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/Menu/Builder/AdminMenu.php
AdminMenu.addFileManagement
private function addFileManagement(MenuEntry $root) { $fileEntry = $root->add( MenuEntry::create('files') ->setLabel(Trans::__('general.phrase.file-management')) ->setIcon('fa:cubes') ->setPermission('files') ); // Uploaded files ...
php
private function addFileManagement(MenuEntry $root) { $fileEntry = $root->add( MenuEntry::create('files') ->setLabel(Trans::__('general.phrase.file-management')) ->setIcon('fa:cubes') ->setPermission('files') ); // Uploaded files ...
[ "private", "function", "addFileManagement", "(", "MenuEntry", "$", "root", ")", "{", "$", "fileEntry", "=", "$", "root", "->", "add", "(", "MenuEntry", "::", "create", "(", "'files'", ")", "->", "setLabel", "(", "Trans", "::", "__", "(", "'general.phrase.f...
File management menus. @param MenuEntry $root
[ "File", "management", "menus", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Menu/Builder/AdminMenu.php#L172-L198
bolt/bolt
src/Menu/Builder/AdminMenu.php
AdminMenu.addExtend
private function addExtend(MenuEntry $root) { $root->add( MenuEntry::create('extensions') ->setRoute('extensions') ->setLabel(Trans::__('general.phrase.extensions-overview')) ->setIcon('fa:cubes') ->setPermission('extensions') ...
php
private function addExtend(MenuEntry $root) { $root->add( MenuEntry::create('extensions') ->setRoute('extensions') ->setLabel(Trans::__('general.phrase.extensions-overview')) ->setIcon('fa:cubes') ->setPermission('extensions') ...
[ "private", "function", "addExtend", "(", "MenuEntry", "$", "root", ")", "{", "$", "root", "->", "add", "(", "MenuEntry", "::", "create", "(", "'extensions'", ")", "->", "setRoute", "(", "'extensions'", ")", "->", "setLabel", "(", "Trans", "::", "__", "("...
Extensions menus. @param MenuEntry $root
[ "Extensions", "menus", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Menu/Builder/AdminMenu.php#L205-L221
bolt/bolt
src/Storage/Entity/FieldValue.php
FieldValue.handleStorage
public function handleStorage($fieldObject) { $type = $fieldObject->getStorageType(); $typeName = $type->getName(); if ($typeName === 'json') { /** @deprecated since 3.3 to be renamed in v4. */ $typeName = 'json_array'; } $typeCol = 'value_' . $typeNam...
php
public function handleStorage($fieldObject) { $type = $fieldObject->getStorageType(); $typeName = $type->getName(); if ($typeName === 'json') { /** @deprecated since 3.3 to be renamed in v4. */ $typeName = 'json_array'; } $typeCol = 'value_' . $typeNam...
[ "public", "function", "handleStorage", "(", "$", "fieldObject", ")", "{", "$", "type", "=", "$", "fieldObject", "->", "getStorageType", "(", ")", ";", "$", "typeName", "=", "$", "type", "->", "getName", "(", ")", ";", "if", "(", "$", "typeName", "===",...
When the entity needs to be persisted the value has to be copied to a field specific to the storage type. To do this we need a field type so we lookup the correct column to write to. @param \Bolt\Storage\Field\Base $fieldObject
[ "When", "the", "entity", "needs", "to", "be", "persisted", "the", "value", "has", "to", "be", "copied", "to", "a", "field", "specific", "to", "the", "storage", "type", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Entity/FieldValue.php#L134-L144
bolt/bolt
src/Nut/ConfigGet.php
ConfigGet.doExecute
protected function doExecute(YamlUpdater $updater, InputInterface $input, OutputInterface $output) { $key = $input->getArgument('key'); $value = $updater->get($key, true); if (is_bool($value)) { $value = $value ? 'true' : 'false'; } $this->io->title(sprintf('Con...
php
protected function doExecute(YamlUpdater $updater, InputInterface $input, OutputInterface $output) { $key = $input->getArgument('key'); $value = $updater->get($key, true); if (is_bool($value)) { $value = $value ? 'true' : 'false'; } $this->io->title(sprintf('Con...
[ "protected", "function", "doExecute", "(", "YamlUpdater", "$", "updater", ",", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "$", "key", "=", "$", "input", "->", "getArgument", "(", "'key'", ")", ";", "$", "value", "=", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/ConfigGet.php#L29-L40
bolt/bolt
src/Nut/ExtensionsUpdate.php
ExtensionsUpdate.execute
protected function execute(InputInterface $input, OutputInterface $output) { if (!$this->pinger->ping(true, $output->getVerbosity() >= OutputInterface::VERBOSITY_DEBUG)) { $this->io->error($this->pinger->getMessages()->toArray()); return 1; } $name = $input->getArgu...
php
protected function execute(InputInterface $input, OutputInterface $output) { if (!$this->pinger->ping(true, $output->getVerbosity() >= OutputInterface::VERBOSITY_DEBUG)) { $this->io->error($this->pinger->getMessages()->toArray()); return 1; } $name = $input->getArgu...
[ "protected", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "if", "(", "!", "$", "this", "->", "pinger", "->", "ping", "(", "true", ",", "$", "output", "->", "getVerbosity", "(", ")", ">=", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/ExtensionsUpdate.php#L41-L67
bolt/bolt
src/Composer/EventListener/PackageDescriptor.php
PackageDescriptor.parse
public static function parse(Composer $composer, $webPath, $path, array $jsonData) { $name = $jsonData['name']; $class = self::parseClass($jsonData); $constraint = self::parseConstraint($jsonData); $valid = self::parseValid($composer, $class, $constraint); return new self($n...
php
public static function parse(Composer $composer, $webPath, $path, array $jsonData) { $name = $jsonData['name']; $class = self::parseClass($jsonData); $constraint = self::parseConstraint($jsonData); $valid = self::parseValid($composer, $class, $constraint); return new self($n...
[ "public", "static", "function", "parse", "(", "Composer", "$", "composer", ",", "$", "webPath", ",", "$", "path", ",", "array", "$", "jsonData", ")", "{", "$", "name", "=", "$", "jsonData", "[", "'name'", "]", ";", "$", "class", "=", "self", "::", ...
Create class from uncertain JSON data. @param Composer $composer @param string $webPath @param string $path @param array $jsonData @return PackageDescriptor
[ "Create", "class", "from", "uncertain", "JSON", "data", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/EventListener/PackageDescriptor.php#L109-L117
bolt/bolt
src/Composer/EventListener/PackageDescriptor.php
PackageDescriptor.jsonSerialize
public function jsonSerialize() { return [ 'name' => $this->name, 'path' => $this->path, 'webPath' => $this->webPath, 'class' => $this->class, 'constraint' => $this->constraint, 'valid' => $this->valid, ...
php
public function jsonSerialize() { return [ 'name' => $this->name, 'path' => $this->path, 'webPath' => $this->webPath, 'class' => $this->class, 'constraint' => $this->constraint, 'valid' => $this->valid, ...
[ "public", "function", "jsonSerialize", "(", ")", "{", "return", "[", "'name'", "=>", "$", "this", "->", "name", ",", "'path'", "=>", "$", "this", "->", "path", ",", "'webPath'", "=>", "$", "this", "->", "webPath", ",", "'class'", "=>", "$", "this", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/EventListener/PackageDescriptor.php#L141-L151
bolt/bolt
src/Composer/EventListener/PackageDescriptor.php
PackageDescriptor.parseValid
private static function parseValid(Composer $composer, $class, $constraint) { if ($constraint === null) { return false; } $provides = $composer->getPackage()->getProvides(); $boltVersion = isset($provides['bolt/bolt']) ? $provides['bolt/bolt'] : new Link('__root__', 'bol...
php
private static function parseValid(Composer $composer, $class, $constraint) { if ($constraint === null) { return false; } $provides = $composer->getPackage()->getProvides(); $boltVersion = isset($provides['bolt/bolt']) ? $provides['bolt/bolt'] : new Link('__root__', 'bol...
[ "private", "static", "function", "parseValid", "(", "Composer", "$", "composer", ",", "$", "class", ",", "$", "constraint", ")", "{", "if", "(", "$", "constraint", "===", "null", ")", "{", "return", "false", ";", "}", "$", "provides", "=", "$", "compos...
Check if the extension is valid for loading, i.e has a class and is withing version constraints. @param Composer $composer @param string|null $class @param string|null $constraint @return bool
[ "Check", "if", "the", "extension", "is", "valid", "for", "loading", "i", ".", "e", "has", "a", "class", "and", "is", "withing", "version", "constraints", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/EventListener/PackageDescriptor.php#L194-L204
bolt/bolt
src/Storage/Repository.php
Repository.create
public function create($params = [], ClassMetadata $metadata = null) { $params = new ArrayObject($params); $builder = $this->getEntityBuilder(); /** @var Entity $entity */ $entity = $builder->getEntity(); $preEventArgs = new HydrationEvent($params, ['entity' => $entity, 'repo...
php
public function create($params = [], ClassMetadata $metadata = null) { $params = new ArrayObject($params); $builder = $this->getEntityBuilder(); /** @var Entity $entity */ $entity = $builder->getEntity(); $preEventArgs = new HydrationEvent($params, ['entity' => $entity, 'repo...
[ "public", "function", "create", "(", "$", "params", "=", "[", "]", ",", "ClassMetadata", "$", "metadata", "=", "null", ")", "{", "$", "params", "=", "new", "ArrayObject", "(", "$", "params", ")", ";", "$", "builder", "=", "$", "this", "->", "getEntit...
Creates a new empty entity and passes the supplied data to the constructor. @param array $params @param ClassMetadata $metadata @return Entity
[ "Creates", "a", "new", "empty", "entity", "and", "passes", "the", "supplied", "data", "to", "the", "constructor", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Repository.php#L53-L66
bolt/bolt
src/Storage/Repository.php
Repository.createQueryBuilder
public function createQueryBuilder($alias = null) { if ($alias === null) { $alias = $this->getAlias(); } if (empty($alias)) { $select = '*'; } else { $select = $alias . '.*'; } return $this->em->createQueryBuilder() ->...
php
public function createQueryBuilder($alias = null) { if ($alias === null) { $alias = $this->getAlias(); } if (empty($alias)) { $select = '*'; } else { $select = $alias . '.*'; } return $this->em->createQueryBuilder() ->...
[ "public", "function", "createQueryBuilder", "(", "$", "alias", "=", "null", ")", "{", "if", "(", "$", "alias", "===", "null", ")", "{", "$", "alias", "=", "$", "this", "->", "getAlias", "(", ")", ";", "}", "if", "(", "empty", "(", "$", "alias", "...
Creates a new QueryBuilder instance that is prepopulated for this entity name. @param string $alias @return QueryBuilder
[ "Creates", "a", "new", "QueryBuilder", "instance", "that", "is", "prepopulated", "for", "this", "entity", "name", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Repository.php#L75-L90
bolt/bolt
src/Storage/Repository.php
Repository.count
public function count() { $qb = $this->getLoadQuery() ->select('COUNT(' . $this->getAlias() . '.id) as count') ->resetQueryParts(['groupBy', 'join']) ; $result = $qb->execute()->fetchColumn(0); return (int) $result; }
php
public function count() { $qb = $this->getLoadQuery() ->select('COUNT(' . $this->getAlias() . '.id) as count') ->resetQueryParts(['groupBy', 'join']) ; $result = $qb->execute()->fetchColumn(0); return (int) $result; }
[ "public", "function", "count", "(", ")", "{", "$", "qb", "=", "$", "this", "->", "getLoadQuery", "(", ")", "->", "select", "(", "'COUNT('", ".", "$", "this", "->", "getAlias", "(", ")", ".", "'.id) as count'", ")", "->", "resetQueryParts", "(", "[", ...
Return the number of rows used in this repository table. @return int
[ "Return", "the", "number", "of", "rows", "used", "in", "this", "repository", "table", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Repository.php#L97-L106
bolt/bolt
src/Storage/Repository.php
Repository.find
public function find($id) { $qb = $this->getLoadQuery(); $result = $qb->where($this->getAlias() . '.id = :id') ->setParameter('id', $id) ->execute() ->fetch(); if ($result) { return $this->hydrate($result, $qb); } return false...
php
public function find($id) { $qb = $this->getLoadQuery(); $result = $qb->where($this->getAlias() . '.id = :id') ->setParameter('id', $id) ->execute() ->fetch(); if ($result) { return $this->hydrate($result, $qb); } return false...
[ "public", "function", "find", "(", "$", "id", ")", "{", "$", "qb", "=", "$", "this", "->", "getLoadQuery", "(", ")", ";", "$", "result", "=", "$", "qb", "->", "where", "(", "$", "this", "->", "getAlias", "(", ")", ".", "'.id = :id'", ")", "->", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Repository.php#L111-L124
bolt/bolt
src/Storage/Repository.php
Repository.findBy
public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) { $qb = $this->findWithCriteria($criteria, $orderBy, $limit, $offset); $result = $qb->execute()->fetchAll(); if ($result) { return $this->hydrateAll($result, $qb); } r...
php
public function findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) { $qb = $this->findWithCriteria($criteria, $orderBy, $limit, $offset); $result = $qb->execute()->fetchAll(); if ($result) { return $this->hydrateAll($result, $qb); } r...
[ "public", "function", "findBy", "(", "array", "$", "criteria", ",", "array", "$", "orderBy", "=", "null", ",", "$", "limit", "=", "null", ",", "$", "offset", "=", "null", ")", "{", "$", "qb", "=", "$", "this", "->", "findWithCriteria", "(", "$", "c...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Repository.php#L137-L148
bolt/bolt
src/Storage/Repository.php
Repository.findOneBy
public function findOneBy(array $criteria, array $orderBy = null) { $qb = $this->findWithCriteria($criteria, $orderBy); $result = $qb->execute()->fetch(); if ($result) { return $this->hydrate($result, $qb); } return false; }
php
public function findOneBy(array $criteria, array $orderBy = null) { $qb = $this->findWithCriteria($criteria, $orderBy); $result = $qb->execute()->fetch(); if ($result) { return $this->hydrate($result, $qb); } return false; }
[ "public", "function", "findOneBy", "(", "array", "$", "criteria", ",", "array", "$", "orderBy", "=", "null", ")", "{", "$", "qb", "=", "$", "this", "->", "findWithCriteria", "(", "$", "criteria", ",", "$", "orderBy", ")", ";", "$", "result", "=", "$"...
Finds a single object by a set of criteria. @param array $criteria the criteria @param array $orderBy @return object|false the object
[ "Finds", "a", "single", "object", "by", "a", "set", "of", "criteria", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Repository.php#L158-L168
bolt/bolt
src/Storage/Repository.php
Repository.findWithCriteria
protected function findWithCriteria(array $criteria, array $orderBy = null, $limit = null, $offset = null) { $qb = $this->getLoadQuery(); foreach ($criteria as $col => $val) { if (is_array($val)) { $qb->andWhere($this->getAlias() . ".$col IN(:$col)"); $qb-...
php
protected function findWithCriteria(array $criteria, array $orderBy = null, $limit = null, $offset = null) { $qb = $this->getLoadQuery(); foreach ($criteria as $col => $val) { if (is_array($val)) { $qb->andWhere($this->getAlias() . ".$col IN(:$col)"); $qb-...
[ "protected", "function", "findWithCriteria", "(", "array", "$", "criteria", ",", "array", "$", "orderBy", "=", "null", ",", "$", "limit", "=", "null", ",", "$", "offset", "=", "null", ")", "{", "$", "qb", "=", "$", "this", "->", "getLoadQuery", "(", ...
Internal method to build a basic select, returns QB object. @param array $criteria @param array $orderBy @param int $limit @param int $offset @return QueryBuilder
[ "Internal", "method", "to", "build", "a", "basic", "select", "returns", "QB", "object", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Repository.php#L180-L203
bolt/bolt
src/Storage/Repository.php
Repository.findWith
public function findWith(QueryBuilder $query) { $this->load($query); $result = $query->execute()->fetchAll(); if ($result) { return $this->hydrateAll($result, $query); } return []; }
php
public function findWith(QueryBuilder $query) { $this->load($query); $result = $query->execute()->fetchAll(); if ($result) { return $this->hydrateAll($result, $query); } return []; }
[ "public", "function", "findWith", "(", "QueryBuilder", "$", "query", ")", "{", "$", "this", "->", "load", "(", "$", "query", ")", ";", "$", "result", "=", "$", "query", "->", "execute", "(", ")", "->", "fetchAll", "(", ")", ";", "if", "(", "$", "...
Method to hydrate and return a QueryBuilder query. @param QueryBuilder $query @return array Entity
[ "Method", "to", "hydrate", "and", "return", "a", "QueryBuilder", "query", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Repository.php#L212-L222
bolt/bolt
src/Storage/Repository.php
Repository.findOneWith
public function findOneWith(QueryBuilder $query) { $this->load($query); $result = $query->execute()->fetch(); if ($result) { return $this->hydrate($result, $query); } return false; }
php
public function findOneWith(QueryBuilder $query) { $this->load($query); $result = $query->execute()->fetch(); if ($result) { return $this->hydrate($result, $query); } return false; }
[ "public", "function", "findOneWith", "(", "QueryBuilder", "$", "query", ")", "{", "$", "this", "->", "load", "(", "$", "query", ")", ";", "$", "result", "=", "$", "query", "->", "execute", "(", ")", "->", "fetch", "(", ")", ";", "if", "(", "$", "...
Method to hydrate and return a single QueryBuilder result. @param QueryBuilder $query @return Entity|false
[ "Method", "to", "hydrate", "and", "return", "a", "single", "QueryBuilder", "result", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Repository.php#L231-L240
bolt/bolt
src/Storage/Repository.php
Repository.queryWith
public function queryWith(QueryInterface $query) { $this->query($query); $queryBuilder = $query->build(); return $this->findWith($queryBuilder); }
php
public function queryWith(QueryInterface $query) { $this->query($query); $queryBuilder = $query->build(); return $this->findWith($queryBuilder); }
[ "public", "function", "queryWith", "(", "QueryInterface", "$", "query", ")", "{", "$", "this", "->", "query", "(", "$", "query", ")", ";", "$", "queryBuilder", "=", "$", "query", "->", "build", "(", ")", ";", "return", "$", "this", "->", "findWith", ...
Method to execute query from a Bolt QueryInterface object The query is passed to the pre-load handlers then built into a QueryBuilder instance that can be executed. @param QueryInterface $query [description] @return array Entity | false
[ "Method", "to", "execute", "query", "from", "a", "Bolt", "QueryInterface", "object", "The", "query", "is", "passed", "to", "the", "pre", "-", "load", "handlers", "then", "built", "into", "a", "QueryBuilder", "instance", "that", "can", "be", "executed", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Repository.php#L251-L257
bolt/bolt
src/Storage/Repository.php
Repository.load
protected function load(QueryBuilder $query) { $metadata = $this->getClassMetadata(); foreach ($metadata->getFieldMappings() as $field) { $fieldtype = $this->getFieldManager()->get($field['fieldtype'], $field); if ($fieldtype instanceof FieldTypeInterface) { $...
php
protected function load(QueryBuilder $query) { $metadata = $this->getClassMetadata(); foreach ($metadata->getFieldMappings() as $field) { $fieldtype = $this->getFieldManager()->get($field['fieldtype'], $field); if ($fieldtype instanceof FieldTypeInterface) { $...
[ "protected", "function", "load", "(", "QueryBuilder", "$", "query", ")", "{", "$", "metadata", "=", "$", "this", "->", "getClassMetadata", "(", ")", ";", "foreach", "(", "$", "metadata", "->", "getFieldMappings", "(", ")", "as", "$", "field", ")", "{", ...
Internal method to run load method on each field for the managed entity. Takes a QueryBuilder instance as input @param QueryBuilder $query
[ "Internal", "method", "to", "run", "load", "method", "on", "each", "field", "for", "the", "managed", "entity", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Repository.php#L280-L289
bolt/bolt
src/Storage/Repository.php
Repository.query
protected function query(QueryInterface $query) { $metadata = $this->getClassMetadata(); foreach ($metadata->getFieldMappings() as $field) { $fieldtype = $this->getFieldManager()->get($field['fieldtype'], $field); if ($fieldtype instanceof FieldTypeInterface) { ...
php
protected function query(QueryInterface $query) { $metadata = $this->getClassMetadata(); foreach ($metadata->getFieldMappings() as $field) { $fieldtype = $this->getFieldManager()->get($field['fieldtype'], $field); if ($fieldtype instanceof FieldTypeInterface) { ...
[ "protected", "function", "query", "(", "QueryInterface", "$", "query", ")", "{", "$", "metadata", "=", "$", "this", "->", "getClassMetadata", "(", ")", ";", "foreach", "(", "$", "metadata", "->", "getFieldMappings", "(", ")", "as", "$", "field", ")", "{"...
Internal method to run query method on each field for the managed entity. Takes a QueryInterface instance as input @param QueryInterface $query
[ "Internal", "method", "to", "run", "query", "method", "on", "each", "field", "for", "the", "managed", "entity", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Repository.php#L298-L308
bolt/bolt
src/Storage/Repository.php
Repository.persist
protected function persist(QuerySet $queries, $entity, $exclusions = []) { $metadata = $this->getClassMetadata(); foreach ($metadata->getFieldMappings() as $field) { $fieldName = $field['fieldname']; if (in_array($fieldName, $exclusions)) { continue; ...
php
protected function persist(QuerySet $queries, $entity, $exclusions = []) { $metadata = $this->getClassMetadata(); foreach ($metadata->getFieldMappings() as $field) { $fieldName = $field['fieldname']; if (in_array($fieldName, $exclusions)) { continue; ...
[ "protected", "function", "persist", "(", "QuerySet", "$", "queries", ",", "$", "entity", ",", "$", "exclusions", "=", "[", "]", ")", "{", "$", "metadata", "=", "$", "this", "->", "getClassMetadata", "(", ")", ";", "foreach", "(", "$", "metadata", "->",...
Internal method to run persist method on each field for the managed entity. Takes a QuerySet instance as input @param QuerySet $queries @param Entity $entity @param array $exclusions
[ "Internal", "method", "to", "run", "persist", "method", "on", "each", "field", "for", "the", "managed", "entity", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Repository.php#L319-L339
bolt/bolt
src/Storage/Repository.php
Repository.delete
public function delete($entity) { $event = new StorageEvent($entity); $this->event()->dispatch(StorageEvents::PRE_DELETE, $event); $qb = $this->em->createQueryBuilder() ->delete($this->getTableName()) ->where('id = :id') ->setParameter('id', $entity->getId...
php
public function delete($entity) { $event = new StorageEvent($entity); $this->event()->dispatch(StorageEvents::PRE_DELETE, $event); $qb = $this->em->createQueryBuilder() ->delete($this->getTableName()) ->where('id = :id') ->setParameter('id', $entity->getId...
[ "public", "function", "delete", "(", "$", "entity", ")", "{", "$", "event", "=", "new", "StorageEvent", "(", "$", "entity", ")", ";", "$", "this", "->", "event", "(", ")", "->", "dispatch", "(", "StorageEvents", "::", "PRE_DELETE", ",", "$", "event", ...
Deletes a single object. @param object $entity the entity to delete @return bool
[ "Deletes", "a", "single", "object", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Repository.php#L348-L362
bolt/bolt
src/Storage/Repository.php
Repository.save
public function save($entity, $silent = null) { try { if ($existing = $entity->getId()) { $creating = false; } else { $creating = true; } } catch (\Exception $e) { $creating = $existing = false; } if ($s...
php
public function save($entity, $silent = null) { try { if ($existing = $entity->getId()) { $creating = false; } else { $creating = true; } } catch (\Exception $e) { $creating = $existing = false; } if ($s...
[ "public", "function", "save", "(", "$", "entity", ",", "$", "silent", "=", "null", ")", "{", "try", "{", "if", "(", "$", "existing", "=", "$", "entity", "->", "getId", "(", ")", ")", "{", "$", "creating", "=", "false", ";", "}", "else", "{", "$...
Saves a single object. @param object $entity the entity to save @param bool $silent Suppress events @return bool
[ "Saves", "a", "single", "object", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Repository.php#L372-L400
bolt/bolt
src/Storage/Repository.php
Repository.insert
public function insert($entity) { $querySet = new QuerySet(); $qb = $this->em->createQueryBuilder(); $qb->insert($this->getTableName()); $querySet->append($qb); $this->persist($querySet, $entity, ['id']); $result = $querySet->execute(); // Try and set the en...
php
public function insert($entity) { $querySet = new QuerySet(); $qb = $this->em->createQueryBuilder(); $qb->insert($this->getTableName()); $querySet->append($qb); $this->persist($querySet, $entity, ['id']); $result = $querySet->execute(); // Try and set the en...
[ "public", "function", "insert", "(", "$", "entity", ")", "{", "$", "querySet", "=", "new", "QuerySet", "(", ")", ";", "$", "qb", "=", "$", "this", "->", "em", "->", "createQueryBuilder", "(", ")", ";", "$", "qb", "->", "insert", "(", "$", "this", ...
Saves a new object into the database. @param object $entity the entity to insert @return bool
[ "Saves", "a", "new", "object", "into", "the", "database", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Repository.php#L409-L426
bolt/bolt
src/Storage/Repository.php
Repository.update
public function update($entity, $exclusions = []) { $querySet = new QuerySet(); $querySet->setParentId($entity->getId()); $qb = $this->em->createQueryBuilder(); $qb->update($this->getTableName()) ->where('id = :id') ->setParameter('id', $entity->getId()); ...
php
public function update($entity, $exclusions = []) { $querySet = new QuerySet(); $querySet->setParentId($entity->getId()); $qb = $this->em->createQueryBuilder(); $qb->update($this->getTableName()) ->where('id = :id') ->setParameter('id', $entity->getId()); ...
[ "public", "function", "update", "(", "$", "entity", ",", "$", "exclusions", "=", "[", "]", ")", "{", "$", "querySet", "=", "new", "QuerySet", "(", ")", ";", "$", "querySet", "->", "setParentId", "(", "$", "entity", "->", "getId", "(", ")", ")", ";"...
Updates an object into the database. @param object $entity the entity to update @param string[] $exclusions Ignore updates to these fields @return bool
[ "Updates", "an", "object", "into", "the", "database", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Repository.php#L436-L448
bolt/bolt
src/Storage/Repository.php
Repository.hydrate
protected function hydrate(array $data, QueryBuilder $qb) { $entity = $this->getEntityBuilder()->getEntity(); $data = new ArrayObject($data); $preEventArgs = new HydrationEvent($data, ['entity' => $entity, 'repository' => $this]); $this->event()->dispatch(StorageEvents::PRE_HYDRATE,...
php
protected function hydrate(array $data, QueryBuilder $qb) { $entity = $this->getEntityBuilder()->getEntity(); $data = new ArrayObject($data); $preEventArgs = new HydrationEvent($data, ['entity' => $entity, 'repository' => $this]); $this->event()->dispatch(StorageEvents::PRE_HYDRATE,...
[ "protected", "function", "hydrate", "(", "array", "$", "data", ",", "QueryBuilder", "$", "qb", ")", "{", "$", "entity", "=", "$", "this", "->", "getEntityBuilder", "(", ")", "->", "getEntity", "(", ")", ";", "$", "data", "=", "new", "ArrayObject", "(",...
Internal method to hydrate an Entity Object from fetched data. @param array $data @param QueryBuilder $qb @return mixed
[ "Internal", "method", "to", "hydrate", "an", "Entity", "Object", "from", "fetched", "data", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Repository.php#L458-L472
bolt/bolt
src/Storage/Repository.php
Repository.hydrateAll
protected function hydrateAll(array $data, QueryBuilder $qb) { $rows = []; foreach ($data as $row) { $rows[] = $this->hydrate($row, $qb); } return $rows; }
php
protected function hydrateAll(array $data, QueryBuilder $qb) { $rows = []; foreach ($data as $row) { $rows[] = $this->hydrate($row, $qb); } return $rows; }
[ "protected", "function", "hydrateAll", "(", "array", "$", "data", ",", "QueryBuilder", "$", "qb", ")", "{", "$", "rows", "=", "[", "]", ";", "foreach", "(", "$", "data", "as", "$", "row", ")", "{", "$", "rows", "[", "]", "=", "$", "this", "->", ...
Internal method to hydrate an array of Entity Objects from fetched data. @param array $data @param QueryBuilder $qb @return mixed
[ "Internal", "method", "to", "hydrate", "an", "array", "of", "Entity", "Objects", "from", "fetched", "data", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Repository.php#L482-L490
bolt/bolt
src/Controller/Async/Widget.php
Widget.widget
public function widget(Request $request, $key) { if (!$widget = $this->app['asset.queue.widget']->get($key)) { return $this->abort(Response::HTTP_NOT_FOUND); } $authCookie = $request->cookies->get($this->app['token.authentication.name']); if ($widget->getZone() !== 'fron...
php
public function widget(Request $request, $key) { if (!$widget = $this->app['asset.queue.widget']->get($key)) { return $this->abort(Response::HTTP_NOT_FOUND); } $authCookie = $request->cookies->get($this->app['token.authentication.name']); if ($widget->getZone() !== 'fron...
[ "public", "function", "widget", "(", "Request", "$", "request", ",", "$", "key", ")", "{", "if", "(", "!", "$", "widget", "=", "$", "this", "->", "app", "[", "'asset.queue.widget'", "]", "->", "get", "(", "$", "key", ")", ")", "{", "return", "$", ...
Render a widget, and return the HTML, so it can be inserted in the page. @param Request $request @param string $key @return Response
[ "Render", "a", "widget", "and", "return", "the", "HTML", "so", "it", "can", "be", "inserted", "in", "the", "page", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Async/Widget.php#L47-L62
bolt/bolt
src/Translation/ContenttypesKeygen.php
ContenttypesKeygen.generateNamesDescription
private function generateNamesDescription() { foreach ($this->app['config']->get('contenttypes') as $ctname => $ctype) { $keyprefix = 'contenttypes.' . $this->slugifyKey($ctname) . '.'; // Names & description $setkeys = [ 'name.plural' => 'name', ...
php
private function generateNamesDescription() { foreach ($this->app['config']->get('contenttypes') as $ctname => $ctype) { $keyprefix = 'contenttypes.' . $this->slugifyKey($ctname) . '.'; // Names & description $setkeys = [ 'name.plural' => 'name', ...
[ "private", "function", "generateNamesDescription", "(", ")", "{", "foreach", "(", "$", "this", "->", "app", "[", "'config'", "]", "->", "get", "(", "'contenttypes'", ")", "as", "$", "ctname", "=>", "$", "ctype", ")", "{", "$", "keyprefix", "=", "'content...
Generates keys for contenttypes names and description and save found names for later usage.
[ "Generates", "keys", "for", "contenttypes", "names", "and", "description", "and", "save", "found", "names", "for", "later", "usage", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Translation/ContenttypesKeygen.php#L76-L111
bolt/bolt
src/Translation/ContenttypesKeygen.php
ContenttypesKeygen.generateGroups
private function generateGroups() { foreach ($this->app['config']->get('contenttypes') as $ctname => $ctype) { $keyprefix = 'contenttypes.' . $this->slugifyKey($ctname) . '.group.'; if (isset($ctype['groups']) && is_array($ctype['groups'])) { foreach ($ctype['groups'...
php
private function generateGroups() { foreach ($this->app['config']->get('contenttypes') as $ctname => $ctype) { $keyprefix = 'contenttypes.' . $this->slugifyKey($ctname) . '.group.'; if (isset($ctype['groups']) && is_array($ctype['groups'])) { foreach ($ctype['groups'...
[ "private", "function", "generateGroups", "(", ")", "{", "foreach", "(", "$", "this", "->", "app", "[", "'config'", "]", "->", "get", "(", "'contenttypes'", ")", "as", "$", "ctname", "=>", "$", "ctype", ")", "{", "$", "keyprefix", "=", "'contenttypes.'", ...
Generates keys for tab group names.
[ "Generates", "keys", "for", "tab", "group", "names", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Translation/ContenttypesKeygen.php#L116-L135
bolt/bolt
src/Translation/ContenttypesKeygen.php
ContenttypesKeygen.generateFromGeneric
private function generateFromGeneric() { $ctypes = $this->app['config']->get('contenttypes'); $translatables = array_filter( array_keys($this->translatables), function ($key) { return substr($key, 0, 21) === 'contenttypes.generic.' && substr($key, 21, 6) !== ...
php
private function generateFromGeneric() { $ctypes = $this->app['config']->get('contenttypes'); $translatables = array_filter( array_keys($this->translatables), function ($key) { return substr($key, 0, 21) === 'contenttypes.generic.' && substr($key, 21, 6) !== ...
[ "private", "function", "generateFromGeneric", "(", ")", "{", "$", "ctypes", "=", "$", "this", "->", "app", "[", "'config'", "]", "->", "get", "(", "'contenttypes'", ")", ";", "$", "translatables", "=", "array_filter", "(", "array_keys", "(", "$", "this", ...
Generates strings for contenttypes from generic translations.
[ "Generates", "strings", "for", "contenttypes", "from", "generic", "translations", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Translation/ContenttypesKeygen.php#L140-L170
bolt/bolt
src/Nut/Info.php
Info.execute
protected function execute(InputInterface $input, OutputInterface $output) { ob_start(); phpinfo(); $this->io->write(ob_get_clean()); return 0; }
php
protected function execute(InputInterface $input, OutputInterface $output) { ob_start(); phpinfo(); $this->io->write(ob_get_clean()); return 0; }
[ "protected", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "ob_start", "(", ")", ";", "phpinfo", "(", ")", ";", "$", "this", "->", "io", "->", "write", "(", "ob_get_clean", "(", ")", ")", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/Info.php#L27-L34
bolt/bolt
src/Storage/Repository/TaxonomyRepository.php
TaxonomyRepository.queryContentByTaxonomy
public function queryContentByTaxonomy($contentTypes, $taxonomyTypes) { $query = $this->createQueryBuilder(); $this->buildJoin($query, $contentTypes); $this->buildWhere($query, $taxonomyTypes); return $query; }
php
public function queryContentByTaxonomy($contentTypes, $taxonomyTypes) { $query = $this->createQueryBuilder(); $this->buildJoin($query, $contentTypes); $this->buildWhere($query, $taxonomyTypes); return $query; }
[ "public", "function", "queryContentByTaxonomy", "(", "$", "contentTypes", ",", "$", "taxonomyTypes", ")", "{", "$", "query", "=", "$", "this", "->", "createQueryBuilder", "(", ")", ";", "$", "this", "->", "buildJoin", "(", "$", "query", ",", "$", "contentT...
@param array $contentTypes @param array $taxonomyTypes @throws InvalidRepositoryException @return QueryBuilder
[ "@param", "array", "$contentTypes", "@param", "array", "$taxonomyTypes" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Repository/TaxonomyRepository.php#L22-L29
bolt/bolt
src/Storage/Repository/TaxonomyRepository.php
TaxonomyRepository.getContentByTaxonomy
public function getContentByTaxonomy(QueryBuilder $query) { $results = $query->execute()->fetchAll(); $set = new TaxonomyQueryResultset(); $set->setEntityManager($this->getEntityManager()); $set->add($results); $set->setOriginalQuery('getcontent', $query); $executeEve...
php
public function getContentByTaxonomy(QueryBuilder $query) { $results = $query->execute()->fetchAll(); $set = new TaxonomyQueryResultset(); $set->setEntityManager($this->getEntityManager()); $set->add($results); $set->setOriginalQuery('getcontent', $query); $executeEve...
[ "public", "function", "getContentByTaxonomy", "(", "QueryBuilder", "$", "query", ")", "{", "$", "results", "=", "$", "query", "->", "execute", "(", ")", "->", "fetchAll", "(", ")", ";", "$", "set", "=", "new", "TaxonomyQueryResultset", "(", ")", ";", "$"...
@param QueryBuilder $query @return TaxonomyQueryResultset
[ "@param", "QueryBuilder", "$query" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Repository/TaxonomyRepository.php#L36-L47
bolt/bolt
src/Storage/Repository/TaxonomyRepository.php
TaxonomyRepository.buildJoin
protected function buildJoin(QueryBuilder $query, $contentTypes) { $subQuery = '(SELECT '; $fragments = []; foreach ($contentTypes as $content) { $repo = $this->getEntityManager()->getRepository($content); $table = $repo->getTableName(); $fragments[] = "id...
php
protected function buildJoin(QueryBuilder $query, $contentTypes) { $subQuery = '(SELECT '; $fragments = []; foreach ($contentTypes as $content) { $repo = $this->getEntityManager()->getRepository($content); $table = $repo->getTableName(); $fragments[] = "id...
[ "protected", "function", "buildJoin", "(", "QueryBuilder", "$", "query", ",", "$", "contentTypes", ")", "{", "$", "subQuery", "=", "'(SELECT '", ";", "$", "fragments", "=", "[", "]", ";", "foreach", "(", "$", "contentTypes", "as", "$", "content", ")", "{...
@param QueryBuilder $query @param array $contentTypes @throws InvalidRepositoryException
[ "@param", "QueryBuilder", "$query", "@param", "array", "$contentTypes" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Repository/TaxonomyRepository.php#L55-L69
bolt/bolt
src/AccessControl/Permissions.php
Permissions.audit
private function audit($msg) { // Log the message if enabled if ($this->app['config']->get('general/debug_permission_audit_mode', false)) { $this->app['logger.system']->info($msg, ['event' => 'authentication']); } }
php
private function audit($msg) { // Log the message if enabled if ($this->app['config']->get('general/debug_permission_audit_mode', false)) { $this->app['logger.system']->info($msg, ['event' => 'authentication']); } }
[ "private", "function", "audit", "(", "$", "msg", ")", "{", "// Log the message if enabled", "if", "(", "$", "this", "->", "app", "[", "'config'", "]", "->", "get", "(", "'general/debug_permission_audit_mode'", ",", "false", ")", ")", "{", "$", "this", "->", ...
Write an entry to the permission audit log. @param string $msg
[ "Write", "an", "entry", "to", "the", "permission", "audit", "log", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/AccessControl/Permissions.php#L69-L75
bolt/bolt
src/AccessControl/Permissions.php
Permissions.getDefinedRoles
public function getDefinedRoles() { $roles = $this->app['config']->get('permissions/roles'); $roles[self::ROLE_ROOT] = [ 'label' => 'Root', 'description' => Trans::__('permissions.roles.description.root'), 'builtin' => true, ]; return $r...
php
public function getDefinedRoles() { $roles = $this->app['config']->get('permissions/roles'); $roles[self::ROLE_ROOT] = [ 'label' => 'Root', 'description' => Trans::__('permissions.roles.description.root'), 'builtin' => true, ]; return $r...
[ "public", "function", "getDefinedRoles", "(", ")", "{", "$", "roles", "=", "$", "this", "->", "app", "[", "'config'", "]", "->", "get", "(", "'permissions/roles'", ")", ";", "$", "roles", "[", "self", "::", "ROLE_ROOT", "]", "=", "[", "'label'", "=>", ...
Gets a list of all the roles that can be assigned to users explicitly. This includes all the custom roles from permissions.yml, plus the special 'root' role, but not the special roles 'anonymous', 'everyone', and 'owner' (these are assigned automatically). @return array
[ "Gets", "a", "list", "of", "all", "the", "roles", "that", "can", "be", "assigned", "to", "users", "explicitly", ".", "This", "includes", "all", "the", "custom", "roles", "from", "permissions", ".", "yml", "plus", "the", "special", "root", "role", "but", ...
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/AccessControl/Permissions.php#L85-L95
bolt/bolt
src/AccessControl/Permissions.php
Permissions.getRole
public function getRole($roleName) { switch ($roleName) { case self::ROLE_ANONYMOUS: return [ 'label' => Trans::__('permissions.roles.label.anonymous'), 'description' => Trans::__('permissions.roles.description.anonymous'), ...
php
public function getRole($roleName) { switch ($roleName) { case self::ROLE_ANONYMOUS: return [ 'label' => Trans::__('permissions.roles.label.anonymous'), 'description' => Trans::__('permissions.roles.description.anonymous'), ...
[ "public", "function", "getRole", "(", "$", "roleName", ")", "{", "switch", "(", "$", "roleName", ")", "{", "case", "self", "::", "ROLE_ANONYMOUS", ":", "return", "[", "'label'", "=>", "Trans", "::", "__", "(", "'permissions.roles.label.anonymous'", ")", ",",...
Gets meta-information on the specified role. @param string $roleName @return array An associative array describing the role. Keys are: - 'label': A human-readable role name, suitable as a label in the backend - 'description': A description of what this role is supposed to do. - 'builtin': Optional; if present and tru...
[ "Gets", "meta", "-", "information", "on", "the", "specified", "role", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/AccessControl/Permissions.php#L109-L141
bolt/bolt
src/AccessControl/Permissions.php
Permissions.getUserRoles
public function getUserRoles($user, Content $content = null) { $userRoleNames = $user['roles']; if (!is_array($userRoleNames)) { throw new AccessControlException('Expected a user-like array, but the "roles" property is not an array'); } $userRoleNames[] = self::ROLE_EVERY...
php
public function getUserRoles($user, Content $content = null) { $userRoleNames = $user['roles']; if (!is_array($userRoleNames)) { throw new AccessControlException('Expected a user-like array, but the "roles" property is not an array'); } $userRoleNames[] = self::ROLE_EVERY...
[ "public", "function", "getUserRoles", "(", "$", "user", ",", "Content", "$", "content", "=", "null", ")", "{", "$", "userRoleNames", "=", "$", "user", "[", "'roles'", "]", ";", "if", "(", "!", "is_array", "(", "$", "userRoleNames", ")", ")", "{", "th...
Gets the roles for a given user. If a content type is specified, the "owner" role is added if appropriate. @param array $user An array as returned by Users::getUser() @param Content $content An optional Content object to check ownership @throws AccessControlException @return array An associative array of roles ...
[ "Gets", "the", "roles", "for", "a", "given", "user", ".", "If", "a", "content", "type", "is", "specified", "the", "owner", "role", "is", "added", "if", "appropriate", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/AccessControl/Permissions.php#L154-L177
bolt/bolt
src/AccessControl/Permissions.php
Permissions.getManipulatableRoles
public function getManipulatableRoles(array $currentUser) { $manipulatableRoles = []; foreach ($this->getDefinedRoles() as $roleName => $role) { if ($this->checkPermission($currentUser['roles'], 'manipulate', 'roles-hierarchy', $roleName)) { $manipulatableRoles[] = $role...
php
public function getManipulatableRoles(array $currentUser) { $manipulatableRoles = []; foreach ($this->getDefinedRoles() as $roleName => $role) { if ($this->checkPermission($currentUser['roles'], 'manipulate', 'roles-hierarchy', $roleName)) { $manipulatableRoles[] = $role...
[ "public", "function", "getManipulatableRoles", "(", "array", "$", "currentUser", ")", "{", "$", "manipulatableRoles", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "getDefinedRoles", "(", ")", "as", "$", "roleName", "=>", "$", "role", ")", "{", ...
Gets the roles the current user can manipulate. @param array $currentUser @return string[] list of role names
[ "Gets", "the", "roles", "the", "current", "user", "can", "manipulate", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/AccessControl/Permissions.php#L186-L197
bolt/bolt
src/AccessControl/Permissions.php
Permissions.checkPermission
public function checkPermission($roleNames, $permissionName, $type = null, $item = null) { // Handle BC if ($type !== null && $item === null) { $item = $type; $type = 'contenttype'; } if (is_array($item) && isset($item['username'])) { $itemStr = s...
php
public function checkPermission($roleNames, $permissionName, $type = null, $item = null) { // Handle BC if ($type !== null && $item === null) { $item = $type; $type = 'contenttype'; } if (is_array($item) && isset($item['username'])) { $itemStr = s...
[ "public", "function", "checkPermission", "(", "$", "roleNames", ",", "$", "permissionName", ",", "$", "type", "=", "null", ",", "$", "item", "=", "null", ")", "{", "// Handle BC", "if", "(", "$", "type", "!==", "null", "&&", "$", "item", "===", "null",...
Low-level permission check. Given a set of available roles, a permission, and an optional content type, this method checks whether the permission may be granted. @param array $roleNames An array of effective role names. This must include any of the appropriate automatic roles, as these are not added at this poin...
[ "Low", "-", "level", "permission", "check", ".", "Given", "a", "set", "of", "available", "roles", "a", "permission", "and", "an", "optional", "content", "type", "this", "method", "checks", "whether", "the", "permission", "may", "be", "granted", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/AccessControl/Permissions.php#L226-L278
bolt/bolt
src/AccessControl/Permissions.php
Permissions.checkRolePermission
private function checkRolePermission($roleName, $permissionName, $type = 'global', $item = null) { if ($type === 'global') { return $this->checkRoleGlobalPermission($roleName, $permissionName); } elseif ($type === 'roles-hierarchy') { return $this->checkRoleHierarchyPermissio...
php
private function checkRolePermission($roleName, $permissionName, $type = 'global', $item = null) { if ($type === 'global') { return $this->checkRoleGlobalPermission($roleName, $permissionName); } elseif ($type === 'roles-hierarchy') { return $this->checkRoleHierarchyPermissio...
[ "private", "function", "checkRolePermission", "(", "$", "roleName", ",", "$", "permissionName", ",", "$", "type", "=", "'global'", ",", "$", "item", "=", "null", ")", "{", "if", "(", "$", "type", "===", "'global'", ")", "{", "return", "$", "this", "->"...
Checks whether the specified $roleName grants permission $permissionName for the $contenttype in question (NULL for global permissions). @param string $roleName @param string $permissionName @param string $type @param mixed $item @return bool
[ "Checks", "whether", "the", "specified", "$roleName", "grants", "permission", "$permissionName", "for", "the", "$contenttype", "in", "question", "(", "NULL", "for", "global", "permissions", ")", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/AccessControl/Permissions.php#L291-L302
bolt/bolt
src/AccessControl/Permissions.php
Permissions.checkRoleGlobalPermission
private function checkRoleGlobalPermission($roleName, $permissionName) { $roles = $this->getRolesByGlobalPermission($permissionName); if (!is_array($roles)) { // We log it, unless the permission name is 'root'. if ($roleName !== self::ROLE_ROOT) { $this->app['...
php
private function checkRoleGlobalPermission($roleName, $permissionName) { $roles = $this->getRolesByGlobalPermission($permissionName); if (!is_array($roles)) { // We log it, unless the permission name is 'root'. if ($roleName !== self::ROLE_ROOT) { $this->app['...
[ "private", "function", "checkRoleGlobalPermission", "(", "$", "roleName", ",", "$", "permissionName", ")", "{", "$", "roles", "=", "$", "this", "->", "getRolesByGlobalPermission", "(", "$", "permissionName", ")", ";", "if", "(", "!", "is_array", "(", "$", "r...
Check if a given role has the specified permission. @param string $roleName @param string $permissionName @return bool
[ "Check", "if", "a", "given", "role", "has", "the", "specified", "permission", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/AccessControl/Permissions.php#L312-L328
bolt/bolt
src/AccessControl/Permissions.php
Permissions.checkRoleHierarchyPermission
private function checkRoleHierarchyPermission($roleName, $permissionName, $role) { // Can current user manipulate role? if (is_string($role)) { $permissions = $this->app['config']->get("permissions/roles-hierarchy/$permissionName/$role", []); return in_array($roleName, $perm...
php
private function checkRoleHierarchyPermission($roleName, $permissionName, $role) { // Can current user manipulate role? if (is_string($role)) { $permissions = $this->app['config']->get("permissions/roles-hierarchy/$permissionName/$role", []); return in_array($roleName, $perm...
[ "private", "function", "checkRoleHierarchyPermission", "(", "$", "roleName", ",", "$", "permissionName", ",", "$", "role", ")", "{", "// Can current user manipulate role?", "if", "(", "is_string", "(", "$", "role", ")", ")", "{", "$", "permissions", "=", "$", ...
Check if a hierarchy role has a sub-role. @param string $roleName @param string $permissionName @param string|array $role @return bool
[ "Check", "if", "a", "hierarchy", "role", "has", "a", "sub", "-", "role", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/AccessControl/Permissions.php#L339-L358
bolt/bolt
src/AccessControl/Permissions.php
Permissions.checkRoleContentTypePermission
private function checkRoleContentTypePermission($roleName, $permissionName, $contenttype) { // Actions on non-existing contenttypes are not allowed. if (!$this->app['storage.metadata']->createContentType($contenttype)) { return false; } $roles = $this->getRolesByContentT...
php
private function checkRoleContentTypePermission($roleName, $permissionName, $contenttype) { // Actions on non-existing contenttypes are not allowed. if (!$this->app['storage.metadata']->createContentType($contenttype)) { return false; } $roles = $this->getRolesByContentT...
[ "private", "function", "checkRoleContentTypePermission", "(", "$", "roleName", ",", "$", "permissionName", ",", "$", "contenttype", ")", "{", "// Actions on non-existing contenttypes are not allowed.", "if", "(", "!", "$", "this", "->", "app", "[", "'storage.metadata'",...
Check if a role has a specific Contenttype permission. @param string $roleName @param string $permissionName @param string $contenttype @throws \Bolt\Exception\StorageException @return bool
[ "Check", "if", "a", "role", "has", "a", "specific", "Contenttype", "permission", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/AccessControl/Permissions.php#L371-L381
bolt/bolt
src/AccessControl/Permissions.php
Permissions.getContentTypeUserPermissions
public function getContentTypeUserPermissions($contentTypeSlug, $user) { $permissions = []; foreach (array_keys($this->contentTypePermissions) as $contentTypePermission) { $permissions[$contentTypePermission] = $this->isAllowed($contentTypePermission, $user, $contentTypeSlug); } ...
php
public function getContentTypeUserPermissions($contentTypeSlug, $user) { $permissions = []; foreach (array_keys($this->contentTypePermissions) as $contentTypePermission) { $permissions[$contentTypePermission] = $this->isAllowed($contentTypePermission, $user, $contentTypeSlug); } ...
[ "public", "function", "getContentTypeUserPermissions", "(", "$", "contentTypeSlug", ",", "$", "user", ")", "{", "$", "permissions", "=", "[", "]", ";", "foreach", "(", "array_keys", "(", "$", "this", "->", "contentTypePermissions", ")", "as", "$", "contentType...
Return a list of ContentType permissions that a user has for the ContentType. @param string $contentTypeSlug @param array|Entity\Users $user @return bool[]
[ "Return", "a", "list", "of", "ContentType", "permissions", "that", "a", "user", "has", "for", "the", "ContentType", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/AccessControl/Permissions.php#L401-L409
bolt/bolt
src/AccessControl/Permissions.php
Permissions.getRolesByContentTypePermission
public function getRolesByContentTypePermission($permissionName, $contenttype) { // Here's how it works: // - if a permission is granted through 'contenttype-all', it is effectively granted // - if a permission is granted through 'contenttypes/$contenttype', it is effectively granted ...
php
public function getRolesByContentTypePermission($permissionName, $contenttype) { // Here's how it works: // - if a permission is granted through 'contenttype-all', it is effectively granted // - if a permission is granted through 'contenttypes/$contenttype', it is effectively granted ...
[ "public", "function", "getRolesByContentTypePermission", "(", "$", "permissionName", ",", "$", "contenttype", ")", "{", "// Here's how it works:", "// - if a permission is granted through 'contenttype-all', it is effectively granted", "// - if a permission is granted through 'contenttypes/...
Lists the roles that would grant the specified permission for the specified content type. Sort of a reverse lookup on the permission check. @param string $permissionName @param string $contenttype @return array
[ "Lists", "the", "roles", "that", "would", "grant", "the", "specified", "permission", "for", "the", "specified", "content", "type", ".", "Sort", "of", "a", "reverse", "lookup", "on", "the", "permission", "check", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/AccessControl/Permissions.php#L443-L464
bolt/bolt
src/AccessControl/Permissions.php
Permissions.getEffectiveRolesForUser
public function getEffectiveRolesForUser($user) { if (isset($user['roles']) && is_array($user['roles'])) { $userRoles = $user['roles']; $userRoles[] = self::ROLE_EVERYONE; } else { $userRoles = []; } $userRoles[] = self::ROLE_ANONYMOUS; re...
php
public function getEffectiveRolesForUser($user) { if (isset($user['roles']) && is_array($user['roles'])) { $userRoles = $user['roles']; $userRoles[] = self::ROLE_EVERYONE; } else { $userRoles = []; } $userRoles[] = self::ROLE_ANONYMOUS; re...
[ "public", "function", "getEffectiveRolesForUser", "(", "$", "user", ")", "{", "if", "(", "isset", "(", "$", "user", "[", "'roles'", "]", ")", "&&", "is_array", "(", "$", "user", "[", "'roles'", "]", ")", ")", "{", "$", "userRoles", "=", "$", "user", ...
Gets the effective roles for a given user. The effective roles include the roles that were explicitly assigned, as well as the built-in automatic roles. @param mixed $user an array or array-access object that contains a 'roles' key; if no user is given, "guest" access is assumed @return array a list of effective role...
[ "Gets", "the", "effective", "roles", "for", "a", "given", "user", ".", "The", "effective", "roles", "include", "the", "roles", "that", "were", "explicitly", "assigned", "as", "well", "as", "the", "built", "-", "in", "automatic", "roles", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/AccessControl/Permissions.php#L477-L488
bolt/bolt
src/AccessControl/Permissions.php
Permissions.isAllowed
public function isAllowed($what, $user, $content = null, $contentId = null) { if (is_array($content)) { $contenttypeSlug = $content['slug']; } elseif ($content instanceof \Bolt\Legacy\Content) { $contenttypeSlug = $content->contenttype['slug']; } else { $c...
php
public function isAllowed($what, $user, $content = null, $contentId = null) { if (is_array($content)) { $contenttypeSlug = $content['slug']; } elseif ($content instanceof \Bolt\Legacy\Content) { $contenttypeSlug = $content->contenttype['slug']; } else { $c...
[ "public", "function", "isAllowed", "(", "$", "what", ",", "$", "user", ",", "$", "content", "=", "null", ",", "$", "contentId", "=", "null", ")", "{", "if", "(", "is_array", "(", "$", "content", ")", ")", "{", "$", "contenttypeSlug", "=", "$", "con...
Runs a permission check. Permissions are encoded as strings, where the ':' character acts as a separator for dynamic parts and sub-permissions. Apart from the route-based rules defined in permissions.yml, the following special cases are available:. "overview:$contenttype" - view the overview for the content type. Alia...
[ "Runs", "a", "permission", "check", ".", "Permissions", "are", "encoded", "as", "strings", "where", "the", ":", "character", "acts", "as", "a", "separator", "for", "dynamic", "parts", "and", "sub", "-", "permissions", ".", "Apart", "from", "the", "route", ...
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/AccessControl/Permissions.php#L529-L570
bolt/bolt
src/AccessControl/Permissions.php
Permissions.isAllowedRule
private function isAllowedRule($rule, $user, $userRoles, $content, $contenttypeSlug, $contentid) { switch ($rule['type']) { case PermissionParser::P_TRUE: return true; case PermissionParser::P_FALSE: return false; case PermissionParser::P_S...
php
private function isAllowedRule($rule, $user, $userRoles, $content, $contenttypeSlug, $contentid) { switch ($rule['type']) { case PermissionParser::P_TRUE: return true; case PermissionParser::P_FALSE: return false; case PermissionParser::P_S...
[ "private", "function", "isAllowedRule", "(", "$", "rule", ",", "$", "user", ",", "$", "userRoles", ",", "$", "content", ",", "$", "contenttypeSlug", ",", "$", "contentid", ")", "{", "switch", "(", "$", "rule", "[", "'type'", "]", ")", "{", "case", "P...
Check if a user is allowed a rule 'type'. @param array $rule @param array $user @param array $userRoles @param string|array|Content $content @param string $contenttypeSlug @param int $contentid @throws AccessControlException @return bool
[ "Check", "if", "a", "user", "is", "allowed", "a", "rule", "type", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/AccessControl/Permissions.php#L586-L614
bolt/bolt
src/AccessControl/Permissions.php
Permissions.isAllowedSingle
private function isAllowedSingle($what, $user, $userRoles, $content = null, $contenttypeSlug = null, $contentId = null) { if ($content !== null) { $parts = [ 'contenttype', $contenttypeSlug, $what, $contentId, ]; ...
php
private function isAllowedSingle($what, $user, $userRoles, $content = null, $contenttypeSlug = null, $contentId = null) { if ($content !== null) { $parts = [ 'contenttype', $contenttypeSlug, $what, $contentId, ]; ...
[ "private", "function", "isAllowedSingle", "(", "$", "what", ",", "$", "user", ",", "$", "userRoles", ",", "$", "content", "=", "null", ",", "$", "contenttypeSlug", "=", "null", ",", "$", "contentId", "=", "null", ")", "{", "if", "(", "$", "content", ...
Check if a user has a specific role. @param string $what @param array $user @param array $userRoles @param string|array|Content $content @param string $contenttypeSlug @param int $contentId @return bool
[ "Check", "if", "a", "user", "has", "a", "specific", "role", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/AccessControl/Permissions.php#L628-L722
bolt/bolt
src/AccessControl/Permissions.php
Permissions.getContentStatusTransitionPermission
public function getContentStatusTransitionPermission($fromStatus, $toStatus) { // No change: no special permission required. if ($fromStatus === $toStatus) { return null; } switch ($toStatus) { case 'draft': case 'held': return empt...
php
public function getContentStatusTransitionPermission($fromStatus, $toStatus) { // No change: no special permission required. if ($fromStatus === $toStatus) { return null; } switch ($toStatus) { case 'draft': case 'held': return empt...
[ "public", "function", "getContentStatusTransitionPermission", "(", "$", "fromStatus", ",", "$", "toStatus", ")", "{", "// No change: no special permission required.", "if", "(", "$", "fromStatus", "===", "$", "toStatus", ")", "{", "return", "null", ";", "}", "switch...
Gets the required permission for transitioning any content item from one status to another. An empty status value indicates a non-existant item (create/delete). @param string $fromStatus @param string $toStatus @throws AccessControlException @return string|null The name of the required permission suffix (e.g. 'publi...
[ "Gets", "the", "required", "permission", "for", "transitioning", "any", "content", "item", "from", "one", "status", "to", "another", ".", "An", "empty", "status", "value", "indicates", "a", "non", "-", "existant", "item", "(", "create", "/", "delete", ")", ...
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/AccessControl/Permissions.php#L737-L756
bolt/bolt
src/AccessControl/Permissions.php
Permissions.isContentStatusTransitionAllowed
public function isContentStatusTransitionAllowed($fromStatus, $toStatus, $user, $contenttype, $contentid = null) { $perm = $this->getContentStatusTransitionPermission($fromStatus, $toStatus); if ($perm === null) { // Bypass permission check if no actual transition is to happen ...
php
public function isContentStatusTransitionAllowed($fromStatus, $toStatus, $user, $contenttype, $contentid = null) { $perm = $this->getContentStatusTransitionPermission($fromStatus, $toStatus); if ($perm === null) { // Bypass permission check if no actual transition is to happen ...
[ "public", "function", "isContentStatusTransitionAllowed", "(", "$", "fromStatus", ",", "$", "toStatus", ",", "$", "user", ",", "$", "contenttype", ",", "$", "contentid", "=", "null", ")", "{", "$", "perm", "=", "$", "this", "->", "getContentStatusTransitionPer...
Check to see if a user is allowed to change that status of a Contenttype record to a target status. @param string $fromStatus @param string $toStatus @param array $user @param string $contenttype @param int $contentid @return bool
[ "Check", "to", "see", "if", "a", "user", "is", "allowed", "to", "change", "that", "status", "of", "a", "Contenttype", "record", "to", "a", "target", "status", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/AccessControl/Permissions.php#L770-L779
bolt/bolt
src/Nut/ServerRun.php
ServerRun.execute
protected function execute(InputInterface $input, OutputInterface $output) { $address = $input->getArgument('address'); if (strpos($address, ':') === false) { $address .= ':' . $input->getOption('port'); } if ($this->isOtherServerProcessRunning($address)) { $...
php
protected function execute(InputInterface $input, OutputInterface $output) { $address = $input->getArgument('address'); if (strpos($address, ':') === false) { $address .= ':' . $input->getOption('port'); } if ($this->isOtherServerProcessRunning($address)) { $...
[ "protected", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "$", "address", "=", "$", "input", "->", "getArgument", "(", "'address'", ")", ";", "if", "(", "strpos", "(", "$", "address", ",", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/ServerRun.php#L37-L75
bolt/bolt
src/Nut/ServerRun.php
ServerRun.createServerProcess
protected function createServerProcess($address, $webDir, $router) { if (!file_exists($router)) { $this->io->error(sprintf('The router script "%s" does not exist', $router)); return null; } $finder = new PhpExecutableFinder(); if (($binary = $finder->find())...
php
protected function createServerProcess($address, $webDir, $router) { if (!file_exists($router)) { $this->io->error(sprintf('The router script "%s" does not exist', $router)); return null; } $finder = new PhpExecutableFinder(); if (($binary = $finder->find())...
[ "protected", "function", "createServerProcess", "(", "$", "address", ",", "$", "webDir", ",", "$", "router", ")", "{", "if", "(", "!", "file_exists", "(", "$", "router", ")", ")", "{", "$", "this", "->", "io", "->", "error", "(", "sprintf", "(", "'Th...
@param string $address @param string $webDir @param string $router @return null|\Symfony\Component\Process\Process
[ "@param", "string", "$address", "@param", "string", "$webDir", "@param", "string", "$router" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/ServerRun.php#L84-L107
bolt/bolt
src/Twig/Runtime/UserRuntime.php
UserRuntime.getUserId
public function getUserId($who) { $user = $this->users->getUser($who); if (isset($user['id'])) { return $user['id']; } return false; }
php
public function getUserId($who) { $user = $this->users->getUser($who); if (isset($user['id'])) { return $user['id']; } return false; }
[ "public", "function", "getUserId", "(", "$", "who", ")", "{", "$", "user", "=", "$", "this", "->", "users", "->", "getUser", "(", "$", "who", ")", ";", "if", "(", "isset", "(", "$", "user", "[", "'id'", "]", ")", ")", "{", "return", "$", "user"...
Get an id number for a user, based on the given name. Returns an integer id on success, and false otherwise. @param string $who @return mixed
[ "Get", "an", "id", "number", "for", "a", "user", "based", "on", "the", "given", "name", ".", "Returns", "an", "integer", "id", "on", "success", "and", "false", "otherwise", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/Runtime/UserRuntime.php#L54-L63
bolt/bolt
src/Twig/Runtime/UserRuntime.php
UserRuntime.isAllowed
public function isAllowed($what, $content = null) { $contenttype = null; $contentid = null; if ($content instanceof \Bolt\Legacy\Content) { // It's a Legacy content record $contenttype = $content; $contentid = $content['id']; } elseif ($content ins...
php
public function isAllowed($what, $content = null) { $contenttype = null; $contentid = null; if ($content instanceof \Bolt\Legacy\Content) { // It's a Legacy content record $contenttype = $content; $contentid = $content['id']; } elseif ($content ins...
[ "public", "function", "isAllowed", "(", "$", "what", ",", "$", "content", "=", "null", ")", "{", "$", "contenttype", "=", "null", ";", "$", "contentid", "=", "null", ";", "if", "(", "$", "content", "instanceof", "\\", "Bolt", "\\", "Legacy", "\\", "C...
Check if a certain action is allowed for the current user (and possibly content item). @param string $what Operation @param mixed $content if specified, a Content item @return bool True if allowed
[ "Check", "if", "a", "certain", "action", "is", "allowed", "for", "the", "current", "user", "(", "and", "possibly", "content", "item", ")", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/Runtime/UserRuntime.php#L74-L93
bolt/bolt
src/Storage/Database/Prefill/Builder.php
Builder.build
public function build(array $contentTypeNames, $count, $canExceedMax = false) { $response = MutableBag::fromRecursive(['created' => [], 'errors' => [], 'warnings' => []]); foreach ($contentTypeNames as $contentTypeName) { try { $existingCount = $this->storage->getReposito...
php
public function build(array $contentTypeNames, $count, $canExceedMax = false) { $response = MutableBag::fromRecursive(['created' => [], 'errors' => [], 'warnings' => []]); foreach ($contentTypeNames as $contentTypeName) { try { $existingCount = $this->storage->getReposito...
[ "public", "function", "build", "(", "array", "$", "contentTypeNames", ",", "$", "count", ",", "$", "canExceedMax", "=", "false", ")", "{", "$", "response", "=", "MutableBag", "::", "fromRecursive", "(", "[", "'created'", "=>", "[", "]", ",", "'errors'", ...
Build up-to 'n' number of pre-filled ContentType records. @param array $contentTypeNames @param int $count @param bool $canExceedMax @return MutableBag
[ "Build", "up", "-", "to", "n", "number", "of", "pre", "-", "filled", "ContentType", "records", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Database/Prefill/Builder.php#L53-L90
bolt/bolt
src/Extension/DatabaseSchemaTrait.php
DatabaseSchemaTrait.extendDatabaseSchemaServices
final protected function extendDatabaseSchemaServices() { $app = $this->getContainer(); $app['schema.extension_tables'] = $app->share( $app->extend( 'schema.extension_tables', function (Container $tables) use ($app) { /** @var \Doctrin...
php
final protected function extendDatabaseSchemaServices() { $app = $this->getContainer(); $app['schema.extension_tables'] = $app->share( $app->extend( 'schema.extension_tables', function (Container $tables) use ($app) { /** @var \Doctrin...
[ "final", "protected", "function", "extendDatabaseSchemaServices", "(", ")", "{", "$", "app", "=", "$", "this", "->", "getContainer", "(", ")", ";", "$", "app", "[", "'schema.extension_tables'", "]", "=", "$", "app", "->", "share", "(", "$", "app", "->", ...
Call this in register method. @internal
[ "Call", "this", "in", "register", "method", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Extension/DatabaseSchemaTrait.php#L35-L55
bolt/bolt
src/Configuration/Validation/Apache.php
Apache.check
public function check() { $request = Request::createFromGlobals(); $serverSoftware = $request->server->get('SERVER_SOFTWARE', ''); $isApache = strpos($serverSoftware, 'Apache') !== false; if (!$isApache) { return; } $path = $this->pathResolver->resolve('%...
php
public function check() { $request = Request::createFromGlobals(); $serverSoftware = $request->server->get('SERVER_SOFTWARE', ''); $isApache = strpos($serverSoftware, 'Apache') !== false; if (!$isApache) { return; } $path = $this->pathResolver->resolve('%...
[ "public", "function", "check", "(", ")", "{", "$", "request", "=", "Request", "::", "createFromGlobals", "(", ")", ";", "$", "serverSoftware", "=", "$", "request", "->", "server", "->", "get", "(", "'SERVER_SOFTWARE'", ",", "''", ")", ";", "$", "isApache...
This check looks for the presence of the .htaccess file inside the web directory. It is here only as a convenience check for users that install the basic version of Bolt. {@inheritdoc}
[ "This", "check", "looks", "for", "the", "presence", "of", "the", ".", "htaccess", "file", "inside", "the", "web", "directory", ".", "It", "is", "here", "only", "as", "a", "convenience", "check", "for", "users", "that", "install", "the", "basic", "version",...
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Configuration/Validation/Apache.php#L25-L40
bolt/bolt
src/Events/AccessControlEvent.php
AccessControlEvent.setReason
public function setReason($reason) { if ($this->dispatched) { throw new \RuntimeException('Attempting to set reason after dispatch.'); } $this->reason = $reason; $this->dispatched = true; return $this; }
php
public function setReason($reason) { if ($this->dispatched) { throw new \RuntimeException('Attempting to set reason after dispatch.'); } $this->reason = $reason; $this->dispatched = true; return $this; }
[ "public", "function", "setReason", "(", "$", "reason", ")", "{", "if", "(", "$", "this", "->", "dispatched", ")", "{", "throw", "new", "\\", "RuntimeException", "(", "'Attempting to set reason after dispatch.'", ")", ";", "}", "$", "this", "->", "reason", "=...
@internal @param int $reason @return AccessControlEvent
[ "@internal" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Events/AccessControlEvent.php#L64-L73
bolt/bolt
src/Controller/Backend/Log.php
Log.changeRecord
public function changeRecord(Request $request, $contenttype, $contentid, $id) { $entry = $this->changeLogRepository()->getChangeLogEntry($contenttype, $contentid, $id, '='); if (empty($entry)) { $error = Trans::__('logs.change-log.not-found'); $this->abort(Response::HTTP_NOT...
php
public function changeRecord(Request $request, $contenttype, $contentid, $id) { $entry = $this->changeLogRepository()->getChangeLogEntry($contenttype, $contentid, $id, '='); if (empty($entry)) { $error = Trans::__('logs.change-log.not-found'); $this->abort(Response::HTTP_NOT...
[ "public", "function", "changeRecord", "(", "Request", "$", "request", ",", "$", "contenttype", ",", "$", "contentid", ",", "$", "id", ")", "{", "$", "entry", "=", "$", "this", "->", "changeLogRepository", "(", ")", "->", "getChangeLogEntry", "(", "$", "c...
Show a single change log entry. @param Request $request @param string $contenttype ContentType slug @param int $contentid Content record ID @param int $id The change log entry ID @return \Bolt\Response\TemplateResponse
[ "Show", "a", "single", "change", "log", "entry", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Backend/Log.php#L86-L105
bolt/bolt
src/Controller/Backend/Log.php
Log.changeRecordListing
public function changeRecordListing(Request $request, $contenttype, $contentid) { // We have to handle three cases here: // - $contenttype and $contentid given: get changelog entries for *one* content item // - only $contenttype given: get changelog entries for all items of that type ...
php
public function changeRecordListing(Request $request, $contenttype, $contentid) { // We have to handle three cases here: // - $contenttype and $contentid given: get changelog entries for *one* content item // - only $contenttype given: get changelog entries for all items of that type ...
[ "public", "function", "changeRecordListing", "(", "Request", "$", "request", ",", "$", "contenttype", ",", "$", "contentid", ")", "{", "// We have to handle three cases here:", "// - $contenttype and $contentid given: get changelog entries for *one* content item", "// - only $conte...
Show a list of changelog entries. @param Request $request @param string $contenttype ContentType slug @param int $contentid Content record ID @return \Bolt\Response\TemplateResponse
[ "Show", "a", "list", "of", "changelog", "entries", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Backend/Log.php#L116-L151
bolt/bolt
src/Controller/Backend/Log.php
Log.systemOverview
public function systemOverview(Request $request) { $action = $request->query->get('action'); if ($action == 'clear') { $this->manager()->clear('system'); $this->flashes()->success(Trans::__('logs.system-log.cleared')); return $this->redirectToRoute('systemlog');...
php
public function systemOverview(Request $request) { $action = $request->query->get('action'); if ($action == 'clear') { $this->manager()->clear('system'); $this->flashes()->success(Trans::__('logs.system-log.cleared')); return $this->redirectToRoute('systemlog');...
[ "public", "function", "systemOverview", "(", "Request", "$", "request", ")", "{", "$", "action", "=", "$", "request", "->", "query", "->", "get", "(", "'action'", ")", ";", "if", "(", "$", "action", "==", "'clear'", ")", "{", "$", "this", "->", "mana...
System log overview route. @param Request $request @return \Bolt\Response\TemplateResponse|\Symfony\Component\HttpFoundation\RedirectResponse
[ "System", "log", "overview", "route", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Backend/Log.php#L160-L187
bolt/bolt
src/Controller/Backend/Log.php
Log.getPagination
private function getPagination($page) { $limit = 5; if ($page !== null) { if ($page === 'all') { $limit = null; $page = null; } else { $page = (int) $page; } } else { $page = 1; } ...
php
private function getPagination($page) { $limit = 5; if ($page !== null) { if ($page === 'all') { $limit = null; $page = null; } else { $page = (int) $page; } } else { $page = 1; } ...
[ "private", "function", "getPagination", "(", "$", "page", ")", "{", "$", "limit", "=", "5", ";", "if", "(", "$", "page", "!==", "null", ")", "{", "if", "(", "$", "page", "===", "'all'", ")", "{", "$", "limit", "=", "null", ";", "$", "page", "="...
Calculate pagination parameters. @param int|string|null $page @return array
[ "Calculate", "pagination", "parameters", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Backend/Log.php#L220-L235
bolt/bolt
src/Controller/Backend/Log.php
Log.getQueryOptions
private function getQueryOptions($pagination) { // Some options that are the same for all three cases $options = [ 'order' => 'date', 'direction' => 'DESC', ]; if ($pagination['limit']) { $options['limit'] = $pagination['limit']; } ...
php
private function getQueryOptions($pagination) { // Some options that are the same for all three cases $options = [ 'order' => 'date', 'direction' => 'DESC', ]; if ($pagination['limit']) { $options['limit'] = $pagination['limit']; } ...
[ "private", "function", "getQueryOptions", "(", "$", "pagination", ")", "{", "// Some options that are the same for all three cases", "$", "options", "=", "[", "'order'", "=>", "'date'", ",", "'direction'", "=>", "'DESC'", ",", "]", ";", "if", "(", "$", "pagination...
Calculate the query options. @param array $pagination @return array
[ "Calculate", "the", "query", "options", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Backend/Log.php#L244-L260
bolt/bolt
src/Nut/RouterMatch.php
RouterMatch.execute
protected function execute(InputInterface $input, OutputInterface $output) { if ($this->app instanceof Application) { $this->app->flush(); } /** @var RouteCollection $router */ $router = $this->app['routes']; $context = new RequestContext($input->getArgument('pat...
php
protected function execute(InputInterface $input, OutputInterface $output) { if ($this->app instanceof Application) { $this->app->flush(); } /** @var RouteCollection $router */ $router = $this->app['routes']; $context = new RequestContext($input->getArgument('pat...
[ "protected", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "if", "(", "$", "this", "->", "app", "instanceof", "Application", ")", "{", "$", "this", "->", "app", "->", "flush", "(", ")", ";", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/RouterMatch.php#L51-L99
bolt/bolt
src/Filesystem/Listing.php
Listing.getDirectories
public function getDirectories($showHidden = false) { $it = $this->getContents(); return array_filter($it, function (HandlerInterface $handler) use ($showHidden) { return $handler->isDir() && ($showHidden ?: strpos($handler->getFilename(), '.') !== 0); }); }
php
public function getDirectories($showHidden = false) { $it = $this->getContents(); return array_filter($it, function (HandlerInterface $handler) use ($showHidden) { return $handler->isDir() && ($showHidden ?: strpos($handler->getFilename(), '.') !== 0); }); }
[ "public", "function", "getDirectories", "(", "$", "showHidden", "=", "false", ")", "{", "$", "it", "=", "$", "this", "->", "getContents", "(", ")", ";", "return", "array_filter", "(", "$", "it", ",", "function", "(", "HandlerInterface", "$", "handler", "...
Return the directories content listing of the requested target. @param bool $showHidden True to show hidden (dot) files @throws Exception\IOException @return DirectoryInterface[]
[ "Return", "the", "directories", "content", "listing", "of", "the", "requested", "target", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Filesystem/Listing.php#L42-L49
bolt/bolt
src/Filesystem/Listing.php
Listing.getFiles
public function getFiles($showHidden = false) { $it = $this->getContents(); return array_filter($it, function (HandlerInterface $handler) use ($showHidden) { return $handler->isFile() && ($showHidden ?: strpos($handler->getFilename(), '.') !== 0); }); }
php
public function getFiles($showHidden = false) { $it = $this->getContents(); return array_filter($it, function (HandlerInterface $handler) use ($showHidden) { return $handler->isFile() && ($showHidden ?: strpos($handler->getFilename(), '.') !== 0); }); }
[ "public", "function", "getFiles", "(", "$", "showHidden", "=", "false", ")", "{", "$", "it", "=", "$", "this", "->", "getContents", "(", ")", ";", "return", "array_filter", "(", "$", "it", ",", "function", "(", "HandlerInterface", "$", "handler", ")", ...
Return the files content listing of the requested target. @param bool $showHidden True to show hidden (dot) files @throws Exception\IOException @return FileInterface[]
[ "Return", "the", "files", "content", "listing", "of", "the", "requested", "target", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Filesystem/Listing.php#L60-L67
bolt/bolt
src/Filesystem/Listing.php
Listing.getContents
private function getContents() { if ($this->contents) { return $this->contents; } return $this->contents = $this->directory->getContents(); }
php
private function getContents() { if ($this->contents) { return $this->contents; } return $this->contents = $this->directory->getContents(); }
[ "private", "function", "getContents", "(", ")", "{", "if", "(", "$", "this", "->", "contents", ")", "{", "return", "$", "this", "->", "contents", ";", "}", "return", "$", "this", "->", "contents", "=", "$", "this", "->", "directory", "->", "getContents...
Lazy load & cache the directory contents. @return HandlerInterface[]
[ "Lazy", "load", "&", "cache", "the", "directory", "contents", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Filesystem/Listing.php#L89-L96
bolt/bolt
src/Events/StorageEvent.php
StorageEvent.getContentType
public function getContentType() { $contentType = $this->getSubject()->contenttype; if ($contentType !== null && isset($contentType['slug'])) { return $contentType['slug']; } return null; }
php
public function getContentType() { $contentType = $this->getSubject()->contenttype; if ($contentType !== null && isset($contentType['slug'])) { return $contentType['slug']; } return null; }
[ "public", "function", "getContentType", "(", ")", "{", "$", "contentType", "=", "$", "this", "->", "getSubject", "(", ")", "->", "contenttype", ";", "if", "(", "$", "contentType", "!==", "null", "&&", "isset", "(", "$", "contentType", "[", "'slug'", "]",...
Return the record's ContentType name. @return string
[ "Return", "the", "record", "s", "ContentType", "name", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Events/StorageEvent.php#L71-L79
bolt/bolt
src/Filesystem/Plugin/HasUrl.php
HasUrl.handle
public function handle($path) { try { $this->filesystem->url($path); } catch (\Exception $e) { return false; } return true; }
php
public function handle($path) { try { $this->filesystem->url($path); } catch (\Exception $e) { return false; } return true; }
[ "public", "function", "handle", "(", "$", "path", ")", "{", "try", "{", "$", "this", "->", "filesystem", "->", "url", "(", "$", "path", ")", ";", "}", "catch", "(", "\\", "Exception", "$", "e", ")", "{", "return", "false", ";", "}", "return", "tr...
Determine if the path has a url. @param string $path @return bool
[ "Determine", "if", "the", "path", "has", "a", "url", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Filesystem/Plugin/HasUrl.php#L29-L38
bolt/bolt
src/Composer/Action/SearchPackage.php
SearchPackage.execute
public function execute($packages, $onlyname = true) { /** @var \Composer\Composer $composer */ $composer = $this->getComposer(); $io = $this->getIO(); $platformRepo = new PlatformRepository(); if ($composer) { $localRepo = $composer->getRepositoryManager()->get...
php
public function execute($packages, $onlyname = true) { /** @var \Composer\Composer $composer */ $composer = $this->getComposer(); $io = $this->getIO(); $platformRepo = new PlatformRepository(); if ($composer) { $localRepo = $composer->getRepositoryManager()->get...
[ "public", "function", "execute", "(", "$", "packages", ",", "$", "onlyname", "=", "true", ")", "{", "/** @var \\Composer\\Composer $composer */", "$", "composer", "=", "$", "this", "->", "getComposer", "(", ")", ";", "$", "io", "=", "$", "this", "->", "get...
Search for packages. @param array $packages Indexed array of package names to search for @param bool $onlyname True for name only search, false for full text @throws PackageManagerException @return array List of matching packages
[ "Search", "for", "packages", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/Action/SearchPackage.php#L28-L58
bolt/bolt
src/Routing/LazyUrlGenerator.php
LazyUrlGenerator.generate
public function generate($name, $parameters = [], $referenceType = self::ABSOLUTE_PATH) { return $this->getUrlGenerator()->generate($name, $parameters, $referenceType); }
php
public function generate($name, $parameters = [], $referenceType = self::ABSOLUTE_PATH) { return $this->getUrlGenerator()->generate($name, $parameters, $referenceType); }
[ "public", "function", "generate", "(", "$", "name", ",", "$", "parameters", "=", "[", "]", ",", "$", "referenceType", "=", "self", "::", "ABSOLUTE_PATH", ")", "{", "return", "$", "this", "->", "getUrlGenerator", "(", ")", "->", "generate", "(", "$", "n...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Routing/LazyUrlGenerator.php#L66-L69
bolt/bolt
src/Composer/Satis/PingService.php
PingService.ping
public function ping($addQuery = false, $debugClient = false) { try { $this->doPing($addQuery, $debugClient); return true; } catch (ClientException $e) { // Thrown for 400 level errors $this->messages[] = Trans::__( 'page.extend.error-...
php
public function ping($addQuery = false, $debugClient = false) { try { $this->doPing($addQuery, $debugClient); return true; } catch (ClientException $e) { // Thrown for 400 level errors $this->messages[] = Trans::__( 'page.extend.error-...
[ "public", "function", "ping", "(", "$", "addQuery", "=", "false", ",", "$", "debugClient", "=", "false", ")", "{", "try", "{", "$", "this", "->", "doPing", "(", "$", "addQuery", ",", "$", "debugClient", ")", ";", "return", "true", ";", "}", "catch", ...
Ping site to see if we have a valid connection and it is responding correctly. @param bool $addQuery
[ "Ping", "site", "to", "see", "if", "we", "have", "a", "valid", "connection", "and", "it", "is", "responding", "correctly", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/Satis/PingService.php#L52-L85
bolt/bolt
src/Composer/Satis/PingService.php
PingService.doPing
private function doPing($addQuery, $debugClient) { if ($this->requestStack->getCurrentRequest() !== null) { $www = $this->requestStack->getCurrentRequest()->server->get('SERVER_SOFTWARE', 'unknown'); } else { $www = 'unknown'; } $query = !$addQuery ? [] : [ ...
php
private function doPing($addQuery, $debugClient) { if ($this->requestStack->getCurrentRequest() !== null) { $www = $this->requestStack->getCurrentRequest()->server->get('SERVER_SOFTWARE', 'unknown'); } else { $www = 'unknown'; } $query = !$addQuery ? [] : [ ...
[ "private", "function", "doPing", "(", "$", "addQuery", ",", "$", "debugClient", ")", "{", "if", "(", "$", "this", "->", "requestStack", "->", "getCurrentRequest", "(", ")", "!==", "null", ")", "{", "$", "www", "=", "$", "this", "->", "requestStack", "-...
@param bool $addQuery @param bool $debugClient @throws ClientException @throws ServerException @throws RequestException
[ "@param", "bool", "$addQuery", "@param", "bool", "$debugClient" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/Satis/PingService.php#L103-L126
bolt/bolt
src/Storage/Field/Collection/RepeatingFieldCollection.php
RepeatingFieldCollection.addFromArray
public function addFromArray(array $fields, $grouping = 0, $entity = null, $block = null) { $collection = new FieldCollection(); $collection->setGrouping($grouping); $collection->setBlock($block); foreach ($fields as $name => $value) { $storageTypeHandler = $this->getFiel...
php
public function addFromArray(array $fields, $grouping = 0, $entity = null, $block = null) { $collection = new FieldCollection(); $collection->setGrouping($grouping); $collection->setBlock($block); foreach ($fields as $name => $value) { $storageTypeHandler = $this->getFiel...
[ "public", "function", "addFromArray", "(", "array", "$", "fields", ",", "$", "grouping", "=", "0", ",", "$", "entity", "=", "null", ",", "$", "block", "=", "null", ")", "{", "$", "collection", "=", "new", "FieldCollection", "(", ")", ";", "$", "colle...
@param array $fields @param int $grouping @param object $entity @param string $block @throws FieldConfigurationException
[ "@param", "array", "$fields", "@param", "int", "$grouping", "@param", "object", "$entity", "@param", "string", "$block" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Field/Collection/RepeatingFieldCollection.php#L65-L97
bolt/bolt
src/Storage/Field/Collection/RepeatingFieldCollection.php
RepeatingFieldCollection.getOriginal
public function getOriginal($entity) { $entities = $this->flatten(); foreach ($entities as $existing) { if ( $existing->getName() == $entity->getName() && $existing->getGrouping() == $entity->getGrouping() && $existing->getFieldname() == $e...
php
public function getOriginal($entity) { $entities = $this->flatten(); foreach ($entities as $existing) { if ( $existing->getName() == $entity->getName() && $existing->getGrouping() == $entity->getGrouping() && $existing->getFieldname() == $e...
[ "public", "function", "getOriginal", "(", "$", "entity", ")", "{", "$", "entities", "=", "$", "this", "->", "flatten", "(", ")", ";", "foreach", "(", "$", "entities", "as", "$", "existing", ")", "{", "if", "(", "$", "existing", "->", "getName", "(", ...
This loops over the existing collection to see if the properties in the incoming are already available on a saved record. @param object $entity @return mixed|null
[ "This", "loops", "over", "the", "existing", "collection", "to", "see", "if", "the", "properties", "in", "the", "incoming", "are", "already", "available", "on", "a", "saved", "record", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Field/Collection/RepeatingFieldCollection.php#L118-L133
bolt/bolt
src/Storage/Field/Collection/RepeatingFieldCollection.php
RepeatingFieldCollection.update
public function update(RepeatingFieldCollection $collection) { $updated = []; // First give priority to already existing entities foreach ($collection->flatten() as $entity) { $master = $this->getOriginal($entity); $master->setValue($entity->getValue()); $...
php
public function update(RepeatingFieldCollection $collection) { $updated = []; // First give priority to already existing entities foreach ($collection->flatten() as $entity) { $master = $this->getOriginal($entity); $master->setValue($entity->getValue()); $...
[ "public", "function", "update", "(", "RepeatingFieldCollection", "$", "collection", ")", "{", "$", "updated", "=", "[", "]", ";", "// First give priority to already existing entities", "foreach", "(", "$", "collection", "->", "flatten", "(", ")", "as", "$", "entit...
@param RepeatingFieldCollection $collection @return RepeatingFieldCollection[]
[ "@param", "RepeatingFieldCollection", "$collection" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Field/Collection/RepeatingFieldCollection.php#L140-L167
bolt/bolt
src/Storage/Field/Collection/RepeatingFieldCollection.php
RepeatingFieldCollection.getFieldType
protected function getFieldType($field, $block = null) { if ($block !== null && !isset($this->mapping['data']['fields'][$block]['fields'][$field]['fieldtype'])) { throw new FieldConfigurationException('Invalid repeating field configuration for ' . $field); } if ($block === null ...
php
protected function getFieldType($field, $block = null) { if ($block !== null && !isset($this->mapping['data']['fields'][$block]['fields'][$field]['fieldtype'])) { throw new FieldConfigurationException('Invalid repeating field configuration for ' . $field); } if ($block === null ...
[ "protected", "function", "getFieldType", "(", "$", "field", ",", "$", "block", "=", "null", ")", "{", "if", "(", "$", "block", "!==", "null", "&&", "!", "isset", "(", "$", "this", "->", "mapping", "[", "'data'", "]", "[", "'fields'", "]", "[", "$",...
@param string $field @param string|null $block @throws FieldConfigurationException @return FieldTypeBase
[ "@param", "string", "$field", "@param", "string|null", "$block" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Field/Collection/RepeatingFieldCollection.php#L232-L251
bolt/bolt
src/Storage/Field/Collection/RepeatingFieldCollection.php
RepeatingFieldCollection.getFieldTypeName
protected function getFieldTypeName($field, $block = null) { if ($block !== null && !isset($this->mapping['data']['fields'][$block]['fields'][$field]['type'])) { throw new FieldConfigurationException('Invalid repeating field configuration for ' . $field); } if ($block === null &...
php
protected function getFieldTypeName($field, $block = null) { if ($block !== null && !isset($this->mapping['data']['fields'][$block]['fields'][$field]['type'])) { throw new FieldConfigurationException('Invalid repeating field configuration for ' . $field); } if ($block === null &...
[ "protected", "function", "getFieldTypeName", "(", "$", "field", ",", "$", "block", "=", "null", ")", "{", "if", "(", "$", "block", "!==", "null", "&&", "!", "isset", "(", "$", "this", "->", "mapping", "[", "'data'", "]", "[", "'fields'", "]", "[", ...
@param string $field @param null $block @throws FieldConfigurationException @return mixed
[ "@param", "string", "$field", "@param", "null", "$block" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Field/Collection/RepeatingFieldCollection.php#L261-L278
bolt/bolt
src/Twig/SetcontentTokenParser.php
SetcontentTokenParser.parse
public function parse(Token $token) { $lineno = $token->getLine(); $arguments = new ArrayExpression([], $lineno); $whereArguments = []; // name - the new variable with the results $name = $this->parser->getStream()->expect(Token::NAME_TYPE)->getValue(); $this->parse...
php
public function parse(Token $token) { $lineno = $token->getLine(); $arguments = new ArrayExpression([], $lineno); $whereArguments = []; // name - the new variable with the results $name = $this->parser->getStream()->expect(Token::NAME_TYPE)->getValue(); $this->parse...
[ "public", "function", "parse", "(", "Token", "$", "token", ")", "{", "$", "lineno", "=", "$", "token", "->", "getLine", "(", ")", ";", "$", "arguments", "=", "new", "ArrayExpression", "(", "[", "]", ",", "$", "lineno", ")", ";", "$", "whereArguments"...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/SetcontentTokenParser.php#L35-L121
bolt/bolt
src/Storage/ContentRequest/Listing.php
Listing.action
public function action($contentTypeSlug, ListingOptions $options) { // Order has to be set carefully. Either set it explicitly when the user // sorts, or fall back to what's defined in the ContentType. Except for // a ContentType that has a "grouping taxonomy", as that should override ...
php
public function action($contentTypeSlug, ListingOptions $options) { // Order has to be set carefully. Either set it explicitly when the user // sorts, or fall back to what's defined in the ContentType. Except for // a ContentType that has a "grouping taxonomy", as that should override ...
[ "public", "function", "action", "(", "$", "contentTypeSlug", ",", "ListingOptions", "$", "options", ")", "{", "// Order has to be set carefully. Either set it explicitly when the user", "// sorts, or fall back to what's defined in the ContentType. Except for", "// a ContentType that has ...
Fetch a listing of ContentType records. @param string $contentTypeSlug @param ListingOptions $options @return Content|false
[ "Fetch", "a", "listing", "of", "ContentType", "records", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/ContentRequest/Listing.php#L52-L91
bolt/bolt
src/Storage/ContentRequest/Listing.php
Listing.getContent
protected function getContent($contentTypeSlug, array $contentParameters, ListingOptions $options) { $contentParameters = array_filter($contentParameters); $records = $this->query->getContent($contentTypeSlug, $contentParameters); if ($records === null && $options->getPage() !== null) { ...
php
protected function getContent($contentTypeSlug, array $contentParameters, ListingOptions $options) { $contentParameters = array_filter($contentParameters); $records = $this->query->getContent($contentTypeSlug, $contentParameters); if ($records === null && $options->getPage() !== null) { ...
[ "protected", "function", "getContent", "(", "$", "contentTypeSlug", ",", "array", "$", "contentParameters", ",", "ListingOptions", "$", "options", ")", "{", "$", "contentParameters", "=", "array_filter", "(", "$", "contentParameters", ")", ";", "$", "records", "...
Get the content records, and fallback a page if none found. @param string $contentTypeSlug @param array $contentParameters @param ListingOptions $options @return Content|false
[ "Get", "the", "content", "records", "and", "fallback", "a", "page", "if", "none", "found", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/ContentRequest/Listing.php#L102-L116
bolt/bolt
src/Storage/ContentRequest/Listing.php
Listing.runGroupSort
protected function runGroupSort($results) { if (!$results instanceof QueryResultset) { return $results; } $grouped = []; $resultTaxOrders = []; foreach ($results as $result) { $taxGroup = null; foreach ($result->getTaxonomy() as $taxonomy) ...
php
protected function runGroupSort($results) { if (!$results instanceof QueryResultset) { return $results; } $grouped = []; $resultTaxOrders = []; foreach ($results as $result) { $taxGroup = null; foreach ($result->getTaxonomy() as $taxonomy) ...
[ "protected", "function", "runGroupSort", "(", "$", "results", ")", "{", "if", "(", "!", "$", "results", "instanceof", "QueryResultset", ")", "{", "return", "$", "results", ";", "}", "$", "grouped", "=", "[", "]", ";", "$", "resultTaxOrders", "=", "[", ...
@param $results @return QueryResultset|array
[ "@param", "$results" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/ContentRequest/Listing.php#L151-L189
bolt/bolt
src/EventListener/ExceptionListener.php
ExceptionListener.onBootException
public function onBootException(GetResponseForExceptionEvent $event) { if ($this->isProfilerRequest($event->getRequest())) { return; } $exception = $event->getException(); if ($exception instanceof BootException) { $event->setResponse($exception->getResponse(...
php
public function onBootException(GetResponseForExceptionEvent $event) { if ($this->isProfilerRequest($event->getRequest())) { return; } $exception = $event->getException(); if ($exception instanceof BootException) { $event->setResponse($exception->getResponse(...
[ "public", "function", "onBootException", "(", "GetResponseForExceptionEvent", "$", "event", ")", "{", "if", "(", "$", "this", "->", "isProfilerRequest", "(", "$", "event", "->", "getRequest", "(", ")", ")", ")", "{", "return", ";", "}", "$", "exception", "...
Handle boot initialisation exceptions. @param GetResponseForExceptionEvent $event
[ "Handle", "boot", "initialisation", "exceptions", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/EventListener/ExceptionListener.php#L105-L115
bolt/bolt
src/EventListener/ExceptionListener.php
ExceptionListener.onKernelException
public function onKernelException(GetResponseForExceptionEvent $event) { if ($this->isProfilerRequest($event->getRequest())) { return; } $exception = $event->getException(); if ($exception instanceof DatabaseExceptionInterface) { $html = $this->renderDatabas...
php
public function onKernelException(GetResponseForExceptionEvent $event) { if ($this->isProfilerRequest($event->getRequest())) { return; } $exception = $event->getException(); if ($exception instanceof DatabaseExceptionInterface) { $html = $this->renderDatabas...
[ "public", "function", "onKernelException", "(", "GetResponseForExceptionEvent", "$", "event", ")", "{", "if", "(", "$", "this", "->", "isProfilerRequest", "(", "$", "event", "->", "getRequest", "(", ")", ")", ")", "{", "return", ";", "}", "$", "exception", ...
Handle errors thrown in the application. @param GetResponseForExceptionEvent $event
[ "Handle", "errors", "thrown", "in", "the", "application", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/EventListener/ExceptionListener.php#L122-L144
bolt/bolt
src/EventListener/ExceptionListener.php
ExceptionListener.getContext
protected function getContext(\Exception $exception = null) { if ($exception) { $this->saveException($exception); } $loggedOnUser = (bool) $this->users->getCurrentUser() ?: false; $showLoggedOff = (bool) $this->config->get('general/debug_show_loggedoff', false); ...
php
protected function getContext(\Exception $exception = null) { if ($exception) { $this->saveException($exception); } $loggedOnUser = (bool) $this->users->getCurrentUser() ?: false; $showLoggedOff = (bool) $this->config->get('general/debug_show_loggedoff', false); ...
[ "protected", "function", "getContext", "(", "\\", "Exception", "$", "exception", "=", "null", ")", "{", "if", "(", "$", "exception", ")", "{", "$", "this", "->", "saveException", "(", "$", "exception", ")", ";", "}", "$", "loggedOnUser", "=", "(", "boo...
Get a pre-packaged Twig context array. @param \Exception $exception @return array
[ "Get", "a", "pre", "-", "packaged", "Twig", "context", "array", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/EventListener/ExceptionListener.php#L225-L268
bolt/bolt
src/EventListener/ExceptionListener.php
ExceptionListener.getSafeTrace
protected function getSafeTrace(\Exception $exception) { if (!$this->debug && !($this->session->isStarted() && $this->session->has('authentication'))) { return []; } $trace = $exception->getTrace(); foreach ($trace as $key => $value) { $trace[$key]['args_safe...
php
protected function getSafeTrace(\Exception $exception) { if (!$this->debug && !($this->session->isStarted() && $this->session->has('authentication'))) { return []; } $trace = $exception->getTrace(); foreach ($trace as $key => $value) { $trace[$key]['args_safe...
[ "protected", "function", "getSafeTrace", "(", "\\", "Exception", "$", "exception", ")", "{", "if", "(", "!", "$", "this", "->", "debug", "&&", "!", "(", "$", "this", "->", "session", "->", "isStarted", "(", ")", "&&", "$", "this", "->", "session", "-...
Get an exception trace that is safe to display publicly. @param \Exception $exception @return array
[ "Get", "an", "exception", "trace", "that", "is", "safe", "to", "display", "publicly", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/EventListener/ExceptionListener.php#L277-L295
bolt/bolt
src/EventListener/ExceptionListener.php
ExceptionListener.getSafeArguments
protected function getSafeArguments(array $args) { $argsSafe = []; foreach ($args as $arg) { $type = gettype($arg); switch ($type) { case 'string': $argsSafe[] = sprintf('<span>"%s"</span>', Html::trimText($arg, 30)); br...
php
protected function getSafeArguments(array $args) { $argsSafe = []; foreach ($args as $arg) { $type = gettype($arg); switch ($type) { case 'string': $argsSafe[] = sprintf('<span>"%s"</span>', Html::trimText($arg, 30)); br...
[ "protected", "function", "getSafeArguments", "(", "array", "$", "args", ")", "{", "$", "argsSafe", "=", "[", "]", ";", "foreach", "(", "$", "args", "as", "$", "arg", ")", "{", "$", "type", "=", "gettype", "(", "$", "arg", ")", ";", "switch", "(", ...
Get an array of safe (sanitised) function arguments from a trace entry. @param array $args @return array
[ "Get", "an", "array", "of", "safe", "(", "sanitised", ")", "function", "arguments", "from", "a", "trace", "entry", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/EventListener/ExceptionListener.php#L304-L335
bolt/bolt
src/EventListener/ExceptionListener.php
ExceptionListener.saveException
protected function saveException(\Exception $exception) { if ($this->debug !== true) { return; } $serialised = Serialization::dump(FlattenException::create($exception)); $sourceFile = str_replace($this->rootPath, '', $exception->getFile()); $sourceFile = substr(...
php
protected function saveException(\Exception $exception) { if ($this->debug !== true) { return; } $serialised = Serialization::dump(FlattenException::create($exception)); $sourceFile = str_replace($this->rootPath, '', $exception->getFile()); $sourceFile = substr(...
[ "protected", "function", "saveException", "(", "\\", "Exception", "$", "exception", ")", "{", "if", "(", "$", "this", "->", "debug", "!==", "true", ")", "{", "return", ";", "}", "$", "serialised", "=", "Serialization", "::", "dump", "(", "FlattenException"...
Attempt to save the serialised exception if in debug mode. @param \Exception $exception
[ "Attempt", "to", "save", "the", "serialised", "exception", "if", "in", "debug", "mode", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/EventListener/ExceptionListener.php#L342-L360
bolt/bolt
src/Storage/NamingStrategy.php
NamingStrategy.classToTableName
public function classToTableName($className) { $className = $this->getRelativeClass($className); $className = ltrim(strtolower(preg_replace('/[A-Z]/', '_$0', $className)), '_'); return $this->prefix . $className; }
php
public function classToTableName($className) { $className = $this->getRelativeClass($className); $className = ltrim(strtolower(preg_replace('/[A-Z]/', '_$0', $className)), '_'); return $this->prefix . $className; }
[ "public", "function", "classToTableName", "(", "$", "className", ")", "{", "$", "className", "=", "$", "this", "->", "getRelativeClass", "(", "$", "className", ")", ";", "$", "className", "=", "ltrim", "(", "strtolower", "(", "preg_replace", "(", "'/[A-Z]/'"...
Takes either a global or absolute class name and returns an underscored table name. @param string $className @return string
[ "Takes", "either", "a", "global", "or", "absolute", "class", "name", "and", "returns", "an", "underscored", "table", "name", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/NamingStrategy.php#L26-L32
bolt/bolt
src/Storage/NamingStrategy.php
NamingStrategy.classToAlias
public function classToAlias($className) { $className = $this->getRelativeClass($className); return ltrim(strtolower(preg_replace('/[A-Z]/', '_$0', $className)), '_'); }
php
public function classToAlias($className) { $className = $this->getRelativeClass($className); return ltrim(strtolower(preg_replace('/[A-Z]/', '_$0', $className)), '_'); }
[ "public", "function", "classToAlias", "(", "$", "className", ")", "{", "$", "className", "=", "$", "this", "->", "getRelativeClass", "(", "$", "className", ")", ";", "return", "ltrim", "(", "strtolower", "(", "preg_replace", "(", "'/[A-Z]/'", ",", "'_$0'", ...
Creates an automatic alias from a class name. @param string $className @return string
[ "Creates", "an", "automatic", "alias", "from", "a", "class", "name", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/NamingStrategy.php#L41-L46
bolt/bolt
src/Storage/NamingStrategy.php
NamingStrategy.getRelativeClass
public function getRelativeClass($className) { if (strpos($className, '\\') !== false) { $className = substr($className, strrpos($className, '\\') + 1); } return $className; }
php
public function getRelativeClass($className) { if (strpos($className, '\\') !== false) { $className = substr($className, strrpos($className, '\\') + 1); } return $className; }
[ "public", "function", "getRelativeClass", "(", "$", "className", ")", "{", "if", "(", "strpos", "(", "$", "className", ",", "'\\\\'", ")", "!==", "false", ")", "{", "$", "className", "=", "substr", "(", "$", "className", ",", "strrpos", "(", "$", "clas...
Returns a class name with namespaces removed. @param string $className @return string
[ "Returns", "a", "class", "name", "with", "namespaces", "removed", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/NamingStrategy.php#L55-L62
bolt/bolt
src/Configuration/Check/EmailSetup.php
EmailSetup.setOptions
public function setOptions(array $options) { $this->options = array_merge($this->options, $options); // Turn off the spool as we're only sending one message, and we don't // want to flush via the event listener as that fires on // KernelEvents::TERMINATE and we are unable to trap th...
php
public function setOptions(array $options) { $this->options = array_merge($this->options, $options); // Turn off the spool as we're only sending one message, and we don't // want to flush via the event listener as that fires on // KernelEvents::TERMINATE and we are unable to trap th...
[ "public", "function", "setOptions", "(", "array", "$", "options", ")", "{", "$", "this", "->", "options", "=", "array_merge", "(", "$", "this", "->", "options", ",", "$", "options", ")", ";", "// Turn off the spool as we're only sending one message, and we don't", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Configuration/Check/EmailSetup.php#L24-L34
bolt/bolt
src/Configuration/Check/EmailSetup.php
EmailSetup.runCheck
public function runCheck() { if ($this->checkMailOptions()) { return $this->results; } if (empty($this->options['host']) || $this->options['host'] === 'localhost') { $this->options['host'] = gethostname(); } // Create an email $mailhtml = $th...
php
public function runCheck() { if ($this->checkMailOptions()) { return $this->results; } if (empty($this->options['host']) || $this->options['host'] === 'localhost') { $this->options['host'] = gethostname(); } // Create an email $mailhtml = $th...
[ "public", "function", "runCheck", "(", ")", "{", "if", "(", "$", "this", "->", "checkMailOptions", "(", ")", ")", "{", "return", "$", "this", "->", "results", ";", "}", "if", "(", "empty", "(", "$", "this", "->", "options", "[", "'host'", "]", ")",...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Configuration/Check/EmailSetup.php#L39-L58
bolt/bolt
src/Configuration/Check/EmailSetup.php
EmailSetup.getEmailHtml
private function getEmailHtml() { return $this->app['twig']->render( 'email/pingtest.twig', [ 'sitename' => $this->app['config']->get('general/sitename'), 'user' => $this->options['user']['displayname'], 'ip' => $this->options...
php
private function getEmailHtml() { return $this->app['twig']->render( 'email/pingtest.twig', [ 'sitename' => $this->app['config']->get('general/sitename'), 'user' => $this->options['user']['displayname'], 'ip' => $this->options...
[ "private", "function", "getEmailHtml", "(", ")", "{", "return", "$", "this", "->", "app", "[", "'twig'", "]", "->", "render", "(", "'email/pingtest.twig'", ",", "[", "'sitename'", "=>", "$", "this", "->", "app", "[", "'config'", "]", "->", "get", "(", ...
Render HTML for the sample email. @return string
[ "Render", "HTML", "for", "the", "sample", "email", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Configuration/Check/EmailSetup.php#L87-L97
bolt/bolt
src/Configuration/Check/EmailSetup.php
EmailSetup.sendMessage
private function sendMessage($senderMail, $senderName, $mailhtml) { try { $message = $this->app['mailer'] ->createMessage('message') ->setSubject('Test email from ' . $this->app['config']->get('general/sitename')) ->setFrom([$senderMail ...
php
private function sendMessage($senderMail, $senderName, $mailhtml) { try { $message = $this->app['mailer'] ->createMessage('message') ->setSubject('Test email from ' . $this->app['config']->get('general/sitename')) ->setFrom([$senderMail ...
[ "private", "function", "sendMessage", "(", "$", "senderMail", ",", "$", "senderName", ",", "$", "mailhtml", ")", "{", "try", "{", "$", "message", "=", "$", "this", "->", "app", "[", "'mailer'", "]", "->", "createMessage", "(", "'message'", ")", "->", "...
Attempt to send the email message. @param string $senderMail @param string $senderName @param string $mailhtml
[ "Attempt", "to", "send", "the", "email", "message", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Configuration/Check/EmailSetup.php#L106-L130
bolt/bolt
src/Form/FormType/UserEditType.php
UserEditType.buildForm
public function buildForm(FormBuilderInterface $builder, array $options) { parent::buildForm($builder, $options); $this ->addUserName($builder) ->addPassword($builder, $options['password']) ->addEmail($builder) ->addDisplayName($builder) -...
php
public function buildForm(FormBuilderInterface $builder, array $options) { parent::buildForm($builder, $options); $this ->addUserName($builder) ->addPassword($builder, $options['password']) ->addEmail($builder) ->addDisplayName($builder) -...
[ "public", "function", "buildForm", "(", "FormBuilderInterface", "$", "builder", ",", "array", "$", "options", ")", "{", "parent", "::", "buildForm", "(", "$", "builder", ",", "$", "options", ")", ";", "$", "this", "->", "addUserName", "(", "$", "builder", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Form/FormType/UserEditType.php#L19-L34
bolt/bolt
src/Configuration/YamlUpdater.php
YamlUpdater.get
public function get($key, $throwEx = false) { // Make $throwEx true by default in v4.0 if ($throwEx && !$this->parsed->hasPath($key)) { throw new \InvalidArgumentException(sprintf("The key '%s' was not found in %s.", $key, $this->file->getFullPath())); } $value = $this->...
php
public function get($key, $throwEx = false) { // Make $throwEx true by default in v4.0 if ($throwEx && !$this->parsed->hasPath($key)) { throw new \InvalidArgumentException(sprintf("The key '%s' was not found in %s.", $key, $this->file->getFullPath())); } $value = $this->...
[ "public", "function", "get", "(", "$", "key", ",", "$", "throwEx", "=", "false", ")", "{", "// Make $throwEx true by default in v4.0", "if", "(", "$", "throwEx", "&&", "!", "$", "this", "->", "parsed", "->", "hasPath", "(", "$", "key", ")", ")", "{", "...
Return a value for a key from the yml file. @param string $key @param bool $throwEx throw exception if key is not found @return mixed|string
[ "Return", "a", "value", "for", "a", "key", "from", "the", "yml", "file", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Configuration/YamlUpdater.php#L78-L92