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/Composer/EventListener/BufferIOListener.php
BufferIOListener.onPrePackage
public function onPrePackage(PackageEvent $event) { if ($event->getIO() instanceof BufferIO) { $this->logger->debug($event->getIO()->getOutput(), ['event' => 'extensions']); } }
php
public function onPrePackage(PackageEvent $event) { if ($event->getIO() instanceof BufferIO) { $this->logger->debug($event->getIO()->getOutput(), ['event' => 'extensions']); } }
[ "public", "function", "onPrePackage", "(", "PackageEvent", "$", "event", ")", "{", "if", "(", "$", "event", "->", "getIO", "(", ")", "instanceof", "BufferIO", ")", "{", "$", "this", "->", "logger", "->", "debug", "(", "$", "event", "->", "getIO", "(", ...
Composer pre-package action events. @param PackageEvent $event
[ "Composer", "pre", "-", "package", "action", "events", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/EventListener/BufferIOListener.php#L41-L46
bolt/bolt
src/EventListener/ExceptionToJsonListener.php
ExceptionToJsonListener.onException
public function onException(GetResponseForExceptionEvent $event) { if (!$this->isApplicable($event->getRequest())) { return; } $response = $this->convert($event->getException()); $event->setResponse($response); }
php
public function onException(GetResponseForExceptionEvent $event) { if (!$this->isApplicable($event->getRequest())) { return; } $response = $this->convert($event->getException()); $event->setResponse($response); }
[ "public", "function", "onException", "(", "GetResponseForExceptionEvent", "$", "event", ")", "{", "if", "(", "!", "$", "this", "->", "isApplicable", "(", "$", "event", "->", "getRequest", "(", ")", ")", ")", "{", "return", ";", "}", "$", "response", "=",...
Listen for exceptions and convert them to JSON responses if necessary. @param GetResponseForExceptionEvent $event
[ "Listen", "for", "exceptions", "and", "convert", "them", "to", "JSON", "responses", "if", "necessary", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/EventListener/ExceptionToJsonListener.php#L41-L50
bolt/bolt
src/EventListener/ExceptionToJsonListener.php
ExceptionToJsonListener.convert
protected function convert(\Exception $exception) { $statusCode = $exception instanceof HttpExceptionInterface ? $exception->getStatusCode() : Response::HTTP_INTERNAL_SERVER_ERROR; $file = Path::makeRelative($exception->getFile(), $this->pathResolver->resolve('root')); $response = new JsonR...
php
protected function convert(\Exception $exception) { $statusCode = $exception instanceof HttpExceptionInterface ? $exception->getStatusCode() : Response::HTTP_INTERNAL_SERVER_ERROR; $file = Path::makeRelative($exception->getFile(), $this->pathResolver->resolve('root')); $response = new JsonR...
[ "protected", "function", "convert", "(", "\\", "Exception", "$", "exception", ")", "{", "$", "statusCode", "=", "$", "exception", "instanceof", "HttpExceptionInterface", "?", "$", "exception", "->", "getStatusCode", "(", ")", ":", "Response", "::", "HTTP_INTERNA...
Convert the exception to a response. @param \Exception $exception @return JsonResponse
[ "Convert", "the", "exception", "to", "a", "response", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/EventListener/ExceptionToJsonListener.php#L71-L89
bolt/bolt
src/EventListener/ExceptionToJsonListener.php
ExceptionToJsonListener.getErrorType
protected function getErrorType(\Exception $exception) { $errorType = get_class($exception); $pos = strrpos($errorType, '\\'); if ($pos !== false) { $errorType = substr($errorType, $pos); } $errorType = Str::replaceLast($errorType, 'Exception', ''); if ...
php
protected function getErrorType(\Exception $exception) { $errorType = get_class($exception); $pos = strrpos($errorType, '\\'); if ($pos !== false) { $errorType = substr($errorType, $pos); } $errorType = Str::replaceLast($errorType, 'Exception', ''); if ...
[ "protected", "function", "getErrorType", "(", "\\", "Exception", "$", "exception", ")", "{", "$", "errorType", "=", "get_class", "(", "$", "exception", ")", ";", "$", "pos", "=", "strrpos", "(", "$", "errorType", ",", "'\\\\'", ")", ";", "if", "(", "$"...
Convert the exception to an error type. @param \Exception $exception @return string
[ "Convert", "the", "exception", "to", "an", "error", "type", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/EventListener/ExceptionToJsonListener.php#L98-L114
bolt/bolt
src/Nut/SetupRun.php
SetupRun.execute
protected function execute(InputInterface $input, OutputInterface $output) { if (!$this->reconcileSystemRequirements()) { return 1; } $this->reconcileDatabaseConfiguration($input->isInteractive()); if ($this->isDbSetup) { $this->reconcileDatabaseSchema($input,...
php
protected function execute(InputInterface $input, OutputInterface $output) { if (!$this->reconcileSystemRequirements()) { return 1; } $this->reconcileDatabaseConfiguration($input->isInteractive()); if ($this->isDbSetup) { $this->reconcileDatabaseSchema($input,...
[ "protected", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "if", "(", "!", "$", "this", "->", "reconcileSystemRequirements", "(", ")", ")", "{", "return", "1", ";", "}", "$", "this", "->", "r...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/SetupRun.php#L44-L58
bolt/bolt
src/Nut/SetupRun.php
SetupRun.reconcileDatabaseConfiguration
protected function reconcileDatabaseConfiguration($isInteractive) { $db = $this->app['db']; $confirmMessage = 'Continue with these database settings?'; $hasSqliteFile = $this->app['filesystem']->has('app://database/bolt.db'); $platform = $this->app['config']->get('general/database/dr...
php
protected function reconcileDatabaseConfiguration($isInteractive) { $db = $this->app['db']; $confirmMessage = 'Continue with these database settings?'; $hasSqliteFile = $this->app['filesystem']->has('app://database/bolt.db'); $platform = $this->app['config']->get('general/database/dr...
[ "protected", "function", "reconcileDatabaseConfiguration", "(", "$", "isInteractive", ")", "{", "$", "db", "=", "$", "this", "->", "app", "[", "'db'", "]", ";", "$", "confirmMessage", "=", "'Continue with these database settings?'", ";", "$", "hasSqliteFile", "=",...
@param bool $isInteractive @throws DatabaseConnectionException @return bool
[ "@param", "bool", "$isInteractive" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/SetupRun.php#L100-L154
bolt/bolt
src/Nut/SetupRun.php
SetupRun.reconcileDatabaseSchema
protected function reconcileDatabaseSchema(InputInterface $input, OutputInterface $output) { if ($this->isDbSetup === false) { return true; } $this->step(++$this->step, 'Checking Database Schema'); $command = $this->getApplication()->find('database:check'); $buffe...
php
protected function reconcileDatabaseSchema(InputInterface $input, OutputInterface $output) { if ($this->isDbSetup === false) { return true; } $this->step(++$this->step, 'Checking Database Schema'); $command = $this->getApplication()->find('database:check'); $buffe...
[ "protected", "function", "reconcileDatabaseSchema", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "if", "(", "$", "this", "->", "isDbSetup", "===", "false", ")", "{", "return", "true", ";", "}", "$", "this", "->", "s...
Check the database schema exists is consistent with the configuration. @param InputInterface $input @param OutputInterface $output @return bool
[ "Check", "the", "database", "schema", "exists", "is", "consistent", "with", "the", "configuration", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/SetupRun.php#L164-L190
bolt/bolt
src/Nut/SetupRun.php
SetupRun.reconcileRootUser
protected function reconcileRootUser(OutputInterface $output) { if ($this->isDbSetup === false) { return true; } /** @var UsersRepository $repo */ $repo = $this->app['storage']->getRepository(Entity\Users::class); if ($repo->count() > 0) { return true;...
php
protected function reconcileRootUser(OutputInterface $output) { if ($this->isDbSetup === false) { return true; } /** @var UsersRepository $repo */ $repo = $this->app['storage']->getRepository(Entity\Users::class); if ($repo->count() > 0) { return true;...
[ "protected", "function", "reconcileRootUser", "(", "OutputInterface", "$", "output", ")", "{", "if", "(", "$", "this", "->", "isDbSetup", "===", "false", ")", "{", "return", "true", ";", "}", "/** @var UsersRepository $repo */", "$", "repo", "=", "$", "this", ...
Create first user, with the "root" role. Only executes when no users are present in the database, and must be run after the database check/update. @param OutputInterface $output @return bool
[ "Create", "first", "user", "with", "the", "root", "role", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/SetupRun.php#L202-L229
bolt/bolt
src/Nut/SetupRun.php
SetupRun.reconcileExtensionEnvironment
protected function reconcileExtensionEnvironment(OutputInterface $output) { $this->step(++$this->step, 'Configuring Extension Environment'); $command = $this->getApplication()->find('extensions:setup'); $buffer = $this->getBufferedOutput($output, OutputInterface::VERBOSITY_QUIET); $i...
php
protected function reconcileExtensionEnvironment(OutputInterface $output) { $this->step(++$this->step, 'Configuring Extension Environment'); $command = $this->getApplication()->find('extensions:setup'); $buffer = $this->getBufferedOutput($output, OutputInterface::VERBOSITY_QUIET); $i...
[ "protected", "function", "reconcileExtensionEnvironment", "(", "OutputInterface", "$", "output", ")", "{", "$", "this", "->", "step", "(", "++", "$", "this", "->", "step", ",", "'Configuring Extension Environment'", ")", ";", "$", "command", "=", "$", "this", ...
Update/install the extension composer.json with latest Bolt specific parameters, version numbers, etc. @param OutputInterface $output @return bool
[ "Update", "/", "install", "the", "extension", "composer", ".", "json", "with", "latest", "Bolt", "specific", "parameters", "version", "numbers", "etc", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/SetupRun.php#L239-L252
bolt/bolt
src/Nut/SetupRun.php
SetupRun.reconcileInitialConfig
protected function reconcileInitialConfig(OutputInterface $output) { $this->step(++$this->step, 'Basic configuration'); $settings = $this->displayConfigTable(); $confirm = $this->io->confirm('Would you like to edit these now?', false); if ($confirm === false) { return tru...
php
protected function reconcileInitialConfig(OutputInterface $output) { $this->step(++$this->step, 'Basic configuration'); $settings = $this->displayConfigTable(); $confirm = $this->io->confirm('Would you like to edit these now?', false); if ($confirm === false) { return tru...
[ "protected", "function", "reconcileInitialConfig", "(", "OutputInterface", "$", "output", ")", "{", "$", "this", "->", "step", "(", "++", "$", "this", "->", "step", ",", "'Basic configuration'", ")", ";", "$", "settings", "=", "$", "this", "->", "displayConf...
Selective config edit on set-up. @param OutputInterface $output @return bool
[ "Selective", "config", "edit", "on", "set", "-", "up", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/SetupRun.php#L261-L308
bolt/bolt
src/Nut/SetupRun.php
SetupRun.finish
protected function finish() { if ($this->firstUser !== null) { $this->step(++$this->step, 'Setup Complete!'); $this->writeWelcome(); $branding = $this->app['config']->get('/general/branding/path', '/bolt'); $this->io->listing([ 'You may now lo...
php
protected function finish() { if ($this->firstUser !== null) { $this->step(++$this->step, 'Setup Complete!'); $this->writeWelcome(); $branding = $this->app['config']->get('/general/branding/path', '/bolt'); $this->io->listing([ 'You may now lo...
[ "protected", "function", "finish", "(", ")", "{", "if", "(", "$", "this", "->", "firstUser", "!==", "null", ")", "{", "$", "this", "->", "step", "(", "++", "$", "this", "->", "step", ",", "'Setup Complete!'", ")", ";", "$", "this", "->", "writeWelcom...
Finishing step. Let new sites know set up is complete and login name. @return int
[ "Finishing", "step", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/SetupRun.php#L345-L363
bolt/bolt
src/Nut/SetupRun.php
SetupRun.getBufferedOutput
protected function getBufferedOutput(OutputInterface $output, $verbosity = null) { $buffer = new BufferedOutput(); $buffer->setDecorated($output->isDecorated()); $buffer->setFormatter($output->getFormatter()); if ($verbosity === null) { $buffer->setVerbosity($output->getV...
php
protected function getBufferedOutput(OutputInterface $output, $verbosity = null) { $buffer = new BufferedOutput(); $buffer->setDecorated($output->isDecorated()); $buffer->setFormatter($output->getFormatter()); if ($verbosity === null) { $buffer->setVerbosity($output->getV...
[ "protected", "function", "getBufferedOutput", "(", "OutputInterface", "$", "output", ",", "$", "verbosity", "=", "null", ")", "{", "$", "buffer", "=", "new", "BufferedOutput", "(", ")", ";", "$", "buffer", "->", "setDecorated", "(", "$", "output", "->", "i...
Return a pre-configured output buffer, with the same formatter and decorator in use for the passed output, with optionally separate verbosity level. @param OutputInterface $output @param int $verbosity @return BufferedOutput
[ "Return", "a", "pre", "-", "configured", "output", "buffer", "with", "the", "same", "formatter", "and", "decorator", "in", "use", "for", "the", "passed", "output", "with", "optionally", "separate", "verbosity", "level", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/SetupRun.php#L375-L387
bolt/bolt
src/Nut/SetupRun.php
SetupRun.writeBufferedOutput
protected function writeBufferedOutput(BufferedOutput $buffer, $result) { if ($result === 0 && $buffer->getVerbosity() < OutputInterface::VERBOSITY_VERBOSE) { return; } $this->io->write($buffer->fetch()); }
php
protected function writeBufferedOutput(BufferedOutput $buffer, $result) { if ($result === 0 && $buffer->getVerbosity() < OutputInterface::VERBOSITY_VERBOSE) { return; } $this->io->write($buffer->fetch()); }
[ "protected", "function", "writeBufferedOutput", "(", "BufferedOutput", "$", "buffer", ",", "$", "result", ")", "{", "if", "(", "$", "result", "===", "0", "&&", "$", "buffer", "->", "getVerbosity", "(", ")", "<", "OutputInterface", "::", "VERBOSITY_VERBOSE", ...
Write buffered output to the console. Nothing will be written if the command result is 0 and verbose output is not enabled. @param BufferedOutput $buffer @param int $result
[ "Write", "buffered", "output", "to", "the", "console", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/SetupRun.php#L398-L405
bolt/bolt
src/Nut/SetupRun.php
SetupRun.step
private function step($step, $message) { $step = 'Step ' . $step; $this->io->block($message, $step, 'fg=white;bg=blue', ' ', true); }
php
private function step($step, $message) { $step = 'Step ' . $step; $this->io->block($message, $step, 'fg=white;bg=blue', ' ', true); }
[ "private", "function", "step", "(", "$", "step", ",", "$", "message", ")", "{", "$", "step", "=", "'Step '", ".", "$", "step", ";", "$", "this", "->", "io", "->", "block", "(", "$", "message", ",", "$", "step", ",", "'fg=white;bg=blue'", ",", "' '"...
Write the current step text to output. @param int $step @param array|string $message
[ "Write", "the", "current", "step", "text", "to", "output", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/SetupRun.php#L413-L417
bolt/bolt
src/Nut/SetupRun.php
SetupRun.writeWelcome
private function writeWelcome() { $message = sprintf( "<info>%s</info> - %s <comment>%s</comment>.\n", Trans::__('nut.greeting'), Trans::__('nut.version'), Version::VERSION ); $this->io->text($message); }
php
private function writeWelcome() { $message = sprintf( "<info>%s</info> - %s <comment>%s</comment>.\n", Trans::__('nut.greeting'), Trans::__('nut.version'), Version::VERSION ); $this->io->text($message); }
[ "private", "function", "writeWelcome", "(", ")", "{", "$", "message", "=", "sprintf", "(", "\"<info>%s</info> - %s <comment>%s</comment>.\\n\"", ",", "Trans", "::", "__", "(", "'nut.greeting'", ")", ",", "Trans", "::", "__", "(", "'nut.version'", ")", ",", "Vers...
Write the welcome message.
[ "Write", "the", "welcome", "message", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/SetupRun.php#L422-L431
bolt/bolt
src/Composer/EventListener/PackageEventListener.php
PackageEventListener.handle
public static function handle(PackageEvent $event) { $operation = $event->getOperation(); if ($operation instanceof InstallOperation) { $package = $operation->getPackage(); } elseif ($operation instanceof UpdateOperation) { $package = $operation->getTargetPackage(); ...
php
public static function handle(PackageEvent $event) { $operation = $event->getOperation(); if ($operation instanceof InstallOperation) { $package = $operation->getPackage(); } elseif ($operation instanceof UpdateOperation) { $package = $operation->getTargetPackage(); ...
[ "public", "static", "function", "handle", "(", "PackageEvent", "$", "event", ")", "{", "$", "operation", "=", "$", "event", "->", "getOperation", "(", ")", ";", "if", "(", "$", "operation", "instanceof", "InstallOperation", ")", "{", "$", "package", "=", ...
Event handler for composer package events. @param PackageEvent $event
[ "Event", "handler", "for", "composer", "package", "events", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/EventListener/PackageEventListener.php#L28-L54
bolt/bolt
src/Composer/EventListener/PackageEventListener.php
PackageEventListener.dump
public static function dump(Event $event) { $composer = $event->getComposer(); $extra = $composer->getPackage()->getExtra(); $includeAssetsDir = realpath($extra['bolt-web-path']) === realpath($extra['bolt-root-path']); /** @var PackageDescriptor[] $extensions */ $extensions...
php
public static function dump(Event $event) { $composer = $event->getComposer(); $extra = $composer->getPackage()->getExtra(); $includeAssetsDir = realpath($extra['bolt-web-path']) === realpath($extra['bolt-root-path']); /** @var PackageDescriptor[] $extensions */ $extensions...
[ "public", "static", "function", "dump", "(", "Event", "$", "event", ")", "{", "$", "composer", "=", "$", "event", "->", "getComposer", "(", ")", ";", "$", "extra", "=", "$", "composer", "->", "getPackage", "(", ")", "->", "getExtra", "(", ")", ";", ...
Dump the metadata for extension loading on the 'post-autoload-dump' event. @param Event $event
[ "Dump", "the", "metadata", "for", "extension", "loading", "on", "the", "post", "-", "autoload", "-", "dump", "event", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/EventListener/PackageEventListener.php#L61-L88
bolt/bolt
src/Composer/EventListener/PackageEventListener.php
PackageEventListener.mirror
public static function mirror($source, $dest, PackageEvent $event) { if (realpath($source) === realpath($dest)) { return; } $fs = new Filesystem(); try { $fs->mirror($source, $dest); } catch (IOException $e) { $event->getIO()->writeError(sp...
php
public static function mirror($source, $dest, PackageEvent $event) { if (realpath($source) === realpath($dest)) { return; } $fs = new Filesystem(); try { $fs->mirror($source, $dest); } catch (IOException $e) { $event->getIO()->writeError(sp...
[ "public", "static", "function", "mirror", "(", "$", "source", ",", "$", "dest", ",", "PackageEvent", "$", "event", ")", "{", "if", "(", "realpath", "(", "$", "source", ")", "===", "realpath", "(", "$", "dest", ")", ")", "{", "return", ";", "}", "$"...
Mirror a directory if the two directories don't match. @param string $source @param string $dest @param PackageEvent $event
[ "Mirror", "a", "directory", "if", "the", "two", "directories", "don", "t", "match", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/EventListener/PackageEventListener.php#L97-L109
bolt/bolt
src/Composer/EventListener/PackageEventListener.php
PackageEventListener.getInstalledComposerJson
private static function getInstalledComposerJson() { $finder = new Finder(); $finder->files() ->name('composer.json') ->notPath('vendor/composer') ->depth(2) ->followLinks() ; try { $finder->in(['vendor']); } catch (...
php
private static function getInstalledComposerJson() { $finder = new Finder(); $finder->files() ->name('composer.json') ->notPath('vendor/composer') ->depth(2) ->followLinks() ; try { $finder->in(['vendor']); } catch (...
[ "private", "static", "function", "getInstalledComposerJson", "(", ")", "{", "$", "finder", "=", "new", "Finder", "(", ")", ";", "$", "finder", "->", "files", "(", ")", "->", "name", "(", "'composer.json'", ")", "->", "notPath", "(", "'vendor/composer'", ")...
Return all the installed extension composer.json files. @return Finder|SplFileInfo[]
[ "Return", "all", "the", "installed", "extension", "composer", ".", "json", "files", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/EventListener/PackageEventListener.php#L116-L132
bolt/bolt
src/Controller/Async/General.php
General.changeLogRecord
public function changeLogRecord($contenttype, $contentid) { $options = [ 'contentid' => $contentid, 'limit' => 4, 'order' => 'date', 'direction' => 'DESC', ]; /** @var Repository\LogChangeRepository $repo */ $repo = $this->stor...
php
public function changeLogRecord($contenttype, $contentid) { $options = [ 'contentid' => $contentid, 'limit' => 4, 'order' => 'date', 'direction' => 'DESC', ]; /** @var Repository\LogChangeRepository $repo */ $repo = $this->stor...
[ "public", "function", "changeLogRecord", "(", "$", "contenttype", ",", "$", "contentid", ")", "{", "$", "options", "=", "[", "'contentid'", "=>", "$", "contentid", ",", "'limit'", "=>", "4", ",", "'order'", "=>", "'date'", ",", "'direction'", "=>", "'DESC'...
Generate the change log box for a single record in edit. @param string $contenttype @param int $contentid @return \Bolt\Response\TemplateResponse
[ "Generate", "the", "change", "log", "box", "for", "a", "single", "record", "in", "edit", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Async/General.php#L107-L125
bolt/bolt
src/Controller/Async/General.php
General.dashboardNews
public function dashboardNews(Request $request) { $news = $this->getNews($request->getHost()); // One 'alert' and one 'info' max. Regular info-items can be disabled, // but Alerts can't. $context = [ 'alert' => empty($news['alert']) ? null : $news['alert'], ...
php
public function dashboardNews(Request $request) { $news = $this->getNews($request->getHost()); // One 'alert' and one 'info' max. Regular info-items can be disabled, // but Alerts can't. $context = [ 'alert' => empty($news['alert']) ? null : $news['alert'], ...
[ "public", "function", "dashboardNews", "(", "Request", "$", "request", ")", "{", "$", "news", "=", "$", "this", "->", "getNews", "(", "$", "request", "->", "getHost", "(", ")", ")", ";", "// One 'alert' and one 'info' max. Regular info-items can be disabled,", "//...
News. Film at 11. @param Request $request @return \Bolt\Response\TemplateResponse
[ "News", ".", "Film", "at", "11", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Async/General.php#L134-L151
bolt/bolt
src/Controller/Async/General.php
General.lastModified
public function lastModified($contenttypeslug, $contentid = null) { // Let's find out how we should determine what the latest changes were: $contentLogEnabled = (bool) $this->getOption('general/changelog/enabled'); if ($contentLogEnabled) { return $this->getLastmodifiedByContent...
php
public function lastModified($contenttypeslug, $contentid = null) { // Let's find out how we should determine what the latest changes were: $contentLogEnabled = (bool) $this->getOption('general/changelog/enabled'); if ($contentLogEnabled) { return $this->getLastmodifiedByContent...
[ "public", "function", "lastModified", "(", "$", "contenttypeslug", ",", "$", "contentid", "=", "null", ")", "{", "// Let's find out how we should determine what the latest changes were:", "$", "contentLogEnabled", "=", "(", "bool", ")", "$", "this", "->", "getOption", ...
Latest {contenttype} to show a small listing in the sidebars. @param string $contenttypeslug @param int|null $contentid @return \Bolt\Response\TemplateResponse
[ "Latest", "{", "contenttype", "}", "to", "show", "a", "small", "listing", "in", "the", "sidebars", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Async/General.php#L161-L171
bolt/bolt
src/Controller/Async/General.php
General.makeUri
public function makeUri(Request $request) { $content = $this->storage()->create( $request->query->get('contenttypeslug'), $request->query->all() ); // Spoof the title, for contenttypes that have a different `uses:` $content->set('title', $request->query->get(...
php
public function makeUri(Request $request) { $content = $this->storage()->create( $request->query->get('contenttypeslug'), $request->query->all() ); // Spoof the title, for contenttypes that have a different `uses:` $content->set('title', $request->query->get(...
[ "public", "function", "makeUri", "(", "Request", "$", "request", ")", "{", "$", "content", "=", "$", "this", "->", "storage", "(", ")", "->", "create", "(", "$", "request", "->", "query", "->", "get", "(", "'contenttypeslug'", ")", ",", "$", "request",...
Generate a URI based on request parameters. @param Request $request @return string
[ "Generate", "a", "URI", "based", "on", "request", "parameters", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Async/General.php#L210-L227
bolt/bolt
src/Controller/Async/General.php
General.omnisearch
public function omnisearch(Request $request) { $query = $request->query->get('q', ''); if (strlen($query) < 3) { return $this->json([]); } $options = $this->app['omnisearch']->query($query); return $this->json($options); }
php
public function omnisearch(Request $request) { $query = $request->query->get('q', ''); if (strlen($query) < 3) { return $this->json([]); } $options = $this->app['omnisearch']->query($query); return $this->json($options); }
[ "public", "function", "omnisearch", "(", "Request", "$", "request", ")", "{", "$", "query", "=", "$", "request", "->", "query", "->", "get", "(", "'q'", ",", "''", ")", ";", "if", "(", "strlen", "(", "$", "query", ")", "<", "3", ")", "{", "return...
Perform an OmniSearch search and return the results. @param Request $request @return \Symfony\Component\HttpFoundation\JsonResponse
[ "Perform", "an", "OmniSearch", "search", "and", "return", "the", "results", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Async/General.php#L236-L247
bolt/bolt
src/Controller/Async/General.php
General.popularTags
public function popularTags(Request $request, $taxonomytype) { $table = $this->getOption('general/database/prefix'); $table .= 'taxonomy'; $query = $this->createQueryBuilder() ->select('name, COUNT(slug) AS count') ->from($table) ->where('taxonomytype = :...
php
public function popularTags(Request $request, $taxonomytype) { $table = $this->getOption('general/database/prefix'); $table .= 'taxonomy'; $query = $this->createQueryBuilder() ->select('name, COUNT(slug) AS count') ->from($table) ->where('taxonomytype = :...
[ "public", "function", "popularTags", "(", "Request", "$", "request", ",", "$", "taxonomytype", ")", "{", "$", "table", "=", "$", "this", "->", "getOption", "(", "'general/database/prefix'", ")", ";", "$", "table", ".=", "'taxonomy'", ";", "$", "query", "="...
Fetch a JSON encoded set of the most popular taxonomy specific tags. @param Request $request @param string $taxonomytype @return \Symfony\Component\HttpFoundation\JsonResponse
[ "Fetch", "a", "JSON", "encoded", "set", "of", "the", "most", "popular", "taxonomy", "specific", "tags", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Async/General.php#L257-L287
bolt/bolt
src/Controller/Async/General.php
General.readme
public function readme(ExtensionInterface $extension) { $file = null; foreach (['README.md', 'readme.md'] as $possibleName) { $file = $extension->getBaseDirectory()->getFile($possibleName); if ($file->exists()) { break; } } if ($fil...
php
public function readme(ExtensionInterface $extension) { $file = null; foreach (['README.md', 'readme.md'] as $possibleName) { $file = $extension->getBaseDirectory()->getFile($possibleName); if ($file->exists()) { break; } } if ($fil...
[ "public", "function", "readme", "(", "ExtensionInterface", "$", "extension", ")", "{", "$", "file", "=", "null", ";", "foreach", "(", "[", "'README.md'", ",", "'readme.md'", "]", "as", "$", "possibleName", ")", "{", "$", "file", "=", "$", "extension", "-...
Render an extension's README.md file. @param ExtensionInterface $extension @return Response
[ "Render", "an", "extension", "s", "README", ".", "md", "file", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Async/General.php#L296-L321
bolt/bolt
src/Controller/Async/General.php
General.tags
public function tags($taxonomytype) { $table = $this->getOption('general/database/prefix'); $table .= 'taxonomy'; $query = $this->createQueryBuilder() ->select("DISTINCT $table.name") ->from($table) ->where('taxonomytype = :taxonomytype') ->or...
php
public function tags($taxonomytype) { $table = $this->getOption('general/database/prefix'); $table .= 'taxonomy'; $query = $this->createQueryBuilder() ->select("DISTINCT $table.name") ->from($table) ->where('taxonomytype = :taxonomytype') ->or...
[ "public", "function", "tags", "(", "$", "taxonomytype", ")", "{", "$", "table", "=", "$", "this", "->", "getOption", "(", "'general/database/prefix'", ")", ";", "$", "table", ".=", "'taxonomy'", ";", "$", "query", "=", "$", "this", "->", "createQueryBuilde...
Fetch a JSON encoded set of taxonomy specific tags. @param string $taxonomytype @return \Symfony\Component\HttpFoundation\JsonResponse
[ "Fetch", "a", "JSON", "encoded", "set", "of", "taxonomy", "specific", "tags", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Async/General.php#L330-L347
bolt/bolt
src/Controller/Async/General.php
General.getNews
private function getNews($hostname) { // Cached for two hours. $news = $this->app['cache']->fetch('dashboardnews'); if ($news !== false) { $this->app['logger.system']->info('Using cached data', ['event' => 'news']); return $news; } // If not cached, ...
php
private function getNews($hostname) { // Cached for two hours. $news = $this->app['cache']->fetch('dashboardnews'); if ($news !== false) { $this->app['logger.system']->info('Using cached data', ['event' => 'news']); return $news; } // If not cached, ...
[ "private", "function", "getNews", "(", "$", "hostname", ")", "{", "// Cached for two hours.", "$", "news", "=", "$", "this", "->", "app", "[", "'cache'", "]", "->", "fetch", "(", "'dashboardnews'", ")", ";", "if", "(", "$", "news", "!==", "false", ")", ...
Get the news from Bolt HQ (with caching). @param string $hostname @return array
[ "Get", "the", "news", "from", "Bolt", "HQ", "(", "with", "caching", ")", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Async/General.php#L356-L372
bolt/bolt
src/Controller/Async/General.php
General.fetchNews
private function fetchNews($hostname) { $source = $this->getOption('general/branding/news_source', 'https://news.bolt.cm/'); $options = $this->fetchNewsOptions($hostname); $this->app['logger.system']->info('Fetching from remote server: ' . $source, ['event' => 'news']); try { ...
php
private function fetchNews($hostname) { $source = $this->getOption('general/branding/news_source', 'https://news.bolt.cm/'); $options = $this->fetchNewsOptions($hostname); $this->app['logger.system']->info('Fetching from remote server: ' . $source, ['event' => 'news']); try { ...
[ "private", "function", "fetchNews", "(", "$", "hostname", ")", "{", "$", "source", "=", "$", "this", "->", "getOption", "(", "'general/branding/news_source'", ",", "'https://news.bolt.cm/'", ")", ";", "$", "options", "=", "$", "this", "->", "fetchNewsOptions", ...
Get the news from Bolt HQ. @param string $hostname @return array
[ "Get", "the", "news", "from", "Bolt", "HQ", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Async/General.php#L381-L442
bolt/bolt
src/Controller/Async/General.php
General.fetchNewsOptions
private function fetchNewsOptions($hostname) { $driver = $this->app['db']->getDatabasePlatform()->getName(); $options = [ 'query' => [ 'v' => Bolt\Version::VERSION, 'p' => PHP_VERSION, 'db' => $driver, 'name' => $ho...
php
private function fetchNewsOptions($hostname) { $driver = $this->app['db']->getDatabasePlatform()->getName(); $options = [ 'query' => [ 'v' => Bolt\Version::VERSION, 'p' => PHP_VERSION, 'db' => $driver, 'name' => $ho...
[ "private", "function", "fetchNewsOptions", "(", "$", "hostname", ")", "{", "$", "driver", "=", "$", "this", "->", "app", "[", "'db'", "]", "->", "getDatabasePlatform", "(", ")", "->", "getName", "(", ")", ";", "$", "options", "=", "[", "'query'", "=>",...
Get the guzzle options. @param string $hostname @return array
[ "Get", "the", "guzzle", "options", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Async/General.php#L451-L480
bolt/bolt
src/Controller/Async/General.php
General.getLastmodifiedByContentLog
private function getLastmodifiedByContentLog($contenttypeslug, $contentid) { // Get the proper ContentType. $contenttype = $this->getContentType($contenttypeslug); // get the changelog for the requested ContentType. $options = ['limit' => 5, 'order' => 'date', 'direction' => 'DESC']...
php
private function getLastmodifiedByContentLog($contenttypeslug, $contentid) { // Get the proper ContentType. $contenttype = $this->getContentType($contenttypeslug); // get the changelog for the requested ContentType. $options = ['limit' => 5, 'order' => 'date', 'direction' => 'DESC']...
[ "private", "function", "getLastmodifiedByContentLog", "(", "$", "contenttypeslug", ",", "$", "contentid", ")", "{", "// Get the proper ContentType.", "$", "contenttype", "=", "$", "this", "->", "getContentType", "(", "$", "contenttypeslug", ")", ";", "// get the chang...
Get last modified records from the content log. @param string $contenttypeslug @param int $contentid @return \Bolt\Response\TemplateResponse
[ "Get", "last", "modified", "records", "from", "the", "content", "log", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Async/General.php#L490-L517
bolt/bolt
src/Controller/Async/General.php
General.getLastmodifiedSimple
private function getLastmodifiedSimple($contenttypeslug) { // Get the proper ContentType. $contenttype = $this->getContentType($contenttypeslug); // Get the 'latest' from the requested ContentType. $latest = $this->getContent($contenttype['slug'], ['limit' => 5, 'order' => '-datecha...
php
private function getLastmodifiedSimple($contenttypeslug) { // Get the proper ContentType. $contenttype = $this->getContentType($contenttypeslug); // Get the 'latest' from the requested ContentType. $latest = $this->getContent($contenttype['slug'], ['limit' => 5, 'order' => '-datecha...
[ "private", "function", "getLastmodifiedSimple", "(", "$", "contenttypeslug", ")", "{", "// Get the proper ContentType.", "$", "contenttype", "=", "$", "this", "->", "getContentType", "(", "$", "contenttypeslug", ")", ";", "// Get the 'latest' from the requested ContentType....
Only get latest {contenttype} record edits based on date changed. @param string $contenttypeslug @return \Bolt\Response\TemplateResponse
[ "Only", "get", "latest", "{", "contenttype", "}", "record", "edits", "based", "on", "date", "changed", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Async/General.php#L526-L540
bolt/bolt
src/Translation/LazyTranslator.php
LazyTranslator./*@codingStandardsIgnoreStart*/
public static function /*@codingStandardsIgnoreStart*/__/*@codingStandardsIgnoreEnd*/($key, array $params = [], $domain = 'messages', $locale = null) { return new self($key, $params, $domain, $locale); }
php
public static function /*@codingStandardsIgnoreStart*/__/*@codingStandardsIgnoreEnd*/($key, array $params = [], $domain = 'messages', $locale = null) { return new self($key, $params, $domain, $locale); }
[ "public", "static", "function", "/*@codingStandardsIgnoreStart*/", "__", "/*@codingStandardsIgnoreEnd*/", "(", "$", "key", ",", "array", "$", "params", "=", "[", "]", ",", "$", "domain", "=", "'messages'", ",", "$", "locale", "=", "null", ")", "{", "return", ...
@param string $key @param array $params @param string $domain @param null $locale @return LazyTranslator
[ "@param", "string", "$key", "@param", "array", "$params", "@param", "string", "$domain", "@param", "null", "$locale" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Translation/LazyTranslator.php#L45-L48
bolt/bolt
src/Nut/LogTrim.php
LogTrim.execute
protected function execute(InputInterface $input, OutputInterface $output) { $this->io->title('Trimming logs'); $ask = !$input->getOption('no-interaction'); $question = new ConfirmationQuestion('<question>Are you sure you want to trim the system & change logs?</question>', false); i...
php
protected function execute(InputInterface $input, OutputInterface $output) { $this->io->title('Trimming logs'); $ask = !$input->getOption('no-interaction'); $question = new ConfirmationQuestion('<question>Are you sure you want to trim the system & change logs?</question>', false); i...
[ "protected", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "$", "this", "->", "io", "->", "title", "(", "'Trimming logs'", ")", ";", "$", "ask", "=", "!", "$", "input", "->", "getOption", "("...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/LogTrim.php#L28-L45
bolt/bolt
src/Form/Resolver/Choice.php
Choice.get
public function get(ContentType $contentType, array $templateFields) { $select = new ArrayObject(); $this->build($select, $contentType->getFields()); $this->build($select, $templateFields, 'templatefields'); return iterator_to_array($select) ?: null; }
php
public function get(ContentType $contentType, array $templateFields) { $select = new ArrayObject(); $this->build($select, $contentType->getFields()); $this->build($select, $templateFields, 'templatefields'); return iterator_to_array($select) ?: null; }
[ "public", "function", "get", "(", "ContentType", "$", "contentType", ",", "array", "$", "templateFields", ")", "{", "$", "select", "=", "new", "ArrayObject", "(", ")", ";", "$", "this", "->", "build", "(", "$", "select", ",", "$", "contentType", "->", ...
@param ContentType $contentType @param array $templateFields @return array
[ "@param", "ContentType", "$contentType", "@param", "array", "$templateFields" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Form/Resolver/Choice.php#L41-L49
bolt/bolt
src/Form/Resolver/Choice.php
Choice.build
private function build(ArrayObject $select, array $fields, $prefix = null) { foreach ($fields as $name => $field) { if ($field['type'] === 'repeater') { $subField = new ArrayObject(); $this->build($subField, $field['fields']); if ($prefix) { ...
php
private function build(ArrayObject $select, array $fields, $prefix = null) { foreach ($fields as $name => $field) { if ($field['type'] === 'repeater') { $subField = new ArrayObject(); $this->build($subField, $field['fields']); if ($prefix) { ...
[ "private", "function", "build", "(", "ArrayObject", "$", "select", ",", "array", "$", "fields", ",", "$", "prefix", "=", "null", ")", "{", "foreach", "(", "$", "fields", "as", "$", "name", "=>", "$", "field", ")", "{", "if", "(", "$", "field", "[",...
Build the select array object. @param ArrayObject $select @param array $fields @param bool $isTemplateFields
[ "Build", "the", "select", "array", "object", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Form/Resolver/Choice.php#L58-L91
bolt/bolt
src/Form/Resolver/Choice.php
Choice.getValues
private function getValues(array $field) { if ($field['type'] !== 'select') { return null; } $field = Bag::from($field); // Get the appropriate values return is_string($field->get('values', [])) ? $this->getEntityValues($field) : $this->getYamlValues($field); ...
php
private function getValues(array $field) { if ($field['type'] !== 'select') { return null; } $field = Bag::from($field); // Get the appropriate values return is_string($field->get('values', [])) ? $this->getEntityValues($field) : $this->getYamlValues($field); ...
[ "private", "function", "getValues", "(", "array", "$", "field", ")", "{", "if", "(", "$", "field", "[", "'type'", "]", "!==", "'select'", ")", "{", "return", "null", ";", "}", "$", "field", "=", "Bag", "::", "from", "(", "$", "field", ")", ";", "...
@param array $field @return array|null
[ "@param", "array", "$field" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Form/Resolver/Choice.php#L98-L107
bolt/bolt
src/Form/Resolver/Choice.php
Choice.getYamlValues
private function getYamlValues(Bag $field) { $values = array_slice($field->get('values', []), 0, $field->get('limit', self::DEFAULT_LIMIT), true); if ($field->get('sortable')) { asort($values, SORT_REGULAR); } return $values; }
php
private function getYamlValues(Bag $field) { $values = array_slice($field->get('values', []), 0, $field->get('limit', self::DEFAULT_LIMIT), true); if ($field->get('sortable')) { asort($values, SORT_REGULAR); } return $values; }
[ "private", "function", "getYamlValues", "(", "Bag", "$", "field", ")", "{", "$", "values", "=", "array_slice", "(", "$", "field", "->", "get", "(", "'values'", ",", "[", "]", ")", ",", "0", ",", "$", "field", "->", "get", "(", "'limit'", ",", "self...
Return a YAML defined array of select field value options. @param Bag $field @return array
[ "Return", "a", "YAML", "defined", "array", "of", "select", "field", "value", "options", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Form/Resolver/Choice.php#L116-L124
bolt/bolt
src/Form/Resolver/Choice.php
Choice.getEntityValues
private function getEntityValues(Bag $field) { $baseParts = explode('/', $field->get('values')); if (count($baseParts) < 2) { throw new \InvalidArgumentException(sprintf('The "values" key for a ContentType select must be in the form of ContentType/field_name but "%s" given', $field->get(...
php
private function getEntityValues(Bag $field) { $baseParts = explode('/', $field->get('values')); if (count($baseParts) < 2) { throw new \InvalidArgumentException(sprintf('The "values" key for a ContentType select must be in the form of ContentType/field_name but "%s" given', $field->get(...
[ "private", "function", "getEntityValues", "(", "Bag", "$", "field", ")", "{", "$", "baseParts", "=", "explode", "(", "'/'", ",", "$", "field", "->", "get", "(", "'values'", ")", ")", ";", "if", "(", "count", "(", "$", "baseParts", ")", "<", "2", ")...
Return select field value options from a ContentType's records. @param Bag $field @return array
[ "Return", "select", "field", "value", "options", "from", "a", "ContentType", "s", "records", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Form/Resolver/Choice.php#L133-L173
bolt/bolt
src/Storage/Field/Type/RepeaterType.php
RepeaterType.query
public function query(QueryInterface $query, ClassMetadata $metadata) { $field = $this->mapping['fieldname']; /** @var SelectQuery $query */ foreach ($query->getFilters() as $filter) { /** @var Filter $filter */ if ($filter->getKey() == $field) { $thi...
php
public function query(QueryInterface $query, ClassMetadata $metadata) { $field = $this->mapping['fieldname']; /** @var SelectQuery $query */ foreach ($query->getFilters() as $filter) { /** @var Filter $filter */ if ($filter->getKey() == $field) { $thi...
[ "public", "function", "query", "(", "QueryInterface", "$", "query", ",", "ClassMetadata", "$", "metadata", ")", "{", "$", "field", "=", "$", "this", "->", "mapping", "[", "'fieldname'", "]", ";", "/** @var SelectQuery $query */", "foreach", "(", "$", "query", ...
Repeater fields can allow filters on the value of a sub-field For example the following queries: 'repeatfield', {'repeatstatus=1'} 'repeatfield', {'repeattitle=%Test%'}. Because the search is actually on the join table, we replace the expression to filter the join side rather than on the main side. @param QueryInter...
[ "Repeater", "fields", "can", "allow", "filters", "on", "the", "value", "of", "a", "sub", "-", "field" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Field/Type/RepeaterType.php#L42-L55
bolt/bolt
src/Storage/Field/Type/RepeaterType.php
RepeaterType.rewriteQueryFilterParameters
protected function rewriteQueryFilterParameters(Filter $filter, SelectQuery $query, $field) { $boltName = $query->getContentType(); $newExpression = $this->em->createExpressionBuilder(); $count = 0; foreach ($query->getWhereParametersFor($field) as $paramKey => $paramValue) { ...
php
protected function rewriteQueryFilterParameters(Filter $filter, SelectQuery $query, $field) { $boltName = $query->getContentType(); $newExpression = $this->em->createExpressionBuilder(); $count = 0; foreach ($query->getWhereParametersFor($field) as $paramKey => $paramValue) { ...
[ "protected", "function", "rewriteQueryFilterParameters", "(", "Filter", "$", "filter", ",", "SelectQuery", "$", "query", ",", "$", "field", ")", "{", "$", "boltName", "=", "$", "query", "->", "getContentType", "(", ")", ";", "$", "newExpression", "=", "$", ...
This method does an in-place modification of a generic ContentType.field query to the format actually used in the raw SQL. For instance a simple query might say `entries.repeater = 'title=%Test%'` but now we are in the context of entries the actual SQL fragment needs to do a sub-select on the bolt_field_value table and...
[ "This", "method", "does", "an", "in", "-", "place", "modification", "of", "a", "generic", "ContentType", ".", "field", "query", "to", "the", "format", "actually", "used", "in", "the", "raw", "SQL", ".", "For", "instance", "a", "simple", "query", "might", ...
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Field/Type/RepeaterType.php#L70-L111
bolt/bolt
src/Storage/Field/Type/RepeaterType.php
RepeaterType.load
public function load(QueryBuilder $query, ClassMetadata $metadata) { $field = $this->mapping['fieldname']; $boltname = $metadata->getBoltName(); $table = $this->mapping['tables']['field_value']; $from = $query->getQueryPart('from'); if (isset($from[0]['alias'])) { ...
php
public function load(QueryBuilder $query, ClassMetadata $metadata) { $field = $this->mapping['fieldname']; $boltname = $metadata->getBoltName(); $table = $this->mapping['tables']['field_value']; $from = $query->getQueryPart('from'); if (isset($from[0]['alias'])) { ...
[ "public", "function", "load", "(", "QueryBuilder", "$", "query", ",", "ClassMetadata", "$", "metadata", ")", "{", "$", "field", "=", "$", "this", "->", "mapping", "[", "'fieldname'", "]", ";", "$", "boltname", "=", "$", "metadata", "->", "getBoltName", "...
For repeating fields, the load method adds extra joins and selects to the query that fetches the related records from the field and field value tables in the same query as the content fetch. @param QueryBuilder $query @param ClassMetadata $metadata @return QueryBuilder|null
[ "For", "repeating", "fields", "the", "load", "method", "adds", "extra", "joins", "and", "selects", "to", "the", "query", "that", "fetches", "the", "related", "records", "from", "the", "field", "and", "field", "value", "tables", "in", "the", "same", "query", ...
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Field/Type/RepeaterType.php#L123-L141
bolt/bolt
src/Storage/Field/Type/RepeaterType.php
RepeaterType.persist
public function persist(QuerySet $queries, $entity) { $this->normalize($entity); $key = $this->mapping['fieldname']; $accessor = 'get' . ucfirst($key); $proposed = $entity->$accessor(); $collection = new RepeatingFieldCollection($this->em, $this->mapping); $existingF...
php
public function persist(QuerySet $queries, $entity) { $this->normalize($entity); $key = $this->mapping['fieldname']; $accessor = 'get' . ucfirst($key); $proposed = $entity->$accessor(); $collection = new RepeatingFieldCollection($this->em, $this->mapping); $existingF...
[ "public", "function", "persist", "(", "QuerySet", "$", "queries", ",", "$", "entity", ")", "{", "$", "this", "->", "normalize", "(", "$", "entity", ")", ";", "$", "key", "=", "$", "this", "->", "mapping", "[", "'fieldname'", "]", ";", "$", "accessor"...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Field/Type/RepeaterType.php#L146-L174
bolt/bolt
src/Storage/Field/Type/RepeaterType.php
RepeaterType.hydrate
public function hydrate($data, $entity) { /** @var string $key */ $key = $this->mapping['fieldname']; $collection = new RepeatingFieldCollection($this->em, $this->mapping); $collection->setName($key); // If there isn't anything set yet then we just return an empty collection...
php
public function hydrate($data, $entity) { /** @var string $key */ $key = $this->mapping['fieldname']; $collection = new RepeatingFieldCollection($this->em, $this->mapping); $collection->setName($key); // If there isn't anything set yet then we just return an empty collection...
[ "public", "function", "hydrate", "(", "$", "data", ",", "$", "entity", ")", "{", "/** @var string $key */", "$", "key", "=", "$", "this", "->", "mapping", "[", "'fieldname'", "]", ";", "$", "collection", "=", "new", "RepeatingFieldCollection", "(", "$", "t...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Field/Type/RepeaterType.php#L179-L254
bolt/bolt
src/Storage/Field/Type/RepeaterType.php
RepeaterType.set
public function set($entity, $val) { if ($val === null) { $val = new RepeatingFieldCollection($this->em, $this->mapping); } return parent::set($entity, $val); }
php
public function set($entity, $val) { if ($val === null) { $val = new RepeatingFieldCollection($this->em, $this->mapping); } return parent::set($entity, $val); }
[ "public", "function", "set", "(", "$", "entity", ",", "$", "val", ")", "{", "if", "(", "$", "val", "===", "null", ")", "{", "$", "val", "=", "new", "RepeatingFieldCollection", "(", "$", "this", "->", "em", ",", "$", "this", "->", "mapping", ")", ...
The set method gets called directly by a new entity builder. For this field we never want to allow null values, rather we want an empty collection so this overrides the default and handles that. @param object $entity @param mixed $val
[ "The", "set", "method", "gets", "called", "directly", "by", "a", "new", "entity", "builder", ".", "For", "this", "field", "we", "never", "want", "to", "allow", "null", "values", "rather", "we", "want", "an", "empty", "collection", "so", "this", "overrides"...
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Field/Type/RepeaterType.php#L263-L270
bolt/bolt
src/Storage/Field/Type/RepeaterType.php
RepeaterType.normalize
public function normalize($entity) { $key = $this->mapping['fieldname']; $accessor = 'get' . ucfirst($key); $outerCollection = $entity->$accessor(); if (!$outerCollection instanceof RepeatingFieldCollection) { $collection = new RepeatingFieldCollection($this->em, $this->...
php
public function normalize($entity) { $key = $this->mapping['fieldname']; $accessor = 'get' . ucfirst($key); $outerCollection = $entity->$accessor(); if (!$outerCollection instanceof RepeatingFieldCollection) { $collection = new RepeatingFieldCollection($this->em, $this->...
[ "public", "function", "normalize", "(", "$", "entity", ")", "{", "$", "key", "=", "$", "this", "->", "mapping", "[", "'fieldname'", "]", ";", "$", "accessor", "=", "'get'", ".", "ucfirst", "(", "$", "key", ")", ";", "$", "outerCollection", "=", "$", ...
Normalize step ensures that we have correctly hydrated objects at the collection and entity level. @param object $entity
[ "Normalize", "step", "ensures", "that", "we", "have", "correctly", "hydrated", "objects", "at", "the", "collection", "and", "entity", "level", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Field/Type/RepeaterType.php#L278-L299
bolt/bolt
src/Storage/Field/Type/RepeaterType.php
RepeaterType.getPlatformGroupConcat
protected function getPlatformGroupConcat(QueryBuilder $query) { $platform = $query->getConnection()->getDatabasePlatform()->getName(); switch ($platform) { case 'mysql': return "GROUP_CONCAT(DISTINCT CONCAT_WS('_', f.name, f.grouping, f.id))"; case 'sqlite':...
php
protected function getPlatformGroupConcat(QueryBuilder $query) { $platform = $query->getConnection()->getDatabasePlatform()->getName(); switch ($platform) { case 'mysql': return "GROUP_CONCAT(DISTINCT CONCAT_WS('_', f.name, f.grouping, f.id))"; case 'sqlite':...
[ "protected", "function", "getPlatformGroupConcat", "(", "QueryBuilder", "$", "query", ")", "{", "$", "platform", "=", "$", "query", "->", "getConnection", "(", ")", "->", "getDatabasePlatform", "(", ")", "->", "getName", "(", ")", ";", "switch", "(", "$", ...
Get platform specific group_concat token for provided column. @param QueryBuilder $query @return string
[ "Get", "platform", "specific", "group_concat", "token", "for", "provided", "column", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Field/Type/RepeaterType.php#L316-L330
bolt/bolt
src/Storage/Field/Type/RepeaterType.php
RepeaterType.getExistingFields
protected function getExistingFields($entity) { /** @var FieldValueRepository $repo */ $repo = $this->em->getRepository(Entity\FieldValue::class); return $repo->getExistingFields($entity->getId(), $entity->getContenttype(), $this->mapping['fieldname']); }
php
protected function getExistingFields($entity) { /** @var FieldValueRepository $repo */ $repo = $this->em->getRepository(Entity\FieldValue::class); return $repo->getExistingFields($entity->getId(), $entity->getContenttype(), $this->mapping['fieldname']); }
[ "protected", "function", "getExistingFields", "(", "$", "entity", ")", "{", "/** @var FieldValueRepository $repo */", "$", "repo", "=", "$", "this", "->", "em", "->", "getRepository", "(", "Entity", "\\", "FieldValue", "::", "class", ")", ";", "return", "$", "...
Get existing fields for this record. @param object $entity @return array
[ "Get", "existing", "fields", "for", "this", "record", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Field/Type/RepeaterType.php#L339-L345
bolt/bolt
src/Storage/Field/Type/RepeaterType.php
RepeaterType.addToInsertQuery
protected function addToInsertQuery(QuerySet $queries, $changes, $entity) { foreach ($changes as $fieldValue) { $repo = $this->em->getRepository(get_class($fieldValue)); $field = $this->getFieldType($fieldValue->getFieldname()); $type = $field->getStorageType(); ...
php
protected function addToInsertQuery(QuerySet $queries, $changes, $entity) { foreach ($changes as $fieldValue) { $repo = $this->em->getRepository(get_class($fieldValue)); $field = $this->getFieldType($fieldValue->getFieldname()); $type = $field->getStorageType(); ...
[ "protected", "function", "addToInsertQuery", "(", "QuerySet", "$", "queries", ",", "$", "changes", ",", "$", "entity", ")", "{", "foreach", "(", "$", "changes", "as", "$", "fieldValue", ")", "{", "$", "repo", "=", "$", "this", "->", "em", "->", "getRep...
Query to insert new field values. @param QuerySet $queries @param array $changes @param object $entity
[ "Query", "to", "insert", "new", "field", "values", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Field/Type/RepeaterType.php#L354-L377
bolt/bolt
src/Storage/Field/Type/RepeaterType.php
RepeaterType.addToUpdateQuery
protected function addToUpdateQuery(QuerySet $queries, $changes) { foreach ($changes as $fieldValue) { $repo = $this->em->getRepository(get_class($fieldValue)); $field = $this->getFieldType($fieldValue->getFieldname()); $type = $field->getStorageType(); $typeC...
php
protected function addToUpdateQuery(QuerySet $queries, $changes) { foreach ($changes as $fieldValue) { $repo = $this->em->getRepository(get_class($fieldValue)); $field = $this->getFieldType($fieldValue->getFieldname()); $type = $field->getStorageType(); $typeC...
[ "protected", "function", "addToUpdateQuery", "(", "QuerySet", "$", "queries", ",", "$", "changes", ")", "{", "foreach", "(", "$", "changes", "as", "$", "fieldValue", ")", "{", "$", "repo", "=", "$", "this", "->", "em", "->", "getRepository", "(", "get_cl...
Query to insert new field values. @param QuerySet $queries @param array $changes
[ "Query", "to", "insert", "new", "field", "values", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Field/Type/RepeaterType.php#L395-L414
bolt/bolt
src/Storage/Field/Type/RepeaterType.php
RepeaterType.getFieldType
protected function getFieldType($field) { if (!isset($this->mapping['data']['fields'][$field]['fieldtype'])) { throw new FieldConfigurationException('Invalid repeating field configuration for ' . $field); } $mapping = $this->mapping['data']['fields'][$field]; $setting = $...
php
protected function getFieldType($field) { if (!isset($this->mapping['data']['fields'][$field]['fieldtype'])) { throw new FieldConfigurationException('Invalid repeating field configuration for ' . $field); } $mapping = $this->mapping['data']['fields'][$field]; $setting = $...
[ "protected", "function", "getFieldType", "(", "$", "field", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "mapping", "[", "'data'", "]", "[", "'fields'", "]", "[", "$", "field", "]", "[", "'fieldtype'", "]", ")", ")", "{", "throw", "ne...
@param string $field @throws FieldConfigurationException @return FieldTypeBase
[ "@param", "string", "$field" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Field/Type/RepeaterType.php#L423-L432
bolt/bolt
src/Storage/Field/Type/RepeaterType.php
RepeaterType.getFieldTypeName
protected function getFieldTypeName($field) { if (!isset($this->mapping['data']['fields'][$field]['type'])) { throw new FieldConfigurationException('Invalid repeating field configuration for ' . $field); } $mapping = $this->mapping['data']['fields'][$field]; return $mapp...
php
protected function getFieldTypeName($field) { if (!isset($this->mapping['data']['fields'][$field]['type'])) { throw new FieldConfigurationException('Invalid repeating field configuration for ' . $field); } $mapping = $this->mapping['data']['fields'][$field]; return $mapp...
[ "protected", "function", "getFieldTypeName", "(", "$", "field", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "mapping", "[", "'data'", "]", "[", "'fields'", "]", "[", "$", "field", "]", "[", "'type'", "]", ")", ")", "{", "throw", "new...
@param $field @throws FieldConfigurationException @return mixed
[ "@param", "$field" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Field/Type/RepeaterType.php#L441-L449
bolt/bolt
src/Storage/Entity/ContentValuesTrait.php
ContentValuesTrait.get
public function get($name) { // For fields that are stored as arrays, like 'video' if (strpos($name, '.') > 0) { list($name, $attr) = explode('.', $name); if (!empty($attr) && isset($this->values[$name][$attr])) { return $this->values[$name][$attr]; ...
php
public function get($name) { // For fields that are stored as arrays, like 'video' if (strpos($name, '.') > 0) { list($name, $attr) = explode('.', $name); if (!empty($attr) && isset($this->values[$name][$attr])) { return $this->values[$name][$attr]; ...
[ "public", "function", "get", "(", "$", "name", ")", "{", "// For fields that are stored as arrays, like 'video'", "if", "(", "strpos", "(", "$", "name", ",", "'.'", ")", ">", "0", ")", "{", "list", "(", "$", "name", ",", "$", "attr", ")", "=", "explode",...
Pseudo-magic function, used for when templates use {{ content.get(title) }}, so we can map it to $this->values['title']. @param string $name @return mixed
[ "Pseudo", "-", "magic", "function", "used", "for", "when", "templates", "use", "{{", "content", ".", "get", "(", "title", ")", "}}", "so", "we", "can", "map", "it", "to", "$this", "-", ">", "values", "[", "title", "]", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Entity/ContentValuesTrait.php#L41-L56
bolt/bolt
src/Storage/Entity/ContentValuesTrait.php
ContentValuesTrait.getValues
public function getValues($json = false, $stripped = false) { // Prevent 'slug may not be NULL' if (!isset($this->values['slug'])) { $this->values['slug'] = ''; } // Return raw values if ($json === false) { return $this->values; } $co...
php
public function getValues($json = false, $stripped = false) { // Prevent 'slug may not be NULL' if (!isset($this->values['slug'])) { $this->values['slug'] = ''; } // Return raw values if ($json === false) { return $this->values; } $co...
[ "public", "function", "getValues", "(", "$", "json", "=", "false", ",", "$", "stripped", "=", "false", ")", "{", "// Prevent 'slug may not be NULL'", "if", "(", "!", "isset", "(", "$", "this", "->", "values", "[", "'slug'", "]", ")", ")", "{", "$", "th...
Return a content objects values. @param bool $json Set to TRUE to return JSON encoded values for arrays @param bool $stripped Set to true to strip all of the base fields @return array
[ "Return", "a", "content", "objects", "values", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Entity/ContentValuesTrait.php#L66-L181
bolt/bolt
src/Storage/Entity/ContentValuesTrait.php
ContentValuesTrait.setValue
public function setValue($key, $value) { // Don't set templateFields if not a real contenttype if (($key === 'templatefields') && (!$this->isRootType)) { return; } // Check if the value need to be unserialized. if (is_string($value) && substr($value, 0, 2) === 'a...
php
public function setValue($key, $value) { // Don't set templateFields if not a real contenttype if (($key === 'templatefields') && (!$this->isRootType)) { return; } // Check if the value need to be unserialized. if (is_string($value) && substr($value, 0, 2) === 'a...
[ "public", "function", "setValue", "(", "$", "key", ",", "$", "value", ")", "{", "// Don't set templateFields if not a real contenttype", "if", "(", "(", "$", "key", "===", "'templatefields'", ")", "&&", "(", "!", "$", "this", "->", "isRootType", ")", ")", "{...
Set a ContentType record's individual value. @param string $key @param mixed $value
[ "Set", "a", "ContentType", "record", "s", "individual", "value", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Entity/ContentValuesTrait.php#L189-L287
bolt/bolt
src/Storage/Entity/ContentValuesTrait.php
ContentValuesTrait.setValues
public function setValues(array $values) { // Since Bolt 1.4, we use 'ownerid' instead of 'username' in the DB tables. If we get an array that has an // empty 'ownerid', attempt to set it from the 'username'. In $this->setValue the user will be set, regardless // of ownerid is an 'id' or a '...
php
public function setValues(array $values) { // Since Bolt 1.4, we use 'ownerid' instead of 'username' in the DB tables. If we get an array that has an // empty 'ownerid', attempt to set it from the 'username'. In $this->setValue the user will be set, regardless // of ownerid is an 'id' or a '...
[ "public", "function", "setValues", "(", "array", "$", "values", ")", "{", "// Since Bolt 1.4, we use 'ownerid' instead of 'username' in the DB tables. If we get an array that has an", "// empty 'ownerid', attempt to set it from the 'username'. In $this->setValue the user will be set, regardless"...
Set a ContentType record's values. @param array $values
[ "Set", "a", "ContentType", "record", "s", "values", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Entity/ContentValuesTrait.php#L294-L413
bolt/bolt
src/Storage/Entity/ContentValuesTrait.php
ContentValuesTrait.setFromPost
public function setFromPost($values, $contenttype) { $values = Input::cleanPostedData($values); $values += ['status' => 'draft']; if (!$this->id) { // this is a new record: current user becomes the owner. $user = $this->app['users']->getCurrentUser(); $th...
php
public function setFromPost($values, $contenttype) { $values = Input::cleanPostedData($values); $values += ['status' => 'draft']; if (!$this->id) { // this is a new record: current user becomes the owner. $user = $this->app['users']->getCurrentUser(); $th...
[ "public", "function", "setFromPost", "(", "$", "values", ",", "$", "contenttype", ")", "{", "$", "values", "=", "Input", "::", "cleanPostedData", "(", "$", "values", ")", ";", "$", "values", "+=", "[", "'status'", "=>", "'draft'", "]", ";", "if", "(", ...
Set a ContentType record values from a HTTP POST. @param array $values @param array $contenttype @throws \Exception
[ "Set", "a", "ContentType", "record", "values", "from", "a", "HTTP", "POST", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Entity/ContentValuesTrait.php#L423-L498
bolt/bolt
src/Storage/Entity/ContentValuesTrait.php
ContentValuesTrait.getImage
public function getImage() { // No fields, no image. if (empty($this->contenttype['fields'])) { return ''; } // Grab the first field of type 'image', and return that. foreach ($this->contenttype['fields'] as $key => $field) { if ($field['type'] === 'i...
php
public function getImage() { // No fields, no image. if (empty($this->contenttype['fields'])) { return ''; } // Grab the first field of type 'image', and return that. foreach ($this->contenttype['fields'] as $key => $field) { if ($field['type'] === 'i...
[ "public", "function", "getImage", "(", ")", "{", "// No fields, no image.", "if", "(", "empty", "(", "$", "this", "->", "contenttype", "[", "'fields'", "]", ")", ")", "{", "return", "''", ";", "}", "// Grab the first field of type 'image', and return that.", "fore...
Get the first image in the content. @return string
[ "Get", "the", "first", "image", "in", "the", "content", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Entity/ContentValuesTrait.php#L505-L526
bolt/bolt
src/Storage/Entity/ContentValuesTrait.php
ContentValuesTrait.getTitle
public function getTitle($allowBasicTags = false) { $titleParts = []; if ($allowBasicTags === true) { $allowedTags = '<b><del><em><i><strong><s>'; } else { $allowedTags = ''; } foreach ($this->getTitleColumnName() as $fieldName) { // Make...
php
public function getTitle($allowBasicTags = false) { $titleParts = []; if ($allowBasicTags === true) { $allowedTags = '<b><del><em><i><strong><s>'; } else { $allowedTags = ''; } foreach ($this->getTitleColumnName() as $fieldName) { // Make...
[ "public", "function", "getTitle", "(", "$", "allowBasicTags", "=", "false", ")", "{", "$", "titleParts", "=", "[", "]", ";", "if", "(", "$", "allowBasicTags", "===", "true", ")", "{", "$", "allowedTags", "=", "'<b><del><em><i><strong><s>'", ";", "}", "else...
Get the title, name, caption or subject. @param bool $allowBasicTags @return string
[ "Get", "the", "title", "name", "caption", "or", "subject", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Entity/ContentValuesTrait.php#L535-L561
bolt/bolt
src/Storage/Entity/ContentValuesTrait.php
ContentValuesTrait.getTitleColumnName
public function getTitleColumnName() { // If we specified a specific fieldname or array of fieldnames as 'title'. if (!empty($this->contenttype['title_format'])) { return (array) $this->contenttype['title_format']; } // Sets the names of some 'common' names for the 'titl...
php
public function getTitleColumnName() { // If we specified a specific fieldname or array of fieldnames as 'title'. if (!empty($this->contenttype['title_format'])) { return (array) $this->contenttype['title_format']; } // Sets the names of some 'common' names for the 'titl...
[ "public", "function", "getTitleColumnName", "(", ")", "{", "// If we specified a specific fieldname or array of fieldnames as 'title'.", "if", "(", "!", "empty", "(", "$", "this", "->", "contenttype", "[", "'title_format'", "]", ")", ")", "{", "return", "(", "array", ...
Get the columnname of the title, name, caption or subject. @return array
[ "Get", "the", "columnname", "of", "the", "title", "name", "caption", "or", "subject", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Entity/ContentValuesTrait.php#L568-L600
bolt/bolt
src/Extension/SimpleExtension.php
SimpleExtension.register
final public function register(Application $app) { $this->extendConfigService(); $this->extendTwigService(); $this->extendMenuService(); $this->extendAssetServices(); $this->extendNutService(); $this->extendTranslatorService(); $this->extendRepositoryMapping()...
php
final public function register(Application $app) { $this->extendConfigService(); $this->extendTwigService(); $this->extendMenuService(); $this->extendAssetServices(); $this->extendNutService(); $this->extendTranslatorService(); $this->extendRepositoryMapping()...
[ "final", "public", "function", "register", "(", "Application", "$", "app", ")", "{", "$", "this", "->", "extendConfigService", "(", ")", ";", "$", "this", "->", "extendTwigService", "(", ")", ";", "$", "this", "->", "extendMenuService", "(", ")", ";", "$...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Extension/SimpleExtension.php#L32-L43
bolt/bolt
src/Extension/SimpleExtension.php
SimpleExtension.boot
public function boot(Application $app) { $this->container = $app; $this->container['dispatcher']->addSubscriber($this); $this->subscribe($this->container['dispatcher']); }
php
public function boot(Application $app) { $this->container = $app; $this->container['dispatcher']->addSubscriber($this); $this->subscribe($this->container['dispatcher']); }
[ "public", "function", "boot", "(", "Application", "$", "app", ")", "{", "$", "this", "->", "container", "=", "$", "app", ";", "$", "this", "->", "container", "[", "'dispatcher'", "]", "->", "addSubscriber", "(", "$", "this", ")", ";", "$", "this", "-...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Extension/SimpleExtension.php#L83-L88
bolt/bolt
src/Nut/Style/NutStyle.php
NutStyle.fromComposer
public static function fromComposer(IOInterface $io) { $input = new ArrayInput([]); $input->setInteractive($io->isInteractive()); if ($io instanceof ConsoleIO) { $ref = new \ReflectionProperty($io, 'output'); $ref->setAccessible(true); $output = $ref->get...
php
public static function fromComposer(IOInterface $io) { $input = new ArrayInput([]); $input->setInteractive($io->isInteractive()); if ($io instanceof ConsoleIO) { $ref = new \ReflectionProperty($io, 'output'); $ref->setAccessible(true); $output = $ref->get...
[ "public", "static", "function", "fromComposer", "(", "IOInterface", "$", "io", ")", "{", "$", "input", "=", "new", "ArrayInput", "(", "[", "]", ")", ";", "$", "input", "->", "setInteractive", "(", "$", "io", "->", "isInteractive", "(", ")", ")", ";", ...
Create from Composer IO. @param IOInterface $io @return NutStyle
[ "Create", "from", "Composer", "IO", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/Style/NutStyle.php#L56-L73
bolt/bolt
src/Nut/Style/NutStyle.php
NutStyle.askThenRemove
public function askThenRemove($question, $default = null, $validator = null) { $question = new Question($question, $default); $question->setValidator($validator); return $this->askQuestionThenRemove($question); }
php
public function askThenRemove($question, $default = null, $validator = null) { $question = new Question($question, $default); $question->setValidator($validator); return $this->askQuestionThenRemove($question); }
[ "public", "function", "askThenRemove", "(", "$", "question", ",", "$", "default", "=", "null", ",", "$", "validator", "=", "null", ")", "{", "$", "question", "=", "new", "Question", "(", "$", "question", ",", "$", "default", ")", ";", "$", "question", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/Style/NutStyle.php#L86-L92
bolt/bolt
src/Nut/Style/NutStyle.php
NutStyle.askHiddenThenRemove
public function askHiddenThenRemove($question, $validator = null) { $question = new Question($question); $question->setHidden(true); $question->setValidator($validator); return $this->askQuestionThenRemove($question); }
php
public function askHiddenThenRemove($question, $validator = null) { $question = new Question($question); $question->setHidden(true); $question->setValidator($validator); return $this->askQuestionThenRemove($question); }
[ "public", "function", "askHiddenThenRemove", "(", "$", "question", ",", "$", "validator", "=", "null", ")", "{", "$", "question", "=", "new", "Question", "(", "$", "question", ")", ";", "$", "question", "->", "setHidden", "(", "true", ")", ";", "$", "q...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/Style/NutStyle.php#L97-L105
bolt/bolt
src/Nut/Style/NutStyle.php
NutStyle.choiceThenRemove
public function choiceThenRemove($question, array $choices, $default = null) { if ($default !== null) { $values = array_flip($choices); $default = $values[$default]; } return $this->askQuestionThenRemove(new ChoiceQuestion($question, $choices, $default)); }
php
public function choiceThenRemove($question, array $choices, $default = null) { if ($default !== null) { $values = array_flip($choices); $default = $values[$default]; } return $this->askQuestionThenRemove(new ChoiceQuestion($question, $choices, $default)); }
[ "public", "function", "choiceThenRemove", "(", "$", "question", ",", "array", "$", "choices", ",", "$", "default", "=", "null", ")", "{", "if", "(", "$", "default", "!==", "null", ")", "{", "$", "values", "=", "array_flip", "(", "$", "choices", ")", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/Style/NutStyle.php#L118-L126
bolt/bolt
src/Nut/Style/NutStyle.php
NutStyle.askQuestionThenRemove
public function askQuestionThenRemove(Question $question) { if (!$this->questionHelper) { $this->questionHelper = new QuestionHelper(); } return $this->questionHelper->askThenRemove($this->input, $this, $question); }
php
public function askQuestionThenRemove(Question $question) { if (!$this->questionHelper) { $this->questionHelper = new QuestionHelper(); } return $this->questionHelper->askThenRemove($this->input, $this, $question); }
[ "public", "function", "askQuestionThenRemove", "(", "Question", "$", "question", ")", "{", "if", "(", "!", "$", "this", "->", "questionHelper", ")", "{", "$", "this", "->", "questionHelper", "=", "new", "QuestionHelper", "(", ")", ";", "}", "return", "$", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/Style/NutStyle.php#L131-L138
bolt/bolt
src/Form/Validator/Constraints/YamlValidator.php
YamlValidator.validate
public function validate($value, Constraint $constraint) { if (!is_string($value)) { return $this->addViolation('YAML input was not a string.', $constraint); } try { $arr = Parser::parse($value, true); } catch (ParseException $e) { return $this->a...
php
public function validate($value, Constraint $constraint) { if (!is_string($value)) { return $this->addViolation('YAML input was not a string.', $constraint); } try { $arr = Parser::parse($value, true); } catch (ParseException $e) { return $this->a...
[ "public", "function", "validate", "(", "$", "value", ",", "Constraint", "$", "constraint", ")", "{", "if", "(", "!", "is_string", "(", "$", "value", ")", ")", "{", "return", "$", "this", "->", "addViolation", "(", "'YAML input was not a string.'", ",", "$"...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Form/Validator/Constraints/YamlValidator.php#L22-L39
bolt/bolt
src/Form/Validator/Constraints/YamlValidator.php
YamlValidator.addViolation
protected function addViolation($error, Constraint $constraint) { $this->context->buildViolation($constraint->message) ->setParameter('%error%', $error) ->addViolation() ; return true; }
php
protected function addViolation($error, Constraint $constraint) { $this->context->buildViolation($constraint->message) ->setParameter('%error%', $error) ->addViolation() ; return true; }
[ "protected", "function", "addViolation", "(", "$", "error", ",", "Constraint", "$", "constraint", ")", "{", "$", "this", "->", "context", "->", "buildViolation", "(", "$", "constraint", "->", "message", ")", "->", "setParameter", "(", "'%error%'", ",", "$", ...
Add violation. @param mixed $error @param Constraint|Yaml $constraint @return true
[ "Add", "violation", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Form/Validator/Constraints/YamlValidator.php#L49-L57
bolt/bolt
src/Extension/AbstractExtension.php
AbstractExtension.getName
final public function getName() { if ($this->name === null) { // Get name from class name without Extension suffix $parts = explode('\\', get_class($this)); $name = array_pop($parts); $pos = strrpos($name, 'Extension'); if ($pos !== false) { ...
php
final public function getName() { if ($this->name === null) { // Get name from class name without Extension suffix $parts = explode('\\', get_class($this)); $name = array_pop($parts); $pos = strrpos($name, 'Extension'); if ($pos !== false) { ...
[ "final", "public", "function", "getName", "(", ")", "{", "if", "(", "$", "this", "->", "name", "===", "null", ")", "{", "// Get name from class name without Extension suffix", "$", "parts", "=", "explode", "(", "'\\\\'", ",", "get_class", "(", "$", "this", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Extension/AbstractExtension.php#L92-L111
bolt/bolt
src/Extension/AbstractExtension.php
AbstractExtension.getVendor
final public function getVendor() { if ($this->vendor === null) { $namespace = $this->getNamespace(); $name = Str::replaceFirst($namespace, 'Bolt\\Extension\\', ''); $pos = strpos($name, '\\'); $this->vendor = $pos === false ? $name : substr($name, 0, $pos); ...
php
final public function getVendor() { if ($this->vendor === null) { $namespace = $this->getNamespace(); $name = Str::replaceFirst($namespace, 'Bolt\\Extension\\', ''); $pos = strpos($name, '\\'); $this->vendor = $pos === false ? $name : substr($name, 0, $pos); ...
[ "final", "public", "function", "getVendor", "(", ")", "{", "if", "(", "$", "this", "->", "vendor", "===", "null", ")", "{", "$", "namespace", "=", "$", "this", "->", "getNamespace", "(", ")", ";", "$", "name", "=", "Str", "::", "replaceFirst", "(", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Extension/AbstractExtension.php#L116-L126
bolt/bolt
src/Composer/Action/AbstractDependencyAction.php
AbstractDependencyAction.execute
public function execute($packageName, $textConstraint = '*', $onlyLocal = true) { // Find packages that are or provide the requested package first $pool = $this->getRequiredPool($packageName, $textConstraint, $onlyLocal); $packages = $pool->whatProvides($packageName); if (empty($pack...
php
public function execute($packageName, $textConstraint = '*', $onlyLocal = true) { // Find packages that are or provide the requested package first $pool = $this->getRequiredPool($packageName, $textConstraint, $onlyLocal); $packages = $pool->whatProvides($packageName); if (empty($pack...
[ "public", "function", "execute", "(", "$", "packageName", ",", "$", "textConstraint", "=", "'*'", ",", "$", "onlyLocal", "=", "true", ")", "{", "// Find packages that are or provide the requested package first", "$", "pool", "=", "$", "this", "->", "getRequiredPool"...
Execute. @param string $packageName package to inspect @param string $textConstraint Optional version constraint @param bool $onlyLocal @return Dependency[]|null
[ "Execute", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/Action/AbstractDependencyAction.php#L38-L69
bolt/bolt
src/Composer/Action/AbstractDependencyAction.php
AbstractDependencyAction.getRequiredPool
private function getRequiredPool($packageName, $textConstraint, $onlyLocal) { if ($onlyLocal === false) { return $this->getPool(); } $composer = $this->getComposer(); $pool = new Pool(); // Prepare repositories and set up a pool $platformOverrides = $comp...
php
private function getRequiredPool($packageName, $textConstraint, $onlyLocal) { if ($onlyLocal === false) { return $this->getPool(); } $composer = $this->getComposer(); $pool = new Pool(); // Prepare repositories and set up a pool $platformOverrides = $comp...
[ "private", "function", "getRequiredPool", "(", "$", "packageName", ",", "$", "textConstraint", ",", "$", "onlyLocal", ")", "{", "if", "(", "$", "onlyLocal", "===", "false", ")", "{", "return", "$", "this", "->", "getPool", "(", ")", ";", "}", "$", "com...
If the version we ask for is not installed then we need to locate it in remote repos and add it. This is needed for why-not to resolve conflicts from an uninstalled version against installed packages. @param string $packageName package to inspect @param string $textConstraint Optional version constraint @param boo...
[ "If", "the", "version", "we", "ask", "for", "is", "not", "installed", "then", "we", "need", "to", "locate", "it", "in", "remote", "repos", "and", "add", "it", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/Action/AbstractDependencyAction.php#L84-L113
bolt/bolt
src/Composer/Action/AbstractDependencyAction.php
AbstractDependencyAction.getNeedles
private function getNeedles($packageName, $packages, $inverted) { $needles = [$packageName]; if ($inverted === false) { return $needles; } // Include replaced packages for inverted lookups as they are then the actual starting point to consider $mapCb = function (...
php
private function getNeedles($packageName, $packages, $inverted) { $needles = [$packageName]; if ($inverted === false) { return $needles; } // Include replaced packages for inverted lookups as they are then the actual starting point to consider $mapCb = function (...
[ "private", "function", "getNeedles", "(", "$", "packageName", ",", "$", "packages", ",", "$", "inverted", ")", "{", "$", "needles", "=", "[", "$", "packageName", "]", ";", "if", "(", "$", "inverted", "===", "false", ")", "{", "return", "$", "needles", ...
Return a needle stack of Links depending on why/why-not. @param string $packageName @param PackageInterface[] $packages @param bool $inverted - Prohibits = true - Depends = false @return Link[]
[ "Return", "a", "needle", "stack", "of", "Links", "depending", "on", "why", "/", "why", "-", "not", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/Action/AbstractDependencyAction.php#L126-L145
bolt/bolt
src/Composer/Action/AbstractDependencyAction.php
AbstractDependencyAction.getDependencies
private function getDependencies(array $results) { $dependencies = []; $doubles = []; foreach ($results as $name => $result) { $type = $this->recursive ? Dependency::PROHIBITS : Dependency::DEPENDS; $dependency = Dependency::create($name, $type, $result); ...
php
private function getDependencies(array $results) { $dependencies = []; $doubles = []; foreach ($results as $name => $result) { $type = $this->recursive ? Dependency::PROHIBITS : Dependency::DEPENDS; $dependency = Dependency::create($name, $type, $result); ...
[ "private", "function", "getDependencies", "(", "array", "$", "results", ")", "{", "$", "dependencies", "=", "[", "]", ";", "$", "doubles", "=", "[", "]", ";", "foreach", "(", "$", "results", "as", "$", "name", "=>", "$", "result", ")", "{", "$", "t...
Assembles and prints a bottom-up table of the dependencies. @param array $results @return Dependency[]
[ "Assembles", "and", "prints", "a", "bottom", "-", "up", "table", "of", "the", "dependencies", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/Action/AbstractDependencyAction.php#L154-L171
bolt/bolt
src/Filesystem/FilePermissions.php
FilePermissions.authorized
public function authorized($prefix, $path) { // Check blocked resources foreach ($this->blocked as $rule) { if (preg_match($rule, $path)) { return false; } } // Check allowed filesystems foreach ($this->allowedPrefixes as $allowedPrefi...
php
public function authorized($prefix, $path) { // Check blocked resources foreach ($this->blocked as $rule) { if (preg_match($rule, $path)) { return false; } } // Check allowed filesystems foreach ($this->allowedPrefixes as $allowedPrefi...
[ "public", "function", "authorized", "(", "$", "prefix", ",", "$", "path", ")", "{", "// Check blocked resources", "foreach", "(", "$", "this", "->", "blocked", "as", "$", "rule", ")", "{", "if", "(", "preg_match", "(", "$", "rule", ",", "$", "path", ")...
Check if you can do something with the given file or directory. @param string $prefix @param string $path @return bool
[ "Check", "if", "you", "can", "do", "something", "with", "the", "given", "file", "or", "directory", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Filesystem/FilePermissions.php#L60-L84
bolt/bolt
src/Filesystem/FilePermissions.php
FilePermissions.allowedUpload
public function allowedUpload($originalFilename) { // Check if file_uploads ini directive is true if (Ini::getBool('file_uploads') === false) { throw new IOException('File uploads are not allowed, check the file_uploads ini directive.'); } // no UNIX-hidden files ...
php
public function allowedUpload($originalFilename) { // Check if file_uploads ini directive is true if (Ini::getBool('file_uploads') === false) { throw new IOException('File uploads are not allowed, check the file_uploads ini directive.'); } // no UNIX-hidden files ...
[ "public", "function", "allowedUpload", "(", "$", "originalFilename", ")", "{", "// Check if file_uploads ini directive is true", "if", "(", "Ini", "::", "getBool", "(", "'file_uploads'", ")", "===", "false", ")", "{", "throw", "new", "IOException", "(", "'File uploa...
Checks if a given file is acceptable for upload. @param string $originalFilename @throws IOException @return bool
[ "Checks", "if", "a", "given", "file", "is", "acceptable", "for", "upload", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Filesystem/FilePermissions.php#L95-L110
bolt/bolt
src/Filesystem/FilePermissions.php
FilePermissions.getMaxUploadSize
public function getMaxUploadSize() { if (!isset($this->maxUploadSize)) { $size = Ini::getBytes('post_max_size'); $uploadMax = Ini::getBytes('upload_max_filesize'); if (($uploadMax > 0) && ($uploadMax < $size)) { $size = $uploadMax; } else { ...
php
public function getMaxUploadSize() { if (!isset($this->maxUploadSize)) { $size = Ini::getBytes('post_max_size'); $uploadMax = Ini::getBytes('upload_max_filesize'); if (($uploadMax > 0) && ($uploadMax < $size)) { $size = $uploadMax; } else { ...
[ "public", "function", "getMaxUploadSize", "(", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "maxUploadSize", ")", ")", "{", "$", "size", "=", "Ini", "::", "getBytes", "(", "'post_max_size'", ")", ";", "$", "uploadMax", "=", "Ini", "::", ...
Get the maximum upload size the server is configured to accept. @return float
[ "Get", "the", "maximum", "upload", "size", "the", "server", "is", "configured", "to", "accept", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Filesystem/FilePermissions.php#L127-L145
bolt/bolt
src/Storage/Database/Schema/Comparison/IgnoredChange.php
IgnoredChange.matches
public function matches($alteration, $propertyName, $before, $after) { if ($this->alteration === $alteration && $this->propertyName === $propertyName && $this->before === $before && $this->after === $after ) { return true; } return fal...
php
public function matches($alteration, $propertyName, $before, $after) { if ($this->alteration === $alteration && $this->propertyName === $propertyName && $this->before === $before && $this->after === $after ) { return true; } return fal...
[ "public", "function", "matches", "(", "$", "alteration", ",", "$", "propertyName", ",", "$", "before", ",", "$", "after", ")", "{", "if", "(", "$", "this", "->", "alteration", "===", "$", "alteration", "&&", "$", "this", "->", "propertyName", "===", "$...
Check if parameters match object parameters. @param string $alteration @param string $propertyName @param string $before @param string $after @return bool
[ "Check", "if", "parameters", "match", "object", "parameters", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Database/Schema/Comparison/IgnoredChange.php#L47-L58
bolt/bolt
src/Debug/Caster/TransparentProxyTrait.php
TransparentProxyTrait.registerCaster
public static function registerCaster(AbstractCloner $cloner) { /** * Don't want this to be publicly accessible. * * @param TransparentProxyTrait $obj * @param array $a * @param Stub $stub * @param bool $...
php
public static function registerCaster(AbstractCloner $cloner) { /** * Don't want this to be publicly accessible. * * @param TransparentProxyTrait $obj * @param array $a * @param Stub $stub * @param bool $...
[ "public", "static", "function", "registerCaster", "(", "AbstractCloner", "$", "cloner", ")", "{", "/**\n * Don't want this to be publicly accessible.\n *\n * @param TransparentProxyTrait $obj\n * @param array $a\n * @param Stub ...
Registers caster for this class. This allows VarDumper to make this proxy transparent when dumping. @param AbstractCloner $cloner
[ "Registers", "caster", "for", "this", "class", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Debug/Caster/TransparentProxyTrait.php#L47-L95
bolt/bolt
src/Provider/MailerServiceProvider.php
MailerServiceProvider.register
public function register(Application $app) { if (!isset($app['swiftmailer.options'])) { $app->register(new SwiftmailerServiceProvider()); } $app['swiftmailer.options'] = function ($app) { return (array) $app['config']->get('general/mailoptions'); }; ...
php
public function register(Application $app) { if (!isset($app['swiftmailer.options'])) { $app->register(new SwiftmailerServiceProvider()); } $app['swiftmailer.options'] = function ($app) { return (array) $app['config']->get('general/mailoptions'); }; ...
[ "public", "function", "register", "(", "Application", "$", "app", ")", "{", "if", "(", "!", "isset", "(", "$", "app", "[", "'swiftmailer.options'", "]", ")", ")", "{", "$", "app", "->", "register", "(", "new", "SwiftmailerServiceProvider", "(", ")", ")",...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Provider/MailerServiceProvider.php#L20-L45
bolt/bolt
src/Controller/Backend/Records.php
Records.edit
public function edit(Request $request, $contenttypeslug, $id) { $contentTypeKey = $contenttypeslug; $duplicate = $request->query->getBoolean('duplicate'); $new = $duplicate ? false : empty($id); // Override return redirect for singletons $isSingleton = $this->getOption('cont...
php
public function edit(Request $request, $contenttypeslug, $id) { $contentTypeKey = $contenttypeslug; $duplicate = $request->query->getBoolean('duplicate'); $new = $duplicate ? false : empty($id); // Override return redirect for singletons $isSingleton = $this->getOption('cont...
[ "public", "function", "edit", "(", "Request", "$", "request", ",", "$", "contenttypeslug", ",", "$", "id", ")", "{", "$", "contentTypeKey", "=", "$", "contenttypeslug", ";", "$", "duplicate", "=", "$", "request", "->", "query", "->", "getBoolean", "(", "...
Edit a record, or create a new one. @param Request $request The Symfony Request @param string $contenttypeslug The content type slug @param int $id The content ID @return \Bolt\Response\TemplateResponse|\Symfony\Component\HttpFoundation\Response
[ "Edit", "a", "record", "or", "create", "a", "new", "one", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Backend/Records.php#L48-L140
bolt/bolt
src/Controller/Backend/Records.php
Records.getReturnTo
private function getReturnTo(Request $request, Button $button) { $name = $button->getName(); $isAjax = $request->isXmlHttpRequest(); if ($request->attributes->has('_test')) { return 'test'; } if ($name === 'save') { return $isAjax ? 'ajax' : $name; ...
php
private function getReturnTo(Request $request, Button $button) { $name = $button->getName(); $isAjax = $request->isXmlHttpRequest(); if ($request->attributes->has('_test')) { return 'test'; } if ($name === 'save') { return $isAjax ? 'ajax' : $name; ...
[ "private", "function", "getReturnTo", "(", "Request", "$", "request", ",", "Button", "$", "button", ")", "{", "$", "name", "=", "$", "button", "->", "getName", "(", ")", ";", "$", "isAjax", "=", "$", "request", "->", "isXmlHttpRequest", "(", ")", ";", ...
Calculate the parameter used to determine response. @internal to be removed when forms cut-over is complete @param Request $request @param Button $button @return string
[ "Calculate", "the", "parameter", "used", "to", "determine", "response", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Backend/Records.php#L152-L164
bolt/bolt
src/Controller/Backend/Records.php
Records.overview
public function overview(Request $request, $contenttypeslug) { // Make sure the user is allowed to see this page, based on 'allowed contenttypes' // for Editors. if (!$this->isAllowed('contenttype:' . $contenttypeslug)) { $this->flashes()->error(Trans::__('general.phrase.access-d...
php
public function overview(Request $request, $contenttypeslug) { // Make sure the user is allowed to see this page, based on 'allowed contenttypes' // for Editors. if (!$this->isAllowed('contenttype:' . $contenttypeslug)) { $this->flashes()->error(Trans::__('general.phrase.access-d...
[ "public", "function", "overview", "(", "Request", "$", "request", ",", "$", "contenttypeslug", ")", "{", "// Make sure the user is allowed to see this page, based on 'allowed contenttypes'", "// for Editors.", "if", "(", "!", "$", "this", "->", "isAllowed", "(", "'content...
Content type overview page. @param Request $request The Symfony Request @param string $contenttypeslug The content type slug @return \Bolt\Response\TemplateResponse|\Symfony\Component\HttpFoundation\RedirectResponse
[ "Content", "type", "overview", "page", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Backend/Records.php#L174-L208
bolt/bolt
src/Controller/Backend/Records.php
Records.checkEditAccess
private function checkEditAccess($contenttypeslug, $id) { // Is the record new or existing $new = empty($id) ?: false; /* * Check the user is allowed to create/edit this record, based on: * contenttype-all: * contenttype-default: * contenttype...
php
private function checkEditAccess($contenttypeslug, $id) { // Is the record new or existing $new = empty($id) ?: false; /* * Check the user is allowed to create/edit this record, based on: * contenttype-all: * contenttype-default: * contenttype...
[ "private", "function", "checkEditAccess", "(", "$", "contenttypeslug", ",", "$", "id", ")", "{", "// Is the record new or existing", "$", "new", "=", "empty", "(", "$", "id", ")", "?", ":", "false", ";", "/*\n * Check the user is allowed to create/edit this re...
Check that the user is allowed to edit the record. @param string $contenttypeslug @param int $id @return bool|\Symfony\Component\HttpFoundation\RedirectResponse
[ "Check", "that", "the", "user", "is", "allowed", "to", "edit", "the", "record", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Backend/Records.php#L218-L240
bolt/bolt
src/Controller/Backend/Records.php
Records.getEditReferrer
private function getEditReferrer(Request $request) { $tmp = parse_url($request->server->get('HTTP_REFERER')); $referrer = $tmp['path']; if (!empty($tmp['query'])) { $referrer .= '?' . $tmp['query']; } if (strpos($referrer, '/overview/') !== false || ($referrer =...
php
private function getEditReferrer(Request $request) { $tmp = parse_url($request->server->get('HTTP_REFERER')); $referrer = $tmp['path']; if (!empty($tmp['query'])) { $referrer .= '?' . $tmp['query']; } if (strpos($referrer, '/overview/') !== false || ($referrer =...
[ "private", "function", "getEditReferrer", "(", "Request", "$", "request", ")", "{", "$", "tmp", "=", "parse_url", "(", "$", "request", "->", "server", "->", "get", "(", "'HTTP_REFERER'", ")", ")", ";", "$", "referrer", "=", "$", "tmp", "[", "'path'", "...
Set the editreferrer in twig if it was not set yet. @param Request $request @return string|null
[ "Set", "the", "editreferrer", "in", "twig", "if", "it", "was", "not", "set", "yet", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Backend/Records.php#L249-L267
bolt/bolt
src/EventListener/DoctrineListener.php
DoctrineListener.failConnect
public function failConnect(FailedConnectionEvent $args) { $e = $args->getException(); $this->logger->debug($e->getMessage(), ['event' => 'exception', 'exception' => $e]); throw new DatabaseConnectionException($args->getDriver()->getName(), $e->getMessage(), $e); }
php
public function failConnect(FailedConnectionEvent $args) { $e = $args->getException(); $this->logger->debug($e->getMessage(), ['event' => 'exception', 'exception' => $e]); throw new DatabaseConnectionException($args->getDriver()->getName(), $e->getMessage(), $e); }
[ "public", "function", "failConnect", "(", "FailedConnectionEvent", "$", "args", ")", "{", "$", "e", "=", "$", "args", "->", "getException", "(", ")", ";", "$", "this", "->", "logger", "->", "debug", "(", "$", "e", "->", "getMessage", "(", ")", ",", "...
Event fired on database connection failure. @param FailedConnectionEvent $args @throws DatabaseConnectionException
[ "Event", "fired", "on", "database", "connection", "failure", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/EventListener/DoctrineListener.php#L47-L53
bolt/bolt
src/EventListener/DoctrineListener.php
DoctrineListener.postConnect
public function postConnect(ConnectionEventArgs $args) { $db = $args->getConnection(); $platform = $args->getDatabasePlatform(); $platformName = $platform->getName(); if ($platformName === 'sqlite') { $db->query('PRAGMA synchronous = OFF'); } elseif ($platformNam...
php
public function postConnect(ConnectionEventArgs $args) { $db = $args->getConnection(); $platform = $args->getDatabasePlatform(); $platformName = $platform->getName(); if ($platformName === 'sqlite') { $db->query('PRAGMA synchronous = OFF'); } elseif ($platformNam...
[ "public", "function", "postConnect", "(", "ConnectionEventArgs", "$", "args", ")", "{", "$", "db", "=", "$", "args", "->", "getConnection", "(", ")", ";", "$", "platform", "=", "$", "args", "->", "getDatabasePlatform", "(", ")", ";", "$", "platformName", ...
After connecting, update this connection's database settings. Note: Doctrine expects this method to be called postConnect @param ConnectionEventArgs $args @throws \Doctrine\DBAL\DBALException
[ "After", "connecting", "update", "this", "connection", "s", "database", "settings", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/EventListener/DoctrineListener.php#L64-L92
bolt/bolt
src/Library.php
Library.filesizeToBytes
public static function filesizeToBytes($size) { $unit = preg_replace('/[^bkmgtpezy]/i', '', $size); $size = preg_replace('/[^0-9\.]/', '', $size); if ($unit) { return round($size * pow(1024, stripos('bkmgtpezy', $unit[0]))); } return round($size); }
php
public static function filesizeToBytes($size) { $unit = preg_replace('/[^bkmgtpezy]/i', '', $size); $size = preg_replace('/[^0-9\.]/', '', $size); if ($unit) { return round($size * pow(1024, stripos('bkmgtpezy', $unit[0]))); } return round($size); }
[ "public", "static", "function", "filesizeToBytes", "(", "$", "size", ")", "{", "$", "unit", "=", "preg_replace", "(", "'/[^bkmgtpezy]/i'", ",", "''", ",", "$", "size", ")", ";", "$", "size", "=", "preg_replace", "(", "'/[^0-9\\.]/'", ",", "''", ",", "$",...
Convert a size string, such as 5M to bytes. @param string $size @return float
[ "Convert", "a", "size", "string", "such", "as", "5M", "to", "bytes", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Library.php#L48-L58
bolt/bolt
src/Library.php
Library.getExtension
public static function getExtension($filename) { Deprecated::method(3.0, 'Use pathinfo() instead.'); $pos = strrpos($filename, '.'); if ($pos === false) { return ''; } $ext = substr($filename, $pos + 1); return $ext; }
php
public static function getExtension($filename) { Deprecated::method(3.0, 'Use pathinfo() instead.'); $pos = strrpos($filename, '.'); if ($pos === false) { return ''; } $ext = substr($filename, $pos + 1); return $ext; }
[ "public", "static", "function", "getExtension", "(", "$", "filename", ")", "{", "Deprecated", "::", "method", "(", "3.0", ",", "'Use pathinfo() instead.'", ")", ";", "$", "pos", "=", "strrpos", "(", "$", "filename", ",", "'.'", ")", ";", "if", "(", "$", ...
Gets the extension (if any) of a filename. @deprecated Deprecated since 3.0, to be removed in 4.0. @param string $filename @return string
[ "Gets", "the", "extension", "(", "if", "any", ")", "of", "a", "filename", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Library.php#L69-L80
bolt/bolt
src/Library.php
Library.safeFilename
public static function safeFilename($filename) { Deprecated::method(3.0); $filename = rawurlencode($filename); // Use 'rawurlencode', because we prefer '%20' over '+' for spaces. $filename = str_replace('%2F', '/', $filename); if (substr($filename, 0, 1) == '/') { $file...
php
public static function safeFilename($filename) { Deprecated::method(3.0); $filename = rawurlencode($filename); // Use 'rawurlencode', because we prefer '%20' over '+' for spaces. $filename = str_replace('%2F', '/', $filename); if (substr($filename, 0, 1) == '/') { $file...
[ "public", "static", "function", "safeFilename", "(", "$", "filename", ")", "{", "Deprecated", "::", "method", "(", "3.0", ")", ";", "$", "filename", "=", "rawurlencode", "(", "$", "filename", ")", ";", "// Use 'rawurlencode', because we prefer '%20' over '+' for spa...
Encodes a filename, for use in thumbnails, magnific popup, etc. @deprecated Deprecated since 3.0, to be removed in 4.0. @param string $filename @return string
[ "Encodes", "a", "filename", "for", "use", "in", "thumbnails", "magnific", "popup", "etc", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Library.php#L91-L103
bolt/bolt
src/Library.php
Library.path
public static function path($path, $param = [], $add = '') { Deprecated::method(3.0, UrlGeneratorInterface::class . '::generate'); $app = AppSingleton::get(); if (!empty($add) && $add[0] != '?') { $add = '?' . $add; } if (empty($param)) { $param = [...
php
public static function path($path, $param = [], $add = '') { Deprecated::method(3.0, UrlGeneratorInterface::class . '::generate'); $app = AppSingleton::get(); if (!empty($add) && $add[0] != '?') { $add = '?' . $add; } if (empty($param)) { $param = [...
[ "public", "static", "function", "path", "(", "$", "path", ",", "$", "param", "=", "[", "]", ",", "$", "add", "=", "''", ")", "{", "Deprecated", "::", "method", "(", "3.0", ",", "UrlGeneratorInterface", "::", "class", ".", "'::generate'", ")", ";", "$...
Simple wrapper for $app['url_generator']->generate(). @deprecated Deprecated since 3.0, to be removed in 4.0. @param string $path @param array $param @param string $add @return string
[ "Simple", "wrapper", "for", "$app", "[", "url_generator", "]", "-", ">", "generate", "()", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Library.php#L116-L131
bolt/bolt
src/Library.php
Library.redirect
public static function redirect($path, $param = [], $add = '') { Deprecated::method(3.0); return new RedirectResponse(self::path($path, $param, $add)); }
php
public static function redirect($path, $param = [], $add = '') { Deprecated::method(3.0); return new RedirectResponse(self::path($path, $param, $add)); }
[ "public", "static", "function", "redirect", "(", "$", "path", ",", "$", "param", "=", "[", "]", ",", "$", "add", "=", "''", ")", "{", "Deprecated", "::", "method", "(", "3.0", ")", ";", "return", "new", "RedirectResponse", "(", "self", "::", "path", ...
Simple wrapper for $app->redirect($app['url_generator']->generate());. @deprecated Deprecated since 3.0, to be removed in 4.0. @param string $path @param array $param @param string $add @return \Symfony\Component\HttpFoundation\RedirectResponse
[ "Simple", "wrapper", "for", "$app", "-", ">", "redirect", "(", "$app", "[", "url_generator", "]", "-", ">", "generate", "()", ")", ";", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Library.php#L144-L149
bolt/bolt
src/Library.php
Library.simpleredirect
public static function simpleredirect($path, $abort = false) { Deprecated::method(3.0); if (empty($path)) { $path = '/'; } header("location: $path"); echo "<p>Redirecting to <a href='$path'>$path</a>.</p>"; echo "<script>window.setTimeout(function () { wi...
php
public static function simpleredirect($path, $abort = false) { Deprecated::method(3.0); if (empty($path)) { $path = '/'; } header("location: $path"); echo "<p>Redirecting to <a href='$path'>$path</a>.</p>"; echo "<script>window.setTimeout(function () { wi...
[ "public", "static", "function", "simpleredirect", "(", "$", "path", ",", "$", "abort", "=", "false", ")", "{", "Deprecated", "::", "method", "(", "3.0", ")", ";", "if", "(", "empty", "(", "$", "path", ")", ")", "{", "$", "path", "=", "'/'", ";", ...
Create a simple redirect to a page / path. @deprecated Deprecated since 3.0, to be removed in 4.0. @param string $path @param bool $abort @return string
[ "Create", "a", "simple", "redirect", "to", "a", "page", "/", "path", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Library.php#L161-L176
bolt/bolt
src/Library.php
Library.smartUnserialize
public static function smartUnserialize($str, $assoc = true) { if ($str[0] === '{' || $str[0] === '[') { return Json::parse($str, $assoc); } return Serialization::parse($str); }
php
public static function smartUnserialize($str, $assoc = true) { if ($str[0] === '{' || $str[0] === '[') { return Json::parse($str, $assoc); } return Serialization::parse($str); }
[ "public", "static", "function", "smartUnserialize", "(", "$", "str", ",", "$", "assoc", "=", "true", ")", "{", "if", "(", "$", "str", "[", "0", "]", "===", "'{'", "||", "$", "str", "[", "0", "]", "===", "'['", ")", "{", "return", "Json", "::", ...
Leniently decode a serialized compound data structure, detecting whether it's dealing with JSON-encoded data or a PHP-serialized string. @param string $str @param bool $assoc @return mixed
[ "Leniently", "decode", "a", "serialized", "compound", "data", "structure", "detecting", "whether", "it", "s", "dealing", "with", "JSON", "-", "encoded", "data", "or", "a", "PHP", "-", "serialized", "string", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Library.php#L187-L194
bolt/bolt
src/Nut/Extensions.php
Extensions.execute
protected function execute(InputInterface $input, OutputInterface $output) { $messages = $this->app['extend.manager']->getMessages(); if (count($messages)) { $this->io->error($messages); return 1; } $rows = []; $installed = $this->app['extend.manager...
php
protected function execute(InputInterface $input, OutputInterface $output) { $messages = $this->app['extend.manager']->getMessages(); if (count($messages)) { $this->io->error($messages); return 1; } $rows = []; $installed = $this->app['extend.manager...
[ "protected", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "$", "messages", "=", "$", "this", "->", "app", "[", "'extend.manager'", "]", "->", "getMessages", "(", ")", ";", "if", "(", "count", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/Extensions.php#L27-L53
bolt/bolt
src/Twig/ArrayAccessSecurityProxy.php
ArrayAccessSecurityProxy.offsetGet
public function offsetGet($offset) { $this->sandbox->checkPropertyAllowed($this, $offset); return $this->object[$offset]; }
php
public function offsetGet($offset) { $this->sandbox->checkPropertyAllowed($this, $offset); return $this->object[$offset]; }
[ "public", "function", "offsetGet", "(", "$", "offset", ")", "{", "$", "this", "->", "sandbox", "->", "checkPropertyAllowed", "(", "$", "this", ",", "$", "offset", ")", ";", "return", "$", "this", "->", "object", "[", "$", "offset", "]", ";", "}" ]
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/ArrayAccessSecurityProxy.php#L71-L76
bolt/bolt
src/Twig/ArrayAccessSecurityProxy.php
ArrayAccessSecurityProxy.getIterator
public function getIterator() { if (!is_array($this->object) && !$this->object instanceof Traversable) { throw new BadMethodCallException('Object is not an array, or does not implement Traversable'); } $this->sandbox->checkPropertyAllowed($this, 'iterator'); if ($this->...
php
public function getIterator() { if (!is_array($this->object) && !$this->object instanceof Traversable) { throw new BadMethodCallException('Object is not an array, or does not implement Traversable'); } $this->sandbox->checkPropertyAllowed($this, 'iterator'); if ($this->...
[ "public", "function", "getIterator", "(", ")", "{", "if", "(", "!", "is_array", "(", "$", "this", "->", "object", ")", "&&", "!", "$", "this", "->", "object", "instanceof", "Traversable", ")", "{", "throw", "new", "BadMethodCallException", "(", "'Object is...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/ArrayAccessSecurityProxy.php#L97-L110
bolt/bolt
src/Twig/ArrayAccessSecurityProxy.php
ArrayAccessSecurityProxy.count
public function count() { if (!is_array($this->object) && !$this->object instanceof Countable) { throw new BadMethodCallException('Object is not an array, or does not implement Countable'); } $this->sandbox->checkPropertyAllowed($this, 'count'); return count($this->obje...
php
public function count() { if (!is_array($this->object) && !$this->object instanceof Countable) { throw new BadMethodCallException('Object is not an array, or does not implement Countable'); } $this->sandbox->checkPropertyAllowed($this, 'count'); return count($this->obje...
[ "public", "function", "count", "(", ")", "{", "if", "(", "!", "is_array", "(", "$", "this", "->", "object", ")", "&&", "!", "$", "this", "->", "object", "instanceof", "Countable", ")", "{", "throw", "new", "BadMethodCallException", "(", "'Object is not an ...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/ArrayAccessSecurityProxy.php#L115-L124
bolt/bolt
src/Pager/Pager.php
Pager.asArray
public function asArray() { $a = get_object_vars($this); $a['showing_from'] = $this->showingFrom; $a['showing_to'] = $this->showingTo; // remove manager object from array unset($a['manager']); return $a; }
php
public function asArray() { $a = get_object_vars($this); $a['showing_from'] = $this->showingFrom; $a['showing_to'] = $this->showingTo; // remove manager object from array unset($a['manager']); return $a; }
[ "public", "function", "asArray", "(", ")", "{", "$", "a", "=", "get_object_vars", "(", "$", "this", ")", ";", "$", "a", "[", "'showing_from'", "]", "=", "$", "this", "->", "showingFrom", ";", "$", "a", "[", "'showing_to'", "]", "=", "$", "this", "-...
For v2 and v3 BC reasons. @return array
[ "For", "v2", "and", "v3", "BC", "reasons", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Pager/Pager.php#L133-L143