repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
bolt/bolt | src/Storage/Database/Schema/SchemaCheck.php | SchemaCheck.getChangedIndexes | private function getChangedIndexes($tableName, TableDiff $diff)
{
/** @var $index \Doctrine\DBAL\Schema\Index */
foreach ($diff->changedIndexes as $index) {
$this->addMessage($tableName, sprintf('invalid index on `%s`', implode(', ', $index->getUnquotedColumns())));
}
} | php | private function getChangedIndexes($tableName, TableDiff $diff)
{
/** @var $index \Doctrine\DBAL\Schema\Index */
foreach ($diff->changedIndexes as $index) {
$this->addMessage($tableName, sprintf('invalid index on `%s`', implode(', ', $index->getUnquotedColumns())));
}
} | [
"private",
"function",
"getChangedIndexes",
"(",
"$",
"tableName",
",",
"TableDiff",
"$",
"diff",
")",
"{",
"/** @var $index \\Doctrine\\DBAL\\Schema\\Index */",
"foreach",
"(",
"$",
"diff",
"->",
"changedIndexes",
"as",
"$",
"index",
")",
"{",
"$",
"this",
"->",
... | Record changed indexes.
@param string $tableName
@param TableDiff $diff | [
"Record",
"changed",
"indexes",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Database/Schema/SchemaCheck.php#L226-L232 |
bolt/bolt | src/Storage/Database/Schema/SchemaCheck.php | SchemaCheck.getRemovedColumns | private function getRemovedColumns($tableName, TableDiff $diff)
{
foreach (array_keys($diff->removedColumns) as $colName) {
$this->addMessage($tableName, sprintf('removed column `%s`', $colName));
}
} | php | private function getRemovedColumns($tableName, TableDiff $diff)
{
foreach (array_keys($diff->removedColumns) as $colName) {
$this->addMessage($tableName, sprintf('removed column `%s`', $colName));
}
} | [
"private",
"function",
"getRemovedColumns",
"(",
"$",
"tableName",
",",
"TableDiff",
"$",
"diff",
")",
"{",
"foreach",
"(",
"array_keys",
"(",
"$",
"diff",
"->",
"removedColumns",
")",
"as",
"$",
"colName",
")",
"{",
"$",
"this",
"->",
"addMessage",
"(",
... | Record removed columns.
@param string $tableName
@param TableDiff $diff | [
"Record",
"removed",
"columns",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Database/Schema/SchemaCheck.php#L240-L245 |
bolt/bolt | src/Storage/Database/Schema/SchemaCheck.php | SchemaCheck.getRemovedIndexes | private function getRemovedIndexes($tableName, TableDiff $diff)
{
foreach (array_keys($diff->removedIndexes) as $indexName) {
$this->addMessage($tableName, sprintf('removed index `%s`', $indexName));
}
} | php | private function getRemovedIndexes($tableName, TableDiff $diff)
{
foreach (array_keys($diff->removedIndexes) as $indexName) {
$this->addMessage($tableName, sprintf('removed index `%s`', $indexName));
}
} | [
"private",
"function",
"getRemovedIndexes",
"(",
"$",
"tableName",
",",
"TableDiff",
"$",
"diff",
")",
"{",
"foreach",
"(",
"array_keys",
"(",
"$",
"diff",
"->",
"removedIndexes",
")",
"as",
"$",
"indexName",
")",
"{",
"$",
"this",
"->",
"addMessage",
"(",... | Record removed indexes.
@param string $tableName
@param TableDiff $diff | [
"Record",
"removed",
"indexes",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Database/Schema/SchemaCheck.php#L253-L258 |
bolt/bolt | src/Storage/Database/Schema/SchemaCheck.php | SchemaCheck.getRenamedColumns | private function getRenamedColumns($tableName, TableDiff $diff)
{
foreach (array_keys($diff->renamedColumns) as $colName) {
$this->addMessage($tableName, sprintf('renamed column `%s`', $colName));
}
} | php | private function getRenamedColumns($tableName, TableDiff $diff)
{
foreach (array_keys($diff->renamedColumns) as $colName) {
$this->addMessage($tableName, sprintf('renamed column `%s`', $colName));
}
} | [
"private",
"function",
"getRenamedColumns",
"(",
"$",
"tableName",
",",
"TableDiff",
"$",
"diff",
")",
"{",
"foreach",
"(",
"array_keys",
"(",
"$",
"diff",
"->",
"renamedColumns",
")",
"as",
"$",
"colName",
")",
"{",
"$",
"this",
"->",
"addMessage",
"(",
... | Record renamed columns.
@param string $tableName
@param TableDiff $diff | [
"Record",
"renamed",
"columns",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Database/Schema/SchemaCheck.php#L266-L271 |
bolt/bolt | src/Storage/Database/Schema/SchemaCheck.php | SchemaCheck.getAddedForeignKeys | private function getAddedForeignKeys($tableName, TableDiff $diff)
{
foreach ($diff->addedForeignKeys as $foreignKey) {
$this->addForeignKeysMessage($tableName, $foreignKey, 'missing foreign key on `%s` related to `%s.%s`');
}
} | php | private function getAddedForeignKeys($tableName, TableDiff $diff)
{
foreach ($diff->addedForeignKeys as $foreignKey) {
$this->addForeignKeysMessage($tableName, $foreignKey, 'missing foreign key on `%s` related to `%s.%s`');
}
} | [
"private",
"function",
"getAddedForeignKeys",
"(",
"$",
"tableName",
",",
"TableDiff",
"$",
"diff",
")",
"{",
"foreach",
"(",
"$",
"diff",
"->",
"addedForeignKeys",
"as",
"$",
"foreignKey",
")",
"{",
"$",
"this",
"->",
"addForeignKeysMessage",
"(",
"$",
"tab... | Record added foreign key(s).
@param string $tableName
@param TableDiff $diff | [
"Record",
"added",
"foreign",
"key",
"(",
"s",
")",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Database/Schema/SchemaCheck.php#L279-L284 |
bolt/bolt | src/Storage/Database/Schema/SchemaCheck.php | SchemaCheck.getChangedForeignKeys | private function getChangedForeignKeys($tableName, TableDiff $diff)
{
foreach ($diff->changedForeignKeys as $foreignKey) {
$this->addForeignKeysMessage($tableName, $foreignKey, 'changed foreign key on `%s`, it is now related to `%s.%s`');
}
} | php | private function getChangedForeignKeys($tableName, TableDiff $diff)
{
foreach ($diff->changedForeignKeys as $foreignKey) {
$this->addForeignKeysMessage($tableName, $foreignKey, 'changed foreign key on `%s`, it is now related to `%s.%s`');
}
} | [
"private",
"function",
"getChangedForeignKeys",
"(",
"$",
"tableName",
",",
"TableDiff",
"$",
"diff",
")",
"{",
"foreach",
"(",
"$",
"diff",
"->",
"changedForeignKeys",
"as",
"$",
"foreignKey",
")",
"{",
"$",
"this",
"->",
"addForeignKeysMessage",
"(",
"$",
... | Record changed foreign key(s).
@param string $tableName
@param TableDiff $diff | [
"Record",
"changed",
"foreign",
"key",
"(",
"s",
")",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Database/Schema/SchemaCheck.php#L292-L297 |
bolt/bolt | src/Storage/Database/Schema/SchemaCheck.php | SchemaCheck.addForeignKeysMessage | private function addForeignKeysMessage($tableName, ForeignKeyConstraint $foreignKey, $format)
{
$this->addMessage(
$tableName,
sprintf(
$format,
implode(', ', $foreignKey->getUnquotedLocalColumns()),
$foreignKey->getForeignTableName(),
... | php | private function addForeignKeysMessage($tableName, ForeignKeyConstraint $foreignKey, $format)
{
$this->addMessage(
$tableName,
sprintf(
$format,
implode(', ', $foreignKey->getUnquotedLocalColumns()),
$foreignKey->getForeignTableName(),
... | [
"private",
"function",
"addForeignKeysMessage",
"(",
"$",
"tableName",
",",
"ForeignKeyConstraint",
"$",
"foreignKey",
",",
"$",
"format",
")",
"{",
"$",
"this",
"->",
"addMessage",
"(",
"$",
"tableName",
",",
"sprintf",
"(",
"$",
"format",
",",
"implode",
"... | Add a message for a foreign key change.
@param string $tableName
@param ForeignKeyConstraint $foreignKey
@param string $format | [
"Add",
"a",
"message",
"for",
"a",
"foreign",
"key",
"change",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Database/Schema/SchemaCheck.php#L306-L317 |
bolt/bolt | src/Storage/Database/Schema/SchemaCheck.php | SchemaCheck.getRemovedForeignKeys | private function getRemovedForeignKeys($tableName, TableDiff $diff)
{
foreach ($diff->removedForeignKeys as $index) {
$this->addMessage($tableName, sprintf('removed foreign key from `%s`', implode(', ', $index->getUnquotedLocalColumns())));
}
} | php | private function getRemovedForeignKeys($tableName, TableDiff $diff)
{
foreach ($diff->removedForeignKeys as $index) {
$this->addMessage($tableName, sprintf('removed foreign key from `%s`', implode(', ', $index->getUnquotedLocalColumns())));
}
} | [
"private",
"function",
"getRemovedForeignKeys",
"(",
"$",
"tableName",
",",
"TableDiff",
"$",
"diff",
")",
"{",
"foreach",
"(",
"$",
"diff",
"->",
"removedForeignKeys",
"as",
"$",
"index",
")",
"{",
"$",
"this",
"->",
"addMessage",
"(",
"$",
"tableName",
"... | Record removed foreign key(s).
@param string $tableName
@param TableDiff $diff | [
"Record",
"removed",
"foreign",
"key",
"(",
"s",
")",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Database/Schema/SchemaCheck.php#L325-L330 |
bolt/bolt | src/Storage/Database/Schema/Comparison/DiffUpdater.php | DiffUpdater.adjustDiff | public function adjustDiff(TableDiff $tableDiff)
{
/** @var IgnoredChange $ignoredChange */
foreach ($this->ignoredChanges as $ignoredChange) {
$alterName = $ignoredChange->getAlteration();
// Array like 'changedColumns', 'changedIndexes', or 'changedForeignKeys'
... | php | public function adjustDiff(TableDiff $tableDiff)
{
/** @var IgnoredChange $ignoredChange */
foreach ($this->ignoredChanges as $ignoredChange) {
$alterName = $ignoredChange->getAlteration();
// Array like 'changedColumns', 'changedIndexes', or 'changedForeignKeys'
... | [
"public",
"function",
"adjustDiff",
"(",
"TableDiff",
"$",
"tableDiff",
")",
"{",
"/** @var IgnoredChange $ignoredChange */",
"foreach",
"(",
"$",
"this",
"->",
"ignoredChanges",
"as",
"$",
"ignoredChange",
")",
"{",
"$",
"alterName",
"=",
"$",
"ignoredChange",
"-... | Platform specific adjustments to table/column diffs.
@param TableDiff $tableDiff
@return TableDiff|false | [
"Platform",
"specific",
"adjustments",
"to",
"table",
"/",
"column",
"diffs",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Database/Schema/Comparison/DiffUpdater.php#L54-L71 |
bolt/bolt | src/Storage/Database/Schema/Comparison/DiffUpdater.php | DiffUpdater.checkChangedProperties | protected function checkChangedProperties(TableDiff $tableDiff, array $schemaUpdateType, $alterName, IgnoredChange $ignoredChange)
{
foreach ($schemaUpdateType as $columnName => $changeObject) {
// Function name we need to call
$func = $this->paramMap[$alterName];
$needsU... | php | protected function checkChangedProperties(TableDiff $tableDiff, array $schemaUpdateType, $alterName, IgnoredChange $ignoredChange)
{
foreach ($schemaUpdateType as $columnName => $changeObject) {
// Function name we need to call
$func = $this->paramMap[$alterName];
$needsU... | [
"protected",
"function",
"checkChangedProperties",
"(",
"TableDiff",
"$",
"tableDiff",
",",
"array",
"$",
"schemaUpdateType",
",",
"$",
"alterName",
",",
"IgnoredChange",
"$",
"ignoredChange",
")",
"{",
"foreach",
"(",
"$",
"schemaUpdateType",
"as",
"$",
"columnNa... | Check individual diff properties.
@param TableDiff $tableDiff
@param array $schemaUpdateType
@param string $alterName
@param IgnoredChange $ignoredChange | [
"Check",
"individual",
"diff",
"properties",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Database/Schema/Comparison/DiffUpdater.php#L81-L91 |
bolt/bolt | src/Storage/Database/Schema/Comparison/DiffUpdater.php | DiffUpdater.checkColumn | protected function checkColumn(Column $column, IgnoredChange $ignoredChange)
{
// Not needed to be implemented yet
if ($ignoredChange->getPropertyName() !== $column->getName()) {
return false;
}
return false;
} | php | protected function checkColumn(Column $column, IgnoredChange $ignoredChange)
{
// Not needed to be implemented yet
if ($ignoredChange->getPropertyName() !== $column->getName()) {
return false;
}
return false;
} | [
"protected",
"function",
"checkColumn",
"(",
"Column",
"$",
"column",
",",
"IgnoredChange",
"$",
"ignoredChange",
")",
"{",
"// Not needed to be implemented yet",
"if",
"(",
"$",
"ignoredChange",
"->",
"getPropertyName",
"(",
")",
"!==",
"$",
"column",
"->",
"getN... | Do checks for columns.
@param Column $column
@param IgnoredChange $ignoredChange
@return bool | [
"Do",
"checks",
"for",
"columns",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Database/Schema/Comparison/DiffUpdater.php#L101-L109 |
bolt/bolt | src/Storage/Database/Schema/Comparison/DiffUpdater.php | DiffUpdater.checkColumnDiff | protected function checkColumnDiff(ColumnDiff $columnDiff, IgnoredChange $ignoredChange)
{
if (count($columnDiff->changedProperties) !== 1 && !$columnDiff->hasChanged($ignoredChange->getPropertyName())) {
return false;
}
$propertyName = $columnDiff->changedProperties[0];
... | php | protected function checkColumnDiff(ColumnDiff $columnDiff, IgnoredChange $ignoredChange)
{
if (count($columnDiff->changedProperties) !== 1 && !$columnDiff->hasChanged($ignoredChange->getPropertyName())) {
return false;
}
$propertyName = $columnDiff->changedProperties[0];
... | [
"protected",
"function",
"checkColumnDiff",
"(",
"ColumnDiff",
"$",
"columnDiff",
",",
"IgnoredChange",
"$",
"ignoredChange",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"columnDiff",
"->",
"changedProperties",
")",
"!==",
"1",
"&&",
"!",
"$",
"columnDiff",
"->",
... | Do checks for column diffs.
@param ColumnDiff $columnDiff
@param IgnoredChange $ignoredChange
@return bool | [
"Do",
"checks",
"for",
"column",
"diffs",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Database/Schema/Comparison/DiffUpdater.php#L119-L133 |
bolt/bolt | src/Storage/Database/Schema/Comparison/DiffUpdater.php | DiffUpdater.checkIndex | protected function checkIndex(Index $index, IgnoredChange $ignoredChange)
{
// Not needed to be implemented yet
if ($ignoredChange->getPropertyName() !== $index->getName()) {
return false;
}
return false;
} | php | protected function checkIndex(Index $index, IgnoredChange $ignoredChange)
{
// Not needed to be implemented yet
if ($ignoredChange->getPropertyName() !== $index->getName()) {
return false;
}
return false;
} | [
"protected",
"function",
"checkIndex",
"(",
"Index",
"$",
"index",
",",
"IgnoredChange",
"$",
"ignoredChange",
")",
"{",
"// Not needed to be implemented yet",
"if",
"(",
"$",
"ignoredChange",
"->",
"getPropertyName",
"(",
")",
"!==",
"$",
"index",
"->",
"getName"... | Do checks for indexes.
@param Index $index
@param IgnoredChange $ignoredChange
@return bool | [
"Do",
"checks",
"for",
"indexes",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Database/Schema/Comparison/DiffUpdater.php#L143-L151 |
bolt/bolt | src/Storage/Database/Schema/Comparison/DiffUpdater.php | DiffUpdater.checkForeignKeyConstraint | protected function checkForeignKeyConstraint(ForeignKeyConstraint $foreignKeyConstraint, IgnoredChange $ignoredChange)
{
// Not needed to be implemented yet
if ($ignoredChange->getPropertyName() !== $foreignKeyConstraint->getName()) {
return false;
}
return false;
} | php | protected function checkForeignKeyConstraint(ForeignKeyConstraint $foreignKeyConstraint, IgnoredChange $ignoredChange)
{
// Not needed to be implemented yet
if ($ignoredChange->getPropertyName() !== $foreignKeyConstraint->getName()) {
return false;
}
return false;
} | [
"protected",
"function",
"checkForeignKeyConstraint",
"(",
"ForeignKeyConstraint",
"$",
"foreignKeyConstraint",
",",
"IgnoredChange",
"$",
"ignoredChange",
")",
"{",
"// Not needed to be implemented yet",
"if",
"(",
"$",
"ignoredChange",
"->",
"getPropertyName",
"(",
")",
... | Do checks for foreignKey constraints.
@param ForeignKeyConstraint $foreignKeyConstraint
@param IgnoredChange $ignoredChange
@return bool | [
"Do",
"checks",
"for",
"foreignKey",
"constraints",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Database/Schema/Comparison/DiffUpdater.php#L161-L169 |
bolt/bolt | src/Storage/Database/Schema/Comparison/DiffUpdater.php | DiffUpdater.updateDiffTable | private function updateDiffTable(TableDiff $diff)
{
foreach (array_keys($this->paramMap) as $param) {
if (!empty($diff->{$param})) {
return $diff;
}
}
return false;
} | php | private function updateDiffTable(TableDiff $diff)
{
foreach (array_keys($this->paramMap) as $param) {
if (!empty($diff->{$param})) {
return $diff;
}
}
return false;
} | [
"private",
"function",
"updateDiffTable",
"(",
"TableDiff",
"$",
"diff",
")",
"{",
"foreach",
"(",
"array_keys",
"(",
"$",
"this",
"->",
"paramMap",
")",
"as",
"$",
"param",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"diff",
"->",
"{",
"$",
"param"... | After post-processing a diff, check if we have anything left and respond
as Comparator::diffTable() would.
@param TableDiff $diff
@return TableDiff|false | [
"After",
"post",
"-",
"processing",
"a",
"diff",
"check",
"if",
"we",
"have",
"anything",
"left",
"and",
"respond",
"as",
"Comparator",
"::",
"diffTable",
"()",
"would",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Database/Schema/Comparison/DiffUpdater.php#L179-L188 |
bolt/bolt | src/Nut/Output/Capture.php | Capture.chunk | private function chunk($text, $width)
{
$chunks = [];
$current = '';
$currentLength = 0;
$styleStack = [];
$bufferLength = mb_strwidth($text);
for ($i = 0; $i < $bufferLength; ++$i) {
if ($text[$i] === "\033") { // start of formatting?
// ... | php | private function chunk($text, $width)
{
$chunks = [];
$current = '';
$currentLength = 0;
$styleStack = [];
$bufferLength = mb_strwidth($text);
for ($i = 0; $i < $bufferLength; ++$i) {
if ($text[$i] === "\033") { // start of formatting?
// ... | [
"private",
"function",
"chunk",
"(",
"$",
"text",
",",
"$",
"width",
")",
"{",
"$",
"chunks",
"=",
"[",
"]",
";",
"$",
"current",
"=",
"''",
";",
"$",
"currentLength",
"=",
"0",
";",
"$",
"styleStack",
"=",
"[",
"]",
";",
"$",
"bufferLength",
"="... | Splits buffer into parts of given width accounting for ANSI styling.
@param string $text
@param int $width
@return string[] | [
"Splits",
"buffer",
"into",
"parts",
"of",
"given",
"width",
"accounting",
"for",
"ANSI",
"styling",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/Output/Capture.php#L97-L150 |
bolt/bolt | src/Exception/BootException.php | BootException.earlyExceptionVersion | public static function earlyExceptionVersion()
{
$message = <<<EOM
Bolt requires PHP <u>5.5.9</u>, or higher.
<br><br>
You are running PHP <u>%s</u>, so Bolt will not run on your current setup.
EOM;
$message = sprintf($message, htmlspecialchars(PHP_VERSION, ENT_QUOTES));
echo sprintf(stati... | php | public static function earlyExceptionVersion()
{
$message = <<<EOM
Bolt requires PHP <u>5.5.9</u>, or higher.
<br><br>
You are running PHP <u>%s</u>, so Bolt will not run on your current setup.
EOM;
$message = sprintf($message, htmlspecialchars(PHP_VERSION, ENT_QUOTES));
echo sprintf(stati... | [
"public",
"static",
"function",
"earlyExceptionVersion",
"(",
")",
"{",
"$",
"message",
"=",
" <<<EOM\nBolt requires PHP <u>5.5.9</u>, or higher. \n<br><br>\nYou are running PHP <u>%s</u>, so Bolt will not run on your current setup.\nEOM",
";",
"$",
"message",
"=",
"sprintf",
"(",
... | Exception due to a PHP version being unsupported. | [
"Exception",
"due",
"to",
"a",
"PHP",
"version",
"being",
"unsupported",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Exception/BootException.php#L90-L102 |
bolt/bolt | src/Composer/Script/ScriptHandlerUpdater.php | ScriptHandlerUpdater.updateAutomatically | private function updateAutomatically()
{
$source = $this->event->getComposer()->getConfig()->getConfigSource();
$file = new JsonFile($source->getName(), null, $this->io);
$contents = $file->read();
$this->scripts = $contents['scripts'] = $this->modifyScripts($contents['scripts']);
... | php | private function updateAutomatically()
{
$source = $this->event->getComposer()->getConfig()->getConfigSource();
$file = new JsonFile($source->getName(), null, $this->io);
$contents = $file->read();
$this->scripts = $contents['scripts'] = $this->modifyScripts($contents['scripts']);
... | [
"private",
"function",
"updateAutomatically",
"(",
")",
"{",
"$",
"source",
"=",
"$",
"this",
"->",
"event",
"->",
"getComposer",
"(",
")",
"->",
"getConfig",
"(",
")",
"->",
"getConfigSource",
"(",
")",
";",
"$",
"file",
"=",
"new",
"JsonFile",
"(",
"... | Update composer.json file. | [
"Update",
"composer",
".",
"json",
"file",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/Script/ScriptHandlerUpdater.php#L64-L80 |
bolt/bolt | src/Composer/Script/ScriptHandlerUpdater.php | ScriptHandlerUpdater.showHow | private function showHow()
{
if (!$this->scripts) {
$scripts = $this->event->getComposer()->getPackage()->getScripts();
$scripts = $this->modifyScripts($scripts);
} else {
$scripts = $this->scripts;
}
$scripts = substr(JsonFile::encode(['scripts' =... | php | private function showHow()
{
if (!$this->scripts) {
$scripts = $this->event->getComposer()->getPackage()->getScripts();
$scripts = $this->modifyScripts($scripts);
} else {
$scripts = $this->scripts;
}
$scripts = substr(JsonFile::encode(['scripts' =... | [
"private",
"function",
"showHow",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"scripts",
")",
"{",
"$",
"scripts",
"=",
"$",
"this",
"->",
"event",
"->",
"getComposer",
"(",
")",
"->",
"getPackage",
"(",
")",
"->",
"getScripts",
"(",
")",
";"... | Tell users of the change and show how the composer.json file should be updated. | [
"Tell",
"users",
"of",
"the",
"change",
"and",
"show",
"how",
"the",
"composer",
".",
"json",
"file",
"should",
"be",
"updated",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/Script/ScriptHandlerUpdater.php#L85-L106 |
bolt/bolt | src/Composer/Script/ScriptHandlerUpdater.php | ScriptHandlerUpdater.modifyScripts | private function modifyScripts($scripts)
{
$updateScripts = (array) $scripts[ScriptEvents::POST_UPDATE_CMD];
$index = array_search(ScriptHandler::class . '::installAssets', $updateScripts) ?: 0;
array_splice($updateScripts, $index, 1, [ScriptHandler::class . '::updateProject', ScriptHandler... | php | private function modifyScripts($scripts)
{
$updateScripts = (array) $scripts[ScriptEvents::POST_UPDATE_CMD];
$index = array_search(ScriptHandler::class . '::installAssets', $updateScripts) ?: 0;
array_splice($updateScripts, $index, 1, [ScriptHandler::class . '::updateProject', ScriptHandler... | [
"private",
"function",
"modifyScripts",
"(",
"$",
"scripts",
")",
"{",
"$",
"updateScripts",
"=",
"(",
"array",
")",
"$",
"scripts",
"[",
"ScriptEvents",
"::",
"POST_UPDATE_CMD",
"]",
";",
"$",
"index",
"=",
"array_search",
"(",
"ScriptHandler",
"::",
"class... | Add updateProject handler right before installAssets handler.
@param string[] $scripts
@return string[] | [
"Add",
"updateProject",
"handler",
"right",
"before",
"installAssets",
"handler",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/Script/ScriptHandlerUpdater.php#L115-L125 |
bolt/bolt | src/Composer/Script/ScriptHandlerUpdater.php | ScriptHandlerUpdater.hasScript | private function hasScript($eventName, $script)
{
$scripts = $this->event->getComposer()->getPackage()->getScripts();
if (!isset($scripts[$eventName])) {
return false;
}
return in_array($script, $scripts[$eventName]);
} | php | private function hasScript($eventName, $script)
{
$scripts = $this->event->getComposer()->getPackage()->getScripts();
if (!isset($scripts[$eventName])) {
return false;
}
return in_array($script, $scripts[$eventName]);
} | [
"private",
"function",
"hasScript",
"(",
"$",
"eventName",
",",
"$",
"script",
")",
"{",
"$",
"scripts",
"=",
"$",
"this",
"->",
"event",
"->",
"getComposer",
"(",
")",
"->",
"getPackage",
"(",
")",
"->",
"getScripts",
"(",
")",
";",
"if",
"(",
"!",
... | @param string $eventName
@param string $script
@return bool | [
"@param",
"string",
"$eventName",
"@param",
"string",
"$script"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/Script/ScriptHandlerUpdater.php#L133-L141 |
bolt/bolt | src/Controller/Backend/General.php | General.checks | public function checks(Request $request)
{
$defaults = [
'pass' => ['php' => [], 'system' => []],
'fail' => ['php' => [], 'system' => []],
];
$checks = MutableBag::fromRecursive([
'requirements' => $defaults,
'recommendations' => $defaults,
... | php | public function checks(Request $request)
{
$defaults = [
'pass' => ['php' => [], 'system' => []],
'fail' => ['php' => [], 'system' => []],
];
$checks = MutableBag::fromRecursive([
'requirements' => $defaults,
'recommendations' => $defaults,
... | [
"public",
"function",
"checks",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"defaults",
"=",
"[",
"'pass'",
"=>",
"[",
"'php'",
"=>",
"[",
"]",
",",
"'system'",
"=>",
"[",
"]",
"]",
",",
"'fail'",
"=>",
"[",
"'php'",
"=>",
"[",
"]",
",",
"'sys... | Configuration checks/tests route.
@param Request $request
@return \Bolt\Response\TemplateResponse | [
"Configuration",
"checks",
"/",
"tests",
"route",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Backend/General.php#L74-L108 |
bolt/bolt | src/Controller/Backend/General.php | General.clearCache | public function clearCache()
{
$result = $this->app['cache']->flushAll();
if ($result) {
$this->flashes()->success(Trans::__('general.phrase.clear-cache-complete'));
} else {
$this->flashes()->error(Trans::__('general.phrase.error-cache-clear'));
}
r... | php | public function clearCache()
{
$result = $this->app['cache']->flushAll();
if ($result) {
$this->flashes()->success(Trans::__('general.phrase.clear-cache-complete'));
} else {
$this->flashes()->error(Trans::__('general.phrase.error-cache-clear'));
}
r... | [
"public",
"function",
"clearCache",
"(",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"app",
"[",
"'cache'",
"]",
"->",
"flushAll",
"(",
")",
";",
"if",
"(",
"$",
"result",
")",
"{",
"$",
"this",
"->",
"flashes",
"(",
")",
"->",
"success",
"(... | Clear the cache.
@return \Bolt\Response\TemplateResponse | [
"Clear",
"the",
"cache",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Backend/General.php#L115-L126 |
bolt/bolt | src/Controller/Backend/General.php | General.omnisearch | public function omnisearch(Request $request)
{
$query = $request->query->get('q', '');
$records = [];
$others = [];
if (strlen($query) >= 3) {
foreach ($this->app['omnisearch']->query($query, true) as $result) {
if (isset($result['slug'])) {
... | php | public function omnisearch(Request $request)
{
$query = $request->query->get('q', '');
$records = [];
$others = [];
if (strlen($query) >= 3) {
foreach ($this->app['omnisearch']->query($query, true) as $result) {
if (isset($result['slug'])) {
... | [
"public",
"function",
"omnisearch",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"query",
"=",
"$",
"request",
"->",
"query",
"->",
"get",
"(",
"'q'",
",",
"''",
")",
";",
"$",
"records",
"=",
"[",
"]",
";",
"$",
"others",
"=",
"[",
"]",
";",
... | Show the Omnisearch results.
@param Request $request The Symfony Request
@return \Bolt\Response\TemplateResponse | [
"Show",
"the",
"Omnisearch",
"results",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Backend/General.php#L145-L168 |
bolt/bolt | src/Controller/Backend/General.php | General.prefill | public function prefill(Request $request)
{
// Determine the ContentTypes that we're doing the prefill for
$choices = [];
foreach ($this->getOption('contenttypes') as $key => $contentType) {
$nameKey = 'contenttypes.' . $key . '.name.plural';
$nameTrans = Trans::__($n... | php | public function prefill(Request $request)
{
// Determine the ContentTypes that we're doing the prefill for
$choices = [];
foreach ($this->getOption('contenttypes') as $key => $contentType) {
$nameKey = 'contenttypes.' . $key . '.name.plural';
$nameTrans = Trans::__($n... | [
"public",
"function",
"prefill",
"(",
"Request",
"$",
"request",
")",
"{",
"// Determine the ContentTypes that we're doing the prefill for",
"$",
"choices",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"getOption",
"(",
"'contenttypes'",
")",
"as",
"$",
... | Generate Lorem Ipsum records in the database for given ContentTypes.
@param Request $request The Symfony Request
@return \Bolt\Response\TemplateResponse|\Symfony\Component\HttpFoundation\RedirectResponse | [
"Generate",
"Lorem",
"Ipsum",
"records",
"in",
"the",
"database",
"for",
"given",
"ContentTypes",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Backend/General.php#L177-L226 |
bolt/bolt | src/Controller/Backend/General.php | General.translation | public function translation(Request $request, $domain, $tr_locale)
{
$tr = MutableBag::from([
'domain' => $domain,
'locale' => $tr_locale,
]);
// Get the translation data
$data = $this->getTranslationData($tr);
$options = [
'write_allowed'... | php | public function translation(Request $request, $domain, $tr_locale)
{
$tr = MutableBag::from([
'domain' => $domain,
'locale' => $tr_locale,
]);
// Get the translation data
$data = $this->getTranslationData($tr);
$options = [
'write_allowed'... | [
"public",
"function",
"translation",
"(",
"Request",
"$",
"request",
",",
"$",
"domain",
",",
"$",
"tr_locale",
")",
"{",
"$",
"tr",
"=",
"MutableBag",
"::",
"from",
"(",
"[",
"'domain'",
"=>",
"$",
"domain",
",",
"'locale'",
"=>",
"$",
"tr_locale",
",... | Prepare/edit/save a translation.
@param Request $request The Symfony Request
@param string $domain The domain
@param string $tr_locale The translation locale
@return \Bolt\Response\TemplateResponse|\Symfony\Component\HttpFoundation\RedirectResponse | [
"Prepare",
"/",
"edit",
"/",
"save",
"a",
"translation",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Backend/General.php#L237-L272 |
bolt/bolt | src/Controller/Backend/General.php | General.getTranslationData | private function getTranslationData(MutableBag $tr)
{
$translation = new TranslationFile($this->app, $tr->get('domain'), $tr->get('locale'));
list($tr['path'], $tr['shortPath']) = $translation->path();
$tr->set('writeallowed', $translation->isWriteAllowed());
$this->app['logger.sys... | php | private function getTranslationData(MutableBag $tr)
{
$translation = new TranslationFile($this->app, $tr->get('domain'), $tr->get('locale'));
list($tr['path'], $tr['shortPath']) = $translation->path();
$tr->set('writeallowed', $translation->isWriteAllowed());
$this->app['logger.sys... | [
"private",
"function",
"getTranslationData",
"(",
"MutableBag",
"$",
"tr",
")",
"{",
"$",
"translation",
"=",
"new",
"TranslationFile",
"(",
"$",
"this",
"->",
"app",
",",
"$",
"tr",
"->",
"get",
"(",
"'domain'",
")",
",",
"$",
"tr",
"->",
"get",
"(",
... | Get the translation data.
@param MutableBag $tr
@return array | [
"Get",
"the",
"translation",
"data",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Backend/General.php#L327-L337 |
bolt/bolt | src/Controller/Backend/General.php | General.saveTranslationFile | private function saveTranslationFile($contents, MutableBag $tr)
{
$contents = Input::cleanPostedData($contents) . "\n";
// Clear any warning for file not found, we are creating it here
// we'll set an error if someone still submits the form and write is not allowed
$this->flashes()-... | php | private function saveTranslationFile($contents, MutableBag $tr)
{
$contents = Input::cleanPostedData($contents) . "\n";
// Clear any warning for file not found, we are creating it here
// we'll set an error if someone still submits the form and write is not allowed
$this->flashes()-... | [
"private",
"function",
"saveTranslationFile",
"(",
"$",
"contents",
",",
"MutableBag",
"$",
"tr",
")",
"{",
"$",
"contents",
"=",
"Input",
"::",
"cleanPostedData",
"(",
"$",
"contents",
")",
".",
"\"\\n\"",
";",
"// Clear any warning for file not found, we are creat... | Attempt to save the POST data for a translation file edit.
@param string $contents
@param MutableBag $tr
@return bool|\Symfony\Component\HttpFoundation\RedirectResponse | [
"Attempt",
"to",
"save",
"the",
"POST",
"data",
"for",
"a",
"translation",
"file",
"edit",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Backend/General.php#L347-L370 |
bolt/bolt | src/Storage/Query/Handler/SelectQueryHandler.php | SelectQueryHandler.whitelistParameters | public function whitelistParameters(array $queryParams, Repository $repo)
{
$metadata = $repo->getClassMetadata();
$allowedParams = array_keys($metadata->getFieldMappings());
$cleanParams = [];
foreach ($queryParams as $fieldSelect => $valueSelect) {
$stack = [];
... | php | public function whitelistParameters(array $queryParams, Repository $repo)
{
$metadata = $repo->getClassMetadata();
$allowedParams = array_keys($metadata->getFieldMappings());
$cleanParams = [];
foreach ($queryParams as $fieldSelect => $valueSelect) {
$stack = [];
... | [
"public",
"function",
"whitelistParameters",
"(",
"array",
"$",
"queryParams",
",",
"Repository",
"$",
"repo",
")",
"{",
"$",
"metadata",
"=",
"$",
"repo",
"->",
"getClassMetadata",
"(",
")",
";",
"$",
"allowedParams",
"=",
"array_keys",
"(",
"$",
"metadata"... | This block is added to deal with the possibility that a requested filter is not an allowable option on the
database table. If the requested field filter is not a valid field on this table then we completely skip
the query because no results will be expected if the field does not exist. The exception to this is if the f... | [
"This",
"block",
"is",
"added",
"to",
"deal",
"with",
"the",
"possibility",
"that",
"a",
"requested",
"filter",
"is",
"not",
"an",
"allowable",
"option",
"on",
"the",
"database",
"table",
".",
"If",
"the",
"requested",
"field",
"filter",
"is",
"not",
"a",
... | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Query/Handler/SelectQueryHandler.php#L76-L113 |
bolt/bolt | src/EventListener/PagerListener.php | PagerListener.onRequest | public function onRequest(GetResponseEvent $event)
{
if (!$event->isMasterRequest()) {
return;
}
$this->manager->initialize($event->getRequest());
} | php | public function onRequest(GetResponseEvent $event)
{
if (!$event->isMasterRequest()) {
return;
}
$this->manager->initialize($event->getRequest());
} | [
"public",
"function",
"onRequest",
"(",
"GetResponseEvent",
"$",
"event",
")",
"{",
"if",
"(",
"!",
"$",
"event",
"->",
"isMasterRequest",
"(",
")",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"manager",
"->",
"initialize",
"(",
"$",
"event",
"->"... | Resume the session if it has been started previously or debugging is enabled.
@param GetResponseEvent $event
@throws \Bolt\Exception\PagerOverrideException | [
"Resume",
"the",
"session",
"if",
"it",
"has",
"been",
"started",
"previously",
"or",
"debugging",
"is",
"enabled",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/EventListener/PagerListener.php#L43-L50 |
bolt/bolt | src/EventListener/PagerListener.php | PagerListener.getCountQuery | private function getCountQuery(QueryBuilder $query)
{
$queryCopy = clone $query;
$queryCopy
->select('count(*)')
->setMaxResults(null)
->setFirstResult(null)
->resetQueryPart('orderBy')
;
return $queryCopy->execute()->fetchAll();
} | php | private function getCountQuery(QueryBuilder $query)
{
$queryCopy = clone $query;
$queryCopy
->select('count(*)')
->setMaxResults(null)
->setFirstResult(null)
->resetQueryPart('orderBy')
;
return $queryCopy->execute()->fetchAll();
} | [
"private",
"function",
"getCountQuery",
"(",
"QueryBuilder",
"$",
"query",
")",
"{",
"$",
"queryCopy",
"=",
"clone",
"$",
"query",
";",
"$",
"queryCopy",
"->",
"select",
"(",
"'count(*)'",
")",
"->",
"setMaxResults",
"(",
"null",
")",
"->",
"setFirstResult",... | @param QueryBuilder $query
@return array | [
"@param",
"QueryBuilder",
"$query"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/EventListener/PagerListener.php#L140-L151 |
bolt/bolt | src/Exception/LowlevelException.php | LowlevelException.catchFatalErrorsEarly | public static function catchFatalErrorsEarly()
{
$error = error_get_last();
if (($error['type'] === E_ERROR || $error['type'] === E_PARSE)) {
echo nl2br(str_replace(dirname(dirname(__DIR__)), '', $error['message']));
}
} | php | public static function catchFatalErrorsEarly()
{
$error = error_get_last();
if (($error['type'] === E_ERROR || $error['type'] === E_PARSE)) {
echo nl2br(str_replace(dirname(dirname(__DIR__)), '', $error['message']));
}
} | [
"public",
"static",
"function",
"catchFatalErrorsEarly",
"(",
")",
"{",
"$",
"error",
"=",
"error_get_last",
"(",
")",
";",
"if",
"(",
"(",
"$",
"error",
"[",
"'type'",
"]",
"===",
"E_ERROR",
"||",
"$",
"error",
"[",
"'type'",
"]",
"===",
"E_PARSE",
")... | Catch and display errors that occur before the Application object has
been instantiated.
If the error occurs later in the application life cycle, we flush this
output in catchFatalErrors() which has access to the Application object. | [
"Catch",
"and",
"display",
"errors",
"that",
"occur",
"before",
"the",
"Application",
"object",
"has",
"been",
"instantiated",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Exception/LowlevelException.php#L107-L113 |
bolt/bolt | src/Exception/LowlevelException.php | LowlevelException.catchFatalErrors | public static function catchFatalErrors(Application $app, $flush = true)
{
if (self::$screen !== null) {
echo self::$screen;
return;
}
// Get last error, if any
$error = error_get_last();
// Let Whoops handle AJAX requested fatal errors
if (... | php | public static function catchFatalErrors(Application $app, $flush = true)
{
if (self::$screen !== null) {
echo self::$screen;
return;
}
// Get last error, if any
$error = error_get_last();
// Let Whoops handle AJAX requested fatal errors
if (... | [
"public",
"static",
"function",
"catchFatalErrors",
"(",
"Application",
"$",
"app",
",",
"$",
"flush",
"=",
"true",
")",
"{",
"if",
"(",
"self",
"::",
"$",
"screen",
"!==",
"null",
")",
"{",
"echo",
"self",
"::",
"$",
"screen",
";",
"return",
";",
"}... | Callback for register_shutdown_function() to handle fatal errors.
@param \Silex\Application $app
@param bool $flush | [
"Callback",
"for",
"register_shutdown_function",
"()",
"to",
"handle",
"fatal",
"errors",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Exception/LowlevelException.php#L121-L198 |
bolt/bolt | src/Exception/LowlevelException.php | LowlevelException.cleanHTML | private static function cleanHTML($output)
{
$output = preg_replace('/<title>.*<\/title>/smi', '', $output);
$output = preg_replace('/<style>.*<\/style>/smi', '', $output);
$output = strip_tags($output);
$output = preg_replace('/(\n+)(\s+)/smi', "\n", $output);
$output = preg... | php | private static function cleanHTML($output)
{
$output = preg_replace('/<title>.*<\/title>/smi', '', $output);
$output = preg_replace('/<style>.*<\/style>/smi', '', $output);
$output = strip_tags($output);
$output = preg_replace('/(\n+)(\s+)/smi', "\n", $output);
$output = preg... | [
"private",
"static",
"function",
"cleanHTML",
"(",
"$",
"output",
")",
"{",
"$",
"output",
"=",
"preg_replace",
"(",
"'/<title>.*<\\/title>/smi'",
",",
"''",
",",
"$",
"output",
")",
";",
"$",
"output",
"=",
"preg_replace",
"(",
"'/<style>.*<\\/style>/smi'",
"... | Remove HTML elements from the error output.
@param string $output
@return string | [
"Remove",
"HTML",
"elements",
"from",
"the",
"error",
"output",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Exception/LowlevelException.php#L216-L225 |
bolt/bolt | src/Events/CronEvent.php | CronEvent.doRunScheduledJobs | public function doRunScheduledJobs(Event $event, $eventName)
{
switch ($eventName) {
case CronEvents::CRON_MINUTE:
$this->cronMinute();
break;
case CronEvents::CRON_HOURLY:
$this->cronHourly();
break;
case Cr... | php | public function doRunScheduledJobs(Event $event, $eventName)
{
switch ($eventName) {
case CronEvents::CRON_MINUTE:
$this->cronMinute();
break;
case CronEvents::CRON_HOURLY:
$this->cronHourly();
break;
case Cr... | [
"public",
"function",
"doRunScheduledJobs",
"(",
"Event",
"$",
"event",
",",
"$",
"eventName",
")",
"{",
"switch",
"(",
"$",
"eventName",
")",
"{",
"case",
"CronEvents",
"::",
"CRON_MINUTE",
":",
"$",
"this",
"->",
"cronMinute",
"(",
")",
";",
"break",
"... | Process jobs.
@param Event $event
@param string $eventName | [
"Process",
"jobs",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Events/CronEvent.php#L48-L70 |
bolt/bolt | src/Events/CronEvent.php | CronEvent.cronMinute | private function cronMinute()
{
$timedRecords = $this->app['storage.event_processor.timed'];
if ($timedRecords->isDuePublish()) {
$this->notify('Publishing timed records');
$timedRecords->publishTimedRecords();
}
if ($timedRecords->isDueHold()) {
$... | php | private function cronMinute()
{
$timedRecords = $this->app['storage.event_processor.timed'];
if ($timedRecords->isDuePublish()) {
$this->notify('Publishing timed records');
$timedRecords->publishTimedRecords();
}
if ($timedRecords->isDueHold()) {
$... | [
"private",
"function",
"cronMinute",
"(",
")",
"{",
"$",
"timedRecords",
"=",
"$",
"this",
"->",
"app",
"[",
"'storage.event_processor.timed'",
"]",
";",
"if",
"(",
"$",
"timedRecords",
"->",
"isDuePublish",
"(",
")",
")",
"{",
"$",
"this",
"->",
"notify",... | Minute by minute jobs. | [
"Minute",
"by",
"minute",
"jobs",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Events/CronEvent.php#L76-L87 |
bolt/bolt | src/Events/CronEvent.php | CronEvent.cronWeekly | private function cronWeekly()
{
// Clear the cache
$this->app['cache']->flushAll();
$this->notify('Clearing cache');
// Trim system log files
$this->app['logger.manager']->trim('system');
// Trim change log files
$this->app['logger.manager']->trim('change');... | php | private function cronWeekly()
{
// Clear the cache
$this->app['cache']->flushAll();
$this->notify('Clearing cache');
// Trim system log files
$this->app['logger.manager']->trim('system');
// Trim change log files
$this->app['logger.manager']->trim('change');... | [
"private",
"function",
"cronWeekly",
"(",
")",
"{",
"// Clear the cache",
"$",
"this",
"->",
"app",
"[",
"'cache'",
"]",
"->",
"flushAll",
"(",
")",
";",
"$",
"this",
"->",
"notify",
"(",
"'Clearing cache'",
")",
";",
"// Trim system log files",
"$",
"this",... | Weekly jobs. | [
"Weekly",
"jobs",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Events/CronEvent.php#L107-L120 |
bolt/bolt | src/Storage/Mapping/ClassMetadata.php | ClassMetadata.getTableName | public function getTableName()
{
if ($this->tableName) {
return $this->tableName;
}
return $this->namingStrategy->classToTableName($this->name);
} | php | public function getTableName()
{
if ($this->tableName) {
return $this->tableName;
}
return $this->namingStrategy->classToTableName($this->name);
} | [
"public",
"function",
"getTableName",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"tableName",
")",
"{",
"return",
"$",
"this",
"->",
"tableName",
";",
"}",
"return",
"$",
"this",
"->",
"namingStrategy",
"->",
"classToTableName",
"(",
"$",
"this",
"->",... | Gets the fully-qualified class name of this persistent class.
@return string | [
"Gets",
"the",
"fully",
"-",
"qualified",
"class",
"name",
"of",
"this",
"persistent",
"class",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Mapping/ClassMetadata.php#L68-L75 |
bolt/bolt | src/Storage/Mapping/ClassMetadata.php | ClassMetadata.getFieldMapping | public function getFieldMapping($fieldName)
{
if (!isset($this->fieldMappings[$fieldName])) {
return false;
}
return $this->fieldMappings[$fieldName];
} | php | public function getFieldMapping($fieldName)
{
if (!isset($this->fieldMappings[$fieldName])) {
return false;
}
return $this->fieldMappings[$fieldName];
} | [
"public",
"function",
"getFieldMapping",
"(",
"$",
"fieldName",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"fieldMappings",
"[",
"$",
"fieldName",
"]",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"$",
"this",
"->",
"fieldMappi... | @param $fieldName
@return bool | [
"@param",
"$fieldName"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Mapping/ClassMetadata.php#L126-L133 |
bolt/bolt | src/Provider/SecurityServiceProvider.php | SecurityServiceProvider.register | public function register(Application $app)
{
$app->register(new SilexSecurityServiceProvider());
$app['security.firewalls'] = $app->share(
function ($app) {
$boltPath = $app['config']->get('general/branding/path');
return [
'login_pa... | php | public function register(Application $app)
{
$app->register(new SilexSecurityServiceProvider());
$app['security.firewalls'] = $app->share(
function ($app) {
$boltPath = $app['config']->get('general/branding/path');
return [
'login_pa... | [
"public",
"function",
"register",
"(",
"Application",
"$",
"app",
")",
"{",
"$",
"app",
"->",
"register",
"(",
"new",
"SilexSecurityServiceProvider",
"(",
")",
")",
";",
"$",
"app",
"[",
"'security.firewalls'",
"]",
"=",
"$",
"app",
"->",
"share",
"(",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Provider/SecurityServiceProvider.php#L20-L67 |
bolt/bolt | src/Controller/Base.php | Base.render | protected function render($template, array $context = [], array $globals = [])
{
$twig = $this->app['twig'];
$template = $twig->resolveTemplate($template);
if ($this->getOption('general/compatibility/twig_globals', true)) {
foreach ($globals as $name => $value) {
... | php | protected function render($template, array $context = [], array $globals = [])
{
$twig = $this->app['twig'];
$template = $twig->resolveTemplate($template);
if ($this->getOption('general/compatibility/twig_globals', true)) {
foreach ($globals as $name => $value) {
... | [
"protected",
"function",
"render",
"(",
"$",
"template",
",",
"array",
"$",
"context",
"=",
"[",
"]",
",",
"array",
"$",
"globals",
"=",
"[",
"]",
")",
"{",
"$",
"twig",
"=",
"$",
"this",
"->",
"app",
"[",
"'twig'",
"]",
";",
"$",
"template",
"="... | Renders a template.
@param string|string[] $template Template name(s)
@param array $context Context variables
@param array $globals Global variables
@return TemplateResponse|TemplateView | [
"Renders",
"a",
"template",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Base.php#L78-L107 |
bolt/bolt | src/Controller/Base.php | Base.addResolvedRoute | private function addResolvedRoute(array $context, $template)
{
if (!isset($context['record'])) {
return;
}
$content = $context['record'];
$request = $this->app['request_stack']->getCurrentRequest();
$homepage = $this->getOption('theme/homepage') ?: $this->getOpt... | php | private function addResolvedRoute(array $context, $template)
{
if (!isset($context['record'])) {
return;
}
$content = $context['record'];
$request = $this->app['request_stack']->getCurrentRequest();
$homepage = $this->getOption('theme/homepage') ?: $this->getOpt... | [
"private",
"function",
"addResolvedRoute",
"(",
"array",
"$",
"context",
",",
"$",
"template",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"context",
"[",
"'record'",
"]",
")",
")",
"{",
"return",
";",
"}",
"$",
"content",
"=",
"$",
"context",
"[",
... | Update the route attributes to change the canonical URL generated.
@param array $context
@param string $template | [
"Update",
"the",
"route",
"attributes",
"to",
"change",
"the",
"canonical",
"URL",
"generated",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Base.php#L115-L146 |
bolt/bolt | src/Controller/Base.php | Base.createForm | protected function createForm($type = FormType::class, $data = null, array $options = [])
{
return $this->app['form.factory']->create($type, $data, $options);
} | php | protected function createForm($type = FormType::class, $data = null, array $options = [])
{
return $this->app['form.factory']->create($type, $data, $options);
} | [
"protected",
"function",
"createForm",
"(",
"$",
"type",
"=",
"FormType",
"::",
"class",
",",
"$",
"data",
"=",
"null",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"app",
"[",
"'form.factory'",
"]",
"->",
"crea... | Creates and returns a Form instance from the type of the form.
@param string|FormTypeInterface $type The built type of the form
@param mixed $data The initial data for the form
@param array $options Options for the form
@return Form | [
"Creates",
"and",
"returns",
"a",
"Form",
"instance",
"from",
"the",
"type",
"of",
"the",
"form",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Base.php#L171-L174 |
bolt/bolt | src/Controller/Base.php | Base.createFormBuilder | protected function createFormBuilder($type = FormType::class, $data = null, array $options = [])
{
return $this->app['form.factory']->createBuilder($type, $data, $options);
} | php | protected function createFormBuilder($type = FormType::class, $data = null, array $options = [])
{
return $this->app['form.factory']->createBuilder($type, $data, $options);
} | [
"protected",
"function",
"createFormBuilder",
"(",
"$",
"type",
"=",
"FormType",
"::",
"class",
",",
"$",
"data",
"=",
"null",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"app",
"[",
"'form.factory'",
"]",
"->",
... | Returns a form builder.
@param string|FormTypeInterface $type The type of the form
@param mixed $data The initial data
@param array $options The options
@return FormBuilderInterface The form builder | [
"Returns",
"a",
"form",
"builder",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Base.php#L185-L188 |
bolt/bolt | src/Controller/Base.php | Base.redirectToRoute | protected function redirectToRoute($route, array $parameters = [], $status = 302)
{
return $this->redirect($this->generateUrl($route, $parameters), $status);
} | php | protected function redirectToRoute($route, array $parameters = [], $status = 302)
{
return $this->redirect($this->generateUrl($route, $parameters), $status);
} | [
"protected",
"function",
"redirectToRoute",
"(",
"$",
"route",
",",
"array",
"$",
"parameters",
"=",
"[",
"]",
",",
"$",
"status",
"=",
"302",
")",
"{",
"return",
"$",
"this",
"->",
"redirect",
"(",
"$",
"this",
"->",
"generateUrl",
"(",
"$",
"route",
... | Returns a RedirectResponse to the given route with the given parameters.
@param string $route The name of the route
@param array $parameters An array of parameters
@param int $status The status code to use for the Response
@return \Symfony\Component\HttpFoundation\RedirectResponse | [
"Returns",
"a",
"RedirectResponse",
"to",
"the",
"given",
"route",
"with",
"the",
"given",
"parameters",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Base.php#L229-L232 |
bolt/bolt | src/Controller/Base.php | Base.validateCsrfToken | protected function validateCsrfToken($value = null, $id = 'bolt')
{
if (!$this->isCsrfTokenValid($value, $id)) {
$this->abort(Response::HTTP_BAD_REQUEST, Trans::__('general.phrase.something-went-wrong'));
}
} | php | protected function validateCsrfToken($value = null, $id = 'bolt')
{
if (!$this->isCsrfTokenValid($value, $id)) {
$this->abort(Response::HTTP_BAD_REQUEST, Trans::__('general.phrase.something-went-wrong'));
}
} | [
"protected",
"function",
"validateCsrfToken",
"(",
"$",
"value",
"=",
"null",
",",
"$",
"id",
"=",
"'bolt'",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isCsrfTokenValid",
"(",
"$",
"value",
",",
"$",
"id",
")",
")",
"{",
"$",
"this",
"->",
"abor... | Validates CSRF token and throws HttpException if not.
@param string|null $value the token value or null to use "bolt_csrf_token" parameter from request
@param string $id the token ID
@throws HttpExceptionInterface | [
"Validates",
"CSRF",
"token",
"and",
"throws",
"HttpException",
"if",
"not",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Base.php#L282-L287 |
bolt/bolt | src/Controller/Base.php | Base.isCsrfTokenValid | protected function isCsrfTokenValid($value = null, $id = 'bolt')
{
$token = new CsrfToken($id, $value ?: $this->app['request_stack']->getCurrentRequest()->get('bolt_csrf_token'));
return $this->app['csrf']->isTokenValid($token);
} | php | protected function isCsrfTokenValid($value = null, $id = 'bolt')
{
$token = new CsrfToken($id, $value ?: $this->app['request_stack']->getCurrentRequest()->get('bolt_csrf_token'));
return $this->app['csrf']->isTokenValid($token);
} | [
"protected",
"function",
"isCsrfTokenValid",
"(",
"$",
"value",
"=",
"null",
",",
"$",
"id",
"=",
"'bolt'",
")",
"{",
"$",
"token",
"=",
"new",
"CsrfToken",
"(",
"$",
"id",
",",
"$",
"value",
"?",
":",
"$",
"this",
"->",
"app",
"[",
"'request_stack'"... | Check if csrf token is valid.
@param string|null $value the token value or null to use "bolt_csrf_token" parameter from request
@param string $id the token ID
@return bool | [
"Check",
"if",
"csrf",
"token",
"is",
"valid",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Base.php#L297-L302 |
bolt/bolt | src/Controller/Base.php | Base.hasUsers | protected function hasUsers()
{
try {
$users = $this->app['users']->getUsers();
if (empty($users)) {
return false;
}
return true;
} catch (TableNotFoundException $e) {
return false;
}
} | php | protected function hasUsers()
{
try {
$users = $this->app['users']->getUsers();
if (empty($users)) {
return false;
}
return true;
} catch (TableNotFoundException $e) {
return false;
}
} | [
"protected",
"function",
"hasUsers",
"(",
")",
"{",
"try",
"{",
"$",
"users",
"=",
"$",
"this",
"->",
"app",
"[",
"'users'",
"]",
"->",
"getUsers",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"users",
")",
")",
"{",
"return",
"false",
";",
"}",
... | Check to see if the user table exists and has records.
@return bool | [
"Check",
"to",
"see",
"if",
"the",
"user",
"table",
"exists",
"and",
"has",
"records",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Base.php#L339-L351 |
bolt/bolt | src/Controller/Base.php | Base.getUser | protected function getUser($userId = null)
{
if ($userId === null) {
/** @var Token $sessionAuth */
if ($this->session()->isStarted() && $sessionAuth = $this->session()->get('authentication')) {
return $sessionAuth->getUser();
}
return false;
... | php | protected function getUser($userId = null)
{
if ($userId === null) {
/** @var Token $sessionAuth */
if ($this->session()->isStarted() && $sessionAuth = $this->session()->get('authentication')) {
return $sessionAuth->getUser();
}
return false;
... | [
"protected",
"function",
"getUser",
"(",
"$",
"userId",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"userId",
"===",
"null",
")",
"{",
"/** @var Token $sessionAuth */",
"if",
"(",
"$",
"this",
"->",
"session",
"(",
")",
"->",
"isStarted",
"(",
")",
"&&",
"$... | Return current user or user by ID.
@param int|string|null $userId
@return Entity\Users|false | [
"Return",
"current",
"user",
"or",
"user",
"by",
"ID",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Base.php#L360-L374 |
bolt/bolt | src/Controller/Base.php | Base.isAllowed | protected function isAllowed($what, $user = null, $contenttype = null, $contentid = null)
{
/** @var Token $sessionAuth */
if ($user === null && $sessionAuth = $this->session()->get('authentication')) {
$user = $sessionAuth->getUser()->toArray();
}
return $this->app['per... | php | protected function isAllowed($what, $user = null, $contenttype = null, $contentid = null)
{
/** @var Token $sessionAuth */
if ($user === null && $sessionAuth = $this->session()->get('authentication')) {
$user = $sessionAuth->getUser()->toArray();
}
return $this->app['per... | [
"protected",
"function",
"isAllowed",
"(",
"$",
"what",
",",
"$",
"user",
"=",
"null",
",",
"$",
"contenttype",
"=",
"null",
",",
"$",
"contentid",
"=",
"null",
")",
"{",
"/** @var Token $sessionAuth */",
"if",
"(",
"$",
"user",
"===",
"null",
"&&",
"$",... | Shortcut for {@see \Bolt\AccessControl\Permissions::isAllowed}.
@param string $what
@param mixed $user the user to check permissions against
@param string|null $contenttype
@param int|null $contentid
@return bool | [
"Shortcut",
"for",
"{",
"@see",
"\\",
"Bolt",
"\\",
"AccessControl",
"\\",
"Permissions",
"::",
"isAllowed",
"}",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Base.php#L386-L394 |
bolt/bolt | src/Controller/Base.php | Base.getContent | protected function getContent($textQuery, $parameters = [], &$pager = [], $whereParameters = [])
{
$isLegacy = $this->getOption('general/compatibility/setcontent_legacy', true);
if ($isLegacy) {
return $this->storage()->getContent($textQuery, $parameters, $pager, $whereParameters);
... | php | protected function getContent($textQuery, $parameters = [], &$pager = [], $whereParameters = [])
{
$isLegacy = $this->getOption('general/compatibility/setcontent_legacy', true);
if ($isLegacy) {
return $this->storage()->getContent($textQuery, $parameters, $pager, $whereParameters);
... | [
"protected",
"function",
"getContent",
"(",
"$",
"textQuery",
",",
"$",
"parameters",
"=",
"[",
"]",
",",
"&",
"$",
"pager",
"=",
"[",
"]",
",",
"$",
"whereParameters",
"=",
"[",
"]",
")",
"{",
"$",
"isLegacy",
"=",
"$",
"this",
"->",
"getOption",
... | Shortcut for {@see \Bolt\Legacy\Storage::getContent()}.
@param string $textQuery
@param array $parameters
@param array $pager
@param array $whereParameters
@return \Bolt\Legacy\Content|\Bolt\Legacy\Content[]
@see \Bolt\Legacy\Storage::getContent() | [
"Shortcut",
"for",
"{",
"@see",
"\\",
"Bolt",
"\\",
"Legacy",
"\\",
"Storage",
"::",
"getContent",
"()",
"}",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Base.php#L420-L430 |
bolt/bolt | src/Controller/Base.php | Base.getContentTypeUserPermissions | protected function getContentTypeUserPermissions($contentTypeSlug, $user = null)
{
if ($user === null) {
return $this->app['permissions']->getContentTypePermissions();
}
return $this->app['permissions']->getContentTypeUserPermissions($contentTypeSlug, $user);
} | php | protected function getContentTypeUserPermissions($contentTypeSlug, $user = null)
{
if ($user === null) {
return $this->app['permissions']->getContentTypePermissions();
}
return $this->app['permissions']->getContentTypeUserPermissions($contentTypeSlug, $user);
} | [
"protected",
"function",
"getContentTypeUserPermissions",
"(",
"$",
"contentTypeSlug",
",",
"$",
"user",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"user",
"===",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"app",
"[",
"'permissions'",
"]",
"->",
"getConten... | Helper to get a user's permissions for a ContentType.
@param string $contentTypeSlug
@param array|Entity\Users $user
@return bool[] | [
"Helper",
"to",
"get",
"a",
"user",
"s",
"permissions",
"for",
"a",
"ContentType",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Base.php#L452-L459 |
bolt/bolt | src/Controller/Base.php | Base.getRefererQueryParameters | protected function getRefererQueryParameters(Request $request)
{
$referer = $request->server->get('HTTP_REFERER');
$request = Request::create($referer);
return (array) $request->query->getIterator();
} | php | protected function getRefererQueryParameters(Request $request)
{
$referer = $request->server->get('HTTP_REFERER');
$request = Request::create($referer);
return (array) $request->query->getIterator();
} | [
"protected",
"function",
"getRefererQueryParameters",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"referer",
"=",
"$",
"request",
"->",
"server",
"->",
"get",
"(",
"'HTTP_REFERER'",
")",
";",
"$",
"request",
"=",
"Request",
"::",
"create",
"(",
"$",
"re... | Get an array of query parameters used in the request.
@param Request $request
@return array | [
"Get",
"an",
"array",
"of",
"query",
"parameters",
"used",
"in",
"the",
"request",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Base.php#L481-L487 |
bolt/bolt | src/Filesystem/Plugin/ThumbnailUrl.php | ThumbnailUrl.handle | public function handle($path, $width, $height, $action)
{
$file = $this->filesystem->getFile($path);
return $this->urlGenerator->generate(
'thumb',
[
'width' => $width,
'height' => $height,
'action' => $action[0], // first cha... | php | public function handle($path, $width, $height, $action)
{
$file = $this->filesystem->getFile($path);
return $this->urlGenerator->generate(
'thumb',
[
'width' => $width,
'height' => $height,
'action' => $action[0], // first cha... | [
"public",
"function",
"handle",
"(",
"$",
"path",
",",
"$",
"width",
",",
"$",
"height",
",",
"$",
"action",
")",
"{",
"$",
"file",
"=",
"$",
"this",
"->",
"filesystem",
"->",
"getFile",
"(",
"$",
"path",
")",
";",
"return",
"$",
"this",
"->",
"u... | Generate thumbnail url.
@param string $path
@param int $width
@param int $height
@param string $action
@return string | [
"Generate",
"thumbnail",
"url",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Filesystem/Plugin/ThumbnailUrl.php#L48-L61 |
bolt/bolt | src/Twig/SwitchTokenParser.php | SwitchTokenParser.parse | public function parse(Token $token)
{
$parser = $this->parser;
$stream = $parser->getStream();
$default = null;
$cases = [];
$end = false;
$name = $parser->getExpressionParser()->parseExpression();
$stream->expect(Token::BLOCK_END_TYPE);
$stream->exp... | php | public function parse(Token $token)
{
$parser = $this->parser;
$stream = $parser->getStream();
$default = null;
$cases = [];
$end = false;
$name = $parser->getExpressionParser()->parseExpression();
$stream->expect(Token::BLOCK_END_TYPE);
$stream->exp... | [
"public",
"function",
"parse",
"(",
"Token",
"$",
"token",
")",
"{",
"$",
"parser",
"=",
"$",
"this",
"->",
"parser",
";",
"$",
"stream",
"=",
"$",
"parser",
"->",
"getStream",
"(",
")",
";",
"$",
"default",
"=",
"null",
";",
"$",
"cases",
"=",
"... | Parses a token and returns a node.
@param Token $token A Token instance
@throws SyntaxError
@return Node A Twig node instance | [
"Parses",
"a",
"token",
"and",
"returns",
"a",
"node",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/SwitchTokenParser.php#L39-L83 |
bolt/bolt | src/Configuration/Validation/Validator.php | Validator.add | public function add($checkName, $className, $prepend = false)
{
if ($prepend) {
$this->check = [$checkName => $className] + $this->check;
} else {
$this->check[$checkName] = $className;
}
} | php | public function add($checkName, $className, $prepend = false)
{
if ($prepend) {
$this->check = [$checkName => $className] + $this->check;
} else {
$this->check[$checkName] = $className;
}
} | [
"public",
"function",
"add",
"(",
"$",
"checkName",
",",
"$",
"className",
",",
"$",
"prepend",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"prepend",
")",
"{",
"$",
"this",
"->",
"check",
"=",
"[",
"$",
"checkName",
"=>",
"$",
"className",
"]",
"+",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Configuration/Validation/Validator.php#L59-L66 |
bolt/bolt | src/Configuration/Validation/Validator.php | Validator.check | public function check($checkName)
{
$className = $this->check[$checkName];
return $this
->getValidator($className, $checkName)
->check()
;
} | php | public function check($checkName)
{
$className = $this->check[$checkName];
return $this
->getValidator($className, $checkName)
->check()
;
} | [
"public",
"function",
"check",
"(",
"$",
"checkName",
")",
"{",
"$",
"className",
"=",
"$",
"this",
"->",
"check",
"[",
"$",
"checkName",
"]",
";",
"return",
"$",
"this",
"->",
"getValidator",
"(",
"$",
"className",
",",
"$",
"checkName",
")",
"->",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Configuration/Validation/Validator.php#L87-L95 |
bolt/bolt | src/Configuration/Validation/Validator.php | Validator.checks | public function checks()
{
foreach ($this->check as $checkName => $className) {
$this
->getValidator($className, $checkName)
->check()
;
}
} | php | public function checks()
{
foreach ($this->check as $checkName => $className) {
$this
->getValidator($className, $checkName)
->check()
;
}
} | [
"public",
"function",
"checks",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"check",
"as",
"$",
"checkName",
"=>",
"$",
"className",
")",
"{",
"$",
"this",
"->",
"getValidator",
"(",
"$",
"className",
",",
"$",
"checkName",
")",
"->",
"check",
... | Run system installation checks. | [
"Run",
"system",
"installation",
"checks",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Configuration/Validation/Validator.php#L100-L108 |
bolt/bolt | src/Configuration/Validation/Validator.php | Validator.getValidator | private function getValidator($className, $constructorArgs)
{
/** @var ValidationInterface $validator */
$validator = is_string($className) ? new $className($constructorArgs) : $className;
if (!$validator instanceof ValidationInterface) {
throw new BootException(sprintf('System v... | php | private function getValidator($className, $constructorArgs)
{
/** @var ValidationInterface $validator */
$validator = is_string($className) ? new $className($constructorArgs) : $className;
if (!$validator instanceof ValidationInterface) {
throw new BootException(sprintf('System v... | [
"private",
"function",
"getValidator",
"(",
"$",
"className",
",",
"$",
"constructorArgs",
")",
"{",
"/** @var ValidationInterface $validator */",
"$",
"validator",
"=",
"is_string",
"(",
"$",
"className",
")",
"?",
"new",
"$",
"className",
"(",
"$",
"constructorA... | Get a validator object from a given class name.
@param string|ValidationInterface $className
@param mixed $constructorArgs
@return ValidationInterface | [
"Get",
"a",
"validator",
"object",
"from",
"a",
"given",
"class",
"name",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Configuration/Validation/Validator.php#L118-L136 |
bolt/bolt | src/EventListener/DisableXssProtectionListener.php | DisableXssProtectionListener.onResponse | public function onResponse(FilterResponseEvent $event)
{
$request = $event->getRequest();
if ($request->isMethodSafe(false)) {
return;
}
// In case we're using 'preview', the `_route` has been set to `contentlink`, because we're
// viewing a single page, but `_o... | php | public function onResponse(FilterResponseEvent $event)
{
$request = $event->getRequest();
if ($request->isMethodSafe(false)) {
return;
}
// In case we're using 'preview', the `_route` has been set to `contentlink`, because we're
// viewing a single page, but `_o... | [
"public",
"function",
"onResponse",
"(",
"FilterResponseEvent",
"$",
"event",
")",
"{",
"$",
"request",
"=",
"$",
"event",
"->",
"getRequest",
"(",
")",
";",
"if",
"(",
"$",
"request",
"->",
"isMethodSafe",
"(",
"false",
")",
")",
"{",
"return",
";",
"... | Add X-XSS-Protection header if route matches, request is unsafe, and response has body.
@param FilterResponseEvent $event | [
"Add",
"X",
"-",
"XSS",
"-",
"Protection",
"header",
"if",
"route",
"matches",
"request",
"is",
"unsafe",
"and",
"response",
"has",
"body",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/EventListener/DisableXssProtectionListener.php#L36-L61 |
bolt/bolt | src/Storage/Query/ContentQueryParser.php | ContentQueryParser.setupDefaults | protected function setupDefaults()
{
$this->addHandler('select', new SelectQueryHandler());
$this->addHandler('search', new SearchQueryHandler());
$this->addHandler('random', new RandomQueryHandler());
$this->addHandler('first', new FirstQueryHandler());
$this->addHandler('la... | php | protected function setupDefaults()
{
$this->addHandler('select', new SelectQueryHandler());
$this->addHandler('search', new SearchQueryHandler());
$this->addHandler('random', new RandomQueryHandler());
$this->addHandler('first', new FirstQueryHandler());
$this->addHandler('la... | [
"protected",
"function",
"setupDefaults",
"(",
")",
"{",
"$",
"this",
"->",
"addHandler",
"(",
"'select'",
",",
"new",
"SelectQueryHandler",
"(",
")",
")",
";",
"$",
"this",
"->",
"addHandler",
"(",
"'search'",
",",
"new",
"SearchQueryHandler",
"(",
")",
"... | Internal method to initialise the default handlers. | [
"Internal",
"method",
"to",
"initialise",
"the",
"default",
"handlers",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Query/ContentQueryParser.php#L78-L96 |
bolt/bolt | src/Storage/Query/ContentQueryParser.php | ContentQueryParser.parseContent | protected function parseContent()
{
$contentString = strtok($this->query, '/');
$content = [];
$delim = '(),';
$tok = strtok($contentString, $delim);
while ($tok !== false) {
$content[] = $tok;
$tok = strtok($delim);
}
$this->contentT... | php | protected function parseContent()
{
$contentString = strtok($this->query, '/');
$content = [];
$delim = '(),';
$tok = strtok($contentString, $delim);
while ($tok !== false) {
$content[] = $tok;
$tok = strtok($delim);
}
$this->contentT... | [
"protected",
"function",
"parseContent",
"(",
")",
"{",
"$",
"contentString",
"=",
"strtok",
"(",
"$",
"this",
"->",
"query",
",",
"'/'",
")",
";",
"$",
"content",
"=",
"[",
"]",
";",
"$",
"delim",
"=",
"'(),'",
";",
"$",
"tok",
"=",
"strtok",
"(",... | Parses the content area of the query string. | [
"Parses",
"the",
"content",
"area",
"of",
"the",
"query",
"string",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Query/ContentQueryParser.php#L142-L155 |
bolt/bolt | src/Storage/Query/ContentQueryParser.php | ContentQueryParser.parseOperation | protected function parseOperation()
{
$operation = 'select';
$queryParts = explode('/', $this->query);
array_shift($queryParts);
if (!count($queryParts)) {
$this->operation = $operation;
return;
}
if (in_array($queryParts[0], $this->operati... | php | protected function parseOperation()
{
$operation = 'select';
$queryParts = explode('/', $this->query);
array_shift($queryParts);
if (!count($queryParts)) {
$this->operation = $operation;
return;
}
if (in_array($queryParts[0], $this->operati... | [
"protected",
"function",
"parseOperation",
"(",
")",
"{",
"$",
"operation",
"=",
"'select'",
";",
"$",
"queryParts",
"=",
"explode",
"(",
"'/'",
",",
"$",
"this",
"->",
"query",
")",
";",
"array_shift",
"(",
"$",
"queryParts",
")",
";",
"if",
"(",
"!",... | Internal method that takes the 'query' part of the input and
parses it into one of the various operations supported.
A simple select operation will just contain the ContentType eg 'pages'
but additional operations can be triggered using the '/' separator.
@internal | [
"Internal",
"method",
"that",
"takes",
"the",
"query",
"part",
"of",
"the",
"input",
"and",
"parses",
"it",
"into",
"one",
"of",
"the",
"various",
"operations",
"supported",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Query/ContentQueryParser.php#L166-L194 |
bolt/bolt | src/Storage/Query/ContentQueryParser.php | ContentQueryParser.parseDirectives | protected function parseDirectives()
{
$this->directives = [];
if (!$this->params) {
return;
}
foreach ($this->params as $key => $value) {
if ($this->hasDirectiveHandler($key)) {
$this->directives[$key] = $value;
unset($this->... | php | protected function parseDirectives()
{
$this->directives = [];
if (!$this->params) {
return;
}
foreach ($this->params as $key => $value) {
if ($this->hasDirectiveHandler($key)) {
$this->directives[$key] = $value;
unset($this->... | [
"protected",
"function",
"parseDirectives",
"(",
")",
"{",
"$",
"this",
"->",
"directives",
"=",
"[",
"]",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"params",
")",
"{",
"return",
";",
"}",
"foreach",
"(",
"$",
"this",
"->",
"params",
"as",
"$",
"key"... | Directives are all of the other parameters supported by Bolt that do not
relate to an actual filter query. Some examples include 'printquery', 'limit',
'order' or 'returnsingle'.
All these need to parsed and taken out of the params that are sent to the query. | [
"Directives",
"are",
"all",
"of",
"the",
"other",
"parameters",
"supported",
"by",
"Bolt",
"that",
"do",
"not",
"relate",
"to",
"an",
"actual",
"filter",
"query",
".",
"Some",
"examples",
"include",
"printquery",
"limit",
"order",
"or",
"returnsingle",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Query/ContentQueryParser.php#L203-L217 |
bolt/bolt | src/Storage/Query/ContentQueryParser.php | ContentQueryParser.runDirectives | public function runDirectives(QueryInterface $query, array $skipDirective = [])
{
foreach ($this->directives as $key => $value) {
if (in_array($key, $skipDirective, true)) {
continue;
}
if (!$this->hasDirectiveHandler($key)) {
continue;
... | php | public function runDirectives(QueryInterface $query, array $skipDirective = [])
{
foreach ($this->directives as $key => $value) {
if (in_array($key, $skipDirective, true)) {
continue;
}
if (!$this->hasDirectiveHandler($key)) {
continue;
... | [
"public",
"function",
"runDirectives",
"(",
"QueryInterface",
"$",
"query",
",",
"array",
"$",
"skipDirective",
"=",
"[",
"]",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"directives",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"in_arr... | This runs the callbacks attached to each directive command.
@param QueryInterface $query
@param array $skipDirective | [
"This",
"runs",
"the",
"callbacks",
"attached",
"to",
"each",
"directive",
"command",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Query/ContentQueryParser.php#L225-L238 |
bolt/bolt | src/Storage/Query/ContentQueryParser.php | ContentQueryParser.getDirective | public function getDirective($key)
{
if (array_key_exists($key, $this->directives)) {
return $this->directives[$key];
}
return null;
} | php | public function getDirective($key)
{
if (array_key_exists($key, $this->directives)) {
return $this->directives[$key];
}
return null;
} | [
"public",
"function",
"getDirective",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"directives",
")",
")",
"{",
"return",
"$",
"this",
"->",
"directives",
"[",
"$",
"key",
"]",
";",
"}",
"return",... | Returns a directive from the parsed list.
@param string $key
@return string|null | [
"Returns",
"a",
"directive",
"from",
"the",
"parsed",
"list",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Query/ContentQueryParser.php#L299-L306 |
bolt/bolt | src/Storage/Query/ContentQueryParser.php | ContentQueryParser.addDirectiveHandler | public function addDirectiveHandler($key, callable $callback = null)
{
if (!array_key_exists($key, $this->directiveHandlers)) {
$this->directiveHandlers[$key] = $callback;
}
} | php | public function addDirectiveHandler($key, callable $callback = null)
{
if (!array_key_exists($key, $this->directiveHandlers)) {
$this->directiveHandlers[$key] = $callback;
}
} | [
"public",
"function",
"addDirectiveHandler",
"(",
"$",
"key",
",",
"callable",
"$",
"callback",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"directiveHandlers",
")",
")",
"{",
"$",
"this",
"->",
"... | Adds a handler for the named directive.
@param string $key
@param callable|null $callback | [
"Adds",
"a",
"handler",
"for",
"the",
"named",
"directive",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Query/ContentQueryParser.php#L349-L354 |
bolt/bolt | src/Storage/Query/ContentQueryParser.php | ContentQueryParser.addHandler | public function addHandler($operation, callable $callback)
{
$this->handlers[$operation] = $callback;
$this->addOperation($operation);
} | php | public function addHandler($operation, callable $callback)
{
$this->handlers[$operation] = $callback;
$this->addOperation($operation);
} | [
"public",
"function",
"addHandler",
"(",
"$",
"operation",
",",
"callable",
"$",
"callback",
")",
"{",
"$",
"this",
"->",
"handlers",
"[",
"$",
"operation",
"]",
"=",
"$",
"callback",
";",
"$",
"this",
"->",
"addOperation",
"(",
"$",
"operation",
")",
... | Adds a handler AND operation for the named operation.
@param string $operation
@param callable $callback | [
"Adds",
"a",
"handler",
"AND",
"operation",
"for",
"the",
"named",
"operation",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Query/ContentQueryParser.php#L362-L366 |
bolt/bolt | src/Storage/Query/ContentQueryParser.php | ContentQueryParser.fetch | public function fetch()
{
$this->parse();
$parseEvent = new QueryEvent($this);
$this->getEntityManager()->getEventManager()->dispatch(QueryEvents::PARSE, $parseEvent);
$result = call_user_func($this->handlers[$this->getOperation()], $this);
$executeEvent = new QueryEvent($th... | php | public function fetch()
{
$this->parse();
$parseEvent = new QueryEvent($this);
$this->getEntityManager()->getEventManager()->dispatch(QueryEvents::PARSE, $parseEvent);
$result = call_user_func($this->handlers[$this->getOperation()], $this);
$executeEvent = new QueryEvent($th... | [
"public",
"function",
"fetch",
"(",
")",
"{",
"$",
"this",
"->",
"parse",
"(",
")",
";",
"$",
"parseEvent",
"=",
"new",
"QueryEvent",
"(",
"$",
"this",
")",
";",
"$",
"this",
"->",
"getEntityManager",
"(",
")",
"->",
"getEventManager",
"(",
")",
"->"... | Runs the query and fetches the results.
@return QueryResultset|Content|null | [
"Runs",
"the",
"query",
"and",
"fetches",
"the",
"results",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Query/ContentQueryParser.php#L442-L453 |
bolt/bolt | src/Storage/Query/ContentQueryParser.php | ContentQueryParser.addOperation | public function addOperation($operation)
{
if (!in_array($operation, $this->operations, true)) {
$this->operations[] = $operation;
}
} | php | public function addOperation($operation)
{
if (!in_array($operation, $this->operations, true)) {
$this->operations[] = $operation;
}
} | [
"public",
"function",
"addOperation",
"(",
"$",
"operation",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"operation",
",",
"$",
"this",
"->",
"operations",
",",
"true",
")",
")",
"{",
"$",
"this",
"->",
"operations",
"[",
"]",
"=",
"$",
"operatio... | Adds a new operation to the list supported.
@param string $operation name of operation to parse for | [
"Adds",
"a",
"new",
"operation",
"to",
"the",
"list",
"supported",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Query/ContentQueryParser.php#L470-L475 |
bolt/bolt | src/Storage/Query/ContentQueryParser.php | ContentQueryParser.removeOperation | public function removeOperation($operation)
{
if (in_array($operation, $this->operations, true)) {
$key = array_search($operation, $this->operations, true);
unset($this->operations[$key]);
}
} | php | public function removeOperation($operation)
{
if (in_array($operation, $this->operations, true)) {
$key = array_search($operation, $this->operations, true);
unset($this->operations[$key]);
}
} | [
"public",
"function",
"removeOperation",
"(",
"$",
"operation",
")",
"{",
"if",
"(",
"in_array",
"(",
"$",
"operation",
",",
"$",
"this",
"->",
"operations",
",",
"true",
")",
")",
"{",
"$",
"key",
"=",
"array_search",
"(",
"$",
"operation",
",",
"$",
... | Removes an operation from the list supported.
@param string $operation name of operation to remove | [
"Removes",
"an",
"operation",
"from",
"the",
"list",
"supported",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Query/ContentQueryParser.php#L482-L488 |
bolt/bolt | src/Extension/AssetTrait.php | AssetTrait.extendAssetServices | final protected function extendAssetServices()
{
/** @var Application $app */
$app = $this->getContainer();
$app['asset.queue.file'] = $app->share(
$app->extend(
'asset.queue.file',
function ($queue) {
$this->loadAssets();
... | php | final protected function extendAssetServices()
{
/** @var Application $app */
$app = $this->getContainer();
$app['asset.queue.file'] = $app->share(
$app->extend(
'asset.queue.file',
function ($queue) {
$this->loadAssets();
... | [
"final",
"protected",
"function",
"extendAssetServices",
"(",
")",
"{",
"/** @var Application $app */",
"$",
"app",
"=",
"$",
"this",
"->",
"getContainer",
"(",
")",
";",
"$",
"app",
"[",
"'asset.queue.file'",
"]",
"=",
"$",
"app",
"->",
"share",
"(",
"$",
... | Call this in register method.
@internal
@throws \InvalidArgumentException | [
"Call",
"this",
"in",
"register",
"method",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Extension/AssetTrait.php#L43-L98 |
bolt/bolt | src/Extension/AssetTrait.php | AssetTrait.loadAssets | private function loadAssets()
{
if ($this->loadedAssets) {
return;
}
foreach ((array) $this->registerAssets() as $asset) {
if (!$asset instanceof AssetInterface) {
throw new \InvalidArgumentException(sprintf(
'%s::registerAssets() ... | php | private function loadAssets()
{
if ($this->loadedAssets) {
return;
}
foreach ((array) $this->registerAssets() as $asset) {
if (!$asset instanceof AssetInterface) {
throw new \InvalidArgumentException(sprintf(
'%s::registerAssets() ... | [
"private",
"function",
"loadAssets",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"loadedAssets",
")",
"{",
"return",
";",
"}",
"foreach",
"(",
"(",
"array",
")",
"$",
"this",
"->",
"registerAssets",
"(",
")",
"as",
"$",
"asset",
")",
"{",
"if",
"(... | Merges assets returned from registerAssets() to our list.
@throws \InvalidArgumentException | [
"Merges",
"assets",
"returned",
"from",
"registerAssets",
"()",
"to",
"our",
"list",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Extension/AssetTrait.php#L105-L124 |
bolt/bolt | src/Extension/AssetTrait.php | AssetTrait.addAsset | private function addAsset(AssetInterface $asset)
{
if ($asset instanceof FileAssetInterface) {
$this->normalizeAsset($asset);
}
$this->assets[] = $asset;
} | php | private function addAsset(AssetInterface $asset)
{
if ($asset instanceof FileAssetInterface) {
$this->normalizeAsset($asset);
}
$this->assets[] = $asset;
} | [
"private",
"function",
"addAsset",
"(",
"AssetInterface",
"$",
"asset",
")",
"{",
"if",
"(",
"$",
"asset",
"instanceof",
"FileAssetInterface",
")",
"{",
"$",
"this",
"->",
"normalizeAsset",
"(",
"$",
"asset",
")",
";",
"}",
"$",
"this",
"->",
"assets",
"... | Add an file, snippet or widget asset to the render queue.
@param AssetInterface $asset | [
"Add",
"an",
"file",
"snippet",
"or",
"widget",
"asset",
"to",
"the",
"render",
"queue",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Extension/AssetTrait.php#L131-L137 |
bolt/bolt | src/Extension/AssetTrait.php | AssetTrait.normalizeAsset | private function normalizeAsset(FileAssetInterface $asset)
{
$path = $asset->getPath();
if ($path === null) {
throw new \RuntimeException('Extension file assets must have a path set.');
}
if ($asset->getPackageName()) {
return;
}
if ($this->i... | php | private function normalizeAsset(FileAssetInterface $asset)
{
$path = $asset->getPath();
if ($path === null) {
throw new \RuntimeException('Extension file assets must have a path set.');
}
if ($asset->getPackageName()) {
return;
}
if ($this->i... | [
"private",
"function",
"normalizeAsset",
"(",
"FileAssetInterface",
"$",
"asset",
")",
"{",
"$",
"path",
"=",
"$",
"asset",
"->",
"getPath",
"(",
")",
";",
"if",
"(",
"$",
"path",
"===",
"null",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
... | Normalizes the path and package name of the asset file.
@param FileAssetInterface $asset | [
"Normalizes",
"the",
"path",
"and",
"package",
"name",
"of",
"the",
"asset",
"file",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Extension/AssetTrait.php#L168-L221 |
bolt/bolt | src/Users.php | Users.saveUser | public function saveUser($user)
{
if (is_array($user)) {
$user = new Entity\Users($user);
}
// Make sure the username is slug-like
$user->setUsername($this->app['slugify']->slugify($user->getUsername()));
// Save the entity
return $this->getRepository()-... | php | public function saveUser($user)
{
if (is_array($user)) {
$user = new Entity\Users($user);
}
// Make sure the username is slug-like
$user->setUsername($this->app['slugify']->slugify($user->getUsername()));
// Save the entity
return $this->getRepository()-... | [
"public",
"function",
"saveUser",
"(",
"$",
"user",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"user",
")",
")",
"{",
"$",
"user",
"=",
"new",
"Entity",
"\\",
"Users",
"(",
"$",
"user",
")",
";",
"}",
"// Make sure the username is slug-like",
"$",
"use... | Save changes to a user to the database. (re)hashing the password, if needed.
@param Entity\Users|array $user
@return int the number of affected rows | [
"Save",
"changes",
"to",
"a",
"user",
"to",
"the",
"database",
".",
"(",
"re",
")",
"hashing",
"the",
"password",
"if",
"needed",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Users.php#L59-L70 |
bolt/bolt | src/Users.php | Users.deleteUser | public function deleteUser($id)
{
$user = $this->getRepository()->find($id);
if (!$user) {
$this->app['logger.flash']->warning(Trans::__('general.phrase.user-not-exist'));
return false;
}
$userId = $user->getId();
if ($result = $this->getRepository(... | php | public function deleteUser($id)
{
$user = $this->getRepository()->find($id);
if (!$user) {
$this->app['logger.flash']->warning(Trans::__('general.phrase.user-not-exist'));
return false;
}
$userId = $user->getId();
if ($result = $this->getRepository(... | [
"public",
"function",
"deleteUser",
"(",
"$",
"id",
")",
"{",
"$",
"user",
"=",
"$",
"this",
"->",
"getRepository",
"(",
")",
"->",
"find",
"(",
"$",
"id",
")",
";",
"if",
"(",
"!",
"$",
"user",
")",
"{",
"$",
"this",
"->",
"app",
"[",
"'logger... | Remove a user from the database.
@param int $id
@return int the number of affected rows | [
"Remove",
"a",
"user",
"from",
"the",
"database",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Users.php#L151-L169 |
bolt/bolt | src/Users.php | Users.getUsers | public function getUsers()
{
if (!empty($this->users)) {
return $this->users;
}
try {
if (!$tempusers = $this->getRepository()->getUsers()) {
return [];
}
/** @var \Bolt\Storage\Entity\Users $userEntity */
foreach ... | php | public function getUsers()
{
if (!empty($this->users)) {
return $this->users;
}
try {
if (!$tempusers = $this->getRepository()->getUsers()) {
return [];
}
/** @var \Bolt\Storage\Entity\Users $userEntity */
foreach ... | [
"public",
"function",
"getUsers",
"(",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"users",
")",
")",
"{",
"return",
"$",
"this",
"->",
"users",
";",
"}",
"try",
"{",
"if",
"(",
"!",
"$",
"tempusers",
"=",
"$",
"this",
"->",
"get... | Get an array with the current users.
@return array[] | [
"Get",
"an",
"array",
"with",
"the",
"current",
"users",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Users.php#L188-L209 |
bolt/bolt | src/Users.php | Users.getUser | public function getUser($userId)
{
// Make sure users have been 'got' already.
$this->getUsers();
// In most cases by far, we'll request an ID, and we can return it here.
if ($userId && array_key_exists($userId, $this->users)) {
return $this->users[$userId];
}
... | php | public function getUser($userId)
{
// Make sure users have been 'got' already.
$this->getUsers();
// In most cases by far, we'll request an ID, and we can return it here.
if ($userId && array_key_exists($userId, $this->users)) {
return $this->users[$userId];
}
... | [
"public",
"function",
"getUser",
"(",
"$",
"userId",
")",
"{",
"// Make sure users have been 'got' already.",
"$",
"this",
"->",
"getUsers",
"(",
")",
";",
"// In most cases by far, we'll request an ID, and we can return it here.",
"if",
"(",
"$",
"userId",
"&&",
"array_k... | Get a user, specified by ID, username or email address.
@param int|string $userId
@return array|false | [
"Get",
"a",
"user",
"specified",
"by",
"ID",
"username",
"or",
"email",
"address",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Users.php#L228-L248 |
bolt/bolt | src/Users.php | Users.getCurrentUser | public function getCurrentUser()
{
if ($this->currentuser === null) {
$this->currentuser = $this->app['session']->isStarted() ? $this->app['session']->get('authentication') : null;
if ($this->currentuser instanceof AccessControl\Token\Token) {
$this->currentuser = $th... | php | public function getCurrentUser()
{
if ($this->currentuser === null) {
$this->currentuser = $this->app['session']->isStarted() ? $this->app['session']->get('authentication') : null;
if ($this->currentuser instanceof AccessControl\Token\Token) {
$this->currentuser = $th... | [
"public",
"function",
"getCurrentUser",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"currentuser",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"currentuser",
"=",
"$",
"this",
"->",
"app",
"[",
"'session'",
"]",
"->",
"isStarted",
"(",
")",
"?",
"$"... | Get the current user as an array.
@return array | [
"Get",
"the",
"current",
"user",
"as",
"an",
"array",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Users.php#L255-L265 |
bolt/bolt | src/Users.php | Users.getCurrentUserProperty | public function getCurrentUserProperty($property)
{
$currentuser = $this->getCurrentUser();
return isset($currentuser[$property]) ? $currentuser[$property] : null;
} | php | public function getCurrentUserProperty($property)
{
$currentuser = $this->getCurrentUser();
return isset($currentuser[$property]) ? $currentuser[$property] : null;
} | [
"public",
"function",
"getCurrentUserProperty",
"(",
"$",
"property",
")",
"{",
"$",
"currentuser",
"=",
"$",
"this",
"->",
"getCurrentUser",
"(",
")",
";",
"return",
"isset",
"(",
"$",
"currentuser",
"[",
"$",
"property",
"]",
")",
"?",
"$",
"currentuser"... | Get the current user's property.
@param string $property
@return string | [
"Get",
"the",
"current",
"user",
"s",
"property",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Users.php#L274-L279 |
bolt/bolt | src/Users.php | Users.isEnabled | public function isEnabled($id = false)
{
$user = $id ? $this->getUser($id) : $this->getCurrentUser();
return (bool) $user['enabled'];
} | php | public function isEnabled($id = false)
{
$user = $id ? $this->getUser($id) : $this->getCurrentUser();
return (bool) $user['enabled'];
} | [
"public",
"function",
"isEnabled",
"(",
"$",
"id",
"=",
"false",
")",
"{",
"$",
"user",
"=",
"$",
"id",
"?",
"$",
"this",
"->",
"getUser",
"(",
"$",
"id",
")",
":",
"$",
"this",
"->",
"getCurrentUser",
"(",
")",
";",
"return",
"(",
"bool",
")",
... | Check a user's enable status.
@param int|bool $id User ID, or false for current user
@return bool | [
"Check",
"a",
"user",
"s",
"enable",
"status",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Users.php#L302-L307 |
bolt/bolt | src/Users.php | Users.setEnabled | public function setEnabled($id, $enabled = true)
{
if (!$user = $this->getUser($id)) {
return false;
}
$user['enabled'] = (int) $enabled;
return $this->saveUser($user);
} | php | public function setEnabled($id, $enabled = true)
{
if (!$user = $this->getUser($id)) {
return false;
}
$user['enabled'] = (int) $enabled;
return $this->saveUser($user);
} | [
"public",
"function",
"setEnabled",
"(",
"$",
"id",
",",
"$",
"enabled",
"=",
"true",
")",
"{",
"if",
"(",
"!",
"$",
"user",
"=",
"$",
"this",
"->",
"getUser",
"(",
"$",
"id",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"user",
"[",
"'enab... | Enable or disable a user, specified by id.
@param int|string $id
@param bool|int $enabled
@return int | [
"Enable",
"or",
"disable",
"a",
"user",
"specified",
"by",
"id",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Users.php#L317-L326 |
bolt/bolt | src/Users.php | Users.hasRole | public function hasRole($id, $role)
{
if (!$user = $this->getUser($id)) {
return false;
}
return in_array($role, $user['roles']);
} | php | public function hasRole($id, $role)
{
if (!$user = $this->getUser($id)) {
return false;
}
return in_array($role, $user['roles']);
} | [
"public",
"function",
"hasRole",
"(",
"$",
"id",
",",
"$",
"role",
")",
"{",
"if",
"(",
"!",
"$",
"user",
"=",
"$",
"this",
"->",
"getUser",
"(",
"$",
"id",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"in_array",
"(",
"$",
"role",
","... | Check if a certain user has a specific role.
@param string|int $id
@param string $role
@return bool | [
"Check",
"if",
"a",
"certain",
"user",
"has",
"a",
"specific",
"role",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Users.php#L336-L343 |
bolt/bolt | src/Users.php | Users.addRole | public function addRole($id, $role)
{
if (empty($role) || !$user = $this->getUser($id)) {
return false;
}
// Add the role to the $user['roles'] array
$user['roles'][] = $role;
return $this->saveUser($user);
} | php | public function addRole($id, $role)
{
if (empty($role) || !$user = $this->getUser($id)) {
return false;
}
// Add the role to the $user['roles'] array
$user['roles'][] = $role;
return $this->saveUser($user);
} | [
"public",
"function",
"addRole",
"(",
"$",
"id",
",",
"$",
"role",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"role",
")",
"||",
"!",
"$",
"user",
"=",
"$",
"this",
"->",
"getUser",
"(",
"$",
"id",
")",
")",
"{",
"return",
"false",
";",
"}",
"//... | Add a certain role from a specific user.
@param string|int $id
@param string $role
@return bool | [
"Add",
"a",
"certain",
"role",
"from",
"a",
"specific",
"user",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Users.php#L353-L363 |
bolt/bolt | src/Users.php | Users.removeRole | public function removeRole($id, $role)
{
$user = $this->getUser($id);
if (empty($user) || empty($role)) {
return false;
}
// Remove the role from the $user['roles'] array.
$user['roles'] = array_diff($user['roles'], [(string) $role]);
return $this->save... | php | public function removeRole($id, $role)
{
$user = $this->getUser($id);
if (empty($user) || empty($role)) {
return false;
}
// Remove the role from the $user['roles'] array.
$user['roles'] = array_diff($user['roles'], [(string) $role]);
return $this->save... | [
"public",
"function",
"removeRole",
"(",
"$",
"id",
",",
"$",
"role",
")",
"{",
"$",
"user",
"=",
"$",
"this",
"->",
"getUser",
"(",
"$",
"id",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"user",
")",
"||",
"empty",
"(",
"$",
"role",
")",
")",
"{... | Remove a certain role from a specific user.
@param string|int $id
@param string $role
@return bool | [
"Remove",
"a",
"certain",
"role",
"from",
"a",
"specific",
"user",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Users.php#L373-L385 |
bolt/bolt | src/Users.php | Users.filterManipulatableRoles | public function filterManipulatableRoles($id, array $newRoles)
{
$oldRoles = [];
if ($id && $user = $this->getUser($id)) {
$oldRoles = $user['roles'];
}
$manipulatableRoles = $this->app['permissions']->getManipulatableRoles($this->getCurrentUser());
$roles = [];... | php | public function filterManipulatableRoles($id, array $newRoles)
{
$oldRoles = [];
if ($id && $user = $this->getUser($id)) {
$oldRoles = $user['roles'];
}
$manipulatableRoles = $this->app['permissions']->getManipulatableRoles($this->getCurrentUser());
$roles = [];... | [
"public",
"function",
"filterManipulatableRoles",
"(",
"$",
"id",
",",
"array",
"$",
"newRoles",
")",
"{",
"$",
"oldRoles",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"id",
"&&",
"$",
"user",
"=",
"$",
"this",
"->",
"getUser",
"(",
"$",
"id",
")",
")",
... | Ensure changes to the user's roles match what the current user has
permissions to manipulate.
@param string|int $id User ID
@param array $newRoles Roles from form submission
@return string[] The user's roles with the allowed changes | [
"Ensure",
"changes",
"to",
"the",
"user",
"s",
"roles",
"match",
"what",
"the",
"current",
"user",
"has",
"permissions",
"to",
"manipulate",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Users.php#L396-L423 |
bolt/bolt | src/Users.php | Users.checkForRoot | public function checkForRoot()
{
// Don't check for root, if we're not logged in.
if ($this->getCurrentUser() === false) {
return false;
}
// Loop over the users, check if anybody's root.
foreach ($this->getUsers() as $user) {
if (in_array('root', $us... | php | public function checkForRoot()
{
// Don't check for root, if we're not logged in.
if ($this->getCurrentUser() === false) {
return false;
}
// Loop over the users, check if anybody's root.
foreach ($this->getUsers() as $user) {
if (in_array('root', $us... | [
"public",
"function",
"checkForRoot",
"(",
")",
"{",
"// Don't check for root, if we're not logged in.",
"if",
"(",
"$",
"this",
"->",
"getCurrentUser",
"(",
")",
"===",
"false",
")",
"{",
"return",
"false",
";",
"}",
"// Loop over the users, check if anybody's root.",
... | Check for a user with the 'root' role.
There should always be at least one If there isn't we promote the current
user.
@return bool | [
"Check",
"for",
"a",
"user",
"with",
"the",
"root",
"role",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Users.php#L433-L460 |
bolt/bolt | src/Users.php | Users.isAllowed | public function isAllowed($what, $contenttype = null, $contentid = null)
{
$user = $this->getCurrentUser();
return $this->app['permissions']->isAllowed($what, $user, $contenttype, $contentid);
} | php | public function isAllowed($what, $contenttype = null, $contentid = null)
{
$user = $this->getCurrentUser();
return $this->app['permissions']->isAllowed($what, $user, $contenttype, $contentid);
} | [
"public",
"function",
"isAllowed",
"(",
"$",
"what",
",",
"$",
"contenttype",
"=",
"null",
",",
"$",
"contentid",
"=",
"null",
")",
"{",
"$",
"user",
"=",
"$",
"this",
"->",
"getCurrentUser",
"(",
")",
";",
"return",
"$",
"this",
"->",
"app",
"[",
... | Runs a permission check. Permissions are encoded as strings, where
the ':' character acts as a separator for dynamic parts and
sub-permissions.
Apart from the route-based rules defined in permissions.yml, the
following special cases are available:
"overview:$contenttype" - view the overview for the content type. Alia... | [
"Runs",
"a",
"permission",
"check",
".",
"Permissions",
"are",
"encoded",
"as",
"strings",
"where",
"the",
":",
"character",
"acts",
"as",
"a",
"separator",
"for",
"dynamic",
"parts",
"and",
"sub",
"-",
"permissions",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Users.php#L493-L498 |
bolt/bolt | src/Users.php | Users.isContentStatusTransitionAllowed | public function isContentStatusTransitionAllowed($fromStatus, $toStatus, $contenttype, $contentid = null)
{
$user = $this->getCurrentUser();
return $this->app['permissions']->isContentStatusTransitionAllowed($fromStatus, $toStatus, $user, $contenttype, $contentid);
} | php | public function isContentStatusTransitionAllowed($fromStatus, $toStatus, $contenttype, $contentid = null)
{
$user = $this->getCurrentUser();
return $this->app['permissions']->isContentStatusTransitionAllowed($fromStatus, $toStatus, $user, $contenttype, $contentid);
} | [
"public",
"function",
"isContentStatusTransitionAllowed",
"(",
"$",
"fromStatus",
",",
"$",
"toStatus",
",",
"$",
"contenttype",
",",
"$",
"contentid",
"=",
"null",
")",
"{",
"$",
"user",
"=",
"$",
"this",
"->",
"getCurrentUser",
"(",
")",
";",
"return",
"... | Check to see if the current user can change the status on the record.
@param string $fromStatus
@param string $toStatus
@param string $contenttype
@param string $contentid
@return bool | [
"Check",
"to",
"see",
"if",
"the",
"current",
"user",
"can",
"change",
"the",
"status",
"on",
"the",
"record",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Users.php#L510-L515 |
bolt/bolt | src/Users.php | Users.canonicalizeFieldValue | private function canonicalizeFieldValue($fieldname, $fieldvalue)
{
switch ($fieldname) {
case 'email':
return strtolower(trim($fieldvalue));
case 'username':
return strtolower(preg_replace('/[^a-zA-Z0-9_\\-]/', '', $fieldvalue));
default:... | php | private function canonicalizeFieldValue($fieldname, $fieldvalue)
{
switch ($fieldname) {
case 'email':
return strtolower(trim($fieldvalue));
case 'username':
return strtolower(preg_replace('/[^a-zA-Z0-9_\\-]/', '', $fieldvalue));
default:... | [
"private",
"function",
"canonicalizeFieldValue",
"(",
"$",
"fieldname",
",",
"$",
"fieldvalue",
")",
"{",
"switch",
"(",
"$",
"fieldname",
")",
"{",
"case",
"'email'",
":",
"return",
"strtolower",
"(",
"trim",
"(",
"$",
"fieldvalue",
")",
")",
";",
"case",... | Create a correctly canonicalized value for a field, depending on its name.
@param string $fieldname
@param string $fieldvalue
@return string | [
"Create",
"a",
"correctly",
"canonicalized",
"value",
"for",
"a",
"field",
"depending",
"on",
"its",
"name",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Users.php#L525-L537 |
bolt/bolt | src/Users.php | Users.checkAvailability | public function checkAvailability($fieldname, $value, $currentid = 0)
{
foreach ($this->users as $user) {
if (($this->canonicalizeFieldValue($fieldname, $user[$fieldname]) ===
$this->canonicalizeFieldValue($fieldname, $value)) &&
($user['id'] != $currentid)
... | php | public function checkAvailability($fieldname, $value, $currentid = 0)
{
foreach ($this->users as $user) {
if (($this->canonicalizeFieldValue($fieldname, $user[$fieldname]) ===
$this->canonicalizeFieldValue($fieldname, $value)) &&
($user['id'] != $currentid)
... | [
"public",
"function",
"checkAvailability",
"(",
"$",
"fieldname",
",",
"$",
"value",
",",
"$",
"currentid",
"=",
"0",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"users",
"as",
"$",
"user",
")",
"{",
"if",
"(",
"(",
"$",
"this",
"->",
"canonicalizeF... | Check if a certain field with a certain value doesn't exist already.
Depending on the field type, different pre-massaging of the compared
values are applied, because what constitutes 'equal' for the purpose
of this filtering depends on the field type.
@param string $fieldname
@param string $value
@param int $curren... | [
"Check",
"if",
"a",
"certain",
"field",
"with",
"a",
"certain",
"value",
"doesn",
"t",
"exist",
"already",
".",
"Depending",
"on",
"the",
"field",
"type",
"different",
"pre",
"-",
"massaging",
"of",
"the",
"compared",
"values",
"are",
"applied",
"because",
... | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Users.php#L551-L564 |
bolt/bolt | src/Routing/Canonical.php | Canonical.setGlobalOverride | public function setGlobalOverride($uri)
{
if (is_string($uri)) {
// Prepend scheme if not included so parse_url doesn't choke.
if (strpos($uri, 'http') !== 0) {
$uri = 'http://' . $uri;
}
$uri = new Uri($uri);
}
Assert::nullOrIs... | php | public function setGlobalOverride($uri)
{
if (is_string($uri)) {
// Prepend scheme if not included so parse_url doesn't choke.
if (strpos($uri, 'http') !== 0) {
$uri = 'http://' . $uri;
}
$uri = new Uri($uri);
}
Assert::nullOrIs... | [
"public",
"function",
"setGlobalOverride",
"(",
"$",
"uri",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"uri",
")",
")",
"{",
"// Prepend scheme if not included so parse_url doesn't choke.",
"if",
"(",
"strpos",
"(",
"$",
"uri",
",",
"'http'",
")",
"!==",
"0",... | This overrides the scheme and host for all urls generated including the canonical one.
@param UriInterface|string|null $uri | [
"This",
"overrides",
"the",
"scheme",
"and",
"host",
"for",
"all",
"urls",
"generated",
"including",
"the",
"canonical",
"one",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Routing/Canonical.php#L63-L75 |
bolt/bolt | src/Routing/Canonical.php | Canonical.setOverride | public function setOverride($uri)
{
if (is_string($uri)) {
$uri = new Uri($uri);
}
Assert::nullOrIsInstanceOf($uri, UriInterface::class, 'Expected a string, UriInterface, or null. Got: %s');
$this->override = $uri;
} | php | public function setOverride($uri)
{
if (is_string($uri)) {
$uri = new Uri($uri);
}
Assert::nullOrIsInstanceOf($uri, UriInterface::class, 'Expected a string, UriInterface, or null. Got: %s');
$this->override = $uri;
} | [
"public",
"function",
"setOverride",
"(",
"$",
"uri",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"uri",
")",
")",
"{",
"$",
"uri",
"=",
"new",
"Uri",
"(",
"$",
"uri",
")",
";",
"}",
"Assert",
"::",
"nullOrIsInstanceOf",
"(",
"$",
"uri",
",",
"Ur... | This overrides the the canonical url. It will be resolved against the current request.
Note: This only applies to the current request, so it will need to be called again for the next one.
@param UriInterface|string|null $uri | [
"This",
"overrides",
"the",
"the",
"canonical",
"url",
".",
"It",
"will",
"be",
"resolved",
"against",
"the",
"current",
"request",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Routing/Canonical.php#L84-L93 |
bolt/bolt | src/Routing/Canonical.php | Canonical.getUrl | public function getUrl()
{
// Ensure in request cycle (even for override).
if ($this->request === null) {
return null;
}
// Ensure request has been matched
if (!$this->request->attributes->get('_route')) {
return null;
}
if ($this->ov... | php | public function getUrl()
{
// Ensure in request cycle (even for override).
if ($this->request === null) {
return null;
}
// Ensure request has been matched
if (!$this->request->attributes->get('_route')) {
return null;
}
if ($this->ov... | [
"public",
"function",
"getUrl",
"(",
")",
"{",
"// Ensure in request cycle (even for override).",
"if",
"(",
"$",
"this",
"->",
"request",
"===",
"null",
")",
"{",
"return",
"null",
";",
"}",
"// Ensure request has been matched",
"if",
"(",
"!",
"$",
"this",
"->... | Returns the canonical url for the current request,
or null if called outside of the request cycle.
@return string|null | [
"Returns",
"the",
"canonical",
"url",
"for",
"the",
"current",
"request",
"or",
"null",
"if",
"called",
"outside",
"of",
"the",
"request",
"cycle",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Routing/Canonical.php#L101-L124 |
bolt/bolt | src/Routing/Canonical.php | Canonical.setRequest | private function setRequest(Request $request = null)
{
$this->request = $request;
$this->override = null;
} | php | private function setRequest(Request $request = null)
{
$this->request = $request;
$this->override = null;
} | [
"private",
"function",
"setRequest",
"(",
"Request",
"$",
"request",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"request",
"=",
"$",
"request",
";",
"$",
"this",
"->",
"override",
"=",
"null",
";",
"}"
] | Set the current request and reset the current override.
@param Request|null $request | [
"Set",
"the",
"current",
"request",
"and",
"reset",
"the",
"current",
"override",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Routing/Canonical.php#L164-L168 |
bolt/bolt | src/Routing/Canonical.php | Canonical.applyGlobalOverride | private function applyGlobalOverride()
{
if (!$this->globalOverride) {
return;
}
$context = $this->urlGenerator->getContext();
// Only override scheme if it's an upgrade to https.
// i.e Don't do: https -> http
if ($this->globalOverride->getScheme() === ... | php | private function applyGlobalOverride()
{
if (!$this->globalOverride) {
return;
}
$context = $this->urlGenerator->getContext();
// Only override scheme if it's an upgrade to https.
// i.e Don't do: https -> http
if ($this->globalOverride->getScheme() === ... | [
"private",
"function",
"applyGlobalOverride",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"globalOverride",
")",
"{",
"return",
";",
"}",
"$",
"context",
"=",
"$",
"this",
"->",
"urlGenerator",
"->",
"getContext",
"(",
")",
";",
"// Only override sch... | Sets the scheme and host overrides (if any) on the UrlGenerator's RequestContext.
This needs to happen after RouterListener as that sets the scheme
and host from the request. To override we need to be after that. | [
"Sets",
"the",
"scheme",
"and",
"host",
"overrides",
"(",
"if",
"any",
")",
"on",
"the",
"UrlGenerator",
"s",
"RequestContext",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Routing/Canonical.php#L176-L192 |
bolt/bolt | src/Routing/Canonical.php | Canonical.resolveCurrentOverride | private function resolveCurrentOverride()
{
// Absolute url or network path
if ($this->override->getHost() !== '') {
return;
}
$context = $this->urlGenerator->getContext();
if (Uri::isRelativePathReference($this->override)) {
$this->override = $this-... | php | private function resolveCurrentOverride()
{
// Absolute url or network path
if ($this->override->getHost() !== '') {
return;
}
$context = $this->urlGenerator->getContext();
if (Uri::isRelativePathReference($this->override)) {
$this->override = $this-... | [
"private",
"function",
"resolveCurrentOverride",
"(",
")",
"{",
"// Absolute url or network path",
"if",
"(",
"$",
"this",
"->",
"override",
"->",
"getHost",
"(",
")",
"!==",
"''",
")",
"{",
"return",
";",
"}",
"$",
"context",
"=",
"$",
"this",
"->",
"urlG... | If there is a current override, resolve it to an absolute url based on current request. | [
"If",
"there",
"is",
"a",
"current",
"override",
"resolve",
"it",
"to",
"an",
"absolute",
"url",
"based",
"on",
"current",
"request",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Routing/Canonical.php#L197-L217 |
bolt/bolt | src/EventListener/RedirectListener.php | RedirectListener.onResponse | public function onResponse(FilterResponseEvent $event)
{
if (!$event->isMasterRequest()) {
return;
}
$request = $event->getRequest();
$response = $event->getResponse();
if (!$response->isRedirect() || !$response instanceof RedirectResponse) {
return;
... | php | public function onResponse(FilterResponseEvent $event)
{
if (!$event->isMasterRequest()) {
return;
}
$request = $event->getRequest();
$response = $event->getResponse();
if (!$response->isRedirect() || !$response instanceof RedirectResponse) {
return;
... | [
"public",
"function",
"onResponse",
"(",
"FilterResponseEvent",
"$",
"event",
")",
"{",
"if",
"(",
"!",
"$",
"event",
"->",
"isMasterRequest",
"(",
")",
")",
"{",
"return",
";",
"}",
"$",
"request",
"=",
"$",
"event",
"->",
"getRequest",
"(",
")",
";",... | Kernel response listener callback.
@param FilterResponseEvent $event | [
"Kernel",
"response",
"listener",
"callback",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/EventListener/RedirectListener.php#L56-L70 |
bolt/bolt | src/EventListener/RedirectListener.php | RedirectListener.handleNoBackendAccess | protected function handleNoBackendAccess(RedirectResponse $response)
{
$authCookie = $this->session->get('authentication');
if ($authCookie === null || !$this->authentication->isValidSession($authCookie)) {
return;
}
$dashboardPath = $this->urlGenerator->generate('dashbo... | php | protected function handleNoBackendAccess(RedirectResponse $response)
{
$authCookie = $this->session->get('authentication');
if ($authCookie === null || !$this->authentication->isValidSession($authCookie)) {
return;
}
$dashboardPath = $this->urlGenerator->generate('dashbo... | [
"protected",
"function",
"handleNoBackendAccess",
"(",
"RedirectResponse",
"$",
"response",
")",
"{",
"$",
"authCookie",
"=",
"$",
"this",
"->",
"session",
"->",
"get",
"(",
"'authentication'",
")",
";",
"if",
"(",
"$",
"authCookie",
"===",
"null",
"||",
"!"... | When redirecting to the backend dashboard (while logged in),
if the user does not have access change the redirect to the homepage.
@param \Symfony\Component\HttpFoundation\RedirectResponse $response | [
"When",
"redirecting",
"to",
"the",
"backend",
"dashboard",
"(",
"while",
"logged",
"in",
")",
"if",
"the",
"user",
"does",
"not",
"have",
"access",
"change",
"the",
"redirect",
"to",
"the",
"homepage",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/EventListener/RedirectListener.php#L78-L91 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.