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/Nut/Helper/Table.php | Table.overwrite | public function overwrite()
{
if (!$this->previouslyRendered) {
$this->previouslyRendered = true;
} else {
$this->output->remove();
}
$this->output->capture();
$this->render();
} | php | public function overwrite()
{
if (!$this->previouslyRendered) {
$this->previouslyRendered = true;
} else {
$this->output->remove();
}
$this->output->capture();
$this->render();
} | [
"public",
"function",
"overwrite",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"previouslyRendered",
")",
"{",
"$",
"this",
"->",
"previouslyRendered",
"=",
"true",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"output",
"->",
"remove",
"(",
")",
"... | Remove previously rendered table, then render again with new data.
This assumes the table is the last output on the terminal. | [
"Remove",
"previously",
"rendered",
"table",
"then",
"render",
"again",
"with",
"new",
"data",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/Helper/Table.php#L40-L49 |
bolt/bolt | src/Storage/LazyEntityManager.php | LazyEntityManager.getContent | public function getContent($textQuery, $parameters = [], &$pager = [], $whereParameters = [])
{
$entity = $this->getEntityManager()->legacy();
if ($entity) {
return $entity->getContent($textQuery, $parameters, $pager, $whereParameters);
} else {
return false;
... | php | public function getContent($textQuery, $parameters = [], &$pager = [], $whereParameters = [])
{
$entity = $this->getEntityManager()->legacy();
if ($entity) {
return $entity->getContent($textQuery, $parameters, $pager, $whereParameters);
} else {
return false;
... | [
"public",
"function",
"getContent",
"(",
"$",
"textQuery",
",",
"$",
"parameters",
"=",
"[",
"]",
",",
"&",
"$",
"pager",
"=",
"[",
"]",
",",
"$",
"whereParameters",
"=",
"[",
"]",
")",
"{",
"$",
"entity",
"=",
"$",
"this",
"->",
"getEntityManager",
... | {@inheritdoc}
@deprecated will be removed when {{ setcontent }} is cut over | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/LazyEntityManager.php#L55-L63 |
bolt/bolt | src/Storage/Database/Schema/Comparison/Sqlite.php | Sqlite.setIgnoredChanges | protected function setIgnoredChanges()
{
if (DBAL\Version::compare('2.7.0') > 0) {
/** @deprecated Drop when minimum PHP version is 7.1 or greater. */
$this->ignoredChanges[] = new IgnoredChange('changedColumns', 'type', 'text', 'json');
$this->ignoredChanges[] = new Igno... | php | protected function setIgnoredChanges()
{
if (DBAL\Version::compare('2.7.0') > 0) {
/** @deprecated Drop when minimum PHP version is 7.1 or greater. */
$this->ignoredChanges[] = new IgnoredChange('changedColumns', 'type', 'text', 'json');
$this->ignoredChanges[] = new Igno... | [
"protected",
"function",
"setIgnoredChanges",
"(",
")",
"{",
"if",
"(",
"DBAL",
"\\",
"Version",
"::",
"compare",
"(",
"'2.7.0'",
")",
">",
"0",
")",
"{",
"/** @deprecated Drop when minimum PHP version is 7.1 or greater. */",
"$",
"this",
"->",
"ignoredChanges",
"["... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Database/Schema/Comparison/Sqlite.php#L23-L37 |
bolt/bolt | src/Storage/Database/Schema/Comparison/Sqlite.php | Sqlite.removeIgnoredChanges | protected function removeIgnoredChanges(TableDiff $diff)
{
/**
* @see https://github.com/doctrine/dbal/pull/242
* \Doctrine\DBAL\Platforms\SqlitePlatform::supportsForeignKeyConstraints
* https://www.sqlite.org/foreignkeys.html
*/
if ($this->connection->g... | php | protected function removeIgnoredChanges(TableDiff $diff)
{
/**
* @see https://github.com/doctrine/dbal/pull/242
* \Doctrine\DBAL\Platforms\SqlitePlatform::supportsForeignKeyConstraints
* https://www.sqlite.org/foreignkeys.html
*/
if ($this->connection->g... | [
"protected",
"function",
"removeIgnoredChanges",
"(",
"TableDiff",
"$",
"diff",
")",
"{",
"/**\n * @see https://github.com/doctrine/dbal/pull/242\n * \\Doctrine\\DBAL\\Platforms\\SqlitePlatform::supportsForeignKeyConstraints\n * https://www.sqlite.org/foreignkeys.... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Database/Schema/Comparison/Sqlite.php#L42-L54 |
bolt/bolt | src/Storage/Query/SearchWeighter.php | SearchWeighter.weight | public function weight()
{
$scores = [];
foreach ($this->results as $result) {
$scores[] = $this->getResultScore($result);
}
return $scores;
} | php | public function weight()
{
$scores = [];
foreach ($this->results as $result) {
$scores[] = $this->getResultScore($result);
}
return $scores;
} | [
"public",
"function",
"weight",
"(",
")",
"{",
"$",
"scores",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"results",
"as",
"$",
"result",
")",
"{",
"$",
"scores",
"[",
"]",
"=",
"$",
"this",
"->",
"getResultScore",
"(",
"$",
"result",
... | This is the public method that gets a score for a the set of results.
@return array An array of scores for each of the corresponding results | [
"This",
"is",
"the",
"public",
"method",
"that",
"gets",
"a",
"score",
"for",
"a",
"the",
"set",
"of",
"results",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Query/SearchWeighter.php#L71-L79 |
bolt/bolt | src/Storage/Query/SearchWeighter.php | SearchWeighter.buildResultIndex | protected function buildResultIndex($result)
{
$corpus = [];
foreach ($this->getContentFields() as $field => $weightings) {
$textualContent = $result->{$field};
// This is to handle taxonomies that need to be converted from an array
// into a string of words.
... | php | protected function buildResultIndex($result)
{
$corpus = [];
foreach ($this->getContentFields() as $field => $weightings) {
$textualContent = $result->{$field};
// This is to handle taxonomies that need to be converted from an array
// into a string of words.
... | [
"protected",
"function",
"buildResultIndex",
"(",
"$",
"result",
")",
"{",
"$",
"corpus",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"getContentFields",
"(",
")",
"as",
"$",
"field",
"=>",
"$",
"weightings",
")",
"{",
"$",
"textualContent",
... | This is a simple version of the Vector Space Model.
@see https://en.wikipedia.org/wiki/Vector_space_model
The goal is to determine a relavance score for a corpus of values
based on both the existence of a word or words but also based on
how important the words are.
For example, when querying results against a search... | [
"This",
"is",
"a",
"simple",
"version",
"of",
"the",
"Vector",
"Space",
"Model",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Query/SearchWeighter.php#L111-L151 |
bolt/bolt | src/Storage/Query/SearchWeighter.php | SearchWeighter.getResultScore | protected function getResultScore($result)
{
$output = [];
$corpus = $this->buildResultIndex($result);
$count = count($corpus['count']);
// This block iterates the search query words and checks both their
// existence and frequency in the index.
//
// The sc... | php | protected function getResultScore($result)
{
$output = [];
$corpus = $this->buildResultIndex($result);
$count = count($corpus['count']);
// This block iterates the search query words and checks both their
// existence and frequency in the index.
//
// The sc... | [
"protected",
"function",
"getResultScore",
"(",
"$",
"result",
")",
"{",
"$",
"output",
"=",
"[",
"]",
";",
"$",
"corpus",
"=",
"$",
"this",
"->",
"buildResultIndex",
"(",
"$",
"result",
")",
";",
"$",
"count",
"=",
"count",
"(",
"$",
"corpus",
"[",
... | This method uses the index built in the method above to do some quick
score calculations for each word of the query, versus each word of the
index dictionary.
@param object $result
@return float | [
"This",
"method",
"uses",
"the",
"index",
"built",
"in",
"the",
"method",
"above",
"to",
"do",
"some",
"quick",
"score",
"calculations",
"for",
"each",
"word",
"of",
"the",
"query",
"versus",
"each",
"word",
"of",
"the",
"index",
"dictionary",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Query/SearchWeighter.php#L162-L213 |
bolt/bolt | src/Configuration/Environment.php | Environment.checkVersion | public function checkVersion()
{
if ($this->checkCacheVersion()) {
return;
}
$this->syncAssets();
$this->cache->flushAll();
$this->updateAutoloader();
$this->updateCacheVersion();
} | php | public function checkVersion()
{
if ($this->checkCacheVersion()) {
return;
}
$this->syncAssets();
$this->cache->flushAll();
$this->updateAutoloader();
$this->updateCacheVersion();
} | [
"public",
"function",
"checkVersion",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"checkCacheVersion",
"(",
")",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"syncAssets",
"(",
")",
";",
"$",
"this",
"->",
"cache",
"->",
"flushAll",
"(",
")",
... | Check Bolt's version against a cached key. If there is a change we flush
the cache data and if required synchronise asset directories. | [
"Check",
"Bolt",
"s",
"version",
"against",
"a",
"cached",
"key",
".",
"If",
"there",
"is",
"a",
"change",
"we",
"flush",
"the",
"cache",
"data",
"and",
"if",
"required",
"synchronise",
"asset",
"directories",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Configuration/Environment.php#L73-L82 |
bolt/bolt | src/Configuration/Environment.php | Environment.syncAssets | public function syncAssets()
{
if ($this->boltPath . '/app/view' === $this->boltAssetsPath) {
return null;
}
$assetDirs = ['css', 'fonts', 'img', 'js'];
$response = null;
foreach ($assetDirs as $dir) {
try {
$this->syncAssetsDirectory... | php | public function syncAssets()
{
if ($this->boltPath . '/app/view' === $this->boltAssetsPath) {
return null;
}
$assetDirs = ['css', 'fonts', 'img', 'js'];
$response = null;
foreach ($assetDirs as $dir) {
try {
$this->syncAssetsDirectory... | [
"public",
"function",
"syncAssets",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"boltPath",
".",
"'/app/view'",
"===",
"$",
"this",
"->",
"boltAssetsPath",
")",
"{",
"return",
"null",
";",
"}",
"$",
"assetDirs",
"=",
"[",
"'css'",
",",
"'fonts'",
",",... | Perform a synchronisation of files in specific app/view/ subdirectories.
@return array|null | [
"Perform",
"a",
"synchronisation",
"of",
"files",
"in",
"specific",
"app",
"/",
"view",
"/",
"subdirectories",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Configuration/Environment.php#L89-L109 |
bolt/bolt | src/Configuration/Environment.php | Environment.syncAssetsDirectory | protected function syncAssetsDirectory($dir)
{
$source = $this->boltPath . '/app/view/' . $dir;
$target = $this->boltAssetsPath . '/' . $dir;
// Mirror source and destination, overwrite existing file and clean up removed files
$this->filesystem->mirror($source, $target, null, ['over... | php | protected function syncAssetsDirectory($dir)
{
$source = $this->boltPath . '/app/view/' . $dir;
$target = $this->boltAssetsPath . '/' . $dir;
// Mirror source and destination, overwrite existing file and clean up removed files
$this->filesystem->mirror($source, $target, null, ['over... | [
"protected",
"function",
"syncAssetsDirectory",
"(",
"$",
"dir",
")",
"{",
"$",
"source",
"=",
"$",
"this",
"->",
"boltPath",
".",
"'/app/view/'",
".",
"$",
"dir",
";",
"$",
"target",
"=",
"$",
"this",
"->",
"boltAssetsPath",
".",
"'/'",
".",
"$",
"dir... | Synchronise the files in an app/view/ subdirectory.
@param string $dir | [
"Synchronise",
"the",
"files",
"in",
"an",
"app",
"/",
"view",
"/",
"subdirectory",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Configuration/Environment.php#L116-L123 |
bolt/bolt | src/Configuration/Environment.php | Environment.checkCacheVersion | protected function checkCacheVersion()
{
$fileName = $this->getVersionFileName();
if (!file_exists($fileName)) {
return false;
}
$version = md5($this->boltVersion);
$cached = file_get_contents($fileName);
if ($version === $cached) {
return t... | php | protected function checkCacheVersion()
{
$fileName = $this->getVersionFileName();
if (!file_exists($fileName)) {
return false;
}
$version = md5($this->boltVersion);
$cached = file_get_contents($fileName);
if ($version === $cached) {
return t... | [
"protected",
"function",
"checkCacheVersion",
"(",
")",
"{",
"$",
"fileName",
"=",
"$",
"this",
"->",
"getVersionFileName",
"(",
")",
";",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"fileName",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"version",
... | Check if the cache version matches Bolt's current version.
@return bool TRUE - versions match
FALSE - versions don't match | [
"Check",
"if",
"the",
"cache",
"version",
"matches",
"Bolt",
"s",
"current",
"version",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Configuration/Environment.php#L131-L148 |
bolt/bolt | src/Configuration/Environment.php | Environment.updateAutoloader | protected function updateAutoloader()
{
$cwd = getcwd();
try {
/** @var DumpAutoload $autoload */
$autoload = $this->actions['autoload'];
$autoload->execute();
} catch (PackageManagerException $e) {
// Write access is potentially disabled
... | php | protected function updateAutoloader()
{
$cwd = getcwd();
try {
/** @var DumpAutoload $autoload */
$autoload = $this->actions['autoload'];
$autoload->execute();
} catch (PackageManagerException $e) {
// Write access is potentially disabled
... | [
"protected",
"function",
"updateAutoloader",
"(",
")",
"{",
"$",
"cwd",
"=",
"getcwd",
"(",
")",
";",
"try",
"{",
"/** @var DumpAutoload $autoload */",
"$",
"autoload",
"=",
"$",
"this",
"->",
"actions",
"[",
"'autoload'",
"]",
";",
"$",
"autoload",
"->",
... | Update the extension autoloader. | [
"Update",
"the",
"extension",
"autoloader",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Configuration/Environment.php#L153-L166 |
bolt/bolt | src/Storage/Field/Type/TemplateFieldsType.php | TemplateFieldsType.hydrate | public function hydrate($data, $entity)
{
/** @var string $key */
$key = $this->mapping['fieldname'];
$type = $this->getStorageType();
$value = $type->convertToPHPValue($data[$key], $this->getPlatform());
$this->set($entity, $value, $data);
} | php | public function hydrate($data, $entity)
{
/** @var string $key */
$key = $this->mapping['fieldname'];
$type = $this->getStorageType();
$value = $type->convertToPHPValue($data[$key], $this->getPlatform());
$this->set($entity, $value, $data);
} | [
"public",
"function",
"hydrate",
"(",
"$",
"data",
",",
"$",
"entity",
")",
"{",
"/** @var string $key */",
"$",
"key",
"=",
"$",
"this",
"->",
"mapping",
"[",
"'fieldname'",
"]",
";",
"$",
"type",
"=",
"$",
"this",
"->",
"getStorageType",
"(",
")",
";... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Field/Type/TemplateFieldsType.php#L47-L54 |
bolt/bolt | src/Storage/Field/Type/TemplateFieldsType.php | TemplateFieldsType.persist | public function persist(QuerySet $queries, $entity)
{
$key = $this->mapping['fieldname'];
$qb = &$queries[0];
$valueMethod = 'serialize' . ucfirst($key);
$value = $entity->$valueMethod();
$type = $this->getStorageType();
if ($value !== null) {
$metadata ... | php | public function persist(QuerySet $queries, $entity)
{
$key = $this->mapping['fieldname'];
$qb = &$queries[0];
$valueMethod = 'serialize' . ucfirst($key);
$value = $entity->$valueMethod();
$type = $this->getStorageType();
if ($value !== null) {
$metadata ... | [
"public",
"function",
"persist",
"(",
"QuerySet",
"$",
"queries",
",",
"$",
"entity",
")",
"{",
"$",
"key",
"=",
"$",
"this",
"->",
"mapping",
"[",
"'fieldname'",
"]",
";",
"$",
"qb",
"=",
"&",
"$",
"queries",
"[",
"0",
"]",
";",
"$",
"valueMethod"... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Field/Type/TemplateFieldsType.php#L79-L99 |
bolt/bolt | src/Storage/Field/Type/TemplateFieldsType.php | TemplateFieldsType.serialize | protected function serialize($input, ClassMetadata $metadata)
{
$output = [];
foreach ($metadata->getFieldMappings() as $field) {
$fieldObj = $this->em->getFieldManager()->get($field['fieldtype'], $field);
$type = $fieldObj->getStorageType();
$key = $field['fieldn... | php | protected function serialize($input, ClassMetadata $metadata)
{
$output = [];
foreach ($metadata->getFieldMappings() as $field) {
$fieldObj = $this->em->getFieldManager()->get($field['fieldtype'], $field);
$type = $fieldObj->getStorageType();
$key = $field['fieldn... | [
"protected",
"function",
"serialize",
"(",
"$",
"input",
",",
"ClassMetadata",
"$",
"metadata",
")",
"{",
"$",
"output",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"metadata",
"->",
"getFieldMappings",
"(",
")",
"as",
"$",
"field",
")",
"{",
"$",
"fieldO... | @param string $input
@param ClassMetadata $metadata
@return array | [
"@param",
"string",
"$input",
"@param",
"ClassMetadata",
"$metadata"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Field/Type/TemplateFieldsType.php#L107-L126 |
bolt/bolt | src/Storage/Field/Type/TemplateFieldsType.php | TemplateFieldsType.buildMetadata | protected function buildMetadata($entity, $rawData = null)
{
$metadata = new ClassMetadata(get_class($entity));
try {
$template = $this->chooser->record($entity, $rawData);
$template = $this->twig->resolveTemplate($template)->getSourceContext()->getName();
} catch (L... | php | protected function buildMetadata($entity, $rawData = null)
{
$metadata = new ClassMetadata(get_class($entity));
try {
$template = $this->chooser->record($entity, $rawData);
$template = $this->twig->resolveTemplate($template)->getSourceContext()->getName();
} catch (L... | [
"protected",
"function",
"buildMetadata",
"(",
"$",
"entity",
",",
"$",
"rawData",
"=",
"null",
")",
"{",
"$",
"metadata",
"=",
"new",
"ClassMetadata",
"(",
"get_class",
"(",
"$",
"entity",
")",
")",
";",
"try",
"{",
"$",
"template",
"=",
"$",
"this",
... | @param object $entity
@param array|null $rawData
@return ClassMetadata | [
"@param",
"object",
"$entity",
"@param",
"array|null",
"$rawData"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Field/Type/TemplateFieldsType.php#L134-L151 |
bolt/bolt | src/Profiler/BoltDataCollector.php | BoltDataCollector.collect | public function collect(Request $request, Response $response, \Exception $exception = null)
{
$this->data = [
'version' => Bolt\Version::VERSION,
'payoff' => 'Sophisticated, lightweight & simple CMS',
'dashboardlink' => sprintf('<a href="%s">%s</a>', $this->a... | php | public function collect(Request $request, Response $response, \Exception $exception = null)
{
$this->data = [
'version' => Bolt\Version::VERSION,
'payoff' => 'Sophisticated, lightweight & simple CMS',
'dashboardlink' => sprintf('<a href="%s">%s</a>', $this->a... | [
"public",
"function",
"collect",
"(",
"Request",
"$",
"request",
",",
"Response",
"$",
"response",
",",
"\\",
"Exception",
"$",
"exception",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"data",
"=",
"[",
"'version'",
"=>",
"Bolt",
"\\",
"Version",
"::",
"... | Collect the date for the Toolbar item.
@param Request $request
@param Response $response
@param \Exception $exception | [
"Collect",
"the",
"date",
"for",
"the",
"Toolbar",
"item",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Profiler/BoltDataCollector.php#L36-L59 |
bolt/bolt | src/Storage/Collection/Taxonomy.php | Taxonomy.update | public function update(Taxonomy $collection)
{
$updated = [];
// First give priority to already existing entities
foreach ($collection as $entity) {
$entity->setSlug(str_replace('/', '', $entity->getSlug()));
$master = $this->getOriginal($entity);
$master-... | php | public function update(Taxonomy $collection)
{
$updated = [];
// First give priority to already existing entities
foreach ($collection as $entity) {
$entity->setSlug(str_replace('/', '', $entity->getSlug()));
$master = $this->getOriginal($entity);
$master-... | [
"public",
"function",
"update",
"(",
"Taxonomy",
"$",
"collection",
")",
"{",
"$",
"updated",
"=",
"[",
"]",
";",
"// First give priority to already existing entities",
"foreach",
"(",
"$",
"collection",
"as",
"$",
"entity",
")",
"{",
"$",
"entity",
"->",
"set... | Runs a check on an incoming collection to make sure that duplicates are filtered out. Precedence is given to
records that are already persisted, with any diff in incoming properties updated.
Any records not in the incoming set are deleted from the collection and the deleted ones returned as an array.
@param Taxonomy ... | [
"Runs",
"a",
"check",
"on",
"an",
"incoming",
"collection",
"to",
"make",
"sure",
"that",
"duplicates",
"are",
"filtered",
"out",
".",
"Precedence",
"is",
"given",
"to",
"records",
"that",
"are",
"already",
"persisted",
"with",
"any",
"diff",
"in",
"incoming... | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Collection/Taxonomy.php#L89-L114 |
bolt/bolt | src/Storage/Collection/Taxonomy.php | Taxonomy.getOriginal | public function getOriginal($entity)
{
/** @var Entity\Taxonomy $existing */
foreach ($this as $k => $existing) {
if (
$existing->getContentId() === $entity->getContentId() &&
$existing->getTaxonomytype() === $entity->getTaxonomytype() &&
$... | php | public function getOriginal($entity)
{
/** @var Entity\Taxonomy $existing */
foreach ($this as $k => $existing) {
if (
$existing->getContentId() === $entity->getContentId() &&
$existing->getTaxonomytype() === $entity->getTaxonomytype() &&
$... | [
"public",
"function",
"getOriginal",
"(",
"$",
"entity",
")",
"{",
"/** @var Entity\\Taxonomy $existing */",
"foreach",
"(",
"$",
"this",
"as",
"$",
"k",
"=>",
"$",
"existing",
")",
"{",
"if",
"(",
"$",
"existing",
"->",
"getContentId",
"(",
")",
"===",
"$... | This loops over the existing collection to see if the properties in the incoming
are already available on a saved record. To do this it checks the three key properties
content_id, taxonomytype and slug, if there's a match it returns the original, otherwise
it returns the new and adds the new one to the collection.
@pa... | [
"This",
"loops",
"over",
"the",
"existing",
"collection",
"to",
"see",
"if",
"the",
"properties",
"in",
"the",
"incoming",
"are",
"already",
"available",
"on",
"a",
"saved",
"record",
".",
"To",
"do",
"this",
"it",
"checks",
"the",
"three",
"key",
"propert... | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Collection/Taxonomy.php#L172-L186 |
bolt/bolt | src/Storage/Collection/Taxonomy.php | Taxonomy.filter | public function filter(Closure $p)
{
$elements = $this->toArray();
$filtered = new static(array_filter($elements, $p));
$filtered->config = $this->config;
return $filtered;
} | php | public function filter(Closure $p)
{
$elements = $this->toArray();
$filtered = new static(array_filter($elements, $p));
$filtered->config = $this->config;
return $filtered;
} | [
"public",
"function",
"filter",
"(",
"Closure",
"$",
"p",
")",
"{",
"$",
"elements",
"=",
"$",
"this",
"->",
"toArray",
"(",
")",
";",
"$",
"filtered",
"=",
"new",
"static",
"(",
"array_filter",
"(",
"$",
"elements",
",",
"$",
"p",
")",
")",
";",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Collection/Taxonomy.php#L206-L213 |
bolt/bolt | src/Nut/DatabaseCheck.php | DatabaseCheck.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
/** @var \Bolt\Storage\Database\Schema\SchemaCheck $response */
$response = $this->app['schema']->check();
if (!$response->hasResponses()) {
$this->io->success('The database is OK.');
retur... | php | protected function execute(InputInterface $input, OutputInterface $output)
{
/** @var \Bolt\Storage\Database\Schema\SchemaCheck $response */
$response = $this->app['schema']->check();
if (!$response->hasResponses()) {
$this->io->success('The database is OK.');
retur... | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"/** @var \\Bolt\\Storage\\Database\\Schema\\SchemaCheck $response */",
"$",
"response",
"=",
"$",
"this",
"->",
"app",
"[",
"'schema'",
"]",
"->"... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/DatabaseCheck.php#L30-L51 |
bolt/bolt | src/Nut/DatabaseCheck.php | DatabaseCheck.showCreates | protected function showCreates()
{
$creates = $this->app['schema.comparator']->getCreates();
if ($creates) {
$this->io->section('Tables to be created');
foreach ($creates as $tableName => $sql) {
$this->io->writeln(\SqlFormatter::format($sql[0]));
... | php | protected function showCreates()
{
$creates = $this->app['schema.comparator']->getCreates();
if ($creates) {
$this->io->section('Tables to be created');
foreach ($creates as $tableName => $sql) {
$this->io->writeln(\SqlFormatter::format($sql[0]));
... | [
"protected",
"function",
"showCreates",
"(",
")",
"{",
"$",
"creates",
"=",
"$",
"this",
"->",
"app",
"[",
"'schema.comparator'",
"]",
"->",
"getCreates",
"(",
")",
";",
"if",
"(",
"$",
"creates",
")",
"{",
"$",
"this",
"->",
"io",
"->",
"section",
"... | Display a section of tables to be created. | [
"Display",
"a",
"section",
"of",
"tables",
"to",
"be",
"created",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/DatabaseCheck.php#L65-L74 |
bolt/bolt | src/Nut/DatabaseCheck.php | DatabaseCheck.showAlterations | protected function showAlterations()
{
$alters = $this->app['schema.comparator']->getAlters();
if ($alters) {
$this->io->section('Tables to be altered:');
$tableCount = count($alters);
foreach ($alters as $tableName => $sql) {
$this->io->comment($... | php | protected function showAlterations()
{
$alters = $this->app['schema.comparator']->getAlters();
if ($alters) {
$this->io->section('Tables to be altered:');
$tableCount = count($alters);
foreach ($alters as $tableName => $sql) {
$this->io->comment($... | [
"protected",
"function",
"showAlterations",
"(",
")",
"{",
"$",
"alters",
"=",
"$",
"this",
"->",
"app",
"[",
"'schema.comparator'",
"]",
"->",
"getAlters",
"(",
")",
";",
"if",
"(",
"$",
"alters",
")",
"{",
"$",
"this",
"->",
"io",
"->",
"section",
... | Display a section of tables to be altered. | [
"Display",
"a",
"section",
"of",
"tables",
"to",
"be",
"altered",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/DatabaseCheck.php#L79-L97 |
bolt/bolt | src/EventListener/SystemLoggerListener.php | SystemLoggerListener.onException | public function onException(GetResponseForExceptionEvent $event)
{
if ($event->isMasterRequest()) {
return;
}
$exception = $event->getException();
$level = LogLevel::CRITICAL;
if ($exception instanceof HttpExceptionInterface && $exception->getStatusCode() < 500)... | php | public function onException(GetResponseForExceptionEvent $event)
{
if ($event->isMasterRequest()) {
return;
}
$exception = $event->getException();
$level = LogLevel::CRITICAL;
if ($exception instanceof HttpExceptionInterface && $exception->getStatusCode() < 500)... | [
"public",
"function",
"onException",
"(",
"GetResponseForExceptionEvent",
"$",
"event",
")",
"{",
"if",
"(",
"$",
"event",
"->",
"isMasterRequest",
"(",
")",
")",
"{",
"return",
";",
"}",
"$",
"exception",
"=",
"$",
"event",
"->",
"getException",
"(",
")",... | Log exceptions thrown in the application.
@param GetResponseForExceptionEvent $event | [
"Log",
"exceptions",
"thrown",
"in",
"the",
"application",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/EventListener/SystemLoggerListener.php#L38-L52 |
bolt/bolt | src/Routing/UrlGeneratorFragmentWrapper.php | UrlGeneratorFragmentWrapper.generate | public function generate($name, $parameters = [], $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH)
{
$fragment = isset($parameters['_fragment']) ? $parameters['_fragment'] : null;
unset($parameters['_fragment']);
if ($fragment === null && isset($parameters['#'])) {
$fragmen... | php | public function generate($name, $parameters = [], $referenceType = UrlGeneratorInterface::ABSOLUTE_PATH)
{
$fragment = isset($parameters['_fragment']) ? $parameters['_fragment'] : null;
unset($parameters['_fragment']);
if ($fragment === null && isset($parameters['#'])) {
$fragmen... | [
"public",
"function",
"generate",
"(",
"$",
"name",
",",
"$",
"parameters",
"=",
"[",
"]",
",",
"$",
"referenceType",
"=",
"UrlGeneratorInterface",
"::",
"ABSOLUTE_PATH",
")",
"{",
"$",
"fragment",
"=",
"isset",
"(",
"$",
"parameters",
"[",
"'_fragment'",
... | {@inheritdoc}
A key, "fragment", can be passed into $parameters whose value will appended to generated url after a "#" | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Routing/UrlGeneratorFragmentWrapper.php#L34-L50 |
bolt/bolt | src/Composer/Action/DependsPackage.php | DependsPackage.execute | public function execute($packageName, $textConstraint = '*', $onlyLocal = true)
{
$this->inverted = false;
return parent::execute($packageName, $textConstraint);
} | php | public function execute($packageName, $textConstraint = '*', $onlyLocal = true)
{
$this->inverted = false;
return parent::execute($packageName, $textConstraint);
} | [
"public",
"function",
"execute",
"(",
"$",
"packageName",
",",
"$",
"textConstraint",
"=",
"'*'",
",",
"$",
"onlyLocal",
"=",
"true",
")",
"{",
"$",
"this",
"->",
"inverted",
"=",
"false",
";",
"return",
"parent",
"::",
"execute",
"(",
"$",
"packageName"... | @param string $packageName
@param string $textConstraint
@param bool $onlyLocal
@return Dependency[]|null | [
"@param",
"string",
"$packageName",
"@param",
"string",
"$textConstraint",
"@param",
"bool",
"$onlyLocal"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/Action/DependsPackage.php#L22-L27 |
bolt/bolt | src/Twig/Extension/UserExtension.php | UserExtension.getFunctions | public function getFunctions()
{
$deprecated = ['deprecated' => true];
return [
// @codingStandardsIgnoreStart
new TwigFunction('getuser', [Runtime\UserRuntime::class, 'getUser']),
new TwigFunction('getuserid', [Runtime\UserRuntime::class, 'getUserId']),
... | php | public function getFunctions()
{
$deprecated = ['deprecated' => true];
return [
// @codingStandardsIgnoreStart
new TwigFunction('getuser', [Runtime\UserRuntime::class, 'getUser']),
new TwigFunction('getuserid', [Runtime\UserRuntime::class, 'getUserId']),
... | [
"public",
"function",
"getFunctions",
"(",
")",
"{",
"$",
"deprecated",
"=",
"[",
"'deprecated'",
"=>",
"true",
"]",
";",
"return",
"[",
"// @codingStandardsIgnoreStart",
"new",
"TwigFunction",
"(",
"'getuser'",
",",
"[",
"Runtime",
"\\",
"UserRuntime",
"::",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/Extension/UserExtension.php#L21-L33 |
bolt/bolt | src/Configuration/Validation/Configuration.php | Configuration.check | public function check()
{
$exceptions = $this->config->getExceptions();
if ($exceptions === null) {
return null;
}
foreach ($exceptions as $exception) {
$this->flashLogger->error($exception);
}
} | php | public function check()
{
$exceptions = $this->config->getExceptions();
if ($exceptions === null) {
return null;
}
foreach ($exceptions as $exception) {
$this->flashLogger->error($exception);
}
} | [
"public",
"function",
"check",
"(",
")",
"{",
"$",
"exceptions",
"=",
"$",
"this",
"->",
"config",
"->",
"getExceptions",
"(",
")",
";",
"if",
"(",
"$",
"exceptions",
"===",
"null",
")",
"{",
"return",
"null",
";",
"}",
"foreach",
"(",
"$",
"exceptio... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Configuration/Validation/Configuration.php#L23-L33 |
bolt/bolt | src/Extension/ContainerProxy.php | ContainerProxy.offsetGet | public function offsetGet($id)
{
if (!in_array($id, $this->serviceWhiteList)) {
throw new \LogicException(sprintf('You cannot retrieve services until the app has been booted. Attempting to access %s', $id));
}
return $this->container->offsetGet($id);
} | php | public function offsetGet($id)
{
if (!in_array($id, $this->serviceWhiteList)) {
throw new \LogicException(sprintf('You cannot retrieve services until the app has been booted. Attempting to access %s', $id));
}
return $this->container->offsetGet($id);
} | [
"public",
"function",
"offsetGet",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"id",
",",
"$",
"this",
"->",
"serviceWhiteList",
")",
")",
"{",
"throw",
"new",
"\\",
"LogicException",
"(",
"sprintf",
"(",
"'You cannot retrieve services ... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Extension/ContainerProxy.php#L43-L50 |
bolt/bolt | src/Twig/Runtime/TextRuntime.php | TextRuntime.localeDateTime | public function localeDateTime($dateTime, $format = '%B %e, %Y %H:%M', $locale = 0)
{
if (!$dateTime instanceof \DateTime) {
$dateTime = new \DateTime($dateTime);
}
// Check for Windows to find and replace the %e modifier correctly
// @see: http://php.net/strftime
... | php | public function localeDateTime($dateTime, $format = '%B %e, %Y %H:%M', $locale = 0)
{
if (!$dateTime instanceof \DateTime) {
$dateTime = new \DateTime($dateTime);
}
// Check for Windows to find and replace the %e modifier correctly
// @see: http://php.net/strftime
... | [
"public",
"function",
"localeDateTime",
"(",
"$",
"dateTime",
",",
"$",
"format",
"=",
"'%B %e, %Y %H:%M'",
",",
"$",
"locale",
"=",
"0",
")",
"{",
"if",
"(",
"!",
"$",
"dateTime",
"instanceof",
"\\",
"DateTime",
")",
"{",
"$",
"dateTime",
"=",
"new",
... | Returns the date time in a particular format. Takes the locale into
account.
@param string|\DateTime $dateTime
@param string $format
@return string Formatted date and time | [
"Returns",
"the",
"date",
"time",
"in",
"a",
"particular",
"format",
".",
"Takes",
"the",
"locale",
"into",
"account",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/Runtime/TextRuntime.php#L61-L90 |
bolt/bolt | src/Twig/Runtime/TextRuntime.php | TextRuntime.pregReplace | public function pregReplace($str, $pattern, $replacement = '', $limit = -1)
{
return preg_replace($pattern, $replacement, $str, $limit);
} | php | public function pregReplace($str, $pattern, $replacement = '', $limit = -1)
{
return preg_replace($pattern, $replacement, $str, $limit);
} | [
"public",
"function",
"pregReplace",
"(",
"$",
"str",
",",
"$",
"pattern",
",",
"$",
"replacement",
"=",
"''",
",",
"$",
"limit",
"=",
"-",
"1",
")",
"{",
"return",
"preg_replace",
"(",
"$",
"pattern",
",",
"$",
"replacement",
",",
"$",
"str",
",",
... | Perform a regular expression search and replace on the given string.
@param string $str
@param string $pattern
@param string $replacement
@param int $limit
@return string Same string where first character is in upper case | [
"Perform",
"a",
"regular",
"expression",
"search",
"and",
"replace",
"on",
"the",
"given",
"string",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/Runtime/TextRuntime.php#L102-L105 |
bolt/bolt | src/Twig/Runtime/TextRuntime.php | TextRuntime.safeString | public function safeString($str, $strict = false, $extrachars = '')
{
return Str::makeSafe($str, $strict, $extrachars);
} | php | public function safeString($str, $strict = false, $extrachars = '')
{
return Str::makeSafe($str, $strict, $extrachars);
} | [
"public",
"function",
"safeString",
"(",
"$",
"str",
",",
"$",
"strict",
"=",
"false",
",",
"$",
"extrachars",
"=",
"''",
")",
"{",
"return",
"Str",
"::",
"makeSafe",
"(",
"$",
"str",
",",
"$",
"strict",
",",
"$",
"extrachars",
")",
";",
"}"
] | Return a 'safe string' version of a given string.
@see function Bolt\Library::safeString()
@param string $str
@param bool $strict
@param string $extrachars
@return string | [
"Return",
"a",
"safe",
"string",
"version",
"of",
"a",
"given",
"string",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/Runtime/TextRuntime.php#L118-L121 |
bolt/bolt | src/Twig/Runtime/TextRuntime.php | TextRuntime.slug | public function slug($str)
{
if (is_array($str)) {
$str = implode(' ', $str);
}
return $this->slugify->slugify($str);
} | php | public function slug($str)
{
if (is_array($str)) {
$str = implode(' ', $str);
}
return $this->slugify->slugify($str);
} | [
"public",
"function",
"slug",
"(",
"$",
"str",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"str",
")",
")",
"{",
"$",
"str",
"=",
"implode",
"(",
"' '",
",",
"$",
"str",
")",
";",
"}",
"return",
"$",
"this",
"->",
"slugify",
"->",
"slugify",
"("... | Return the 'sluggified' version of a string.
@param string $str input value
@return string Slug safe version of the string | [
"Return",
"the",
"sluggified",
"version",
"of",
"a",
"string",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/Runtime/TextRuntime.php#L130-L137 |
bolt/bolt | src/Twig/Runtime/ImageRuntime.php | ImageRuntime.image | public function image(Environment $env, $fileName = null, $width = null, $height = null, $crop = null)
{
//Check if it's an alias as the only parameter after $filename
if ($width && !$height && !$crop && $this->isAlias($width)) {
return $this->getAliasedUri($fileName, $width);
}
... | php | public function image(Environment $env, $fileName = null, $width = null, $height = null, $crop = null)
{
//Check if it's an alias as the only parameter after $filename
if ($width && !$height && !$crop && $this->isAlias($width)) {
return $this->getAliasedUri($fileName, $width);
}
... | [
"public",
"function",
"image",
"(",
"Environment",
"$",
"env",
",",
"$",
"fileName",
"=",
"null",
",",
"$",
"width",
"=",
"null",
",",
"$",
"height",
"=",
"null",
",",
"$",
"crop",
"=",
"null",
")",
"{",
"//Check if it's an alias as the only parameter after ... | Helper function to make a path to an image.
@param Environment $env
@param string|array $fileName Target filename
@param string|int $width Target width
@param string|int $height Target height
@param string $crop String identifier for cropped images
@return string Image path | [
"Helper",
"function",
"to",
"make",
"a",
"path",
"to",
"an",
"image",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/Runtime/ImageRuntime.php#L63-L96 |
bolt/bolt | src/Twig/Runtime/ImageRuntime.php | ImageRuntime.imageInfo | public function imageInfo($fileName)
{
if ($fileName instanceof ImageInterface) {
return $fileName;
}
$image = $this->filesystem->getFile('files://' . $fileName, new NullableImage());
return $image;
} | php | public function imageInfo($fileName)
{
if ($fileName instanceof ImageInterface) {
return $fileName;
}
$image = $this->filesystem->getFile('files://' . $fileName, new NullableImage());
return $image;
} | [
"public",
"function",
"imageInfo",
"(",
"$",
"fileName",
")",
"{",
"if",
"(",
"$",
"fileName",
"instanceof",
"ImageInterface",
")",
"{",
"return",
"$",
"fileName",
";",
"}",
"$",
"image",
"=",
"$",
"this",
"->",
"filesystem",
"->",
"getFile",
"(",
"'file... | Get an image.
@param string $fileName
@return \Bolt\Filesystem\Handler\ImageInterface | [
"Get",
"an",
"image",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/Runtime/ImageRuntime.php#L105-L114 |
bolt/bolt | src/Twig/Runtime/ImageRuntime.php | ImageRuntime.popup | public function popup($fileName = null, $width = null, $height = null, $crop = null, $title = null)
{
if (empty($fileName)) {
return '';
}
$thumbconf = $this->config->get('general/thumbnails');
$fullwidth = !empty($thumbconf['default_image'][0]) ? $thumbconf['default_ima... | php | public function popup($fileName = null, $width = null, $height = null, $crop = null, $title = null)
{
if (empty($fileName)) {
return '';
}
$thumbconf = $this->config->get('general/thumbnails');
$fullwidth = !empty($thumbconf['default_image'][0]) ? $thumbconf['default_ima... | [
"public",
"function",
"popup",
"(",
"$",
"fileName",
"=",
"null",
",",
"$",
"width",
"=",
"null",
",",
"$",
"height",
"=",
"null",
",",
"$",
"crop",
"=",
"null",
",",
"$",
"title",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"fileName",
... | Helper function to wrap an image in a Magnific popup HTML tag, with thumbnail.
example: {{ content.image|popup(320, 240) }}
example: {{ popup(content.image, 320, 240) }}
example: {{ content.image|popup(width=320, height=240, title="My Image") }}
Note: This function used to be called 'fancybox', but Fancybox was
depre... | [
"Helper",
"function",
"to",
"wrap",
"an",
"image",
"in",
"a",
"Magnific",
"popup",
"HTML",
"tag",
"with",
"thumbnail",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/Runtime/ImageRuntime.php#L134-L167 |
bolt/bolt | src/Twig/Runtime/ImageRuntime.php | ImageRuntime.showImage | public function showImage($fileName = null, $width = null, $height = null, $crop = null)
{
if (empty($fileName)) {
return '';
}
$thumb = $this->getThumbnail($fileName, $width, $height, $crop);
if ($width === null && $height === null) {
$thumbconf = $this->con... | php | public function showImage($fileName = null, $width = null, $height = null, $crop = null)
{
if (empty($fileName)) {
return '';
}
$thumb = $this->getThumbnail($fileName, $width, $height, $crop);
if ($width === null && $height === null) {
$thumbconf = $this->con... | [
"public",
"function",
"showImage",
"(",
"$",
"fileName",
"=",
"null",
",",
"$",
"width",
"=",
"null",
",",
"$",
"height",
"=",
"null",
",",
"$",
"crop",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"fileName",
")",
")",
"{",
"return",
"''... | Helper function to show an image on a rendered page.
Set width or height parameter to '0' for proportional scaling.
Set them both to null (or not at all) to get the default size from config.yml.
Example: {{ content.image|showimage(320, 240) }}
Example: {{ showimage(content.image, 320, 240) }}
@param string $fileName... | [
"Helper",
"function",
"to",
"show",
"an",
"image",
"on",
"a",
"rendered",
"page",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/Runtime/ImageRuntime.php#L185-L220 |
bolt/bolt | src/Twig/Runtime/ImageRuntime.php | ImageRuntime.thumbnail | public function thumbnail($fileName = null, $width = null, $height = null, $crop = null)
{
//Check if it's an alias as the only parameter after $filename
if ($width && !$height && !$crop && $this->isAlias($width)) {
return $this->getAliasedUri($fileName, $width);
}
$thum... | php | public function thumbnail($fileName = null, $width = null, $height = null, $crop = null)
{
//Check if it's an alias as the only parameter after $filename
if ($width && !$height && !$crop && $this->isAlias($width)) {
return $this->getAliasedUri($fileName, $width);
}
$thum... | [
"public",
"function",
"thumbnail",
"(",
"$",
"fileName",
"=",
"null",
",",
"$",
"width",
"=",
"null",
",",
"$",
"height",
"=",
"null",
",",
"$",
"crop",
"=",
"null",
")",
"{",
"//Check if it's an alias as the only parameter after $filename",
"if",
"(",
"$",
... | Helper function to make a path to an image thumbnail.
@param string $fileName Target filename
@param string|int $width Target width
@param string|int $height Target height
@param string $crop zooming and cropping: Set to 'f(it)', 'b(orders)', 'r(esize)' or 'c(rop)'
Set width or height parameter to '0'... | [
"Helper",
"function",
"to",
"make",
"a",
"path",
"to",
"an",
"image",
"thumbnail",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/Runtime/ImageRuntime.php#L234-L244 |
bolt/bolt | src/Twig/Runtime/ImageRuntime.php | ImageRuntime.getThumbnail | private function getThumbnail($fileName = null, $width = null, $height = null, $scale = null)
{
$thumb = new Thumbnail($this->config->get('general/thumbnails'));
$thumb
->setFileName($fileName)
->setWidth($width)
->setHeight($height)
->setScale($scale)... | php | private function getThumbnail($fileName = null, $width = null, $height = null, $scale = null)
{
$thumb = new Thumbnail($this->config->get('general/thumbnails'));
$thumb
->setFileName($fileName)
->setWidth($width)
->setHeight($height)
->setScale($scale)... | [
"private",
"function",
"getThumbnail",
"(",
"$",
"fileName",
"=",
"null",
",",
"$",
"width",
"=",
"null",
",",
"$",
"height",
"=",
"null",
",",
"$",
"scale",
"=",
"null",
")",
"{",
"$",
"thumb",
"=",
"new",
"Thumbnail",
"(",
"$",
"this",
"->",
"con... | Get a thumbnail object.
@param string|array $fileName
@param int $width
@param int $height
@param string $scale
@return Thumbnail | [
"Get",
"a",
"thumbnail",
"object",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/Runtime/ImageRuntime.php#L256-L267 |
bolt/bolt | src/Twig/Runtime/ImageRuntime.php | ImageRuntime.getThumbnailUri | private function getThumbnailUri(Thumbnail $thumb)
{
$fileName = $thumb->getFileName();
if ($fileName === null || $fileName === '') {
return false;
}
return $this->urlGenerator->generate(
'thumb',
[
'width' => $thumb->getWidth(),
... | php | private function getThumbnailUri(Thumbnail $thumb)
{
$fileName = $thumb->getFileName();
if ($fileName === null || $fileName === '') {
return false;
}
return $this->urlGenerator->generate(
'thumb',
[
'width' => $thumb->getWidth(),
... | [
"private",
"function",
"getThumbnailUri",
"(",
"Thumbnail",
"$",
"thumb",
")",
"{",
"$",
"fileName",
"=",
"$",
"thumb",
"->",
"getFileName",
"(",
")",
";",
"if",
"(",
"$",
"fileName",
"===",
"null",
"||",
"$",
"fileName",
"===",
"''",
")",
"{",
"return... | Get the thumbnail relative URI, using width, height and action.
@param Thumbnail $thumb
@return string | [
"Get",
"the",
"thumbnail",
"relative",
"URI",
"using",
"width",
"height",
"and",
"action",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/Runtime/ImageRuntime.php#L276-L292 |
bolt/bolt | src/Twig/Runtime/ImageRuntime.php | ImageRuntime.getAliasedUri | private function getAliasedUri($fileName, $alias)
{
if ($fileName === null) {
return false;
}
if (!$this->isAlias($alias)) {
return false;
}
// If we're passing in an image as array, instead of a single filename.
$fileName = $this->normalizeF... | php | private function getAliasedUri($fileName, $alias)
{
if ($fileName === null) {
return false;
}
if (!$this->isAlias($alias)) {
return false;
}
// If we're passing in an image as array, instead of a single filename.
$fileName = $this->normalizeF... | [
"private",
"function",
"getAliasedUri",
"(",
"$",
"fileName",
",",
"$",
"alias",
")",
"{",
"if",
"(",
"$",
"fileName",
"===",
"null",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"!",
"$",
"this",
"->",
"isAlias",
"(",
"$",
"alias",
")",
")",
... | Get the thumbnail relative URI, using an alias.
@param string|null $fileName
@param string $alias
@return string | [
"Get",
"the",
"thumbnail",
"relative",
"URI",
"using",
"an",
"alias",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/Runtime/ImageRuntime.php#L302-L322 |
bolt/bolt | src/Twig/Runtime/ImageRuntime.php | ImageRuntime.normalizeFileName | private function normalizeFileName($fileName)
{
if (!is_array($fileName)) {
return $fileName;
}
return isset($fileName['filename']) ? $fileName['filename']
: isset($fileName['file']) ? $fileName['file'] : ''
;
} | php | private function normalizeFileName($fileName)
{
if (!is_array($fileName)) {
return $fileName;
}
return isset($fileName['filename']) ? $fileName['filename']
: isset($fileName['file']) ? $fileName['file'] : ''
;
} | [
"private",
"function",
"normalizeFileName",
"(",
"$",
"fileName",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"fileName",
")",
")",
"{",
"return",
"$",
"fileName",
";",
"}",
"return",
"isset",
"(",
"$",
"fileName",
"[",
"'filename'",
"]",
")",
"?",... | If $fileName is an array with 'filename' or 'file' return that property,
otherwise return passed value.
@param array|string $fileName
@return string | [
"If",
"$fileName",
"is",
"an",
"array",
"with",
"filename",
"or",
"file",
"return",
"that",
"property",
"otherwise",
"return",
"passed",
"value",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/Runtime/ImageRuntime.php#L343-L352 |
bolt/bolt | src/Nut/DatabasePrefill.php | DatabasePrefill.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
$contentTypeNames = (array) $input->getArgument('contenttypes');
if (empty($contentTypeNames)) {
$contentTypeNames = $this->getContentTypeNames();
}
if (!$input->getOption('no-interaction')) {
... | php | protected function execute(InputInterface $input, OutputInterface $output)
{
$contentTypeNames = (array) $input->getArgument('contenttypes');
if (empty($contentTypeNames)) {
$contentTypeNames = $this->getContentTypeNames();
}
if (!$input->getOption('no-interaction')) {
... | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"contentTypeNames",
"=",
"(",
"array",
")",
"$",
"input",
"->",
"getArgument",
"(",
"'contenttypes'",
")",
";",
"if",
"(",
"empty",... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/DatabasePrefill.php#L33-L58 |
bolt/bolt | src/EventListener/StorageEventListener.php | StorageEventListener.onUserEntityPreSave | public function onUserEntityPreSave(StorageEvent $event)
{
/** @var Entity\Users $entityRecord */
$entityRecord = $event->getContent();
if ($entityRecord instanceof Entity\Users) {
$this->passwordHash($entityRecord);
}
} | php | public function onUserEntityPreSave(StorageEvent $event)
{
/** @var Entity\Users $entityRecord */
$entityRecord = $event->getContent();
if ($entityRecord instanceof Entity\Users) {
$this->passwordHash($entityRecord);
}
} | [
"public",
"function",
"onUserEntityPreSave",
"(",
"StorageEvent",
"$",
"event",
")",
"{",
"/** @var Entity\\Users $entityRecord */",
"$",
"entityRecord",
"=",
"$",
"event",
"->",
"getContent",
"(",
")",
";",
"if",
"(",
"$",
"entityRecord",
"instanceof",
"Entity",
... | Pre-save storage event for user entities.
@param StorageEvent $event | [
"Pre",
"-",
"save",
"storage",
"event",
"for",
"user",
"entities",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/EventListener/StorageEventListener.php#L84-L92 |
bolt/bolt | src/EventListener/StorageEventListener.php | StorageEventListener.onPostHydrate | public function onPostHydrate(HydrationEvent $event)
{
$entity = $event->getSubject();
if (!$entity instanceof Entity\Users) {
return;
}
// Ensure Permissions::ROLE_EVERYONE always exists
$roles = $entity->getRoles();
if (!in_array(Permissions::ROLE_EVERY... | php | public function onPostHydrate(HydrationEvent $event)
{
$entity = $event->getSubject();
if (!$entity instanceof Entity\Users) {
return;
}
// Ensure Permissions::ROLE_EVERYONE always exists
$roles = $entity->getRoles();
if (!in_array(Permissions::ROLE_EVERY... | [
"public",
"function",
"onPostHydrate",
"(",
"HydrationEvent",
"$",
"event",
")",
"{",
"$",
"entity",
"=",
"$",
"event",
"->",
"getSubject",
"(",
")",
";",
"if",
"(",
"!",
"$",
"entity",
"instanceof",
"Entity",
"\\",
"Users",
")",
"{",
"return",
";",
"}... | Post hydration storage event.
@param HydrationEvent $event | [
"Post",
"hydration",
"storage",
"event",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/EventListener/StorageEventListener.php#L99-L112 |
bolt/bolt | src/EventListener/StorageEventListener.php | StorageEventListener.onPreDelete | public function onPreDelete(StorageEvent $event)
{
$entity = $event->getContent();
if (!$entity instanceof Entity\Content) {
return;
}
$taxonomies = $entity->getTaxonomy();
if ($taxonomies instanceof Collection\Taxonomy) {
$repo = $this->em->getReposit... | php | public function onPreDelete(StorageEvent $event)
{
$entity = $event->getContent();
if (!$entity instanceof Entity\Content) {
return;
}
$taxonomies = $entity->getTaxonomy();
if ($taxonomies instanceof Collection\Taxonomy) {
$repo = $this->em->getReposit... | [
"public",
"function",
"onPreDelete",
"(",
"StorageEvent",
"$",
"event",
")",
"{",
"$",
"entity",
"=",
"$",
"event",
"->",
"getContent",
"(",
")",
";",
"if",
"(",
"!",
"$",
"entity",
"instanceof",
"Entity",
"\\",
"Content",
")",
"{",
"return",
";",
"}",... | Pre-delete event to delete an entities taxonomy & relation entities.
@param StorageEvent $event | [
"Pre",
"-",
"delete",
"event",
"to",
"delete",
"an",
"entities",
"taxonomy",
"&",
"relation",
"entities",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/EventListener/StorageEventListener.php#L119-L139 |
bolt/bolt | src/EventListener/StorageEventListener.php | StorageEventListener.onKernelRequest | public function onKernelRequest(GetResponseEvent $event)
{
if (!$event->isMasterRequest()) {
return;
}
if ($this->isProfilerRequest($event->getRequest())) {
return;
}
$this->schemaCheck($event);
// Check if we need to 'publish' any 'timed' re... | php | public function onKernelRequest(GetResponseEvent $event)
{
if (!$event->isMasterRequest()) {
return;
}
if ($this->isProfilerRequest($event->getRequest())) {
return;
}
$this->schemaCheck($event);
// Check if we need to 'publish' any 'timed' re... | [
"public",
"function",
"onKernelRequest",
"(",
"GetResponseEvent",
"$",
"event",
")",
"{",
"if",
"(",
"!",
"$",
"event",
"->",
"isMasterRequest",
"(",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"isProfilerRequest",
"(",
"$",
"event",... | Kernel request listener callback.
@param GetResponseEvent $event | [
"Kernel",
"request",
"listener",
"callback",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/EventListener/StorageEventListener.php#L146-L164 |
bolt/bolt | src/EventListener/StorageEventListener.php | StorageEventListener.schemaCheck | protected function schemaCheck(GetResponseEvent $event)
{
$session = $event->getRequest()->getSession();
$validSession = $session->isStarted() && $session->get('authentication');
$expired = $this->schemaManager->isCheckRequired();
// Don't show the check if we're in the dbcheck alre... | php | protected function schemaCheck(GetResponseEvent $event)
{
$session = $event->getRequest()->getSession();
$validSession = $session->isStarted() && $session->get('authentication');
$expired = $this->schemaManager->isCheckRequired();
// Don't show the check if we're in the dbcheck alre... | [
"protected",
"function",
"schemaCheck",
"(",
"GetResponseEvent",
"$",
"event",
")",
"{",
"$",
"session",
"=",
"$",
"event",
"->",
"getRequest",
"(",
")",
"->",
"getSession",
"(",
")",
";",
"$",
"validSession",
"=",
"$",
"session",
"->",
"isStarted",
"(",
... | Trigger database schema checks if required.
@param GetResponseEvent $event | [
"Trigger",
"database",
"schema",
"checks",
"if",
"required",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/EventListener/StorageEventListener.php#L171-L193 |
bolt/bolt | src/EventListener/StorageEventListener.php | StorageEventListener.passwordHash | protected function passwordHash(Entity\Users $usersEntity)
{
if ($usersEntity->getPassword() !== null) {
$usersEntity->setPassword($this->getValidHash($usersEntity->getPassword()));
}
} | php | protected function passwordHash(Entity\Users $usersEntity)
{
if ($usersEntity->getPassword() !== null) {
$usersEntity->setPassword($this->getValidHash($usersEntity->getPassword()));
}
} | [
"protected",
"function",
"passwordHash",
"(",
"Entity",
"\\",
"Users",
"$",
"usersEntity",
")",
"{",
"if",
"(",
"$",
"usersEntity",
"->",
"getPassword",
"(",
")",
"!==",
"null",
")",
"{",
"$",
"usersEntity",
"->",
"setPassword",
"(",
"$",
"this",
"->",
"... | Hash user passwords on save.
@param Entity\Users $usersEntity | [
"Hash",
"user",
"passwords",
"on",
"save",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/EventListener/StorageEventListener.php#L200-L205 |
bolt/bolt | src/EventListener/StorageEventListener.php | StorageEventListener.getValidHash | private function getValidHash($password)
{
if (Password\Blowfish::detect($password)) {
return $password;
}
if (Password\PHPASS::detect($password)) {
return $password;
}
if (strlen($password) < 6) {
throw new AccessControlException('Can not ... | php | private function getValidHash($password)
{
if (Password\Blowfish::detect($password)) {
return $password;
}
if (Password\PHPASS::detect($password)) {
return $password;
}
if (strlen($password) < 6) {
throw new AccessControlException('Can not ... | [
"private",
"function",
"getValidHash",
"(",
"$",
"password",
")",
"{",
"if",
"(",
"Password",
"\\",
"Blowfish",
"::",
"detect",
"(",
"$",
"password",
")",
")",
"{",
"return",
"$",
"password",
";",
"}",
"if",
"(",
"Password",
"\\",
"PHPASS",
"::",
"dete... | Return a valid hash for a password, of if the password is already hashed
just return as is.
@param string $password
@throws AccessControlException
@return string | [
"Return",
"a",
"valid",
"hash",
"for",
"a",
"password",
"of",
"if",
"the",
"password",
"is",
"already",
"hashed",
"just",
"return",
"as",
"is",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/EventListener/StorageEventListener.php#L217-L230 |
bolt/bolt | src/Configuration/PathsProxy.php | PathsProxy.offsetGet | public function offsetGet($offset)
{
Deprecated::warn(
"\$app['paths']['$offset'] in PHP and {{ paths.$offset }} in Twig",
3.0,
'Instead use UrlGenerator or Asset Packages for urls, and Bolt\Filesystem (recommended)' .
' or PathResolver::resolve for filesystem... | php | public function offsetGet($offset)
{
Deprecated::warn(
"\$app['paths']['$offset'] in PHP and {{ paths.$offset }} in Twig",
3.0,
'Instead use UrlGenerator or Asset Packages for urls, and Bolt\Filesystem (recommended)' .
' or PathResolver::resolve for filesystem... | [
"public",
"function",
"offsetGet",
"(",
"$",
"offset",
")",
"{",
"Deprecated",
"::",
"warn",
"(",
"\"\\$app['paths']['$offset'] in PHP and {{ paths.$offset }} in Twig\"",
",",
"3.0",
",",
"'Instead use UrlGenerator or Asset Packages for urls, and Bolt\\Filesystem (recommended)'",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Configuration/PathsProxy.php#L42-L67 |
bolt/bolt | src/Storage/Migration/Export.php | Export.run | public function run(array $exportContentTypes, MutableBag $responseBag, $includeUsers = false)
{
// Get initial data object
$exportData = MutableBag::from([]);
// Add the meta header
$this->addExportMeta($exportData);
if ($includeUsers) {
$this->addExportUsers($ex... | php | public function run(array $exportContentTypes, MutableBag $responseBag, $includeUsers = false)
{
// Get initial data object
$exportData = MutableBag::from([]);
// Add the meta header
$this->addExportMeta($exportData);
if ($includeUsers) {
$this->addExportUsers($ex... | [
"public",
"function",
"run",
"(",
"array",
"$",
"exportContentTypes",
",",
"MutableBag",
"$",
"responseBag",
",",
"$",
"includeUsers",
"=",
"false",
")",
"{",
"// Get initial data object",
"$",
"exportData",
"=",
"MutableBag",
"::",
"from",
"(",
"[",
"]",
")",... | Run the export process and return the data.
@param array $exportContentTypes
@param MutableBag $responseBag
@param bool $includeUsers
@throws \Bolt\Exception\InvalidRepositoryException
@return MutableBag | [
"Run",
"the",
"export",
"process",
"and",
"return",
"the",
"data",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Migration/Export.php#L54-L71 |
bolt/bolt | src/Storage/Migration/Export.php | Export.addExportMeta | private function addExportMeta(MutableBag $exportData)
{
$exportData->set('__bolt_export_meta', [
'date' => Carbon::now()->toRfc3339String(),
'version' => Version::forComposer(),
'platform' => $this->em->getConnection()->getDatabasePlatform()->getName(),
]);
... | php | private function addExportMeta(MutableBag $exportData)
{
$exportData->set('__bolt_export_meta', [
'date' => Carbon::now()->toRfc3339String(),
'version' => Version::forComposer(),
'platform' => $this->em->getConnection()->getDatabasePlatform()->getName(),
]);
... | [
"private",
"function",
"addExportMeta",
"(",
"MutableBag",
"$",
"exportData",
")",
"{",
"$",
"exportData",
"->",
"set",
"(",
"'__bolt_export_meta'",
",",
"[",
"'date'",
"=>",
"Carbon",
"::",
"now",
"(",
")",
"->",
"toRfc3339String",
"(",
")",
",",
"'version'... | Add the export meta information.
@param MutableBag $exportData | [
"Add",
"the",
"export",
"meta",
"information",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Migration/Export.php#L78-L85 |
bolt/bolt | src/Storage/Migration/Export.php | Export.addExportUsers | private function addExportUsers(MutableBag $exportData)
{
$repo = $this->em->getRepository(Users::class);
$users = $repo->findAll();
$export = [];
/** @var Entity $user */
foreach ($users as $user) {
$export[] = Bag::from($user->toArray())
->filter... | php | private function addExportUsers(MutableBag $exportData)
{
$repo = $this->em->getRepository(Users::class);
$users = $repo->findAll();
$export = [];
/** @var Entity $user */
foreach ($users as $user) {
$export[] = Bag::from($user->toArray())
->filter... | [
"private",
"function",
"addExportUsers",
"(",
"MutableBag",
"$",
"exportData",
")",
"{",
"$",
"repo",
"=",
"$",
"this",
"->",
"em",
"->",
"getRepository",
"(",
"Users",
"::",
"class",
")",
";",
"$",
"users",
"=",
"$",
"repo",
"->",
"findAll",
"(",
")",... | Add the user table to the export.
@param MutableBag $exportData
@throws \Bolt\Exception\InvalidRepositoryException | [
"Add",
"the",
"user",
"table",
"to",
"the",
"export",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Migration/Export.php#L94-L108 |
bolt/bolt | src/Storage/Migration/Export.php | Export.getRecords | private function getRecords($contentTypeName, MutableBag $exportData, MutableBag $responseBag)
{
/** @var ContentRepository $repo */
$repo = $this->em->getRepository($contentTypeName);
$metadata = $repo->getClassMetadata();
// Get all the records for the ContentType
$entities... | php | private function getRecords($contentTypeName, MutableBag $exportData, MutableBag $responseBag)
{
/** @var ContentRepository $repo */
$repo = $this->em->getRepository($contentTypeName);
$metadata = $repo->getClassMetadata();
// Get all the records for the ContentType
$entities... | [
"private",
"function",
"getRecords",
"(",
"$",
"contentTypeName",
",",
"MutableBag",
"$",
"exportData",
",",
"MutableBag",
"$",
"responseBag",
")",
"{",
"/** @var ContentRepository $repo */",
"$",
"repo",
"=",
"$",
"this",
"->",
"em",
"->",
"getRepository",
"(",
... | Get the records for a given ContentType.
@param string $contentTypeName
@param MutableBag $exportData
@param MutableBag $responseBag
@throws \Bolt\Exception\InvalidRepositoryException | [
"Get",
"the",
"records",
"for",
"a",
"given",
"ContentType",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Migration/Export.php#L119-L135 |
bolt/bolt | src/Storage/Migration/Export.php | Export.addRecord | private function addRecord(MutableBag $contentTypeBag, ClassMetadata $metadata, Content $entity)
{
$values = [];
foreach ($metadata->getFieldMappings() as $field) {
$fieldName = $field['fieldname'];
$val = $entity->$fieldName;
if (in_array($field['type'], ['date',... | php | private function addRecord(MutableBag $contentTypeBag, ClassMetadata $metadata, Content $entity)
{
$values = [];
foreach ($metadata->getFieldMappings() as $field) {
$fieldName = $field['fieldname'];
$val = $entity->$fieldName;
if (in_array($field['type'], ['date',... | [
"private",
"function",
"addRecord",
"(",
"MutableBag",
"$",
"contentTypeBag",
",",
"ClassMetadata",
"$",
"metadata",
",",
"Content",
"$",
"entity",
")",
"{",
"$",
"values",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"metadata",
"->",
"getFieldMappings",
"(",
... | Add a single record to the export data.
@param MutableBag $contentTypeBag
@param ClassMetadata $metadata
@param Content $entity | [
"Add",
"a",
"single",
"record",
"to",
"the",
"export",
"data",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Migration/Export.php#L144-L163 |
bolt/bolt | src/Twig/Runtime/AdminRuntime.php | AdminRuntime.addData | public function addData($path, $value)
{
$path = explode('.', $path);
if (empty($path[0])) {
return;
}
$jsdata = $this->app['jsdata'];
$part = &$jsdata;
foreach ($path as $key) {
if (!isset($part[$key])) {
$part[$key] = [];
... | php | public function addData($path, $value)
{
$path = explode('.', $path);
if (empty($path[0])) {
return;
}
$jsdata = $this->app['jsdata'];
$part = &$jsdata;
foreach ($path as $key) {
if (!isset($part[$key])) {
$part[$key] = [];
... | [
"public",
"function",
"addData",
"(",
"$",
"path",
",",
"$",
"value",
")",
"{",
"$",
"path",
"=",
"explode",
"(",
"'.'",
",",
"$",
"path",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"path",
"[",
"0",
"]",
")",
")",
"{",
"return",
";",
"}",
"$",
... | Add JavaScript data to app['jsdata'].
@param string $path
@param mixed $value | [
"Add",
"JavaScript",
"data",
"to",
"app",
"[",
"jsdata",
"]",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/Runtime/AdminRuntime.php#L59-L80 |
bolt/bolt | src/Twig/Runtime/AdminRuntime.php | AdminRuntime.stack | public function stack($types = [])
{
if (is_string($types)) {
$types = explode(',', $types) ?: [];
$types = array_filter(array_map('trim', $types));
}
$files = $this->stack->getList($types);
return $files;
} | php | public function stack($types = [])
{
if (is_string($types)) {
$types = explode(',', $types) ?: [];
$types = array_filter(array_map('trim', $types));
}
$files = $this->stack->getList($types);
return $files;
} | [
"public",
"function",
"stack",
"(",
"$",
"types",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"types",
")",
")",
"{",
"$",
"types",
"=",
"explode",
"(",
"','",
",",
"$",
"types",
")",
"?",
":",
"[",
"]",
";",
"$",
"types",
"=",... | Return an array with the items on the stack.
@param array|string $types
@return array An array of items | [
"Return",
"an",
"array",
"with",
"the",
"items",
"on",
"the",
"stack",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/Runtime/AdminRuntime.php#L108-L118 |
bolt/bolt | src/Twig/Runtime/AdminRuntime.php | AdminRuntime.logLevel | public function logLevel($level)
{
if (!is_numeric($level)) {
return $level;
}
try {
return ucfirst(strtolower(\Monolog\Logger::getLevelName($level)));
} catch (\Exception $e) {
return $level;
}
} | php | public function logLevel($level)
{
if (!is_numeric($level)) {
return $level;
}
try {
return ucfirst(strtolower(\Monolog\Logger::getLevelName($level)));
} catch (\Exception $e) {
return $level;
}
} | [
"public",
"function",
"logLevel",
"(",
"$",
"level",
")",
"{",
"if",
"(",
"!",
"is_numeric",
"(",
"$",
"level",
")",
")",
"{",
"return",
"$",
"level",
";",
"}",
"try",
"{",
"return",
"ucfirst",
"(",
"strtolower",
"(",
"\\",
"Monolog",
"\\",
"Logger",... | Convert a Monolog log level to textual equivalent.
@param int $level
@return string | [
"Convert",
"a",
"Monolog",
"log",
"level",
"to",
"textual",
"equivalent",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/Runtime/AdminRuntime.php#L127-L138 |
bolt/bolt | src/Twig/Runtime/AdminRuntime.php | AdminRuntime.trans | public function trans()
{
$args = func_get_args();
$numArgs = func_num_args();
switch ($numArgs) {
case 4:
return Trans::__($args[0], $args[1], $args[2], $args[3]);
case 3:
return Trans::__($args[0], $args[1], $args[2]);
ca... | php | public function trans()
{
$args = func_get_args();
$numArgs = func_num_args();
switch ($numArgs) {
case 4:
return Trans::__($args[0], $args[1], $args[2], $args[3]);
case 3:
return Trans::__($args[0], $args[1], $args[2]);
ca... | [
"public",
"function",
"trans",
"(",
")",
"{",
"$",
"args",
"=",
"func_get_args",
"(",
")",
";",
"$",
"numArgs",
"=",
"func_num_args",
"(",
")",
";",
"switch",
"(",
"$",
"numArgs",
")",
"{",
"case",
"4",
":",
"return",
"Trans",
"::",
"__",
"(",
"$",... | Translate using our __().
@internal
@internal param array $args
@internal param int $numArgs
@return string Translated content | [
"Translate",
"using",
"our",
"__",
"()",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/Runtime/AdminRuntime.php#L149-L166 |
bolt/bolt | src/Twig/Runtime/AdminRuntime.php | AdminRuntime.randomQuote | public function randomQuote()
{
$quotes = [
'Complexity is your enemy. Any fool can make something complicated. It is hard to make something simple.#Richard Branson',
'It takes a lot of effort to make things look effortless.#Mark Pilgrim',
'Perfection is achieved, not whe... | php | public function randomQuote()
{
$quotes = [
'Complexity is your enemy. Any fool can make something complicated. It is hard to make something simple.#Richard Branson',
'It takes a lot of effort to make things look effortless.#Mark Pilgrim',
'Perfection is achieved, not whe... | [
"public",
"function",
"randomQuote",
"(",
")",
"{",
"$",
"quotes",
"=",
"[",
"'Complexity is your enemy. Any fool can make something complicated. It is hard to make something simple.#Richard Branson'",
",",
"'It takes a lot of effort to make things look effortless.#Mark Pilgrim'",
",",
"... | Returns a random quote. Just for fun.
@return string | [
"Returns",
"a",
"random",
"quote",
".",
"Just",
"for",
"fun",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/Runtime/AdminRuntime.php#L173-L209 |
bolt/bolt | src/Twig/Runtime/AdminRuntime.php | AdminRuntime.ymllink | public function ymllink($str)
{
return preg_replace_callback(
'/ ([a-z0-9_-]+\.yml)/i',
function ($matches) {
$path = $this->urlGenerator->generate('fileedit', ['namespace' => 'config', 'file' => $matches[1]]);
$link = sprintf(' <a href="%s">%s</a>', $... | php | public function ymllink($str)
{
return preg_replace_callback(
'/ ([a-z0-9_-]+\.yml)/i',
function ($matches) {
$path = $this->urlGenerator->generate('fileedit', ['namespace' => 'config', 'file' => $matches[1]]);
$link = sprintf(' <a href="%s">%s</a>', $... | [
"public",
"function",
"ymllink",
"(",
"$",
"str",
")",
"{",
"return",
"preg_replace_callback",
"(",
"'/ ([a-z0-9_-]+\\.yml)/i'",
",",
"function",
"(",
"$",
"matches",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"urlGenerator",
"->",
"generate",
"(",
"'fil... | Create a link to edit a .yml file, if a filename is detected in the string. Mostly
for use in Flashbag messages, to allow easy editing.
@param string $str
@return string Resulting string | [
"Create",
"a",
"link",
"to",
"edit",
"a",
".",
"yml",
"file",
"if",
"a",
"filename",
"is",
"detected",
"in",
"the",
"string",
".",
"Mostly",
"for",
"use",
"in",
"Flashbag",
"messages",
"to",
"allow",
"easy",
"editing",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/Runtime/AdminRuntime.php#L219-L231 |
bolt/bolt | src/Twig/Runtime/AdminRuntime.php | AdminRuntime.hattr | public function hattr($attributes)
{
// http://www.w3.org/html/wg/drafts/html/master/infrastructure.html#boolean-attributes
// We implement only a subset for now that is used in Bolt.
$booleans = ['checked', 'disabled', 'multiple', 'readonly', 'required', 'selected'];
$return = '';
... | php | public function hattr($attributes)
{
// http://www.w3.org/html/wg/drafts/html/master/infrastructure.html#boolean-attributes
// We implement only a subset for now that is used in Bolt.
$booleans = ['checked', 'disabled', 'multiple', 'readonly', 'required', 'selected'];
$return = '';
... | [
"public",
"function",
"hattr",
"(",
"$",
"attributes",
")",
"{",
"// http://www.w3.org/html/wg/drafts/html/master/infrastructure.html#boolean-attributes",
"// We implement only a subset for now that is used in Bolt.",
"$",
"booleans",
"=",
"[",
"'checked'",
",",
"'disabled'",
",",
... | Prepares attributes ready to attach to an html tag.
- Handles boolean attributes.
- Omits empty attributes if not forced by appending '!' to the name.
- JSON encodes array values
- Prettied output of class attribute and array data is handled.
@param array $attributes
@return string Attributes | [
"Prepares",
"attributes",
"ready",
"to",
"attach",
"to",
"an",
"html",
"tag",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/Runtime/AdminRuntime.php#L245-L284 |
bolt/bolt | src/Twig/Runtime/AdminRuntime.php | AdminRuntime.hclass | public function hclass($classes, $raw = false)
{
if (is_array($classes)) {
$classes = implode(' ', $classes);
}
$classes = preg_split('/ +/', trim($classes));
$classes = implode(' ', $classes);
if ($raw) {
return $classes;
}
return $c... | php | public function hclass($classes, $raw = false)
{
if (is_array($classes)) {
$classes = implode(' ', $classes);
}
$classes = preg_split('/ +/', trim($classes));
$classes = implode(' ', $classes);
if ($raw) {
return $classes;
}
return $c... | [
"public",
"function",
"hclass",
"(",
"$",
"classes",
",",
"$",
"raw",
"=",
"false",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"classes",
")",
")",
"{",
"$",
"classes",
"=",
"implode",
"(",
"' '",
",",
"$",
"classes",
")",
";",
"}",
"$",
"classes... | Generates pretty class attributes.
@param array|string $classes
@param bool $raw
@return string Class attribute | [
"Generates",
"pretty",
"class",
"attributes",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/Runtime/AdminRuntime.php#L294-L307 |
bolt/bolt | src/Provider/DebugServiceProvider.php | DebugServiceProvider.register | public function register(Application $app)
{
if (!$this->firstPhase) {
return;
}
// Debug value that's not based on config service, so exception handler can be registered with minimal logic.
$app['debug.early'] = true;
// Whether $this->boot() has happened
... | php | public function register(Application $app)
{
if (!$this->firstPhase) {
return;
}
// Debug value that's not based on config service, so exception handler can be registered with minimal logic.
$app['debug.early'] = true;
// Whether $this->boot() has happened
... | [
"public",
"function",
"register",
"(",
"Application",
"$",
"app",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"firstPhase",
")",
"{",
"return",
";",
"}",
"// Debug value that's not based on config service, so exception handler can be registered with minimal logic.",
"$",... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Provider/DebugServiceProvider.php#L59-L183 |
bolt/bolt | src/Provider/DebugServiceProvider.php | DebugServiceProvider.boot | public function boot(Application $app)
{
if ($this->firstPhase) {
if ($app['error_handler.enabled']) {
// Report all errors since it has its own logging / throwing errors logic.
error_reporting(E_ALL);
// Disable built-in PHP error displaying logi... | php | public function boot(Application $app)
{
if ($this->firstPhase) {
if ($app['error_handler.enabled']) {
// Report all errors since it has its own logging / throwing errors logic.
error_reporting(E_ALL);
// Disable built-in PHP error displaying logi... | [
"public",
"function",
"boot",
"(",
"Application",
"$",
"app",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"firstPhase",
")",
"{",
"if",
"(",
"$",
"app",
"[",
"'error_handler.enabled'",
"]",
")",
"{",
"// Report all errors since it has its own logging / throwing errors... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Provider/DebugServiceProvider.php#L188-L215 |
bolt/bolt | src/Provider/DebugServiceProvider.php | DebugServiceProvider.configureLogger | private function configureLogger(ErrorHandler $handler, LoggerInterface $logger, $loggedAt)
{
// Set real logger for the levels specified.
$handler->setDefaultLogger($logger, $loggedAt);
// For all the levels not logged, tell the handler not to log them.
$notLoggedLevels = [];
... | php | private function configureLogger(ErrorHandler $handler, LoggerInterface $logger, $loggedAt)
{
// Set real logger for the levels specified.
$handler->setDefaultLogger($logger, $loggedAt);
// For all the levels not logged, tell the handler not to log them.
$notLoggedLevels = [];
... | [
"private",
"function",
"configureLogger",
"(",
"ErrorHandler",
"$",
"handler",
",",
"LoggerInterface",
"$",
"logger",
",",
"$",
"loggedAt",
")",
"{",
"// Set real logger for the levels specified.",
"$",
"handler",
"->",
"setDefaultLogger",
"(",
"$",
"logger",
",",
"... | Configure the error handler to log types given to the logger given and to ignore all types not specified.
It's important that the BufferingLogger is completely replaced for all error types with either a real logger
or null, otherwise a memory leak could occur.
@param ErrorHandler $handler
@param LoggerInterface $l... | [
"Configure",
"the",
"error",
"handler",
"to",
"log",
"types",
"given",
"to",
"the",
"logger",
"given",
"and",
"to",
"ignore",
"all",
"types",
"not",
"specified",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Provider/DebugServiceProvider.php#L255-L297 |
bolt/bolt | src/Storage/Database/Schema/Builder/ContentTables.php | ContentTables.getSchemaTables | public function getSchemaTables(Schema $schema, Config $config)
{
if ($this->tableSchemas !== null) {
return $this->tableSchemas;
}
/** @var $fieldManager FieldManager */
$fieldManager = $config->getFields();
$contentTypes = $this->getNormalisedContentTypes($conf... | php | public function getSchemaTables(Schema $schema, Config $config)
{
if ($this->tableSchemas !== null) {
return $this->tableSchemas;
}
/** @var $fieldManager FieldManager */
$fieldManager = $config->getFields();
$contentTypes = $this->getNormalisedContentTypes($conf... | [
"public",
"function",
"getSchemaTables",
"(",
"Schema",
"$",
"schema",
",",
"Config",
"$",
"config",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"tableSchemas",
"!==",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"tableSchemas",
";",
"}",
"/** @var $fieldMan... | Build the schema for Bolt ContentType tables.
@param Schema $schema
@param Config $config
@return \Doctrine\DBAL\Schema\Table[] | [
"Build",
"the",
"schema",
"for",
"Bolt",
"ContentType",
"tables",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Database/Schema/Builder/ContentTables.php#L32-L54 |
bolt/bolt | src/Storage/Database/Schema/Builder/ContentTables.php | ContentTables.getNormalisedContentTypes | private function getNormalisedContentTypes(Config $config)
{
$normalised = [];
$contentTypes = $config->get('contenttypes');
foreach ($contentTypes as $contentType) {
$normalised[$contentType['tablename']] = $contentType;
}
return $normalised;
} | php | private function getNormalisedContentTypes(Config $config)
{
$normalised = [];
$contentTypes = $config->get('contenttypes');
foreach ($contentTypes as $contentType) {
$normalised[$contentType['tablename']] = $contentType;
}
return $normalised;
} | [
"private",
"function",
"getNormalisedContentTypes",
"(",
"Config",
"$",
"config",
")",
"{",
"$",
"normalised",
"=",
"[",
"]",
";",
"$",
"contentTypes",
"=",
"$",
"config",
"->",
"get",
"(",
"'contenttypes'",
")",
";",
"foreach",
"(",
"$",
"contentTypes",
"... | Return an array of ContentTypes with the table name is the key.
@param Config $config
@return array | [
"Return",
"an",
"array",
"of",
"ContentTypes",
"with",
"the",
"table",
"name",
"is",
"the",
"key",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Database/Schema/Builder/ContentTables.php#L63-L72 |
bolt/bolt | src/Storage/Database/Schema/Builder/ContentTables.php | ContentTables.addContentTypeTableColumns | private function addContentTypeTableColumns(ContentType $tableObj, Table $table, array $fields, FieldManager $fieldManager)
{
// Check if all the fields are present in the DB.
foreach ($fields as $fieldName => $values) {
/** @var \Doctrine\DBAL\Platforms\Keywords\KeywordList $reservedLis... | php | private function addContentTypeTableColumns(ContentType $tableObj, Table $table, array $fields, FieldManager $fieldManager)
{
// Check if all the fields are present in the DB.
foreach ($fields as $fieldName => $values) {
/** @var \Doctrine\DBAL\Platforms\Keywords\KeywordList $reservedLis... | [
"private",
"function",
"addContentTypeTableColumns",
"(",
"ContentType",
"$",
"tableObj",
",",
"Table",
"$",
"table",
",",
"array",
"$",
"fields",
",",
"FieldManager",
"$",
"fieldManager",
")",
"{",
"// Check if all the fields are present in the DB.",
"foreach",
"(",
... | Add the custom columns for the ContentType.
@param \Bolt\Storage\Database\Schema\Table\ContentType $tableObj
@param \Doctrine\DBAL\Schema\Table $table
@param array $fields
@param FieldManager $fieldManager | [
"Add",
"the",
"custom",
"columns",
"for",
"the",
"ContentType",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Database/Schema/Builder/ContentTables.php#L82-L100 |
bolt/bolt | src/Storage/Database/Schema/Builder/ContentTables.php | ContentTables.addContentTypeTableColumn | private function addContentTypeTableColumn(ContentType $tableObj, Table $table, $fieldName, array $values, FieldManager $fieldManager)
{
if ($tableObj->isKnownType($values['type'])) {
// Use loose comparison on true as 'true' in YAML is a string
$addIndex = isset($values['index']) &&... | php | private function addContentTypeTableColumn(ContentType $tableObj, Table $table, $fieldName, array $values, FieldManager $fieldManager)
{
if ($tableObj->isKnownType($values['type'])) {
// Use loose comparison on true as 'true' in YAML is a string
$addIndex = isset($values['index']) &&... | [
"private",
"function",
"addContentTypeTableColumn",
"(",
"ContentType",
"$",
"tableObj",
",",
"Table",
"$",
"table",
",",
"$",
"fieldName",
",",
"array",
"$",
"values",
",",
"FieldManager",
"$",
"fieldManager",
")",
"{",
"if",
"(",
"$",
"tableObj",
"->",
"is... | Add a single column to the ContentType table.
@param \Bolt\Storage\Database\Schema\Table\ContentType $tableObj
@param \Doctrine\DBAL\Schema\Table $table
@param string $fieldName
@param array $values
@param FieldManag... | [
"Add",
"a",
"single",
"column",
"to",
"the",
"ContentType",
"table",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Database/Schema/Builder/ContentTables.php#L111-L123 |
bolt/bolt | src/Storage/Database/Schema/Builder/ContentTables.php | ContentTables.getContentTypeTableColumnType | private function getContentTypeTableColumnType(array $values)
{
// Multi-value selects are stored as JSON arrays
if (isset($values['type']) && $values['type'] === 'select' && isset($values['multiple']) && $values['multiple'] === true) {
return 'selectmultiple';
}
return ... | php | private function getContentTypeTableColumnType(array $values)
{
// Multi-value selects are stored as JSON arrays
if (isset($values['type']) && $values['type'] === 'select' && isset($values['multiple']) && $values['multiple'] === true) {
return 'selectmultiple';
}
return ... | [
"private",
"function",
"getContentTypeTableColumnType",
"(",
"array",
"$",
"values",
")",
"{",
"// Multi-value selects are stored as JSON arrays",
"if",
"(",
"isset",
"(",
"$",
"values",
"[",
"'type'",
"]",
")",
"&&",
"$",
"values",
"[",
"'type'",
"]",
"===",
"'... | Certain field types can have single or JSON array types, figure it out.
@param array $values
@return string | [
"Certain",
"field",
"types",
"can",
"have",
"single",
"or",
"JSON",
"array",
"types",
"figure",
"it",
"out",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Database/Schema/Builder/ContentTables.php#L132-L140 |
bolt/bolt | src/Storage/QuerySet.php | QuerySet.execute | public function execute()
{
$result = null;
// Only return the result of the primary query
foreach ($this as $query) {
/** @var QueryBuilder $query */
try {
if ($result === null) {
$result = $query->execute();
if... | php | public function execute()
{
$result = null;
// Only return the result of the primary query
foreach ($this as $query) {
/** @var QueryBuilder $query */
try {
if ($result === null) {
$result = $query->execute();
if... | [
"public",
"function",
"execute",
"(",
")",
"{",
"$",
"result",
"=",
"null",
";",
"// Only return the result of the primary query",
"foreach",
"(",
"$",
"this",
"as",
"$",
"query",
")",
"{",
"/** @var QueryBuilder $query */",
"try",
"{",
"if",
"(",
"$",
"result",... | Execute function, iterate the queries, and execute them sequentially.
@throws \Exception
@return \Doctrine\DBAL\Driver\Statement|int|null | [
"Execute",
"function",
"iterate",
"the",
"queries",
"and",
"execute",
"them",
"sequentially",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/QuerySet.php#L38-L65 |
bolt/bolt | src/Storage/QuerySet.php | QuerySet.setLastInsertId | private function setLastInsertId(QueryBuilder $query)
{
$seq = null;
if ($query->getConnection()->getDatabasePlatform()->getName() === 'postgresql') {
$sequences = $query->getConnection()->getSchemaManager()->listSequences();
$desiredSeq = $query->getQueryPart('from')['table'... | php | private function setLastInsertId(QueryBuilder $query)
{
$seq = null;
if ($query->getConnection()->getDatabasePlatform()->getName() === 'postgresql') {
$sequences = $query->getConnection()->getSchemaManager()->listSequences();
$desiredSeq = $query->getQueryPart('from')['table'... | [
"private",
"function",
"setLastInsertId",
"(",
"QueryBuilder",
"$",
"query",
")",
"{",
"$",
"seq",
"=",
"null",
";",
"if",
"(",
"$",
"query",
"->",
"getConnection",
"(",
")",
"->",
"getDatabasePlatform",
"(",
")",
"->",
"getName",
"(",
")",
"===",
"'post... | @TODO Temporary workaround for PostgreSQL databases that don't use a sequence.
@param QueryBuilder $query | [
"@TODO",
"Temporary",
"workaround",
"for",
"PostgreSQL",
"databases",
"that",
"don",
"t",
"use",
"a",
"sequence",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/QuerySet.php#L93-L110 |
bolt/bolt | src/Helpers/Arr.php | Arr.makeValuePairs | public static function makeValuePairs($array, $key, $value)
{
Deprecated::method(3.3, 'Use array_column() or Arr::column() instead.');
if (!is_array($array)) {
return [];
}
return self::column($array, $value, $key);
} | php | public static function makeValuePairs($array, $key, $value)
{
Deprecated::method(3.3, 'Use array_column() or Arr::column() instead.');
if (!is_array($array)) {
return [];
}
return self::column($array, $value, $key);
} | [
"public",
"static",
"function",
"makeValuePairs",
"(",
"$",
"array",
",",
"$",
"key",
",",
"$",
"value",
")",
"{",
"Deprecated",
"::",
"method",
"(",
"3.3",
",",
"'Use array_column() or Arr::column() instead.'",
")",
";",
"if",
"(",
"!",
"is_array",
"(",
"$"... | Make a simple array consisting of key=>value pairs, that can be used
in select-boxes in forms.
@param array $array
@param string $key
@param string $value
@return array
@deprecated since 3.3, to be removed in 4.0. Use {@see array_column} or {@see Arr::column} instead. | [
"Make",
"a",
"simple",
"array",
"consisting",
"of",
"key",
"=",
">",
"value",
"pairs",
"that",
"can",
"be",
"used",
"in",
"select",
"-",
"boxes",
"in",
"forms",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Helpers/Arr.php#L24-L33 |
bolt/bolt | src/Helpers/Arr.php | Arr.mergeRecursiveDistinct | public static function mergeRecursiveDistinct(array &$array1, array &$array2)
{
Deprecated::method(3.3, 'Use array_replace_recursive() or Arr::replaceRecursive() instead.');
$merged = $array1;
foreach ($array2 as $key => &$value) {
// if $key = 'accept_file_types, don't merge.
... | php | public static function mergeRecursiveDistinct(array &$array1, array &$array2)
{
Deprecated::method(3.3, 'Use array_replace_recursive() or Arr::replaceRecursive() instead.');
$merged = $array1;
foreach ($array2 as $key => &$value) {
// if $key = 'accept_file_types, don't merge.
... | [
"public",
"static",
"function",
"mergeRecursiveDistinct",
"(",
"array",
"&",
"$",
"array1",
",",
"array",
"&",
"$",
"array2",
")",
"{",
"Deprecated",
"::",
"method",
"(",
"3.3",
",",
"'Use array_replace_recursive() or Arr::replaceRecursive() instead.'",
")",
";",
"$... | This is the same as {@see array_replace_recursive}.
Use that instead or the smarter {@see replaceRecursive}.
@param array $array1
@param array $array2
@return array
@deprecated since 3.3, to be removed in 4.0. | [
"This",
"is",
"the",
"same",
"as",
"{",
"@see",
"array_replace_recursive",
"}",
".",
"Use",
"that",
"instead",
"or",
"the",
"smarter",
"{",
"@see",
"replaceRecursive",
"}",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Helpers/Arr.php#L46-L67 |
bolt/bolt | src/Helpers/Arr.php | Arr.isIndexedArray | public static function isIndexedArray(array $arr)
{
Deprecated::method(3.3, 'Use Arr::isIndexed() or Arr::isAssociative() instead.');
foreach ($arr as $key => $val) {
if ($key !== (int) $key) {
return false;
}
}
return true;
} | php | public static function isIndexedArray(array $arr)
{
Deprecated::method(3.3, 'Use Arr::isIndexed() or Arr::isAssociative() instead.');
foreach ($arr as $key => $val) {
if ($key !== (int) $key) {
return false;
}
}
return true;
} | [
"public",
"static",
"function",
"isIndexedArray",
"(",
"array",
"$",
"arr",
")",
"{",
"Deprecated",
"::",
"method",
"(",
"3.3",
",",
"'Use Arr::isIndexed() or Arr::isAssociative() instead.'",
")",
";",
"foreach",
"(",
"$",
"arr",
"as",
"$",
"key",
"=>",
"$",
"... | Use {@see isIndexed} or {@see isAssociative} instead.
This is the same as isIndexed but it does not check if
array is zero-indexed and has sequential keys.
@param array $arr
@return bool True if indexed, false if associative
@deprecated since 3.3, to be removed in 4.0. | [
"Use",
"{",
"@see",
"isIndexed",
"}",
"or",
"{",
"@see",
"isAssociative",
"}",
"instead",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Helpers/Arr.php#L81-L92 |
bolt/bolt | src/Composer/Action/BaseAction.php | BaseAction.getComposer | protected function getComposer()
{
if (!$this->composer) {
// Set composer environment variables
putenv('COMPOSER_HOME=' . $this->app['path_resolver']->resolve('%cache%/composer'));
// Set working directory
chdir($this->getOptions()->baseDir());
... | php | protected function getComposer()
{
if (!$this->composer) {
// Set composer environment variables
putenv('COMPOSER_HOME=' . $this->app['path_resolver']->resolve('%cache%/composer'));
// Set working directory
chdir($this->getOptions()->baseDir());
... | [
"protected",
"function",
"getComposer",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"composer",
")",
"{",
"// Set composer environment variables",
"putenv",
"(",
"'COMPOSER_HOME='",
".",
"$",
"this",
"->",
"app",
"[",
"'path_resolver'",
"]",
"->",
"resol... | Get a Composer object.
@throws \Exception
@return \Composer\Composer | [
"Get",
"a",
"Composer",
"object",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/Action/BaseAction.php#L67-L95 |
bolt/bolt | src/Composer/Action/BaseAction.php | BaseAction.getPreferedTarget | protected function getPreferedTarget($option)
{
$prefer = [
'source' => false,
'dist' => false,
];
switch ($option) {
case 'source':
$prefer['source'] = true;
break;
case 'dist':
$prefer['dist'... | php | protected function getPreferedTarget($option)
{
$prefer = [
'source' => false,
'dist' => false,
];
switch ($option) {
case 'source':
$prefer['source'] = true;
break;
case 'dist':
$prefer['dist'... | [
"protected",
"function",
"getPreferedTarget",
"(",
"$",
"option",
")",
"{",
"$",
"prefer",
"=",
"[",
"'source'",
"=>",
"false",
",",
"'dist'",
"=>",
"false",
",",
"]",
";",
"switch",
"(",
"$",
"option",
")",
"{",
"case",
"'source'",
":",
"$",
"prefer",... | Determine if we're to force installation from package sources when
possible, including VCS information.
@param string $option
@return array | [
"Determine",
"if",
"we",
"re",
"to",
"force",
"installation",
"from",
"package",
"sources",
"when",
"possible",
"including",
"VCS",
"information",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/Action/BaseAction.php#L127-L147 |
bolt/bolt | src/Composer/Action/BaseAction.php | BaseAction.setAllowSslDowngrade | private function setAllowSslDowngrade($choice)
{
$repos = $this->getComposer()->getRepositoryManager()->getRepositories();
/** @var ConfigurableRepositoryInterface $repo */
foreach ($repos as $repo) {
if (!$repo instanceof ComposerRepository) {
continue;
... | php | private function setAllowSslDowngrade($choice)
{
$repos = $this->getComposer()->getRepositoryManager()->getRepositories();
/** @var ConfigurableRepositoryInterface $repo */
foreach ($repos as $repo) {
if (!$repo instanceof ComposerRepository) {
continue;
... | [
"private",
"function",
"setAllowSslDowngrade",
"(",
"$",
"choice",
")",
"{",
"$",
"repos",
"=",
"$",
"this",
"->",
"getComposer",
"(",
")",
"->",
"getRepositoryManager",
"(",
")",
"->",
"getRepositories",
"(",
")",
";",
"/** @var ConfigurableRepositoryInterface $r... | Set repos to allow HTTP instead of HTTPS.
@param bool $choice | [
"Set",
"repos",
"to",
"allow",
"HTTP",
"instead",
"of",
"HTTPS",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/Action/BaseAction.php#L154-L176 |
bolt/bolt | src/Composer/Action/BaseAction.php | BaseAction.findBestVersionForPackage | protected function findBestVersionForPackage($packageName, $targetPackageVersion = null, $returnArray = false)
{
$versionSelector = new VersionSelector($this->getPool());
$package = $versionSelector->findBestCandidate($packageName, $targetPackageVersion, strtok(PHP_VERSION, '-'), $this->getComposer(... | php | protected function findBestVersionForPackage($packageName, $targetPackageVersion = null, $returnArray = false)
{
$versionSelector = new VersionSelector($this->getPool());
$package = $versionSelector->findBestCandidate($packageName, $targetPackageVersion, strtok(PHP_VERSION, '-'), $this->getComposer(... | [
"protected",
"function",
"findBestVersionForPackage",
"(",
"$",
"packageName",
",",
"$",
"targetPackageVersion",
"=",
"null",
",",
"$",
"returnArray",
"=",
"false",
")",
"{",
"$",
"versionSelector",
"=",
"new",
"VersionSelector",
"(",
"$",
"this",
"->",
"getPool... | Given a package name, this determines the best version to use in the require key.
This returns a version with the ^ operator prefixed when possible.
@param string $packageName
@param string $targetPackageVersion
@param bool $returnArray
@throws \InvalidArgumentException
@return string|array | [
"Given",
"a",
"package",
"name",
"this",
"determines",
"the",
"best",
"version",
"to",
"use",
"in",
"the",
"require",
"key",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/Action/BaseAction.php#L191-L220 |
bolt/bolt | src/Composer/Action/BaseAction.php | BaseAction.getPool | protected function getPool()
{
if (!$this->pool) {
$this->pool = new Pool($this->getMinimumStability());
// Add each of our configured repos to the pool,
// or it defaults to packagist.org
foreach ($this->getRepos() as $repo) {
$this->pool->ad... | php | protected function getPool()
{
if (!$this->pool) {
$this->pool = new Pool($this->getMinimumStability());
// Add each of our configured repos to the pool,
// or it defaults to packagist.org
foreach ($this->getRepos() as $repo) {
$this->pool->ad... | [
"protected",
"function",
"getPool",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"pool",
")",
"{",
"$",
"this",
"->",
"pool",
"=",
"new",
"Pool",
"(",
"$",
"this",
"->",
"getMinimumStability",
"(",
")",
")",
";",
"// Add each of our configured repos... | Return a resolver pool that contains repositories, that provide packages.
@return \Composer\DependencyResolver\Pool | [
"Return",
"a",
"resolver",
"pool",
"that",
"contains",
"repositories",
"that",
"provide",
"packages",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/Action/BaseAction.php#L227-L240 |
bolt/bolt | src/Composer/Action/BaseAction.php | BaseAction.getRepos | protected function getRepos()
{
if (!$this->repos) {
$this->repos = $this->getComposer()->getRepositoryManager()->getRepositories();
}
return $this->repos;
} | php | protected function getRepos()
{
if (!$this->repos) {
$this->repos = $this->getComposer()->getRepositoryManager()->getRepositories();
}
return $this->repos;
} | [
"protected",
"function",
"getRepos",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"repos",
")",
"{",
"$",
"this",
"->",
"repos",
"=",
"$",
"this",
"->",
"getComposer",
"(",
")",
"->",
"getRepositoryManager",
"(",
")",
"->",
"getRepositories",
"(",... | Get all our repos.
@return \Composer\Repository\CompositeRepository | [
"Get",
"all",
"our",
"repos",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/Action/BaseAction.php#L262-L269 |
bolt/bolt | src/Composer/Action/BaseAction.php | BaseAction.formatRequirements | protected function formatRequirements(array $packages)
{
$requires = [];
$packages = $this->normalizeRequirements($packages);
foreach ($packages as $package) {
$requires[$package['name']] = $package['version'];
}
return $requires;
} | php | protected function formatRequirements(array $packages)
{
$requires = [];
$packages = $this->normalizeRequirements($packages);
foreach ($packages as $package) {
$requires[$package['name']] = $package['version'];
}
return $requires;
} | [
"protected",
"function",
"formatRequirements",
"(",
"array",
"$",
"packages",
")",
"{",
"$",
"requires",
"=",
"[",
"]",
";",
"$",
"packages",
"=",
"$",
"this",
"->",
"normalizeRequirements",
"(",
"$",
"packages",
")",
";",
"foreach",
"(",
"$",
"packages",
... | @param array $packages
@return array | [
"@param",
"array",
"$packages"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/Action/BaseAction.php#L276-L285 |
bolt/bolt | src/Storage/Repository/FieldValueRepository.php | FieldValueRepository.queryExistingFields | public function queryExistingFields($id, $contentType, $field)
{
$query = $this->createQueryBuilder()
->select('grouping, id', 'name')
->where('content_id = :id')
->andWhere('contenttype = :contenttype')
->andWhere('name = :name')
->orderBy('groupi... | php | public function queryExistingFields($id, $contentType, $field)
{
$query = $this->createQueryBuilder()
->select('grouping, id', 'name')
->where('content_id = :id')
->andWhere('contenttype = :contenttype')
->andWhere('name = :name')
->orderBy('groupi... | [
"public",
"function",
"queryExistingFields",
"(",
"$",
"id",
",",
"$",
"contentType",
",",
"$",
"field",
")",
"{",
"$",
"query",
"=",
"$",
"this",
"->",
"createQueryBuilder",
"(",
")",
"->",
"select",
"(",
"'grouping, id'",
",",
"'name'",
")",
"->",
"whe... | @param int $id
@param string $contentType
@param string $field
@return \Doctrine\DBAL\Query\QueryBuilder | [
"@param",
"int",
"$id",
"@param",
"string",
"$contentType",
"@param",
"string",
"$field"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Repository/FieldValueRepository.php#L17-L32 |
bolt/bolt | src/Storage/Repository/FieldValueRepository.php | FieldValueRepository.getExistingFields | public function getExistingFields($id, $contentType, $field)
{
$query = $this->queryExistingFields($id, $contentType, $field);
$results = $query->execute()->fetchAll();
$fields = [];
if (!$results) {
return $fields;
}
foreach ($results as $result) {
... | php | public function getExistingFields($id, $contentType, $field)
{
$query = $this->queryExistingFields($id, $contentType, $field);
$results = $query->execute()->fetchAll();
$fields = [];
if (!$results) {
return $fields;
}
foreach ($results as $result) {
... | [
"public",
"function",
"getExistingFields",
"(",
"$",
"id",
",",
"$",
"contentType",
",",
"$",
"field",
")",
"{",
"$",
"query",
"=",
"$",
"this",
"->",
"queryExistingFields",
"(",
"$",
"id",
",",
"$",
"contentType",
",",
"$",
"field",
")",
";",
"$",
"... | @param int $id
@param string $contentType
@param string $field
@return Entity[] | [
"@param",
"int",
"$id",
"@param",
"string",
"$contentType",
"@param",
"string",
"$field"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Repository/FieldValueRepository.php#L41-L57 |
bolt/bolt | src/Storage/Field/Collection/LazyFieldCollection.php | LazyFieldCollection.setGrouping | public function setGrouping($grouping)
{
if (!$this->initialized) {
$this->grouping = $grouping;
} else {
$this->collection->setGrouping($grouping);
}
} | php | public function setGrouping($grouping)
{
if (!$this->initialized) {
$this->grouping = $grouping;
} else {
$this->collection->setGrouping($grouping);
}
} | [
"public",
"function",
"setGrouping",
"(",
"$",
"grouping",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"initialized",
")",
"{",
"$",
"this",
"->",
"grouping",
"=",
"$",
"grouping",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"collection",
"->",
"setGr... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Field/Collection/LazyFieldCollection.php#L61-L68 |
bolt/bolt | src/Storage/Field/Collection/LazyFieldCollection.php | LazyFieldCollection.doInitialize | protected function doInitialize()
{
$this->collection = new FieldCollection();
$this->collection->setGrouping($this->grouping);
if ($this->references) {
$repo = $this->em->getRepository(FieldValue::class);
$instances = $repo->findBy(['id' => $this->references]);
... | php | protected function doInitialize()
{
$this->collection = new FieldCollection();
$this->collection->setGrouping($this->grouping);
if ($this->references) {
$repo = $this->em->getRepository(FieldValue::class);
$instances = $repo->findBy(['id' => $this->references]);
... | [
"protected",
"function",
"doInitialize",
"(",
")",
"{",
"$",
"this",
"->",
"collection",
"=",
"new",
"FieldCollection",
"(",
")",
";",
"$",
"this",
"->",
"collection",
"->",
"setGrouping",
"(",
"$",
"this",
"->",
"grouping",
")",
";",
"if",
"(",
"$",
"... | Handles the conversion of references to entities. | [
"Handles",
"the",
"conversion",
"of",
"references",
"to",
"entities",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Field/Collection/LazyFieldCollection.php#L101-L147 |
bolt/bolt | src/Controller/Backend/Upload.php | Upload.uploadNamespace | public function uploadNamespace(Request $request, $namespace)
{
if ($handler = $request->get('handler')) {
// Use custom handlers
if (is_array($handler)) {
return $this->processCustomUploadHandler($request, $handler);
}
list($namespace, $prefix... | php | public function uploadNamespace(Request $request, $namespace)
{
if ($handler = $request->get('handler')) {
// Use custom handlers
if (is_array($handler)) {
return $this->processCustomUploadHandler($request, $handler);
}
list($namespace, $prefix... | [
"public",
"function",
"uploadNamespace",
"(",
"Request",
"$",
"request",
",",
"$",
"namespace",
")",
"{",
"if",
"(",
"$",
"handler",
"=",
"$",
"request",
"->",
"get",
"(",
"'handler'",
")",
")",
"{",
"// Use custom handlers",
"if",
"(",
"is_array",
"(",
... | Route to handle file uploads.
@param Request $request
@param string $namespace
@return \Symfony\Component\HttpFoundation\JsonResponse | [
"Route",
"to",
"handle",
"file",
"uploads",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Backend/Upload.php#L49-L67 |
bolt/bolt | src/Controller/Backend/Upload.php | Upload.parser | private function parser($handler)
{
$parts = explode('://', $handler);
if (count($parts) === 2) {
$namespace = $parts[0];
array_shift($parts);
} else {
$namespace = $this->app['upload.namespace'];
}
$prefix = rtrim($parts[0], '/') . '/';
... | php | private function parser($handler)
{
$parts = explode('://', $handler);
if (count($parts) === 2) {
$namespace = $parts[0];
array_shift($parts);
} else {
$namespace = $this->app['upload.namespace'];
}
$prefix = rtrim($parts[0], '/') . '/';
... | [
"private",
"function",
"parser",
"(",
"$",
"handler",
")",
"{",
"$",
"parts",
"=",
"explode",
"(",
"'://'",
",",
"$",
"handler",
")",
";",
"if",
"(",
"count",
"(",
"$",
"parts",
")",
"===",
"2",
")",
"{",
"$",
"namespace",
"=",
"$",
"parts",
"[",... | Parse a string and determine the upload prefix and namespace.
@param string $handler
@return array | [
"Parse",
"a",
"string",
"and",
"determine",
"the",
"upload",
"prefix",
"and",
"namespace",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Backend/Upload.php#L76-L88 |
bolt/bolt | src/Controller/Backend/Upload.php | Upload.handleUploadFiles | private function handleUploadFiles(Request $request, $namespace, $files = null)
{
$filesToProcess = $this->getFilesToProcess($request, $namespace, $files);
/** @var \Sirius\Upload\Result\Collection $result */
$result = $this->app['upload']->process($filesToProcess);
if ($result->is... | php | private function handleUploadFiles(Request $request, $namespace, $files = null)
{
$filesToProcess = $this->getFilesToProcess($request, $namespace, $files);
/** @var \Sirius\Upload\Result\Collection $result */
$result = $this->app['upload']->process($filesToProcess);
if ($result->is... | [
"private",
"function",
"handleUploadFiles",
"(",
"Request",
"$",
"request",
",",
"$",
"namespace",
",",
"$",
"files",
"=",
"null",
")",
"{",
"$",
"filesToProcess",
"=",
"$",
"this",
"->",
"getFilesToProcess",
"(",
"$",
"request",
",",
"$",
"namespace",
","... | Perform a file upload.
@param Request $request
@param string $namespace
@param string $files
@return array | [
"Perform",
"a",
"file",
"upload",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Backend/Upload.php#L99-L138 |
bolt/bolt | src/Controller/Backend/Upload.php | Upload.getFilesToProcess | private function getFilesToProcess(Request $request, $namespace, $files = null)
{
$this->app['upload.namespace'] = $namespace;
if ($files === null) {
$files = $request->files->get($namespace);
}
if (!$files) {
return [];
}
$filesToProcess = [... | php | private function getFilesToProcess(Request $request, $namespace, $files = null)
{
$this->app['upload.namespace'] = $namespace;
if ($files === null) {
$files = $request->files->get($namespace);
}
if (!$files) {
return [];
}
$filesToProcess = [... | [
"private",
"function",
"getFilesToProcess",
"(",
"Request",
"$",
"request",
",",
"$",
"namespace",
",",
"$",
"files",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"app",
"[",
"'upload.namespace'",
"]",
"=",
"$",
"namespace",
";",
"if",
"(",
"$",
"files",
... | Determine the list of files to upload.
@param Request $request
@param string $namespace
@param string $files
@return array | [
"Determine",
"the",
"list",
"of",
"files",
"to",
"upload",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Backend/Upload.php#L149-L173 |
bolt/bolt | src/Controller/Backend/Upload.php | Upload.processCustomUploadHandler | private function processCustomUploadHandler(Request $request, array $handler)
{
list($namespace, $prefix) = $this->parser($handler[0]);
$this->app['upload.namespace'] = $namespace;
$this->app['upload.prefix'] = $prefix;
// Do the upload
$fullResult = $this->handleUploadFiles... | php | private function processCustomUploadHandler(Request $request, array $handler)
{
list($namespace, $prefix) = $this->parser($handler[0]);
$this->app['upload.namespace'] = $namespace;
$this->app['upload.prefix'] = $prefix;
// Do the upload
$fullResult = $this->handleUploadFiles... | [
"private",
"function",
"processCustomUploadHandler",
"(",
"Request",
"$",
"request",
",",
"array",
"$",
"handler",
")",
"{",
"list",
"(",
"$",
"namespace",
",",
"$",
"prefix",
")",
"=",
"$",
"this",
"->",
"parser",
"(",
"$",
"handler",
"[",
"0",
"]",
"... | This handles the more advanced functionality where multiple upload handlers
are provided. Only the first one is returned as a result, the result
of this first upload is then attempted to copy to the remaining handlers.
@param Request $request
@param array $handler
@return \Symfony\Component\HttpFoundation\JsonRespo... | [
"This",
"handles",
"the",
"more",
"advanced",
"functionality",
"where",
"multiple",
"upload",
"handlers",
"are",
"provided",
".",
"Only",
"the",
"first",
"one",
"is",
"returned",
"as",
"a",
"result",
"the",
"result",
"of",
"this",
"first",
"upload",
"is",
"t... | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Backend/Upload.php#L185-L210 |
bolt/bolt | src/Asset/CallableInvokerTrait.php | CallableInvokerTrait.invokeCallable | protected function invokeCallable(callable $callback, $callbackArguments)
{
if ($callbackArguments === null) {
return $callback();
}
if (Arr::isIndexed($callbackArguments)) {
return call_user_func_array($callback, (array) $callbackArguments);
}
$orde... | php | protected function invokeCallable(callable $callback, $callbackArguments)
{
if ($callbackArguments === null) {
return $callback();
}
if (Arr::isIndexed($callbackArguments)) {
return call_user_func_array($callback, (array) $callbackArguments);
}
$orde... | [
"protected",
"function",
"invokeCallable",
"(",
"callable",
"$",
"callback",
",",
"$",
"callbackArguments",
")",
"{",
"if",
"(",
"$",
"callbackArguments",
"===",
"null",
")",
"{",
"return",
"$",
"callback",
"(",
")",
";",
"}",
"if",
"(",
"Arr",
"::",
"is... | Get the return value from the callable.
Parameters can be can handled in three ways:
- null - Nothing passed to the callback
- Indexed array - Value of each element will be passed to function in order
- Associative array - Key names will attempt to match to the callable function variable names
@param... | [
"Get",
"the",
"return",
"value",
"from",
"the",
"callable",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Asset/CallableInvokerTrait.php#L31-L44 |
bolt/bolt | src/Asset/CallableInvokerTrait.php | CallableInvokerTrait.getArguments | private function getArguments(callable $callback, array $callbackArguments)
{
$parameters = $this->getParameters($callback);
$arguments = [];
foreach ($parameters as $param) {
if (array_key_exists($param->getName(), $callbackArguments)) {
$arguments[] = $callbackA... | php | private function getArguments(callable $callback, array $callbackArguments)
{
$parameters = $this->getParameters($callback);
$arguments = [];
foreach ($parameters as $param) {
if (array_key_exists($param->getName(), $callbackArguments)) {
$arguments[] = $callbackA... | [
"private",
"function",
"getArguments",
"(",
"callable",
"$",
"callback",
",",
"array",
"$",
"callbackArguments",
")",
"{",
"$",
"parameters",
"=",
"$",
"this",
"->",
"getParameters",
"(",
"$",
"callback",
")",
";",
"$",
"arguments",
"=",
"[",
"]",
";",
"... | Get an ordered list of arguments.
@param callable $callback
@param array $callbackArguments
@return array | [
"Get",
"an",
"ordered",
"list",
"of",
"arguments",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Asset/CallableInvokerTrait.php#L54-L69 |
bolt/bolt | src/Asset/CallableInvokerTrait.php | CallableInvokerTrait.getParameters | private function getParameters(callable $callback)
{
if (is_array($callback)) {
$mirror = new ReflectionMethod($callback[0], $callback[1]);
} elseif (is_object($callback) && !$callback instanceof \Closure) {
/** @var object $callback */
$mirror = new ReflectionObj... | php | private function getParameters(callable $callback)
{
if (is_array($callback)) {
$mirror = new ReflectionMethod($callback[0], $callback[1]);
} elseif (is_object($callback) && !$callback instanceof \Closure) {
/** @var object $callback */
$mirror = new ReflectionObj... | [
"private",
"function",
"getParameters",
"(",
"callable",
"$",
"callback",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"callback",
")",
")",
"{",
"$",
"mirror",
"=",
"new",
"ReflectionMethod",
"(",
"$",
"callback",
"[",
"0",
"]",
",",
"$",
"callback",
"[... | Get the callback function's parameters.
@param callable $callback
@return ReflectionParameter[] | [
"Get",
"the",
"callback",
"function",
"s",
"parameters",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Asset/CallableInvokerTrait.php#L78-L91 |
bolt/bolt | src/Filesystem/UploadContainer.php | UploadContainer.moveUploadedFile | public function moveUploadedFile($localFile, $destination)
{
$this->filesystem->putStream($destination, fopen($localFile, 'r+'));
return true;
} | php | public function moveUploadedFile($localFile, $destination)
{
$this->filesystem->putStream($destination, fopen($localFile, 'r+'));
return true;
} | [
"public",
"function",
"moveUploadedFile",
"(",
"$",
"localFile",
",",
"$",
"destination",
")",
"{",
"$",
"this",
"->",
"filesystem",
"->",
"putStream",
"(",
"$",
"destination",
",",
"fopen",
"(",
"$",
"localFile",
",",
"'r+'",
")",
")",
";",
"return",
"t... | {@inheritdoc}
@throws IOException
This is called from \Sirius\Upload\Handler::processSingleFile() which expects a boolean return value,
and as \Bolt\FilesystemInterface::putStream only returns void or throws an error, we catch
IOExceptions here and return a false on exception | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Filesystem/UploadContainer.php#L64-L69 |
bolt/bolt | src/Composer/Action/ShowPackage.php | ShowPackage.execute | public function execute($type, $package = '', $version = '', $root = false)
{
$io = $this->getIO();
if ($root) {
$composerJson = $this->app['path_resolver']->resolve('composer.json');
$composer = Factory::create($io, $composerJson, true);
} else {
$compos... | php | public function execute($type, $package = '', $version = '', $root = false)
{
$io = $this->getIO();
if ($root) {
$composerJson = $this->app['path_resolver']->resolve('composer.json');
$composer = Factory::create($io, $composerJson, true);
} else {
$compos... | [
"public",
"function",
"execute",
"(",
"$",
"type",
",",
"$",
"package",
"=",
"''",
",",
"$",
"version",
"=",
"''",
",",
"$",
"root",
"=",
"false",
")",
"{",
"$",
"io",
"=",
"$",
"this",
"->",
"getIO",
"(",
")",
";",
"if",
"(",
"$",
"root",
")... | Retrieves detailed information about a package, or lists all packages available.
@param string $type Repository type, either: 'self', 'platform', 'installed' or 'available'
@param string $package Package name to show
@param string $version Package version to show
@param bool $root Query the Bolt parent compose... | [
"Retrieves",
"detailed",
"information",
"about",
"a",
"package",
"or",
"lists",
"all",
"packages",
"available",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/Action/ShowPackage.php#L36-L139 |
bolt/bolt | src/Menu/Builder/AdminMenu.php | AdminMenu.build | public function build(MenuEntry $root)
{
$this->addConfiguration($root);
$this->addFileManagement($root);
$this->addExtend($root);
return $root;
} | php | public function build(MenuEntry $root)
{
$this->addConfiguration($root);
$this->addFileManagement($root);
$this->addExtend($root);
return $root;
} | [
"public",
"function",
"build",
"(",
"MenuEntry",
"$",
"root",
")",
"{",
"$",
"this",
"->",
"addConfiguration",
"(",
"$",
"root",
")",
";",
"$",
"this",
"->",
"addFileManagement",
"(",
"$",
"root",
")",
";",
"$",
"this",
"->",
"addExtend",
"(",
"$",
"... | Build the menus.
@param MenuEntry $root
@return MenuEntry | [
"Build",
"the",
"menus",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Menu/Builder/AdminMenu.php#L25-L32 |
bolt/bolt | src/Menu/Builder/AdminMenu.php | AdminMenu.addConfiguration | private function addConfiguration(MenuEntry $root)
{
// Main configuration
$configEntry = $root->add(
MenuEntry::create('config')
->setLabel(Trans::__('general.phrase.configuration'))
->setIcon('fa:cogs')
->setPermission('settings')
... | php | private function addConfiguration(MenuEntry $root)
{
// Main configuration
$configEntry = $root->add(
MenuEntry::create('config')
->setLabel(Trans::__('general.phrase.configuration'))
->setIcon('fa:cogs')
->setPermission('settings')
... | [
"private",
"function",
"addConfiguration",
"(",
"MenuEntry",
"$",
"root",
")",
"{",
"// Main configuration",
"$",
"configEntry",
"=",
"$",
"root",
"->",
"add",
"(",
"MenuEntry",
"::",
"create",
"(",
"'config'",
")",
"->",
"setLabel",
"(",
"Trans",
"::",
"__"... | Configuration menus.
@param MenuEntry $root | [
"Configuration",
"menus",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Menu/Builder/AdminMenu.php#L39-L165 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.