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/EventListener/RedirectListener.php | RedirectListener.handleLoginRetreat | protected function handleLoginRetreat(Request $request, RedirectResponse $response)
{
$route = $request->attributes->get('_route');
if ($response->getTargetUrl() === $this->urlGenerator->generate('login') && $route !== 'logout') {
$this->session->set(
'retreat',
... | php | protected function handleLoginRetreat(Request $request, RedirectResponse $response)
{
$route = $request->attributes->get('_route');
if ($response->getTargetUrl() === $this->urlGenerator->generate('login') && $route !== 'logout') {
$this->session->set(
'retreat',
... | [
"protected",
"function",
"handleLoginRetreat",
"(",
"Request",
"$",
"request",
",",
"RedirectResponse",
"$",
"response",
")",
"{",
"$",
"route",
"=",
"$",
"request",
"->",
"attributes",
"->",
"get",
"(",
"'_route'",
")",
";",
"if",
"(",
"$",
"response",
"-... | When redirecting to login page set the 'retreat' variable in the session.
This allows a redirect back to the current page after successful login.
@param \Symfony\Component\HttpFoundation\Request $request
@param \Symfony\Component\HttpFoundation\RedirectResponse $response | [
"When",
"redirecting",
"to",
"login",
"page",
"set",
"the",
"retreat",
"variable",
"in",
"the",
"session",
".",
"This",
"allows",
"a",
"redirect",
"back",
"to",
"the",
"current",
"page",
"after",
"successful",
"login",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/EventListener/RedirectListener.php#L100-L115 |
bolt/bolt | src/Twig/Extension/AdminExtension.php | AdminExtension.getFunctions | public function getFunctions()
{
$safe = ['is_safe' => ['html']];
$deprecated = ['deprecated' => true];
return [
// @codingStandardsIgnoreStart
new TwigFunction('__', [Runtime\AdminRuntime::class, 'trans'], $safe),
new TwigFunction('buid',... | php | public function getFunctions()
{
$safe = ['is_safe' => ['html']];
$deprecated = ['deprecated' => true];
return [
// @codingStandardsIgnoreStart
new TwigFunction('__', [Runtime\AdminRuntime::class, 'trans'], $safe),
new TwigFunction('buid',... | [
"public",
"function",
"getFunctions",
"(",
")",
"{",
"$",
"safe",
"=",
"[",
"'is_safe'",
"=>",
"[",
"'html'",
"]",
"]",
";",
"$",
"deprecated",
"=",
"[",
"'deprecated'",
"=>",
"true",
"]",
";",
"return",
"[",
"// @codingStandardsIgnoreStart",
"new",
"TwigF... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/Extension/AdminExtension.php#L23-L40 |
bolt/bolt | src/Twig/Extension/AdminExtension.php | AdminExtension.getFilters | public function getFilters()
{
$safe = ['is_safe' => ['html']];
return [
// @codingStandardsIgnoreStart
new TwigFilter('__', [Runtime\AdminRuntime::class, 'trans']),
new TwigFilter('loglevel', [Runtime\AdminRuntime::class, 'logLevel']),
new Twig... | php | public function getFilters()
{
$safe = ['is_safe' => ['html']];
return [
// @codingStandardsIgnoreStart
new TwigFilter('__', [Runtime\AdminRuntime::class, 'trans']),
new TwigFilter('loglevel', [Runtime\AdminRuntime::class, 'logLevel']),
new Twig... | [
"public",
"function",
"getFilters",
"(",
")",
"{",
"$",
"safe",
"=",
"[",
"'is_safe'",
"=>",
"[",
"'html'",
"]",
"]",
";",
"return",
"[",
"// @codingStandardsIgnoreStart",
"new",
"TwigFilter",
"(",
"'__'",
",",
"[",
"Runtime",
"\\",
"AdminRuntime",
"::",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/Extension/AdminExtension.php#L45-L56 |
bolt/bolt | src/Filesystem/Plugin/Parents.php | Parents.handle | public function handle($path)
{
$parents = [];
// path could actually be a file, but it doesn't matter here.
$dir = $this->filesystem->getDir($path);
if ($dir->isRoot()) {
return $parents;
}
do {
$dir = $dir->getParent();
$parent... | php | public function handle($path)
{
$parents = [];
// path could actually be a file, but it doesn't matter here.
$dir = $this->filesystem->getDir($path);
if ($dir->isRoot()) {
return $parents;
}
do {
$dir = $dir->getParent();
$parent... | [
"public",
"function",
"handle",
"(",
"$",
"path",
")",
"{",
"$",
"parents",
"=",
"[",
"]",
";",
"// path could actually be a file, but it doesn't matter here.",
"$",
"dir",
"=",
"$",
"this",
"->",
"filesystem",
"->",
"getDir",
"(",
"$",
"path",
")",
";",
"if... | @param string $path
@return DirectoryInterface[] | [
"@param",
"string",
"$path"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Filesystem/Plugin/Parents.php#L30-L47 |
bolt/bolt | src/Storage/Database/Schema/Comparison/MySql.php | MySql.removeIgnoredChanges | protected function removeIgnoredChanges(TableDiff $diff)
{
// Work around reserved column name removal
if ($diff->fromTable->getName() === $this->prefix . 'cron') {
foreach ($diff->renamedColumns as $key => $col) {
if ($col->getName() === 'interim') {
... | php | protected function removeIgnoredChanges(TableDiff $diff)
{
// Work around reserved column name removal
if ($diff->fromTable->getName() === $this->prefix . 'cron') {
foreach ($diff->renamedColumns as $key => $col) {
if ($col->getName() === 'interim') {
... | [
"protected",
"function",
"removeIgnoredChanges",
"(",
"TableDiff",
"$",
"diff",
")",
"{",
"// Work around reserved column name removal",
"if",
"(",
"$",
"diff",
"->",
"fromTable",
"->",
"getName",
"(",
")",
"===",
"$",
"this",
"->",
"prefix",
".",
"'cron'",
")",... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Database/Schema/Comparison/MySql.php#L31-L55 |
bolt/bolt | src/Asset/Snippet/Snippet.php | Snippet.getCallableResult | private function getCallableResult()
{
if (is_callable($this->callback)) {
return call_user_func_array($this->callback, (array) $this->callbackArguments);
} elseif (is_string($this->callback) || $this->callback instanceof Markup) {
// Insert the 'callback' as a string.
... | php | private function getCallableResult()
{
if (is_callable($this->callback)) {
return call_user_func_array($this->callback, (array) $this->callbackArguments);
} elseif (is_string($this->callback) || $this->callback instanceof Markup) {
// Insert the 'callback' as a string.
... | [
"private",
"function",
"getCallableResult",
"(",
")",
"{",
"if",
"(",
"is_callable",
"(",
"$",
"this",
"->",
"callback",
")",
")",
"{",
"return",
"call_user_func_array",
"(",
"$",
"this",
"->",
"callback",
",",
"(",
"array",
")",
"$",
"this",
"->",
"call... | Get the output from the callback.
@throws \RuntimeException
@return string | [
"Get",
"the",
"output",
"from",
"the",
"callback",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Asset/Snippet/Snippet.php#L145-L161 |
bolt/bolt | src/Storage/Database/Schema/Builder/ExtensionTables.php | ExtensionTables.getSchemaTables | public function getSchemaTables(Schema $schema)
{
$tables = [];
foreach ($this->tables->keys() as $name) {
/** @var BaseTable $table */
$table = $this->tables[$name];
$tables[$name] = $table->buildTable($schema, $name, $this->charset, $this->collate);
}
... | php | public function getSchemaTables(Schema $schema)
{
$tables = [];
foreach ($this->tables->keys() as $name) {
/** @var BaseTable $table */
$table = $this->tables[$name];
$tables[$name] = $table->buildTable($schema, $name, $this->charset, $this->collate);
}
... | [
"public",
"function",
"getSchemaTables",
"(",
"Schema",
"$",
"schema",
")",
"{",
"$",
"tables",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"tables",
"->",
"keys",
"(",
")",
"as",
"$",
"name",
")",
"{",
"/** @var BaseTable $table */",
"$",
"... | Get all the registered extension tables.
We need to be prepared for generators returning a single table, as well
as generators returning an array of tables.
@param Schema $schema
@return \Doctrine\DBAL\Schema\Table[] | [
"Get",
"all",
"the",
"registered",
"extension",
"tables",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Database/Schema/Builder/ExtensionTables.php#L34-L67 |
bolt/bolt | src/AccessControl/PermissionParser.php | PermissionParser.tokenName | public static function tokenName($tokenType)
{
switch ($tokenType) {
case self::T_UNDEFINED:
return 'T_UNDEFINED';
case self::T_OPEN_PARENS:
return 'T_OPEN_PARENS';
case self::T_CLOSE_PARENS:
return 'T_CLOSE_PARENS';
... | php | public static function tokenName($tokenType)
{
switch ($tokenType) {
case self::T_UNDEFINED:
return 'T_UNDEFINED';
case self::T_OPEN_PARENS:
return 'T_OPEN_PARENS';
case self::T_CLOSE_PARENS:
return 'T_CLOSE_PARENS';
... | [
"public",
"static",
"function",
"tokenName",
"(",
"$",
"tokenType",
")",
"{",
"switch",
"(",
"$",
"tokenType",
")",
"{",
"case",
"self",
"::",
"T_UNDEFINED",
":",
"return",
"'T_UNDEFINED'",
";",
"case",
"self",
"::",
"T_OPEN_PARENS",
":",
"return",
"'T_OPEN_... | Get the symbolic name of a lexer token type.
@param int $tokenType
@return string | [
"Get",
"the",
"symbolic",
"name",
"of",
"a",
"lexer",
"token",
"type",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/AccessControl/PermissionParser.php#L85-L109 |
bolt/bolt | src/AccessControl/PermissionParser.php | PermissionParser.lex | public static function lex($query)
{
$originalQuery = $query;
// A branch is defined as a regular expression to match, mapped onto
// the resulting token type (in the 'type' key).
// If the regular expression has capturing subexpressions, the first
// of those is returned in... | php | public static function lex($query)
{
$originalQuery = $query;
// A branch is defined as a regular expression to match, mapped onto
// the resulting token type (in the 'type' key).
// If the regular expression has capturing subexpressions, the first
// of those is returned in... | [
"public",
"static",
"function",
"lex",
"(",
"$",
"query",
")",
"{",
"$",
"originalQuery",
"=",
"$",
"query",
";",
"// A branch is defined as a regular expression to match, mapped onto",
"// the resulting token type (in the 'type' key).",
"// If the regular expression has capturing ... | Lexes the given $query into lexer tokens.
@param $query
@throws PermissionLexerException
@return array | [
"Lexes",
"the",
"given",
"$query",
"into",
"lexer",
"tokens",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/AccessControl/PermissionParser.php#L164-L239 |
bolt/bolt | src/AccessControl/PermissionParser.php | PermissionParser.expect | private static function expect($expected, $token)
{
if (!in_array($token['type'], $expected)) {
if (count($expected) === 1) {
$expectedStr = self::tokenName($expected[0]);
} else {
$last = array_pop($expected);
$expectedStr = 'one of ' ... | php | private static function expect($expected, $token)
{
if (!in_array($token['type'], $expected)) {
if (count($expected) === 1) {
$expectedStr = self::tokenName($expected[0]);
} else {
$last = array_pop($expected);
$expectedStr = 'one of ' ... | [
"private",
"static",
"function",
"expect",
"(",
"$",
"expected",
",",
"$",
"token",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"token",
"[",
"'type'",
"]",
",",
"$",
"expected",
")",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"expected",
")",
"... | Assert that the given $token's 'type' key is in the list of $expected
token types.
@param array $expected list of token types (T_XXXX constants)
@param array $token a lexer token, associative array
@throws PermissionParserException | [
"Assert",
"that",
"the",
"given",
"$token",
"s",
"type",
"key",
"is",
"in",
"the",
"list",
"of",
"$expected",
"token",
"types",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/AccessControl/PermissionParser.php#L250-L266 |
bolt/bolt | src/Storage/Entity/Builder.php | Builder.getClassMetadata | public function getClassMetadata()
{
$class = $this->class;
if ($this->classMetadata === null) {
$classMetadata = $this->metadata->loadMetadataForClass($class);
$this->classMetadata = $classMetadata;
}
return $this->classMetadata;
} | php | public function getClassMetadata()
{
$class = $this->class;
if ($this->classMetadata === null) {
$classMetadata = $this->metadata->loadMetadataForClass($class);
$this->classMetadata = $classMetadata;
}
return $this->classMetadata;
} | [
"public",
"function",
"getClassMetadata",
"(",
")",
"{",
"$",
"class",
"=",
"$",
"this",
"->",
"class",
";",
"if",
"(",
"$",
"this",
"->",
"classMetadata",
"===",
"null",
")",
"{",
"$",
"classMetadata",
"=",
"$",
"this",
"->",
"metadata",
"->",
"loadMe... | Gets the metadata instance.
@throws \Bolt\Exception\StorageException
@return ClassMetadata $classMetadata | [
"Gets",
"the",
"metadata",
"instance",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Entity/Builder.php#L66-L75 |
bolt/bolt | src/Storage/Entity/Builder.php | Builder.getEntity | public function getEntity($entity = null)
{
if ($entity === null) {
$class = $this->class;
$entity = new $class();
}
if ($entity instanceof Content && !$entity->getContenttype() && $ct = $this->getClassMetadata()->getBoltName()) {
$contentType = $this->me... | php | public function getEntity($entity = null)
{
if ($entity === null) {
$class = $this->class;
$entity = new $class();
}
if ($entity instanceof Content && !$entity->getContenttype() && $ct = $this->getClassMetadata()->getBoltName()) {
$contentType = $this->me... | [
"public",
"function",
"getEntity",
"(",
"$",
"entity",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"entity",
"===",
"null",
")",
"{",
"$",
"class",
"=",
"$",
"this",
"->",
"class",
";",
"$",
"entity",
"=",
"new",
"$",
"class",
"(",
")",
";",
"}",
"i... | Returns a new empty entity class.
@param object|null $entity
@throws \Bolt\Exception\StorageException
@return object | [
"Returns",
"a",
"new",
"empty",
"entity",
"class",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Entity/Builder.php#L97-L114 |
bolt/bolt | src/Storage/Entity/Builder.php | Builder.create | public function create($data, $entity = null)
{
$entity = $this->getEntity($entity);
$fields = $this->getFields();
// set fields
foreach ($fields as $key => $mapping) {
$fieldType = $this->fieldManager->get($mapping['fieldtype'], $mapping);
// If we have a t... | php | public function create($data, $entity = null)
{
$entity = $this->getEntity($entity);
$fields = $this->getFields();
// set fields
foreach ($fields as $key => $mapping) {
$fieldType = $this->fieldManager->get($mapping['fieldtype'], $mapping);
// If we have a t... | [
"public",
"function",
"create",
"(",
"$",
"data",
",",
"$",
"entity",
"=",
"null",
")",
"{",
"$",
"entity",
"=",
"$",
"this",
"->",
"getEntity",
"(",
"$",
"entity",
")",
";",
"$",
"fields",
"=",
"$",
"this",
"->",
"getFields",
"(",
")",
";",
"// ... | Creates a new entity object.
@param array|object $data data to load into the entity
@param object|null $entity
@throws \Bolt\Exception\StorageException
@return object $entity | [
"Creates",
"a",
"new",
"entity",
"object",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Entity/Builder.php#L139-L163 |
bolt/bolt | src/Storage/Entity/Builder.php | Builder.createFromDatabaseValues | public function createFromDatabaseValues($data, $entity = null)
{
$entity = $this->getEntity($entity);
$fields = $this->getFields();
// set fields
foreach ($fields as $key => $mapping) {
$fieldType = $this->fieldManager->get($mapping['fieldtype'], $mapping);
... | php | public function createFromDatabaseValues($data, $entity = null)
{
$entity = $this->getEntity($entity);
$fields = $this->getFields();
// set fields
foreach ($fields as $key => $mapping) {
$fieldType = $this->fieldManager->get($mapping['fieldtype'], $mapping);
... | [
"public",
"function",
"createFromDatabaseValues",
"(",
"$",
"data",
",",
"$",
"entity",
"=",
"null",
")",
"{",
"$",
"entity",
"=",
"$",
"this",
"->",
"getEntity",
"(",
"$",
"entity",
")",
";",
"$",
"fields",
"=",
"$",
"this",
"->",
"getFields",
"(",
... | Performs database to PHP transforms before creating new entity.
@param array $data
@param object|null $entity
@throws \Bolt\Exception\StorageException
@return object $entity | [
"Performs",
"database",
"to",
"PHP",
"transforms",
"before",
"creating",
"new",
"entity",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Entity/Builder.php#L175-L189 |
bolt/bolt | src/Storage/Entity/Builder.php | Builder.refresh | public function refresh($entity)
{
$fields = $this->getFields();
foreach ($fields as $key => $mapping) {
$fieldType = $this->fieldManager->get($mapping['fieldtype'], $mapping);
$getter = 'get' . ucfirst($key);
$value = $entity->$getter();
if ($value) ... | php | public function refresh($entity)
{
$fields = $this->getFields();
foreach ($fields as $key => $mapping) {
$fieldType = $this->fieldManager->get($mapping['fieldtype'], $mapping);
$getter = 'get' . ucfirst($key);
$value = $entity->$getter();
if ($value) ... | [
"public",
"function",
"refresh",
"(",
"$",
"entity",
")",
"{",
"$",
"fields",
"=",
"$",
"this",
"->",
"getFields",
"(",
")",
";",
"foreach",
"(",
"$",
"fields",
"as",
"$",
"key",
"=>",
"$",
"mapping",
")",
"{",
"$",
"fieldType",
"=",
"$",
"this",
... | Refresh an entities values.
@param object|null $entity
@throws \Bolt\Exception\StorageException | [
"Refresh",
"an",
"entities",
"values",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Entity/Builder.php#L198-L210 |
bolt/bolt | src/Storage/Entity/Builder.php | Builder.getHydratedValue | public function getHydratedValue($value, $field, $subField = null, $block = null)
{
$fields = $this->getFields();
foreach ($fields as $key => $mapping) {
if ($key !== $field) {
continue;
}
$fieldType = $this->fieldManager->get($mapping['fieldtype'... | php | public function getHydratedValue($value, $field, $subField = null, $block = null)
{
$fields = $this->getFields();
foreach ($fields as $key => $mapping) {
if ($key !== $field) {
continue;
}
$fieldType = $this->fieldManager->get($mapping['fieldtype'... | [
"public",
"function",
"getHydratedValue",
"(",
"$",
"value",
",",
"$",
"field",
",",
"$",
"subField",
"=",
"null",
",",
"$",
"block",
"=",
"null",
")",
"{",
"$",
"fields",
"=",
"$",
"this",
"->",
"getFields",
"(",
")",
";",
"foreach",
"(",
"$",
"fi... | @param mixed $value
@param string $field
@param string|null $subField
@param string|null $block
@throws \Bolt\Exception\StorageException
@return FieldValue|bool | [
"@param",
"mixed",
"$value",
"@param",
"string",
"$field",
"@param",
"string|null",
"$subField",
"@param",
"string|null",
"$block"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Entity/Builder.php#L222-L254 |
bolt/bolt | src/Controller/Routing.php | Routing.getTaxonomyRequirement | public function getTaxonomyRequirement($taxonomyName, $emptyValue = 'none')
{
$this->deprecationWarn(__FUNCTION__, 'singleTaxonomy');
return $this->singleTaxonomy($taxonomyName, $emptyValue);
} | php | public function getTaxonomyRequirement($taxonomyName, $emptyValue = 'none')
{
$this->deprecationWarn(__FUNCTION__, 'singleTaxonomy');
return $this->singleTaxonomy($taxonomyName, $emptyValue);
} | [
"public",
"function",
"getTaxonomyRequirement",
"(",
"$",
"taxonomyName",
",",
"$",
"emptyValue",
"=",
"'none'",
")",
"{",
"$",
"this",
"->",
"deprecationWarn",
"(",
"__FUNCTION__",
",",
"'singleTaxonomy'",
")",
";",
"return",
"$",
"this",
"->",
"singleTaxonomy"... | @deprecated Deprecated since 3.0, to be removed in 4.0. Use {@see Bolt\Controller\Requirement::singleTaxonomy} instead.
@param string $taxonomyName
@param string $emptyValue
@return string | [
"@deprecated",
"Deprecated",
"since",
"3",
".",
"0",
"to",
"be",
"removed",
"in",
"4",
".",
"0",
".",
"Use",
"{",
"@see",
"Bolt",
"\\",
"Controller",
"\\",
"Requirement",
"::",
"singleTaxonomy",
"}",
"instead",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Routing.php#L60-L65 |
bolt/bolt | src/Pager/PagerManager.php | PagerManager.isPagingRequest | public static function isPagingRequest(Request $request)
{
$matches = [];
$found = preg_match('/page_[A-Za-z0-9_]+=(?!1\b)\d+/', $request->getRequestUri(), $matches);
return (bool) $found;
} | php | public static function isPagingRequest(Request $request)
{
$matches = [];
$found = preg_match('/page_[A-Za-z0-9_]+=(?!1\b)\d+/', $request->getRequestUri(), $matches);
return (bool) $found;
} | [
"public",
"static",
"function",
"isPagingRequest",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"matches",
"=",
"[",
"]",
";",
"$",
"found",
"=",
"preg_match",
"(",
"'/page_[A-Za-z0-9_]+=(?!1\\b)\\d+/'",
",",
"$",
"request",
"->",
"getRequestUri",
"(",
")",
... | @param Request $request
@return bool | [
"@param",
"Request",
"$request"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Pager/PagerManager.php#L58-L64 |
bolt/bolt | src/Pager/PagerManager.php | PagerManager.initialize | public function initialize(Request $request)
{
// prevent reinit
if (!$this->request) {
$this->request = $request;
$pagers = $this->decodeHttpQuery();
// prevent pager override
if (array_intersect_key($pagers, $this->pagers)) {
throw ne... | php | public function initialize(Request $request)
{
// prevent reinit
if (!$this->request) {
$this->request = $request;
$pagers = $this->decodeHttpQuery();
// prevent pager override
if (array_intersect_key($pagers, $this->pagers)) {
throw ne... | [
"public",
"function",
"initialize",
"(",
"Request",
"$",
"request",
")",
"{",
"// prevent reinit",
"if",
"(",
"!",
"$",
"this",
"->",
"request",
")",
"{",
"$",
"this",
"->",
"request",
"=",
"$",
"request",
";",
"$",
"pagers",
"=",
"$",
"this",
"->",
... | Initializer of pager objects from request query parameters.
@param Request $request
@throws PagerOverrideException | [
"Initializer",
"of",
"pager",
"objects",
"from",
"request",
"query",
"parameters",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Pager/PagerManager.php#L73-L86 |
bolt/bolt | src/Pager/PagerManager.php | PagerManager.makeLink | public function makeLink($linkFor = null)
{
/*
* If link set directly that forces using it rather than build
*/
if ($this->link) {
return $this->link;
}
$qparams = ($this->request) ? $this->request->query->all() : [];
$pagerid = $this->findPage... | php | public function makeLink($linkFor = null)
{
/*
* If link set directly that forces using it rather than build
*/
if ($this->link) {
return $this->link;
}
$qparams = ($this->request) ? $this->request->query->all() : [];
$pagerid = $this->findPage... | [
"public",
"function",
"makeLink",
"(",
"$",
"linkFor",
"=",
"null",
")",
"{",
"/*\n * If link set directly that forces using it rather than build\n */",
"if",
"(",
"$",
"this",
"->",
"link",
")",
"{",
"return",
"$",
"this",
"->",
"link",
";",
"}",
... | Use for calling from template to build up paginated URL link.
It preserves each http query parameters except which is requested and returns a http GET query string.
Last parameter appended to the end of the string so its value can be just concatenating.
Against deprecated Pager::makelink() this is will build link based... | [
"Use",
"for",
"calling",
"from",
"template",
"to",
"build",
"up",
"paginated",
"URL",
"link",
".",
"It",
"preserves",
"each",
"http",
"query",
"parameters",
"except",
"which",
"is",
"requested",
"and",
"returns",
"a",
"http",
"GET",
"query",
"string",
".",
... | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Pager/PagerManager.php#L100-L132 |
bolt/bolt | src/Pager/PagerManager.php | PagerManager.decodeHttpQuery | public function decodeHttpQuery()
{
$values = [];
foreach ($this->getRequest()->query->all() as $key => $parameter) {
if (strpos($key, self::PAGE) === 0) {
$chunks = explode('_', $key);
$contextId = end($chunks);
$pager = new Pager($this);... | php | public function decodeHttpQuery()
{
$values = [];
foreach ($this->getRequest()->query->all() as $key => $parameter) {
if (strpos($key, self::PAGE) === 0) {
$chunks = explode('_', $key);
$contextId = end($chunks);
$pager = new Pager($this);... | [
"public",
"function",
"decodeHttpQuery",
"(",
")",
"{",
"$",
"values",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"getRequest",
"(",
")",
"->",
"query",
"->",
"all",
"(",
")",
"as",
"$",
"key",
"=>",
"$",
"parameter",
")",
"{",
"if",
... | Decodes HTTP query url and stores in addressable format. | [
"Decodes",
"HTTP",
"query",
"url",
"and",
"stores",
"in",
"addressable",
"format",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Pager/PagerManager.php#L153-L168 |
bolt/bolt | src/Pager/PagerManager.php | PagerManager.encodeHttpQuery | public function encodeHttpQuery($qparams = null)
{
$qparams = ($qparams === null) ? $this->getRequest()->query->all() : $qparams;
return http_build_query(array_merge($qparams, $this->remapPagers()));
} | php | public function encodeHttpQuery($qparams = null)
{
$qparams = ($qparams === null) ? $this->getRequest()->query->all() : $qparams;
return http_build_query(array_merge($qparams, $this->remapPagers()));
} | [
"public",
"function",
"encodeHttpQuery",
"(",
"$",
"qparams",
"=",
"null",
")",
"{",
"$",
"qparams",
"=",
"(",
"$",
"qparams",
"===",
"null",
")",
"?",
"$",
"this",
"->",
"getRequest",
"(",
")",
"->",
"query",
"->",
"all",
"(",
")",
":",
"$",
"qpar... | Encodes Http GET query string from actual parts of query parameters and from 'current' values of pager objects.
@param array|null $qparams [optional] Optional parameters where actual values to be merged into
@return string Encoded query string | [
"Encodes",
"Http",
"GET",
"query",
"string",
"from",
"actual",
"parts",
"of",
"query",
"parameters",
"and",
"from",
"current",
"values",
"of",
"pager",
"objects",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Pager/PagerManager.php#L177-L182 |
bolt/bolt | src/Pager/PagerManager.php | PagerManager.offsetSet | public function offsetSet($contextId, $pager)
{
if (!$pager->manager) {
$pager->setManager($this);
}
$this->pagers[$this->makeParameterId($contextId)] = $pager;
} | php | public function offsetSet($contextId, $pager)
{
if (!$pager->manager) {
$pager->setManager($this);
}
$this->pagers[$this->makeParameterId($contextId)] = $pager;
} | [
"public",
"function",
"offsetSet",
"(",
"$",
"contextId",
",",
"$",
"pager",
")",
"{",
"if",
"(",
"!",
"$",
"pager",
"->",
"manager",
")",
"{",
"$",
"pager",
"->",
"setManager",
"(",
"$",
"this",
")",
";",
"}",
"$",
"this",
"->",
"pagers",
"[",
"... | Set the Pager object.
@param mixed $contextId
@param Pager $pager | [
"Set",
"the",
"Pager",
"object",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Pager/PagerManager.php#L212-L218 |
bolt/bolt | src/Pager/PagerManager.php | PagerManager.offsetGet | public function offsetGet($contextId)
{
$ctxkey = $this->makeParameterId($contextId);
if (array_key_exists($ctxkey, $this->pagers)) {
return $this->pagers[$ctxkey];
}
return false;
} | php | public function offsetGet($contextId)
{
$ctxkey = $this->makeParameterId($contextId);
if (array_key_exists($ctxkey, $this->pagers)) {
return $this->pagers[$ctxkey];
}
return false;
} | [
"public",
"function",
"offsetGet",
"(",
"$",
"contextId",
")",
"{",
"$",
"ctxkey",
"=",
"$",
"this",
"->",
"makeParameterId",
"(",
"$",
"contextId",
")",
";",
"if",
"(",
"array_key_exists",
"(",
"$",
"ctxkey",
",",
"$",
"this",
"->",
"pagers",
")",
")"... | @param mixed $contextId
@return Pager|false | [
"@param",
"mixed",
"$contextId"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Pager/PagerManager.php#L235-L243 |
bolt/bolt | src/Pager/PagerManager.php | PagerManager.keys | public function keys()
{
return array_map(
function ($key) {
$chunks = explode('_', $key);
return array_pop($chunks);
},
array_keys($this->pagers)
);
} | php | public function keys()
{
return array_map(
function ($key) {
$chunks = explode('_', $key);
return array_pop($chunks);
},
array_keys($this->pagers)
);
} | [
"public",
"function",
"keys",
"(",
")",
"{",
"return",
"array_map",
"(",
"function",
"(",
"$",
"key",
")",
"{",
"$",
"chunks",
"=",
"explode",
"(",
"'_'",
",",
"$",
"key",
")",
";",
"return",
"array_pop",
"(",
"$",
"chunks",
")",
";",
"}",
",",
"... | Returns context ids array.
@return array | [
"Returns",
"context",
"ids",
"array",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Pager/PagerManager.php#L250-L260 |
bolt/bolt | src/Pager/PagerManager.php | PagerManager.createPager | public function createPager($contextId = null)
{
$pager = new Pager($this);
$pager->setFor($contextId);
return $this->pagers[$this->makeParameterId($contextId)] = $pager;
} | php | public function createPager($contextId = null)
{
$pager = new Pager($this);
$pager->setFor($contextId);
return $this->pagers[$this->makeParameterId($contextId)] = $pager;
} | [
"public",
"function",
"createPager",
"(",
"$",
"contextId",
"=",
"null",
")",
"{",
"$",
"pager",
"=",
"new",
"Pager",
"(",
"$",
"this",
")",
";",
"$",
"pager",
"->",
"setFor",
"(",
"$",
"contextId",
")",
";",
"return",
"$",
"this",
"->",
"pagers",
... | Factory method creating a Pager object.
@param string $contextId [optional]
@return Pager | [
"Factory",
"method",
"creating",
"a",
"Pager",
"object",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Pager/PagerManager.php#L293-L299 |
bolt/bolt | src/Pager/PagerManager.php | PagerManager.getPager | public function getPager($contextId = null)
{
if ($contextId) {
return $this->pagers[$this->makeParameterId($contextId)];
} else {
$initialized = $this->findInitializedPagerId();
if ($initialized) {
return $this->pagers[$initialized];
}... | php | public function getPager($contextId = null)
{
if ($contextId) {
return $this->pagers[$this->makeParameterId($contextId)];
} else {
$initialized = $this->findInitializedPagerId();
if ($initialized) {
return $this->pagers[$initialized];
}... | [
"public",
"function",
"getPager",
"(",
"$",
"contextId",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"contextId",
")",
"{",
"return",
"$",
"this",
"->",
"pagers",
"[",
"$",
"this",
"->",
"makeParameterId",
"(",
"$",
"contextId",
")",
"]",
";",
"}",
"else"... | Gets the explicitly indexed pager or finds a completely initialized one.
Pager is initialized if its _$totalpages_ attribute set.
@param string $contextId [optional]
@return mixed | [
"Gets",
"the",
"explicitly",
"indexed",
"pager",
"or",
"finds",
"a",
"completely",
"initialized",
"one",
".",
"Pager",
"is",
"initialized",
"if",
"its",
"_$totalpages_",
"attribute",
"set",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Pager/PagerManager.php#L309-L321 |
bolt/bolt | src/Pager/PagerManager.php | PagerManager.getCurrentPage | public function getCurrentPage($contextId = null)
{
$pager = $this->offsetGet($contextId) ?: $this->offsetGet('');
return ($pager) ? $pager->current : 1;
} | php | public function getCurrentPage($contextId = null)
{
$pager = $this->offsetGet($contextId) ?: $this->offsetGet('');
return ($pager) ? $pager->current : 1;
} | [
"public",
"function",
"getCurrentPage",
"(",
"$",
"contextId",
"=",
"null",
")",
"{",
"$",
"pager",
"=",
"$",
"this",
"->",
"offsetGet",
"(",
"$",
"contextId",
")",
"?",
":",
"$",
"this",
"->",
"offsetGet",
"(",
"''",
")",
";",
"return",
"(",
"$",
... | @param string $contextId
@return Pager|int | [
"@param",
"string",
"$contextId"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Pager/PagerManager.php#L328-L333 |
bolt/bolt | src/Pager/PagerManager.php | PagerManager.findInitializedPagerId | protected function findInitializedPagerId()
{
foreach ($this->pagers as $key => $pager) {
if (isset($pager->totalpages)) {
return $key;
}
}
return '';
} | php | protected function findInitializedPagerId()
{
foreach ($this->pagers as $key => $pager) {
if (isset($pager->totalpages)) {
return $key;
}
}
return '';
} | [
"protected",
"function",
"findInitializedPagerId",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"pagers",
"as",
"$",
"key",
"=>",
"$",
"pager",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"pager",
"->",
"totalpages",
")",
")",
"{",
"return",
"$",
"k... | Finds any initialized pager and gets its pager id.
@return int|string | [
"Finds",
"any",
"initialized",
"pager",
"and",
"gets",
"its",
"pager",
"id",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Pager/PagerManager.php#L391-L400 |
bolt/bolt | src/Storage/Repository/CronRepository.php | CronRepository.queryNextRunTime | public function queryNextRunTime($interimName)
{
/** @deprecated Deprecated since 3.0, to be removed in 4.0. */
$oldname = strtolower(str_replace('cron.', '', $interimName));
$qb = $this->createQueryBuilder();
$qb->select('id, lastrun, interim')
->where('interim = :inter... | php | public function queryNextRunTime($interimName)
{
/** @deprecated Deprecated since 3.0, to be removed in 4.0. */
$oldname = strtolower(str_replace('cron.', '', $interimName));
$qb = $this->createQueryBuilder();
$qb->select('id, lastrun, interim')
->where('interim = :inter... | [
"public",
"function",
"queryNextRunTime",
"(",
"$",
"interimName",
")",
"{",
"/** @deprecated Deprecated since 3.0, to be removed in 4.0. */",
"$",
"oldname",
"=",
"strtolower",
"(",
"str_replace",
"(",
"'cron.'",
",",
"''",
",",
"$",
"interimName",
")",
")",
";",
"... | Build the query for a run time.
@param string $interimName
@return QueryBuilder | [
"Build",
"the",
"query",
"for",
"a",
"run",
"time",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Repository/CronRepository.php#L34-L48 |
bolt/bolt | src/Embed/Resolver.php | Resolver.embed | public function embed(UriInterface $url, $providerName)
{
$adapter = $this->getUrlAdapter($url);
$providers = $adapter->getProviders();
if (!isset($providers[$providerName])) {
return [];
}
/** @var \Embed\Providers\Provider $provider */
$provider = $provi... | php | public function embed(UriInterface $url, $providerName)
{
$adapter = $this->getUrlAdapter($url);
$providers = $adapter->getProviders();
if (!isset($providers[$providerName])) {
return [];
}
/** @var \Embed\Providers\Provider $provider */
$provider = $provi... | [
"public",
"function",
"embed",
"(",
"UriInterface",
"$",
"url",
",",
"$",
"providerName",
")",
"{",
"$",
"adapter",
"=",
"$",
"this",
"->",
"getUrlAdapter",
"(",
"$",
"url",
")",
";",
"$",
"providers",
"=",
"$",
"adapter",
"->",
"getProviders",
"(",
")... | Return embed information from a given URL.
@param UriInterface $url
@param string $providerName
@return array | [
"Return",
"embed",
"information",
"from",
"a",
"given",
"URL",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Embed/Resolver.php#L41-L52 |
bolt/bolt | src/Embed/Resolver.php | Resolver.getUrlAdapter | private function getUrlAdapter(UriInterface $url)
{
$embedFactory = $this->embedFactory;
$url = Url::create((string) $url);
try {
$adapter = $embedFactory($url);
} catch (InvalidUrlException $e) {
throw new EmbedResolverException($e->getMessage(), 1, $e);
... | php | private function getUrlAdapter(UriInterface $url)
{
$embedFactory = $this->embedFactory;
$url = Url::create((string) $url);
try {
$adapter = $embedFactory($url);
} catch (InvalidUrlException $e) {
throw new EmbedResolverException($e->getMessage(), 1, $e);
... | [
"private",
"function",
"getUrlAdapter",
"(",
"UriInterface",
"$",
"url",
")",
"{",
"$",
"embedFactory",
"=",
"$",
"this",
"->",
"embedFactory",
";",
"$",
"url",
"=",
"Url",
"::",
"create",
"(",
"(",
"string",
")",
"$",
"url",
")",
";",
"try",
"{",
"$... | Return an API adapter matching the pattern of the given URL.
@param UriInterface $url
@return \Embed\Adapters\Adapter | [
"Return",
"an",
"API",
"adapter",
"matching",
"the",
"pattern",
"of",
"the",
"given",
"URL",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Embed/Resolver.php#L89-L103 |
bolt/bolt | src/Nut/ConfigSet.php | ConfigSet.doExecute | protected function doExecute(YamlUpdater $updater, InputInterface $input, OutputInterface $output)
{
$key = $input->getArgument('key');
$value = $input->getArgument('value');
$backup = $input->getOption('backup');
$newValue = $value === 'true' || $value === 'false'
? fil... | php | protected function doExecute(YamlUpdater $updater, InputInterface $input, OutputInterface $output)
{
$key = $input->getArgument('key');
$value = $input->getArgument('value');
$backup = $input->getOption('backup');
$newValue = $value === 'true' || $value === 'false'
? fil... | [
"protected",
"function",
"doExecute",
"(",
"YamlUpdater",
"$",
"updater",
",",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"key",
"=",
"$",
"input",
"->",
"getArgument",
"(",
"'key'",
")",
";",
"$",
"value",
"=",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/ConfigSet.php#L33-L51 |
bolt/bolt | src/TemplateChooser.php | TemplateChooser.homepage | public function homepage($content)
{
$templates = [];
// First candidate: Theme-specific config.yml file.
if ($template = $this->config->get('theme/homepage_template')) {
$templates[] = $template;
}
// Second candidate: Global config.yml file.
if ($templ... | php | public function homepage($content)
{
$templates = [];
// First candidate: Theme-specific config.yml file.
if ($template = $this->config->get('theme/homepage_template')) {
$templates[] = $template;
}
// Second candidate: Global config.yml file.
if ($templ... | [
"public",
"function",
"homepage",
"(",
"$",
"content",
")",
"{",
"$",
"templates",
"=",
"[",
"]",
";",
"// First candidate: Theme-specific config.yml file.",
"if",
"(",
"$",
"template",
"=",
"$",
"this",
"->",
"config",
"->",
"get",
"(",
"'theme/homepage_templat... | Choose a template for the homepage.
@param \Bolt\Legacy\Content|\Bolt\Legacy\Content[] $content
@return string[] | [
"Choose",
"a",
"template",
"for",
"the",
"homepage",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/TemplateChooser.php#L30-L57 |
bolt/bolt | src/TemplateChooser.php | TemplateChooser.record | public function record($record, $data = null)
{
$templates = [];
// First candidate: A legacy Content record has a templateselect field, and it's set.
if (isset($record->contenttype['fields'])) {
foreach ($record->contenttype['fields'] as $name => $field) {
if ($... | php | public function record($record, $data = null)
{
$templates = [];
// First candidate: A legacy Content record has a templateselect field, and it's set.
if (isset($record->contenttype['fields'])) {
foreach ($record->contenttype['fields'] as $name => $field) {
if ($... | [
"public",
"function",
"record",
"(",
"$",
"record",
",",
"$",
"data",
"=",
"null",
")",
"{",
"$",
"templates",
"=",
"[",
"]",
";",
"// First candidate: A legacy Content record has a templateselect field, and it's set.",
"if",
"(",
"isset",
"(",
"$",
"record",
"->"... | Choose a template for a single record page, e.g.:
- '/page/about'
- '/entry/lorum-ipsum'.
Refactor note: Using a FQCN for the hint here as a `use` statement causes
a fatal in the unit tests… 'cause PHP and class_alias() versus namespaces.
@param object $record
@param array $data
@return string[] | [
"Choose",
"a",
"template",
"for",
"a",
"single",
"record",
"page",
"e",
".",
"g",
".",
":",
"-",
"/",
"page",
"/",
"about",
"-",
"/",
"entry",
"/",
"lorum",
"-",
"ipsum",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/TemplateChooser.php#L72-L121 |
bolt/bolt | src/TemplateChooser.php | TemplateChooser.listing | public function listing($contenttype)
{
$templates = [];
// First candidate: defined specifically in the contenttype.
if (!empty($contenttype['listing_template'])) {
$templates[] = $contenttype['listing_template'];
}
// Second candidate: a template with the same... | php | public function listing($contenttype)
{
$templates = [];
// First candidate: defined specifically in the contenttype.
if (!empty($contenttype['listing_template'])) {
$templates[] = $contenttype['listing_template'];
}
// Second candidate: a template with the same... | [
"public",
"function",
"listing",
"(",
"$",
"contenttype",
")",
"{",
"$",
"templates",
"=",
"[",
"]",
";",
"// First candidate: defined specifically in the contenttype.",
"if",
"(",
"!",
"empty",
"(",
"$",
"contenttype",
"[",
"'listing_template'",
"]",
")",
")",
... | Select a template for listing pages.
@param array $contenttype
@return string[] | [
"Select",
"a",
"template",
"for",
"listing",
"pages",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/TemplateChooser.php#L130-L155 |
bolt/bolt | src/TemplateChooser.php | TemplateChooser.taxonomy | public function taxonomy($taxonomyslug)
{
$templates = [];
// First candidate: defined specifically in the taxonomy
if ($template = $this->config->get('taxonomy/' . $taxonomyslug . '/listing_template')) {
$templates[] = $template;
}
// Second candidate: Theme-sp... | php | public function taxonomy($taxonomyslug)
{
$templates = [];
// First candidate: defined specifically in the taxonomy
if ($template = $this->config->get('taxonomy/' . $taxonomyslug . '/listing_template')) {
$templates[] = $template;
}
// Second candidate: Theme-sp... | [
"public",
"function",
"taxonomy",
"(",
"$",
"taxonomyslug",
")",
"{",
"$",
"templates",
"=",
"[",
"]",
";",
"// First candidate: defined specifically in the taxonomy",
"if",
"(",
"$",
"template",
"=",
"$",
"this",
"->",
"config",
"->",
"get",
"(",
"'taxonomy/'",... | Select a template for taxonomy.
@param string $taxonomyslug
@return string[] | [
"Select",
"a",
"template",
"for",
"taxonomy",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/TemplateChooser.php#L164-L182 |
bolt/bolt | src/TemplateChooser.php | TemplateChooser.search | public function search()
{
$templates = [];
// First candidate: specific search setting in global config.
if ($template = $this->config->get('theme/search_results_template')) {
$templates[] = $template;
}
// Second candidate: specific search setting in global co... | php | public function search()
{
$templates = [];
// First candidate: specific search setting in global config.
if ($template = $this->config->get('theme/search_results_template')) {
$templates[] = $template;
}
// Second candidate: specific search setting in global co... | [
"public",
"function",
"search",
"(",
")",
"{",
"$",
"templates",
"=",
"[",
"]",
";",
"// First candidate: specific search setting in global config.",
"if",
"(",
"$",
"template",
"=",
"$",
"this",
"->",
"config",
"->",
"get",
"(",
"'theme/search_results_template'",
... | Select a search template.
@return string[] | [
"Select",
"a",
"search",
"template",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/TemplateChooser.php#L189-L207 |
bolt/bolt | src/TemplateChooser.php | TemplateChooser.maintenance | public function maintenance()
{
$templates = [];
// First candidate: Theme-specific config.
if ($template = $this->config->get('theme/maintenance_template')) {
$templates[] = $template;
}
// Second candidate: global config.
$templates[] = $this->config->... | php | public function maintenance()
{
$templates = [];
// First candidate: Theme-specific config.
if ($template = $this->config->get('theme/maintenance_template')) {
$templates[] = $template;
}
// Second candidate: global config.
$templates[] = $this->config->... | [
"public",
"function",
"maintenance",
"(",
")",
"{",
"$",
"templates",
"=",
"[",
"]",
";",
"// First candidate: Theme-specific config.",
"if",
"(",
"$",
"template",
"=",
"$",
"this",
"->",
"config",
"->",
"get",
"(",
"'theme/maintenance_template'",
")",
")",
"{... | Select a template to use for the "maintenance" page.
@return string[] | [
"Select",
"a",
"template",
"to",
"use",
"for",
"the",
"maintenance",
"page",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/TemplateChooser.php#L214-L227 |
bolt/bolt | src/Twig/Extension/RoutingExtension.php | RoutingExtension.getFunctions | public function getFunctions()
{
return [
// @codingStandardsIgnoreStart
new TwigFunction('canonical', [Runtime\RoutingRuntime::class, 'canonical']),
new TwigFunction('editlink', [Runtime\RoutingRuntime::class, 'editlink']),
new TwigFunction('htmlla... | php | public function getFunctions()
{
return [
// @codingStandardsIgnoreStart
new TwigFunction('canonical', [Runtime\RoutingRuntime::class, 'canonical']),
new TwigFunction('editlink', [Runtime\RoutingRuntime::class, 'editlink']),
new TwigFunction('htmlla... | [
"public",
"function",
"getFunctions",
"(",
")",
"{",
"return",
"[",
"// @codingStandardsIgnoreStart",
"new",
"TwigFunction",
"(",
"'canonical'",
",",
"[",
"Runtime",
"\\",
"RoutingRuntime",
"::",
"class",
",",
"'canonical'",
"]",
")",
",",
"new",
"TwigFunction",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/Extension/RoutingExtension.php#L21-L33 |
bolt/bolt | src/Storage/Entity/ContentRouteTrait.php | ContentRouteTrait.link | public function link($referenceType = UrlGeneratorInterface::ABSOLUTE_PATH)
{
list($name, $params) = $this->getRouteNameAndParams();
/** @var UrlGeneratorInterface $urlGenerator */
$urlGenerator = $this->app['url_generator'];
return $name ? $urlGenerator->generate($name, $params, $r... | php | public function link($referenceType = UrlGeneratorInterface::ABSOLUTE_PATH)
{
list($name, $params) = $this->getRouteNameAndParams();
/** @var UrlGeneratorInterface $urlGenerator */
$urlGenerator = $this->app['url_generator'];
return $name ? $urlGenerator->generate($name, $params, $r... | [
"public",
"function",
"link",
"(",
"$",
"referenceType",
"=",
"UrlGeneratorInterface",
"::",
"ABSOLUTE_PATH",
")",
"{",
"list",
"(",
"$",
"name",
",",
"$",
"params",
")",
"=",
"$",
"this",
"->",
"getRouteNameAndParams",
"(",
")",
";",
"/** @var UrlGeneratorInt... | Creates a URL for the content record.
@param int $referenceType
@return string|null | [
"Creates",
"a",
"URL",
"for",
"the",
"content",
"record",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Entity/ContentRouteTrait.php#L42-L49 |
bolt/bolt | src/Storage/Entity/ContentRouteTrait.php | ContentRouteTrait.isHome | public function isHome()
{
$config = $this->app['config'];
$homepage = $config->get('theme/homepage') ?: $config->get('general/homepage');
$uriID = $this->contenttype['singular_slug'] . '/' . $this->get('id');
$uriSlug = $this->contenttype['singular_slug'] . '/' . $this->get('slug');... | php | public function isHome()
{
$config = $this->app['config'];
$homepage = $config->get('theme/homepage') ?: $config->get('general/homepage');
$uriID = $this->contenttype['singular_slug'] . '/' . $this->get('id');
$uriSlug = $this->contenttype['singular_slug'] . '/' . $this->get('slug');... | [
"public",
"function",
"isHome",
"(",
")",
"{",
"$",
"config",
"=",
"$",
"this",
"->",
"app",
"[",
"'config'",
"]",
";",
"$",
"homepage",
"=",
"$",
"config",
"->",
"get",
"(",
"'theme/homepage'",
")",
"?",
":",
"$",
"config",
"->",
"get",
"(",
"'gen... | Checks if the current record is set as the homepage.
@return bool | [
"Checks",
"if",
"the",
"current",
"record",
"is",
"set",
"as",
"the",
"homepage",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Entity/ContentRouteTrait.php#L56-L64 |
bolt/bolt | src/Storage/Entity/ContentRouteTrait.php | ContentRouteTrait.getRouteNameAndParams | public function getRouteNameAndParams()
{
if (empty($this->id)) {
return null;
}
// No links for records that are 'viewless'
if (isset($this->contenttype['viewless']) && $this->contenttype['viewless'] === true) {
return null;
}
list($name, $c... | php | public function getRouteNameAndParams()
{
if (empty($this->id)) {
return null;
}
// No links for records that are 'viewless'
if (isset($this->contenttype['viewless']) && $this->contenttype['viewless'] === true) {
return null;
}
list($name, $c... | [
"public",
"function",
"getRouteNameAndParams",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"id",
")",
")",
"{",
"return",
"null",
";",
"}",
"// No links for records that are 'viewless'",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"contenttype... | Returns [route name, route params] for url generation, or null for various reasons.
@return array|null | [
"Returns",
"[",
"route",
"name",
"route",
"params",
"]",
"for",
"url",
"generation",
"or",
"null",
"for",
"various",
"reasons",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Entity/ContentRouteTrait.php#L71-L116 |
bolt/bolt | src/Storage/Entity/ContentRouteTrait.php | ContentRouteTrait.getRouteConfig | protected function getRouteConfig()
{
$allroutes = $this->app['config']->get('routing');
// First, try to find a custom route that's applicable
foreach ($allroutes as $binding => $config) {
if ($this->isApplicableRoute($config)) {
return [$binding, $config];
... | php | protected function getRouteConfig()
{
$allroutes = $this->app['config']->get('routing');
// First, try to find a custom route that's applicable
foreach ($allroutes as $binding => $config) {
if ($this->isApplicableRoute($config)) {
return [$binding, $config];
... | [
"protected",
"function",
"getRouteConfig",
"(",
")",
"{",
"$",
"allroutes",
"=",
"$",
"this",
"->",
"app",
"[",
"'config'",
"]",
"->",
"get",
"(",
"'routing'",
")",
";",
"// First, try to find a custom route that's applicable",
"foreach",
"(",
"$",
"allroutes",
... | Retrieves the first route applicable to the content as a two-element array consisting of the binding and the
route array. Returns `null` if there is no applicable route.
@return array|null | [
"Retrieves",
"the",
"first",
"route",
"applicable",
"to",
"the",
"content",
"as",
"a",
"two",
"-",
"element",
"array",
"consisting",
"of",
"the",
"binding",
"and",
"the",
"route",
"array",
".",
"Returns",
"null",
"if",
"there",
"is",
"no",
"applicable",
"r... | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Entity/ContentRouteTrait.php#L124-L141 |
bolt/bolt | src/Storage/Entity/ContentRouteTrait.php | ContentRouteTrait.getRouteRequirementParams | protected function getRouteRequirementParams(array $route)
{
$params = [];
if (isset($route['requirements'])) {
foreach ($route['requirements'] as $fieldName => $requirement) {
if ('\d{4}-\d{2}-\d{2}' === $requirement) {
// Special case, if we need to ... | php | protected function getRouteRequirementParams(array $route)
{
$params = [];
if (isset($route['requirements'])) {
foreach ($route['requirements'] as $fieldName => $requirement) {
if ('\d{4}-\d{2}-\d{2}' === $requirement) {
// Special case, if we need to ... | [
"protected",
"function",
"getRouteRequirementParams",
"(",
"array",
"$",
"route",
")",
"{",
"$",
"params",
"=",
"[",
"]",
";",
"if",
"(",
"isset",
"(",
"$",
"route",
"[",
"'requirements'",
"]",
")",
")",
"{",
"foreach",
"(",
"$",
"route",
"[",
"'requir... | Build a ContentType's route parameters.
@param array $route
@return array | [
"Build",
"a",
"ContentType",
"s",
"route",
"parameters",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Entity/ContentRouteTrait.php#L150-L181 |
bolt/bolt | src/Storage/Entity/ContentRouteTrait.php | ContentRouteTrait.isApplicableRoute | protected function isApplicableRoute(array $route)
{
return (isset($route['contenttype']) && $route['contenttype'] === $this->contenttype['singular_slug'])
|| (isset($route['contenttype']) && $route['contenttype'] === $this->contenttype['slug'])
|| (isset($route['recordslug']) && $ro... | php | protected function isApplicableRoute(array $route)
{
return (isset($route['contenttype']) && $route['contenttype'] === $this->contenttype['singular_slug'])
|| (isset($route['contenttype']) && $route['contenttype'] === $this->contenttype['slug'])
|| (isset($route['recordslug']) && $ro... | [
"protected",
"function",
"isApplicableRoute",
"(",
"array",
"$",
"route",
")",
"{",
"return",
"(",
"isset",
"(",
"$",
"route",
"[",
"'contenttype'",
"]",
")",
"&&",
"$",
"route",
"[",
"'contenttype'",
"]",
"===",
"$",
"this",
"->",
"contenttype",
"[",
"'... | Check if a route is applicable to this record.
@param array $route
@return bool | [
"Check",
"if",
"a",
"route",
"is",
"applicable",
"to",
"this",
"record",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Entity/ContentRouteTrait.php#L190-L195 |
bolt/bolt | src/Storage/Entity/ContentRouteTrait.php | ContentRouteTrait.getLinkSlug | private function getLinkSlug()
{
if ($this instanceof Content) {
return $this->slug ?: $this->id;
}
if (isset($this->values['slug'])) {
return $this->values['slug'];
}
return $this->id;
} | php | private function getLinkSlug()
{
if ($this instanceof Content) {
return $this->slug ?: $this->id;
}
if (isset($this->values['slug'])) {
return $this->values['slug'];
}
return $this->id;
} | [
"private",
"function",
"getLinkSlug",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"instanceof",
"Content",
")",
"{",
"return",
"$",
"this",
"->",
"slug",
"?",
":",
"$",
"this",
"->",
"id",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"values",
... | Get a record's slug depending on the type of object used.
@return string|int | [
"Get",
"a",
"record",
"s",
"slug",
"depending",
"on",
"the",
"type",
"of",
"object",
"used",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Entity/ContentRouteTrait.php#L214-L225 |
bolt/bolt | src/Controller/Backend/BackendBase.php | BackendBase.render | protected function render($template, array $context = [], array $globals = [])
{
if (!isset($context['context'])) {
$context = ['context' => $context];
}
return parent::render($template, $context, $globals);
} | php | protected function render($template, array $context = [], array $globals = [])
{
if (!isset($context['context'])) {
$context = ['context' => $context];
}
return parent::render($template, $context, $globals);
} | [
"protected",
"function",
"render",
"(",
"$",
"template",
",",
"array",
"$",
"context",
"=",
"[",
"]",
",",
"array",
"$",
"globals",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"context",
"[",
"'context'",
"]",
")",
")",
"{",
"$",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Backend/BackendBase.php#L40-L47 |
bolt/bolt | src/Controller/Backend/BackendBase.php | BackendBase.before | public function before(Request $request, Application $app, $roleRoute = null)
{
// Start the 'stopwatch' for the profiler.
$app['stopwatch']->start('bolt.backend.before');
$route = $request->get('_route');
// Initial event
$event = new AccessControlEvent($request);
... | php | public function before(Request $request, Application $app, $roleRoute = null)
{
// Start the 'stopwatch' for the profiler.
$app['stopwatch']->start('bolt.backend.before');
$route = $request->get('_route');
// Initial event
$event = new AccessControlEvent($request);
... | [
"public",
"function",
"before",
"(",
"Request",
"$",
"request",
",",
"Application",
"$",
"app",
",",
"$",
"roleRoute",
"=",
"null",
")",
"{",
"// Start the 'stopwatch' for the profiler.",
"$",
"app",
"[",
"'stopwatch'",
"]",
"->",
"start",
"(",
"'bolt.backend.be... | Middleware function to check whether a user is logged on.
@param Request $request The Symfony Request
@param Application $app The application/container
@param string $roleRoute An overriding value for the route name in permission checks
@return null|\Symfony\Component\HttpFoundation\RedirectResponse|... | [
"Middleware",
"function",
"to",
"check",
"whether",
"a",
"user",
"is",
"logged",
"on",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Backend/BackendBase.php#L58-L134 |
bolt/bolt | src/Controller/Backend/BackendBase.php | BackendBase.getContent | protected function getContent($textQuery, $parameters = [], &$pager = [], $whereParameters = [])
{
$query = $this->app['query'];
return $query->getContent($textQuery, $parameters);
} | php | protected function getContent($textQuery, $parameters = [], &$pager = [], $whereParameters = [])
{
$query = $this->app['query'];
return $query->getContent($textQuery, $parameters);
} | [
"protected",
"function",
"getContent",
"(",
"$",
"textQuery",
",",
"$",
"parameters",
"=",
"[",
"]",
",",
"&",
"$",
"pager",
"=",
"[",
"]",
",",
"$",
"whereParameters",
"=",
"[",
"]",
")",
"{",
"$",
"query",
"=",
"$",
"this",
"->",
"app",
"[",
"'... | Temporary override for back-end.
@internal For core use only, to be removed soon!
@param string $textQuery
@param array $parameters
@param array $pager
@param array $whereParameters
@return QueryResultset
@see \Bolt\Storage\Query\Query::getContent() | [
"Temporary",
"override",
"for",
"back",
"-",
"end",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Backend/BackendBase.php#L150-L155 |
bolt/bolt | src/Controller/Backend/BackendBase.php | BackendBase.setAuthenticationCookie | protected function setAuthenticationCookie(Request $request, Response $response, $token)
{
$response->setVary('Cookies', false)->setMaxAge(0)->setPrivate();
$response->headers->setCookie(
new Cookie(
$this->app['token.authentication.name'],
$token,
... | php | protected function setAuthenticationCookie(Request $request, Response $response, $token)
{
$response->setVary('Cookies', false)->setMaxAge(0)->setPrivate();
$response->headers->setCookie(
new Cookie(
$this->app['token.authentication.name'],
$token,
... | [
"protected",
"function",
"setAuthenticationCookie",
"(",
"Request",
"$",
"request",
",",
"Response",
"$",
"response",
",",
"$",
"token",
")",
"{",
"$",
"response",
"->",
"setVary",
"(",
"'Cookies'",
",",
"false",
")",
"->",
"setMaxAge",
"(",
"0",
")",
"->"... | Set the authentication cookie in the response.
@param Request $request
@param Response $response
@param string $token
@return Response | [
"Set",
"the",
"authentication",
"cookie",
"in",
"the",
"response",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Backend/BackendBase.php#L184-L200 |
bolt/bolt | src/Controller/Backend/BackendBase.php | BackendBase.checkFirstUser | private function checkFirstUser(Application $app, $route)
{
/** @var UsersRepository $repo */
$repo = $app['storage']->getRepository(Entity\Users::class);
try {
$userCount = $repo->count();
} catch (TableNotFoundException $e) {
$app['schema']->update();
... | php | private function checkFirstUser(Application $app, $route)
{
/** @var UsersRepository $repo */
$repo = $app['storage']->getRepository(Entity\Users::class);
try {
$userCount = $repo->count();
} catch (TableNotFoundException $e) {
$app['schema']->update();
... | [
"private",
"function",
"checkFirstUser",
"(",
"Application",
"$",
"app",
",",
"$",
"route",
")",
"{",
"/** @var UsersRepository $repo */",
"$",
"repo",
"=",
"$",
"app",
"[",
"'storage'",
"]",
"->",
"getRepository",
"(",
"Entity",
"\\",
"Users",
"::",
"class",
... | Check and handle first user set up.
@param Application $app
@param mixed $route
@return null|true|\Symfony\Component\HttpFoundation\RedirectResponse | [
"Check",
"and",
"handle",
"first",
"user",
"set",
"up",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Backend/BackendBase.php#L230-L251 |
bolt/bolt | src/Composer/PackageManager.php | PackageManager.setup | private function setup()
{
if ($this->started) {
return;
}
if ($this->app['extend.writeable']) {
// Do required JSON update/set up
try {
$this->updateJson();
} catch (ParseException $e) {
$this->app['logger.flas... | php | private function setup()
{
if ($this->started) {
return;
}
if ($this->app['extend.writeable']) {
// Do required JSON update/set up
try {
$this->updateJson();
} catch (ParseException $e) {
$this->app['logger.flas... | [
"private",
"function",
"setup",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"started",
")",
"{",
"return",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"app",
"[",
"'extend.writeable'",
"]",
")",
"{",
"// Do required JSON update/set up",
"try",
"{",
"$",
"... | Set up function.
- Copy/update the installer event class
- Update the composer.json
- Test connection to the server | [
"Set",
"up",
"function",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/PackageManager.php#L69-L88 |
bolt/bolt | src/Composer/PackageManager.php | PackageManager.useSsl | public function useSsl()
{
if ($this->useSsl !== null) {
return $this->useSsl;
}
if (!extension_loaded('openssl')) {
return $this->useSsl = false;
}
if (!CaBundle::getSystemCaRootBundlePath($this->app['logger.system'])) {
throw new \Excep... | php | public function useSsl()
{
if ($this->useSsl !== null) {
return $this->useSsl;
}
if (!extension_loaded('openssl')) {
return $this->useSsl = false;
}
if (!CaBundle::getSystemCaRootBundlePath($this->app['logger.system'])) {
throw new \Excep... | [
"public",
"function",
"useSsl",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"useSsl",
"!==",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"useSsl",
";",
"}",
"if",
"(",
"!",
"extension_loaded",
"(",
"'openssl'",
")",
")",
"{",
"return",
"$",
"th... | Check if we can/should use SSL/TLS/HTTP2 or HTTP.
@throws \Exception
@return bool | [
"Check",
"if",
"we",
"can",
"/",
"should",
"use",
"SSL",
"/",
"TLS",
"/",
"HTTP2",
"or",
"HTTP",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/PackageManager.php#L97-L112 |
bolt/bolt | src/Composer/PackageManager.php | PackageManager.showPackage | public function showPackage($target, $package = '', $version = '', $root = false)
{
return $this->app['extend.action']['show']->execute($target, $package, $version, $root);
} | php | public function showPackage($target, $package = '', $version = '', $root = false)
{
return $this->app['extend.action']['show']->execute($target, $package, $version, $root);
} | [
"public",
"function",
"showPackage",
"(",
"$",
"target",
",",
"$",
"package",
"=",
"''",
",",
"$",
"version",
"=",
"''",
",",
"$",
"root",
"=",
"false",
")",
"{",
"return",
"$",
"this",
"->",
"app",
"[",
"'extend.action'",
"]",
"[",
"'show'",
"]",
... | Show packages.
@param string $target
@param string $package
@param string $version
@param bool $root
@return array | [
"Show",
"packages",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/PackageManager.php#L217-L220 |
bolt/bolt | src/Composer/PackageManager.php | PackageManager.getAllPackages | public function getAllPackages()
{
$collection = new PackageCollection();
if ($this->started === false) {
return $collection;
}
// Installed
$installed = $this->app['extend.action']['show']->execute('installed');
foreach ($installed as $composerPackage) ... | php | public function getAllPackages()
{
$collection = new PackageCollection();
if ($this->started === false) {
return $collection;
}
// Installed
$installed = $this->app['extend.action']['show']->execute('installed');
foreach ($installed as $composerPackage) ... | [
"public",
"function",
"getAllPackages",
"(",
")",
"{",
"$",
"collection",
"=",
"new",
"PackageCollection",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"started",
"===",
"false",
")",
"{",
"return",
"$",
"collection",
";",
"}",
"// Installed",
"$",
"inst... | Get packages that a properly installed, pending installed and locally installed.
@return PackageCollection | [
"Get",
"packages",
"that",
"a",
"properly",
"installed",
"pending",
"installed",
"and",
"locally",
"installed",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/PackageManager.php#L250-L317 |
bolt/bolt | src/Composer/PackageManager.php | PackageManager.linkConfig | private function linkConfig(ResolvedExtension $extension)
{
$file = $this->app['filesystem']->getFile(strtolower("extensions_config://{$extension->getName()}.{$extension->getVendor()}.yml"));
if ($file->exists()) {
return $this->app['url_generator']->generate('fileedit', ['namespace' => ... | php | private function linkConfig(ResolvedExtension $extension)
{
$file = $this->app['filesystem']->getFile(strtolower("extensions_config://{$extension->getName()}.{$extension->getVendor()}.yml"));
if ($file->exists()) {
return $this->app['url_generator']->generate('fileedit', ['namespace' => ... | [
"private",
"function",
"linkConfig",
"(",
"ResolvedExtension",
"$",
"extension",
")",
"{",
"$",
"file",
"=",
"$",
"this",
"->",
"app",
"[",
"'filesystem'",
"]",
"->",
"getFile",
"(",
"strtolower",
"(",
"\"extensions_config://{$extension->getName()}.{$extension->getVen... | Return the URI for a package's config file edit window.
@param ResolvedExtension $extension
@return string | [
"Return",
"the",
"URI",
"for",
"a",
"package",
"s",
"config",
"file",
"edit",
"window",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/PackageManager.php#L340-L348 |
bolt/bolt | src/Config.php | Config.loadTheme | private function loadTheme()
{
if ($this->isThemeCacheValid()) {
return;
}
$this->invalidateCache();
$themeDir = $this->app['filesystem']->getDir('themes://' . $this->get('general/theme'));
$this->data['theme'] = $this->parseTheme($themeDir, $this->data['general... | php | private function loadTheme()
{
if ($this->isThemeCacheValid()) {
return;
}
$this->invalidateCache();
$themeDir = $this->app['filesystem']->getDir('themes://' . $this->get('general/theme'));
$this->data['theme'] = $this->parseTheme($themeDir, $this->data['general... | [
"private",
"function",
"loadTheme",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isThemeCacheValid",
"(",
")",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"invalidateCache",
"(",
")",
";",
"$",
"themeDir",
"=",
"$",
"this",
"->",
"app",
"[",
... | Checks if cache is valid for theme; if not invalidate and load it. | [
"Checks",
"if",
"cache",
"is",
"valid",
"for",
"theme",
";",
"if",
"not",
"invalidate",
"and",
"load",
"it",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Config.php#L123-L133 |
bolt/bolt | src/Config.php | Config.parseConfigYaml | protected function parseConfigYaml($filename, DirectoryInterface $directory = null)
{
$directory = $directory ?: $this->app['filesystem']->getDir('config://');
try {
$file = $directory->get($filename);
} catch (FileNotFoundException $e) {
// Copy in dist files if app... | php | protected function parseConfigYaml($filename, DirectoryInterface $directory = null)
{
$directory = $directory ?: $this->app['filesystem']->getDir('config://');
try {
$file = $directory->get($filename);
} catch (FileNotFoundException $e) {
// Copy in dist files if app... | [
"protected",
"function",
"parseConfigYaml",
"(",
"$",
"filename",
",",
"DirectoryInterface",
"$",
"directory",
"=",
"null",
")",
"{",
"$",
"directory",
"=",
"$",
"directory",
"?",
":",
"$",
"this",
"->",
"app",
"[",
"'filesystem'",
"]",
"->",
"getDir",
"("... | Read and parse a YAML configuration file.
@param string $filename The name of the YAML file to read
@param DirectoryInterface $directory The (optional) directory to the YAML file
@return array | [
"Read",
"and",
"parse",
"a",
"YAML",
"configuration",
"file",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Config.php#L143-L170 |
bolt/bolt | src/Config.php | Config.set | public function set($path, $value)
{
Arr::set($this->data, $path, $value);
return true;
} | php | public function set($path, $value)
{
Arr::set($this->data, $path, $value);
return true;
} | [
"public",
"function",
"set",
"(",
"$",
"path",
",",
"$",
"value",
")",
"{",
"Arr",
"::",
"set",
"(",
"$",
"this",
"->",
"data",
",",
"$",
"path",
",",
"$",
"value",
")",
";",
"return",
"true",
";",
"}"
] | Set a config value, using a path.
For example:
$app['config']->set('general/branding/name', 'Bolt');
@param string $path
@param mixed $value
@return bool | [
"Set",
"a",
"config",
"value",
"using",
"a",
"path",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Config.php#L183-L188 |
bolt/bolt | src/Config.php | Config.doReplacements | public function doReplacements($value = null)
{
if ($value === null) {
$this->data = $this->doReplacements($this->data);
return;
}
if (!is_array($value) && ('%' !== substr($value, 0, 1) && '%' !== substr($value, -1, 1))) {
return $value;
}
... | php | public function doReplacements($value = null)
{
if ($value === null) {
$this->data = $this->doReplacements($this->data);
return;
}
if (!is_array($value) && ('%' !== substr($value, 0, 1) && '%' !== substr($value, -1, 1))) {
return $value;
}
... | [
"public",
"function",
"doReplacements",
"(",
"$",
"value",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"value",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"data",
"=",
"$",
"this",
"->",
"doReplacements",
"(",
"$",
"this",
"->",
"data",
")",
";",
"retu... | Replaces placeholders in config values %foo% will be resolved to $app['foo'] from the container.
@internal This is only public so that it can be called from the service provider boot method.
Do not access this directly since the API is liable to be changed at short notice.
@param mixed $value
@return mixed | [
"Replaces",
"placeholders",
"in",
"config",
"values",
"%foo%",
"will",
"be",
"resolved",
"to",
"$app",
"[",
"foo",
"]",
"from",
"the",
"container",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Config.php#L216-L268 |
bolt/bolt | src/Config.php | Config.getConfig | public function getConfig()
{
$config = [];
$config['general'] = $this->parseGeneral();
$config['taxonomy'] = $this->parseTaxonomy();
$config['contenttypes'] = $this->parseContentTypes($config['general']);
$config['menu'] = $this->parseConfigYaml('menu.yml');
$config... | php | public function getConfig()
{
$config = [];
$config['general'] = $this->parseGeneral();
$config['taxonomy'] = $this->parseTaxonomy();
$config['contenttypes'] = $this->parseContentTypes($config['general']);
$config['menu'] = $this->parseConfigYaml('menu.yml');
$config... | [
"public",
"function",
"getConfig",
"(",
")",
"{",
"$",
"config",
"=",
"[",
"]",
";",
"$",
"config",
"[",
"'general'",
"]",
"=",
"$",
"this",
"->",
"parseGeneral",
"(",
")",
";",
"$",
"config",
"[",
"'taxonomy'",
"]",
"=",
"$",
"this",
"->",
"parseT... | Load the configuration from the various YML files.
@return array | [
"Load",
"the",
"configuration",
"from",
"the",
"various",
"YML",
"files",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Config.php#L275-L288 |
bolt/bolt | src/Config.php | Config.parseGeneral | protected function parseGeneral()
{
// Read the config and merge it. (note: We use temp variables to prevent
// "Only variables should be passed by reference")
$tempconfig = $this->parseConfigYaml('config.yml');
$tempconfiglocal = $this->parseConfigYaml('config_local.yml');
$... | php | protected function parseGeneral()
{
// Read the config and merge it. (note: We use temp variables to prevent
// "Only variables should be passed by reference")
$tempconfig = $this->parseConfigYaml('config.yml');
$tempconfiglocal = $this->parseConfigYaml('config_local.yml');
$... | [
"protected",
"function",
"parseGeneral",
"(",
")",
"{",
"// Read the config and merge it. (note: We use temp variables to prevent",
"// \"Only variables should be passed by reference\")",
"$",
"tempconfig",
"=",
"$",
"this",
"->",
"parseConfigYaml",
"(",
"'config.yml'",
")",
";",... | Read and parse the config.yml and config_local.yml configuration files.
@return array | [
"Read",
"and",
"parse",
"the",
"config",
".",
"yml",
"and",
"config_local",
".",
"yml",
"configuration",
"files",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Config.php#L295-L340 |
bolt/bolt | src/Config.php | Config.parseTaxonomy | protected function parseTaxonomy(array $taxonomies = null)
{
$taxonomies = $taxonomies ?: $this->parseConfigYaml('taxonomy.yml');
$slugify = Slugify::create();
foreach ($taxonomies as $key => $taxonomy) {
if (!isset($taxonomy['name'])) {
$taxonomy['name'] = ucwor... | php | protected function parseTaxonomy(array $taxonomies = null)
{
$taxonomies = $taxonomies ?: $this->parseConfigYaml('taxonomy.yml');
$slugify = Slugify::create();
foreach ($taxonomies as $key => $taxonomy) {
if (!isset($taxonomy['name'])) {
$taxonomy['name'] = ucwor... | [
"protected",
"function",
"parseTaxonomy",
"(",
"array",
"$",
"taxonomies",
"=",
"null",
")",
"{",
"$",
"taxonomies",
"=",
"$",
"taxonomies",
"?",
":",
"$",
"this",
"->",
"parseConfigYaml",
"(",
"'taxonomy.yml'",
")",
";",
"$",
"slugify",
"=",
"Slugify",
":... | Read and parse the taxonomy.yml configuration file.
@param array|null $taxonomies
@return array | [
"Read",
"and",
"parse",
"the",
"taxonomy",
".",
"yml",
"configuration",
"file",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Config.php#L349-L405 |
bolt/bolt | src/Config.php | Config.parseContentTypes | protected function parseContentTypes(array $generalConfig)
{
$contentTypes = [];
$tempContentTypes = $this->parseConfigYaml('contenttypes.yml');
foreach ($tempContentTypes as $key => $contentType) {
try {
$contentType = $this->parseContentType($key, $contentType, ... | php | protected function parseContentTypes(array $generalConfig)
{
$contentTypes = [];
$tempContentTypes = $this->parseConfigYaml('contenttypes.yml');
foreach ($tempContentTypes as $key => $contentType) {
try {
$contentType = $this->parseContentType($key, $contentType, ... | [
"protected",
"function",
"parseContentTypes",
"(",
"array",
"$",
"generalConfig",
")",
"{",
"$",
"contentTypes",
"=",
"[",
"]",
";",
"$",
"tempContentTypes",
"=",
"$",
"this",
"->",
"parseConfigYaml",
"(",
"'contenttypes.yml'",
")",
";",
"foreach",
"(",
"$",
... | Read and parse the contenttypes.yml configuration file.
@param array $generalConfig
@return array | [
"Read",
"and",
"parse",
"the",
"contenttypes",
".",
"yml",
"configuration",
"file",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Config.php#L414-L428 |
bolt/bolt | src/Config.php | Config.parseTheme | protected function parseTheme(DirectoryInterface $themeDir, array $generalConfig)
{
$themeConfig = $this->parseConfigYaml('theme.yml', $themeDir);
/** @deprecated Deprecated since 3.0, to be removed in 4.0. (config.yml was the old filename) */
if (empty($themeConfig)) {
$themeCo... | php | protected function parseTheme(DirectoryInterface $themeDir, array $generalConfig)
{
$themeConfig = $this->parseConfigYaml('theme.yml', $themeDir);
/** @deprecated Deprecated since 3.0, to be removed in 4.0. (config.yml was the old filename) */
if (empty($themeConfig)) {
$themeCo... | [
"protected",
"function",
"parseTheme",
"(",
"DirectoryInterface",
"$",
"themeDir",
",",
"array",
"$",
"generalConfig",
")",
"{",
"$",
"themeConfig",
"=",
"$",
"this",
"->",
"parseConfigYaml",
"(",
"'theme.yml'",
",",
"$",
"themeDir",
")",
";",
"/** @deprecated D... | Read and parse the current theme's config.yml configuration file.
@param DirectoryInterface $themeDir
@param array $generalConfig
@return array | [
"Read",
"and",
"parse",
"the",
"current",
"theme",
"s",
"config",
".",
"yml",
"configuration",
"file",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Config.php#L438-L471 |
bolt/bolt | src/Config.php | Config.parseTemplatefields | protected function parseTemplatefields()
{
$theme = $this->data['theme'];
if (isset($theme['templatefields'])) {
foreach ($this->data['contenttypes'] as $key => $ct) {
foreach ($ct['fields'] as $field) {
if (isset($field['type']) && $field['type'] ===... | php | protected function parseTemplatefields()
{
$theme = $this->data['theme'];
if (isset($theme['templatefields'])) {
foreach ($this->data['contenttypes'] as $key => $ct) {
foreach ($ct['fields'] as $field) {
if (isset($field['type']) && $field['type'] ===... | [
"protected",
"function",
"parseTemplatefields",
"(",
")",
"{",
"$",
"theme",
"=",
"$",
"this",
"->",
"data",
"[",
"'theme'",
"]",
";",
"if",
"(",
"isset",
"(",
"$",
"theme",
"[",
"'templatefields'",
"]",
")",
")",
"{",
"foreach",
"(",
"$",
"this",
"-... | This method pulls the templatefields config from the theme config and appends it
to the contenttypes configuration. | [
"This",
"method",
"pulls",
"the",
"templatefields",
"config",
"from",
"the",
"theme",
"config",
"and",
"appends",
"it",
"to",
"the",
"contenttypes",
"configuration",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Config.php#L477-L490 |
bolt/bolt | src/Config.php | Config.parseContentType | protected function parseContentType($key, $contentType, $generalConfig)
{
// If the slug isn't set, and the 'key' isn't numeric, use that as the slug.
if (!isset($contentType['slug']) && !is_numeric($key)) {
$contentType['slug'] = Slugify::create()->slugify($key);
}
// I... | php | protected function parseContentType($key, $contentType, $generalConfig)
{
// If the slug isn't set, and the 'key' isn't numeric, use that as the slug.
if (!isset($contentType['slug']) && !is_numeric($key)) {
$contentType['slug'] = Slugify::create()->slugify($key);
}
// I... | [
"protected",
"function",
"parseContentType",
"(",
"$",
"key",
",",
"$",
"contentType",
",",
"$",
"generalConfig",
")",
"{",
"// If the slug isn't set, and the 'key' isn't numeric, use that as the slug.",
"if",
"(",
"!",
"isset",
"(",
"$",
"contentType",
"[",
"'slug'",
... | Parse a single Contenttype configuration array.
@param string $key
@param array $contentType
@param array $generalConfig
@throws InvalidArgumentException
@return array | [
"Parse",
"a",
"single",
"Contenttype",
"configuration",
"array",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Config.php#L503-L595 |
bolt/bolt | src/Config.php | Config.parseFieldsAndGroups | protected function parseFieldsAndGroups(array $fields, array $generalConfig)
{
$acceptableFileTypes = $generalConfig['accept_file_types'];
$currentGroup = 'ungrouped';
$groups = [];
$hasGroups = false;
foreach ($fields as $key => $field) {
unset($fields[$key]);
... | php | protected function parseFieldsAndGroups(array $fields, array $generalConfig)
{
$acceptableFileTypes = $generalConfig['accept_file_types'];
$currentGroup = 'ungrouped';
$groups = [];
$hasGroups = false;
foreach ($fields as $key => $field) {
unset($fields[$key]);
... | [
"protected",
"function",
"parseFieldsAndGroups",
"(",
"array",
"$",
"fields",
",",
"array",
"$",
"generalConfig",
")",
"{",
"$",
"acceptableFileTypes",
"=",
"$",
"generalConfig",
"[",
"'accept_file_types'",
"]",
";",
"$",
"currentGroup",
"=",
"'ungrouped'",
";",
... | Parse a Contenttype's filed and determine the grouping.
@param array $fields
@param array $generalConfig
@return array | [
"Parse",
"a",
"Contenttype",
"s",
"filed",
"and",
"determine",
"the",
"grouping",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Config.php#L605-L687 |
bolt/bolt | src/Config.php | Config.parseFieldRepeaters | private function parseFieldRepeaters(array $fields, $key)
{
$blacklist = ['repeater', 'slug', 'templatefield'];
$repeater = $fields[$key];
if (!isset($repeater['fields']) || !is_array($repeater['fields'])) {
return;
}
foreach ($repeater['fields'] as $repeaterKey... | php | private function parseFieldRepeaters(array $fields, $key)
{
$blacklist = ['repeater', 'slug', 'templatefield'];
$repeater = $fields[$key];
if (!isset($repeater['fields']) || !is_array($repeater['fields'])) {
return;
}
foreach ($repeater['fields'] as $repeaterKey... | [
"private",
"function",
"parseFieldRepeaters",
"(",
"array",
"$",
"fields",
",",
"$",
"key",
")",
"{",
"$",
"blacklist",
"=",
"[",
"'repeater'",
",",
"'slug'",
",",
"'templatefield'",
"]",
";",
"$",
"repeater",
"=",
"$",
"fields",
"[",
"$",
"key",
"]",
... | Basic validation of repeater fields.
@param array $fields
@param string $key
@return array | [
"Basic",
"validation",
"of",
"repeater",
"fields",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Config.php#L697-L713 |
bolt/bolt | src/Config.php | Config.parseDatabase | protected function parseDatabase(array $options)
{
// Make sure prefix ends with underscore
if (substr($options['prefix'], strlen($options['prefix']) - 1) !== '_') {
$options['prefix'] .= '_';
}
// Parse master connection parameters
$master = $this->parseConnecti... | php | protected function parseDatabase(array $options)
{
// Make sure prefix ends with underscore
if (substr($options['prefix'], strlen($options['prefix']) - 1) !== '_') {
$options['prefix'] .= '_';
}
// Parse master connection parameters
$master = $this->parseConnecti... | [
"protected",
"function",
"parseDatabase",
"(",
"array",
"$",
"options",
")",
"{",
"// Make sure prefix ends with underscore",
"if",
"(",
"substr",
"(",
"$",
"options",
"[",
"'prefix'",
"]",
",",
"strlen",
"(",
"$",
"options",
"[",
"'prefix'",
"]",
")",
"-",
... | Parse and fine-tune the database configuration.
@param array $options
@return array | [
"Parse",
"and",
"fine",
"-",
"tune",
"the",
"database",
"configuration",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Config.php#L722-L772 |
bolt/bolt | src/Config.php | Config.parseSqliteOptions | protected function parseSqliteOptions(array $config)
{
if (isset($config['memory']) && $config['memory']) {
// If in-memory, no need to parse paths
unset($config['path']);
return $config;
}
// Prevent SQLite driver from trying to use in-memory connection
... | php | protected function parseSqliteOptions(array $config)
{
if (isset($config['memory']) && $config['memory']) {
// If in-memory, no need to parse paths
unset($config['path']);
return $config;
}
// Prevent SQLite driver from trying to use in-memory connection
... | [
"protected",
"function",
"parseSqliteOptions",
"(",
"array",
"$",
"config",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"config",
"[",
"'memory'",
"]",
")",
"&&",
"$",
"config",
"[",
"'memory'",
"]",
")",
"{",
"// If in-memory, no need to parse paths",
"unset",
... | Fine-tune Sqlite configuration parameters.
@param array $config
@return array | [
"Fine",
"-",
"tune",
"Sqlite",
"configuration",
"parameters",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Config.php#L781-L815 |
bolt/bolt | src/Config.php | Config.parseConnectionParams | protected function parseConnectionParams($params, $defaults = [])
{
// Handle host shortcut
if (is_string($params)) {
$params = ['host' => $params];
}
// Convert keys from Bolt
$replacements = [
'databasename' => 'dbname',
'username' =... | php | protected function parseConnectionParams($params, $defaults = [])
{
// Handle host shortcut
if (is_string($params)) {
$params = ['host' => $params];
}
// Convert keys from Bolt
$replacements = [
'databasename' => 'dbname',
'username' =... | [
"protected",
"function",
"parseConnectionParams",
"(",
"$",
"params",
",",
"$",
"defaults",
"=",
"[",
"]",
")",
"{",
"// Handle host shortcut",
"if",
"(",
"is_string",
"(",
"$",
"params",
")",
")",
"{",
"$",
"params",
"=",
"[",
"'host'",
"=>",
"$",
"para... | Parses params to valid connection parameters.
- Defaults are merged into the params
- Bolt keys are converted to Doctrine keys
- Invalid keys are filtered out
@param array|string $params
@param array $defaults
@return array | [
"Parses",
"params",
"to",
"valid",
"connection",
"parameters",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Config.php#L829-L863 |
bolt/bolt | src/Config.php | Config.checkTaxonomy | private function checkTaxonomy()
{
foreach ($this->data['taxonomy'] as $key => $taxonomy) {
if (empty($taxonomy['options']) || !is_array($taxonomy['options'])) {
continue;
}
foreach ($taxonomy['options'] as $optionKey => $optionValue) {
if... | php | private function checkTaxonomy()
{
foreach ($this->data['taxonomy'] as $key => $taxonomy) {
if (empty($taxonomy['options']) || !is_array($taxonomy['options'])) {
continue;
}
foreach ($taxonomy['options'] as $optionKey => $optionValue) {
if... | [
"private",
"function",
"checkTaxonomy",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"data",
"[",
"'taxonomy'",
"]",
"as",
"$",
"key",
"=>",
"$",
"taxonomy",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"taxonomy",
"[",
"'options'",
"]",
")",
"||",
... | Sanity check for slashes in in taxonomy slugs.
@return bool | [
"Sanity",
"check",
"for",
"slashes",
"in",
"in",
"taxonomy",
"slugs",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Config.php#L870-L892 |
bolt/bolt | src/Config.php | Config.checkConfig | public function checkConfig()
{
$slugs = [];
if ($this->passed === null) {
$this->passed = true;
} else {
return $this->passed;
}
foreach ($this->data['contenttypes'] as $key => $ct) {
// Make sure that there are no hyphens in the contentt... | php | public function checkConfig()
{
$slugs = [];
if ($this->passed === null) {
$this->passed = true;
} else {
return $this->passed;
}
foreach ($this->data['contenttypes'] as $key => $ct) {
// Make sure that there are no hyphens in the contentt... | [
"public",
"function",
"checkConfig",
"(",
")",
"{",
"$",
"slugs",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"this",
"->",
"passed",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"passed",
"=",
"true",
";",
"}",
"else",
"{",
"return",
"$",
"this",
"->",
... | Sanity checks for doubles in in contenttypes.
@return bool | [
"Sanity",
"checks",
"for",
"doubles",
"in",
"in",
"contenttypes",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Config.php#L899-L1079 |
bolt/bolt | src/Config.php | Config.getDefaults | protected function getDefaults()
{
return [
'database' => [
'driver' => 'sqlite',
'host' => 'localhost',
'slaves' => [],
'dbname' => 'bolt',
'prefix' => 'bolt_',
... | php | protected function getDefaults()
{
return [
'database' => [
'driver' => 'sqlite',
'host' => 'localhost',
'slaves' => [],
'dbname' => 'bolt',
'prefix' => 'bolt_',
... | [
"protected",
"function",
"getDefaults",
"(",
")",
"{",
"return",
"[",
"'database'",
"=>",
"[",
"'driver'",
"=>",
"'sqlite'",
",",
"'host'",
"=>",
"'localhost'",
",",
"'slaves'",
"=>",
"[",
"]",
",",
"'dbname'",
"=>",
"'bolt'",
",",
"'prefix'",
"=>",
"'bolt... | Assume sensible defaults for a number of options. | [
"Assume",
"sensible",
"defaults",
"for",
"a",
"number",
"of",
"options",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Config.php#L1094-L1207 |
bolt/bolt | src/Config.php | Config.getTwigPath | public function getTwigPath()
{
Deprecated::method(3.3);
$themepath = $this->app['resources']->getPath('templatespath');
$twigpath = [];
if (file_exists($themepath)) {
$twigpath[] = $themepath;
} else {
// If the template path doesn't exist, flash e... | php | public function getTwigPath()
{
Deprecated::method(3.3);
$themepath = $this->app['resources']->getPath('templatespath');
$twigpath = [];
if (file_exists($themepath)) {
$twigpath[] = $themepath;
} else {
// If the template path doesn't exist, flash e... | [
"public",
"function",
"getTwigPath",
"(",
")",
"{",
"Deprecated",
"::",
"method",
"(",
"3.3",
")",
";",
"$",
"themepath",
"=",
"$",
"this",
"->",
"app",
"[",
"'resources'",
"]",
"->",
"getPath",
"(",
"'templatespath'",
")",
";",
"$",
"twigpath",
"=",
"... | Build an array of Twig paths.
@return string[] | [
"Build",
"an",
"array",
"of",
"Twig",
"paths",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Config.php#L1214-L1241 |
bolt/bolt | src/Config.php | Config.loadCache | protected function loadCache()
{
if ($this->isCacheValid() === false) {
return null;
}
$data = null;
try {
$data = $this->cacheFile->parse();
} catch (ParseException $e) {
// JSON is invalid, remove the file
$this->invalidateC... | php | protected function loadCache()
{
if ($this->isCacheValid() === false) {
return null;
}
$data = null;
try {
$data = $this->cacheFile->parse();
} catch (ParseException $e) {
// JSON is invalid, remove the file
$this->invalidateC... | [
"protected",
"function",
"loadCache",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isCacheValid",
"(",
")",
"===",
"false",
")",
"{",
"return",
"null",
";",
"}",
"$",
"data",
"=",
"null",
";",
"try",
"{",
"$",
"data",
"=",
"$",
"this",
"->",
"ca... | Attempt to load cached configuration files.
@throws RuntimeException
@return array|null | [
"Attempt",
"to",
"load",
"cached",
"configuration",
"files",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Config.php#L1257-L1289 |
bolt/bolt | src/Config.php | Config.isCacheValid | private function isCacheValid()
{
if (!$this->cacheFile->exists()) {
return false;
}
$cachedConfigTimestamp = $this->cacheFile->getTimestamp();
/** @var \Bolt\Filesystem\Filesystem $configFs */
$configFs = $this->app['filesystem']->getFilesystem('config');
... | php | private function isCacheValid()
{
if (!$this->cacheFile->exists()) {
return false;
}
$cachedConfigTimestamp = $this->cacheFile->getTimestamp();
/** @var \Bolt\Filesystem\Filesystem $configFs */
$configFs = $this->app['filesystem']->getFilesystem('config');
... | [
"private",
"function",
"isCacheValid",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"cacheFile",
"->",
"exists",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"cachedConfigTimestamp",
"=",
"$",
"this",
"->",
"cacheFile",
"->",
"getTimestamp"... | Check if the cached config file exists, and is newer than the authoritative source.
@return bool | [
"Check",
"if",
"the",
"cached",
"config",
"file",
"exists",
"and",
"is",
"newer",
"than",
"the",
"authoritative",
"source",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Config.php#L1296-L1328 |
bolt/bolt | src/Config.php | Config.isThemeCacheValid | private function isThemeCacheValid()
{
if (!$this->cacheFile->exists()) {
return false;
}
$themeDir = $this->app['filesystem']->getDir('themes://' . $this->get('general/theme'));
// Check the timestamp for the theme's configuration file
$timestampTheme = 0;
... | php | private function isThemeCacheValid()
{
if (!$this->cacheFile->exists()) {
return false;
}
$themeDir = $this->app['filesystem']->getDir('themes://' . $this->get('general/theme'));
// Check the timestamp for the theme's configuration file
$timestampTheme = 0;
... | [
"private",
"function",
"isThemeCacheValid",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"cacheFile",
"->",
"exists",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"themeDir",
"=",
"$",
"this",
"->",
"app",
"[",
"'filesystem'",
"]",
"->"... | Check if the cache is still valid with theme file as well.
@return bool | [
"Check",
"if",
"the",
"cache",
"is",
"still",
"valid",
"with",
"theme",
"file",
"as",
"well",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Config.php#L1335-L1354 |
bolt/bolt | src/Config.php | Config.cacheConfig | public function cacheConfig($force = false)
{
if ($this->cacheFile->exists() && $force === false) {
return;
}
$this->cacheFile->dump($this->data);
} | php | public function cacheConfig($force = false)
{
if ($this->cacheFile->exists() && $force === false) {
return;
}
$this->cacheFile->dump($this->data);
} | [
"public",
"function",
"cacheConfig",
"(",
"$",
"force",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"cacheFile",
"->",
"exists",
"(",
")",
"&&",
"$",
"force",
"===",
"false",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"cacheFile",
"... | @internal Do not use
@param bool $force | [
"@internal",
"Do",
"not",
"use"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Config.php#L1373-L1379 |
bolt/bolt | src/Config.php | Config.getTimestamp | public function getTimestamp($when)
{
Deprecated::method(3.3);
$timezone = $this->get('general/timezone');
$now = date_format(new \DateTime($when, new \DateTimeZone($timezone)), 'Y-m-d H:i:s');
return $now;
} | php | public function getTimestamp($when)
{
Deprecated::method(3.3);
$timezone = $this->get('general/timezone');
$now = date_format(new \DateTime($when, new \DateTimeZone($timezone)), 'Y-m-d H:i:s');
return $now;
} | [
"public",
"function",
"getTimestamp",
"(",
"$",
"when",
")",
"{",
"Deprecated",
"::",
"method",
"(",
"3.3",
")",
";",
"$",
"timezone",
"=",
"$",
"this",
"->",
"get",
"(",
"'general/timezone'",
")",
";",
"$",
"now",
"=",
"date_format",
"(",
"new",
"\\",... | Get a timestamp, corrected to the timezone.
@param mixed $when
@return string Timestamp | [
"Get",
"a",
"timestamp",
"corrected",
"to",
"the",
"timezone",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Config.php#L1402-L1410 |
bolt/bolt | src/Config.php | Config.getCurrentTimestamp | public function getCurrentTimestamp()
{
Deprecated::method(3.3);
$timezone = $this->get('general/timezone');
$now = date_format(new \DateTime($timezone), 'Y-m-d H:i:s');
return $now;
} | php | public function getCurrentTimestamp()
{
Deprecated::method(3.3);
$timezone = $this->get('general/timezone');
$now = date_format(new \DateTime($timezone), 'Y-m-d H:i:s');
return $now;
} | [
"public",
"function",
"getCurrentTimestamp",
"(",
")",
"{",
"Deprecated",
"::",
"method",
"(",
"3.3",
")",
";",
"$",
"timezone",
"=",
"$",
"this",
"->",
"get",
"(",
"'general/timezone'",
")",
";",
"$",
"now",
"=",
"date_format",
"(",
"new",
"\\",
"DateTi... | Get the current timestamp, corrected to the timezone.
@return string Current timestamp | [
"Get",
"the",
"current",
"timestamp",
"corrected",
"to",
"the",
"timezone",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Config.php#L1417-L1425 |
bolt/bolt | src/Config.php | Config.getWhichEnd | public function getWhichEnd()
{
Deprecated::method(3.0);
$zone = $this->determineZone();
$this->app['end'] = $zone; // This is also deprecated
return $zone;
} | php | public function getWhichEnd()
{
Deprecated::method(3.0);
$zone = $this->determineZone();
$this->app['end'] = $zone; // This is also deprecated
return $zone;
} | [
"public",
"function",
"getWhichEnd",
"(",
")",
"{",
"Deprecated",
"::",
"method",
"(",
"3.0",
")",
";",
"$",
"zone",
"=",
"$",
"this",
"->",
"determineZone",
"(",
")",
";",
"$",
"this",
"->",
"app",
"[",
"'end'",
"]",
"=",
"$",
"zone",
";",
"// Thi... | Use {@see Zone} instead with a {@see Request}.
Going forward, decisions determined by current request
should be done in an app or route middleware.
Application should be setup agnostic to the current request.
Route middlewares apply only to a certain route or group of routes.
See {@see \Bolt\Controller\Async\AsyncBas... | [
"Use",
"{",
"@see",
"Zone",
"}",
"instead",
"with",
"a",
"{",
"@see",
"Request",
"}",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Config.php#L1445-L1453 |
bolt/bolt | src/Render.php | Render.render | public function render($templateName, $context = [], $globals = [])
{
Deprecated::method(3.3);
$template = $this->app['twig']->resolveTemplate($templateName);
foreach ($globals as $name => $value) {
$this->app['twig']->addGlobal($name, $value);
}
$html = twig_i... | php | public function render($templateName, $context = [], $globals = [])
{
Deprecated::method(3.3);
$template = $this->app['twig']->resolveTemplate($templateName);
foreach ($globals as $name => $value) {
$this->app['twig']->addGlobal($name, $value);
}
$html = twig_i... | [
"public",
"function",
"render",
"(",
"$",
"templateName",
",",
"$",
"context",
"=",
"[",
"]",
",",
"$",
"globals",
"=",
"[",
"]",
")",
"{",
"Deprecated",
"::",
"method",
"(",
"3.3",
")",
";",
"$",
"template",
"=",
"$",
"this",
"->",
"app",
"[",
"... | Render a template, possibly store it in cache. Or, if applicable, return the cached result.
@param string|string[] $templateName Template name(s)
@param array $context Context variables
@param array $globals Global variables
@return TemplateResponse
@deprecated Since 3.3, will be remove... | [
"Render",
"a",
"template",
"possibly",
"store",
"it",
"in",
"cache",
".",
"Or",
"if",
"applicable",
"return",
"the",
"cached",
"result",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Render.php#L69-L84 |
bolt/bolt | src/Render.php | Render.hasTemplate | public function hasTemplate($template)
{
Deprecated::method(3.3);
$loader = $this->app['twig']->getLoader();
/*
* Twig_ExistsLoaderInterface is getting merged into
* Twig_LoaderInterface in Twig 2.0. Check for this
* instead once we are there, and remove getSourc... | php | public function hasTemplate($template)
{
Deprecated::method(3.3);
$loader = $this->app['twig']->getLoader();
/*
* Twig_ExistsLoaderInterface is getting merged into
* Twig_LoaderInterface in Twig 2.0. Check for this
* instead once we are there, and remove getSourc... | [
"public",
"function",
"hasTemplate",
"(",
"$",
"template",
")",
"{",
"Deprecated",
"::",
"method",
"(",
"3.3",
")",
";",
"$",
"loader",
"=",
"$",
"this",
"->",
"app",
"[",
"'twig'",
"]",
"->",
"getLoader",
"(",
")",
";",
"/*\n * Twig_ExistsLoaderIn... | @deprecated Since 3.3, will be removed in 4.0.
Check if the template exists.
@param string $template the name of the template
@return bool | [
"@deprecated",
"Since",
"3",
".",
"3",
"will",
"be",
"removed",
"in",
"4",
".",
"0",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Render.php#L95-L117 |
bolt/bolt | src/Render.php | Render.fetchCachedRequest | public function fetchCachedRequest()
{
Deprecated::method(3.3);
$response = false;
if ($this->checkCacheConditions('request', true)) {
$key = md5($this->app['request']->getPathInfo() . $this->app['request']->getQueryString());
$result = $this->app['cache']->fetch($k... | php | public function fetchCachedRequest()
{
Deprecated::method(3.3);
$response = false;
if ($this->checkCacheConditions('request', true)) {
$key = md5($this->app['request']->getPathInfo() . $this->app['request']->getQueryString());
$result = $this->app['cache']->fetch($k... | [
"public",
"function",
"fetchCachedRequest",
"(",
")",
"{",
"Deprecated",
"::",
"method",
"(",
"3.3",
")",
";",
"$",
"response",
"=",
"false",
";",
"if",
"(",
"$",
"this",
"->",
"checkCacheConditions",
"(",
"'request'",
",",
"true",
")",
")",
"{",
"$",
... | Retrieve a fully cached page from cache.
@deprecated Deprecated since 3.1, to be removed in 4.0. @see \Silex\HttpCache
@return \Symfony\Component\HttpFoundation\Response|bool | [
"Retrieve",
"a",
"fully",
"cached",
"page",
"from",
"cache",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Render.php#L126-L154 |
bolt/bolt | src/Render.php | Render.cacheRequest | public function cacheRequest(Response $response)
{
Deprecated::method(3.3);
if ($this->checkCacheConditions('request')) {
$html = $response->getContent();
// This is where the magic happens.. We also store it with an empty
// 'template' name, so we can later fet... | php | public function cacheRequest(Response $response)
{
Deprecated::method(3.3);
if ($this->checkCacheConditions('request')) {
$html = $response->getContent();
// This is where the magic happens.. We also store it with an empty
// 'template' name, so we can later fet... | [
"public",
"function",
"cacheRequest",
"(",
"Response",
"$",
"response",
")",
"{",
"Deprecated",
"::",
"method",
"(",
"3.3",
")",
";",
"if",
"(",
"$",
"this",
"->",
"checkCacheConditions",
"(",
"'request'",
")",
")",
"{",
"$",
"html",
"=",
"$",
"response"... | Store a fully rendered (and post-processed) page to cache.
@deprecated Deprecated since 3.1, to be removed in 4.0. @see \Silex\HttpCache
@param Response $response | [
"Store",
"a",
"fully",
"rendered",
"(",
"and",
"post",
"-",
"processed",
")",
"page",
"to",
"cache",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Render.php#L163-L175 |
bolt/bolt | src/Render.php | Render.checkCacheConditions | public function checkCacheConditions($type = 'template', $checkoverride = false)
{
Deprecated::method(3.3);
// Do not cache in "safe" mode: we don't want to accidentally bleed
// sensitive data from a previous unsafe run.
if ($this->safe) {
return false;
}
... | php | public function checkCacheConditions($type = 'template', $checkoverride = false)
{
Deprecated::method(3.3);
// Do not cache in "safe" mode: we don't want to accidentally bleed
// sensitive data from a previous unsafe run.
if ($this->safe) {
return false;
}
... | [
"public",
"function",
"checkCacheConditions",
"(",
"$",
"type",
"=",
"'template'",
",",
"$",
"checkoverride",
"=",
"false",
")",
"{",
"Deprecated",
"::",
"method",
"(",
"3.3",
")",
";",
"// Do not cache in \"safe\" mode: we don't want to accidentally bleed",
"// sensiti... | Check if the current conditions are suitable for caching.
@deprecated Deprecated since 3.1, to be removed in 4.0. @see \Silex\HttpCache
@param string $type
@param bool $checkoverride
@return bool | [
"Check",
"if",
"the",
"current",
"conditions",
"are",
"suitable",
"for",
"caching",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Render.php#L205-L239 |
bolt/bolt | src/Asset/File/Queue.php | Queue.add | public function add(FileAssetInterface $asset)
{
if (!$asset->getPackageName()) {
// Deprecated.
$asset->setPackageName('extensions');
}
$key = $asset->getPackageName()."/".$asset->getPath();
if ($asset->getType() === 'javascript') {
$this->javas... | php | public function add(FileAssetInterface $asset)
{
if (!$asset->getPackageName()) {
// Deprecated.
$asset->setPackageName('extensions');
}
$key = $asset->getPackageName()."/".$asset->getPath();
if ($asset->getType() === 'javascript') {
$this->javas... | [
"public",
"function",
"add",
"(",
"FileAssetInterface",
"$",
"asset",
")",
"{",
"if",
"(",
"!",
"$",
"asset",
"->",
"getPackageName",
"(",
")",
")",
"{",
"// Deprecated.",
"$",
"asset",
"->",
"setPackageName",
"(",
"'extensions'",
")",
";",
"}",
"$",
"ke... | Add a file asset to the queue.
@param FileAssetInterface $asset
@throws \InvalidArgumentException | [
"Add",
"a",
"file",
"asset",
"to",
"the",
"queue",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Asset/File/Queue.php#L58-L74 |
bolt/bolt | src/Asset/File/Queue.php | Queue.process | public function process(Request $request, Response $response)
{
// Conditionally add jQuery
$this->addJquery($request, $response);
/** @var FileAssetInterface $asset */
foreach ($this->sort($this->javascript) as $key => $asset) {
$this->processAsset($asset, $request, $re... | php | public function process(Request $request, Response $response)
{
// Conditionally add jQuery
$this->addJquery($request, $response);
/** @var FileAssetInterface $asset */
foreach ($this->sort($this->javascript) as $key => $asset) {
$this->processAsset($asset, $request, $re... | [
"public",
"function",
"process",
"(",
"Request",
"$",
"request",
",",
"Response",
"$",
"response",
")",
"{",
"// Conditionally add jQuery",
"$",
"this",
"->",
"addJquery",
"(",
"$",
"request",
",",
"$",
"response",
")",
";",
"/** @var FileAssetInterface $asset */"... | {@inheritdoc}
Uses sorting by priority. | [
"{",
"@inheritdoc",
"}"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Asset/File/Queue.php#L81-L97 |
bolt/bolt | src/Asset/File/Queue.php | Queue.processAsset | protected function processAsset(FileAssetInterface $asset, Request $request, Response $response)
{
$url = $this->packages->getUrl($asset->getPath(), $asset->getPackageName());
$asset->setUrl($url);
if ($asset->getZone() !== Zone::get($request)) {
return;
}
if ($... | php | protected function processAsset(FileAssetInterface $asset, Request $request, Response $response)
{
$url = $this->packages->getUrl($asset->getPath(), $asset->getPackageName());
$asset->setUrl($url);
if ($asset->getZone() !== Zone::get($request)) {
return;
}
if ($... | [
"protected",
"function",
"processAsset",
"(",
"FileAssetInterface",
"$",
"asset",
",",
"Request",
"$",
"request",
",",
"Response",
"$",
"response",
")",
"{",
"$",
"url",
"=",
"$",
"this",
"->",
"packages",
"->",
"getUrl",
"(",
"$",
"asset",
"->",
"getPath"... | Process a single asset.
@param FileAssetInterface $asset
@param Request $request
@param Response $response | [
"Process",
"a",
"single",
"asset",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Asset/File/Queue.php#L126-L148 |
bolt/bolt | src/Asset/File/Queue.php | Queue.addJquery | protected function addJquery(Request $request, Response $response)
{
if (!$this->config->get('general/add_jquery', false) &&
!$this->config->get('theme/add_jquery', false)) {
return;
}
// Check zone to skip expensive regex
if (Zone::isFrontend($request) === f... | php | protected function addJquery(Request $request, Response $response)
{
if (!$this->config->get('general/add_jquery', false) &&
!$this->config->get('theme/add_jquery', false)) {
return;
}
// Check zone to skip expensive regex
if (Zone::isFrontend($request) === f... | [
"protected",
"function",
"addJquery",
"(",
"Request",
"$",
"request",
",",
"Response",
"$",
"response",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"config",
"->",
"get",
"(",
"'general/add_jquery'",
",",
"false",
")",
"&&",
"!",
"$",
"this",
"->",
"c... | Insert jQuery, if it's not inserted already.
Some of the patterns that 'match' are:
- jquery.js
- jquery.min.js
- jquery-latest.js
- jquery-latest.min.js
- jquery-1.8.2.min.js
- jquery-1.5.js
@param Request $request
@param Response $response | [
"Insert",
"jQuery",
"if",
"it",
"s",
"not",
"inserted",
"already",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Asset/File/Queue.php#L164-L186 |
bolt/bolt | src/Form/Validator/Constraints/ExistingEntityValidator.php | ExistingEntityValidator.validate | public function validate($value, Constraint $constraint)
{
if ($this->hasEntity($value, $constraint)) {
$this->addViolation($value, $constraint);
}
} | php | public function validate($value, Constraint $constraint)
{
if ($this->hasEntity($value, $constraint)) {
$this->addViolation($value, $constraint);
}
} | [
"public",
"function",
"validate",
"(",
"$",
"value",
",",
"Constraint",
"$",
"constraint",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasEntity",
"(",
"$",
"value",
",",
"$",
"constraint",
")",
")",
"{",
"$",
"this",
"->",
"addViolation",
"(",
"$",
"va... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Form/Validator/Constraints/ExistingEntityValidator.php#L33-L38 |
bolt/bolt | src/Form/Validator/Constraints/ExistingEntityValidator.php | ExistingEntityValidator.hasEntity | protected function hasEntity($value, Constraint $constraint)
{
$repo = $this->em->getRepository($constraint->className);
/** @var Entity $formEntity */
$formEntity = $this->context->getRoot()->getData();
$query = $repo->createQueryBuilder()
->setParameter('value', $value)... | php | protected function hasEntity($value, Constraint $constraint)
{
$repo = $this->em->getRepository($constraint->className);
/** @var Entity $formEntity */
$formEntity = $this->context->getRoot()->getData();
$query = $repo->createQueryBuilder()
->setParameter('value', $value)... | [
"protected",
"function",
"hasEntity",
"(",
"$",
"value",
",",
"Constraint",
"$",
"constraint",
")",
"{",
"$",
"repo",
"=",
"$",
"this",
"->",
"em",
"->",
"getRepository",
"(",
"$",
"constraint",
"->",
"className",
")",
";",
"/** @var Entity $formEntity */",
... | Check if the validating entity has a record with a matching field value.
@param mixed $value
@param Constraint $constraint
@return bool | [
"Check",
"if",
"the",
"validating",
"entity",
"has",
"a",
"record",
"with",
"a",
"matching",
"field",
"value",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Form/Validator/Constraints/ExistingEntityValidator.php#L48-L69 |
bolt/bolt | src/Form/Validator/Constraints/ExistingEntityValidator.php | ExistingEntityValidator.addViolation | protected function addViolation($value, Constraint $constraint)
{
$this->context->buildViolation($constraint->message)
->setParameter('%type%', $constraint->className)
->setParameter('%fields%', implode(', ', (array) $constraint->fieldNames))
->setParameter('%value%', $va... | php | protected function addViolation($value, Constraint $constraint)
{
$this->context->buildViolation($constraint->message)
->setParameter('%type%', $constraint->className)
->setParameter('%fields%', implode(', ', (array) $constraint->fieldNames))
->setParameter('%value%', $va... | [
"protected",
"function",
"addViolation",
"(",
"$",
"value",
",",
"Constraint",
"$",
"constraint",
")",
"{",
"$",
"this",
"->",
"context",
"->",
"buildViolation",
"(",
"$",
"constraint",
"->",
"message",
")",
"->",
"setParameter",
"(",
"'%type%'",
",",
"$",
... | Add violation.
@param mixed $value
@param Constraint $constraint | [
"Add",
"violation",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Form/Validator/Constraints/ExistingEntityValidator.php#L77-L85 |
bolt/bolt | src/Composer/Action/InstallPackage.php | InstallPackage.execute | public function execute()
{
/** @var $composer \Composer\Composer */
$composer = $this->getComposer();
$io = $this->getIO();
$config = $composer->getConfig();
$optimize = $this->getOptions()->optimizeAutoloader() || $config->get('optimize-autoloader');
$authoritative... | php | public function execute()
{
/** @var $composer \Composer\Composer */
$composer = $this->getComposer();
$io = $this->getIO();
$config = $composer->getConfig();
$optimize = $this->getOptions()->optimizeAutoloader() || $config->get('optimize-autoloader');
$authoritative... | [
"public",
"function",
"execute",
"(",
")",
"{",
"/** @var $composer \\Composer\\Composer */",
"$",
"composer",
"=",
"$",
"this",
"->",
"getComposer",
"(",
")",
";",
"$",
"io",
"=",
"$",
"this",
"->",
"getIO",
"(",
")",
";",
"$",
"config",
"=",
"$",
"comp... | Install packages.
@throws \Bolt\Exception\PackageManagerException
@return int 0 on success or a positive error code on failure | [
"Install",
"packages",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/Action/InstallPackage.php#L22-L52 |
bolt/bolt | src/Controller/Requirement.php | Requirement.singleTaxonomy | public function singleTaxonomy($taxonomyName, $emptyValue = 'none')
{
$taxonomyValues = $this->config->get('taxonomy/' . $taxonomyName . '/options');
// If by accident, someone uses a "tags" taxonomy.
if (empty($taxonomyValues)) {
return '[a-z0-9-_]+';
}
$taxonom... | php | public function singleTaxonomy($taxonomyName, $emptyValue = 'none')
{
$taxonomyValues = $this->config->get('taxonomy/' . $taxonomyName . '/options');
// If by accident, someone uses a "tags" taxonomy.
if (empty($taxonomyValues)) {
return '[a-z0-9-_]+';
}
$taxonom... | [
"public",
"function",
"singleTaxonomy",
"(",
"$",
"taxonomyName",
",",
"$",
"emptyValue",
"=",
"'none'",
")",
"{",
"$",
"taxonomyValues",
"=",
"$",
"this",
"->",
"config",
"->",
"get",
"(",
"'taxonomy/'",
".",
"$",
"taxonomyName",
".",
"'/options'",
")",
"... | Return slugs of existing taxonomy values.
@param string $taxonomyName
@param string $emptyValue
@return string | [
"Return",
"slugs",
"of",
"existing",
"taxonomy",
"values",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Requirement.php#L75-L91 |
bolt/bolt | src/Controller/Requirement.php | Requirement.configAssert | protected function configAssert($key, $singular)
{
$types = $this->config->get($key);
// No types, nothing to assert. The route _DOES_ expect a string, so
// we return a regex that never matches.
if (empty($types)) {
return '$.';
}
$slugs = [];
fo... | php | protected function configAssert($key, $singular)
{
$types = $this->config->get($key);
// No types, nothing to assert. The route _DOES_ expect a string, so
// we return a regex that never matches.
if (empty($types)) {
return '$.';
}
$slugs = [];
fo... | [
"protected",
"function",
"configAssert",
"(",
"$",
"key",
",",
"$",
"singular",
")",
"{",
"$",
"types",
"=",
"$",
"this",
"->",
"config",
"->",
"get",
"(",
"$",
"key",
")",
";",
"// No types, nothing to assert. The route _DOES_ expect a string, so",
"// we return ... | Gets slugs from config imploded for regex.
@param string $key contenttypes or taxonomy
@param bool $singular Include singular slugs
@return string | [
"Gets",
"slugs",
"from",
"config",
"imploded",
"for",
"regex",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Requirement.php#L101-L119 |
bolt/bolt | src/Menu/Resolver/RecentlyEdited.php | RecentlyEdited.getRecords | private function getRecords($contentTypeKey, $limit)
{
$repo = $this->em->getRepository($contentTypeKey);
$qb = $repo
->createQueryBuilder()
->setMaxResults($limit)
->orderBy('datechanged', 'DESC')
;
return $repo->findWith($qb);
} | php | private function getRecords($contentTypeKey, $limit)
{
$repo = $this->em->getRepository($contentTypeKey);
$qb = $repo
->createQueryBuilder()
->setMaxResults($limit)
->orderBy('datechanged', 'DESC')
;
return $repo->findWith($qb);
} | [
"private",
"function",
"getRecords",
"(",
"$",
"contentTypeKey",
",",
"$",
"limit",
")",
"{",
"$",
"repo",
"=",
"$",
"this",
"->",
"em",
"->",
"getRepository",
"(",
"$",
"contentTypeKey",
")",
";",
"$",
"qb",
"=",
"$",
"repo",
"->",
"createQueryBuilder",... | Fetch recently changed records for a given ContentType.
@param string $contentTypeKey
@param int $limit
@return Entity\Content[] | [
"Fetch",
"recently",
"changed",
"records",
"for",
"a",
"given",
"ContentType",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Menu/Resolver/RecentlyEdited.php#L164-L174 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.