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/Asset/Widget/Widget.php
Widget.setKey
public function setKey() { if ($this->key === null) { $this->key = md5(Json::dump(get_object_vars($this))); } return $this; }
php
public function setKey() { if ($this->key === null) { $this->key = md5(Json::dump(get_object_vars($this))); } return $this; }
[ "public", "function", "setKey", "(", ")", "{", "if", "(", "$", "this", "->", "key", "===", "null", ")", "{", "$", "this", "->", "key", "=", "md5", "(", "Json", "::", "dump", "(", "get_object_vars", "(", "$", "this", ")", ")", ")", ";", "}", "re...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Asset/Widget/Widget.php#L85-L92
bolt/bolt
src/Asset/Widget/Widget.php
Widget.setClass
public function setClass($class) { if (is_array($class)) { foreach ($class as $classitem) { $this->setClass($classitem); } return $this; } if (substr($class, 0, 7) != 'widget-') { $class = 'widget-' . $class; } ...
php
public function setClass($class) { if (is_array($class)) { foreach ($class as $classitem) { $this->setClass($classitem); } return $this; } if (substr($class, 0, 7) != 'widget-') { $class = 'widget-' . $class; } ...
[ "public", "function", "setClass", "(", "$", "class", ")", "{", "if", "(", "is_array", "(", "$", "class", ")", ")", "{", "foreach", "(", "$", "class", "as", "$", "classitem", ")", "{", "$", "this", "->", "setClass", "(", "$", "classitem", ")", ";", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Asset/Widget/Widget.php#L195-L212
bolt/bolt
src/Asset/Widget/Widget.php
Widget.toString
protected function toString() { if ($this->rendered !== null) { return $this->rendered; } if (is_callable($this->callback)) { try { return $this->rendered = $this->invokeCallable($this->callback, $this->callbackArguments); } catch (\Except...
php
protected function toString() { if ($this->rendered !== null) { return $this->rendered; } if (is_callable($this->callback)) { try { return $this->rendered = $this->invokeCallable($this->callback, $this->callbackArguments); } catch (\Except...
[ "protected", "function", "toString", "(", ")", "{", "if", "(", "$", "this", "->", "rendered", "!==", "null", ")", "{", "return", "$", "this", "->", "rendered", ";", "}", "if", "(", "is_callable", "(", "$", "this", "->", "callback", ")", ")", "{", "...
Either return the passed in 'content' or the result of the callback. @return string
[ "Either", "return", "the", "passed", "in", "content", "or", "the", "result", "of", "the", "callback", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Asset/Widget/Widget.php#L317-L332
bolt/bolt
src/Twig/Extension/TextExtension.php
TextExtension.getFilters
public function getFilters() { $safe = ['is_safe' => ['html']]; $deprecated = ['deprecated' => true]; return [ // @codingStandardsIgnoreStart new TwigFilter('json_decode', [Runtime\TextRuntime::class, 'jsonDecode']), new TwigFilter('localdate', [R...
php
public function getFilters() { $safe = ['is_safe' => ['html']]; $deprecated = ['deprecated' => true]; return [ // @codingStandardsIgnoreStart new TwigFilter('json_decode', [Runtime\TextRuntime::class, 'jsonDecode']), new TwigFilter('localdate', [R...
[ "public", "function", "getFilters", "(", ")", "{", "$", "safe", "=", "[", "'is_safe'", "=>", "[", "'html'", "]", "]", ";", "$", "deprecated", "=", "[", "'deprecated'", "=>", "true", "]", ";", "return", "[", "// @codingStandardsIgnoreStart", "new", "TwigFil...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/Extension/TextExtension.php#L30-L45
bolt/bolt
src/Nut/DatabaseImport.php
DatabaseImport.execute
protected function execute(InputInterface $input, OutputInterface $output) { // Get file & directory paths list($fileNames, $dirPath) = $this->getResolvedPaths($input); $filesystem = new Filesystem(new Local($dirPath)); $this->io->warning('This command may overwrite or replace data ...
php
protected function execute(InputInterface $input, OutputInterface $output) { // Get file & directory paths list($fileNames, $dirPath) = $this->getResolvedPaths($input); $filesystem = new Filesystem(new Local($dirPath)); $this->io->warning('This command may overwrite or replace data ...
[ "protected", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "// Get file & directory paths", "list", "(", "$", "fileNames", ",", "$", "dirPath", ")", "=", "$", "this", "->", "getResolvedPaths", "(", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/DatabaseImport.php#L43-L110
bolt/bolt
src/Nut/DatabaseImport.php
DatabaseImport.getResolvedPaths
private function getResolvedPaths(InputInterface $input) { $fileName = $input->getOption('file'); $dirPath = $input->getOption('directory'); if ($fileName === null && $dirPath === null) { throw new RuntimeException('Either the --file or --directory option is required.'); ...
php
private function getResolvedPaths(InputInterface $input) { $fileName = $input->getOption('file'); $dirPath = $input->getOption('directory'); if ($fileName === null && $dirPath === null) { throw new RuntimeException('Either the --file or --directory option is required.'); ...
[ "private", "function", "getResolvedPaths", "(", "InputInterface", "$", "input", ")", "{", "$", "fileName", "=", "$", "input", "->", "getOption", "(", "'file'", ")", ";", "$", "dirPath", "=", "$", "input", "->", "getOption", "(", "'directory'", ")", ";", ...
@param InputInterface $input @throws RuntimeException @return array
[ "@param", "InputInterface", "$input" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/DatabaseImport.php#L119-L156
bolt/bolt
src/Nut/DatabaseOptimize.php
DatabaseOptimize.execute
protected function execute(InputInterface $input, OutputInterface $output) { $this->assertMaintenanceMode(); /** @var ContainerHelper $helper */ $helper = $this->getHelper('container'); $app = $helper->getContainer(); /** @var Connection $db */ $db = $app['db']; ...
php
protected function execute(InputInterface $input, OutputInterface $output) { $this->assertMaintenanceMode(); /** @var ContainerHelper $helper */ $helper = $this->getHelper('container'); $app = $helper->getContainer(); /** @var Connection $db */ $db = $app['db']; ...
[ "protected", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "$", "this", "->", "assertMaintenanceMode", "(", ")", ";", "/** @var ContainerHelper $helper */", "$", "helper", "=", "$", "this", "->", "ge...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/DatabaseOptimize.php#L32-L78
bolt/bolt
src/Nut/DatabaseOptimize.php
DatabaseOptimize.getPlatformUpdates
private function getPlatformUpdates() { /** @var ContainerHelper $helper */ $helper = $this->getHelper('container'); $app = $helper->getContainer(); $platform = $app['db']->getDatabasePlatform(); $platformName = $platform->getName(); $schemaTables = $app['schema']->ge...
php
private function getPlatformUpdates() { /** @var ContainerHelper $helper */ $helper = $this->getHelper('container'); $app = $helper->getContainer(); $platform = $app['db']->getDatabasePlatform(); $platformName = $platform->getName(); $schemaTables = $app['schema']->ge...
[ "private", "function", "getPlatformUpdates", "(", ")", "{", "/** @var ContainerHelper $helper */", "$", "helper", "=", "$", "this", "->", "getHelper", "(", "'container'", ")", ";", "$", "app", "=", "$", "helper", "->", "getContainer", "(", ")", ";", "$", "pl...
@throws RuntimeException @return MutableBag
[ "@throws", "RuntimeException" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/DatabaseOptimize.php#L85-L121
bolt/bolt
src/Nut/DatabaseOptimize.php
DatabaseOptimize.assertMaintenanceMode
private function assertMaintenanceMode() { /** @var ContainerHelper $helper */ $helper = $this->getHelper('container'); $app = $helper->getContainer(); /** @var \Bolt\Config $config */ $config = $app['config']; if ($config->get('general/maintenance_mode') !== true) { ...
php
private function assertMaintenanceMode() { /** @var ContainerHelper $helper */ $helper = $this->getHelper('container'); $app = $helper->getContainer(); /** @var \Bolt\Config $config */ $config = $app['config']; if ($config->get('general/maintenance_mode') !== true) { ...
[ "private", "function", "assertMaintenanceMode", "(", ")", "{", "/** @var ContainerHelper $helper */", "$", "helper", "=", "$", "this", "->", "getHelper", "(", "'container'", ")", ";", "$", "app", "=", "$", "helper", "->", "getContainer", "(", ")", ";", "/** @v...
Ensure the site is in maintenance mode. @throws RuntimeException
[ "Ensure", "the", "site", "is", "in", "maintenance", "mode", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/DatabaseOptimize.php#L128-L138
bolt/bolt
src/Storage/Field/Type/RelationType.php
RelationType.load
public function load(QueryBuilder $query, ClassMetadata $metadata) { $field = $this->mapping['fieldname']; $target = $this->mapping['target']; $boltname = $metadata->getBoltName(); $from = $query->getQueryPart('from'); if (isset($from[0]['alias'])) { $alias = $f...
php
public function load(QueryBuilder $query, ClassMetadata $metadata) { $field = $this->mapping['fieldname']; $target = $this->mapping['target']; $boltname = $metadata->getBoltName(); $from = $query->getQueryPart('from'); if (isset($from[0]['alias'])) { $alias = $f...
[ "public", "function", "load", "(", "QueryBuilder", "$", "query", ",", "ClassMetadata", "$", "metadata", ")", "{", "$", "field", "=", "$", "this", "->", "mapping", "[", "'fieldname'", "]", ";", "$", "target", "=", "$", "this", "->", "mapping", "[", "'ta...
For relations, the load method adds an extra ->addSelect() and ->leftJoin() to the query that fetches the related records from the join table in the same query as the content fetch. IDs are returned comma-separated which the ->hydrate() method can then turn into pointers to the related entities. @param QueryBuilder ...
[ "For", "relations", "the", "load", "method", "adds", "an", "extra", "-", ">", "addSelect", "()", "and", "-", ">", "leftJoin", "()", "to", "the", "query", "that", "fetches", "the", "related", "records", "from", "the", "join", "table", "in", "the", "same",...
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Field/Type/RelationType.php#L65-L88
bolt/bolt
src/Storage/Field/Type/RelationType.php
RelationType.hydrate
public function hydrate($data, $entity) { $field = $this->mapping['fieldname']; $data = $this->normalizeData($data, $field); /** @var Entity\Content $entity */ if (!count($entity->getRelation())) { $entity->setRelation($this->em->createCollection(Entity\Relations::class))...
php
public function hydrate($data, $entity) { $field = $this->mapping['fieldname']; $data = $this->normalizeData($data, $field); /** @var Entity\Content $entity */ if (!count($entity->getRelation())) { $entity->setRelation($this->em->createCollection(Entity\Relations::class))...
[ "public", "function", "hydrate", "(", "$", "data", ",", "$", "entity", ")", "{", "$", "field", "=", "$", "this", "->", "mapping", "[", "'fieldname'", "]", ";", "$", "data", "=", "$", "this", "->", "normalizeData", "(", "$", "data", ",", "$", "field...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Field/Type/RelationType.php#L93-L117
bolt/bolt
src/Storage/Field/Type/RelationType.php
RelationType.persist
public function persist(QuerySet $queries, $entity) { $this->normalize($entity); $field = $this->mapping['fieldname']; $relations = $entity->getRelation() ->getField($field); // Fetch existing relations and create two sets of records, updates and deletes. $existi...
php
public function persist(QuerySet $queries, $entity) { $this->normalize($entity); $field = $this->mapping['fieldname']; $relations = $entity->getRelation() ->getField($field); // Fetch existing relations and create two sets of records, updates and deletes. $existi...
[ "public", "function", "persist", "(", "QuerySet", "$", "queries", ",", "$", "entity", ")", "{", "$", "this", "->", "normalize", "(", "$", "entity", ")", ";", "$", "field", "=", "$", "this", "->", "mapping", "[", "'fieldname'", "]", ";", "$", "relatio...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Field/Type/RelationType.php#L122-L160
bolt/bolt
src/Storage/Field/Type/RelationType.php
RelationType.getPlatformGroupConcat
protected function getPlatformGroupConcat($column, $alias, QueryBuilder $query) { $platform = $query->getConnection()->getDatabasePlatform()->getName(); switch ($platform) { case 'mysql': return "GROUP_CONCAT($column) as $alias"; case 'sqlite': ...
php
protected function getPlatformGroupConcat($column, $alias, QueryBuilder $query) { $platform = $query->getConnection()->getDatabasePlatform()->getName(); switch ($platform) { case 'mysql': return "GROUP_CONCAT($column) as $alias"; case 'sqlite': ...
[ "protected", "function", "getPlatformGroupConcat", "(", "$", "column", ",", "$", "alias", ",", "QueryBuilder", "$", "query", ")", "{", "$", "platform", "=", "$", "query", "->", "getConnection", "(", ")", "->", "getDatabasePlatform", "(", ")", "->", "getName"...
Get platform specific group_concat token for provided column. @param string $column @param string $alias @param QueryBuilder $query @throws StorageException @return string
[ "Get", "platform", "specific", "group_concat", "token", "for", "provided", "column", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Field/Type/RelationType.php#L231-L244
bolt/bolt
src/Storage/Field/Type/RelationType.php
RelationType.normalize
public function normalize($entity) { /** @var Collection\Relations $collection */ $collection = $this->normalizeFromPost($entity, Entity\Relations::class); if ($collection) { $entity->setRelation($collection); } }
php
public function normalize($entity) { /** @var Collection\Relations $collection */ $collection = $this->normalizeFromPost($entity, Entity\Relations::class); if ($collection) { $entity->setRelation($collection); } }
[ "public", "function", "normalize", "(", "$", "entity", ")", "{", "/** @var Collection\\Relations $collection */", "$", "collection", "=", "$", "this", "->", "normalizeFromPost", "(", "$", "entity", ",", "Entity", "\\", "Relations", "::", "class", ")", ";", "if",...
The normalize method takes care of any pre-persist cleaning up. For relations that allows us to support non standard data formats such as arrays that allow this style data setting to work... `$entity->setPages(['1', '2']);` or `$entity->setRelation(['pages'=>['1', '2']]);` @param Entity\Content $entity
[ "The", "normalize", "method", "takes", "care", "of", "any", "pre", "-", "persist", "cleaning", "up", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Field/Type/RelationType.php#L260-L267
bolt/bolt
src/Twig/SafeEnvironment.php
SafeEnvironment.render
public function render($name, array $context = []) { Deprecated::method(3.3, 'Use Twig_Environment::render with sandbox enabled.'); $weSandboxed = false; if (!$this->sandbox->isSandboxed()) { $weSandboxed = true; $this->sandbox->enableSandbox(); } tr...
php
public function render($name, array $context = []) { Deprecated::method(3.3, 'Use Twig_Environment::render with sandbox enabled.'); $weSandboxed = false; if (!$this->sandbox->isSandboxed()) { $weSandboxed = true; $this->sandbox->enableSandbox(); } tr...
[ "public", "function", "render", "(", "$", "name", ",", "array", "$", "context", "=", "[", "]", ")", "{", "Deprecated", "::", "method", "(", "3.3", ",", "'Use Twig_Environment::render with sandbox enabled.'", ")", ";", "$", "weSandboxed", "=", "false", ";", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/SafeEnvironment.php#L40-L59
bolt/bolt
src/Twig/SafeEnvironment.php
SafeEnvironment.addExtension
public function addExtension(ExtensionInterface $extension) { Deprecated::method(3.3, 'Use Twig_Environment::addExtension instead and add to sandbox security policy directly.'); $policy = $this->sandbox->getSecurityPolicy(); if (!$policy instanceof SecurityPolicy) { return; ...
php
public function addExtension(ExtensionInterface $extension) { Deprecated::method(3.3, 'Use Twig_Environment::addExtension instead and add to sandbox security policy directly.'); $policy = $this->sandbox->getSecurityPolicy(); if (!$policy instanceof SecurityPolicy) { return; ...
[ "public", "function", "addExtension", "(", "ExtensionInterface", "$", "extension", ")", "{", "Deprecated", "::", "method", "(", "3.3", ",", "'Use Twig_Environment::addExtension instead and add to sandbox security policy directly.'", ")", ";", "$", "policy", "=", "$", "thi...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/SafeEnvironment.php#L86-L107
bolt/bolt
src/Twig/Runtime/RecordRuntime.php
RecordRuntime.current
public function current($content) { /** @var Request $request */ $request = $this->requestStack->getCurrentRequest(); $requestUri = $request->getRequestUri(); $routeParams = $request->get('_route_params'); // If passed a string, and it is in the route. if (is_string(...
php
public function current($content) { /** @var Request $request */ $request = $this->requestStack->getCurrentRequest(); $requestUri = $request->getRequestUri(); $routeParams = $request->get('_route_params'); // If passed a string, and it is in the route. if (is_string(...
[ "public", "function", "current", "(", "$", "content", ")", "{", "/** @var Request $request */", "$", "request", "=", "$", "this", "->", "requestStack", "->", "getCurrentRequest", "(", ")", ";", "$", "requestUri", "=", "$", "request", "->", "getRequestUri", "("...
Returns true, if the given content is the current content. If we're on page/foo, and content is that page, you can use {% is page|current %}class='active'{% endif %} @param \Bolt\Legacy\Content|array $content @return bool true if the given content is on the curent page
[ "Returns", "true", "if", "the", "given", "content", "is", "the", "current", "content", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/Runtime/RecordRuntime.php#L78-L125
bolt/bolt
src/Twig/Runtime/RecordRuntime.php
RecordRuntime.excerpt
public function excerpt($content, $length = 200, $focus = null, $stripFields = null) { $excerpter = new Excerpt($content); return $excerpter->getExcerpt($length, false, $focus, $stripFields); }
php
public function excerpt($content, $length = 200, $focus = null, $stripFields = null) { $excerpter = new Excerpt($content); return $excerpter->getExcerpt($length, false, $focus, $stripFields); }
[ "public", "function", "excerpt", "(", "$", "content", ",", "$", "length", "=", "200", ",", "$", "focus", "=", "null", ",", "$", "stripFields", "=", "null", ")", "{", "$", "excerpter", "=", "new", "Excerpt", "(", "$", "content", ")", ";", "return", ...
Create an excerpt for the given content. @param \Bolt\Legacy\Content|array|string $content @param int $length Defaults to 200 characters @param array|string|null $focus @param array|null $stripFields @return string Resulting excerpt
[ "Create", "an", "excerpt", "for", "the", "given", "content", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/Runtime/RecordRuntime.php#L137-L142
bolt/bolt
src/Twig/Runtime/RecordRuntime.php
RecordRuntime.getFirstImage
public function getFirstImage($content) { Deprecated::method('3.4'); $contentType = $content->getContenttype(); if (!$contentType instanceof ContentType) { return null; } $fields = $contentType->getFields(); if (!is_array($fields)) { return nu...
php
public function getFirstImage($content) { Deprecated::method('3.4'); $contentType = $content->getContenttype(); if (!$contentType instanceof ContentType) { return null; } $fields = $contentType->getFields(); if (!is_array($fields)) { return nu...
[ "public", "function", "getFirstImage", "(", "$", "content", ")", "{", "Deprecated", "::", "method", "(", "'3.4'", ")", ";", "$", "contentType", "=", "$", "content", "->", "getContenttype", "(", ")", ";", "if", "(", "!", "$", "contentType", "instanceof", ...
Gets the first image from the given content record. This method is deprecated. In Bolt 3.5 it'll be replaced / removed to fall in line with the work done for #6985 @param \Bolt\Storage\Entity\Content $content @return array|null image
[ "Gets", "the", "first", "image", "from", "the", "given", "content", "record", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/Runtime/RecordRuntime.php#L154-L176
bolt/bolt
src/Twig/Runtime/RecordRuntime.php
RecordRuntime.fields
public function fields( Environment $env, $record = null, $common = true, $extended = false, $repeaters = true, $templateFields = true, $template = '_sub_fields.twig', $exclude = null, $skip_uses = true ) { Deprecated::method('3.3'); ...
php
public function fields( Environment $env, $record = null, $common = true, $extended = false, $repeaters = true, $templateFields = true, $template = '_sub_fields.twig', $exclude = null, $skip_uses = true ) { Deprecated::method('3.3'); ...
[ "public", "function", "fields", "(", "Environment", "$", "env", ",", "$", "record", "=", "null", ",", "$", "common", "=", "true", ",", "$", "extended", "=", "false", ",", "$", "repeaters", "=", "true", ",", "$", "templateFields", "=", "true", ",", "$...
Output all (relevant) fields to the browser. Convenient for dumping the content in order in, say, a `record.twig` template, without having to iterate over them in the browser. @param Environment $env @param \Bolt\Legacy\Content $record @param bool $common @param bool $extended ...
[ "Output", "all", "(", "relevant", ")", "fields", "to", "the", "browser", ".", "Convenient", "for", "dumping", "the", "content", "in", "order", "in", "say", "a", "record", ".", "twig", "template", "without", "having", "to", "iterate", "over", "them", "in", ...
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/Runtime/RecordRuntime.php#L195-L235
bolt/bolt
src/Twig/Runtime/RecordRuntime.php
RecordRuntime.listTemplates
public function listTemplates($filter = null) { $files = []; $name = $filter ? Glob::toRegex($filter, false, false) : '/^[a-zA-Z0-9]\V+\.twig$/'; /** @var Finder|FileInterface[] $finder */ $finder = $this->templatesDir->find() ->files() ->notName('/^_/') ...
php
public function listTemplates($filter = null) { $files = []; $name = $filter ? Glob::toRegex($filter, false, false) : '/^[a-zA-Z0-9]\V+\.twig$/'; /** @var Finder|FileInterface[] $finder */ $finder = $this->templatesDir->find() ->files() ->notName('/^_/') ...
[ "public", "function", "listTemplates", "(", "$", "filter", "=", "null", ")", "{", "$", "files", "=", "[", "]", ";", "$", "name", "=", "$", "filter", "?", "Glob", "::", "toRegex", "(", "$", "filter", ",", "false", ",", "false", ")", ":", "'/^[a-zA-Z...
Lists templates, optionally filtered by $filter. @param string $filter @return array Sorted and possibly filtered templates
[ "Lists", "templates", "optionally", "filtered", "by", "$filter", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/Runtime/RecordRuntime.php#L244-L273
bolt/bolt
src/Twig/Runtime/RecordRuntime.php
RecordRuntime.next
public function next($entity, $field = 'datepublish', $where = []) { if ($field[0] === '-') { $operator = '<'; $field = substr($field, 1); $order = '-' . $field; } elseif ($field[0] === '+') { $operator = '>'; $field = substr($field, 1); ...
php
public function next($entity, $field = 'datepublish', $where = []) { if ($field[0] === '-') { $operator = '<'; $field = substr($field, 1); $order = '-' . $field; } elseif ($field[0] === '+') { $operator = '>'; $field = substr($field, 1); ...
[ "public", "function", "next", "(", "$", "entity", ",", "$", "field", "=", "'datepublish'", ",", "$", "where", "=", "[", "]", ")", "{", "if", "(", "$", "field", "[", "0", "]", "===", "'-'", ")", "{", "$", "operator", "=", "'<'", ";", "$", "field...
@param Entity\Content $entity @param string $field @param array $where @return Entity\Content|null
[ "@param", "Entity", "\\", "Content", "$entity", "@param", "string", "$field", "@param", "array", "$where" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/Runtime/RecordRuntime.php#L282-L305
bolt/bolt
src/Twig/Runtime/RecordRuntime.php
RecordRuntime.pager
public function pager(Environment $env, $pagerName = '', $surr = 4, $template = '_sub_pager.twig', $class = '') { if ($this->pagerManager->isEmptyPager()) { // nothing to page. return ''; } $thisPager = $this->pagerManager->getPager($pagerName); $context = [...
php
public function pager(Environment $env, $pagerName = '', $surr = 4, $template = '_sub_pager.twig', $class = '') { if ($this->pagerManager->isEmptyPager()) { // nothing to page. return ''; } $thisPager = $this->pagerManager->getPager($pagerName); $context = [...
[ "public", "function", "pager", "(", "Environment", "$", "env", ",", "$", "pagerName", "=", "''", ",", "$", "surr", "=", "4", ",", "$", "template", "=", "'_sub_pager.twig'", ",", "$", "class", "=", "''", ")", "{", "if", "(", "$", "this", "->", "page...
Output a simple pager, for paginated listing pages. @param Environment $env @param string $pagerName @param int $surr @param string $template The template to apply @param string $class @return string The rendered pager HTML
[ "Output", "a", "simple", "pager", "for", "paginated", "listing", "pages", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/Runtime/RecordRuntime.php#L350-L372
bolt/bolt
src/Twig/Runtime/RecordRuntime.php
RecordRuntime.selectField
public function selectField($content, $fieldName, $startempty = false, $keyName = 'id', $contentType = null) { $retval = $startempty ? [] : ['' => '']; if (empty($content)) { return $retval; } foreach ($content as $c) { if (is_string($contentType) && $conten...
php
public function selectField($content, $fieldName, $startempty = false, $keyName = 'id', $contentType = null) { $retval = $startempty ? [] : ['' => '']; if (empty($content)) { return $retval; } foreach ($content as $c) { if (is_string($contentType) && $conten...
[ "public", "function", "selectField", "(", "$", "content", ",", "$", "fieldName", ",", "$", "startempty", "=", "false", ",", "$", "keyName", "=", "'id'", ",", "$", "contentType", "=", "null", ")", "{", "$", "retval", "=", "$", "startempty", "?", "[", ...
Return a selected field from a contentset. @param array $content A Bolt record array @param array|string $fieldName Name of a field, or array of field names to return from each record @param bool $startempty Whether or not the array should start with an empty element @param string $keyName ...
[ "Return", "a", "selected", "field", "from", "a", "contentset", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/Runtime/RecordRuntime.php#L385-L422
bolt/bolt
src/Twig/Runtime/RecordRuntime.php
RecordRuntime.taxonomy
public function taxonomy($candidate) { // If this is a legacy content object then we set the candidate to the taxonomy array if ($candidate instanceof Legacy\Content) { $candidate = $candidate->taxonomy; } // If it's a content entity then fetch the taxonomy field ...
php
public function taxonomy($candidate) { // If this is a legacy content object then we set the candidate to the taxonomy array if ($candidate instanceof Legacy\Content) { $candidate = $candidate->taxonomy; } // If it's a content entity then fetch the taxonomy field ...
[ "public", "function", "taxonomy", "(", "$", "candidate", ")", "{", "// If this is a legacy content object then we set the candidate to the taxonomy array", "if", "(", "$", "candidate", "instanceof", "Legacy", "\\", "Content", ")", "{", "$", "candidate", "=", "$", "candi...
@param array|Taxonomy|Entity\Content|Legacy\Content $candidate @return array
[ "@param", "array|Taxonomy|Entity", "\\", "Content|Legacy", "\\", "Content", "$candidate" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/Runtime/RecordRuntime.php#L429-L461
bolt/bolt
src/Storage/Field/Type/SlugType.php
SlugType.persist
public function persist(QuerySet $queries, $entity) { if ($entity->getSlug() === null) { // When no slug value is given, generate a pseudo-random reasonably unique one. $entity->setSlug('slug-' . md5(mt_rand())); } parent::persist($queries, $entity); }
php
public function persist(QuerySet $queries, $entity) { if ($entity->getSlug() === null) { // When no slug value is given, generate a pseudo-random reasonably unique one. $entity->setSlug('slug-' . md5(mt_rand())); } parent::persist($queries, $entity); }
[ "public", "function", "persist", "(", "QuerySet", "$", "queries", ",", "$", "entity", ")", "{", "if", "(", "$", "entity", "->", "getSlug", "(", ")", "===", "null", ")", "{", "// When no slug value is given, generate a pseudo-random reasonably unique one.", "$", "e...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Field/Type/SlugType.php#L27-L34
bolt/bolt
src/Profiler/DebugToolbarEnabler.php
DebugToolbarEnabler.onRequest
public function onRequest(GetResponseEvent $event) { if (!$event->isMasterRequest()) { return; } if (!$session = $event->getRequest()->getSession()) { return; } if ($this->debugLoggedOff || ($session->isStarted() && $session->has('authentication'))) ...
php
public function onRequest(GetResponseEvent $event) { if (!$event->isMasterRequest()) { return; } if (!$session = $event->getRequest()->getSession()) { return; } if ($this->debugLoggedOff || ($session->isStarted() && $session->has('authentication'))) ...
[ "public", "function", "onRequest", "(", "GetResponseEvent", "$", "event", ")", "{", "if", "(", "!", "$", "event", "->", "isMasterRequest", "(", ")", ")", "{", "return", ";", "}", "if", "(", "!", "$", "session", "=", "$", "event", "->", "getRequest", ...
Enable toolbar if logged in or debug mode is enabled. @param GetResponseEvent $event
[ "Enable", "toolbar", "if", "logged", "in", "or", "debug", "mode", "is", "enabled", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Profiler/DebugToolbarEnabler.php#L32-L45
bolt/bolt
src/Profiler/DebugToolbarEnabler.php
DebugToolbarEnabler.boot
public function boot(Application $app) { $this->listener = $app['web_profiler.toolbar.listener']; $this->dispatcher = $app['dispatcher']; $this->dispatcher->addSubscriber($this); $this->debugLoggedOff = $app['config']->get('general/debug_show_loggedoff', false); }
php
public function boot(Application $app) { $this->listener = $app['web_profiler.toolbar.listener']; $this->dispatcher = $app['dispatcher']; $this->dispatcher->addSubscriber($this); $this->debugLoggedOff = $app['config']->get('general/debug_show_loggedoff', false); }
[ "public", "function", "boot", "(", "Application", "$", "app", ")", "{", "$", "this", "->", "listener", "=", "$", "app", "[", "'web_profiler.toolbar.listener'", "]", ";", "$", "this", "->", "dispatcher", "=", "$", "app", "[", "'dispatcher'", "]", ";", "$"...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Profiler/DebugToolbarEnabler.php#L57-L63
bolt/bolt
src/Controller/Async/FilesystemManager.php
FilesystemManager.browse
public function browse(Request $request, $namespace, $path) { $directory = $this->filesystem()->getDir("$namespace://$path"); $listing = new Listing($directory); $showHidden = $this->isAllowed('files:hidden'); try { $directories = $listing->getDirectories($showHidden); ...
php
public function browse(Request $request, $namespace, $path) { $directory = $this->filesystem()->getDir("$namespace://$path"); $listing = new Listing($directory); $showHidden = $this->isAllowed('files:hidden'); try { $directories = $listing->getDirectories($showHidden); ...
[ "public", "function", "browse", "(", "Request", "$", "request", ",", "$", "namespace", ",", "$", "path", ")", "{", "$", "directory", "=", "$", "this", "->", "filesystem", "(", ")", "->", "getDir", "(", "\"$namespace://$path\"", ")", ";", "$", "listing", ...
List browse on the server, so we can insert them in the file input. @param Request $request @param string $namespace @param string $path @return \Bolt\Response\TemplateResponse
[ "List", "browse", "on", "the", "server", "so", "we", "can", "insert", "them", "in", "the", "file", "input", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Async/FilesystemManager.php#L69-L92
bolt/bolt
src/Controller/Async/FilesystemManager.php
FilesystemManager.createFolder
public function createFolder(Request $request) { $namespace = $request->request->get('namespace'); $parentPath = $request->request->get('parent'); $folderName = $request->request->get('foldername'); try { $dir = $this->filesystem()->getDir("$namespace://$parentPath/$fold...
php
public function createFolder(Request $request) { $namespace = $request->request->get('namespace'); $parentPath = $request->request->get('parent'); $folderName = $request->request->get('foldername'); try { $dir = $this->filesystem()->getDir("$namespace://$parentPath/$fold...
[ "public", "function", "createFolder", "(", "Request", "$", "request", ")", "{", "$", "namespace", "=", "$", "request", "->", "request", "->", "get", "(", "'namespace'", ")", ";", "$", "parentPath", "=", "$", "request", "->", "request", "->", "get", "(", ...
Create a new folder. @param Request $request @return \Symfony\Component\HttpFoundation\JsonResponse
[ "Create", "a", "new", "folder", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Async/FilesystemManager.php#L101-L118
bolt/bolt
src/Controller/Async/FilesystemManager.php
FilesystemManager.createFile
public function createFile(Request $request) { $namespace = $request->request->get('namespace'); $parentPath = $request->request->get('parentPath'); $filename = $request->request->get('filename'); if ($this->validateFileExtension($filename) === false) { return $this->jso...
php
public function createFile(Request $request) { $namespace = $request->request->get('namespace'); $parentPath = $request->request->get('parentPath'); $filename = $request->request->get('filename'); if ($this->validateFileExtension($filename) === false) { return $this->jso...
[ "public", "function", "createFile", "(", "Request", "$", "request", ")", "{", "$", "namespace", "=", "$", "request", "->", "request", "->", "get", "(", "'namespace'", ")", ";", "$", "parentPath", "=", "$", "request", "->", "request", "->", "get", "(", ...
Create an empty file. @param Request $request @return \Symfony\Component\HttpFoundation\JsonResponse
[ "Create", "an", "empty", "file", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Async/FilesystemManager.php#L127-L151
bolt/bolt
src/Controller/Async/FilesystemManager.php
FilesystemManager.deleteFile
public function deleteFile(Request $request) { $namespace = $request->request->get('namespace'); $filename = $request->request->get('filename'); try { $this->filesystem()->delete("$namespace://$filename"); return $this->json($filename, Response::HTTP_OK); } ...
php
public function deleteFile(Request $request) { $namespace = $request->request->get('namespace'); $filename = $request->request->get('filename'); try { $this->filesystem()->delete("$namespace://$filename"); return $this->json($filename, Response::HTTP_OK); } ...
[ "public", "function", "deleteFile", "(", "Request", "$", "request", ")", "{", "$", "namespace", "=", "$", "request", "->", "request", "->", "get", "(", "'namespace'", ")", ";", "$", "filename", "=", "$", "request", "->", "request", "->", "get", "(", "'...
Delete a file on the server. @param Request $request @return \Symfony\Component\HttpFoundation\JsonResponse
[ "Delete", "a", "file", "on", "the", "server", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Async/FilesystemManager.php#L160-L178
bolt/bolt
src/Controller/Async/FilesystemManager.php
FilesystemManager.duplicateFile
public function duplicateFile(Request $request) { $namespace = $request->request->get('namespace'); $filename = $request->request->get('filename'); $filesystem = $this->filesystem()->getFilesystem($namespace); // If the filename doesn't have an extension $extensionPos will be equal...
php
public function duplicateFile(Request $request) { $namespace = $request->request->get('namespace'); $filename = $request->request->get('filename'); $filesystem = $this->filesystem()->getFilesystem($namespace); // If the filename doesn't have an extension $extensionPos will be equal...
[ "public", "function", "duplicateFile", "(", "Request", "$", "request", ")", "{", "$", "namespace", "=", "$", "request", "->", "request", "->", "get", "(", "'namespace'", ")", ";", "$", "filename", "=", "$", "request", "->", "request", "->", "get", "(", ...
Duplicate a file on the server. @param Request $request @return \Symfony\Component\HttpFoundation\JsonResponse
[ "Duplicate", "a", "file", "on", "the", "server", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Async/FilesystemManager.php#L187-L220
bolt/bolt
src/Controller/Async/FilesystemManager.php
FilesystemManager.filesAutoComplete
public function filesAutoComplete(Request $request) { $term = $request->query->get('term', '.*'); $dir = Path::getDirectory($term); $term = Path::getFilename($term); $term = preg_quote($term); $extensions = implode('|', explode(',', $request->query->get('ext', '.*'))); ...
php
public function filesAutoComplete(Request $request) { $term = $request->query->get('term', '.*'); $dir = Path::getDirectory($term); $term = Path::getFilename($term); $term = preg_quote($term); $extensions = implode('|', explode(',', $request->query->get('ext', '.*'))); ...
[ "public", "function", "filesAutoComplete", "(", "Request", "$", "request", ")", "{", "$", "term", "=", "$", "request", "->", "query", "->", "get", "(", "'term'", ",", "'.*'", ")", ";", "$", "dir", "=", "Path", "::", "getDirectory", "(", "$", "term", ...
Return autocomplete data for a file name. @param Request $request @return \Symfony\Component\HttpFoundation\JsonResponse
[ "Return", "autocomplete", "data", "for", "a", "file", "name", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Async/FilesystemManager.php#L229-L252
bolt/bolt
src/Controller/Async/FilesystemManager.php
FilesystemManager.recordBrowser
public function recordBrowser() { $results = []; foreach ($this->app['config']->get('contenttypes') as $contenttype) { if ($contenttype['viewless']) { // Skip viewless ContentTypes continue; } $slug = $contenttype['slug']; ...
php
public function recordBrowser() { $results = []; foreach ($this->app['config']->get('contenttypes') as $contenttype) { if ($contenttype['viewless']) { // Skip viewless ContentTypes continue; } $slug = $contenttype['slug']; ...
[ "public", "function", "recordBrowser", "(", ")", "{", "$", "results", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "app", "[", "'config'", "]", "->", "get", "(", "'contenttypes'", ")", "as", "$", "contenttype", ")", "{", "if", "(", "$", "...
List records to easily insert links through the WYSIWYG editor. @return \Bolt\Response\TemplateResponse
[ "List", "records", "to", "easily", "insert", "links", "through", "the", "WYSIWYG", "editor", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Async/FilesystemManager.php#L259-L283
bolt/bolt
src/Controller/Async/FilesystemManager.php
FilesystemManager.removeFolder
public function removeFolder(Request $request) { $namespace = $request->request->get('namespace'); $parent = $request->request->get('parent'); $folderName = $request->request->get('foldername'); try { $this->filesystem()->deleteDir("$namespace://$parent/$folderName"); ...
php
public function removeFolder(Request $request) { $namespace = $request->request->get('namespace'); $parent = $request->request->get('parent'); $folderName = $request->request->get('foldername'); try { $this->filesystem()->deleteDir("$namespace://$parent/$folderName"); ...
[ "public", "function", "removeFolder", "(", "Request", "$", "request", ")", "{", "$", "namespace", "=", "$", "request", "->", "request", "->", "get", "(", "'namespace'", ")", ";", "$", "parent", "=", "$", "request", "->", "request", "->", "get", "(", "'...
Delete a folder recursively if writeable. @param Request $request @return \Symfony\Component\HttpFoundation\JsonResponse
[ "Delete", "a", "folder", "recursively", "if", "writeable", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Async/FilesystemManager.php#L292-L309
bolt/bolt
src/Controller/Async/FilesystemManager.php
FilesystemManager.renameFile
public function renameFile(Request $request) { $namespace = $request->request->get('namespace'); $parent = $request->request->get('parent'); $oldName = $request->request->get('oldname'); $newName = $request->request->get('newname'); if (!$this->isExtensionChangedAndIsChangeA...
php
public function renameFile(Request $request) { $namespace = $request->request->get('namespace'); $parent = $request->request->get('parent'); $oldName = $request->request->get('oldname'); $newName = $request->request->get('newname'); if (!$this->isExtensionChangedAndIsChangeA...
[ "public", "function", "renameFile", "(", "Request", "$", "request", ")", "{", "$", "namespace", "=", "$", "request", "->", "request", "->", "get", "(", "'namespace'", ")", ";", "$", "parent", "=", "$", "request", "->", "request", "->", "get", "(", "'pa...
Rename a file within the files directory tree. @param Request $request @return \Symfony\Component\HttpFoundation\JsonResponse
[ "Rename", "a", "file", "within", "the", "files", "directory", "tree", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Async/FilesystemManager.php#L318-L354
bolt/bolt
src/Controller/Async/FilesystemManager.php
FilesystemManager.renameFolder
public function renameFolder(Request $request) { $namespace = $request->request->get('namespace'); $parent = $request->request->get('parent'); $oldName = $request->request->get('oldname'); $newName = $request->request->get('newname'); try { $dir = $this->filesyst...
php
public function renameFolder(Request $request) { $namespace = $request->request->get('namespace'); $parent = $request->request->get('parent'); $oldName = $request->request->get('oldname'); $newName = $request->request->get('newname'); try { $dir = $this->filesyst...
[ "public", "function", "renameFolder", "(", "Request", "$", "request", ")", "{", "$", "namespace", "=", "$", "request", "->", "request", "->", "get", "(", "'namespace'", ")", ";", "$", "parent", "=", "$", "request", "->", "request", "->", "get", "(", "'...
Rename a folder within the files directory tree. @param Request $request @return \Symfony\Component\HttpFoundation\JsonResponse
[ "Rename", "a", "folder", "within", "the", "files", "directory", "tree", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Async/FilesystemManager.php#L363-L395
bolt/bolt
src/Controller/Async/FilesystemManager.php
FilesystemManager.isExtensionChangedAndIsChangeAllowed
private function isExtensionChangedAndIsChangeAllowed($oldName, $newName) { $user = $this->getUser(); if ($this->users()->hasRole($user['id'], 'root') || $this->users()->hasRole($user['id'], 'admin')) { return true; } $oldFile = new \SplFileInfo($oldName); $newFi...
php
private function isExtensionChangedAndIsChangeAllowed($oldName, $newName) { $user = $this->getUser(); if ($this->users()->hasRole($user['id'], 'root') || $this->users()->hasRole($user['id'], 'admin')) { return true; } $oldFile = new \SplFileInfo($oldName); $newFi...
[ "private", "function", "isExtensionChangedAndIsChangeAllowed", "(", "$", "oldName", ",", "$", "newName", ")", "{", "$", "user", "=", "$", "this", "->", "getUser", "(", ")", ";", "if", "(", "$", "this", "->", "users", "(", ")", "->", "hasRole", "(", "$"...
Check that file extensions are not being changed. @param string $oldName @param string $newName @return bool
[ "Check", "that", "file", "extensions", "are", "not", "being", "changed", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Async/FilesystemManager.php#L405-L416
bolt/bolt
src/Controller/Async/FilesystemManager.php
FilesystemManager.logException
private function logException($message, $exception) { return $this->app['logger.system']->error( $message . ': ' . $exception->getMessage(), ['event' => 'exception', 'exception' => $exception] ); }
php
private function logException($message, $exception) { return $this->app['logger.system']->error( $message . ': ' . $exception->getMessage(), ['event' => 'exception', 'exception' => $exception] ); }
[ "private", "function", "logException", "(", "$", "message", ",", "$", "exception", ")", "{", "return", "$", "this", "->", "app", "[", "'logger.system'", "]", "->", "error", "(", "$", "message", ".", "': '", ".", "$", "exception", "->", "getMessage", "(",...
Log an exception to the system log. @param string $message A formatted error message @param \Exception $exception The exception that has been thrown @return bool Whether the record has been processed
[ "Log", "an", "exception", "to", "the", "system", "log", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Async/FilesystemManager.php#L426-L432
bolt/bolt
src/Controller/Async/FilesystemManager.php
FilesystemManager.validateFileExtension
private function validateFileExtension($filename) { // no UNIX-hidden files if ($filename[0] === '.') { return false; } // only whitelisted extensions $extension = pathinfo($filename, PATHINFO_EXTENSION); $allowedExtensions = $this->getAllowedUploadExtensi...
php
private function validateFileExtension($filename) { // no UNIX-hidden files if ($filename[0] === '.') { return false; } // only whitelisted extensions $extension = pathinfo($filename, PATHINFO_EXTENSION); $allowedExtensions = $this->getAllowedUploadExtensi...
[ "private", "function", "validateFileExtension", "(", "$", "filename", ")", "{", "// no UNIX-hidden files", "if", "(", "$", "filename", "[", "0", "]", "===", "'.'", ")", "{", "return", "false", ";", "}", "// only whitelisted extensions", "$", "extension", "=", ...
@param string $filename @return bool
[ "@param", "string", "$filename" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Async/FilesystemManager.php#L439-L450
bolt/bolt
src/Form/FormType/FileEditType.php
FileEditType.buildForm
public function buildForm(FormBuilderInterface $builder, array $options) { $builder ->add( 'contents', TextareaType::class, [ 'constraints' => $options['contents_constraints'], ] ) ->add( ...
php
public function buildForm(FormBuilderInterface $builder, array $options) { $builder ->add( 'contents', TextareaType::class, [ 'constraints' => $options['contents_constraints'], ] ) ->add( ...
[ "public", "function", "buildForm", "(", "FormBuilderInterface", "$", "builder", ",", "array", "$", "options", ")", "{", "$", "builder", "->", "add", "(", "'contents'", ",", "TextareaType", "::", "class", ",", "[", "'constraints'", "=>", "$", "options", "[", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Form/FormType/FileEditType.php#L24-L51
bolt/bolt
src/Form/FormType/FileEditType.php
FileEditType.configureOptions
public function configureOptions(OptionsResolver $resolver) { $resolver->setRequired('write_allowed') ->setDefined('contents_allow_empty') ->setAllowedValues('contents_allow_empty', [true, false]) ->setDefault('contents_allow_empty', true) ; $resolver->set...
php
public function configureOptions(OptionsResolver $resolver) { $resolver->setRequired('write_allowed') ->setDefined('contents_allow_empty') ->setAllowedValues('contents_allow_empty', [true, false]) ->setDefault('contents_allow_empty', true) ; $resolver->set...
[ "public", "function", "configureOptions", "(", "OptionsResolver", "$", "resolver", ")", "{", "$", "resolver", "->", "setRequired", "(", "'write_allowed'", ")", "->", "setDefined", "(", "'contents_allow_empty'", ")", "->", "setAllowedValues", "(", "'contents_allow_empt...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Form/FormType/FileEditType.php#L56-L73
bolt/bolt
src/Storage/Query/SearchConfig.php
SearchConfig.getConfig
public function getConfig($contentType) { if (array_key_exists($contentType, $this->searchableTypes)) { return $this->searchableTypes[$contentType]; } if ($this->canSearchInvisible() && array_key_exists($contentType, $this->invisibleTypes)) { return $this->invisibleT...
php
public function getConfig($contentType) { if (array_key_exists($contentType, $this->searchableTypes)) { return $this->searchableTypes[$contentType]; } if ($this->canSearchInvisible() && array_key_exists($contentType, $this->invisibleTypes)) { return $this->invisibleT...
[ "public", "function", "getConfig", "(", "$", "contentType", ")", "{", "if", "(", "array_key_exists", "(", "$", "contentType", ",", "$", "this", "->", "searchableTypes", ")", ")", "{", "return", "$", "this", "->", "searchableTypes", "[", "$", "contentType", ...
Get the config of all fields for a given content type. @param string $contentType @return array|false
[ "Get", "the", "config", "of", "all", "fields", "for", "a", "given", "content", "type", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Query/SearchConfig.php#L42-L53
bolt/bolt
src/Storage/Query/SearchConfig.php
SearchConfig.getFieldConfig
public function getFieldConfig($contentType, $field) { if (isset($this->searchableTypes[$contentType][$field])) { return $this->searchableTypes[$contentType][$field]; } if ($this->canSearchInvisible() && isset($this->invisibleTypes[$contentType][$field])) { return $t...
php
public function getFieldConfig($contentType, $field) { if (isset($this->searchableTypes[$contentType][$field])) { return $this->searchableTypes[$contentType][$field]; } if ($this->canSearchInvisible() && isset($this->invisibleTypes[$contentType][$field])) { return $t...
[ "public", "function", "getFieldConfig", "(", "$", "contentType", ",", "$", "field", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "searchableTypes", "[", "$", "contentType", "]", "[", "$", "field", "]", ")", ")", "{", "return", "$", "this", "...
Get the config of one given field for a given content type. @param string $contentType @param string $field @return array|false
[ "Get", "the", "config", "of", "one", "given", "field", "for", "a", "given", "content", "type", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Query/SearchConfig.php#L64-L75
bolt/bolt
src/Storage/Query/SearchConfig.php
SearchConfig.parseContenttypes
protected function parseContenttypes() { $contentTypes = $this->config->get('contenttypes'); foreach ($contentTypes as $type => $values) { $this->getSearchableColumns($type); if (isset($values['taxonomy'])) { $this->parseTaxonomies($type, $values['taxonomy'])...
php
protected function parseContenttypes() { $contentTypes = $this->config->get('contenttypes'); foreach ($contentTypes as $type => $values) { $this->getSearchableColumns($type); if (isset($values['taxonomy'])) { $this->parseTaxonomies($type, $values['taxonomy'])...
[ "protected", "function", "parseContenttypes", "(", ")", "{", "$", "contentTypes", "=", "$", "this", "->", "config", "->", "get", "(", "'contenttypes'", ")", ";", "foreach", "(", "$", "contentTypes", "as", "$", "type", "=>", "$", "values", ")", "{", "$", ...
Iterates over the main config and delegates weighting to both searchable columns and searchable taxonomies.
[ "Iterates", "over", "the", "main", "config", "and", "delegates", "weighting", "to", "both", "searchable", "columns", "and", "searchable", "taxonomies", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Query/SearchConfig.php#L81-L91
bolt/bolt
src/Storage/Query/SearchConfig.php
SearchConfig.parseTaxonomies
protected function parseTaxonomies($contentType, $taxonomies) { foreach ((array) $taxonomies as $taxonomy) { $taxonomyConfig = $this->config->get('taxonomy/' . $taxonomy); if (isset($taxonomyConfig['searchweight'])) { $weight = $taxonomyConfig['searchweight']; ...
php
protected function parseTaxonomies($contentType, $taxonomies) { foreach ((array) $taxonomies as $taxonomy) { $taxonomyConfig = $this->config->get('taxonomy/' . $taxonomy); if (isset($taxonomyConfig['searchweight'])) { $weight = $taxonomyConfig['searchweight']; ...
[ "protected", "function", "parseTaxonomies", "(", "$", "contentType", ",", "$", "taxonomies", ")", "{", "foreach", "(", "(", "array", ")", "$", "taxonomies", "as", "$", "taxonomy", ")", "{", "$", "taxonomyConfig", "=", "$", "this", "->", "config", "->", "...
Iterates the taxonomies for a given ContentType, then assigns a weighting based on type. @param string $contentType @param array $taxonomies
[ "Iterates", "the", "taxonomies", "for", "a", "given", "ContentType", "then", "assigns", "a", "weighting", "based", "on", "type", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Query/SearchConfig.php#L100-L118
bolt/bolt
src/Storage/Query/SearchConfig.php
SearchConfig.getSearchableColumns
protected function getSearchableColumns($type) { $fields = $this->config->get('contenttypes/' . $type . '/fields'); foreach ($fields as $field => $options) { if (in_array($options['type'], ['text', 'textarea', 'html', 'markdown']) || (isset($options['searchable']) && $op...
php
protected function getSearchableColumns($type) { $fields = $this->config->get('contenttypes/' . $type . '/fields'); foreach ($fields as $field => $options) { if (in_array($options['type'], ['text', 'textarea', 'html', 'markdown']) || (isset($options['searchable']) && $op...
[ "protected", "function", "getSearchableColumns", "(", "$", "type", ")", "{", "$", "fields", "=", "$", "this", "->", "config", "->", "get", "(", "'contenttypes/'", ".", "$", "type", ".", "'/fields'", ")", ";", "foreach", "(", "$", "fields", "as", "$", "...
Determine what columns are searchable for a given ContentType. @param string $type
[ "Determine", "what", "columns", "are", "searchable", "for", "a", "given", "ContentType", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Query/SearchConfig.php#L138-L160
bolt/bolt
src/Storage/Query/SearchConfig.php
SearchConfig.isInvisible
protected function isInvisible($contentType) { $info = $this->config->get('contenttypes/' . $contentType); if ($info) { if (array_key_exists('viewless', $info) && $info['viewless'] === true) { return true; } if (array_key_exists('searchable', $info...
php
protected function isInvisible($contentType) { $info = $this->config->get('contenttypes/' . $contentType); if ($info) { if (array_key_exists('viewless', $info) && $info['viewless'] === true) { return true; } if (array_key_exists('searchable', $info...
[ "protected", "function", "isInvisible", "(", "$", "contentType", ")", "{", "$", "info", "=", "$", "this", "->", "config", "->", "get", "(", "'contenttypes/'", ".", "$", "contentType", ")", ";", "if", "(", "$", "info", ")", "{", "if", "(", "array_key_ex...
Does some checks to see whether a ContentType should appear in search results. This is based on ContentType options. @param string $contentType @return bool
[ "Does", "some", "checks", "to", "see", "whether", "a", "ContentType", "should", "appear", "in", "search", "results", ".", "This", "is", "based", "on", "ContentType", "options", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Query/SearchConfig.php#L170-L183
bolt/bolt
src/Nut/DebugRouter.php
DebugRouter.execute
protected function execute(InputInterface $input, OutputInterface $output) { $this->app->flush(); $name = $input->getArgument('name'); if ($name === null) { return $this->executeAll($input, $output); } $table = new Table($output); $table->setHeaders([ ...
php
protected function execute(InputInterface $input, OutputInterface $output) { $this->app->flush(); $name = $input->getArgument('name'); if ($name === null) { return $this->executeAll($input, $output); } $table = new Table($output); $table->setHeaders([ ...
[ "protected", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "$", "this", "->", "app", "->", "flush", "(", ")", ";", "$", "name", "=", "$", "input", "->", "getArgument", "(", "'name'", ")", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/DebugRouter.php#L39-L72
bolt/bolt
src/Nut/DebugRouter.php
DebugRouter.formatArrayAsYaml
protected function formatArrayAsYaml($array) { if (!(is_array($array) || !$array instanceof ArrayObject)) { return $array; } array_walk_recursive($array, function (&$item) { $item = is_object($item) ? get_class($item) : $item; }); $yaml = Yaml::dump($...
php
protected function formatArrayAsYaml($array) { if (!(is_array($array) || !$array instanceof ArrayObject)) { return $array; } array_walk_recursive($array, function (&$item) { $item = is_object($item) ? get_class($item) : $item; }); $yaml = Yaml::dump($...
[ "protected", "function", "formatArrayAsYaml", "(", "$", "array", ")", "{", "if", "(", "!", "(", "is_array", "(", "$", "array", ")", "||", "!", "$", "array", "instanceof", "ArrayObject", ")", ")", "{", "return", "$", "array", ";", "}", "array_walk_recursi...
@param mixed $array @return string
[ "@param", "mixed", "$array" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/DebugRouter.php#L79-L91
bolt/bolt
src/Nut/DebugRouter.php
DebugRouter.sortPattern
private function sortPattern(array $routes) { uasort($routes, function (Route $a, Route $b) { if ($a->getPath() === $b->getPath()) { return 0; } $a = str_replace('{', '', str_replace('}', '', $a->getPath())); $b = str_replace('{', '', str_repla...
php
private function sortPattern(array $routes) { uasort($routes, function (Route $a, Route $b) { if ($a->getPath() === $b->getPath()) { return 0; } $a = str_replace('{', '', str_replace('}', '', $a->getPath())); $b = str_replace('{', '', str_repla...
[ "private", "function", "sortPattern", "(", "array", "$", "routes", ")", "{", "uasort", "(", "$", "routes", ",", "function", "(", "Route", "$", "a", ",", "Route", "$", "b", ")", "{", "if", "(", "$", "a", "->", "getPath", "(", ")", "===", "$", "b",...
Sort routes by their URI pattern. @param Route[] $routes @return Route[]
[ "Sort", "routes", "by", "their", "URI", "pattern", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/DebugRouter.php#L151-L164
bolt/bolt
src/Nut/DebugRouter.php
DebugRouter.getMethods
private function getMethods(Route $route) { $methods = $route->getMethods(); sort($methods); return implode('|', $methods) ?: 'ANY'; }
php
private function getMethods(Route $route) { $methods = $route->getMethods(); sort($methods); return implode('|', $methods) ?: 'ANY'; }
[ "private", "function", "getMethods", "(", "Route", "$", "route", ")", "{", "$", "methods", "=", "$", "route", "->", "getMethods", "(", ")", ";", "sort", "(", "$", "methods", ")", ";", "return", "implode", "(", "'|'", ",", "$", "methods", ")", "?", ...
Get a route's HTTP methods as a sorted string. @param Route $route @return string
[ "Get", "a", "route", "s", "HTTP", "methods", "as", "a", "sorted", "string", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/DebugRouter.php#L173-L179
bolt/bolt
src/Nut/DebugRouter.php
DebugRouter.sortMethods
private function sortMethods(array $routes) { uasort($routes, function (Route $a, Route $b) { if ($a->getMethods() === $b->getMethods()) { return 0; } return ($a->getMethods() < $b->getMethods()) ? -1 : 1; }); return $routes; }
php
private function sortMethods(array $routes) { uasort($routes, function (Route $a, Route $b) { if ($a->getMethods() === $b->getMethods()) { return 0; } return ($a->getMethods() < $b->getMethods()) ? -1 : 1; }); return $routes; }
[ "private", "function", "sortMethods", "(", "array", "$", "routes", ")", "{", "uasort", "(", "$", "routes", ",", "function", "(", "Route", "$", "a", ",", "Route", "$", "b", ")", "{", "if", "(", "$", "a", "->", "getMethods", "(", ")", "===", "$", "...
Sort routes by their allowed HTTP method(s). @param Route[] $routes @return Route[]
[ "Sort", "routes", "by", "their", "allowed", "HTTP", "method", "(", "s", ")", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/DebugRouter.php#L188-L199
bolt/bolt
src/Nut/DatabaseRepair.php
DatabaseRepair.execute
protected function execute(InputInterface $input, OutputInterface $output) { if ($input->getOption('dump-sql')) { $this->dumpSql(); $this->io->note('Database SQL above was NOT applied to your database.'); return 0; } $response = $this->app['schema']->che...
php
protected function execute(InputInterface $input, OutputInterface $output) { if ($input->getOption('dump-sql')) { $this->dumpSql(); $this->io->note('Database SQL above was NOT applied to your database.'); return 0; } $response = $this->app['schema']->che...
[ "protected", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "if", "(", "$", "input", "->", "getOption", "(", "'dump-sql'", ")", ")", "{", "$", "this", "->", "dumpSql", "(", ")", ";", "$", "t...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/DatabaseRepair.php#L29-L55
bolt/bolt
src/Nut/DatabaseRepair.php
DatabaseRepair.dumpSql
private function dumpSql() { $this->app['schema']->check(); $context = [ 'alters' => $this->app['schema.comparator']->getAlters(), 'creates' => $this->app['schema.comparator']->getCreates(), ]; foreach ($context as $section) { foreach ($section ...
php
private function dumpSql() { $this->app['schema']->check(); $context = [ 'alters' => $this->app['schema.comparator']->getAlters(), 'creates' => $this->app['schema.comparator']->getCreates(), ]; foreach ($context as $section) { foreach ($section ...
[ "private", "function", "dumpSql", "(", ")", "{", "$", "this", "->", "app", "[", "'schema'", "]", "->", "check", "(", ")", ";", "$", "context", "=", "[", "'alters'", "=>", "$", "this", "->", "app", "[", "'schema.comparator'", "]", "->", "getAlters", "...
Dump the output.
[ "Dump", "the", "output", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/DatabaseRepair.php#L60-L74
bolt/bolt
src/EventListener/ProfilerListener.php
ProfilerListener.onKernelRequest
public function onKernelRequest(GetResponseEvent $event) { $request = $event->getRequest(); if (!$this->isProfilerRequest($request)) { return; } $token = $this->session->isStarted() ? $this->session->get('authentication') : null; if ($this->debug && ($token insta...
php
public function onKernelRequest(GetResponseEvent $event) { $request = $event->getRequest(); if (!$this->isProfilerRequest($request)) { return; } $token = $this->session->isStarted() ? $this->session->get('authentication') : null; if ($this->debug && ($token insta...
[ "public", "function", "onKernelRequest", "(", "GetResponseEvent", "$", "event", ")", "{", "$", "request", "=", "$", "event", "->", "getRequest", "(", ")", ";", "if", "(", "!", "$", "this", "->", "isProfilerRequest", "(", "$", "request", ")", ")", "{", ...
Request listener to prevent access to profiler routes when debugging is not enabled, or the user is logged off & debugging is not configured to show when logged off. @param GetResponseEvent $event
[ "Request", "listener", "to", "prevent", "access", "to", "profiler", "routes", "when", "debugging", "is", "not", "enabled", "or", "the", "user", "is", "logged", "off", "&", "debugging", "is", "not", "configured", "to", "show", "when", "logged", "off", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/EventListener/ProfilerListener.php#L50-L63
bolt/bolt
src/Composer/Package/Dependency.php
Dependency.create
public static function create($name, $type, array $result) { list($package, $link, $children) = $result; return new self($name, $type, $package, $link, $children); }
php
public static function create($name, $type, array $result) { list($package, $link, $children) = $result; return new self($name, $type, $package, $link, $children); }
[ "public", "static", "function", "create", "(", "$", "name", ",", "$", "type", ",", "array", "$", "result", ")", "{", "list", "(", "$", "package", ",", "$", "link", ",", "$", "children", ")", "=", "$", "result", ";", "return", "new", "self", "(", ...
@param string $name @param string $type @param array $result @return Dependency
[ "@param", "string", "$name", "@param", "string", "$type", "@param", "array", "$result" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/Package/Dependency.php#L82-L87
bolt/bolt
src/Composer/Package/Dependency.php
Dependency.setChildren
public function setChildren($children) { if (is_array($children)) { $c = []; foreach ($children as $name => $child) { list($package, $link, $children) = $child; $c[] = new self($name, $this->type, $package, $link, $children); } ...
php
public function setChildren($children) { if (is_array($children)) { $c = []; foreach ($children as $name => $child) { list($package, $link, $children) = $child; $c[] = new self($name, $this->type, $package, $link, $children); } ...
[ "public", "function", "setChildren", "(", "$", "children", ")", "{", "if", "(", "is_array", "(", "$", "children", ")", ")", "{", "$", "c", "=", "[", "]", ";", "foreach", "(", "$", "children", "as", "$", "name", "=>", "$", "child", ")", "{", "list...
@param Dependency[]|false $children @return Dependency
[ "@param", "Dependency", "[]", "|false", "$children" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/Package/Dependency.php#L182-L195
bolt/bolt
src/Provider/SessionServiceProvider.php
SessionServiceProvider.register
public function register(Application $app) { if (!isset($app['session'])) { $app->register(new Bridge\Silex1\SessionServiceProvider()); } $app['session.options'] = function () use ($app) { $config = $app['config']; return $config->get('general/session', ...
php
public function register(Application $app) { if (!isset($app['session'])) { $app->register(new Bridge\Silex1\SessionServiceProvider()); } $app['session.options'] = function () use ($app) { $config = $app['config']; return $config->get('general/session', ...
[ "public", "function", "register", "(", "Application", "$", "app", ")", "{", "if", "(", "!", "isset", "(", "$", "app", "[", "'session'", "]", ")", ")", "{", "$", "app", "->", "register", "(", "new", "Bridge", "\\", "Silex1", "\\", "SessionServiceProvide...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Provider/SessionServiceProvider.php#L19-L53
bolt/bolt
src/Nut/ExtensionsSetup.php
ExtensionsSetup.setupJson
private function setupJson() { $this->io->title('Creating/updating composer.json'); $this->app['extend.manager.json']->update(); $this->io->success('Success'); }
php
private function setupJson() { $this->io->title('Creating/updating composer.json'); $this->app['extend.manager.json']->update(); $this->io->success('Success'); }
[ "private", "function", "setupJson", "(", ")", "{", "$", "this", "->", "io", "->", "title", "(", "'Creating/updating composer.json'", ")", ";", "$", "this", "->", "app", "[", "'extend.manager.json'", "]", "->", "update", "(", ")", ";", "$", "this", "->", ...
Create or update the extensions/composer.json file.
[ "Create", "or", "update", "the", "extensions", "/", "composer", ".", "json", "file", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/ExtensionsSetup.php#L38-L43
bolt/bolt
src/Nut/ExtensionsSetup.php
ExtensionsSetup.setupAutoloader
private function setupAutoloader() { $this->io->title('Updating autoloaders'); $result = $this->app['extend.action']['autoload']->execute(); $this->outputResult($result); }
php
private function setupAutoloader() { $this->io->title('Updating autoloaders'); $result = $this->app['extend.action']['autoload']->execute(); $this->outputResult($result); }
[ "private", "function", "setupAutoloader", "(", ")", "{", "$", "this", "->", "io", "->", "title", "(", "'Updating autoloaders'", ")", ";", "$", "result", "=", "$", "this", "->", "app", "[", "'extend.action'", "]", "[", "'autoload'", "]", "->", "execute", ...
Set up the Composer autoloader. @throws \Bolt\Exception\PackageManagerException
[ "Set", "up", "the", "Composer", "autoloader", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/ExtensionsSetup.php#L50-L55
bolt/bolt
src/Nut/ExtensionsSetup.php
ExtensionsSetup.outputResult
private function outputResult($result) { $this->io->writeln(sprintf('<comment>%s</comment>', $this->app['extend.action.io']->getOutput()), OutputInterface::OUTPUT_PLAIN); if ($result === 0) { $this->io->success('Autoloaders updated'); $this->auditLog(__CLASS__, 'Autoloaders ...
php
private function outputResult($result) { $this->io->writeln(sprintf('<comment>%s</comment>', $this->app['extend.action.io']->getOutput()), OutputInterface::OUTPUT_PLAIN); if ($result === 0) { $this->io->success('Autoloaders updated'); $this->auditLog(__CLASS__, 'Autoloaders ...
[ "private", "function", "outputResult", "(", "$", "result", ")", "{", "$", "this", "->", "io", "->", "writeln", "(", "sprintf", "(", "'<comment>%s</comment>'", ",", "$", "this", "->", "app", "[", "'extend.action.io'", "]", "->", "getOutput", "(", ")", ")", ...
Output the relevant result. @param int $result @return int
[ "Output", "the", "relevant", "result", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/ExtensionsSetup.php#L64-L76
bolt/bolt
src/Twig/Runtime/UtilsRuntime.php
UtilsRuntime.printFirebug
public function printFirebug($var, $msg) { if (!$this->allowDebug()) { return; } if (is_string($msg)) { $this->firebugLogger->info($msg, (array) $var); } elseif (is_string($var)) { $this->firebugLogger->info($var, (array) $msg); } }
php
public function printFirebug($var, $msg) { if (!$this->allowDebug()) { return; } if (is_string($msg)) { $this->firebugLogger->info($msg, (array) $var); } elseif (is_string($var)) { $this->firebugLogger->info($var, (array) $msg); } }
[ "public", "function", "printFirebug", "(", "$", "var", ",", "$", "msg", ")", "{", "if", "(", "!", "$", "this", "->", "allowDebug", "(", ")", ")", "{", "return", ";", "}", "if", "(", "is_string", "(", "$", "msg", ")", ")", "{", "$", "this", "->"...
Send debug data to the developers FirePHP instance in-browser. @param mixed $var The data to be dumped into FirePHP @param mixed $msg The message to associate with the data
[ "Send", "debug", "data", "to", "the", "developers", "FirePHP", "instance", "in", "-", "browser", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/Runtime/UtilsRuntime.php#L57-L68
bolt/bolt
src/Logger/Handler/RecordChangeHandler.php
RecordChangeHandler.checkTransaction
protected function checkTransaction(array $context) { if (!in_array($context['action'], $this->allowed)) { throw new \UnexpectedValueException("Invalid action '{$context['action']}' specified for changelog (must be one of [ " . implode(', ', $this->allowed) . ' ])'); } if (empty(...
php
protected function checkTransaction(array $context) { if (!in_array($context['action'], $this->allowed)) { throw new \UnexpectedValueException("Invalid action '{$context['action']}' specified for changelog (must be one of [ " . implode(', ', $this->allowed) . ' ])'); } if (empty(...
[ "protected", "function", "checkTransaction", "(", "array", "$", "context", ")", "{", "if", "(", "!", "in_array", "(", "$", "context", "[", "'action'", "]", ",", "$", "this", "->", "allowed", ")", ")", "{", "throw", "new", "\\", "UnexpectedValueException", ...
Check that the requested log transaction is valid. @param array $context @throws \UnexpectedValueException
[ "Check", "that", "the", "requested", "log", "transaction", "is", "valid", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Logger/Handler/RecordChangeHandler.php#L122-L136
bolt/bolt
src/Logger/Handler/RecordChangeHandler.php
RecordChangeHandler.getData
protected function getData(array $context) { $data = []; switch ($context['action']) { case 'UPDATE': $diff = $this->diff($context['old'], $context['new']); foreach ($diff as $item) { list($k, $old, $new) = $item; if...
php
protected function getData(array $context) { $data = []; switch ($context['action']) { case 'UPDATE': $diff = $this->diff($context['old'], $context['new']); foreach ($diff as $item) { list($k, $old, $new) = $item; if...
[ "protected", "function", "getData", "(", "array", "$", "context", ")", "{", "$", "data", "=", "[", "]", ";", "switch", "(", "$", "context", "[", "'action'", "]", ")", "{", "case", "'UPDATE'", ":", "$", "diff", "=", "$", "this", "->", "diff", "(", ...
Get the context data. @param array $context @return array
[ "Get", "the", "context", "data", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Logger/Handler/RecordChangeHandler.php#L145-L171
bolt/bolt
src/Logger/Handler/RecordChangeHandler.php
RecordChangeHandler.getContentObject
protected function getContentObject(array $contenttype, array $values) { if (empty($contenttype['class'])) { return new Content($this->app, $contenttype, $values); } if (class_exists($contenttype['class'])) { $content = new $contenttype['class']($this->app, $contentt...
php
protected function getContentObject(array $contenttype, array $values) { if (empty($contenttype['class'])) { return new Content($this->app, $contenttype, $values); } if (class_exists($contenttype['class'])) { $content = new $contenttype['class']($this->app, $contentt...
[ "protected", "function", "getContentObject", "(", "array", "$", "contenttype", ",", "array", "$", "values", ")", "{", "if", "(", "empty", "(", "$", "contenttype", "[", "'class'", "]", ")", ")", "{", "return", "new", "Content", "(", "$", "this", "->", "...
Get the content object. @deprecated Deprecated since 3.3. To be removed in v4. @param array $contenttype @param array $values @throws StorageException @return Content
[ "Get", "the", "content", "object", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Logger/Handler/RecordChangeHandler.php#L185-L205
bolt/bolt
src/Logger/Handler/RecordChangeHandler.php
RecordChangeHandler.initialize
private function initialize() { $this->tablename = sprintf('%s%s', $this->app['config']->get('general/database/prefix', 'bolt_'), 'log_change'); $this->allowed = ['INSERT', 'UPDATE', 'DELETE']; $this->initialized = true; }
php
private function initialize() { $this->tablename = sprintf('%s%s', $this->app['config']->get('general/database/prefix', 'bolt_'), 'log_change'); $this->allowed = ['INSERT', 'UPDATE', 'DELETE']; $this->initialized = true; }
[ "private", "function", "initialize", "(", ")", "{", "$", "this", "->", "tablename", "=", "sprintf", "(", "'%s%s'", ",", "$", "this", "->", "app", "[", "'config'", "]", "->", "get", "(", "'general/database/prefix'", ",", "'bolt_'", ")", ",", "'log_change'",...
Initialize class parameters.
[ "Initialize", "class", "parameters", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Logger/Handler/RecordChangeHandler.php#L210-L215
bolt/bolt
src/Logger/Handler/RecordChangeHandler.php
RecordChangeHandler.diff
private function diff(array $a, array $b) { if (empty($a)) { $a = []; } if (empty($b)) { $b = []; } $keys = array_keys($a + $b); $result = []; foreach ($keys as $k) { if (empty($a[$k])) { $l = null; ...
php
private function diff(array $a, array $b) { if (empty($a)) { $a = []; } if (empty($b)) { $b = []; } $keys = array_keys($a + $b); $result = []; foreach ($keys as $k) { if (empty($a[$k])) { $l = null; ...
[ "private", "function", "diff", "(", "array", "$", "a", ",", "array", "$", "b", ")", "{", "if", "(", "empty", "(", "$", "a", ")", ")", "{", "$", "a", "=", "[", "]", ";", "}", "if", "(", "empty", "(", "$", "b", ")", ")", "{", "$", "b", "=...
@param array $a @param array $b @return array [key, left, right][]
[ "@param", "array", "$a", "@param", "array", "$b" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Logger/Handler/RecordChangeHandler.php#L223-L251
bolt/bolt
src/Storage/Entity/ContentTaxonomyTrait.php
ContentTaxonomyTrait.setGroup
public function setGroup($group, $name, $taxonomytype, $sortorder = 0) { $this->group = [ 'slug' => $group, 'name' => $name, ]; $hasSortOrder = $this->app['config']->get('taxonomy/' . $taxonomytype . '/has_sortorder'); // Only set the sortorder, if the conte...
php
public function setGroup($group, $name, $taxonomytype, $sortorder = 0) { $this->group = [ 'slug' => $group, 'name' => $name, ]; $hasSortOrder = $this->app['config']->get('taxonomy/' . $taxonomytype . '/has_sortorder'); // Only set the sortorder, if the conte...
[ "public", "function", "setGroup", "(", "$", "group", ",", "$", "name", ",", "$", "taxonomytype", ",", "$", "sortorder", "=", "0", ")", "{", "$", "this", "->", "group", "=", "[", "'slug'", "=>", "$", "group", ",", "'name'", "=>", "$", "name", ",", ...
Set the 'group', 'groupname' and 'sortorder' properties of the current object. @param string $group @param string $name @param string $taxonomytype @param int $sortorder
[ "Set", "the", "group", "groupname", "and", "sortorder", "properties", "of", "the", "current", "object", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Entity/ContentTaxonomyTrait.php#L40-L62
bolt/bolt
src/Storage/Entity/ContentTaxonomyTrait.php
ContentTaxonomyTrait.setTaxonomy
public function setTaxonomy($taxonomyType, $slug, $name = '', $sortorder = 0) { // If $value is an array, recurse over it, adding each one by itself. if (is_array($slug)) { foreach ($slug as $single) { $this->setTaxonomy($taxonomyType, $single, '', $sortorder); ...
php
public function setTaxonomy($taxonomyType, $slug, $name = '', $sortorder = 0) { // If $value is an array, recurse over it, adding each one by itself. if (is_array($slug)) { foreach ($slug as $single) { $this->setTaxonomy($taxonomyType, $single, '', $sortorder); ...
[ "public", "function", "setTaxonomy", "(", "$", "taxonomyType", ",", "$", "slug", ",", "$", "name", "=", "''", ",", "$", "sortorder", "=", "0", ")", "{", "// If $value is an array, recurse over it, adding each one by itself.", "if", "(", "is_array", "(", "$", "sl...
Set a taxonomy for the current object. @param string $taxonomyType @param string|array $slug @param string $name @param int $sortorder @return bool
[ "Set", "a", "taxonomy", "for", "the", "current", "object", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Entity/ContentTaxonomyTrait.php#L74-L128
bolt/bolt
src/Storage/Entity/ContentTaxonomyTrait.php
ContentTaxonomyTrait.sortTaxonomy
public function sortTaxonomy() { if (empty($this->taxonomy)) { // Nothing to do here. return; } foreach (array_keys($this->taxonomy) as $type) { $taxonomytype = $this->app['config']->get('taxonomy/' . $type); // Don't order tags. i...
php
public function sortTaxonomy() { if (empty($this->taxonomy)) { // Nothing to do here. return; } foreach (array_keys($this->taxonomy) as $type) { $taxonomytype = $this->app['config']->get('taxonomy/' . $type); // Don't order tags. i...
[ "public", "function", "sortTaxonomy", "(", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "taxonomy", ")", ")", "{", "// Nothing to do here.", "return", ";", "}", "foreach", "(", "array_keys", "(", "$", "this", "->", "taxonomy", ")", "as", "$", ...
Sort the taxonomy of the current object, based on the order given in taxonomy.yml.
[ "Sort", "the", "taxonomy", "of", "the", "current", "object", "based", "on", "the", "order", "given", "in", "taxonomy", ".", "yml", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Entity/ContentTaxonomyTrait.php#L133-L158
bolt/bolt
src/Storage/Repository/UsersRepository.php
UsersRepository.deleteUser
public function deleteUser($userId) { // Forget remembered users. $this->userEntities = []; $query = $this->deleteUserQuery($userId); return $query->execute(); }
php
public function deleteUser($userId) { // Forget remembered users. $this->userEntities = []; $query = $this->deleteUserQuery($userId); return $query->execute(); }
[ "public", "function", "deleteUser", "(", "$", "userId", ")", "{", "// Forget remembered users.", "$", "this", "->", "userEntities", "=", "[", "]", ";", "$", "query", "=", "$", "this", "->", "deleteUserQuery", "(", "$", "userId", ")", ";", "return", "$", ...
Delete a user. @param string|int $userId either the user's ID, username, or email address @return int
[ "Delete", "a", "user", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Repository/UsersRepository.php#L24-L32
bolt/bolt
src/Storage/Repository/UsersRepository.php
UsersRepository.deleteUserQuery
public function deleteUserQuery($userId) { $qb = $this->createQueryBuilder(); $qb->delete($this->getTableName()); if (is_numeric($userId)) { $qb->where('id = :userId'); } else { $qb->where('username = :userId')->orWhere('email = :userId'); } $...
php
public function deleteUserQuery($userId) { $qb = $this->createQueryBuilder(); $qb->delete($this->getTableName()); if (is_numeric($userId)) { $qb->where('id = :userId'); } else { $qb->where('username = :userId')->orWhere('email = :userId'); } $...
[ "public", "function", "deleteUserQuery", "(", "$", "userId", ")", "{", "$", "qb", "=", "$", "this", "->", "createQueryBuilder", "(", ")", ";", "$", "qb", "->", "delete", "(", "$", "this", "->", "getTableName", "(", ")", ")", ";", "if", "(", "is_numer...
Get the user deletion query. @param string|int $userId @return QueryBuilder
[ "Get", "the", "user", "deletion", "query", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Repository/UsersRepository.php#L41-L54
bolt/bolt
src/Storage/Repository/UsersRepository.php
UsersRepository.getUser
public function getUser($userId) { // Check if we've already retrieved this user. if (isset($this->userEntities[$userId])) { return $this->userEntities[$userId]; } $query = $this->getUserQuery($userId); /** @var Entity\Users $userEntity */ if ($userEntity...
php
public function getUser($userId) { // Check if we've already retrieved this user. if (isset($this->userEntities[$userId])) { return $this->userEntities[$userId]; } $query = $this->getUserQuery($userId); /** @var Entity\Users $userEntity */ if ($userEntity...
[ "public", "function", "getUser", "(", "$", "userId", ")", "{", "// Check if we've already retrieved this user.", "if", "(", "isset", "(", "$", "this", "->", "userEntities", "[", "$", "userId", "]", ")", ")", "{", "return", "$", "this", "->", "userEntities", ...
Get a user. @param string|int $userId either the user's ID, username, or email address @return Entity\Users|false
[ "Get", "a", "user", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Repository/UsersRepository.php#L64-L81
bolt/bolt
src/Storage/Repository/UsersRepository.php
UsersRepository.getUserQuery
public function getUserQuery($userId) { $qb = $this->createQueryBuilder(); $qb->select('*'); if (is_numeric($userId)) { $qb->where('id = :userId'); } else { $qb ->where($qb->expr()->like('username', ':userId')) ->orWhere('email...
php
public function getUserQuery($userId) { $qb = $this->createQueryBuilder(); $qb->select('*'); if (is_numeric($userId)) { $qb->where('id = :userId'); } else { $qb ->where($qb->expr()->like('username', ':userId')) ->orWhere('email...
[ "public", "function", "getUserQuery", "(", "$", "userId", ")", "{", "$", "qb", "=", "$", "this", "->", "createQueryBuilder", "(", ")", ";", "$", "qb", "->", "select", "(", "'*'", ")", ";", "if", "(", "is_numeric", "(", "$", "userId", ")", ")", "{",...
Get the user fetch query. @param string|int $userId @return QueryBuilder
[ "Get", "the", "user", "fetch", "query", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Repository/UsersRepository.php#L90-L106
bolt/bolt
src/Storage/Repository/UsersRepository.php
UsersRepository.getUserAuthDataQuery
public function getUserAuthDataQuery($userId) { $qb = $this->createQueryBuilder(); $qb->select('id') ->addSelect('password') ->addSelect('shadowpassword') ->where('id = :userId') ->setParameter('userId', $userId); return $qb; }
php
public function getUserAuthDataQuery($userId) { $qb = $this->createQueryBuilder(); $qb->select('id') ->addSelect('password') ->addSelect('shadowpassword') ->where('id = :userId') ->setParameter('userId', $userId); return $qb; }
[ "public", "function", "getUserAuthDataQuery", "(", "$", "userId", ")", "{", "$", "qb", "=", "$", "this", "->", "createQueryBuilder", "(", ")", ";", "$", "qb", "->", "select", "(", "'id'", ")", "->", "addSelect", "(", "'password'", ")", "->", "addSelect",...
Get the user fetch query. @param string|int $userId @return QueryBuilder
[ "Get", "the", "user", "fetch", "query", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Repository/UsersRepository.php#L129-L139
bolt/bolt
src/Storage/Repository/UsersRepository.php
UsersRepository.getUsers
public function getUsers() { $userEntities = $this->findAll(); if ($userEntities) { foreach ($userEntities as $userEntity) { $this->unsetSensitiveFields($userEntity); } } return $userEntities; }
php
public function getUsers() { $userEntities = $this->findAll(); if ($userEntities) { foreach ($userEntities as $userEntity) { $this->unsetSensitiveFields($userEntity); } } return $userEntities; }
[ "public", "function", "getUsers", "(", ")", "{", "$", "userEntities", "=", "$", "this", "->", "findAll", "(", ")", ";", "if", "(", "$", "userEntities", ")", "{", "foreach", "(", "$", "userEntities", "as", "$", "userEntity", ")", "{", "$", "this", "->...
Get all the system users. @return Entity\Users[]|false
[ "Get", "all", "the", "system", "users", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Repository/UsersRepository.php#L146-L156
bolt/bolt
src/Storage/Repository/UsersRepository.php
UsersRepository.getUserShadowAuthQuery
public function getUserShadowAuthQuery($shadowToken) { $qb = $this->createQueryBuilder(); $qb->select('*') ->where('shadowtoken = :shadowtoken') ->andWhere('shadowvalidity > :shadowvalidity') ->setParameter('shadowtoken', $shadowToken) ->setParameter('...
php
public function getUserShadowAuthQuery($shadowToken) { $qb = $this->createQueryBuilder(); $qb->select('*') ->where('shadowtoken = :shadowtoken') ->andWhere('shadowvalidity > :shadowvalidity') ->setParameter('shadowtoken', $shadowToken) ->setParameter('...
[ "public", "function", "getUserShadowAuthQuery", "(", "$", "shadowToken", ")", "{", "$", "qb", "=", "$", "this", "->", "createQueryBuilder", "(", ")", ";", "$", "qb", "->", "select", "(", "'*'", ")", "->", "where", "(", "'shadowtoken = :shadowtoken'", ")", ...
@param string $shadowToken @return QueryBuilder
[ "@param", "string", "$shadowToken" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Repository/UsersRepository.php#L204-L214
bolt/bolt
src/Storage/Repository/UsersRepository.php
UsersRepository.save
public function save($entity, $silent = null) { $this->userEntities = []; return parent::save($entity, $silent); }
php
public function save($entity, $silent = null) { $this->userEntities = []; return parent::save($entity, $silent); }
[ "public", "function", "save", "(", "$", "entity", ",", "$", "silent", "=", "null", ")", "{", "$", "this", "->", "userEntities", "=", "[", "]", ";", "return", "parent", "::", "save", "(", "$", "entity", ",", "$", "silent", ")", ";", "}" ]
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Repository/UsersRepository.php#L219-L224
bolt/bolt
src/Storage/Repository/UsersRepository.php
UsersRepository.update
public function update($entity, $exclusions = []) { // Forget remembered users. $this->userEntities = []; if ($entity->getPassword() === null) { $result = parent::update($entity, ['password']); } else { $result = parent::update($entity); } re...
php
public function update($entity, $exclusions = []) { // Forget remembered users. $this->userEntities = []; if ($entity->getPassword() === null) { $result = parent::update($entity, ['password']); } else { $result = parent::update($entity); } re...
[ "public", "function", "update", "(", "$", "entity", ",", "$", "exclusions", "=", "[", "]", ")", "{", "// Forget remembered users.", "$", "this", "->", "userEntities", "=", "[", "]", ";", "if", "(", "$", "entity", "->", "getPassword", "(", ")", "===", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Repository/UsersRepository.php#L229-L241
bolt/bolt
src/Storage/Repository/UsersRepository.php
UsersRepository.unsetSensitiveFields
protected function unsetSensitiveFields(Entity\Users $entity) { $entity->setPassword(null); $entity->setShadowpassword(null); $entity->setShadowtoken(null); $entity->setShadowvalidity(null); }
php
protected function unsetSensitiveFields(Entity\Users $entity) { $entity->setPassword(null); $entity->setShadowpassword(null); $entity->setShadowtoken(null); $entity->setShadowvalidity(null); }
[ "protected", "function", "unsetSensitiveFields", "(", "Entity", "\\", "Users", "$", "entity", ")", "{", "$", "entity", "->", "setPassword", "(", "null", ")", ";", "$", "entity", "->", "setShadowpassword", "(", "null", ")", ";", "$", "entity", "->", "setSha...
Null sensitive data that doesn't need to be passed around. @param Entity\Users $entity
[ "Null", "sensitive", "data", "that", "doesn", "t", "need", "to", "be", "passed", "around", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Repository/UsersRepository.php#L248-L254
bolt/bolt
src/Storage/Query/Query.php
Query.getScope
public function getScope($name) { if (array_key_exists($name, $this->scopes)) { return $this->scopes[$name]; } return null; }
php
public function getScope($name) { if (array_key_exists($name, $this->scopes)) { return $this->scopes[$name]; } return null; }
[ "public", "function", "getScope", "(", "$", "name", ")", "{", "if", "(", "array_key_exists", "(", "$", "name", ",", "$", "this", "->", "scopes", ")", ")", "{", "return", "$", "this", "->", "scopes", "[", "$", "name", "]", ";", "}", "return", "null"...
@param string $name @return QueryScopeInterface|null
[ "@param", "string", "$name" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Query/Query.php#L43-L50
bolt/bolt
src/Storage/Query/Query.php
Query.getContent
public function getContent($textQuery, array $parameters = []) { $this->parser->setQuery($textQuery); $this->parser->setParameters($parameters); return $this->parser->fetch(); }
php
public function getContent($textQuery, array $parameters = []) { $this->parser->setQuery($textQuery); $this->parser->setParameters($parameters); return $this->parser->fetch(); }
[ "public", "function", "getContent", "(", "$", "textQuery", ",", "array", "$", "parameters", "=", "[", "]", ")", "{", "$", "this", "->", "parser", "->", "setQuery", "(", "$", "textQuery", ")", ";", "$", "this", "->", "parser", "->", "setParameters", "("...
getContent based on a 'human readable query'. Used by the twig command {% setcontent %} but also directly. For reference refer to @link https://docs.bolt.cm/templating/content-fetching @param string $textQuery @param array|string $parameters @return QueryResultset|Content|null
[ "getContent", "based", "on", "a", "human", "readable", "query", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Query/Query.php#L63-L69
bolt/bolt
src/Storage/Query/Query.php
Query.getContentByScope
public function getContentByScope($scopeName, $textQuery, array $parameters = []) { if ($scope = $this->getScope($scopeName)) { $this->parser->setQuery($textQuery); $this->parser->setParameters($parameters); $this->parser->setScope($scope); return $this->pars...
php
public function getContentByScope($scopeName, $textQuery, array $parameters = []) { if ($scope = $this->getScope($scopeName)) { $this->parser->setQuery($textQuery); $this->parser->setParameters($parameters); $this->parser->setScope($scope); return $this->pars...
[ "public", "function", "getContentByScope", "(", "$", "scopeName", ",", "$", "textQuery", ",", "array", "$", "parameters", "=", "[", "]", ")", "{", "if", "(", "$", "scope", "=", "$", "this", "->", "getScope", "(", "$", "scopeName", ")", ")", "{", "$",...
@param string $scopeName @param string $textQuery @param array $parameters @return QueryResultset|null
[ "@param", "string", "$scopeName", "@param", "string", "$textQuery", "@param", "array", "$parameters" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Query/Query.php#L78-L89
bolt/bolt
src/Storage/Query/Query.php
Query.getContentForTwig
public function getContentForTwig($textQuery, array $parameters = []) { // fix BC break if (func_num_args() === 3) { $whereparameters = func_get_arg(2); if (is_array($whereparameters) && !empty($whereparameters)) { $parameters = array_merge($parameters, $where...
php
public function getContentForTwig($textQuery, array $parameters = []) { // fix BC break if (func_num_args() === 3) { $whereparameters = func_get_arg(2); if (is_array($whereparameters) && !empty($whereparameters)) { $parameters = array_merge($parameters, $where...
[ "public", "function", "getContentForTwig", "(", "$", "textQuery", ",", "array", "$", "parameters", "=", "[", "]", ")", "{", "// fix BC break", "if", "(", "func_num_args", "(", ")", "===", "3", ")", "{", "$", "whereparameters", "=", "func_get_arg", "(", "2"...
Helper to be called from Twig that is passed via a TwigRecordsView rather than the raw records. @param $textQuery @param array $parameters @return QueryResultset|null
[ "Helper", "to", "be", "called", "from", "Twig", "that", "is", "passed", "via", "a", "TwigRecordsView", "rather", "than", "the", "raw", "records", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Query/Query.php#L99-L111
bolt/bolt
src/Form/FormType/FileUploadType.php
FileUploadType.buildForm
public function buildForm(FormBuilderInterface $builder, array $options) { $builder ->add( 'select', FileType::class, [ 'label' => false, 'multiple' => true, 'attr' => [ ...
php
public function buildForm(FormBuilderInterface $builder, array $options) { $builder ->add( 'select', FileType::class, [ 'label' => false, 'multiple' => true, 'attr' => [ ...
[ "public", "function", "buildForm", "(", "FormBuilderInterface", "$", "builder", ",", "array", "$", "options", ")", "{", "$", "builder", "->", "add", "(", "'select'", ",", "FileType", "::", "class", ",", "[", "'label'", "=>", "false", ",", "'multiple'", "=>...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Form/FormType/FileUploadType.php#L22-L47
bolt/bolt
src/Routing/CallbackResolver.php
CallbackResolver.isValid
public function isValid($name) { if (parent::isValid($name)) { return true; } if (is_array($name)) { list($cls, $method) = $name; if (is_object($cls)) { return false; // No need to convert } if (is_array($method)) { ...
php
public function isValid($name) { if (parent::isValid($name)) { return true; } if (is_array($name)) { list($cls, $method) = $name; if (is_object($cls)) { return false; // No need to convert } if (is_array($method)) { ...
[ "public", "function", "isValid", "(", "$", "name", ")", "{", "if", "(", "parent", "::", "isValid", "(", "$", "name", ")", ")", "{", "return", "true", ";", "}", "if", "(", "is_array", "(", "$", "name", ")", ")", "{", "list", "(", "$", "cls", ","...
Returns true if the string is a valid service method representation or if the string/array references a class contained in the resolver's classmap. @param string $name @return bool
[ "Returns", "true", "if", "the", "string", "is", "a", "valid", "service", "method", "representation", "or", "if", "the", "string", "/", "array", "references", "a", "class", "contained", "in", "the", "resolver", "s", "classmap", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Routing/CallbackResolver.php#L47-L80
bolt/bolt
src/Routing/CallbackResolver.php
CallbackResolver.convertCallback
public function convertCallback($name) { if (is_array($name)) { list($cls, $method) = $name; if (is_array($method)) { $params = $method; $callback = $this->resolveCallback($cls); return function () use ($callback, $params) { ...
php
public function convertCallback($name) { if (is_array($name)) { list($cls, $method) = $name; if (is_array($method)) { $params = $method; $callback = $this->resolveCallback($cls); return function () use ($callback, $params) { ...
[ "public", "function", "convertCallback", "(", "$", "name", ")", "{", "if", "(", "is_array", "(", "$", "name", ")", ")", "{", "list", "(", "$", "cls", ",", "$", "method", ")", "=", "$", "name", ";", "if", "(", "is_array", "(", "$", "method", ")", ...
Converts:. - Bolt\\Controller\\Frontend::hompeage to controller.frontend:homepage - [Bolt\\Controller\\Frontend, homepage] to controller.frontend:homepage Those are then converted to valid callbacks with the controller object from application @param string $name @return callable A callable array
[ "Converts", ":", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Routing/CallbackResolver.php#L94-L123
bolt/bolt
src/Menu/Resolver/Access.php
Access.resolve
public function resolve(MenuEntry $menu, Entity\Users $user) { foreach ($menu->children() as $name => $child) { $this->doResolve($menu, $child, $user); if ($child->children() === [] && $child->getUri() === null) { $menu->remove($name); } } }
php
public function resolve(MenuEntry $menu, Entity\Users $user) { foreach ($menu->children() as $name => $child) { $this->doResolve($menu, $child, $user); if ($child->children() === [] && $child->getUri() === null) { $menu->remove($name); } } }
[ "public", "function", "resolve", "(", "MenuEntry", "$", "menu", ",", "Entity", "\\", "Users", "$", "user", ")", "{", "foreach", "(", "$", "menu", "->", "children", "(", ")", "as", "$", "name", "=>", "$", "child", ")", "{", "$", "this", "->", "doRes...
Resolve the access permissions on each menu child recursively, and remove the child if access is not granted. Should a parent have no remaining children & isn't routed, it should then be removed. @param MenuEntry $menu @param Entity\Users $user
[ "Resolve", "the", "access", "permissions", "on", "each", "menu", "child", "recursively", "and", "remove", "the", "child", "if", "access", "is", "not", "granted", ".", "Should", "a", "parent", "have", "no", "remaining", "children", "&", "isn", "t", "routed", ...
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Menu/Resolver/Access.php#L39-L48
bolt/bolt
src/Storage/Database/Schema/Types/JsonType.php
JsonType.convertToDatabaseValue
public function convertToDatabaseValue($value, AbstractPlatform $platform) { if ($value === null) { return null; } try { return Json::dump($value); } catch (DumpException $e) { throw ConversionException::conversionFailedSerialization($value, $this...
php
public function convertToDatabaseValue($value, AbstractPlatform $platform) { if ($value === null) { return null; } try { return Json::dump($value); } catch (DumpException $e) { throw ConversionException::conversionFailedSerialization($value, $this...
[ "public", "function", "convertToDatabaseValue", "(", "$", "value", ",", "AbstractPlatform", "$", "platform", ")", "{", "if", "(", "$", "value", "===", "null", ")", "{", "return", "null", ";", "}", "try", "{", "return", "Json", "::", "dump", "(", "$", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Database/Schema/Types/JsonType.php#L38-L49
bolt/bolt
src/Storage/Database/Schema/Types/JsonType.php
JsonType.convertToPHPValue
public function convertToPHPValue($value, AbstractPlatform $platform) { if ($value === null || $value === '') { return null; } if (is_resource($value)) { $value = stream_get_contents($value); } try { return Json::parse($value); } ...
php
public function convertToPHPValue($value, AbstractPlatform $platform) { if ($value === null || $value === '') { return null; } if (is_resource($value)) { $value = stream_get_contents($value); } try { return Json::parse($value); } ...
[ "public", "function", "convertToPHPValue", "(", "$", "value", ",", "AbstractPlatform", "$", "platform", ")", "{", "if", "(", "$", "value", "===", "null", "||", "$", "value", "===", "''", ")", "{", "return", "null", ";", "}", "if", "(", "is_resource", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Database/Schema/Types/JsonType.php#L54-L69
bolt/bolt
src/Storage/Entity/EntityArrayAccessTrait.php
EntityArrayAccessTrait.offsetExists
public function offsetExists($offset) { if (method_exists($this, 'has')) { // from MagicAttributeTrait return $this->has($offset); } $accessor = 'get' . ucfirst($offset); $result = $this->$accessor(); return !empty($result); }
php
public function offsetExists($offset) { if (method_exists($this, 'has')) { // from MagicAttributeTrait return $this->has($offset); } $accessor = 'get' . ucfirst($offset); $result = $this->$accessor(); return !empty($result); }
[ "public", "function", "offsetExists", "(", "$", "offset", ")", "{", "if", "(", "method_exists", "(", "$", "this", ",", "'has'", ")", ")", "{", "// from MagicAttributeTrait", "return", "$", "this", "->", "has", "(", "$", "offset", ")", ";", "}", "$", "a...
@see ArrayAccess::offsetExists @param string $offset @return bool
[ "@see", "ArrayAccess", "::", "offsetExists" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Entity/EntityArrayAccessTrait.php#L32-L42
bolt/bolt
src/Filesystem/Plugin/AssetUrl.php
AssetUrl.handle
public function handle($path) { // getFile first to split mount point from path, if present. $file = $this->filesystem->getFile($path); if ($this->packages instanceof Packages) { return $this->packages->getUrl($file->getPath(), $file->getMountPoint()); } return ...
php
public function handle($path) { // getFile first to split mount point from path, if present. $file = $this->filesystem->getFile($path); if ($this->packages instanceof Packages) { return $this->packages->getUrl($file->getPath(), $file->getMountPoint()); } return ...
[ "public", "function", "handle", "(", "$", "path", ")", "{", "// getFile first to split mount point from path, if present.", "$", "file", "=", "$", "this", "->", "filesystem", "->", "getFile", "(", "$", "path", ")", ";", "if", "(", "$", "this", "->", "packages"...
Returns the public url/path of an asset. @param string $path @return string
[ "Returns", "the", "public", "url", "/", "path", "of", "an", "asset", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Filesystem/Plugin/AssetUrl.php#L59-L69
bolt/bolt
src/Form/Validator/Constraints/FieldEqualsValidator.php
FieldEqualsValidator.addViolation
protected function addViolation($value, Constraint $constraint) { $this->context->buildViolation($constraint->message) ->setParameter('%field%', null) ->setParameter('%value%', $value) ->addViolation() ; return true; }
php
protected function addViolation($value, Constraint $constraint) { $this->context->buildViolation($constraint->message) ->setParameter('%field%', null) ->setParameter('%value%', $value) ->addViolation() ; return true; }
[ "protected", "function", "addViolation", "(", "$", "value", ",", "Constraint", "$", "constraint", ")", "{", "$", "this", "->", "context", "->", "buildViolation", "(", "$", "constraint", "->", "message", ")", "->", "setParameter", "(", "'%field%'", ",", "null...
Add violation. @param mixed $value @param Constraint $constraint @return true
[ "Add", "violation", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Form/Validator/Constraints/FieldEqualsValidator.php#L53-L62
bolt/bolt
src/Composer/JsonManager.php
JsonManager.init
public function init($file, array $data = null) { if ($data === null) { $data = $this->setJsonDefaults([]); } $this->app['filesystem']->write($file, Json::dump($data, Json::HUMAN)); }
php
public function init($file, array $data = null) { if ($data === null) { $data = $this->setJsonDefaults([]); } $this->app['filesystem']->write($file, Json::dump($data, Json::HUMAN)); }
[ "public", "function", "init", "(", "$", "file", ",", "array", "$", "data", "=", "null", ")", "{", "if", "(", "$", "data", "===", "null", ")", "{", "$", "data", "=", "$", "this", "->", "setJsonDefaults", "(", "[", "]", ")", ";", "}", "$", "this"...
Initialise a JSON file at given location with optional data input. @param string $file @param array $data
[ "Initialise", "a", "JSON", "file", "at", "given", "location", "with", "optional", "data", "input", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/JsonManager.php#L43-L49
bolt/bolt
src/Composer/JsonManager.php
JsonManager.update
public function update() { /** @var \Bolt\Filesystem\Handler\JsonFile $jsonFile */ $jsonFile = $this->app['filesystem']->get('extensions://composer.json', new JsonFile()); if (!$jsonFile->exists()) { try { $this->init('extensions://composer.json'); } ...
php
public function update() { /** @var \Bolt\Filesystem\Handler\JsonFile $jsonFile */ $jsonFile = $this->app['filesystem']->get('extensions://composer.json', new JsonFile()); if (!$jsonFile->exists()) { try { $this->init('extensions://composer.json'); } ...
[ "public", "function", "update", "(", ")", "{", "/** @var \\Bolt\\Filesystem\\Handler\\JsonFile $jsonFile */", "$", "jsonFile", "=", "$", "this", "->", "app", "[", "'filesystem'", "]", "->", "get", "(", "'extensions://composer.json'", ",", "new", "JsonFile", "(", ")"...
Set up Composer JSON file. @return array|null
[ "Set", "up", "Composer", "JSON", "file", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/JsonManager.php#L56-L93
bolt/bolt
src/Composer/JsonManager.php
JsonManager.setJsonDefaults
private function setJsonDefaults(array $json) { $config = $this->app['config']; $pathResolver = $this->app['path_resolver']; $rootPath = $pathResolver->resolve('root'); $extensionsPath = $pathResolver->resolve('extensions'); $webPath = $pathResolver->resolve('web'); ...
php
private function setJsonDefaults(array $json) { $config = $this->app['config']; $pathResolver = $this->app['path_resolver']; $rootPath = $pathResolver->resolve('root'); $extensionsPath = $pathResolver->resolve('extensions'); $webPath = $pathResolver->resolve('web'); ...
[ "private", "function", "setJsonDefaults", "(", "array", "$", "json", ")", "{", "$", "config", "=", "$", "this", "->", "app", "[", "'config'", "]", ";", "$", "pathResolver", "=", "$", "this", "->", "app", "[", "'path_resolver'", "]", ";", "$", "rootPath...
Enforce the default JSON settings. @param array $json @return array
[ "Enforce", "the", "default", "JSON", "settings", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/JsonManager.php#L102-L158
bolt/bolt
src/Nut/UserResetPassword.php
UserResetPassword.execute
protected function execute(InputInterface $input, OutputInterface $output) { $userName = $input->getArgument('username'); $this->io->title("Resetting password for user '$userName'"); $ask = !$input->getOption('no-interaction'); $question = new ConfirmationQuestion("<question>Are you...
php
protected function execute(InputInterface $input, OutputInterface $output) { $userName = $input->getArgument('username'); $this->io->title("Resetting password for user '$userName'"); $ask = !$input->getOption('no-interaction'); $question = new ConfirmationQuestion("<question>Are you...
[ "protected", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "$", "userName", "=", "$", "input", "->", "getArgument", "(", "'username'", ")", ";", "$", "this", "->", "io", "->", "title", "(", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/UserResetPassword.php#L32-L54
bolt/bolt
src/Nut/ExtensionsUninstall.php
ExtensionsUninstall.execute
protected function execute(InputInterface $input, OutputInterface $output) { $name = $input->getArgument('name'); $this->io->title("Starting uninstall of $name"); $result = $this->app['extend.manager']->removePackage([$name]); $this->io->writeln(sprintf('<comment>%s</comment>', $thi...
php
protected function execute(InputInterface $input, OutputInterface $output) { $name = $input->getArgument('name'); $this->io->title("Starting uninstall of $name"); $result = $this->app['extend.manager']->removePackage([$name]); $this->io->writeln(sprintf('<comment>%s</comment>', $thi...
[ "protected", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "$", "name", "=", "$", "input", "->", "getArgument", "(", "'name'", ")", ";", "$", "this", "->", "io", "->", "title", "(", "\"Starti...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/ExtensionsUninstall.php#L33-L48