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/Configuration/YamlUpdater.php
YamlUpdater.change
public function change($key, $value, $backup = true) { $yaml = $this->lines->join("\n"); $pattern = '/^' . str_replace('/', ':.*?', $key) . '(:\s*)/mis'; preg_match($pattern, $yaml, $matches, PREG_OFFSET_CAPTURE); if (!$matches) { // Throw exception by default in v4.0 in...
php
public function change($key, $value, $backup = true) { $yaml = $this->lines->join("\n"); $pattern = '/^' . str_replace('/', ':.*?', $key) . '(:\s*)/mis'; preg_match($pattern, $yaml, $matches, PREG_OFFSET_CAPTURE); if (!$matches) { // Throw exception by default in v4.0 in...
[ "public", "function", "change", "(", "$", "key", ",", "$", "value", ",", "$", "backup", "=", "true", ")", "{", "$", "yaml", "=", "$", "this", "->", "lines", "->", "join", "(", "\"\\n\"", ")", ";", "$", "pattern", "=", "'/^'", ".", "str_replace", ...
Updates a single value with replacement for given key in yml file. @param string $key @param string|array $value @param bool $backup @return bool
[ "Updates", "a", "single", "value", "with", "replacement", "for", "given", "key", "in", "yml", "file", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Configuration/YamlUpdater.php#L103-L126
bolt/bolt
src/Configuration/YamlUpdater.php
YamlUpdater.save
protected function save($backup) { $yaml = $this->lines->join("\n"); Yaml::parse($yaml, true, true); if ($backup) { $this->file->copy($this->file->getPath() . '.' . date('Ymd-His')); } $this->file->update($yaml); }
php
protected function save($backup) { $yaml = $this->lines->join("\n"); Yaml::parse($yaml, true, true); if ($backup) { $this->file->copy($this->file->getPath() . '.' . date('Ymd-His')); } $this->file->update($yaml); }
[ "protected", "function", "save", "(", "$", "backup", ")", "{", "$", "yaml", "=", "$", "this", "->", "lines", "->", "join", "(", "\"\\n\"", ")", ";", "Yaml", "::", "parse", "(", "$", "yaml", ",", "true", ",", "true", ")", ";", "if", "(", "$", "b...
Save our modified .yml file. @param bool $backup Back up the file before committing changes to it @throws IOException @throws ParseException
[ "Save", "our", "modified", ".", "yml", "file", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Configuration/YamlUpdater.php#L150-L161
bolt/bolt
src/Request/ProfilerAwareTrait.php
ProfilerAwareTrait.isProfilerRequest
protected function isProfilerRequest(Request $request) { $route = $request->attributes->get('_route'); return $route === '_wdt' || strpos($route, '_profiler') === 0; }
php
protected function isProfilerRequest(Request $request) { $route = $request->attributes->get('_route'); return $route === '_wdt' || strpos($route, '_profiler') === 0; }
[ "protected", "function", "isProfilerRequest", "(", "Request", "$", "request", ")", "{", "$", "route", "=", "$", "request", "->", "attributes", "->", "get", "(", "'_route'", ")", ";", "return", "$", "route", "===", "'_wdt'", "||", "strpos", "(", "$", "rou...
Check to see if the request has matched one of the profiler's routes. @param Request $request @return bool
[ "Check", "to", "see", "if", "the", "request", "has", "matched", "one", "of", "the", "profiler", "s", "routes", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Request/ProfilerAwareTrait.php#L22-L27
bolt/bolt
src/Controller/Backend/Users.php
Users.admin
public function admin() { $currentuser = $this->getUser(); $users = $this->users()->getUsers(); $sessions = $this->accessControl()->getActiveSessions(); foreach ($users as $name => $user) { if (($key = array_search(Permissions::ROLE_EVERYONE, $user['roles'], true)) !== f...
php
public function admin() { $currentuser = $this->getUser(); $users = $this->users()->getUsers(); $sessions = $this->accessControl()->getActiveSessions(); foreach ($users as $name => $user) { if (($key = array_search(Permissions::ROLE_EVERYONE, $user['roles'], true)) !== f...
[ "public", "function", "admin", "(", ")", "{", "$", "currentuser", "=", "$", "this", "->", "getUser", "(", ")", ";", "$", "users", "=", "$", "this", "->", "users", "(", ")", "->", "getUsers", "(", ")", ";", "$", "sessions", "=", "$", "this", "->",...
All users admin page. @return \Bolt\Response\TemplateResponse
[ "All", "users", "admin", "page", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Backend/Users.php#L56-L75
bolt/bolt
src/Controller/Backend/Users.php
Users.edit
public function edit(Request $request, $id) { $currentUser = $this->getUser(); $userEntity = $this->getUserEntity($id); if ($userEntity === false) { return $this->redirectToRoute('users'); } /** @var Permissions $permissions */ $permissions = $this->app['p...
php
public function edit(Request $request, $id) { $currentUser = $this->getUser(); $userEntity = $this->getUserEntity($id); if ($userEntity === false) { return $this->redirectToRoute('users'); } /** @var Permissions $permissions */ $permissions = $this->app['p...
[ "public", "function", "edit", "(", "Request", "$", "request", ",", "$", "id", ")", "{", "$", "currentUser", "=", "$", "this", "->", "getUser", "(", ")", ";", "$", "userEntity", "=", "$", "this", "->", "getUserEntity", "(", "$", "id", ")", ";", "if"...
User edit route. @param Request $request The Symfony Request @param int $id The user ID @return \Bolt\Response\TemplateResponse|\Symfony\Component\HttpFoundation\RedirectResponse
[ "User", "edit", "route", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Backend/Users.php#L85-L156
bolt/bolt
src/Controller/Backend/Users.php
Users.first
public function first(Request $request) { // We should only be here for creating the first user if ($this->app['schema']->hasUserTable() && $this->users()->hasUsers()) { return $this->redirectToRoute('dashboard'); } // Add a note, if we're setting up the first user using...
php
public function first(Request $request) { // We should only be here for creating the first user if ($this->app['schema']->hasUserTable() && $this->users()->hasUsers()) { return $this->redirectToRoute('dashboard'); } // Add a note, if we're setting up the first user using...
[ "public", "function", "first", "(", "Request", "$", "request", ")", "{", "// We should only be here for creating the first user", "if", "(", "$", "this", "->", "app", "[", "'schema'", "]", "->", "hasUserTable", "(", ")", "&&", "$", "this", "->", "users", "(", ...
Create the first user. @param Request $request The Symfony Request @return \Bolt\Response\TemplateResponse|\Symfony\Component\HttpFoundation\RedirectResponse
[ "Create", "the", "first", "user", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Backend/Users.php#L165-L240
bolt/bolt
src/Controller/Backend/Users.php
Users.modify
public function modify($action, $id) { if (!$this->isCsrfTokenValid()) { $this->flashes()->error(Trans::__('general.phrase.something-went-wrong')); return $this->redirectToRoute('users'); } if (!$user = $this->getUser($id)) { $this->flashes()->error('No ...
php
public function modify($action, $id) { if (!$this->isCsrfTokenValid()) { $this->flashes()->error(Trans::__('general.phrase.something-went-wrong')); return $this->redirectToRoute('users'); } if (!$user = $this->getUser($id)) { $this->flashes()->error('No ...
[ "public", "function", "modify", "(", "$", "action", ",", "$", "id", ")", "{", "if", "(", "!", "$", "this", "->", "isCsrfTokenValid", "(", ")", ")", "{", "$", "this", "->", "flashes", "(", ")", "->", "error", "(", "Trans", "::", "__", "(", "'gener...
Perform modification actions on users. @param string $action The action @param int $id The user ID @return \Symfony\Component\HttpFoundation\RedirectResponse
[ "Perform", "modification", "actions", "on", "users", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Backend/Users.php#L250-L314
bolt/bolt
src/Controller/Backend/Users.php
Users.profile
public function profile(Request $request) { $userEntity = $this->getUser(); if ($userEntity === false) { return $this->redirectToRoute('users'); } // Generate the form $form = $this->createFormBuilder(FormType\UserProfileType::class, $userEntity) ->ge...
php
public function profile(Request $request) { $userEntity = $this->getUser(); if ($userEntity === false) { return $this->redirectToRoute('users'); } // Generate the form $form = $this->createFormBuilder(FormType\UserProfileType::class, $userEntity) ->ge...
[ "public", "function", "profile", "(", "Request", "$", "request", ")", "{", "$", "userEntity", "=", "$", "this", "->", "getUser", "(", ")", ";", "if", "(", "$", "userEntity", "===", "false", ")", "{", "return", "$", "this", "->", "redirectToRoute", "(",...
User profile page route. @param Request $request The Symfony Request @return \Bolt\Response\TemplateResponse|\Symfony\Component\HttpFoundation\RedirectResponse
[ "User", "profile", "page", "route", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Backend/Users.php#L323-L359
bolt/bolt
src/Controller/Backend/Users.php
Users.viewRoles
public function viewRoles() { $contenttypes = $this->getOption('contenttypes'); $permissions = $this->app['permissions']->getContentTypePermissions(); $effectivePermissions = []; foreach ($contenttypes as $contenttype) { foreach (array_keys($permissions) as $permission) {...
php
public function viewRoles() { $contenttypes = $this->getOption('contenttypes'); $permissions = $this->app['permissions']->getContentTypePermissions(); $effectivePermissions = []; foreach ($contenttypes as $contenttype) { foreach (array_keys($permissions) as $permission) {...
[ "public", "function", "viewRoles", "(", ")", "{", "$", "contenttypes", "=", "$", "this", "->", "getOption", "(", "'contenttypes'", ")", ";", "$", "permissions", "=", "$", "this", "->", "app", "[", "'permissions'", "]", "->", "getContentTypePermissions", "(",...
Route to view the configured user roles. @return \Bolt\Response\TemplateResponse
[ "Route", "to", "view", "the", "configured", "user", "roles", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Backend/Users.php#L366-L385
bolt/bolt
src/Controller/Backend/Users.php
Users.getUserEntity
private function getUserEntity($id = null) { if (empty($id)) { return new Entity\Users(); } elseif (!$userEntity = $this->getUser($id)) { $this->flashes()->error(Trans::__('general.phrase.user-not-exist')); return false; } $currentUser = $this->g...
php
private function getUserEntity($id = null) { if (empty($id)) { return new Entity\Users(); } elseif (!$userEntity = $this->getUser($id)) { $this->flashes()->error(Trans::__('general.phrase.user-not-exist')); return false; } $currentUser = $this->g...
[ "private", "function", "getUserEntity", "(", "$", "id", "=", "null", ")", "{", "if", "(", "empty", "(", "$", "id", ")", ")", "{", "return", "new", "Entity", "\\", "Users", "(", ")", ";", "}", "elseif", "(", "!", "$", "userEntity", "=", "$", "this...
Get the user we want to edit, or a new entity object if null. @param int $id @return Entity\Users|false
[ "Get", "the", "user", "we", "want", "to", "edit", "or", "a", "new", "entity", "object", "if", "null", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Backend/Users.php#L394-L413
bolt/bolt
src/Controller/Backend/Users.php
Users.notifyUserSetupEmail
private function notifyUserSetupEmail(Request $request, $displayName, $email) { $logger = $this->app['logger.system']; $mailer = $this->app['mailer']; $transport = $this->app['swiftmailer.spooltransport']; // Create a welcome email $mailHtml = $this->app['twig']->render( ...
php
private function notifyUserSetupEmail(Request $request, $displayName, $email) { $logger = $this->app['logger.system']; $mailer = $this->app['mailer']; $transport = $this->app['swiftmailer.spooltransport']; // Create a welcome email $mailHtml = $this->app['twig']->render( ...
[ "private", "function", "notifyUserSetupEmail", "(", "Request", "$", "request", ",", "$", "displayName", ",", "$", "email", ")", "{", "$", "logger", "=", "$", "this", "->", "app", "[", "'logger.system'", "]", ";", "$", "mailer", "=", "$", "this", "->", ...
Send a welcome email to test mail settings. @param Request $request @param string $displayName @param string $email
[ "Send", "a", "welcome", "email", "to", "test", "mail", "settings", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Backend/Users.php#L422-L465
bolt/bolt
src/Nut/Init.php
Init.execute
protected function execute(InputInterface $input, OutputInterface $output) { try { $this->updateDistBundles(); } catch (\Exception $e) { if ($output instanceof Output && $output->isDebug()) { throw $e; } $this->io->error(sprintf('There ...
php
protected function execute(InputInterface $input, OutputInterface $output) { try { $this->updateDistBundles(); } catch (\Exception $e) { if ($output instanceof Output && $output->isDebug()) { throw $e; } $this->io->error(sprintf('There ...
[ "protected", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "try", "{", "$", "this", "->", "updateDistBundles", "(", ")", ";", "}", "catch", "(", "\\", "Exception", "$", "e", ")", "{", "if", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/Init.php#L30-L50
bolt/bolt
src/Nut/Init.php
Init.updateDistBundles
private function updateDistBundles() { $fs = $this->app['filesystem']->getFilesystem('root'); $files = [ '.bolt.yml', 'composer.json', 'composer.lock', 'src/Site/CustomisationExtension.php', ]; foreach ($files as $file) { $d...
php
private function updateDistBundles() { $fs = $this->app['filesystem']->getFilesystem('root'); $files = [ '.bolt.yml', 'composer.json', 'composer.lock', 'src/Site/CustomisationExtension.php', ]; foreach ($files as $file) { $d...
[ "private", "function", "updateDistBundles", "(", ")", "{", "$", "fs", "=", "$", "this", "->", "app", "[", "'filesystem'", "]", "->", "getFilesystem", "(", "'root'", ")", ";", "$", "files", "=", "[", "'.bolt.yml'", ",", "'composer.json'", ",", "'composer.lo...
Archive distributions have the site bundle files installed as .dist files to prevent the real files being overridden. If the .dist file exists, but the original doesn't then we should rename them.
[ "Archive", "distributions", "have", "the", "site", "bundle", "files", "installed", "as", ".", "dist", "files", "to", "prevent", "the", "real", "files", "being", "overridden", ".", "If", "the", ".", "dist", "file", "exists", "but", "the", "original", "doesn",...
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/Init.php#L57-L72
bolt/bolt
src/Storage/Field/Type/ListTypeBase.php
ListTypeBase.persist
public function persist(QuerySet $queries, $entity) { $key = $this->mapping['fieldname']; $value = $entity->get($key); if ($value !== null && !empty($value)) { $value = Json::test($value) ? Json::parse($value) : $value; // Remove elements that are not important for ...
php
public function persist(QuerySet $queries, $entity) { $key = $this->mapping['fieldname']; $value = $entity->get($key); if ($value !== null && !empty($value)) { $value = Json::test($value) ? Json::parse($value) : $value; // Remove elements that are not important for ...
[ "public", "function", "persist", "(", "QuerySet", "$", "queries", ",", "$", "entity", ")", "{", "$", "key", "=", "$", "this", "->", "mapping", "[", "'fieldname'", "]", ";", "$", "value", "=", "$", "entity", "->", "get", "(", "$", "key", ")", ";", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Field/Type/ListTypeBase.php#L20-L39
bolt/bolt
src/Menu/Builder/AdminContent.php
AdminContent.build
public function build(MenuEntry $root) { // Top level header for ContentTypes $contentRoot = $root->add( MenuEntry::create('content', '') ->setLabel(Trans::__('general.phrase.content')) ->setIcon('fa:file-text') ->setPermission('dashboard')...
php
public function build(MenuEntry $root) { // Top level header for ContentTypes $contentRoot = $root->add( MenuEntry::create('content', '') ->setLabel(Trans::__('general.phrase.content')) ->setIcon('fa:file-text') ->setPermission('dashboard')...
[ "public", "function", "build", "(", "MenuEntry", "$", "root", ")", "{", "// Top level header for ContentTypes", "$", "contentRoot", "=", "$", "root", "->", "add", "(", "MenuEntry", "::", "create", "(", "'content'", ",", "''", ")", "->", "setLabel", "(", "Tra...
Build the "Content" menu. @param MenuEntry $root @return MenuEntry
[ "Build", "the", "Content", "menu", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Menu/Builder/AdminContent.php#L38-L63
bolt/bolt
src/Menu/Builder/AdminContent.php
AdminContent.addContentType
private function addContentType(MenuEntry $contentRoot, $contentTypeKey, Bag $contentType) { $icon = $contentType->get('singleton') ? $contentType->get('icon_one') : $contentType->get('icon_many'); // Named ContentType root $contentTypeEntry = $contentRoot->add( MenuEntry::creat...
php
private function addContentType(MenuEntry $contentRoot, $contentTypeKey, Bag $contentType) { $icon = $contentType->get('singleton') ? $contentType->get('icon_one') : $contentType->get('icon_many'); // Named ContentType root $contentTypeEntry = $contentRoot->add( MenuEntry::creat...
[ "private", "function", "addContentType", "(", "MenuEntry", "$", "contentRoot", ",", "$", "contentTypeKey", ",", "Bag", "$", "contentType", ")", "{", "$", "icon", "=", "$", "contentType", "->", "get", "(", "'singleton'", ")", "?", "$", "contentType", "->", ...
Add a ContentType's menu and sub-menu. @param MenuEntry $contentRoot @param string $contentTypeKey @param Bag $contentType
[ "Add", "a", "ContentType", "s", "menu", "and", "sub", "-", "menu", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Menu/Builder/AdminContent.php#L72-L100
bolt/bolt
src/Menu/Builder/AdminContent.php
AdminContent.addGroupedMenu
private function addGroupedMenu(MenuEntry $contentRoot, Bag $contentType) { $key = $contentType->get('show_in_menu') ?: 'other'; $label = $key === 'other' ? Trans::__('general.phrase.other-content') : ucwords($key); $contentRoot->add( MenuEntry::create(strtolower($key)) ...
php
private function addGroupedMenu(MenuEntry $contentRoot, Bag $contentType) { $key = $contentType->get('show_in_menu') ?: 'other'; $label = $key === 'other' ? Trans::__('general.phrase.other-content') : ucwords($key); $contentRoot->add( MenuEntry::create(strtolower($key)) ...
[ "private", "function", "addGroupedMenu", "(", "MenuEntry", "$", "contentRoot", ",", "Bag", "$", "contentType", ")", "{", "$", "key", "=", "$", "contentType", "->", "get", "(", "'show_in_menu'", ")", "?", ":", "'other'", ";", "$", "label", "=", "$", "key"...
Add the "Other content" & similar menu/sub menus. @param MenuEntry $contentRoot @param Bag $contentType
[ "Add", "the", "Other", "content", "&", "similar", "menu", "/", "sub", "menus", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Menu/Builder/AdminContent.php#L108-L121
bolt/bolt
src/Menu/Builder/AdminContent.php
AdminContent.fillGroupedMenus
private function fillGroupedMenus(MenuEntry $contentRoot) { $groups = $this->contentTypes->call(function ($a) { $arr = []; foreach ($a as $k => $v) { if ($v['show_in_menu'] === true) { continue; } $group = $v['show_i...
php
private function fillGroupedMenus(MenuEntry $contentRoot) { $groups = $this->contentTypes->call(function ($a) { $arr = []; foreach ($a as $k => $v) { if ($v['show_in_menu'] === true) { continue; } $group = $v['show_i...
[ "private", "function", "fillGroupedMenus", "(", "MenuEntry", "$", "contentRoot", ")", "{", "$", "groups", "=", "$", "this", "->", "contentTypes", "->", "call", "(", "function", "(", "$", "a", ")", "{", "$", "arr", "=", "[", "]", ";", "foreach", "(", ...
Fill the "Other content" & similar menu/sub menus with entries. @param MenuEntry $contentRoot
[ "Fill", "the", "Other", "content", "&", "similar", "menu", "/", "sub", "menus", "with", "entries", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Menu/Builder/AdminContent.php#L128-L149
bolt/bolt
src/Menu/Builder/AdminContent.php
AdminContent.addGroupedContentTypes
private function addGroupedContentTypes(MenuEntry $groupEntry, array $contentTypes) { foreach ($contentTypes as $contentTypeKey => $contentType) { /** @var Bag $contentType */ $groupEntry->add( MenuEntry::create($contentTypeKey) ->setRoute('overvie...
php
private function addGroupedContentTypes(MenuEntry $groupEntry, array $contentTypes) { foreach ($contentTypes as $contentTypeKey => $contentType) { /** @var Bag $contentType */ $groupEntry->add( MenuEntry::create($contentTypeKey) ->setRoute('overvie...
[ "private", "function", "addGroupedContentTypes", "(", "MenuEntry", "$", "groupEntry", ",", "array", "$", "contentTypes", ")", "{", "foreach", "(", "$", "contentTypes", "as", "$", "contentTypeKey", "=>", "$", "contentType", ")", "{", "/** @var Bag $contentType */", ...
Add a group's children. @param MenuEntry $groupEntry @param array $contentTypes
[ "Add", "a", "group", "s", "children", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Menu/Builder/AdminContent.php#L157-L169
bolt/bolt
src/Storage/Database/Schema/Table/ContentType.php
ContentType.addIndexes
protected function addIndexes() { $this->table->addIndex(['slug']); $this->table->addIndex(['datecreated']); $this->table->addIndex(['datechanged']); $this->table->addIndex(['datepublish']); $this->table->addIndex(['datedepublish']); $this->table->addIndex(['status'])...
php
protected function addIndexes() { $this->table->addIndex(['slug']); $this->table->addIndex(['datecreated']); $this->table->addIndex(['datechanged']); $this->table->addIndex(['datepublish']); $this->table->addIndex(['datedepublish']); $this->table->addIndex(['status'])...
[ "protected", "function", "addIndexes", "(", ")", "{", "$", "this", "->", "table", "->", "addIndex", "(", "[", "'slug'", "]", ")", ";", "$", "this", "->", "table", "->", "addIndex", "(", "[", "'datecreated'", "]", ")", ";", "$", "this", "->", "table",...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Database/Schema/Table/ContentType.php#L71-L79
bolt/bolt
src/Storage/Database/Schema/Table/ContentType.php
ContentType.addCustomFields
public function addCustomFields($fieldName, $type, $addIndex) { if (!$this->table->hasColumn($fieldName)) { $this->{$this->typeMap[$type]}($fieldName); } if ($addIndex) { $this->table->addIndex([$fieldName]); } }
php
public function addCustomFields($fieldName, $type, $addIndex) { if (!$this->table->hasColumn($fieldName)) { $this->{$this->typeMap[$type]}($fieldName); } if ($addIndex) { $this->table->addIndex([$fieldName]); } }
[ "public", "function", "addCustomFields", "(", "$", "fieldName", ",", "$", "type", ",", "$", "addIndex", ")", "{", "if", "(", "!", "$", "this", "->", "table", "->", "hasColumn", "(", "$", "fieldName", ")", ")", "{", "$", "this", "->", "{", "$", "thi...
Add the contenttype's specific fields. @param string $fieldName @param string $type @param bool $addIndex
[ "Add", "the", "contenttype", "s", "specific", "fields", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Database/Schema/Table/ContentType.php#L108-L117
bolt/bolt
src/Composer/Script/Options.php
Options.getDirMode
public function getDirMode() { $dirMode = $this->get('dir-mode', 0777); $dirMode = is_string($dirMode) ? octdec($dirMode) : $dirMode; return $dirMode; }
php
public function getDirMode() { $dirMode = $this->get('dir-mode', 0777); $dirMode = is_string($dirMode) ? octdec($dirMode) : $dirMode; return $dirMode; }
[ "public", "function", "getDirMode", "(", ")", "{", "$", "dirMode", "=", "$", "this", "->", "get", "(", "'dir-mode'", ",", "0777", ")", ";", "$", "dirMode", "=", "is_string", "(", "$", "dirMode", ")", "?", "octdec", "(", "$", "dirMode", ")", ":", "$...
Returns the directory mode. @return int
[ "Returns", "the", "directory", "mode", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/Script/Options.php#L46-L52
bolt/bolt
src/Composer/Script/Options.php
Options.get
public function get($key, $default = null) { if ($value = $this->getEnv($key)) { return $value; } $key = strtolower(str_replace('_', '-', $key)); if (strpos($key, 'bolt-') !== 0) { $key = 'bolt-' . $key; } return isset($this->composerExtra[$...
php
public function get($key, $default = null) { if ($value = $this->getEnv($key)) { return $value; } $key = strtolower(str_replace('_', '-', $key)); if (strpos($key, 'bolt-') !== 0) { $key = 'bolt-' . $key; } return isset($this->composerExtra[$...
[ "public", "function", "get", "(", "$", "key", ",", "$", "default", "=", "null", ")", "{", "if", "(", "$", "value", "=", "$", "this", "->", "getEnv", "(", "$", "key", ")", ")", "{", "return", "$", "value", ";", "}", "$", "key", "=", "strtolower"...
Get an option from environment variable or composer's extra section. Example: With key "dir-mode" it checks for "BOLT_DIR_MODE" environment variable, then "bolt-dir-mode" in composer's extra section, then returns given default value. @param string $key @param mixed $default @return mixed
[ "Get", "an", "option", "from", "environment", "variable", "or", "composer", "s", "extra", "section", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/Script/Options.php#L65-L78
bolt/bolt
src/Composer/Script/Options.php
Options.getEnv
private function getEnv($key) { $key = strtoupper(str_replace('-', '_', $key)); if (strpos($key, 'BOLT_') !== 0) { $key = 'BOLT_' . $key; } return getenv($key); }
php
private function getEnv($key) { $key = strtoupper(str_replace('-', '_', $key)); if (strpos($key, 'BOLT_') !== 0) { $key = 'BOLT_' . $key; } return getenv($key); }
[ "private", "function", "getEnv", "(", "$", "key", ")", "{", "$", "key", "=", "strtoupper", "(", "str_replace", "(", "'-'", ",", "'_'", ",", "$", "key", ")", ")", ";", "if", "(", "strpos", "(", "$", "key", ",", "'BOLT_'", ")", "!==", "0", ")", "...
@param string $key @return array|false|string
[ "@param", "string", "$key" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/Script/Options.php#L85-L94
bolt/bolt
src/Storage/Query/SearchQuery.php
SearchQuery.getSearchParameter
protected function getSearchParameter() { if (strpos($this->search, '+')) { $words = preg_split('/[\s\+]+/', $this->search); return '%' . implode('% && %', $words) . '%'; } $words = explode(' ', $this->search); return '%' . implode('% || %', $words) . '%'; ...
php
protected function getSearchParameter() { if (strpos($this->search, '+')) { $words = preg_split('/[\s\+]+/', $this->search); return '%' . implode('% && %', $words) . '%'; } $words = explode(' ', $this->search); return '%' . implode('% || %', $words) . '%'; ...
[ "protected", "function", "getSearchParameter", "(", ")", "{", "if", "(", "strpos", "(", "$", "this", "->", "search", ",", "'+'", ")", ")", "{", "$", "words", "=", "preg_split", "(", "'/[\\s\\+]+/'", ",", "$", "this", "->", "search", ")", ";", "return",...
This is an internal helper method to get the search words prepared to be passed to the expression builder. @return string
[ "This", "is", "an", "internal", "helper", "method", "to", "get", "the", "search", "words", "prepared", "to", "be", "passed", "to", "the", "expression", "builder", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Query/SearchQuery.php#L81-L91
bolt/bolt
src/Storage/Query/SearchQuery.php
SearchQuery.processFilters
protected function processFilters() { $params = $this->params; if (!$this->contentType) { throw new QueryParseException('You have attempted to run a search query without specifying a ContentType', 1); } if (isset($params['invisible']) && $params['invisible'] === true) {...
php
protected function processFilters() { $params = $this->params; if (!$this->contentType) { throw new QueryParseException('You have attempted to run a search query without specifying a ContentType', 1); } if (isset($params['invisible']) && $params['invisible'] === true) {...
[ "protected", "function", "processFilters", "(", ")", "{", "$", "params", "=", "$", "this", "->", "params", ";", "if", "(", "!", "$", "this", "->", "contentType", ")", "{", "throw", "new", "QueryParseException", "(", "'You have attempted to run a search query wit...
This overrides the SelectQuery default to do some extra preparation for a search query. Firstly it builds separate filters for the search query and then it removes the filter from the params and the others will then get processed normally by the parent. @throws QueryParseException
[ "This", "overrides", "the", "SelectQuery", "default", "to", "do", "some", "extra", "preparation", "for", "a", "search", "query", ".", "Firstly", "it", "builds", "separate", "filters", "for", "the", "search", "query", "and", "then", "it", "removes", "the", "f...
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Query/SearchQuery.php#L100-L125
bolt/bolt
src/Storage/Query/SearchQuery.php
SearchQuery.getWhereExpression
public function getWhereExpression() { if (!count($this->filters)) { return null; } $wrapExpr = $this->qb->expr()->andX(); $config = $this->config->getConfig($this->contentType); $searchExpr = $this->qb->expr()->orX(); $searchKeys = array_keys($config); ...
php
public function getWhereExpression() { if (!count($this->filters)) { return null; } $wrapExpr = $this->qb->expr()->andX(); $config = $this->config->getConfig($this->contentType); $searchExpr = $this->qb->expr()->orX(); $searchKeys = array_keys($config); ...
[ "public", "function", "getWhereExpression", "(", ")", "{", "if", "(", "!", "count", "(", "$", "this", "->", "filters", ")", ")", "{", "return", "null", ";", "}", "$", "wrapExpr", "=", "$", "this", "->", "qb", "->", "expr", "(", ")", "->", "andX", ...
Creates a composite expression that adds all the attached filters individual expressions into a combined one. @return CompositeExpression|null
[ "Creates", "a", "composite", "expression", "that", "adds", "all", "the", "attached", "filters", "individual", "expressions", "into", "a", "combined", "one", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Query/SearchQuery.php#L133-L155
bolt/bolt
src/Nut/Output/OverwritableOutput.php
OverwritableOutput.captureUserInput
public function captureUserInput($input) { if (!$this->captures) { $this->capture(); } $this->captures[0]->append($input); }
php
public function captureUserInput($input) { if (!$this->captures) { $this->capture(); } $this->captures[0]->append($input); }
[ "public", "function", "captureUserInput", "(", "$", "input", ")", "{", "if", "(", "!", "$", "this", "->", "captures", ")", "{", "$", "this", "->", "capture", "(", ")", ";", "}", "$", "this", "->", "captures", "[", "0", "]", "->", "append", "(", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/Output/OverwritableOutput.php#L45-L51
bolt/bolt
src/Nut/Output/OverwritableOutput.php
OverwritableOutput.remove
public function remove() { if (!$this->captures) { return; } $capture = array_shift($this->captures); if (!$this->isDecorated()) { return; } $overwrite = $capture->overwrite($this->getFormatter(), Terminal::getWidth()); $this->outpu...
php
public function remove() { if (!$this->captures) { return; } $capture = array_shift($this->captures); if (!$this->isDecorated()) { return; } $overwrite = $capture->overwrite($this->getFormatter(), Terminal::getWidth()); $this->outpu...
[ "public", "function", "remove", "(", ")", "{", "if", "(", "!", "$", "this", "->", "captures", ")", "{", "return", ";", "}", "$", "capture", "=", "array_shift", "(", "$", "this", "->", "captures", ")", ";", "if", "(", "!", "$", "this", "->", "isDe...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/Output/OverwritableOutput.php#L56-L71
bolt/bolt
src/Nut/Output/OverwritableOutput.php
OverwritableOutput.write
public function write($messages, $newline = false, $options = 0) { if ($this->captures) { $this->buffer->write($messages, $newline, $options); $buffer = $this->buffer->fetch(); $this->captures[0]->append($buffer); } $this->output->write($messages, $newlin...
php
public function write($messages, $newline = false, $options = 0) { if ($this->captures) { $this->buffer->write($messages, $newline, $options); $buffer = $this->buffer->fetch(); $this->captures[0]->append($buffer); } $this->output->write($messages, $newlin...
[ "public", "function", "write", "(", "$", "messages", ",", "$", "newline", "=", "false", ",", "$", "options", "=", "0", ")", "{", "if", "(", "$", "this", "->", "captures", ")", "{", "$", "this", "->", "buffer", "->", "write", "(", "$", "messages", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/Output/OverwritableOutput.php#L76-L85
bolt/bolt
src/Storage/Collection/LazyCollection.php
LazyCollection.serialize
public function serialize() { $output = []; foreach ($this as $element) { $proxy = $element->getProxy(); $output[] = $proxy->getContenttype() . '/' . $proxy->getSlug(); } return $output; }
php
public function serialize() { $output = []; foreach ($this as $element) { $proxy = $element->getProxy(); $output[] = $proxy->getContenttype() . '/' . $proxy->getSlug(); } return $output; }
[ "public", "function", "serialize", "(", ")", "{", "$", "output", "=", "[", "]", ";", "foreach", "(", "$", "this", "as", "$", "element", ")", "{", "$", "proxy", "=", "$", "element", "->", "getProxy", "(", ")", ";", "$", "output", "[", "]", "=", ...
Force loads the proxy objects and returns the real objects
[ "Force", "loads", "the", "proxy", "objects", "and", "returns", "the", "real", "objects" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Collection/LazyCollection.php#L19-L28
bolt/bolt
src/Storage/Collection/LazyCollection.php
LazyCollection.getIterator
public function getIterator() { $els = parent::getIterator(); return new CallbackFilterIterator($els, function (&$current) { /** @var EntityProxy $current */ $current = $current->getProxy(); return true; } ); }
php
public function getIterator() { $els = parent::getIterator(); return new CallbackFilterIterator($els, function (&$current) { /** @var EntityProxy $current */ $current = $current->getProxy(); return true; } ); }
[ "public", "function", "getIterator", "(", ")", "{", "$", "els", "=", "parent", "::", "getIterator", "(", ")", ";", "return", "new", "CallbackFilterIterator", "(", "$", "els", ",", "function", "(", "&", "$", "current", ")", "{", "/** @var EntityProxy $current...
This overrides the base getIterator method and on access swaps out the EntityProxy objects for real entities. @return CallbackFilterIterator
[ "This", "overrides", "the", "base", "getIterator", "method", "and", "on", "access", "swaps", "out", "the", "EntityProxy", "objects", "for", "real", "entities", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Collection/LazyCollection.php#L36-L47
bolt/bolt
src/Configuration/LazyPathsProxy.php
LazyPathsProxy.offsetGet
public function offsetGet($offset) { if (!$this->resources) { $this->resources = call_user_func($this->factory); if (!$this->resources instanceof ResourceManager) { throw new \LogicException( sprintf( 'Factory given to %s mu...
php
public function offsetGet($offset) { if (!$this->resources) { $this->resources = call_user_func($this->factory); if (!$this->resources instanceof ResourceManager) { throw new \LogicException( sprintf( 'Factory given to %s mu...
[ "public", "function", "offsetGet", "(", "$", "offset", ")", "{", "if", "(", "!", "$", "this", "->", "resources", ")", "{", "$", "this", "->", "resources", "=", "call_user_func", "(", "$", "this", "->", "factory", ")", ";", "if", "(", "!", "$", "thi...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Configuration/LazyPathsProxy.php#L32-L48
bolt/bolt
src/Extension/Manager.php
Manager.get
public function get($id) { $resolved = $this->getResolved($id); return $resolved ? $resolved->getInnerExtension() : null; }
php
public function get($id) { $resolved = $this->getResolved($id); return $resolved ? $resolved->getInnerExtension() : null; }
[ "public", "function", "get", "(", "$", "id", ")", "{", "$", "resolved", "=", "$", "this", "->", "getResolved", "(", "$", "id", ")", ";", "return", "$", "resolved", "?", "$", "resolved", "->", "getInnerExtension", "(", ")", ":", "null", ";", "}" ]
Get an installed extension class. @param string|null $id The extension ID or composer name @return ExtensionInterface|null
[ "Get", "an", "installed", "extension", "class", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Extension/Manager.php#L82-L87
bolt/bolt
src/Extension/Manager.php
Manager.getResolved
public function getResolved($id) { if (isset($this->extensions[$id])) { return $this->extensions[$id]; } elseif (isset($this->composerNames[$id])) { $id = (string) $this->composerNames[$id]; return $this->extensions[$id]; } return null; }
php
public function getResolved($id) { if (isset($this->extensions[$id])) { return $this->extensions[$id]; } elseif (isset($this->composerNames[$id])) { $id = (string) $this->composerNames[$id]; return $this->extensions[$id]; } return null; }
[ "public", "function", "getResolved", "(", "$", "id", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "extensions", "[", "$", "id", "]", ")", ")", "{", "return", "$", "this", "->", "extensions", "[", "$", "id", "]", ";", "}", "elseif", "(", ...
Get the resolved form of an installed extension class. @param string|null $id The extension ID or composer name @return ResolvedExtension|null
[ "Get", "the", "resolved", "form", "of", "an", "installed", "extension", "class", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Extension/Manager.php#L96-L107
bolt/bolt
src/Extension/Manager.php
Manager.add
public function add(ExtensionInterface $extension, DirectoryInterface $baseDir = null, DirectoryInterface $webDir = null, $composerName = null) { if ($this->registered) { throw new \RuntimeException('Can not add extensions after they are registered.'); } // Set paths in the exte...
php
public function add(ExtensionInterface $extension, DirectoryInterface $baseDir = null, DirectoryInterface $webDir = null, $composerName = null) { if ($this->registered) { throw new \RuntimeException('Can not add extensions after they are registered.'); } // Set paths in the exte...
[ "public", "function", "add", "(", "ExtensionInterface", "$", "extension", ",", "DirectoryInterface", "$", "baseDir", "=", "null", ",", "DirectoryInterface", "$", "webDir", "=", "null", ",", "$", "composerName", "=", "null", ")", "{", "if", "(", "$", "this", ...
Add an extension to be registered. @param ExtensionInterface $extension @param DirectoryInterface|null $baseDir @param DirectoryInterface|null $webDir @param string|null $composerName @throws \RuntimeException @return ResolvedExtension
[ "Add", "an", "extension", "to", "be", "registered", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Extension/Manager.php#L121-L165
bolt/bolt
src/Extension/Manager.php
Manager.addManagedExtensions
public function addManagedExtensions() { if ($this->loaded) { throw new \RuntimeException('Extensions already loaded.'); } try { $this->extFs->includeFile('vendor/autoload.php'); } catch (FileNotFoundException $e) { $this->loaded = true; ...
php
public function addManagedExtensions() { if ($this->loaded) { throw new \RuntimeException('Extensions already loaded.'); } try { $this->extFs->includeFile('vendor/autoload.php'); } catch (FileNotFoundException $e) { $this->loaded = true; ...
[ "public", "function", "addManagedExtensions", "(", ")", "{", "if", "(", "$", "this", "->", "loaded", ")", "{", "throw", "new", "\\", "RuntimeException", "(", "'Extensions already loaded.'", ")", ";", "}", "try", "{", "$", "this", "->", "extFs", "->", "incl...
Load a collection of extension classes.
[ "Load", "a", "collection", "of", "extension", "classes", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Extension/Manager.php#L170-L192
bolt/bolt
src/Extension/Manager.php
Manager.register
public function register(Application $app) { if ($this->registered) { throw new \RuntimeException('Can not re-register extensions.'); } foreach ($this->extensions as $extension) { if ($extension->isEnabled() !== true) { continue; } ...
php
public function register(Application $app) { if ($this->registered) { throw new \RuntimeException('Can not re-register extensions.'); } foreach ($this->extensions as $extension) { if ($extension->isEnabled() !== true) { continue; } ...
[ "public", "function", "register", "(", "Application", "$", "app", ")", "{", "if", "(", "$", "this", "->", "registered", ")", "{", "throw", "new", "\\", "RuntimeException", "(", "'Can not re-register extensions.'", ")", ";", "}", "foreach", "(", "$", "this", ...
Call register() for each extension. @param Application $app @throws \RuntimeException
[ "Call", "register", "()", "for", "each", "extension", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Extension/Manager.php#L201-L219
bolt/bolt
src/Extension/Manager.php
Manager.boot
public function boot(Application $app) { if (!$this->registered) { throw new \RuntimeException('Can not boot extensions prior to completion of registration.'); } if ($this->booted) { throw new \RuntimeException('Can not re-boot extensions.'); } // Boo...
php
public function boot(Application $app) { if (!$this->registered) { throw new \RuntimeException('Can not boot extensions prior to completion of registration.'); } if ($this->booted) { throw new \RuntimeException('Can not re-boot extensions.'); } // Boo...
[ "public", "function", "boot", "(", "Application", "$", "app", ")", "{", "if", "(", "!", "$", "this", "->", "registered", ")", "{", "throw", "new", "\\", "RuntimeException", "(", "'Can not boot extensions prior to completion of registration.'", ")", ";", "}", "if...
Call boot() for each extension loader that implements ServiceProviderInterface. @internal @param Application $app @throws \RuntimeException
[ "Call", "boot", "()", "for", "each", "extension", "loader", "that", "implements", "ServiceProviderInterface", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Extension/Manager.php#L230-L250
bolt/bolt
src/Extension/Manager.php
Manager.loadPackageDescriptors
private function loadPackageDescriptors() { $descriptors = []; try { /** @var JsonFile $autoload */ $autoload = $this->extFs->get('vendor/autoload.json'); } catch (FileNotFoundException $e) { return $descriptors; } // Get extensions we're ...
php
private function loadPackageDescriptors() { $descriptors = []; try { /** @var JsonFile $autoload */ $autoload = $this->extFs->get('vendor/autoload.json'); } catch (FileNotFoundException $e) { return $descriptors; } // Get extensions we're ...
[ "private", "function", "loadPackageDescriptors", "(", ")", "{", "$", "descriptors", "=", "[", "]", ";", "try", "{", "/** @var JsonFile $autoload */", "$", "autoload", "=", "$", "this", "->", "extFs", "->", "get", "(", "'vendor/autoload.json'", ")", ";", "}", ...
Load the extension autoload.json cache file and build the PackageDescriptor array. @return PackageDescriptor[]
[ "Load", "the", "extension", "autoload", ".", "json", "cache", "file", "and", "build", "the", "PackageDescriptor", "array", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Extension/Manager.php#L257-L273
bolt/bolt
src/Extension/Manager.php
Manager.addManagedExtension
private function addManagedExtension(PackageDescriptor $descriptor) { $className = $descriptor->getClass(); if ($this->isClassLoadable($className) === false) { $this->flashLogger->error(Trans::__( 'page.extend.error-class-invalid', ['%NAME%' => $descriptor...
php
private function addManagedExtension(PackageDescriptor $descriptor) { $className = $descriptor->getClass(); if ($this->isClassLoadable($className) === false) { $this->flashLogger->error(Trans::__( 'page.extend.error-class-invalid', ['%NAME%' => $descriptor...
[ "private", "function", "addManagedExtension", "(", "PackageDescriptor", "$", "descriptor", ")", "{", "$", "className", "=", "$", "descriptor", "->", "getClass", "(", ")", ";", "if", "(", "$", "this", "->", "isClassLoadable", "(", "$", "className", ")", "==="...
Load a single extension. @param PackageDescriptor $descriptor
[ "Load", "a", "single", "extension", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Extension/Manager.php#L280-L306
bolt/bolt
src/Extension/Manager.php
Manager.isClassLoadable
private function isClassLoadable($className) { try { $exists = class_exists($className); } catch (ContextErrorException $e) { if ($e->getSeverity() === E_WARNING && basename($e->getFile()) === 'ClassLoader.php') { return false; } throw ...
php
private function isClassLoadable($className) { try { $exists = class_exists($className); } catch (ContextErrorException $e) { if ($e->getSeverity() === E_WARNING && basename($e->getFile()) === 'ClassLoader.php') { return false; } throw ...
[ "private", "function", "isClassLoadable", "(", "$", "className", ")", "{", "try", "{", "$", "exists", "=", "class_exists", "(", "$", "className", ")", ";", "}", "catch", "(", "ContextErrorException", "$", "e", ")", "{", "if", "(", "$", "e", "->", "getS...
Check if a class is loadable. This comes about as local extensions that are moved or removed will over emmit warnings while trying to validly rebuild autoloaders. @param string $className @throws ContextErrorException @return bool
[ "Check", "if", "a", "class", "is", "loadable", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Extension/Manager.php#L320-L332
bolt/bolt
src/Storage/Entity/ContentRelationTrait.php
ContentRelationTrait.getRelation
public function getRelation($filterContentType = null, $options = []) { if (empty($this->relation)) { return false; // nothing to do here. } // Backwards compatibility: If '$options' is a string, assume we passed an id if (!is_array($options)) { $options = [ ...
php
public function getRelation($filterContentType = null, $options = []) { if (empty($this->relation)) { return false; // nothing to do here. } // Backwards compatibility: If '$options' is a string, assume we passed an id if (!is_array($options)) { $options = [ ...
[ "public", "function", "getRelation", "(", "$", "filterContentType", "=", "null", ",", "$", "options", "=", "[", "]", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "relation", ")", ")", "{", "return", "false", ";", "// nothing to do here.", "}", ...
Gets one or more related records. @param string $filterContentType ContentType to filter returned results on @param array $options a set of 'WHERE' options to apply to the filter Backward compatibility note: The $options parameter used to be $filterid, an integer @return \Bolt\Legacy\Content[]
[ "Gets", "one", "or", "more", "related", "records", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Entity/ContentRelationTrait.php#L45-L96
bolt/bolt
src/Storage/Entity/ContentRelationTrait.php
ContentRelationTrait.setRelation
public function setRelation($contentType, $id) { if (empty($this->relation[$contentType]) || !in_array($id, $this->relation[$contentType], false)) { $this->relation[$contentType][] = $id; } }
php
public function setRelation($contentType, $id) { if (empty($this->relation[$contentType]) || !in_array($id, $this->relation[$contentType], false)) { $this->relation[$contentType][] = $id; } }
[ "public", "function", "setRelation", "(", "$", "contentType", ",", "$", "id", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "relation", "[", "$", "contentType", "]", ")", "||", "!", "in_array", "(", "$", "id", ",", "$", "this", "->", "relat...
Add a relation. @param string|array $contentType @param int $id
[ "Add", "a", "relation", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Entity/ContentRelationTrait.php#L104-L109
bolt/bolt
src/Controller/Backend/Extend.php
Extend.addRoutes
protected function addRoutes(ControllerCollection $c) { $c->get('', 'overview') ->bind('extensions'); // Allows BC with 3.2 and earlier, to be removed in 4.0 $c->get('', 'overview') ->bind('extend'); $c->get('/check', 'check') ->bind('check'); ...
php
protected function addRoutes(ControllerCollection $c) { $c->get('', 'overview') ->bind('extensions'); // Allows BC with 3.2 and earlier, to be removed in 4.0 $c->get('', 'overview') ->bind('extend'); $c->get('/check', 'check') ->bind('check'); ...
[ "protected", "function", "addRoutes", "(", "ControllerCollection", "$", "c", ")", "{", "$", "c", "->", "get", "(", "''", ",", "'overview'", ")", "->", "bind", "(", "'extensions'", ")", ";", "// Allows BC with 3.2 and earlier, to be removed in 4.0", "$", "c", "->...
Returns routes to connect to the application. @param \Silex\ControllerCollection $c
[ "Returns", "routes", "to", "connect", "to", "the", "application", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Backend/Extend.php#L29-L76
bolt/bolt
src/Controller/Backend/Extend.php
Extend.before
public function before(Request $request, Application $app, $roleRoute = null) { return parent::before($request, $app, 'extensions'); }
php
public function before(Request $request, Application $app, $roleRoute = null) { return parent::before($request, $app, 'extensions'); }
[ "public", "function", "before", "(", "Request", "$", "request", ",", "Application", "$", "app", ",", "$", "roleRoute", "=", "null", ")", "{", "return", "parent", "::", "before", "(", "$", "request", ",", "$", "app", ",", "'extensions'", ")", ";", "}" ]
Middleware function to check whether a user is logged on. @param Request $request @param Application $app @param string $roleRoute @return null|\Symfony\Component\HttpFoundation\RedirectResponse
[ "Middleware", "function", "to", "check", "whether", "a", "user", "is", "logged", "on", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Backend/Extend.php#L87-L90
bolt/bolt
src/Controller/Backend/Extend.php
Extend.check
public function check() { try { return $this->json($this->manager()->checkPackage()); } catch (PackageManagerException $e) { return $this->getJsonException($e); } }
php
public function check() { try { return $this->json($this->manager()->checkPackage()); } catch (PackageManagerException $e) { return $this->getJsonException($e); } }
[ "public", "function", "check", "(", ")", "{", "try", "{", "return", "$", "this", "->", "json", "(", "$", "this", "->", "manager", "(", ")", "->", "checkPackage", "(", ")", ")", ";", "}", "catch", "(", "PackageManagerException", "$", "e", ")", "{", ...
Check a package. @return \Symfony\Component\HttpFoundation\JsonResponse
[ "Check", "a", "package", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Backend/Extend.php#L101-L108
bolt/bolt
src/Controller/Backend/Extend.php
Extend.dependsPackage
public function dependsPackage(Request $request) { $package = $request->get('needle'); $constraint = $request->get('constraint', '*'); try { $response = $this->manager()->dependsPackage($package, $constraint); } catch (\Exception $e) { return $this->getJsonEx...
php
public function dependsPackage(Request $request) { $package = $request->get('needle'); $constraint = $request->get('constraint', '*'); try { $response = $this->manager()->dependsPackage($package, $constraint); } catch (\Exception $e) { return $this->getJsonEx...
[ "public", "function", "dependsPackage", "(", "Request", "$", "request", ")", "{", "$", "package", "=", "$", "request", "->", "get", "(", "'needle'", ")", ";", "$", "constraint", "=", "$", "request", "->", "get", "(", "'constraint'", ",", "'*'", ")", ";...
Find "depends" package dependencies. @param Request $request @return JsonResponse
[ "Find", "depends", "package", "dependencies", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Backend/Extend.php#L117-L129
bolt/bolt
src/Controller/Backend/Extend.php
Extend.dumpAutoload
public function dumpAutoload() { try { $response = $this->manager()->dumpAutoload(); } catch (PackageManagerException $e) { return $this->getJsonException($e); } if ($response === 0) { $this->app['logger.system']->info($this->manager()->getOutput(...
php
public function dumpAutoload() { try { $response = $this->manager()->dumpAutoload(); } catch (PackageManagerException $e) { return $this->getJsonException($e); } if ($response === 0) { $this->app['logger.system']->info($this->manager()->getOutput(...
[ "public", "function", "dumpAutoload", "(", ")", "{", "try", "{", "$", "response", "=", "$", "this", "->", "manager", "(", ")", "->", "dumpAutoload", "(", ")", ";", "}", "catch", "(", "PackageManagerException", "$", "e", ")", "{", "return", "$", "this",...
Dumps the autoloader. @throws PackageManagerException @return Response
[ "Dumps", "the", "autoloader", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Backend/Extend.php#L138-L153
bolt/bolt
src/Controller/Backend/Extend.php
Extend.generateTheme
public function generateTheme(Request $request) { $theme = $request->query->get('theme'); $newName = $request->query->get('name'); if (empty($theme)) { return new Response(Trans::__('page.extend.theme.generation.missing.name')); } if (!$newName) { $n...
php
public function generateTheme(Request $request) { $theme = $request->query->get('theme'); $newName = $request->query->get('name'); if (empty($theme)) { return new Response(Trans::__('page.extend.theme.generation.missing.name')); } if (!$newName) { $n...
[ "public", "function", "generateTheme", "(", "Request", "$", "request", ")", "{", "$", "theme", "=", "$", "request", "->", "query", "->", "get", "(", "'theme'", ")", ";", "$", "newName", "=", "$", "request", "->", "query", "->", "get", "(", "'name'", ...
Generate a copy of a theme package. @param Request $request @throws PackageManagerException @return Response
[ "Generate", "a", "copy", "of", "a", "theme", "package", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Backend/Extend.php#L164-L195
bolt/bolt
src/Controller/Backend/Extend.php
Extend.install
public function install(Request $request) { $package = $request->get('package'); $version = $request->get('version'); try { $response = $this->manager()->requirePackage( [ 'name' => $package, 'version' => $version, ...
php
public function install(Request $request) { $package = $request->get('package'); $version = $request->get('version'); try { $response = $this->manager()->requirePackage( [ 'name' => $package, 'version' => $version, ...
[ "public", "function", "install", "(", "Request", "$", "request", ")", "{", "$", "package", "=", "$", "request", "->", "get", "(", "'package'", ")", ";", "$", "version", "=", "$", "request", "->", "get", "(", "'version'", ")", ";", "try", "{", "$", ...
Install a package. Equivalent to `composer require author/package` @param Request $request @throws PackageManagerException @return \Symfony\Component\HttpFoundation\Response
[ "Install", "a", "package", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Backend/Extend.php#L208-L231
bolt/bolt
src/Controller/Backend/Extend.php
Extend.installAll
public function installAll() { try { $response = $this->manager()->installPackages(); } catch (\Exception $e) { return $this->getJsonException($e); } if ($response === 0) { return new Response($this->manager()->getOutput()); } ret...
php
public function installAll() { try { $response = $this->manager()->installPackages(); } catch (\Exception $e) { return $this->getJsonException($e); } if ($response === 0) { return new Response($this->manager()->getOutput()); } ret...
[ "public", "function", "installAll", "(", ")", "{", "try", "{", "$", "response", "=", "$", "this", "->", "manager", "(", ")", "->", "installPackages", "(", ")", ";", "}", "catch", "(", "\\", "Exception", "$", "e", ")", "{", "return", "$", "this", "-...
Install all packages that are in the composer.json but not in vendor. Equivalent to `composer install` @throws PackageManagerException @return \Symfony\Component\HttpFoundation\Response
[ "Install", "all", "packages", "that", "are", "in", "the", "composer", ".", "json", "but", "not", "in", "vendor", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Backend/Extend.php#L242-L255
bolt/bolt
src/Controller/Backend/Extend.php
Extend.installed
public function installed() { try { return $this->json($this->manager()->getAllPackages()); } catch (\Exception $e) { return $this->getJsonException($e); } }
php
public function installed() { try { return $this->json($this->manager()->getAllPackages()); } catch (\Exception $e) { return $this->getJsonException($e); } }
[ "public", "function", "installed", "(", ")", "{", "try", "{", "return", "$", "this", "->", "json", "(", "$", "this", "->", "manager", "(", ")", "->", "getAllPackages", "(", ")", ")", ";", "}", "catch", "(", "\\", "Exception", "$", "e", ")", "{", ...
Get a list of all installed packages. Partially equivalent to `composer show -i` @return \Symfony\Component\HttpFoundation\JsonResponse
[ "Get", "a", "list", "of", "all", "installed", "packages", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Backend/Extend.php#L264-L271
bolt/bolt
src/Controller/Backend/Extend.php
Extend.installInfo
public function installInfo(Request $request) { $package = $request->query->get('package'); if ($package === null) { $message = 'Extension browser request query was missing or invalid, check your web server configuration.'; return $this->getJsonException(new \Exception($mess...
php
public function installInfo(Request $request) { $package = $request->query->get('package'); if ($package === null) { $message = 'Extension browser request query was missing or invalid, check your web server configuration.'; return $this->getJsonException(new \Exception($mess...
[ "public", "function", "installInfo", "(", "Request", "$", "request", ")", "{", "$", "package", "=", "$", "request", "->", "query", "->", "get", "(", "'package'", ")", ";", "if", "(", "$", "package", "===", "null", ")", "{", "$", "message", "=", "'Ext...
@param Request $request @return \Symfony\Component\HttpFoundation\JsonResponse
[ "@param", "Request", "$request" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Backend/Extend.php#L278-L309
bolt/bolt
src/Controller/Backend/Extend.php
Extend.installPackage
public function installPackage() { try { return $this->render('@bolt/extend/_action-modal.twig', $this->getRenderContext()); } catch (\Exception $e) { return $this->getJsonException($e); } }
php
public function installPackage() { try { return $this->render('@bolt/extend/_action-modal.twig', $this->getRenderContext()); } catch (\Exception $e) { return $this->getJsonException($e); } }
[ "public", "function", "installPackage", "(", ")", "{", "try", "{", "return", "$", "this", "->", "render", "(", "'@bolt/extend/_action-modal.twig'", ",", "$", "this", "->", "getRenderContext", "(", ")", ")", ";", "}", "catch", "(", "\\", "Exception", "$", "...
Package install chooser modal. @return \Bolt\Response\TemplateResponse|\Symfony\Component\HttpFoundation\JsonResponse
[ "Package", "install", "chooser", "modal", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Backend/Extend.php#L316-L323
bolt/bolt
src/Controller/Backend/Extend.php
Extend.overview
public function overview() { /** @var PingService $pinger */ $pinger = $this->app['extend.ping']; // Ping the extensions server to confirm connection $this->app['extend.online'] = $pinger->ping(true); try { return $this->render('@bolt/extend/extend.twig', $this->...
php
public function overview() { /** @var PingService $pinger */ $pinger = $this->app['extend.ping']; // Ping the extensions server to confirm connection $this->app['extend.online'] = $pinger->ping(true); try { return $this->render('@bolt/extend/extend.twig', $this->...
[ "public", "function", "overview", "(", ")", "{", "/** @var PingService $pinger */", "$", "pinger", "=", "$", "this", "->", "app", "[", "'extend.ping'", "]", ";", "// Ping the extensions server to confirm connection", "$", "this", "->", "app", "[", "'extend.online'", ...
The main 'Extensions' page. @return \Bolt\Response\TemplateResponse|\Symfony\Component\HttpFoundation\JsonResponse
[ "The", "main", "Extensions", "page", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Backend/Extend.php#L330-L342
bolt/bolt
src/Controller/Backend/Extend.php
Extend.packageInfo
public function packageInfo(Request $request) { $packageName = $request->get('package'); $reqVersion = $request->get('version'); try { $response = $this->manager()->showPackage('installed', $packageName, $reqVersion); } catch (\Exception $e) { return $this->g...
php
public function packageInfo(Request $request) { $packageName = $request->get('package'); $reqVersion = $request->get('version'); try { $response = $this->manager()->showPackage('installed', $packageName, $reqVersion); } catch (\Exception $e) { return $this->g...
[ "public", "function", "packageInfo", "(", "Request", "$", "request", ")", "{", "$", "packageName", "=", "$", "request", "->", "get", "(", "'package'", ")", ";", "$", "reqVersion", "=", "$", "request", "->", "get", "(", "'version'", ")", ";", "try", "{"...
Show installed packages. @param Request $request @throws PackageManagerException] @return \Symfony\Component\HttpFoundation\JsonResponse
[ "Show", "installed", "packages", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Backend/Extend.php#L353-L376
bolt/bolt
src/Controller/Backend/Extend.php
Extend.update
public function update(Request $request) { $package = $request->query->get('package'); try { $response = $this->app['extend.manager']->updatePackage((array) $package); } catch (\Exception $e) { return $this->getJsonException($e); } if ($response === ...
php
public function update(Request $request) { $package = $request->query->get('package'); try { $response = $this->app['extend.manager']->updatePackage((array) $package); } catch (\Exception $e) { return $this->getJsonException($e); } if ($response === ...
[ "public", "function", "update", "(", "Request", "$", "request", ")", "{", "$", "package", "=", "$", "request", "->", "query", "->", "get", "(", "'package'", ")", ";", "try", "{", "$", "response", "=", "$", "this", "->", "app", "[", "'extend.manager'", ...
Update a package(s). @param Request $request @throws PackageManagerException @return \Symfony\Component\HttpFoundation\JsonResponse
[ "Update", "a", "package", "(", "s", ")", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Backend/Extend.php#L408-L425
bolt/bolt
src/Controller/Backend/Extend.php
Extend.uninstall
public function uninstall(Request $request) { $package = $request->get('package'); try { $response = $this->manager()->removePackage([$package]); } catch (\Exception $e) { return $this->getJsonException($e); } if ($response === 0) { $this...
php
public function uninstall(Request $request) { $package = $request->get('package'); try { $response = $this->manager()->removePackage([$package]); } catch (\Exception $e) { return $this->getJsonException($e); } if ($response === 0) { $this...
[ "public", "function", "uninstall", "(", "Request", "$", "request", ")", "{", "$", "package", "=", "$", "request", "->", "get", "(", "'package'", ")", ";", "try", "{", "$", "response", "=", "$", "this", "->", "manager", "(", ")", "->", "removePackage", ...
Uninstall a package. @param Request $request @throws PackageManagerException @return \Symfony\Component\HttpFoundation\Response
[ "Uninstall", "a", "package", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Backend/Extend.php#L436-L453
bolt/bolt
src/Controller/Backend/Extend.php
Extend.getRenderContext
private function getRenderContext() { $bundled = array_filter( $this->app['extensions']->all(), function (ResolvedExtension $ext) { return $ext->isBundled(); } ); return [ 'messages' => $this->app['extend.ping']->getMessa...
php
private function getRenderContext() { $bundled = array_filter( $this->app['extensions']->all(), function (ResolvedExtension $ext) { return $ext->isBundled(); } ); return [ 'messages' => $this->app['extend.ping']->getMessa...
[ "private", "function", "getRenderContext", "(", ")", "{", "$", "bundled", "=", "array_filter", "(", "$", "this", "->", "app", "[", "'extensions'", "]", "->", "all", "(", ")", ",", "function", "(", "ResolvedExtension", "$", "ext", ")", "{", "return", "$",...
Get render parameters for Twig. @return array
[ "Get", "render", "parameters", "for", "Twig", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Backend/Extend.php#L460-L479
bolt/bolt
src/Controller/Backend/Extend.php
Extend.getJsonException
private function getJsonException(\Exception $e) { $file = Path::makeRelative($e->getFile(), $this->app['path_resolver']->resolve('root')); $error = [ 'error' => [ 'type' => get_class($e), 'file' => $file, 'line' => $e->getLine(),...
php
private function getJsonException(\Exception $e) { $file = Path::makeRelative($e->getFile(), $this->app['path_resolver']->resolve('root')); $error = [ 'error' => [ 'type' => get_class($e), 'file' => $file, 'line' => $e->getLine(),...
[ "private", "function", "getJsonException", "(", "\\", "Exception", "$", "e", ")", "{", "$", "file", "=", "Path", "::", "makeRelative", "(", "$", "e", "->", "getFile", "(", ")", ",", "$", "this", "->", "app", "[", "'path_resolver'", "]", "->", "resolve"...
Return an exception formatted as JSON. @param \Exception $e @return JsonResponse
[ "Return", "an", "exception", "formatted", "as", "JSON", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Backend/Extend.php#L496-L510
bolt/bolt
src/Nut/DebugEvents.php
DebugEvents.execute
protected function execute(InputInterface $input, OutputInterface $output) { $dispatcher = $this->app['dispatcher']; $listeners = $dispatcher->getListeners(); if ($input->getOption('summary')) { $this->io->title('Event Names Registered on Dispatcher'); $this->io->lis...
php
protected function execute(InputInterface $input, OutputInterface $output) { $dispatcher = $this->app['dispatcher']; $listeners = $dispatcher->getListeners(); if ($input->getOption('summary')) { $this->io->title('Event Names Registered on Dispatcher'); $this->io->lis...
[ "protected", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "$", "dispatcher", "=", "$", "this", "->", "app", "[", "'dispatcher'", "]", ";", "$", "listeners", "=", "$", "dispatcher", "->", "getL...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/DebugEvents.php#L38-L97
bolt/bolt
src/Nut/DebugEvents.php
DebugEvents.getTable
protected function getTable(OutputInterface $output) { $table = new Table($output); $leftAligned = new TableStyle(); $leftAligned->setPadType(STR_PAD_LEFT); $table->setColumnStyle(0, $leftAligned); $rightAligned = new TableStyle(); $rightAligned->setPadType(STR_PAD_...
php
protected function getTable(OutputInterface $output) { $table = new Table($output); $leftAligned = new TableStyle(); $leftAligned->setPadType(STR_PAD_LEFT); $table->setColumnStyle(0, $leftAligned); $rightAligned = new TableStyle(); $rightAligned->setPadType(STR_PAD_...
[ "protected", "function", "getTable", "(", "OutputInterface", "$", "output", ")", "{", "$", "table", "=", "new", "Table", "(", "$", "output", ")", ";", "$", "leftAligned", "=", "new", "TableStyle", "(", ")", ";", "$", "leftAligned", "->", "setPadType", "(...
@param OutputInterface $output @return Table
[ "@param", "OutputInterface", "$output" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/DebugEvents.php#L104-L121
bolt/bolt
src/Storage/Database/Schema/Types/ConversionException.php
ConversionException.conversionFailedSerialization
public static function conversionFailedSerialization($value, $format, $error, Exception $e = null) { $actualType = is_object($value) ? get_class($value) : gettype($value); return new self(sprintf( "Could not convert PHP type '%s' to '%s', as an error was triggered by the serialization: ...
php
public static function conversionFailedSerialization($value, $format, $error, Exception $e = null) { $actualType = is_object($value) ? get_class($value) : gettype($value); return new self(sprintf( "Could not convert PHP type '%s' to '%s', as an error was triggered by the serialization: ...
[ "public", "static", "function", "conversionFailedSerialization", "(", "$", "value", ",", "$", "format", ",", "$", "error", ",", "Exception", "$", "e", "=", "null", ")", "{", "$", "actualType", "=", "is_object", "(", "$", "value", ")", "?", "get_class", "...
Thrown when a value failed serialisation. @param mixed $value @param string $format @param string $error @param Exception|null $e @return ConversionException
[ "Thrown", "when", "a", "value", "failed", "serialisation", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Database/Schema/Types/ConversionException.php#L25-L35
bolt/bolt
src/Extension/TwigTrait.php
TwigTrait.extendTwigService
final protected function extendTwigService() { $app = $this->getContainer(); $app['twig'] = $app->share( $app->extend( 'twig', function ($twig) { $this->loadTwig($twig); return $twig; } ...
php
final protected function extendTwigService() { $app = $this->getContainer(); $app['twig'] = $app->share( $app->extend( 'twig', function ($twig) { $this->loadTwig($twig); return $twig; } ...
[ "final", "protected", "function", "extendTwigService", "(", ")", "{", "$", "app", "=", "$", "this", "->", "getContainer", "(", ")", ";", "$", "app", "[", "'twig'", "]", "=", "$", "app", "->", "share", "(", "$", "app", "->", "extend", "(", "'twig'", ...
Call this in register method. @internal
[ "Call", "this", "in", "register", "method", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Extension/TwigTrait.php#L93-L107
bolt/bolt
src/Extension/TwigTrait.php
TwigTrait.loadTwig
private function loadTwig(Environment $twig) { foreach ($this->registerTwigFunctions() as $name => $options) { if (is_string($options)) { $this->addTwigFunction($name, $options); } else { $this->addTwigFunction($name, $options[0], isset($options[1]) ? ...
php
private function loadTwig(Environment $twig) { foreach ($this->registerTwigFunctions() as $name => $options) { if (is_string($options)) { $this->addTwigFunction($name, $options); } else { $this->addTwigFunction($name, $options[0], isset($options[1]) ? ...
[ "private", "function", "loadTwig", "(", "Environment", "$", "twig", ")", "{", "foreach", "(", "$", "this", "->", "registerTwigFunctions", "(", ")", "as", "$", "name", "=>", "$", "options", ")", "{", "if", "(", "is_string", "(", "$", "options", ")", ")"...
Adds filters and functions to Twig Environment. @param Environment $twig
[ "Adds", "filters", "and", "functions", "to", "Twig", "Environment", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Extension/TwigTrait.php#L114-L149
bolt/bolt
src/Extension/TwigTrait.php
TwigTrait.addTwigPath
private function addTwigPath($path, array $options = []) { if ($path === 'templates' && $this->pathAdded) { return; } $app = $this->getContainer(); $position = isset($options['position']) ? $options['position'] : 'append'; $namespace = isset($options['namespace'...
php
private function addTwigPath($path, array $options = []) { if ($path === 'templates' && $this->pathAdded) { return; } $app = $this->getContainer(); $position = isset($options['position']) ? $options['position'] : 'append'; $namespace = isset($options['namespace'...
[ "private", "function", "addTwigPath", "(", "$", "path", ",", "array", "$", "options", "=", "[", "]", ")", "{", "if", "(", "$", "path", "===", "'templates'", "&&", "$", "this", "->", "pathAdded", ")", "{", "return", ";", "}", "$", "app", "=", "$", ...
Append a path to Twig's path array. @param string $path @param array $options @throws LoaderError
[ "Append", "a", "path", "to", "Twig", "s", "path", "array", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Extension/TwigTrait.php#L181-L205
bolt/bolt
src/Extension/TwigTrait.php
TwigTrait.addTwigFunction
protected function addTwigFunction($name, $callback, $options = []) { // If we pass a callback as a simple string, we need to turn it into an array. if (is_string($callback) && method_exists($this, $callback)) { $callback = [$this, $callback]; } $safe = method_exists($th...
php
protected function addTwigFunction($name, $callback, $options = []) { // If we pass a callback as a simple string, we need to turn it into an array. if (is_string($callback) && method_exists($this, $callback)) { $callback = [$this, $callback]; } $safe = method_exists($th...
[ "protected", "function", "addTwigFunction", "(", "$", "name", ",", "$", "callback", ",", "$", "options", "=", "[", "]", ")", "{", "// If we pass a callback as a simple string, we need to turn it into an array.", "if", "(", "is_string", "(", "$", "callback", ")", "&&...
Add a Twig Function. @internal Will be made private in 4.0. Use registerTwigFunctions() instead. @param string $name @param string|callable $callback @param array $options
[ "Add", "a", "Twig", "Function", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Extension/TwigTrait.php#L216-L234
bolt/bolt
src/Extension/TwigTrait.php
TwigTrait.addTwigFilter
protected function addTwigFilter($name, $callback, $options = []) { // If we pass a callback as a simple string, we need to turn it into an array. if (is_string($callback) && method_exists($this, $callback)) { $callback = [$this, $callback]; } $safe = method_exists($this...
php
protected function addTwigFilter($name, $callback, $options = []) { // If we pass a callback as a simple string, we need to turn it into an array. if (is_string($callback) && method_exists($this, $callback)) { $callback = [$this, $callback]; } $safe = method_exists($this...
[ "protected", "function", "addTwigFilter", "(", "$", "name", ",", "$", "callback", ",", "$", "options", "=", "[", "]", ")", "{", "// If we pass a callback as a simple string, we need to turn it into an array.", "if", "(", "is_string", "(", "$", "callback", ")", "&&",...
Add a Twig Filter. @internal Will be made private in 4.0. Use registerTwigFilters() instead. @param string $name @param string|callable $callback @param array $options
[ "Add", "a", "Twig", "Filter", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Extension/TwigTrait.php#L245-L263
bolt/bolt
src/Extension/TwigTrait.php
TwigTrait.renderTemplate
protected function renderTemplate($template, array $context = []) { $app = $this->getContainer(); if ($this->pathAdded === false) { $this->addTwigPath('templates'); $this->pathAdded = true; } return $app['twig']->render($template, $context); }
php
protected function renderTemplate($template, array $context = []) { $app = $this->getContainer(); if ($this->pathAdded === false) { $this->addTwigPath('templates'); $this->pathAdded = true; } return $app['twig']->render($template, $context); }
[ "protected", "function", "renderTemplate", "(", "$", "template", ",", "array", "$", "context", "=", "[", "]", ")", "{", "$", "app", "=", "$", "this", "->", "getContainer", "(", ")", ";", "if", "(", "$", "this", "->", "pathAdded", "===", "false", ")",...
Render a Twig template. @param string $template @param array $context @return string
[ "Render", "a", "Twig", "template", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Extension/TwigTrait.php#L273-L283
bolt/bolt
src/Storage/Database/Schema/Table/LogChange.php
LogChange.addColumns
protected function addColumns() { // @codingStandardsIgnoreStart $this->table->addColumn('id', 'integer', ['autoincrement' => true]); $this->table->addColumn('date', 'datetime', []); $this->table->addColumn('ownerid', 'integer', ['notnull' => false])...
php
protected function addColumns() { // @codingStandardsIgnoreStart $this->table->addColumn('id', 'integer', ['autoincrement' => true]); $this->table->addColumn('date', 'datetime', []); $this->table->addColumn('ownerid', 'integer', ['notnull' => false])...
[ "protected", "function", "addColumns", "(", ")", "{", "// @codingStandardsIgnoreStart", "$", "this", "->", "table", "->", "addColumn", "(", "'id'", ",", "'integer'", ",", "[", "'autoincrement'", "=>", "true", "]", ")", ";", "$", "this", "->", "table", "->", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Database/Schema/Table/LogChange.php#L15-L28
bolt/bolt
src/Helpers/Input.php
Input.cleanPostedData
public static function cleanPostedData($var, $stripslashes = true, $stripControlChars = false) { if (is_array($var)) { foreach ($var as $key => $value) { $var[$key] = static::cleanPostedData($value, $stripslashes, $stripControlChars); } } elseif (is_string($va...
php
public static function cleanPostedData($var, $stripslashes = true, $stripControlChars = false) { if (is_array($var)) { foreach ($var as $key => $value) { $var[$key] = static::cleanPostedData($value, $stripslashes, $stripControlChars); } } elseif (is_string($va...
[ "public", "static", "function", "cleanPostedData", "(", "$", "var", ",", "$", "stripslashes", "=", "true", ",", "$", "stripControlChars", "=", "false", ")", "{", "if", "(", "is_array", "(", "$", "var", ")", ")", "{", "foreach", "(", "$", "var", "as", ...
Clean posted data. Convert tabs to spaces (primarily for yaml) and stripslashes when magic quotes are turned on. @param mixed $var @param bool $stripslashes @param bool $stripControlChars @return string|array
[ "Clean", "posted", "data", ".", "Convert", "tabs", "to", "spaces", "(", "primarily", "for", "yaml", ")", "and", "stripslashes", "when", "magic", "quotes", "are", "turned", "on", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Helpers/Input.php#L17-L34
bolt/bolt
src/Form/FormType/ContentEditType.php
ContentEditType.buildForm
public function buildForm(FormBuilderInterface $builder, array $options) { $builder ->add( 'save', SubmitType::class, [ 'label' => Trans::__('contenttypes.generic.save', ['%contenttype%' => $options['contenttype_name']]), ...
php
public function buildForm(FormBuilderInterface $builder, array $options) { $builder ->add( 'save', SubmitType::class, [ 'label' => Trans::__('contenttypes.generic.save', ['%contenttype%' => $options['contenttype_name']]), ...
[ "public", "function", "buildForm", "(", "FormBuilderInterface", "$", "builder", ",", "array", "$", "options", ")", "{", "$", "builder", "->", "add", "(", "'save'", ",", "SubmitType", "::", "class", ",", "[", "'label'", "=>", "Trans", "::", "__", "(", "'c...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Form/FormType/ContentEditType.php#L22-L71
bolt/bolt
src/Configuration/PathResolver.php
PathResolver.define
public function define($name, $path) { $name = $this->normalizeName($name); if (strpos($path, "%$name%") !== false) { throw new \InvalidArgumentException('Paths cannot reference themselves.'); } $this->paths[$name] = $path; }
php
public function define($name, $path) { $name = $this->normalizeName($name); if (strpos($path, "%$name%") !== false) { throw new \InvalidArgumentException('Paths cannot reference themselves.'); } $this->paths[$name] = $path; }
[ "public", "function", "define", "(", "$", "name", ",", "$", "path", ")", "{", "$", "name", "=", "$", "this", "->", "normalizeName", "(", "$", "name", ")", ";", "if", "(", "strpos", "(", "$", "path", ",", "\"%$name%\"", ")", "!==", "false", ")", "...
Define a path, or really an alias/variable. @param string $name @param string $path
[ "Define", "a", "path", "or", "really", "an", "alias", "/", "variable", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Configuration/PathResolver.php#L75-L84
bolt/bolt
src/Configuration/PathResolver.php
PathResolver.resolve
public function resolve($path, $absolute = true) { $path = $this->normalizeName($path); if (isset($this->paths[$path])) { $path = $this->paths[$path]; } $path = preg_replace_callback('#%(.+)%#', function ($match) use ($path) { $alias = $match[1]; ...
php
public function resolve($path, $absolute = true) { $path = $this->normalizeName($path); if (isset($this->paths[$path])) { $path = $this->paths[$path]; } $path = preg_replace_callback('#%(.+)%#', function ($match) use ($path) { $alias = $match[1]; ...
[ "public", "function", "resolve", "(", "$", "path", ",", "$", "absolute", "=", "true", ")", "{", "$", "path", "=", "$", "this", "->", "normalizeName", "(", "$", "path", ")", ";", "if", "(", "isset", "(", "$", "this", "->", "paths", "[", "$", "path...
Resolve a path. Examples: - `%web%/files` - A path with variables. - `files` - A previously defined variable. - `foo/bar` - A relative path that will be resolved against the root path. - `/tmp` - An absolute path will be returned as is. @param string $path the path @param bool $absolute if the path is relative,...
[ "Resolve", "a", "path", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Configuration/PathResolver.php#L100-L138
bolt/bolt
src/Configuration/PathResolver.php
PathResolver.raw
public function raw($name) { $name = $this->normalizeName($name); return isset($this->paths[$name]) ? $this->paths[$name] : null; }
php
public function raw($name) { $name = $this->normalizeName($name); return isset($this->paths[$name]) ? $this->paths[$name] : null; }
[ "public", "function", "raw", "(", "$", "name", ")", "{", "$", "name", "=", "$", "this", "->", "normalizeName", "(", "$", "name", ")", ";", "return", "isset", "(", "$", "this", "->", "paths", "[", "$", "name", "]", ")", "?", "$", "this", "->", "...
Returns the raw path definition for the name given. @param string $name @return string|null
[ "Returns", "the", "raw", "path", "definition", "for", "the", "name", "given", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Configuration/PathResolver.php#L147-L152
bolt/bolt
src/Nut/DatabaseExport.php
DatabaseExport.execute
protected function execute(InputInterface $input, OutputInterface $output) { // Get file & directory paths list($fileName, $dirPath) = $this->getResolvedPaths($input); $filesystem = new Filesystem(new Local($dirPath)); /** @var JsonFile|YamlFile $file */ $file = $filesystem->...
php
protected function execute(InputInterface $input, OutputInterface $output) { // Get file & directory paths list($fileName, $dirPath) = $this->getResolvedPaths($input); $filesystem = new Filesystem(new Local($dirPath)); /** @var JsonFile|YamlFile $file */ $file = $filesystem->...
[ "protected", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "// Get file & directory paths", "list", "(", "$", "fileName", ",", "$", "dirPath", ")", "=", "$", "this", "->", "getResolvedPaths", "(", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/DatabaseExport.php#L42-L73
bolt/bolt
src/Nut/DatabaseExport.php
DatabaseExport.getResolvedPaths
private function getResolvedPaths(InputInterface $input) { $fileName = $input->getOption('file'); $dirPath = $input->getOption('directory'); if ($fileName === null && $dirPath === null) { throw new RuntimeException('Either the --file or --directory option is required.'); ...
php
private function getResolvedPaths(InputInterface $input) { $fileName = $input->getOption('file'); $dirPath = $input->getOption('directory'); if ($fileName === null && $dirPath === null) { throw new RuntimeException('Either the --file or --directory option is required.'); ...
[ "private", "function", "getResolvedPaths", "(", "InputInterface", "$", "input", ")", "{", "$", "fileName", "=", "$", "input", "->", "getOption", "(", "'file'", ")", ";", "$", "dirPath", "=", "$", "input", "->", "getOption", "(", "'directory'", ")", ";", ...
@param InputInterface $input @throws RuntimeException @return array
[ "@param", "InputInterface", "$input" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/DatabaseExport.php#L82-L102
bolt/bolt
src/Configuration/PathDependencySorter.php
PathDependencySorter.getSortedNames
public function getSortedNames() { $sorted = []; $toSort = $this->getDependencies(); while (count($toSort) > 0) { foreach ($toSort as $name => $dependencies) { if (!array_diff($dependencies, $sorted)) { $sorted[] = $name; u...
php
public function getSortedNames() { $sorted = []; $toSort = $this->getDependencies(); while (count($toSort) > 0) { foreach ($toSort as $name => $dependencies) { if (!array_diff($dependencies, $sorted)) { $sorted[] = $name; u...
[ "public", "function", "getSortedNames", "(", ")", "{", "$", "sorted", "=", "[", "]", ";", "$", "toSort", "=", "$", "this", "->", "getDependencies", "(", ")", ";", "while", "(", "count", "(", "$", "toSort", ")", ">", "0", ")", "{", "foreach", "(", ...
Returns the list of path names sorted by least dependent first. @return string[]
[ "Returns", "the", "list", "of", "path", "names", "sorted", "by", "least", "dependent", "first", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Configuration/PathDependencySorter.php#L34-L49
bolt/bolt
src/Configuration/PathDependencySorter.php
PathDependencySorter.getDependencies
private function getDependencies() { $dependencies = []; foreach ($this->resolver->names() as $name) { $dependencies[$name] = $this->getDependenciesRecursive($name); } return $dependencies; }
php
private function getDependencies() { $dependencies = []; foreach ($this->resolver->names() as $name) { $dependencies[$name] = $this->getDependenciesRecursive($name); } return $dependencies; }
[ "private", "function", "getDependencies", "(", ")", "{", "$", "dependencies", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "resolver", "->", "names", "(", ")", "as", "$", "name", ")", "{", "$", "dependencies", "[", "$", "name", "]", "=", ...
Returns path names with their dependencies. @return array [name => dependencies]
[ "Returns", "path", "names", "with", "their", "dependencies", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Configuration/PathDependencySorter.php#L56-L65
bolt/bolt
src/Configuration/PathDependencySorter.php
PathDependencySorter.getDependenciesRecursive
private function getDependenciesRecursive($path, $dependencies = []) { $raw = $this->resolver->raw($path); if ($raw !== null) { $path = $raw; } preg_match_all('#%([^/\\\\]+)%#', $path, $matches); foreach ($matches[1] as $alias) { if (!in_array($alias,...
php
private function getDependenciesRecursive($path, $dependencies = []) { $raw = $this->resolver->raw($path); if ($raw !== null) { $path = $raw; } preg_match_all('#%([^/\\\\]+)%#', $path, $matches); foreach ($matches[1] as $alias) { if (!in_array($alias,...
[ "private", "function", "getDependenciesRecursive", "(", "$", "path", ",", "$", "dependencies", "=", "[", "]", ")", "{", "$", "raw", "=", "$", "this", "->", "resolver", "->", "raw", "(", "$", "path", ")", ";", "if", "(", "$", "raw", "!==", "null", "...
Returns dependencies recursively for a path. @param string $path @param array $dependencies @return array
[ "Returns", "dependencies", "recursively", "for", "a", "path", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Configuration/PathDependencySorter.php#L75-L101
bolt/bolt
src/Filesystem/Matcher.php
Matcher.getFile
public function getFile($path, $throwException = true) { if ($path instanceof FileInterface) { return $path; } if (!$this->filesystem instanceof AggregateFilesystemInterface || $this->containsMountPoint($path)) { $file = $this->filesystem->getFile($path); ...
php
public function getFile($path, $throwException = true) { if ($path instanceof FileInterface) { return $path; } if (!$this->filesystem instanceof AggregateFilesystemInterface || $this->containsMountPoint($path)) { $file = $this->filesystem->getFile($path); ...
[ "public", "function", "getFile", "(", "$", "path", ",", "$", "throwException", "=", "true", ")", "{", "if", "(", "$", "path", "instanceof", "FileInterface", ")", "{", "return", "$", "path", ";", "}", "if", "(", "!", "$", "this", "->", "filesystem", "...
Gets the file object for the path given. Paths with the mount point included are preferred, but are not required for BC. If the mount point is not included a list of filesystems are checked and chosen if the file exists in that filesystem. @param FileInterface|string $path @param bool $throwException ...
[ "Gets", "the", "file", "object", "for", "the", "path", "given", ".", "Paths", "with", "the", "mount", "point", "included", "are", "preferred", "but", "are", "not", "required", "for", "BC", ".", "If", "the", "mount", "point", "is", "not", "included", "a",...
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Filesystem/Matcher.php#L47-L86
bolt/bolt
src/Filesystem/Matcher.php
Matcher.getImage
public function getImage($path, $throwException = true) { if ($path instanceof ImageInterface) { return $path; } $file = $this->getFile($path, $throwException); if ($file) { return $this->filesystem->getImage($file->getFullPath()); } return n...
php
public function getImage($path, $throwException = true) { if ($path instanceof ImageInterface) { return $path; } $file = $this->getFile($path, $throwException); if ($file) { return $this->filesystem->getImage($file->getFullPath()); } return n...
[ "public", "function", "getImage", "(", "$", "path", ",", "$", "throwException", "=", "true", ")", "{", "if", "(", "$", "path", "instanceof", "ImageInterface", ")", "{", "return", "$", "path", ";", "}", "$", "file", "=", "$", "this", "->", "getFile", ...
Same as {@see getFile} for images. @param ImageInterface|string $path @param bool $throwException @throws FileNotFoundException if file was not found @return ImageInterface
[ "Same", "as", "{", "@see", "getFile", "}", "for", "images", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Filesystem/Matcher.php#L98-L110
bolt/bolt
src/Storage/Database/Schema/Types/CarbonDateTimeType.php
CarbonDateTimeType.convertToPHPValue
public function convertToPHPValue($value, AbstractPlatform $platform) { if ($value === null || $value === '') { return null; } return Carbon::instance(parent::convertToPHPValue($value, $platform)); }
php
public function convertToPHPValue($value, AbstractPlatform $platform) { if ($value === null || $value === '') { return null; } return Carbon::instance(parent::convertToPHPValue($value, $platform)); }
[ "public", "function", "convertToPHPValue", "(", "$", "value", ",", "AbstractPlatform", "$", "platform", ")", "{", "if", "(", "$", "value", "===", "null", "||", "$", "value", "===", "''", ")", "{", "return", "null", ";", "}", "return", "Carbon", "::", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Database/Schema/Types/CarbonDateTimeType.php#L21-L28
bolt/bolt
src/EventListener/FlashLoggerListener.php
FlashLoggerListener.onRequest
public function onRequest(GetResponseEvent $event) { if (!$event->isMasterRequest()) { return; } $request = $event->getRequest(); $session = $request->getSession(); $isProfilerRoute = strpos($request->getPathInfo(), $this->profilerMountPrefix) === 0; if ...
php
public function onRequest(GetResponseEvent $event) { if (!$event->isMasterRequest()) { return; } $request = $event->getRequest(); $session = $request->getSession(); $isProfilerRoute = strpos($request->getPathInfo(), $this->profilerMountPrefix) === 0; if ...
[ "public", "function", "onRequest", "(", "GetResponseEvent", "$", "event", ")", "{", "if", "(", "!", "$", "event", "->", "isMasterRequest", "(", ")", ")", "{", "return", ";", "}", "$", "request", "=", "$", "event", "->", "getRequest", "(", ")", ";", "...
Resume the session if it has been started previously or debugging is enabled. @param GetResponseEvent $event
[ "Resume", "the", "session", "if", "it", "has", "been", "started", "previously", "or", "debugging", "is", "enabled", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/EventListener/FlashLoggerListener.php#L45-L58
bolt/bolt
src/EventListener/FlashLoggerListener.php
FlashLoggerListener.onEvent
public function onEvent($event) { if (!$event->isMasterRequest()) { return; } $session = $event->getRequest()->getSession(); if ($session && $session->isStarted()) { $this->attachFlashBag($session); } }
php
public function onEvent($event) { if (!$event->isMasterRequest()) { return; } $session = $event->getRequest()->getSession(); if ($session && $session->isStarted()) { $this->attachFlashBag($session); } }
[ "public", "function", "onEvent", "(", "$", "event", ")", "{", "if", "(", "!", "$", "event", "->", "isMasterRequest", "(", ")", ")", "{", "return", ";", "}", "$", "session", "=", "$", "event", "->", "getRequest", "(", ")", "->", "getSession", "(", "...
Attach session's flash bag to flash logger if it is started. @param GetResponseEvent|FilterResponseEvent $event
[ "Attach", "session", "s", "flash", "bag", "to", "flash", "logger", "if", "it", "is", "started", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/EventListener/FlashLoggerListener.php#L65-L75
bolt/bolt
src/Extension/StorageTrait.php
StorageTrait.extendRepositoryMapping
final protected function extendRepositoryMapping() { $app = $this->getContainer(); $app['storage'] = $app->share( $app->extend( 'storage', function ($entityManager) use ($app) { foreach ($this->registerRepositoryMappings() as $alias =>...
php
final protected function extendRepositoryMapping() { $app = $this->getContainer(); $app['storage'] = $app->share( $app->extend( 'storage', function ($entityManager) use ($app) { foreach ($this->registerRepositoryMappings() as $alias =>...
[ "final", "protected", "function", "extendRepositoryMapping", "(", ")", "{", "$", "app", "=", "$", "this", "->", "getContainer", "(", ")", ";", "$", "app", "[", "'storage'", "]", "=", "$", "app", "->", "share", "(", "$", "app", "->", "extend", "(", "'...
Call this in register method. @internal
[ "Call", "this", "in", "register", "method", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Extension/StorageTrait.php#L36-L59
bolt/bolt
src/Storage/Database/Schema/Timer.php
Timer.isCheckRequired
public function isCheckRequired() { if ($this->expired === false) { return false; } if ($this->cacheFile->exists()) { $expiryTimestamp = (int) $this->cacheFile->read(); } else { $expiryTimestamp = 0; } $ts = Carbon::createFromTimes...
php
public function isCheckRequired() { if ($this->expired === false) { return false; } if ($this->cacheFile->exists()) { $expiryTimestamp = (int) $this->cacheFile->read(); } else { $expiryTimestamp = 0; } $ts = Carbon::createFromTimes...
[ "public", "function", "isCheckRequired", "(", ")", "{", "if", "(", "$", "this", "->", "expired", "===", "false", ")", "{", "return", "false", ";", "}", "if", "(", "$", "this", "->", "cacheFile", "->", "exists", "(", ")", ")", "{", "$", "expiryTimesta...
Check if we have determined that we need to do a database check. @return bool
[ "Check", "if", "we", "have", "determined", "that", "we", "need", "to", "do", "a", "database", "check", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Database/Schema/Timer.php#L40-L54
bolt/bolt
src/Storage/Database/Schema/Timer.php
Timer.setCheckRequired
public function setCheckRequired() { try { $this->expired = true; $this->cacheFile->delete(); } catch (FileNotFoundException $e) { // Don't need to delete the file, it isn't there } catch (IOException $e) { $message = sprintf('Unable to remove ...
php
public function setCheckRequired() { try { $this->expired = true; $this->cacheFile->delete(); } catch (FileNotFoundException $e) { // Don't need to delete the file, it isn't there } catch (IOException $e) { $message = sprintf('Unable to remove ...
[ "public", "function", "setCheckRequired", "(", ")", "{", "try", "{", "$", "this", "->", "expired", "=", "true", ";", "$", "this", "->", "cacheFile", "->", "delete", "(", ")", ";", "}", "catch", "(", "FileNotFoundException", "$", "e", ")", "{", "// Don'...
Invalidate our database check by removing the timestamp file from cache. @throws \RuntimeException
[ "Invalidate", "our", "database", "check", "by", "removing", "the", "timestamp", "file", "from", "cache", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Database/Schema/Timer.php#L61-L73
bolt/bolt
src/Storage/Database/Schema/Timer.php
Timer.setCheckExpiry
public function setCheckExpiry() { try { $this->expired = false; $this->cacheFile->put(Carbon::now()->getTimestamp()); } catch (IOException $e) { // Something went wrong } }
php
public function setCheckExpiry() { try { $this->expired = false; $this->cacheFile->put(Carbon::now()->getTimestamp()); } catch (IOException $e) { // Something went wrong } }
[ "public", "function", "setCheckExpiry", "(", ")", "{", "try", "{", "$", "this", "->", "expired", "=", "false", ";", "$", "this", "->", "cacheFile", "->", "put", "(", "Carbon", "::", "now", "(", ")", "->", "getTimestamp", "(", ")", ")", ";", "}", "c...
Set our state as valid by writing the current date/time to the app/cache/dbcheck.ts file. We only want to do these checks once per hour, per session, since it's pretty time consuming… Unless specifically requested.
[ "Set", "our", "state", "as", "valid", "by", "writing", "the", "current", "date", "/", "time", "to", "the", "app", "/", "cache", "/", "dbcheck", ".", "ts", "file", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Database/Schema/Timer.php#L82-L90
bolt/bolt
src/Cache.php
Cache.doFlush
protected function doFlush() { // Clear Doctrine's folder. $result = parent::doFlush(); if ($this->filesystem instanceof CompositeFilesystemInterface) { $cacheFs = $this->filesystem->getFilesystem('cache'); // Clear our cached configuration if ($cacheFs->...
php
protected function doFlush() { // Clear Doctrine's folder. $result = parent::doFlush(); if ($this->filesystem instanceof CompositeFilesystemInterface) { $cacheFs = $this->filesystem->getFilesystem('cache'); // Clear our cached configuration if ($cacheFs->...
[ "protected", "function", "doFlush", "(", ")", "{", "// Clear Doctrine's folder.", "$", "result", "=", "parent", "::", "doFlush", "(", ")", ";", "if", "(", "$", "this", "->", "filesystem", "instanceof", "CompositeFilesystemInterface", ")", "{", "$", "cacheFs", ...
Clear the cache. Both the doctrine FilesystemCache, as well as twig and thumbnail temp files. @return bool
[ "Clear", "the", "cache", ".", "Both", "the", "doctrine", "FilesystemCache", "as", "well", "as", "twig", "and", "thumbnail", "temp", "files", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Cache.php#L72-L100
bolt/bolt
src/Cache.php
Cache.flushDirectory
private function flushDirectory(DirectoryInterface $directory) { if (!$directory->exists()) { return; } $files = $directory->find() ->ignoreDotFiles() ->ignoreVCS() ; /** @var HandlerInterface $file */ foreach ($files as $file) { ...
php
private function flushDirectory(DirectoryInterface $directory) { if (!$directory->exists()) { return; } $files = $directory->find() ->ignoreDotFiles() ->ignoreVCS() ; /** @var HandlerInterface $file */ foreach ($files as $file) { ...
[ "private", "function", "flushDirectory", "(", "DirectoryInterface", "$", "directory", ")", "{", "if", "(", "!", "$", "directory", "->", "exists", "(", ")", ")", "{", "return", ";", "}", "$", "files", "=", "$", "directory", "->", "find", "(", ")", "->",...
Helper function for doFlush(). @param DirectoryInterface $directory
[ "Helper", "function", "for", "doFlush", "()", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Cache.php#L107-L125
bolt/bolt
src/Cache.php
Cache.createPathIfNeeded
private function createPathIfNeeded() { if (!is_dir($this->directory)) { return @mkdir($this->directory, 0777 & (~$this->umask), true) && !is_dir($this->directory); } return true; }
php
private function createPathIfNeeded() { if (!is_dir($this->directory)) { return @mkdir($this->directory, 0777 & (~$this->umask), true) && !is_dir($this->directory); } return true; }
[ "private", "function", "createPathIfNeeded", "(", ")", "{", "if", "(", "!", "is_dir", "(", "$", "this", "->", "directory", ")", ")", "{", "return", "@", "mkdir", "(", "$", "this", "->", "directory", ",", "0777", "&", "(", "~", "$", "this", "->", "u...
Create base path path if needed. @return bool
[ "Create", "base", "path", "path", "if", "needed", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Cache.php#L132-L139
bolt/bolt
src/Configuration/PathResolverFactory.php
PathResolverFactory.create
public function create() { if ($this->rootPath === null) { throw new \LogicException('Root path must be set before PathResolver can be created'); } return new PathResolver($this->rootPath, $this->paths); }
php
public function create() { if ($this->rootPath === null) { throw new \LogicException('Root path must be set before PathResolver can be created'); } return new PathResolver($this->rootPath, $this->paths); }
[ "public", "function", "create", "(", ")", "{", "if", "(", "$", "this", "->", "rootPath", "===", "null", ")", "{", "throw", "new", "\\", "LogicException", "(", "'Root path must be set before PathResolver can be created'", ")", ";", "}", "return", "new", "PathReso...
Create PathResolver. @return PathResolver
[ "Create", "PathResolver", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Configuration/PathResolverFactory.php#L94-L101
bolt/bolt
src/Storage/Database/Schema/Table/Users.php
Users.addColumns
protected function addColumns() { // @codingStandardsIgnoreStart $this->table->addColumn('id', 'integer', ['autoincrement' => true]); $this->table->addColumn('username', 'string', ['length' => 32]); $this->table->addColumn('password', 'string', ['le...
php
protected function addColumns() { // @codingStandardsIgnoreStart $this->table->addColumn('id', 'integer', ['autoincrement' => true]); $this->table->addColumn('username', 'string', ['length' => 32]); $this->table->addColumn('password', 'string', ['le...
[ "protected", "function", "addColumns", "(", ")", "{", "// @codingStandardsIgnoreStart", "$", "this", "->", "table", "->", "addColumn", "(", "'id'", ",", "'integer'", ",", "[", "'autoincrement'", "=>", "true", "]", ")", ";", "$", "this", "->", "table", "->", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Database/Schema/Table/Users.php#L15-L34
bolt/bolt
src/Storage/Database/Schema/Table/Users.php
Users.addIndexes
protected function addIndexes() { $this->table->addUniqueIndex(['username']); $this->table->addUniqueIndex(['email']); $this->table->addIndex(['enabled']); }
php
protected function addIndexes() { $this->table->addUniqueIndex(['username']); $this->table->addUniqueIndex(['email']); $this->table->addIndex(['enabled']); }
[ "protected", "function", "addIndexes", "(", ")", "{", "$", "this", "->", "table", "->", "addUniqueIndex", "(", "[", "'username'", "]", ")", ";", "$", "this", "->", "table", "->", "addUniqueIndex", "(", "[", "'email'", "]", ")", ";", "$", "this", "->", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Database/Schema/Table/Users.php#L39-L45
bolt/bolt
src/Storage/EntityManager.php
EntityManager.create
public function create($className, $data, ClassMetadataInterface $metadata = null) { $repo = $this->getRepository($className); return $repo->create($data, $metadata); }
php
public function create($className, $data, ClassMetadataInterface $metadata = null) { $repo = $this->getRepository($className); return $repo->create($data, $metadata); }
[ "public", "function", "create", "(", "$", "className", ",", "$", "data", ",", "ClassMetadataInterface", "$", "metadata", "=", "null", ")", "{", "$", "repo", "=", "$", "this", "->", "getRepository", "(", "$", "className", ")", ";", "return", "$", "repo", ...
Creates an entity of the given class, with the data supplied. @param string $className The type of entity to create @param array $data The data to use to hydrate the new entity @param ClassMetadataInterface $metadata @throws InvalidRepositoryException @return Entity\Entity
[ "Creates", "an", "entity", "of", "the", "given", "class", "with", "the", "data", "supplied", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/EntityManager.php#L104-L109
bolt/bolt
src/Storage/EntityManager.php
EntityManager.getEntityBuilder
public function getEntityBuilder($className = null, ClassMetadata $classMetadata = null) { $builder = new Entity\Builder($this->getMapper(), $this->getFieldManager()); if ($className !== null) { $builder->setClass($className); } if ($classMetadata !== null) { ...
php
public function getEntityBuilder($className = null, ClassMetadata $classMetadata = null) { $builder = new Entity\Builder($this->getMapper(), $this->getFieldManager()); if ($className !== null) { $builder->setClass($className); } if ($classMetadata !== null) { ...
[ "public", "function", "getEntityBuilder", "(", "$", "className", "=", "null", ",", "ClassMetadata", "$", "classMetadata", "=", "null", ")", "{", "$", "builder", "=", "new", "Entity", "\\", "Builder", "(", "$", "this", "->", "getMapper", "(", ")", ",", "$...
Get an entity builder instance for a given class. @param string $className @param ClassMetadata $classMetadata @return Entity\Builder
[ "Get", "an", "entity", "builder", "instance", "for", "a", "given", "class", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/EntityManager.php#L119-L132
bolt/bolt
src/Storage/EntityManager.php
EntityManager.createCollection
public function createCollection($className) { $className = (string) $className; if (array_key_exists($className, $this->aliases)) { $className = $this->aliases[$className]; } return $this->getCollectionManager()->create($className); }
php
public function createCollection($className) { $className = (string) $className; if (array_key_exists($className, $this->aliases)) { $className = $this->aliases[$className]; } return $this->getCollectionManager()->create($className); }
[ "public", "function", "createCollection", "(", "$", "className", ")", "{", "$", "className", "=", "(", "string", ")", "$", "className", ";", "if", "(", "array_key_exists", "(", "$", "className", ",", "$", "this", "->", "aliases", ")", ")", "{", "$", "c...
Shorthand access method to create collection. Consults aliases to allow short names. @param string|Entity\Entity $className @return ArrayCollection
[ "Shorthand", "access", "method", "to", "create", "collection", ".", "Consults", "aliases", "to", "allow", "short", "names", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/EntityManager.php#L189-L197
bolt/bolt
src/Storage/EntityManager.php
EntityManager.find
public function find($className, $id) { $repo = $this->getRepository($className); return $repo->find($id); }
php
public function find($className, $id) { $repo = $this->getRepository($className); return $repo->find($id); }
[ "public", "function", "find", "(", "$", "className", ",", "$", "id", ")", "{", "$", "repo", "=", "$", "this", "->", "getRepository", "(", "$", "className", ")", ";", "return", "$", "repo", "->", "find", "(", "$", "id", ")", ";", "}" ]
Finds an object by its identifier. This is just a convenient shortcut for getRepository($className)->find($id). @param string $className class name of the object to find @param int|string $id identity of the object to find @throws InvalidRepositoryException @return object the found object
[ "Finds", "an", "object", "by", "its", "identifier", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/EntityManager.php#L211-L216