repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
bolt/bolt
src/Asset/Widget/Queue.php
Queue.process
public function process(Request $request, Response $response) { /** @var WidgetAssetInterface $widget */ foreach ($this->queue as $widget) { if ($widget->isDeferred()) { $this->addDeferredJavaScript($widget, $response); } } }
php
public function process(Request $request, Response $response) { /** @var WidgetAssetInterface $widget */ foreach ($this->queue as $widget) { if ($widget->isDeferred()) { $this->addDeferredJavaScript($widget, $response); } } }
[ "public", "function", "process", "(", "Request", "$", "request", ",", "Response", "$", "response", ")", "{", "/** @var WidgetAssetInterface $widget */", "foreach", "(", "$", "this", "->", "queue", "as", "$", "widget", ")", "{", "if", "(", "$", "widget", "->"...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Asset/Widget/Queue.php#L108-L116
bolt/bolt
src/Asset/Widget/Queue.php
Queue.has
public function has($location, $zone = Zone::FRONTEND) { return (bool) $this->count($location, $zone); }
php
public function has($location, $zone = Zone::FRONTEND) { return (bool) $this->count($location, $zone); }
[ "public", "function", "has", "(", "$", "location", ",", "$", "zone", "=", "Zone", "::", "FRONTEND", ")", "{", "return", "(", "bool", ")", "$", "this", "->", "count", "(", "$", "location", ",", "$", "zone", ")", ";", "}" ]
Get the number of queued widgets. @param string $location Location (e.g. 'dashboard_aside_top') @param string $zone Either Zone::FRONTEND or Zone::BACKEND @return bool
[ "Get", "the", "number", "of", "queued", "widgets", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Asset/Widget/Queue.php#L143-L146
bolt/bolt
src/Asset/Widget/Queue.php
Queue.count
public function count($location, $zone = Zone::FRONTEND) { $count = 0; foreach ($this->queue as $widget) { if ($widget->getZone() === $zone && $widget->getLocation() === $location) { ++$count; } } return $count; }
php
public function count($location, $zone = Zone::FRONTEND) { $count = 0; foreach ($this->queue as $widget) { if ($widget->getZone() === $zone && $widget->getLocation() === $location) { ++$count; } } return $count; }
[ "public", "function", "count", "(", "$", "location", ",", "$", "zone", "=", "Zone", "::", "FRONTEND", ")", "{", "$", "count", "=", "0", ";", "foreach", "(", "$", "this", "->", "queue", "as", "$", "widget", ")", "{", "if", "(", "$", "widget", "->"...
Get the number of queued widgets. @param string $location Location (e.g. 'dashboard_aside_top') @param string $zone Either Zone::FRONTEND or Zone::BACKEND @return int
[ "Get", "the", "number", "of", "queued", "widgets", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Asset/Widget/Queue.php#L163-L174
bolt/bolt
src/Asset/Widget/Queue.php
Queue.render
public function render($location, $zone = Zone::FRONTEND, $wrapperTemplate = 'widgetwrapper.twig') { $widgets = []; /** @var WidgetAssetInterface $widget */ foreach ($this->sort($this->queue) as $widget) { if ($widget->getZone() !== $zone || $widget->getLocation() !== $location)...
php
public function render($location, $zone = Zone::FRONTEND, $wrapperTemplate = 'widgetwrapper.twig') { $widgets = []; /** @var WidgetAssetInterface $widget */ foreach ($this->sort($this->queue) as $widget) { if ($widget->getZone() !== $zone || $widget->getLocation() !== $location)...
[ "public", "function", "render", "(", "$", "location", ",", "$", "zone", "=", "Zone", "::", "FRONTEND", ",", "$", "wrapperTemplate", "=", "'widgetwrapper.twig'", ")", "{", "$", "widgets", "=", "[", "]", ";", "/** @var WidgetAssetInterface $widget */", "foreach", ...
Render a location's widget. @param string $location Location (e.g. 'dashboard_aside_top') @param string $zone Either Zone::FRONTEND or Zone::BACKEND @param string $wrapperTemplate Template file for wrapper @return string|null
[ "Render", "a", "location", "s", "widget", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Asset/Widget/Queue.php#L185-L203
bolt/bolt
src/Asset/Widget/Queue.php
Queue.getHtml
protected function getHtml(WidgetAssetInterface $widget) { $key = 'widget_' . $widget->getKey(); if ($html = $this->cache->fetch($key)) { return $html; } $html = Thrower::call([$widget, '__toString']); if ($widget->getCacheDuration() !== null) { $thi...
php
protected function getHtml(WidgetAssetInterface $widget) { $key = 'widget_' . $widget->getKey(); if ($html = $this->cache->fetch($key)) { return $html; } $html = Thrower::call([$widget, '__toString']); if ($widget->getCacheDuration() !== null) { $thi...
[ "protected", "function", "getHtml", "(", "WidgetAssetInterface", "$", "widget", ")", "{", "$", "key", "=", "'widget_'", ".", "$", "widget", "->", "getKey", "(", ")", ";", "if", "(", "$", "html", "=", "$", "this", "->", "cache", "->", "fetch", "(", "$...
Get the HTML content from the widget. @param WidgetAssetInterface $widget @throws \Exception @return string
[ "Get", "the", "HTML", "content", "from", "the", "widget", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Asset/Widget/Queue.php#L214-L228
bolt/bolt
src/Asset/Widget/Queue.php
Queue.addDeferredJavaScript
protected function addDeferredJavaScript(WidgetAssetInterface $widget, Response $response) { if ($this->deferAdded) { return; } $javaScript = $this->render->render( 'widgetjavascript.twig', [ 'widget' => $widget, ] ); ...
php
protected function addDeferredJavaScript(WidgetAssetInterface $widget, Response $response) { if ($this->deferAdded) { return; } $javaScript = $this->render->render( 'widgetjavascript.twig', [ 'widget' => $widget, ] ); ...
[ "protected", "function", "addDeferredJavaScript", "(", "WidgetAssetInterface", "$", "widget", ",", "Response", "$", "response", ")", "{", "if", "(", "$", "this", "->", "deferAdded", ")", "{", "return", ";", "}", "$", "javaScript", "=", "$", "this", "->", "...
Insert a snippet of Javascript to fetch the actual widget's contents. @param WidgetAssetInterface $widget @param Response $response
[ "Insert", "a", "snippet", "of", "Javascript", "to", "fetch", "the", "actual", "widget", "s", "contents", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Asset/Widget/Queue.php#L236-L256
bolt/bolt
src/Storage/Database/Schema/TableModifier.php
TableModifier.createTables
public function createTables(array $tableCreates, SchemaCheck $response) { foreach ($tableCreates as $tableName => $tableCreate) { $this->createTable($tableName, $tableCreate, $response); } }
php
public function createTables(array $tableCreates, SchemaCheck $response) { foreach ($tableCreates as $tableName => $tableCreate) { $this->createTable($tableName, $tableCreate, $response); } }
[ "public", "function", "createTables", "(", "array", "$", "tableCreates", ",", "SchemaCheck", "$", "response", ")", "{", "foreach", "(", "$", "tableCreates", "as", "$", "tableName", "=>", "$", "tableCreate", ")", "{", "$", "this", "->", "createTable", "(", ...
Process a group of tables create queries. @param array $tableCreates @param SchemaCheck $response
[ "Process", "a", "group", "of", "tables", "create", "queries", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Database/Schema/TableModifier.php#L45-L50
bolt/bolt
src/Storage/Database/Schema/TableModifier.php
TableModifier.alterTables
public function alterTables(array $tableAlters, SchemaCheck $response) { foreach ($tableAlters as $tableName => $tableAlter) { $this->alterTable($tableName, $tableAlter, $response); } }
php
public function alterTables(array $tableAlters, SchemaCheck $response) { foreach ($tableAlters as $tableName => $tableAlter) { $this->alterTable($tableName, $tableAlter, $response); } }
[ "public", "function", "alterTables", "(", "array", "$", "tableAlters", ",", "SchemaCheck", "$", "response", ")", "{", "foreach", "(", "$", "tableAlters", "as", "$", "tableName", "=>", "$", "tableAlter", ")", "{", "$", "this", "->", "alterTable", "(", "$", ...
Process a group of tables alter queries. @param array $tableAlters @param SchemaCheck $response
[ "Process", "a", "group", "of", "tables", "alter", "queries", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Database/Schema/TableModifier.php#L58-L63
bolt/bolt
src/Storage/Database/Schema/TableModifier.php
TableModifier.createTable
protected function createTable($tableName, array $tableCreate, SchemaCheck $response) { foreach ($tableCreate as $query) { if ($this->runQuery($tableName, $query)) { $response->addTitle($tableName, sprintf('Created table `%s`.', $tableName)); } } }
php
protected function createTable($tableName, array $tableCreate, SchemaCheck $response) { foreach ($tableCreate as $query) { if ($this->runQuery($tableName, $query)) { $response->addTitle($tableName, sprintf('Created table `%s`.', $tableName)); } } }
[ "protected", "function", "createTable", "(", "$", "tableName", ",", "array", "$", "tableCreate", ",", "SchemaCheck", "$", "response", ")", "{", "foreach", "(", "$", "tableCreate", "as", "$", "query", ")", "{", "if", "(", "$", "this", "->", "runQuery", "(...
Process a single table create query. @param string $tableName @param array $tableCreate @param SchemaCheck $response
[ "Process", "a", "single", "table", "create", "query", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Database/Schema/TableModifier.php#L72-L79
bolt/bolt
src/Storage/Database/Schema/TableModifier.php
TableModifier.alterTable
protected function alterTable($tableName, array $tableAlter, SchemaCheck $response) { foreach ($tableAlter as $query) { if ($this->runQuery($tableName, $query) === null) { // Don't continue processing a table after exception is hit. return; } ...
php
protected function alterTable($tableName, array $tableAlter, SchemaCheck $response) { foreach ($tableAlter as $query) { if ($this->runQuery($tableName, $query) === null) { // Don't continue processing a table after exception is hit. return; } ...
[ "protected", "function", "alterTable", "(", "$", "tableName", ",", "array", "$", "tableAlter", ",", "SchemaCheck", "$", "response", ")", "{", "foreach", "(", "$", "tableAlter", "as", "$", "query", ")", "{", "if", "(", "$", "this", "->", "runQuery", "(", ...
Process a single table alter queries. @param string $tableName @param array $tableAlter @param SchemaCheck $response
[ "Process", "a", "single", "table", "alter", "queries", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Database/Schema/TableModifier.php#L88-L97
bolt/bolt
src/Storage/Database/Schema/TableModifier.php
TableModifier.runQuery
protected function runQuery($tableName, $query) { try { return $this->connection->query($query); } catch (DBALException $e) { $this->loggerSystem->critical($e->getMessage(), ['event' => 'exception', 'exception' => $e]); $this->loggerFlash->error( T...
php
protected function runQuery($tableName, $query) { try { return $this->connection->query($query); } catch (DBALException $e) { $this->loggerSystem->critical($e->getMessage(), ['event' => 'exception', 'exception' => $e]); $this->loggerFlash->error( T...
[ "protected", "function", "runQuery", "(", "$", "tableName", ",", "$", "query", ")", "{", "try", "{", "return", "$", "this", "->", "connection", "->", "query", "(", "$", "query", ")", ";", "}", "catch", "(", "DBALException", "$", "e", ")", "{", "$", ...
Run the create/alter query. @param string $tableName @param string $query @return \Doctrine\DBAL\Driver\Statement|null
[ "Run", "the", "create", "/", "alter", "query", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Database/Schema/TableModifier.php#L107-L120
bolt/bolt
src/Logger/FlashLogger.php
FlashLogger.has
public function has($type) { if ($this->flashBag) { return $this->flashBag->has($type); } return array_key_exists($type, $this->flashes) && $this->flashes[$type]; }
php
public function has($type) { if ($this->flashBag) { return $this->flashBag->has($type); } return array_key_exists($type, $this->flashes) && $this->flashes[$type]; }
[ "public", "function", "has", "(", "$", "type", ")", "{", "if", "(", "$", "this", "->", "flashBag", ")", "{", "return", "$", "this", "->", "flashBag", "->", "has", "(", "$", "type", ")", ";", "}", "return", "array_key_exists", "(", "$", "type", ",",...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Logger/FlashLogger.php#L74-L81
bolt/bolt
src/Logger/FlashLogger.php
FlashLogger.get
public function get($type, array $default = []) { if ($this->flashBag) { return $this->flashBag->get($type, $default); } if (!$this->has($type)) { return $default; } $return = $this->flashes[$type]; unset($this->flashes[$type]); ret...
php
public function get($type, array $default = []) { if ($this->flashBag) { return $this->flashBag->get($type, $default); } if (!$this->has($type)) { return $default; } $return = $this->flashes[$type]; unset($this->flashes[$type]); ret...
[ "public", "function", "get", "(", "$", "type", ",", "array", "$", "default", "=", "[", "]", ")", "{", "if", "(", "$", "this", "->", "flashBag", ")", "{", "return", "$", "this", "->", "flashBag", "->", "get", "(", "$", "type", ",", "$", "default",...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Logger/FlashLogger.php#L86-L101
bolt/bolt
src/Logger/FlashLogger.php
FlashLogger.add
public function add($type, $message) { if ($this->flashBag) { $this->flashBag->add($type, $message); return; } $this->flashes[$type][] = $message; }
php
public function add($type, $message) { if ($this->flashBag) { $this->flashBag->add($type, $message); return; } $this->flashes[$type][] = $message; }
[ "public", "function", "add", "(", "$", "type", ",", "$", "message", ")", "{", "if", "(", "$", "this", "->", "flashBag", ")", "{", "$", "this", "->", "flashBag", "->", "add", "(", "$", "type", ",", "$", "message", ")", ";", "return", ";", "}", "...
Add a message. @param string $type @param string $message
[ "Add", "a", "message", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Logger/FlashLogger.php#L122-L130
bolt/bolt
src/Logger/FlashLogger.php
FlashLogger.attachFlashBag
public function attachFlashBag(FlashBagInterface $flashBag) { if ($this->flashBag) { return; } $this->flashBag = $flashBag; // We iterate as some flashes might validly be set in Twig // and we shouldn't wipe them. foreach ($this->flashes as $type => $mess...
php
public function attachFlashBag(FlashBagInterface $flashBag) { if ($this->flashBag) { return; } $this->flashBag = $flashBag; // We iterate as some flashes might validly be set in Twig // and we shouldn't wipe them. foreach ($this->flashes as $type => $mess...
[ "public", "function", "attachFlashBag", "(", "FlashBagInterface", "$", "flashBag", ")", "{", "if", "(", "$", "this", "->", "flashBag", ")", "{", "return", ";", "}", "$", "this", "->", "flashBag", "=", "$", "flashBag", ";", "// We iterate as some flashes might ...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Logger/FlashLogger.php#L147-L162
bolt/bolt
src/Debug/Caster/FilesystemCasters.php
FilesystemCasters.castHandler
public static function castHandler(HandlerInterface $handler, array $a, Stub $stub, $isNested, $filter = 0) { // Populate lazy loaded properties $a[Caster::PREFIX_PROTECTED . 'fullPath'] = $handler->getFullPath(); $a[Caster::PREFIX_PROTECTED . 'dirname'] = $handler->getDirname(); $a[...
php
public static function castHandler(HandlerInterface $handler, array $a, Stub $stub, $isNested, $filter = 0) { // Populate lazy loaded properties $a[Caster::PREFIX_PROTECTED . 'fullPath'] = $handler->getFullPath(); $a[Caster::PREFIX_PROTECTED . 'dirname'] = $handler->getDirname(); $a[...
[ "public", "static", "function", "castHandler", "(", "HandlerInterface", "$", "handler", ",", "array", "$", "a", ",", "Stub", "$", "stub", ",", "$", "isNested", ",", "$", "filter", "=", "0", ")", "{", "// Populate lazy loaded properties", "$", "a", "[", "Ca...
@param HandlerInterface $handler @param array $a @param Stub $stub @param bool $isNested @param int $filter @return array
[ "@param", "HandlerInterface", "$handler", "@param", "array", "$a", "@param", "Stub", "$stub", "@param", "bool", "$isNested", "@param", "int", "$filter" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Debug/Caster/FilesystemCasters.php#L46-L82
bolt/bolt
src/Debug/Caster/FilesystemCasters.php
FilesystemCasters.castFile
public static function castFile(FileInterface $file, array $a, Stub $stub, $isNested, $filter = 0) { if ($file->exists()) { $a[Caster::PREFIX_PROTECTED . 'mimetype'] = $file->getMimeType(); $a[Caster::PREFIX_PROTECTED . 'size'] = $file->getSize(); $a[Caster::PREFIX_VIRTUA...
php
public static function castFile(FileInterface $file, array $a, Stub $stub, $isNested, $filter = 0) { if ($file->exists()) { $a[Caster::PREFIX_PROTECTED . 'mimetype'] = $file->getMimeType(); $a[Caster::PREFIX_PROTECTED . 'size'] = $file->getSize(); $a[Caster::PREFIX_VIRTUA...
[ "public", "static", "function", "castFile", "(", "FileInterface", "$", "file", ",", "array", "$", "a", ",", "Stub", "$", "stub", ",", "$", "isNested", ",", "$", "filter", "=", "0", ")", "{", "if", "(", "$", "file", "->", "exists", "(", ")", ")", ...
@param FileInterface $file @param array $a @param Stub $stub @param bool $isNested @param int $filter @return array
[ "@param", "FileInterface", "$file", "@param", "array", "$a", "@param", "Stub", "$stub", "@param", "bool", "$isNested", "@param", "int", "$filter" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Debug/Caster/FilesystemCasters.php#L93-L105
bolt/bolt
src/Debug/Caster/FilesystemCasters.php
FilesystemCasters.castDirectory
public static function castDirectory(DirectoryInterface $directory, array $a, Stub $stub, $isNested, $filter = 0) { $a[Caster::PREFIX_VIRTUAL . 'root'] = $directory->isRoot(); return $a; }
php
public static function castDirectory(DirectoryInterface $directory, array $a, Stub $stub, $isNested, $filter = 0) { $a[Caster::PREFIX_VIRTUAL . 'root'] = $directory->isRoot(); return $a; }
[ "public", "static", "function", "castDirectory", "(", "DirectoryInterface", "$", "directory", ",", "array", "$", "a", ",", "Stub", "$", "stub", ",", "$", "isNested", ",", "$", "filter", "=", "0", ")", "{", "$", "a", "[", "Caster", "::", "PREFIX_VIRTUAL",...
@param DirectoryInterface $directory @param array $a @param Stub $stub @param bool $isNested @param int $filter @return array
[ "@param", "DirectoryInterface", "$directory", "@param", "array", "$a", "@param", "Stub", "$stub", "@param", "bool", "$isNested", "@param", "int", "$filter" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Debug/Caster/FilesystemCasters.php#L116-L121
bolt/bolt
src/Debug/Caster/FilesystemCasters.php
FilesystemCasters.castImage
public static function castImage(Image $image, array $a, Stub $stub, $isNested, $filter = 0) { try { $a[Caster::PREFIX_PROTECTED . 'info'] = $image->getInfo(); } catch (IOException $e) { } return $a; }
php
public static function castImage(Image $image, array $a, Stub $stub, $isNested, $filter = 0) { try { $a[Caster::PREFIX_PROTECTED . 'info'] = $image->getInfo(); } catch (IOException $e) { } return $a; }
[ "public", "static", "function", "castImage", "(", "Image", "$", "image", ",", "array", "$", "a", ",", "Stub", "$", "stub", ",", "$", "isNested", ",", "$", "filter", "=", "0", ")", "{", "try", "{", "$", "a", "[", "Caster", "::", "PREFIX_PROTECTED", ...
@param Image $image @param array $a @param Stub $stub @param bool $isNested @param int $filter @return array
[ "@param", "Image", "$image", "@param", "array", "$a", "@param", "Stub", "$stub", "@param", "bool", "$isNested", "@param", "int", "$filter" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Debug/Caster/FilesystemCasters.php#L132-L140
bolt/bolt
src/Debug/Caster/FilesystemCasters.php
FilesystemCasters.castImageInfo
public static function castImageInfo(Image\Info $info, array $a, Stub $stub, $isNested, $filter = 0) { $a[Caster::PREFIX_VIRTUAL . 'width'] = $info->getWidth(); $a[Caster::PREFIX_VIRTUAL . 'height'] = $info->getHeight(); return $a; }
php
public static function castImageInfo(Image\Info $info, array $a, Stub $stub, $isNested, $filter = 0) { $a[Caster::PREFIX_VIRTUAL . 'width'] = $info->getWidth(); $a[Caster::PREFIX_VIRTUAL . 'height'] = $info->getHeight(); return $a; }
[ "public", "static", "function", "castImageInfo", "(", "Image", "\\", "Info", "$", "info", ",", "array", "$", "a", ",", "Stub", "$", "stub", ",", "$", "isNested", ",", "$", "filter", "=", "0", ")", "{", "$", "a", "[", "Caster", "::", "PREFIX_VIRTUAL",...
@param Image\Info $info @param array $a @param Stub $stub @param bool $isNested @param int $filter @return array
[ "@param", "Image", "\\", "Info", "$info", "@param", "array", "$a", "@param", "Stub", "$stub", "@param", "bool", "$isNested", "@param", "int", "$filter" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Debug/Caster/FilesystemCasters.php#L151-L157
bolt/bolt
src/Debug/Caster/FilesystemCasters.php
FilesystemCasters.castImageType
public static function castImageType(Image\Type $type, array $a, Stub $stub, $isNested, $filter = 0) { unset($a["\0Bolt\\Filesystem\\Handler\\Image\\Type\0name"]); $a[Caster::PREFIX_VIRTUAL . 'string'] = $type->toString(); $a[Caster::PREFIX_VIRTUAL . 'mimeType'] = $type->getMimeType(); ...
php
public static function castImageType(Image\Type $type, array $a, Stub $stub, $isNested, $filter = 0) { unset($a["\0Bolt\\Filesystem\\Handler\\Image\\Type\0name"]); $a[Caster::PREFIX_VIRTUAL . 'string'] = $type->toString(); $a[Caster::PREFIX_VIRTUAL . 'mimeType'] = $type->getMimeType(); ...
[ "public", "static", "function", "castImageType", "(", "Image", "\\", "Type", "$", "type", ",", "array", "$", "a", ",", "Stub", "$", "stub", ",", "$", "isNested", ",", "$", "filter", "=", "0", ")", "{", "unset", "(", "$", "a", "[", "\"\\0Bolt\\\\Files...
@param Image\Type $type @param array $a @param Stub $stub @param bool $isNested @param int $filter @return array
[ "@param", "Image", "\\", "Type", "$type", "@param", "array", "$a", "@param", "Stub", "$stub", "@param", "bool", "$isNested", "@param", "int", "$filter" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Debug/Caster/FilesystemCasters.php#L168-L178
bolt/bolt
src/Debug/Caster/FilesystemCasters.php
FilesystemCasters.castDimensions
public static function castDimensions(Image\Dimensions $dimensions, array $a, Stub $stub, $isNested, $filter = 0) { $stub->class .= sprintf(' "%s"', (string) $dimensions); return $a; }
php
public static function castDimensions(Image\Dimensions $dimensions, array $a, Stub $stub, $isNested, $filter = 0) { $stub->class .= sprintf(' "%s"', (string) $dimensions); return $a; }
[ "public", "static", "function", "castDimensions", "(", "Image", "\\", "Dimensions", "$", "dimensions", ",", "array", "$", "a", ",", "Stub", "$", "stub", ",", "$", "isNested", ",", "$", "filter", "=", "0", ")", "{", "$", "stub", "->", "class", ".=", "...
@param Image\Dimensions $dimensions @param array $a @param Stub $stub @param bool $isNested @param int $filter @return array
[ "@param", "Image", "\\", "Dimensions", "$dimensions", "@param", "array", "$a", "@param", "Stub", "$stub", "@param", "bool", "$isNested", "@param", "int", "$filter" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Debug/Caster/FilesystemCasters.php#L189-L194
bolt/bolt
src/Debug/Caster/FilesystemCasters.php
FilesystemCasters.castImageExif
public static function castImageExif(Image\Exif $exif, array $a, Stub $stub, $isNested, $filter = 0) { $a = $a[Caster::PREFIX_PROTECTED . 'data']; $a[Caster::PREFIX_VIRTUAL . 'aspectRatio'] = $exif->getAspectRatio(); $a[Caster::PREFIX_VIRTUAL . 'latitude'] = $exif->getLatitude(); $a...
php
public static function castImageExif(Image\Exif $exif, array $a, Stub $stub, $isNested, $filter = 0) { $a = $a[Caster::PREFIX_PROTECTED . 'data']; $a[Caster::PREFIX_VIRTUAL . 'aspectRatio'] = $exif->getAspectRatio(); $a[Caster::PREFIX_VIRTUAL . 'latitude'] = $exif->getLatitude(); $a...
[ "public", "static", "function", "castImageExif", "(", "Image", "\\", "Exif", "$", "exif", ",", "array", "$", "a", ",", "Stub", "$", "stub", ",", "$", "isNested", ",", "$", "filter", "=", "0", ")", "{", "$", "a", "=", "$", "a", "[", "Caster", "::"...
@param Image\Exif $exif @param array $a @param Stub $stub @param bool $isNested @param int $filter @return array|mixed
[ "@param", "Image", "\\", "Exif", "$exif", "@param", "array", "$a", "@param", "Stub", "$stub", "@param", "bool", "$isNested", "@param", "int", "$filter" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Debug/Caster/FilesystemCasters.php#L205-L214
bolt/bolt
src/Helpers/Html.php
Html.trimText
public static function trimText($str, $desiredLength, $hellip = true, $cutOffCap = 10) { if ($hellip) { $ellipseStr = ' …'; $newLength = $desiredLength - 1; } else { $ellipseStr = ''; $newLength = $desiredLength; } $str = trim(strip_ta...
php
public static function trimText($str, $desiredLength, $hellip = true, $cutOffCap = 10) { if ($hellip) { $ellipseStr = ' …'; $newLength = $desiredLength - 1; } else { $ellipseStr = ''; $newLength = $desiredLength; } $str = trim(strip_ta...
[ "public", "static", "function", "trimText", "(", "$", "str", ",", "$", "desiredLength", ",", "$", "hellip", "=", "true", ",", "$", "cutOffCap", "=", "10", ")", "{", "if", "(", "$", "hellip", ")", "{", "$", "ellipseStr", "=", "' …';", "", "$", "newL...
Trim text to a given length. @param string $str String to trim @param int $desiredLength Target string length @param bool $hellip Add dots when the string is too long @param int $cutOffCap Maximum difference between string length when removing words @return string Trimmed string
[ "Trim", "text", "to", "a", "given", "length", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Helpers/Html.php#L17-L46
bolt/bolt
src/Helpers/Html.php
Html.decorateTT
public static function decorateTT($str) { $str = htmlspecialchars($str, ENT_QUOTES); $str = preg_replace('/`([^`]*)`/', '<tt>\\1</tt>', $str); return $str; }
php
public static function decorateTT($str) { $str = htmlspecialchars($str, ENT_QUOTES); $str = preg_replace('/`([^`]*)`/', '<tt>\\1</tt>', $str); return $str; }
[ "public", "static", "function", "decorateTT", "(", "$", "str", ")", "{", "$", "str", "=", "htmlspecialchars", "(", "$", "str", ",", "ENT_QUOTES", ")", ";", "$", "str", "=", "preg_replace", "(", "'/`([^`]*)`/'", ",", "'<tt>\\\\1</tt>'", ",", "$", "str", "...
Transforms plain text to HTML. Plot twist: text between backticks (`) is wrapped in a <tt> element. @param string $str Input string. Treated as plain text. @return string The resulting HTML
[ "Transforms", "plain", "text", "to", "HTML", ".", "Plot", "twist", ":", "text", "between", "backticks", "(", ")", "is", "wrapped", "in", "a", "<tt", ">", "element", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Helpers/Html.php#L56-L62
bolt/bolt
src/Helpers/Html.php
Html.isURL
public static function isURL($str) { $pattern = '~^(?:\b[a-z\d.-]+://[^<>\s]+|\b(?:(?:(?:[^\s!@#$%^&*()_=+[\]{}\|;:\'",.<>/?]+)\.)+(?:ac|ad|aero|ae|af|ag|ai|al|am|an|ao|aq|arpa|ar|asia|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|biz|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|cat|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|coop|co...
php
public static function isURL($str) { $pattern = '~^(?:\b[a-z\d.-]+://[^<>\s]+|\b(?:(?:(?:[^\s!@#$%^&*()_=+[\]{}\|;:\'",.<>/?]+)\.)+(?:ac|ad|aero|ae|af|ag|ai|al|am|an|ao|aq|arpa|ar|asia|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|biz|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|cat|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|coop|co...
[ "public", "static", "function", "isURL", "(", "$", "str", ")", "{", "$", "pattern", "=", "'~^(?:\\b[a-z\\d.-]+://[^<>\\s]+|\\b(?:(?:(?:[^\\s!@#$%^&*()_=+[\\]{}\\|;:\\'\",.<>/?]+)\\.)+(?:ac|ad|aero|ae|af|ag|ai|al|am|an|ao|aq|arpa|ar|asia|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|biz|bi|bj|bm|bn|...
Check if a given string looks like it could be a URL, with or without the protocol. @see https://mathiasbynens.be/demo/url-regex @param string $str @return bool
[ "Check", "if", "a", "given", "string", "looks", "like", "it", "could", "be", "a", "URL", "with", "or", "without", "the", "protocol", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Helpers/Html.php#L73-L83
bolt/bolt
src/Helpers/Html.php
Html.addScheme
public static function addScheme($url, $scheme = 'http://') { $url = parse_url($url, PHP_URL_SCHEME) === null ? $scheme . $url : $url; return $url; }
php
public static function addScheme($url, $scheme = 'http://') { $url = parse_url($url, PHP_URL_SCHEME) === null ? $scheme . $url : $url; return $url; }
[ "public", "static", "function", "addScheme", "(", "$", "url", ",", "$", "scheme", "=", "'http://'", ")", "{", "$", "url", "=", "parse_url", "(", "$", "url", ",", "PHP_URL_SCHEME", ")", "===", "null", "?", "$", "scheme", ".", "$", "url", ":", "$", "...
Add 'http://' to a link, if it has no protocol already. @param string $url @param string $scheme @return string
[ "Add", "http", ":", "//", "to", "a", "link", "if", "it", "has", "no", "protocol", "already", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Helpers/Html.php#L93-L98
bolt/bolt
src/Helpers/Html.php
Html.providerLink
public static function providerLink($providedby) { // If nothing is provided, we don't make a link. if (empty($providedby) || !is_array($providedby)) { return ''; } // If we forgot the second element in the array, substitute the first for it. if (empty($providedb...
php
public static function providerLink($providedby) { // If nothing is provided, we don't make a link. if (empty($providedby) || !is_array($providedby)) { return ''; } // If we forgot the second element in the array, substitute the first for it. if (empty($providedb...
[ "public", "static", "function", "providerLink", "(", "$", "providedby", ")", "{", "// If nothing is provided, we don't make a link.", "if", "(", "empty", "(", "$", "providedby", ")", "||", "!", "is_array", "(", "$", "providedby", ")", ")", "{", "return", "''", ...
Create 'provider' link, as used in the footer, to link to either an email address or website URL. @param array $providedby @return string
[ "Create", "provider", "link", "as", "used", "in", "the", "footer", "to", "link", "to", "either", "an", "email", "address", "or", "website", "URL", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Helpers/Html.php#L108-L140
bolt/bolt
src/Composer/Script/DirectoryConfigurator.php
DirectoryConfigurator.fromEvent
public static function fromEvent(Event $event) { $io = NutStyle::fromComposer($event->getIO()); $options = Options::fromEvent($event); return new static($io, $options); }
php
public static function fromEvent(Event $event) { $io = NutStyle::fromComposer($event->getIO()); $options = Options::fromEvent($event); return new static($io, $options); }
[ "public", "static", "function", "fromEvent", "(", "Event", "$", "event", ")", "{", "$", "io", "=", "NutStyle", "::", "fromComposer", "(", "$", "event", "->", "getIO", "(", ")", ")", ";", "$", "options", "=", "Options", "::", "fromEvent", "(", "$", "e...
Create from a Composer event object. @param Event $event @return DirectoryConfigurator
[ "Create", "from", "a", "Composer", "event", "object", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/Script/DirectoryConfigurator.php#L69-L75
bolt/bolt
src/Composer/Script/DirectoryConfigurator.php
DirectoryConfigurator.configureDirs
private function configureDirs() { // Configure dirs from environment variables and composer extra values. foreach ($this->resolver->names() as $name) { $default = $this->resolver->raw($name); $path = $this->options->get($name . '-dir', $default); if ($path !== $d...
php
private function configureDirs() { // Configure dirs from environment variables and composer extra values. foreach ($this->resolver->names() as $name) { $default = $this->resolver->raw($name); $path = $this->options->get($name . '-dir', $default); if ($path !== $d...
[ "private", "function", "configureDirs", "(", ")", "{", "// Configure dirs from environment variables and composer extra values.", "foreach", "(", "$", "this", "->", "resolver", "->", "names", "(", ")", "as", "$", "name", ")", "{", "$", "default", "=", "$", "this",...
Configure dirs from env, composer extra values, and via user input.
[ "Configure", "dirs", "from", "env", "composer", "extra", "values", "and", "via", "user", "input", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/Script/DirectoryConfigurator.php#L94-L113
bolt/bolt
src/Composer/Script/DirectoryConfigurator.php
DirectoryConfigurator.writeYamlConfig
private function writeYamlConfig() { $customized = []; foreach ($this->resolver->names() as $name) { $raw = $this->resolver->raw($name); if ($raw !== $this->defaults->raw($name)) { $customized[$name] = $raw; } } if (!$customized)...
php
private function writeYamlConfig() { $customized = []; foreach ($this->resolver->names() as $name) { $raw = $this->resolver->raw($name); if ($raw !== $this->defaults->raw($name)) { $customized[$name] = $raw; } } if (!$customized)...
[ "private", "function", "writeYamlConfig", "(", ")", "{", "$", "customized", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "resolver", "->", "names", "(", ")", "as", "$", "name", ")", "{", "$", "raw", "=", "$", "this", "->", "resolver", "->...
Writes the .bolt.yml file if paths are not the default.
[ "Writes", "the", ".", "bolt", ".", "yml", "file", "if", "paths", "are", "not", "the", "default", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/Script/DirectoryConfigurator.php#L118-L140
bolt/bolt
src/Composer/Script/DirectoryConfigurator.php
DirectoryConfigurator.moveSkeletonDirs
private function moveSkeletonDirs() { // Sort paths based on their dependencies $pathNames = (new PathDependencySorter($this->resolver))->getSortedNames(); foreach ($pathNames as $name) { $this->moveSkeletonDir($name); } }
php
private function moveSkeletonDirs() { // Sort paths based on their dependencies $pathNames = (new PathDependencySorter($this->resolver))->getSortedNames(); foreach ($pathNames as $name) { $this->moveSkeletonDir($name); } }
[ "private", "function", "moveSkeletonDirs", "(", ")", "{", "// Sort paths based on their dependencies", "$", "pathNames", "=", "(", "new", "PathDependencySorter", "(", "$", "this", "->", "resolver", ")", ")", "->", "getSortedNames", "(", ")", ";", "foreach", "(", ...
Move dirs from skeleton to match given paths.
[ "Move", "dirs", "from", "skeleton", "to", "match", "given", "paths", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/Script/DirectoryConfigurator.php#L145-L153
bolt/bolt
src/Composer/Script/DirectoryConfigurator.php
DirectoryConfigurator.moveSkeletonDir
private function moveSkeletonDir($name) { $root = $this->resolver->resolve('root'); $target = $this->resolver->resolve($name); $target = Path::makeRelative($target, $root); $origin = $this->defaults->resolve($name); $origin = Path::makeRelative($origin, $root); // N...
php
private function moveSkeletonDir($name) { $root = $this->resolver->resolve('root'); $target = $this->resolver->resolve($name); $target = Path::makeRelative($target, $root); $origin = $this->defaults->resolve($name); $origin = Path::makeRelative($origin, $root); // N...
[ "private", "function", "moveSkeletonDir", "(", "$", "name", ")", "{", "$", "root", "=", "$", "this", "->", "resolver", "->", "resolve", "(", "'root'", ")", ";", "$", "target", "=", "$", "this", "->", "resolver", "->", "resolve", "(", "$", "name", ")"...
Move given dir from skeleton to match PathResolver setting if needed. @param string $name
[ "Move", "given", "dir", "from", "skeleton", "to", "match", "PathResolver", "setting", "if", "needed", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/Script/DirectoryConfigurator.php#L160-L194
bolt/bolt
src/Composer/Script/DirectoryConfigurator.php
DirectoryConfigurator.updatePermissions
private function updatePermissions() { $pathNames = $this->resolver->names(); // These should be moved to PathResolver paths eventually. $pathNames[] = '%web%/extensions'; $pathNames[] = '%web%/thumbs'; $dirMode = $this->options->getDirMode(); foreach ($pathNames as ...
php
private function updatePermissions() { $pathNames = $this->resolver->names(); // These should be moved to PathResolver paths eventually. $pathNames[] = '%web%/extensions'; $pathNames[] = '%web%/thumbs'; $dirMode = $this->options->getDirMode(); foreach ($pathNames as ...
[ "private", "function", "updatePermissions", "(", ")", "{", "$", "pathNames", "=", "$", "this", "->", "resolver", "->", "names", "(", ")", ";", "// These should be moved to PathResolver paths eventually.", "$", "pathNames", "[", "]", "=", "'%web%/extensions'", ";", ...
Update all path resolver directories permissions.
[ "Update", "all", "path", "resolver", "directories", "permissions", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/Script/DirectoryConfigurator.php#L199-L214
bolt/bolt
src/Provider/ValidatorServiceProvider.php
ValidatorServiceProvider.register
public function register(Application $app) { parent::register($app); $app['validator.mapping.class_metadata_factory'] = $app->share(function ($app) { return new LazyLoadingMetadataFactory(new StaticMethodLoader(), new DoctrineCache($app['cache'])); }); }
php
public function register(Application $app) { parent::register($app); $app['validator.mapping.class_metadata_factory'] = $app->share(function ($app) { return new LazyLoadingMetadataFactory(new StaticMethodLoader(), new DoctrineCache($app['cache'])); }); }
[ "public", "function", "register", "(", "Application", "$", "app", ")", "{", "parent", "::", "register", "(", "$", "app", ")", ";", "$", "app", "[", "'validator.mapping.class_metadata_factory'", "]", "=", "$", "app", "->", "share", "(", "function", "(", "$"...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Provider/ValidatorServiceProvider.php#L21-L28
bolt/bolt
src/Filesystem/Plugin/Authorized.php
Authorized.handle
public function handle($path) { $file = $this->filesystem->getFile($path); return $this->filePermissions->authorized($file->getMountPoint(), $file->getPath()); }
php
public function handle($path) { $file = $this->filesystem->getFile($path); return $this->filePermissions->authorized($file->getMountPoint(), $file->getPath()); }
[ "public", "function", "handle", "(", "$", "path", ")", "{", "$", "file", "=", "$", "this", "->", "filesystem", "->", "getFile", "(", "$", "path", ")", ";", "return", "$", "this", "->", "filePermissions", "->", "authorized", "(", "$", "file", "->", "g...
Returns whether you are authorized to do something with a file or directory. @param string $path @return bool
[ "Returns", "whether", "you", "are", "authorized", "to", "do", "something", "with", "a", "file", "or", "directory", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Filesystem/Plugin/Authorized.php#L45-L50
bolt/bolt
src/Routing/RootControllerCollection.php
RootControllerCollection.flush
public function flush($prefix = '') { $event = new MountEvent($this->app, $this); $this->dispatcher->dispatch(ControllerEvents::MOUNT, $event); return parent::flush($prefix); }
php
public function flush($prefix = '') { $event = new MountEvent($this->app, $this); $this->dispatcher->dispatch(ControllerEvents::MOUNT, $event); return parent::flush($prefix); }
[ "public", "function", "flush", "(", "$", "prefix", "=", "''", ")", "{", "$", "event", "=", "new", "MountEvent", "(", "$", "this", "->", "app", ",", "$", "this", ")", ";", "$", "this", "->", "dispatcher", "->", "dispatch", "(", "ControllerEvents", "::...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Routing/RootControllerCollection.php#L44-L51
bolt/bolt
src/Storage/Entity/ContentSearchTrait.php
ContentSearchTrait.weighSearchResult
public function weighSearchResult($query) { static $contenttypeFields = null; static $contenttypeTaxonomies = null; $ct = $this->contenttype['slug']; if (($contenttypeFields === null) || (!isset($contenttypeFields[$ct]))) { // Should run only once per contenttype (e.g. s...
php
public function weighSearchResult($query) { static $contenttypeFields = null; static $contenttypeTaxonomies = null; $ct = $this->contenttype['slug']; if (($contenttypeFields === null) || (!isset($contenttypeFields[$ct]))) { // Should run only once per contenttype (e.g. s...
[ "public", "function", "weighSearchResult", "(", "$", "query", ")", "{", "static", "$", "contenttypeFields", "=", "null", ";", "static", "$", "contenttypeTaxonomies", "=", "null", ";", "$", "ct", "=", "$", "this", "->", "contenttype", "[", "'slug'", "]", ";...
Weigh this content against a query. The query is assumed to be in a format as returned by decode Storage->decodeSearchQuery(). @param array $query Query to weigh against
[ "Weigh", "this", "content", "against", "a", "query", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Entity/ContentSearchTrait.php#L41-L74
bolt/bolt
src/Storage/Entity/ContentSearchTrait.php
ContentSearchTrait.getFieldWeights
private function getFieldWeights() { // This could be more configurable // (see also Storage->searchSingleContentType) $searchableTypes = ['text', 'textarea', 'html', 'markdown']; $fields = []; $slugFields = []; // The field(s) that are used by the slug need to be b...
php
private function getFieldWeights() { // This could be more configurable // (see also Storage->searchSingleContentType) $searchableTypes = ['text', 'textarea', 'html', 'markdown']; $fields = []; $slugFields = []; // The field(s) that are used by the slug need to be b...
[ "private", "function", "getFieldWeights", "(", ")", "{", "// This could be more configurable", "// (see also Storage->searchSingleContentType)", "$", "searchableTypes", "=", "[", "'text'", ",", "'textarea'", ",", "'html'", ",", "'markdown'", "]", ";", "$", "fields", "="...
Calculate the default field weights. This gives more weight to the 'slug pointer fields'. @return array
[ "Calculate", "the", "default", "field", "weights", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Entity/ContentSearchTrait.php#L83-L108
bolt/bolt
src/Storage/Entity/ContentSearchTrait.php
ContentSearchTrait.getTaxonomyWeights
private function getTaxonomyWeights() { $taxonomies = []; if (isset($this->contenttype['taxonomy'])) { foreach ($this->contenttype['taxonomy'] as $key) { if ($this->app['config']->get('taxonomy/' . $key . '/behaves_like') === 'tags') { $taxonomies[$ke...
php
private function getTaxonomyWeights() { $taxonomies = []; if (isset($this->contenttype['taxonomy'])) { foreach ($this->contenttype['taxonomy'] as $key) { if ($this->app['config']->get('taxonomy/' . $key . '/behaves_like') === 'tags') { $taxonomies[$ke...
[ "private", "function", "getTaxonomyWeights", "(", ")", "{", "$", "taxonomies", "=", "[", "]", ";", "if", "(", "isset", "(", "$", "this", "->", "contenttype", "[", "'taxonomy'", "]", ")", ")", "{", "foreach", "(", "$", "this", "->", "contenttype", "[", ...
Calculate the default taxonomy weights. Adds weights to taxonomies that behave like tags. @return array
[ "Calculate", "the", "default", "taxonomy", "weights", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Entity/ContentSearchTrait.php#L117-L130
bolt/bolt
src/Storage/Entity/ContentSearchTrait.php
ContentSearchTrait.weighQueryText
private function weighQueryText($subject, $complete, array $words, $max) { $lowSubject = mb_strtolower(trim($subject)); if ($lowSubject === $complete) { // a complete match is 100% of the maximum return round((100 / 100) * $max); } if (strpos($lowSubject, $co...
php
private function weighQueryText($subject, $complete, array $words, $max) { $lowSubject = mb_strtolower(trim($subject)); if ($lowSubject === $complete) { // a complete match is 100% of the maximum return round((100 / 100) * $max); } if (strpos($lowSubject, $co...
[ "private", "function", "weighQueryText", "(", "$", "subject", ",", "$", "complete", ",", "array", "$", "words", ",", "$", "max", ")", "{", "$", "lowSubject", "=", "mb_strtolower", "(", "trim", "(", "$", "subject", ")", ")", ";", "if", "(", "$", "lowS...
Weight a text part relative to some other part. @param string $subject the subject to search in @param string $complete the complete search term (lowercased) @param array $words all the individual search terms (lowercased) @param int $max maximum number of points to return @return int The weight
[ "Weight", "a", "text", "part", "relative", "to", "some", "other", "part", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Entity/ContentSearchTrait.php#L142-L169
bolt/bolt
src/Nut/Helper/Terminal.php
Terminal.getWidth
public static function getWidth() { $width = getenv('COLUMNS'); if ($width !== false) { return (int) trim($width); } static::updateDimensions(); return static::$width; }
php
public static function getWidth() { $width = getenv('COLUMNS'); if ($width !== false) { return (int) trim($width); } static::updateDimensions(); return static::$width; }
[ "public", "static", "function", "getWidth", "(", ")", "{", "$", "width", "=", "getenv", "(", "'COLUMNS'", ")", ";", "if", "(", "$", "width", "!==", "false", ")", "{", "return", "(", "int", ")", "trim", "(", "$", "width", ")", ";", "}", "static", ...
Returns the Terminal's width. @return int
[ "Returns", "the", "Terminal", "s", "width", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/Helper/Terminal.php#L30-L40
bolt/bolt
src/Nut/Helper/Terminal.php
Terminal.getHeight
public static function getHeight() { $height = getenv('LINES'); if ($height !== false) { return (int) trim($height); } static::updateDimensions(); return static::$height; }
php
public static function getHeight() { $height = getenv('LINES'); if ($height !== false) { return (int) trim($height); } static::updateDimensions(); return static::$height; }
[ "public", "static", "function", "getHeight", "(", ")", "{", "$", "height", "=", "getenv", "(", "'LINES'", ")", ";", "if", "(", "$", "height", "!==", "false", ")", "{", "return", "(", "int", ")", "trim", "(", "$", "height", ")", ";", "}", "static", ...
Returns the Terminal's height. @return int
[ "Returns", "the", "Terminal", "s", "height", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/Helper/Terminal.php#L47-L57
bolt/bolt
src/Nut/Helper/Terminal.php
Terminal.checkPcntl
private static function checkPcntl() { if (static::$pcntlEnabled === null) { if (!extension_loaded('pcntl')) { static::$pcntlEnabled = false; return true; } static::$pcntlEnabled = true; if (version_compare(PHP_VERSION, '7.1',...
php
private static function checkPcntl() { if (static::$pcntlEnabled === null) { if (!extension_loaded('pcntl')) { static::$pcntlEnabled = false; return true; } static::$pcntlEnabled = true; if (version_compare(PHP_VERSION, '7.1',...
[ "private", "static", "function", "checkPcntl", "(", ")", "{", "if", "(", "static", "::", "$", "pcntlEnabled", "===", "null", ")", "{", "if", "(", "!", "extension_loaded", "(", "'pcntl'", ")", ")", "{", "static", "::", "$", "pcntlEnabled", "=", "false", ...
Initializes and checks if we have received a SIGWINCH signal. @return bool whether dimensions should be fetched
[ "Initializes", "and", "checks", "if", "we", "have", "received", "a", "SIGWINCH", "signal", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/Helper/Terminal.php#L76-L105
bolt/bolt
src/Nut/Helper/Terminal.php
Terminal.fetchDimensions
private static function fetchDimensions() { if (DIRECTORY_SEPARATOR === '\\') { $dimensions = static::getAnsiCon(); if (!$dimensions) { $dimensions = static::getConsoleMode(); } } else { $dimensions = static::getSttyColumns(); }...
php
private static function fetchDimensions() { if (DIRECTORY_SEPARATOR === '\\') { $dimensions = static::getAnsiCon(); if (!$dimensions) { $dimensions = static::getConsoleMode(); } } else { $dimensions = static::getSttyColumns(); }...
[ "private", "static", "function", "fetchDimensions", "(", ")", "{", "if", "(", "DIRECTORY_SEPARATOR", "===", "'\\\\'", ")", "{", "$", "dimensions", "=", "static", "::", "getAnsiCon", "(", ")", ";", "if", "(", "!", "$", "dimensions", ")", "{", "$", "dimens...
Fetch dimensions based on platform.
[ "Fetch", "dimensions", "based", "on", "platform", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/Helper/Terminal.php#L110-L129
bolt/bolt
src/Nut/Helper/Terminal.php
Terminal.getAnsiCon
private static function getAnsiCon() { if (preg_match('/^(\d+)x(\d+)(?: \((\d+)x(\d+)\))?$/', trim(getenv('ANSICON')), $matches)) { // extract [w, H] from "wxh (WxH)" // or [w, h] from "wxh" return [ (int) $matches[1], isset($matches[4]) ? ...
php
private static function getAnsiCon() { if (preg_match('/^(\d+)x(\d+)(?: \((\d+)x(\d+)\))?$/', trim(getenv('ANSICON')), $matches)) { // extract [w, H] from "wxh (WxH)" // or [w, h] from "wxh" return [ (int) $matches[1], isset($matches[4]) ? ...
[ "private", "static", "function", "getAnsiCon", "(", ")", "{", "if", "(", "preg_match", "(", "'/^(\\d+)x(\\d+)(?: \\((\\d+)x(\\d+)\\))?$/'", ",", "trim", "(", "getenv", "(", "'ANSICON'", ")", ")", ",", "$", "matches", ")", ")", "{", "// extract [w, H] from \"wxh (W...
Parse width & height from ANSICON env var. @return int[]
[ "Parse", "width", "&", "height", "from", "ANSICON", "env", "var", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/Helper/Terminal.php#L136-L148
bolt/bolt
src/Nut/Helper/Terminal.php
Terminal.getConsoleMode
private static function getConsoleMode() { $info = static::runCommand('mode CON'); if ($info && preg_match('/--------+\r?\n.+?(\d+)\r?\n.+?(\d+)\r?\n/', $info, $matches)) { // extract [w, h] from "wxh" return [(int) $matches[2], (int) $matches[1]]; } return ...
php
private static function getConsoleMode() { $info = static::runCommand('mode CON'); if ($info && preg_match('/--------+\r?\n.+?(\d+)\r?\n.+?(\d+)\r?\n/', $info, $matches)) { // extract [w, h] from "wxh" return [(int) $matches[2], (int) $matches[1]]; } return ...
[ "private", "static", "function", "getConsoleMode", "(", ")", "{", "$", "info", "=", "static", "::", "runCommand", "(", "'mode CON'", ")", ";", "if", "(", "$", "info", "&&", "preg_match", "(", "'/--------+\\r?\\n.+?(\\d+)\\r?\\n.+?(\\d+)\\r?\\n/'", ",", "$", "inf...
Run console mode command and parse output to width & height. @return int[]
[ "Run", "console", "mode", "command", "and", "parse", "output", "to", "width", "&", "height", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/Helper/Terminal.php#L155-L165
bolt/bolt
src/Nut/Helper/Terminal.php
Terminal.getSttyColumns
private static function getSttyColumns() { $info = static::runCommand('stty -a | grep columns'); if ($info && preg_match('/rows.(\d+);.columns.(\d+);/i', $info, $matches)) { // extract [w, h] from "rows h; columns w;" } elseif ($info && preg_match('/;.(\d+).rows;.(\d+).columns/i...
php
private static function getSttyColumns() { $info = static::runCommand('stty -a | grep columns'); if ($info && preg_match('/rows.(\d+);.columns.(\d+);/i', $info, $matches)) { // extract [w, h] from "rows h; columns w;" } elseif ($info && preg_match('/;.(\d+).rows;.(\d+).columns/i...
[ "private", "static", "function", "getSttyColumns", "(", ")", "{", "$", "info", "=", "static", "::", "runCommand", "(", "'stty -a | grep columns'", ")", ";", "if", "(", "$", "info", "&&", "preg_match", "(", "'/rows.(\\d+);.columns.(\\d+);/i'", ",", "$", "info", ...
Run stty command and parse output to width & height. @return int[]
[ "Run", "stty", "command", "and", "parse", "output", "to", "width", "&", "height", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/Helper/Terminal.php#L172-L185
bolt/bolt
src/Nut/Helper/Terminal.php
Terminal.runCommand
private static function runCommand($command) { if (!function_exists('proc_open')) { return null; } $descriptorSpec = [ 1 => ['pipe', 'w'], 2 => ['pipe', 'w'], ]; $process = proc_open($command, $descriptorSpec, $pipes, null, null, ['suppres...
php
private static function runCommand($command) { if (!function_exists('proc_open')) { return null; } $descriptorSpec = [ 1 => ['pipe', 'w'], 2 => ['pipe', 'w'], ]; $process = proc_open($command, $descriptorSpec, $pipes, null, null, ['suppres...
[ "private", "static", "function", "runCommand", "(", "$", "command", ")", "{", "if", "(", "!", "function_exists", "(", "'proc_open'", ")", ")", "{", "return", "null", ";", "}", "$", "descriptorSpec", "=", "[", "1", "=>", "[", "'pipe'", ",", "'w'", "]", ...
Run a command. @param string $command @return string|null
[ "Run", "a", "command", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/Helper/Terminal.php#L194-L215
bolt/bolt
src/Nut/UsersList.php
UsersList.execute
protected function execute(InputInterface $input, OutputInterface $output) { /** @var \Bolt\Storage\Repository\UsersRepository $repo */ $repo = $this->app['storage']->getRepository(Entity\Users::class); $userEntities = $repo->findAll(); if ($userEntities === false) { $th...
php
protected function execute(InputInterface $input, OutputInterface $output) { /** @var \Bolt\Storage\Repository\UsersRepository $repo */ $repo = $this->app['storage']->getRepository(Entity\Users::class); $userEntities = $repo->findAll(); if ($userEntities === false) { $th...
[ "protected", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "/** @var \\Bolt\\Storage\\Repository\\UsersRepository $repo */", "$", "repo", "=", "$", "this", "->", "app", "[", "'storage'", "]", "->", "getR...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/UsersList.php#L29-L61
bolt/bolt
src/Extension/ControllerMountTrait.php
ControllerMountTrait.onMountControllers
final public function onMountControllers(MountEvent $event) { foreach ($this->registerFrontendControllers() as $prefix => $collection) { $event->mount($prefix, $collection); } $app = $this->getContainer(); $backendPrefix = $app['controller.backend.mount_prefix']; ...
php
final public function onMountControllers(MountEvent $event) { foreach ($this->registerFrontendControllers() as $prefix => $collection) { $event->mount($prefix, $collection); } $app = $this->getContainer(); $backendPrefix = $app['controller.backend.mount_prefix']; ...
[ "final", "public", "function", "onMountControllers", "(", "MountEvent", "$", "event", ")", "{", "foreach", "(", "$", "this", "->", "registerFrontendControllers", "(", ")", "as", "$", "prefix", "=>", "$", "collection", ")", "{", "$", "event", "->", "mount", ...
Mounts the controllers defined in registerControllers(). @param MountEvent $event @internal
[ "Mounts", "the", "controllers", "defined", "in", "registerControllers", "()", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Extension/ControllerMountTrait.php#L58-L69
bolt/bolt
src/Form/FormType/PrefillType.php
PrefillType.buildForm
public function buildForm(FormBuilderInterface $builder, array $options) { $builder ->add( 'contenttypes', ChoiceType::class, [ 'choices' => $options['contenttypes'], 'multiple' => true, 'expanded' => tr...
php
public function buildForm(FormBuilderInterface $builder, array $options) { $builder ->add( 'contenttypes', ChoiceType::class, [ 'choices' => $options['contenttypes'], 'multiple' => true, 'expanded' => tr...
[ "public", "function", "buildForm", "(", "FormBuilderInterface", "$", "builder", ",", "array", "$", "options", ")", "{", "$", "builder", "->", "add", "(", "'contenttypes'", ",", "ChoiceType", "::", "class", ",", "[", "'choices'", "=>", "$", "options", "[", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Form/FormType/PrefillType.php#L22-L39
bolt/bolt
src/Menu/MenuBuilder.php
MenuBuilder.menuBuilder
private function menuBuilder(array $menu) { foreach ($menu as $key => $item) { $menu[$key] = $this->menuHelper($item); if (isset($item['submenu'])) { $menu[$key]['submenu'] = $this->menuBuilder($item['submenu']); } } return $menu; }
php
private function menuBuilder(array $menu) { foreach ($menu as $key => $item) { $menu[$key] = $this->menuHelper($item); if (isset($item['submenu'])) { $menu[$key]['submenu'] = $this->menuBuilder($item['submenu']); } } return $menu; }
[ "private", "function", "menuBuilder", "(", "array", "$", "menu", ")", "{", "foreach", "(", "$", "menu", "as", "$", "key", "=>", "$", "item", ")", "{", "$", "menu", "[", "$", "key", "]", "=", "$", "this", "->", "menuHelper", "(", "$", "item", ")",...
Recursively scans the passed array to ensure everything gets the menuHelper() treatment. @param array $menu @return array
[ "Recursively", "scans", "the", "passed", "array", "to", "ensure", "everything", "gets", "the", "menuHelper", "()", "treatment", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Menu/MenuBuilder.php#L72-L82
bolt/bolt
src/Menu/MenuBuilder.php
MenuBuilder.menuHelper
private function menuHelper($item) { // recurse into submenus if (isset($item['submenu']) && is_array($item['submenu'])) { $item['submenu'] = $this->menuHelper($item['submenu']); } if (isset($item['route'])) { $item['link'] = $this->resolveRouteToLink($item);...
php
private function menuHelper($item) { // recurse into submenus if (isset($item['submenu']) && is_array($item['submenu'])) { $item['submenu'] = $this->menuHelper($item['submenu']); } if (isset($item['route'])) { $item['link'] = $this->resolveRouteToLink($item);...
[ "private", "function", "menuHelper", "(", "$", "item", ")", "{", "// recurse into submenus", "if", "(", "isset", "(", "$", "item", "[", "'submenu'", "]", ")", "&&", "is_array", "(", "$", "item", "[", "'submenu'", "]", ")", ")", "{", "$", "item", "[", ...
Updates a menu item to have at least a 'link' key. @param array $item @return array Keys 'link' and possibly 'label', 'title' and 'path'
[ "Updates", "a", "menu", "item", "to", "have", "at", "least", "a", "link", "key", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Menu/MenuBuilder.php#L91-L105
bolt/bolt
src/Menu/MenuBuilder.php
MenuBuilder.resolveRouteToLink
private function resolveRouteToLink(array $item) { $param = !empty($item['param']) ? $item['param'] : []; if (isset($item['add'])) { Deprecated::warn('Menu item property "add"', null, 'Use "#" under "param" instead.'); $add = $item['add']; if (!empty($add) && $a...
php
private function resolveRouteToLink(array $item) { $param = !empty($item['param']) ? $item['param'] : []; if (isset($item['add'])) { Deprecated::warn('Menu item property "add"', null, 'Use "#" under "param" instead.'); $add = $item['add']; if (!empty($add) && $a...
[ "private", "function", "resolveRouteToLink", "(", "array", "$", "item", ")", "{", "$", "param", "=", "!", "empty", "(", "$", "item", "[", "'param'", "]", ")", "?", "$", "item", "[", "'param'", "]", ":", "[", "]", ";", "if", "(", "isset", "(", "$"...
Resolve the route to a generated url. @param array $item @return string
[ "Resolve", "the", "route", "to", "a", "generated", "url", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Menu/MenuBuilder.php#L114-L132
bolt/bolt
src/Menu/MenuBuilder.php
MenuBuilder.resolvePathToContent
private function resolvePathToContent(array $item) { if ($item['path'] === 'homepage') { $item['link'] = $this->app['url_generator']->generate('homepage'); return $item; } // We have a mistakenly placed URL, allow it but log it. if (preg_match('#^(https?://|...
php
private function resolvePathToContent(array $item) { if ($item['path'] === 'homepage') { $item['link'] = $this->app['url_generator']->generate('homepage'); return $item; } // We have a mistakenly placed URL, allow it but log it. if (preg_match('#^(https?://|...
[ "private", "function", "resolvePathToContent", "(", "array", "$", "item", ")", "{", "if", "(", "$", "item", "[", "'path'", "]", "===", "'homepage'", ")", "{", "$", "item", "[", "'link'", "]", "=", "$", "this", "->", "app", "[", "'url_generator'", "]", ...
Determine the type of path we have. @param array $item @return array
[ "Determine", "the", "type", "of", "path", "we", "have", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Menu/MenuBuilder.php#L141-L199
bolt/bolt
src/Menu/MenuBuilder.php
MenuBuilder.populateItemFromRecord
private function populateItemFromRecord(array $item, $path) { /** @var \Bolt\Legacy\Storage $engine */ $engine = $this->app[$this->storageAccessor]; $content = $engine->getContent($path, ['hydrate' => false]); if ($content) { if (empty($item['label'])) { ...
php
private function populateItemFromRecord(array $item, $path) { /** @var \Bolt\Legacy\Storage $engine */ $engine = $this->app[$this->storageAccessor]; $content = $engine->getContent($path, ['hydrate' => false]); if ($content) { if (empty($item['label'])) { ...
[ "private", "function", "populateItemFromRecord", "(", "array", "$", "item", ",", "$", "path", ")", "{", "/** @var \\Bolt\\Legacy\\Storage $engine */", "$", "engine", "=", "$", "this", "->", "app", "[", "$", "this", "->", "storageAccessor", "]", ";", "$", "cont...
Populate a single menu item. @param array $item @param string $path @return string
[ "Populate", "a", "single", "menu", "item", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Menu/MenuBuilder.php#L209-L228
bolt/bolt
src/Twig/Extension/RecordExtension.php
RecordExtension.getFunctions
public function getFunctions() { $safe = ['is_safe' => ['html']]; $env = ['needs_environment' => true]; $deprecated = ['deprecated' => true]; return [ // @codingStandardsIgnoreStart new TwigFunction('current', [Runtime\RecordRuntime::class, 'current']),...
php
public function getFunctions() { $safe = ['is_safe' => ['html']]; $env = ['needs_environment' => true]; $deprecated = ['deprecated' => true]; return [ // @codingStandardsIgnoreStart new TwigFunction('current', [Runtime\RecordRuntime::class, 'current']),...
[ "public", "function", "getFunctions", "(", ")", "{", "$", "safe", "=", "[", "'is_safe'", "=>", "[", "'html'", "]", "]", ";", "$", "env", "=", "[", "'needs_environment'", "=>", "true", "]", ";", "$", "deprecated", "=", "[", "'deprecated'", "=>", "true",...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/Extension/RecordExtension.php#L22-L41
bolt/bolt
src/Twig/Extension/RecordExtension.php
RecordExtension.getFilters
public function getFilters() { $safe = ['is_safe' => ['html']]; $deprecated = ['deprecated' => true]; return [ // @codingStandardsIgnoreStart new TwigFilter('current', [Runtime\RecordRuntime::class, 'current']), new TwigFilter('excerpt', [Runtime\...
php
public function getFilters() { $safe = ['is_safe' => ['html']]; $deprecated = ['deprecated' => true]; return [ // @codingStandardsIgnoreStart new TwigFilter('current', [Runtime\RecordRuntime::class, 'current']), new TwigFilter('excerpt', [Runtime\...
[ "public", "function", "getFilters", "(", ")", "{", "$", "safe", "=", "[", "'is_safe'", "=>", "[", "'html'", "]", "]", ";", "$", "deprecated", "=", "[", "'deprecated'", "=>", "true", "]", ";", "return", "[", "// @codingStandardsIgnoreStart", "new", "TwigFil...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/Extension/RecordExtension.php#L46-L63
bolt/bolt
src/Composer/Script/DirectorySyncer.php
DirectorySyncer.fromEvent
public static function fromEvent(Event $event) { $vendorDir = $event->getComposer()->getConfig()->get('vendor-dir'); $boltDir = $vendorDir . '/bolt/bolt'; if (file_exists($boltDir)) { /** * Use bootstrap.php to ensure autoloader and correct root path is used. ...
php
public static function fromEvent(Event $event) { $vendorDir = $event->getComposer()->getConfig()->get('vendor-dir'); $boltDir = $vendorDir . '/bolt/bolt'; if (file_exists($boltDir)) { /** * Use bootstrap.php to ensure autoloader and correct root path is used. ...
[ "public", "static", "function", "fromEvent", "(", "Event", "$", "event", ")", "{", "$", "vendorDir", "=", "$", "event", "->", "getComposer", "(", ")", "->", "getConfig", "(", ")", "->", "get", "(", "'vendor-dir'", ")", ";", "$", "boltDir", "=", "$", ...
Create from Composer Event. @param Event $event @return DirectorySyncer
[ "Create", "from", "Composer", "Event", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/Script/DirectorySyncer.php#L62-L88
bolt/bolt
src/Composer/Script/DirectorySyncer.php
DirectorySyncer.mirror
private function mirror($origin, $target, $delete = false) { $this->filesystem->mirror($origin, $target, null, ['override' => true, 'delete' => $delete]); }
php
private function mirror($origin, $target, $delete = false) { $this->filesystem->mirror($origin, $target, null, ['override' => true, 'delete' => $delete]); }
[ "private", "function", "mirror", "(", "$", "origin", ",", "$", "target", ",", "$", "delete", "=", "false", ")", "{", "$", "this", "->", "filesystem", "->", "mirror", "(", "$", "origin", ",", "$", "target", ",", "null", ",", "[", "'override'", "=>", ...
Helper to make mirror calls shorter. @param string $origin @param string $target @param bool $delete
[ "Helper", "to", "make", "mirror", "calls", "shorter", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/Script/DirectorySyncer.php#L128-L131
bolt/bolt
src/Controller/Frontend.php
Frontend.before
public function before(Request $request) { // Start the 'stopwatch' for the profiler. $this->app['stopwatch']->start('bolt.frontend.before'); // If there are no users in the users table, or the table doesn't exist. // Repair the DB, and let's add a new user. if (!$this->hasU...
php
public function before(Request $request) { // Start the 'stopwatch' for the profiler. $this->app['stopwatch']->start('bolt.frontend.before'); // If there are no users in the users table, or the table doesn't exist. // Repair the DB, and let's add a new user. if (!$this->hasU...
[ "public", "function", "before", "(", "Request", "$", "request", ")", "{", "// Start the 'stopwatch' for the profiler.", "$", "this", "->", "app", "[", "'stopwatch'", "]", "->", "start", "(", "'bolt.frontend.before'", ")", ";", "// If there are no users in the users tabl...
The default before filter for the controllers in this file. Refer to the routing.yml config file for overridding. @param Request $request The Symfony Request @return null|TemplateResponse|RedirectResponse
[ "The", "default", "before", "filter", "for", "the", "controllers", "in", "this", "file", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Frontend.php#L56-L84
bolt/bolt
src/Controller/Frontend.php
Frontend.after
public function after(Request $request, Response $response) { if ($this->session()->isStarted()) { $response->setPrivate(); } else { $sharedMaxAge = $this->getOption('general/caching/duration', 10) * 60; $response ->setPublic() ->se...
php
public function after(Request $request, Response $response) { if ($this->session()->isStarted()) { $response->setPrivate(); } else { $sharedMaxAge = $this->getOption('general/caching/duration', 10) * 60; $response ->setPublic() ->se...
[ "public", "function", "after", "(", "Request", "$", "request", ",", "Response", "$", "response", ")", "{", "if", "(", "$", "this", "->", "session", "(", ")", "->", "isStarted", "(", ")", ")", "{", "$", "response", "->", "setPrivate", "(", ")", ";", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Frontend.php#L89-L100
bolt/bolt
src/Controller/Frontend.php
Frontend.homepage
public function homepage(Request $request) { $homepage = $this->getOption('theme/homepage') ?: $this->getOption('general/homepage'); $listingParameters = $this->getListingParameters($homepage, true); $content = $this->getContent($homepage, $listingParameters); $template = $this->tem...
php
public function homepage(Request $request) { $homepage = $this->getOption('theme/homepage') ?: $this->getOption('general/homepage'); $listingParameters = $this->getListingParameters($homepage, true); $content = $this->getContent($homepage, $listingParameters); $template = $this->tem...
[ "public", "function", "homepage", "(", "Request", "$", "request", ")", "{", "$", "homepage", "=", "$", "this", "->", "getOption", "(", "'theme/homepage'", ")", "?", ":", "$", "this", "->", "getOption", "(", "'general/homepage'", ")", ";", "$", "listingPara...
Controller for the "Homepage" route. Usually the front page of the website. @param Request $request @return TemplateResponse
[ "Controller", "for", "the", "Homepage", "route", ".", "Usually", "the", "front", "page", "of", "the", "website", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Frontend.php#L109-L129
bolt/bolt
src/Controller/Frontend.php
Frontend.record
public function record(Request $request, $contenttypeslug, $slug = '') { $contenttype = $this->getContentType($contenttypeslug); // If the ContentType is 'viewless', don't show the record page. if (isset($contenttype['viewless']) && $contenttype['viewless'] === true) { $this->ab...
php
public function record(Request $request, $contenttypeslug, $slug = '') { $contenttype = $this->getContentType($contenttypeslug); // If the ContentType is 'viewless', don't show the record page. if (isset($contenttype['viewless']) && $contenttype['viewless'] === true) { $this->ab...
[ "public", "function", "record", "(", "Request", "$", "request", ",", "$", "contenttypeslug", ",", "$", "slug", "=", "''", ")", "{", "$", "contenttype", "=", "$", "this", "->", "getContentType", "(", "$", "contenttypeslug", ")", ";", "// If the ContentType is...
Controller for a single record page, like '/page/about/' or '/entry/lorum'. @param Request $request The request @param string $contenttypeslug The content type slug @param string $slug The content slug @return TemplateResponse
[ "Controller", "for", "a", "single", "record", "page", "like", "/", "page", "/", "about", "/", "or", "/", "entry", "/", "lorum", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Frontend.php#L140-L188
bolt/bolt
src/Controller/Frontend.php
Frontend.preview
public function preview(Request $request, $contenttypeslug) { if (!$request->isMethod('POST')) { throw new MethodNotAllowedHttpException(['POST'], 'This route only accepts POST requests.'); } $contenttype = $this->getContentType($contenttypeslug); $formValues = $request-...
php
public function preview(Request $request, $contenttypeslug) { if (!$request->isMethod('POST')) { throw new MethodNotAllowedHttpException(['POST'], 'This route only accepts POST requests.'); } $contenttype = $this->getContentType($contenttypeslug); $formValues = $request-...
[ "public", "function", "preview", "(", "Request", "$", "request", ",", "$", "contenttypeslug", ")", "{", "if", "(", "!", "$", "request", "->", "isMethod", "(", "'POST'", ")", ")", "{", "throw", "new", "MethodNotAllowedHttpException", "(", "[", "'POST'", "]"...
The controller for previewing a content from posted data. @param Request $request The Symfony Request @param string $contenttypeslug The content type slug @throws \Exception @return TemplateResponse
[ "The", "controller", "for", "previewing", "a", "content", "from", "posted", "data", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Frontend.php#L200-L261
bolt/bolt
src/Controller/Frontend.php
Frontend.fixBlockFieldsForPreview
private function fixBlockFieldsForPreview($record) { foreach ($record->contenttype['fields'] as $fieldSlug => $fieldSettings) { if ($fieldSettings['type'] === 'block') { $fieldValue = $this->getBlockFieldValue($record, $fieldSlug); if ($fieldValue) { ...
php
private function fixBlockFieldsForPreview($record) { foreach ($record->contenttype['fields'] as $fieldSlug => $fieldSettings) { if ($fieldSettings['type'] === 'block') { $fieldValue = $this->getBlockFieldValue($record, $fieldSlug); if ($fieldValue) { ...
[ "private", "function", "fixBlockFieldsForPreview", "(", "$", "record", ")", "{", "foreach", "(", "$", "record", "->", "contenttype", "[", "'fields'", "]", "as", "$", "fieldSlug", "=>", "$", "fieldSettings", ")", "{", "if", "(", "$", "fieldSettings", "[", "...
Helper function to prefill `block` fields with an additional `block` field per item. This is needed to make previewing content with block fields fully working.
[ "Helper", "function", "to", "prefill", "block", "fields", "with", "an", "additional", "block", "field", "per", "item", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Frontend.php#L268-L289
bolt/bolt
src/Controller/Frontend.php
Frontend.fixHTMLFieldsForPreview
private function fixHTMLFieldsForPreview($record) { foreach ($record->contenttype['fields'] as $fieldSlug => $fieldSettings) { if (in_array($fieldSettings['type'], ['html', 'text', 'textarea', 'markdown'])) { $fieldValue = new \Twig_Markup($this->getFieldValue($record, $fieldSlug...
php
private function fixHTMLFieldsForPreview($record) { foreach ($record->contenttype['fields'] as $fieldSlug => $fieldSettings) { if (in_array($fieldSettings['type'], ['html', 'text', 'textarea', 'markdown'])) { $fieldValue = new \Twig_Markup($this->getFieldValue($record, $fieldSlug...
[ "private", "function", "fixHTMLFieldsForPreview", "(", "$", "record", ")", "{", "foreach", "(", "$", "record", "->", "contenttype", "[", "'fields'", "]", "as", "$", "fieldSlug", "=>", "$", "fieldSettings", ")", "{", "if", "(", "in_array", "(", "$", "fieldS...
Helper function to make sure HTML-like fields are Twig_Markup, and image fields are an image. Like they are in a "real" page. This is needed to make previewing content with block fields fully working. See: https://github.com/bolt/bolt/issues/7753
[ "Helper", "function", "to", "make", "sure", "HTML", "-", "like", "fields", "are", "Twig_Markup", "and", "image", "fields", "are", "an", "image", ".", "Like", "they", "are", "in", "a", "real", "page", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Frontend.php#L298-L316
bolt/bolt
src/Controller/Frontend.php
Frontend.listing
public function listing(Request $request, $contenttypeslug) { $listingParameters = $this->getListingParameters($contenttypeslug); $content = $this->getContent($contenttypeslug, $listingParameters); $contenttype = $this->getContentType($contenttypeslug); $template = $this->templateCh...
php
public function listing(Request $request, $contenttypeslug) { $listingParameters = $this->getListingParameters($contenttypeslug); $content = $this->getContent($contenttypeslug, $listingParameters); $contenttype = $this->getContentType($contenttypeslug); $template = $this->templateCh...
[ "public", "function", "listing", "(", "Request", "$", "request", ",", "$", "contenttypeslug", ")", "{", "$", "listingParameters", "=", "$", "this", "->", "getListingParameters", "(", "$", "contenttypeslug", ")", ";", "$", "content", "=", "$", "this", "->", ...
The listing page controller. @param Request $request The Symfony Request @param string $contenttypeslug The content type slug @return TemplateResponse
[ "The", "listing", "page", "controller", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Frontend.php#L360-L377
bolt/bolt
src/Controller/Frontend.php
Frontend.taxonomy
public function taxonomy(Request $request, $taxonomytype, $slug) { $taxonomy = $this->app['config']->get('taxonomy/' . $taxonomytype); // No taxonomytype, no possible content. if (empty($taxonomy)) { return false; } $taxonomyslug = $taxonomy['slug']; // F...
php
public function taxonomy(Request $request, $taxonomytype, $slug) { $taxonomy = $this->app['config']->get('taxonomy/' . $taxonomytype); // No taxonomytype, no possible content. if (empty($taxonomy)) { return false; } $taxonomyslug = $taxonomy['slug']; // F...
[ "public", "function", "taxonomy", "(", "Request", "$", "request", ",", "$", "taxonomytype", ",", "$", "slug", ")", "{", "$", "taxonomy", "=", "$", "this", "->", "app", "[", "'config'", "]", "->", "get", "(", "'taxonomy/'", ".", "$", "taxonomytype", ")"...
The taxonomy listing page controller. @param Request $request The Symfony Request @param string $taxonomytype The taxonomy type slug @param string $slug The taxonomy slug @throws \Bolt\Exception\InvalidRepositoryException @return TemplateResponse|false
[ "The", "taxonomy", "listing", "page", "controller", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Frontend.php#L390-L452
bolt/bolt
src/Controller/Frontend.php
Frontend.isTaxonomyValid
protected function isTaxonomyValid($content, $slug, array $taxonomy) { if ($taxonomy['behaves_like'] === 'tags' && !$content) { return false; } $isNotTag = in_array($taxonomy['behaves_like'], ['categories', 'grouping']); $options = isset($taxonomy['options']) ? array_key...
php
protected function isTaxonomyValid($content, $slug, array $taxonomy) { if ($taxonomy['behaves_like'] === 'tags' && !$content) { return false; } $isNotTag = in_array($taxonomy['behaves_like'], ['categories', 'grouping']); $options = isset($taxonomy['options']) ? array_key...
[ "protected", "function", "isTaxonomyValid", "(", "$", "content", ",", "$", "slug", ",", "array", "$", "taxonomy", ")", "{", "if", "(", "$", "taxonomy", "[", "'behaves_like'", "]", "===", "'tags'", "&&", "!", "$", "content", ")", "{", "return", "false", ...
Check if the taxonomy is valid. @see https://github.com/bolt/bolt/pull/2310 @param array|false $content @param string $slug @param array $taxonomy @return bool
[ "Check", "if", "the", "taxonomy", "is", "valid", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Frontend.php#L465-L479
bolt/bolt
src/Controller/Frontend.php
Frontend.search
public function search(Request $request, array $contenttypes = null) { $q = ''; $context = __FUNCTION__; if ($request->query->has('q')) { $q = $request->query->get('q'); } elseif ($request->query->has($context)) { $q = $request->query->get($context); ...
php
public function search(Request $request, array $contenttypes = null) { $q = ''; $context = __FUNCTION__; if ($request->query->has('q')) { $q = $request->query->get('q'); } elseif ($request->query->has($context)) { $q = $request->query->get($context); ...
[ "public", "function", "search", "(", "Request", "$", "request", ",", "array", "$", "contenttypes", "=", "null", ")", "{", "$", "q", "=", "''", ";", "$", "context", "=", "__FUNCTION__", ";", "if", "(", "$", "request", "->", "query", "->", "has", "(", ...
The search result page controller. @param Request $request The Symfony Request @param array $contenttypes The content type slug(s) you want to search for @return TemplateResponse
[ "The", "search", "result", "page", "controller", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Frontend.php#L489-L576
bolt/bolt
src/Controller/Frontend.php
Frontend.getListingParameters
private function getListingParameters($contentTypeSlug, $allowViewless = false) { $contentType = $this->getContentType(current(explode('/', $contentTypeSlug))); // If there is no ContentType, don't get parameters for it if ($contentType === false) { return []; } ...
php
private function getListingParameters($contentTypeSlug, $allowViewless = false) { $contentType = $this->getContentType(current(explode('/', $contentTypeSlug))); // If there is no ContentType, don't get parameters for it if ($contentType === false) { return []; } ...
[ "private", "function", "getListingParameters", "(", "$", "contentTypeSlug", ",", "$", "allowViewless", "=", "false", ")", "{", "$", "contentType", "=", "$", "this", "->", "getContentType", "(", "current", "(", "explode", "(", "'/'", ",", "$", "contentTypeSlug"...
Returns an array of the parameters used in getContent for listing pages. @param string $contentTypeSlug The content type slug @param bool $allowViewless Allow viewless contenttype @return array Parameters to use in getContent
[ "Returns", "an", "array", "of", "the", "parameters", "used", "in", "getContent", "for", "listing", "pages", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Frontend.php#L604-L630
bolt/bolt
src/Controller/Frontend.php
Frontend.getListingOrder
private function getListingOrder($contentType) { // An empty default isn't set in config yet, arrays got to hate them. if (isset($contentType['taxonomy'])) { $taxonomies = $this->getOption('taxonomy'); foreach ($contentType['taxonomy'] as $taxonomyName) { if (...
php
private function getListingOrder($contentType) { // An empty default isn't set in config yet, arrays got to hate them. if (isset($contentType['taxonomy'])) { $taxonomies = $this->getOption('taxonomy'); foreach ($contentType['taxonomy'] as $taxonomyName) { if (...
[ "private", "function", "getListingOrder", "(", "$", "contentType", ")", "{", "// An empty default isn't set in config yet, arrays got to hate them.", "if", "(", "isset", "(", "$", "contentType", "[", "'taxonomy'", "]", ")", ")", "{", "$", "taxonomies", "=", "$", "th...
Return the listing order. If the ContentType's sort is false (default in Config::parseContentType), either: - we let `getContent()` sort by itself - we explicitly set it to sort on the general/listing_sort setting @param ContentType|array $contentType @return null|string
[ "Return", "the", "listing", "order", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Frontend.php#L644-L658
bolt/bolt
src/Nut/Helper/QuestionHelper.php
QuestionHelper.askThenRemove
public function askThenRemove(InputInterface $input, OverwritableOutputInterface $output, Question $question) { // Following suit of ask(). if (!$input->isInteractive()) { return $question->getDefault(); } $this->remove = true; $this->question = $question; ...
php
public function askThenRemove(InputInterface $input, OverwritableOutputInterface $output, Question $question) { // Following suit of ask(). if (!$input->isInteractive()) { return $question->getDefault(); } $this->remove = true; $this->question = $question; ...
[ "public", "function", "askThenRemove", "(", "InputInterface", "$", "input", ",", "OverwritableOutputInterface", "$", "output", ",", "Question", "$", "question", ")", "{", "// Following suit of ask().", "if", "(", "!", "$", "input", "->", "isInteractive", "(", ")",...
Ask a question to the user and then remove the question & answer. @param InputInterface $input @param OverwritableOutputInterface $output @param Question $question @return mixed|string The user answer
[ "Ask", "a", "question", "to", "the", "user", "and", "then", "remove", "the", "question", "&", "answer", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/Helper/QuestionHelper.php#L49-L87
bolt/bolt
src/Nut/Helper/QuestionHelper.php
QuestionHelper.setInputStream
public function setInputStream($stream) { $stream = new Stream($stream ?: STDIN); $stream = FnStream::decorate($stream, [ 'read' => function ($length) use ($stream) { $ret = $stream->read($length); $this->onRead($ret); return $ret; ...
php
public function setInputStream($stream) { $stream = new Stream($stream ?: STDIN); $stream = FnStream::decorate($stream, [ 'read' => function ($length) use ($stream) { $ret = $stream->read($length); $this->onRead($ret); return $ret; ...
[ "public", "function", "setInputStream", "(", "$", "stream", ")", "{", "$", "stream", "=", "new", "Stream", "(", "$", "stream", "?", ":", "STDIN", ")", ";", "$", "stream", "=", "FnStream", "::", "decorate", "(", "$", "stream", ",", "[", "'read'", "=>"...
{@inheritdoc} Wrap input stream to call our onRead method.
[ "{", "@inheritdoc", "}" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/Helper/QuestionHelper.php#L94-L108
bolt/bolt
src/Nut/Helper/QuestionHelper.php
QuestionHelper.onRead
protected function onRead($data) { if (!$this->remove || $this->autocomplete || $this->question->isHidden()) { return; } $this->output->captureUserInput($data); }
php
protected function onRead($data) { if (!$this->remove || $this->autocomplete || $this->question->isHidden()) { return; } $this->output->captureUserInput($data); }
[ "protected", "function", "onRead", "(", "$", "data", ")", "{", "if", "(", "!", "$", "this", "->", "remove", "||", "$", "this", "->", "autocomplete", "||", "$", "this", "->", "question", "->", "isHidden", "(", ")", ")", "{", "return", ";", "}", "$",...
On input stream read. We capture user input here if applicable. We can't use the return value of ask() because it is trimmed. We need to account for those extra characters when overwriting. @param string $data
[ "On", "input", "stream", "read", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/Helper/QuestionHelper.php#L120-L127
bolt/bolt
src/Routing/ControllerResolver.php
ControllerResolver.instantiateController
protected function instantiateController($class) { $refCls = new \ReflectionClass($class); if ($refCls->implementsInterface(ExtensionInterface::class)) { Deprecated::warn('Using Extension class name', 3.3, 'Use controller object in route definition or make the controller a service and us...
php
protected function instantiateController($class) { $refCls = new \ReflectionClass($class); if ($refCls->implementsInterface(ExtensionInterface::class)) { Deprecated::warn('Using Extension class name', 3.3, 'Use controller object in route definition or make the controller a service and us...
[ "protected", "function", "instantiateController", "(", "$", "class", ")", "{", "$", "refCls", "=", "new", "\\", "ReflectionClass", "(", "$", "class", ")", ";", "if", "(", "$", "refCls", "->", "implementsInterface", "(", "ExtensionInterface", "::", "class", "...
If class name passed in is an extension then return the extension instance instead of creating a new class. @param string $class @return object
[ "If", "class", "name", "passed", "in", "is", "an", "extension", "then", "return", "the", "extension", "instance", "instead", "of", "creating", "a", "new", "class", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Routing/ControllerResolver.php#L24-L41
bolt/bolt
src/Nut/UserRoleAdd.php
UserRoleAdd.interact
protected function interact(InputInterface $input, OutputInterface $output) { try { $input->validate(); } catch (RuntimeException $e) { $this->askUserName($input); $this->askRole($input); } }
php
protected function interact(InputInterface $input, OutputInterface $output) { try { $input->validate(); } catch (RuntimeException $e) { $this->askUserName($input); $this->askRole($input); } }
[ "protected", "function", "interact", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "try", "{", "$", "input", "->", "validate", "(", ")", ";", "}", "catch", "(", "RuntimeException", "$", "e", ")", "{", "$", "this", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/UserRoleAdd.php#L31-L39
bolt/bolt
src/Nut/UserRoleAdd.php
UserRoleAdd.execute
protected function execute(InputInterface $input, OutputInterface $output) { $username = $input->getArgument('username'); $roles = $input->getArgument('role'); $users = $this->app['users']; $permissions = $this->app['config']->get('permissions/roles', []); $result = 0; ...
php
protected function execute(InputInterface $input, OutputInterface $output) { $username = $input->getArgument('username'); $roles = $input->getArgument('role'); $users = $this->app['users']; $permissions = $this->app['config']->get('permissions/roles', []); $result = 0; ...
[ "protected", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "$", "username", "=", "$", "input", "->", "getArgument", "(", "'username'", ")", ";", "$", "roles", "=", "$", "input", "->", "getArgum...
{@inheritdoc}
[ "{" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/UserRoleAdd.php#L44-L91
bolt/bolt
src/Extension/TranslationTrait.php
TranslationTrait.extendTranslatorService
final protected function extendTranslatorService() { $app = $this->getContainer(); $app['translator'] = $app->share( $app->extend( 'translator', function ($translator) { $translations = $this->loadTranslationsFromDefaultPath(); ...
php
final protected function extendTranslatorService() { $app = $this->getContainer(); $app['translator'] = $app->share( $app->extend( 'translator', function ($translator) { $translations = $this->loadTranslationsFromDefaultPath(); ...
[ "final", "protected", "function", "extendTranslatorService", "(", ")", "{", "$", "app", "=", "$", "this", "->", "getContainer", "(", ")", ";", "$", "app", "[", "'translator'", "]", "=", "$", "app", "->", "share", "(", "$", "app", "->", "extend", "(", ...
Call this in register method. @internal
[ "Call", "this", "in", "register", "method", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Extension/TranslationTrait.php#L26-L46
bolt/bolt
src/Extension/TranslationTrait.php
TranslationTrait.loadTranslationsFromDefaultPath
private function loadTranslationsFromDefaultPath() { /** @var DirectoryInterface $baseDir */ $baseDir = $this->getBaseDirectory(); /** @var Filesystem $filesystem */ $filesystem = $this->getBaseDirectory()->getFilesystem(); if ($filesystem->has($baseDir->getFullPath() . '/tra...
php
private function loadTranslationsFromDefaultPath() { /** @var DirectoryInterface $baseDir */ $baseDir = $this->getBaseDirectory(); /** @var Filesystem $filesystem */ $filesystem = $this->getBaseDirectory()->getFilesystem(); if ($filesystem->has($baseDir->getFullPath() . '/tra...
[ "private", "function", "loadTranslationsFromDefaultPath", "(", ")", "{", "/** @var DirectoryInterface $baseDir */", "$", "baseDir", "=", "$", "this", "->", "getBaseDirectory", "(", ")", ";", "/** @var Filesystem $filesystem */", "$", "filesystem", "=", "$", "this", "->"...
Load translations from every extensions translations directory. File names must follow common naming conventions, e.g.: - en.yml - en_GB.yml
[ "Load", "translations", "from", "every", "extensions", "translations", "directory", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Extension/TranslationTrait.php#L55-L84
bolt/bolt
src/Composer/PackageCollection.php
PackageCollection.add
public function add(Package $package) { $name = $package->getName(); if (isset($this->packages[$name])) { return; } $this->packages[$name] = $package; }
php
public function add(Package $package) { $name = $package->getName(); if (isset($this->packages[$name])) { return; } $this->packages[$name] = $package; }
[ "public", "function", "add", "(", "Package", "$", "package", ")", "{", "$", "name", "=", "$", "package", "->", "getName", "(", ")", ";", "if", "(", "isset", "(", "$", "this", "->", "packages", "[", "$", "name", "]", ")", ")", "{", "return", ";", ...
Add a package to the collection. @param Package $package
[ "Add", "a", "package", "to", "the", "collection", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/PackageCollection.php#L22-L30
bolt/bolt
src/Composer/PackageCollection.php
PackageCollection.get
public function get($name) { if (!isset($this->packages[$name])) { return null; } return $this->packages[$name]; }
php
public function get($name) { if (!isset($this->packages[$name])) { return null; } return $this->packages[$name]; }
[ "public", "function", "get", "(", "$", "name", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "packages", "[", "$", "name", "]", ")", ")", "{", "return", "null", ";", "}", "return", "$", "this", "->", "packages", "[", "$", "name", "...
Get a package from the collection. @param string $name @return Package|null
[ "Get", "a", "package", "from", "the", "collection", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/PackageCollection.php#L39-L46
bolt/bolt
src/Configuration/LowlevelChecks.php
LowlevelChecks.removeCheck
public function removeCheck($check) { if (in_array($check, $this->checks)) { $this->checks = array_diff($this->checks, [$check]); } }
php
public function removeCheck($check) { if (in_array($check, $this->checks)) { $this->checks = array_diff($this->checks, [$check]); } }
[ "public", "function", "removeCheck", "(", "$", "check", ")", "{", "if", "(", "in_array", "(", "$", "check", ",", "$", "this", "->", "checks", ")", ")", "{", "$", "this", "->", "checks", "=", "array_diff", "(", "$", "this", "->", "checks", ",", "[",...
Remove a check from the list causing it to be skipped. @param string $check
[ "Remove", "a", "check", "from", "the", "list", "causing", "it", "to", "be", "skipped", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Configuration/LowlevelChecks.php#L76-L81
bolt/bolt
src/Configuration/LowlevelChecks.php
LowlevelChecks.addCheck
public function addCheck($check, $top = false) { if (!in_array($check, $this->checks)) { if ($top) { array_unshift($this->checks, $check); } else { $this->checks[] = $check; } } }
php
public function addCheck($check, $top = false) { if (!in_array($check, $this->checks)) { if ($top) { array_unshift($this->checks, $check); } else { $this->checks[] = $check; } } }
[ "public", "function", "addCheck", "(", "$", "check", ",", "$", "top", "=", "false", ")", "{", "if", "(", "!", "in_array", "(", "$", "check", ",", "$", "this", "->", "checks", ")", ")", "{", "if", "(", "$", "top", ")", "{", "array_unshift", "(", ...
Add a check. @param string $check @param bool $top
[ "Add", "a", "check", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Configuration/LowlevelChecks.php#L89-L98
bolt/bolt
src/Configuration/LowlevelChecks.php
LowlevelChecks.doChecks
public function doChecks() { foreach ($this->checks as $check) { $method = 'check' . ucfirst($check); $this->$method(); } // If the config folder is OK, but the config files are missing, attempt to fix it. foreach ($this->configChecks as $check) { ...
php
public function doChecks() { foreach ($this->checks as $check) { $method = 'check' . ucfirst($check); $this->$method(); } // If the config folder is OK, but the config files are missing, attempt to fix it. foreach ($this->configChecks as $check) { ...
[ "public", "function", "doChecks", "(", ")", "{", "foreach", "(", "$", "this", "->", "checks", "as", "$", "check", ")", "{", "$", "method", "=", "'check'", ".", "ucfirst", "(", "$", "check", ")", ";", "$", "this", "->", "$", "method", "(", ")", ";...
Perform the checks.
[ "Perform", "the", "checks", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Configuration/LowlevelChecks.php#L103-L114
bolt/bolt
src/Configuration/LowlevelChecks.php
LowlevelChecks.checkApache
public function checkApache() { if ($this->disableApacheChecks) { return; } if ($this->isApache && !is_readable($this->config->getPath('web') . '/.htaccess')) { throw new BootException( 'The file <code>' . htmlspecialchars($this->config->getPath('web')...
php
public function checkApache() { if ($this->disableApacheChecks) { return; } if ($this->isApache && !is_readable($this->config->getPath('web') . '/.htaccess')) { throw new BootException( 'The file <code>' . htmlspecialchars($this->config->getPath('web')...
[ "public", "function", "checkApache", "(", ")", "{", "if", "(", "$", "this", "->", "disableApacheChecks", ")", "{", "return", ";", "}", "if", "(", "$", "this", "->", "isApache", "&&", "!", "is_readable", "(", "$", "this", "->", "config", "->", "getPath"...
This check looks for the presence of the .htaccess file inside the web directory. It is here only as a convenience check for users that install the basic version of Bolt. If you see this error and want to disable it, call $config->getVerifier()->disableApacheChecks(); inside your bootstrap.php file, just before the ca...
[ "This", "check", "looks", "for", "the", "presence", "of", "the", ".", "htaccess", "file", "inside", "the", "web", "directory", ".", "It", "is", "here", "only", "as", "a", "convenience", "check", "for", "users", "that", "install", "the", "basic", "version",...
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Configuration/LowlevelChecks.php#L175-L191
bolt/bolt
src/Configuration/LowlevelChecks.php
LowlevelChecks.doDatabaseCheck
public function doDatabaseCheck() { $validator = new Validation\Database(); $validator->setPathResolver($this->config->app['path_resolver']); $validator->setConfig($this->config->app['config']); $validator->check(); }
php
public function doDatabaseCheck() { $validator = new Validation\Database(); $validator->setPathResolver($this->config->app['path_resolver']); $validator->setConfig($this->config->app['config']); $validator->check(); }
[ "public", "function", "doDatabaseCheck", "(", ")", "{", "$", "validator", "=", "new", "Validation", "\\", "Database", "(", ")", ";", "$", "validator", "->", "setPathResolver", "(", "$", "this", "->", "config", "->", "app", "[", "'path_resolver'", "]", ")",...
Perform the check for the database folder. We do this separately, because it can only be done _after_ the other checks, since we need to have the $config, to see if we even _need_ to do this check.
[ "Perform", "the", "check", "for", "the", "database", "folder", ".", "We", "do", "this", "separately", "because", "it", "can", "only", "be", "done", "_after_", "the", "other", "checks", "since", "we", "need", "to", "have", "the", "$config", "to", "see", "...
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Configuration/LowlevelChecks.php#L198-L204
bolt/bolt
src/Configuration/LowlevelChecks.php
LowlevelChecks.lowlevelConfigFix
protected function lowlevelConfigFix($name) { $distname = realpath(__DIR__ . '/../../app/config/' . $name . '.yml.dist'); $ymlname = $this->config->getPath('config') . '/' . $name . '.yml'; if (file_exists($ymlname) && !is_readable($ymlname)) { $error = sprintf( ...
php
protected function lowlevelConfigFix($name) { $distname = realpath(__DIR__ . '/../../app/config/' . $name . '.yml.dist'); $ymlname = $this->config->getPath('config') . '/' . $name . '.yml'; if (file_exists($ymlname) && !is_readable($ymlname)) { $error = sprintf( ...
[ "protected", "function", "lowlevelConfigFix", "(", "$", "name", ")", "{", "$", "distname", "=", "realpath", "(", "__DIR__", ".", "'/../../app/config/'", ".", "$", "name", ".", "'.yml.dist'", ")", ";", "$", "ymlname", "=", "$", "this", "->", "config", "->",...
Check if a config file is present and writable. If not, try to create it from the filename.dist. @param string $name Filename stem; .yml extension will be added automatically. @throws \Bolt\Exception\BootException
[ "Check", "if", "a", "config", "file", "is", "present", "and", "writable", ".", "If", "not", "try", "to", "create", "it", "from", "the", "filename", ".", "dist", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Configuration/LowlevelChecks.php#L224-L254
bolt/bolt
src/Storage/Database/Schema/Comparison/BaseComparator.php
BaseComparator.hasPending
public function hasPending($fromTables, $toTables, array $protectedTableNames) { if ($this->pending !== null) { return $this->pending; } $this->compare($fromTables, $toTables, $protectedTableNames); return $this->pending; }
php
public function hasPending($fromTables, $toTables, array $protectedTableNames) { if ($this->pending !== null) { return $this->pending; } $this->compare($fromTables, $toTables, $protectedTableNames); return $this->pending; }
[ "public", "function", "hasPending", "(", "$", "fromTables", ",", "$", "toTables", ",", "array", "$", "protectedTableNames", ")", "{", "if", "(", "$", "this", "->", "pending", "!==", "null", ")", "{", "return", "$", "this", "->", "pending", ";", "}", "$...
Are database updates required. @param Table[] $fromTables @param Table[] $toTables @param array $protectedTableNames @return bool
[ "Are", "database", "updates", "required", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Database/Schema/Comparison/BaseComparator.php#L64-L72
bolt/bolt
src/Storage/Database/Schema/Comparison/BaseComparator.php
BaseComparator.compare
public function compare($fromTables, $toTables, array $protectedTableNames, $force = false) { if ($this->response !== null && $force === false) { return $this->getResponse(); } if ($force === false) { $this->setIgnoredChanges(); } $this->checkTables($...
php
public function compare($fromTables, $toTables, array $protectedTableNames, $force = false) { if ($this->response !== null && $force === false) { return $this->getResponse(); } if ($force === false) { $this->setIgnoredChanges(); } $this->checkTables($...
[ "public", "function", "compare", "(", "$", "fromTables", ",", "$", "toTables", ",", "array", "$", "protectedTableNames", ",", "$", "force", "=", "false", ")", "{", "if", "(", "$", "this", "->", "response", "!==", "null", "&&", "$", "force", "===", "fal...
Run the update checks and flag if we need an update. @param Table[] $fromTables @param Table[] $toTables @param array $protectedTableNames @param bool $force @return SchemaCheck
[ "Run", "the", "update", "checks", "and", "flag", "if", "we", "need", "an", "update", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Database/Schema/Comparison/BaseComparator.php#L84-L102
bolt/bolt
src/Storage/Database/Schema/Comparison/BaseComparator.php
BaseComparator.getCreates
public function getCreates() { if ($this->tablesCreate === null) { return []; } $platform = $this->connection->getDatabasePlatform(); $flags = AbstractPlatform::CREATE_INDEXES | AbstractPlatform::CREATE_FOREIGNKEYS; $queries = []; foreach ($this->tablesC...
php
public function getCreates() { if ($this->tablesCreate === null) { return []; } $platform = $this->connection->getDatabasePlatform(); $flags = AbstractPlatform::CREATE_INDEXES | AbstractPlatform::CREATE_FOREIGNKEYS; $queries = []; foreach ($this->tablesC...
[ "public", "function", "getCreates", "(", ")", "{", "if", "(", "$", "this", "->", "tablesCreate", "===", "null", ")", "{", "return", "[", "]", ";", "}", "$", "platform", "=", "$", "this", "->", "connection", "->", "getDatabasePlatform", "(", ")", ";", ...
Get the table creation SQL queries. @return string[]
[ "Get", "the", "table", "creation", "SQL", "queries", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Database/Schema/Comparison/BaseComparator.php#L123-L138
bolt/bolt
src/Storage/Database/Schema/Comparison/BaseComparator.php
BaseComparator.getAlters
public function getAlters() { $queries = []; if ($this->tablesAlter === null) { return $queries; } $platform = $this->connection->getDatabasePlatform(); /** @var $tableDiff TableDiff */ foreach ($this->tablesAlter as $tableName => $tableDiff) { ...
php
public function getAlters() { $queries = []; if ($this->tablesAlter === null) { return $queries; } $platform = $this->connection->getDatabasePlatform(); /** @var $tableDiff TableDiff */ foreach ($this->tablesAlter as $tableName => $tableDiff) { ...
[ "public", "function", "getAlters", "(", ")", "{", "$", "queries", "=", "[", "]", ";", "if", "(", "$", "this", "->", "tablesAlter", "===", "null", ")", "{", "return", "$", "queries", ";", "}", "$", "platform", "=", "$", "this", "->", "connection", "...
Get the table alteration SQL queries. @return string[]
[ "Get", "the", "table", "alteration", "SQL", "queries", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Database/Schema/Comparison/BaseComparator.php#L145-L160
bolt/bolt
src/Storage/Database/Schema/Comparison/BaseComparator.php
BaseComparator.checkTables
protected function checkTables($fromTables, $toTables) { /** @var $fromTable Table */ foreach ($toTables as $toTableAlias => $toTable) { $tableName = $toTable->getName(); if (!isset($fromTables[$toTableAlias])) { // Table doesn't exist. Mark it for pending cr...
php
protected function checkTables($fromTables, $toTables) { /** @var $fromTable Table */ foreach ($toTables as $toTableAlias => $toTable) { $tableName = $toTable->getName(); if (!isset($fromTables[$toTableAlias])) { // Table doesn't exist. Mark it for pending cr...
[ "protected", "function", "checkTables", "(", "$", "fromTables", ",", "$", "toTables", ")", "{", "/** @var $fromTable Table */", "foreach", "(", "$", "toTables", "as", "$", "toTableAlias", "=>", "$", "toTable", ")", "{", "$", "tableName", "=", "$", "toTable", ...
Run the checks on the tables to see if they firstly exist, then if they require update. @param Table[] $fromTables @param Table[] $toTables
[ "Run", "the", "checks", "on", "the", "tables", "to", "see", "if", "they", "firstly", "exist", "then", "if", "they", "require", "update", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Database/Schema/Comparison/BaseComparator.php#L202-L221
bolt/bolt
src/Storage/Database/Schema/Comparison/BaseComparator.php
BaseComparator.checkTable
protected function checkTable(Table $fromTable, Table $toTable) { $tableName = $fromTable->getName(); $diff = (new Comparator())->diffTable($fromTable, $toTable); if ($diff !== false) { $this->removeIgnoredChanges($diff); $this->diffs[$tableName] = $diff; } ...
php
protected function checkTable(Table $fromTable, Table $toTable) { $tableName = $fromTable->getName(); $diff = (new Comparator())->diffTable($fromTable, $toTable); if ($diff !== false) { $this->removeIgnoredChanges($diff); $this->diffs[$tableName] = $diff; } ...
[ "protected", "function", "checkTable", "(", "Table", "$", "fromTable", ",", "Table", "$", "toTable", ")", "{", "$", "tableName", "=", "$", "fromTable", "->", "getName", "(", ")", ";", "$", "diff", "=", "(", "new", "Comparator", "(", ")", ")", "->", "...
Check that a single table's columns and indices are valid. @param Table $fromTable @param Table $toTable
[ "Check", "that", "a", "single", "table", "s", "columns", "and", "indices", "are", "valid", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Database/Schema/Comparison/BaseComparator.php#L229-L237
bolt/bolt
src/Storage/Database/Schema/Comparison/BaseComparator.php
BaseComparator.adjustDiffs
protected function adjustDiffs(array $protectedTableNames) { $diffUpdater = new DiffUpdater($this->ignoredChanges); /** @var TableDiff $tableDiff */ foreach ($this->diffs as $tableName => $tableDiff) { $this->adjustContentTypeDiffs($tableDiff, $protectedTableNames); ...
php
protected function adjustDiffs(array $protectedTableNames) { $diffUpdater = new DiffUpdater($this->ignoredChanges); /** @var TableDiff $tableDiff */ foreach ($this->diffs as $tableName => $tableDiff) { $this->adjustContentTypeDiffs($tableDiff, $protectedTableNames); ...
[ "protected", "function", "adjustDiffs", "(", "array", "$", "protectedTableNames", ")", "{", "$", "diffUpdater", "=", "new", "DiffUpdater", "(", "$", "this", "->", "ignoredChanges", ")", ";", "/** @var TableDiff $tableDiff */", "foreach", "(", "$", "this", "->", ...
Platform specific adjustments to table/column diffs. @param array $protectedTableNames
[ "Platform", "specific", "adjustments", "to", "table", "/", "column", "diffs", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Database/Schema/Comparison/BaseComparator.php#L244-L257
bolt/bolt
src/Storage/Database/Schema/Comparison/BaseComparator.php
BaseComparator.adjustContentTypeDiffs
protected function adjustContentTypeDiffs(TableDiff $tableDiff, array $protectedTableNames) { $alias = str_replace($this->prefix, '', $tableDiff->fromTable->getName()); if (in_array($alias, $protectedTableNames)) { $tableDiff->removedColumns = []; } }
php
protected function adjustContentTypeDiffs(TableDiff $tableDiff, array $protectedTableNames) { $alias = str_replace($this->prefix, '', $tableDiff->fromTable->getName()); if (in_array($alias, $protectedTableNames)) { $tableDiff->removedColumns = []; } }
[ "protected", "function", "adjustContentTypeDiffs", "(", "TableDiff", "$", "tableDiff", ",", "array", "$", "protectedTableNames", ")", "{", "$", "alias", "=", "str_replace", "(", "$", "this", "->", "prefix", ",", "''", ",", "$", "tableDiff", "->", "fromTable", ...
Clear 'removedColumns' attribute from ContentType table diffs to prevent accidental data removal. @param TableDiff $tableDiff @param array $protectedTableNames
[ "Clear", "removedColumns", "attribute", "from", "ContentType", "table", "diffs", "to", "prevent", "accidental", "data", "removal", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Database/Schema/Comparison/BaseComparator.php#L265-L271
bolt/bolt
src/Storage/Database/Schema/Comparison/BaseComparator.php
BaseComparator.addAlterResponses
protected function addAlterResponses() { $platform = $this->connection->getDatabasePlatform(); $response = $this->getResponse(); $this->setIgnoredChanges(); foreach ($this->diffs as $tableName => $tableDiff) { $this->pending = true; $this->tablesAlter[$tableN...
php
protected function addAlterResponses() { $platform = $this->connection->getDatabasePlatform(); $response = $this->getResponse(); $this->setIgnoredChanges(); foreach ($this->diffs as $tableName => $tableDiff) { $this->pending = true; $this->tablesAlter[$tableN...
[ "protected", "function", "addAlterResponses", "(", ")", "{", "$", "platform", "=", "$", "this", "->", "connection", "->", "getDatabasePlatform", "(", ")", ";", "$", "response", "=", "$", "this", "->", "getResponse", "(", ")", ";", "$", "this", "->", "set...
Add required changes to the response object. NOTE: This must be run after adjustDiffs() so that the user response doesn't contain ignored changes.
[ "Add", "required", "changes", "to", "the", "response", "object", "." ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Database/Schema/Comparison/BaseComparator.php#L279-L292
bolt/bolt
src/Response/TemplateView.php
TemplateView.setContext
public function setContext($context) { Assert::isTraversable($context); $this->context = MutableBag::from($context); return $this; }
php
public function setContext($context) { Assert::isTraversable($context); $this->context = MutableBag::from($context); return $this; }
[ "public", "function", "setContext", "(", "$", "context", ")", "{", "Assert", "::", "isTraversable", "(", "$", "context", ")", ";", "$", "this", "->", "context", "=", "MutableBag", "::", "from", "(", "$", "context", ")", ";", "return", "$", "this", ";",...
@param iterable $context @return TemplateView
[ "@param", "iterable", "$context" ]
train
https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Response/TemplateView.php#L67-L74