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/Twig/Extension/BoltExtension.php | BoltExtension.getTokenParsers | public function getTokenParsers()
{
$isLegacy = $this->config->get('general/compatibility/setcontent_legacy', true);
$parsers = [
new SetcontentTokenParser($isLegacy),
new SwitchTokenParser(),
];
return $parsers;
} | php | public function getTokenParsers()
{
$isLegacy = $this->config->get('general/compatibility/setcontent_legacy', true);
$parsers = [
new SetcontentTokenParser($isLegacy),
new SwitchTokenParser(),
];
return $parsers;
} | [
"public",
"function",
"getTokenParsers",
"(",
")",
"{",
"$",
"isLegacy",
"=",
"$",
"this",
"->",
"config",
"->",
"get",
"(",
"'general/compatibility/setcontent_legacy'",
",",
"true",
")",
";",
"$",
"parsers",
"=",
"[",
"new",
"SetcontentTokenParser",
"(",
"$",... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/Extension/BoltExtension.php#L118-L127 |
bolt/bolt | src/Provider/TranslationServiceProvider.php | TranslationServiceProvider.boot | public function boot(Application $app)
{
$locales = (array) $app['config']->get('general/locale');
// Add fallback locales to list if they are not already there
$locales = array_unique(array_merge($locales, $app['locale_fallbacks']));
// Merge in generic versions of each locale
... | php | public function boot(Application $app)
{
$locales = (array) $app['config']->get('general/locale');
// Add fallback locales to list if they are not already there
$locales = array_unique(array_merge($locales, $app['locale_fallbacks']));
// Merge in generic versions of each locale
... | [
"public",
"function",
"boot",
"(",
"Application",
"$",
"app",
")",
"{",
"$",
"locales",
"=",
"(",
"array",
")",
"$",
"app",
"[",
"'config'",
"]",
"->",
"get",
"(",
"'general/locale'",
")",
";",
"// Add fallback locales to list if they are not already there",
"$"... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Provider/TranslationServiceProvider.php#L93-L107 |
bolt/bolt | src/Provider/TranslationServiceProvider.php | TranslationServiceProvider.addResources | public static function addResources(Application $app, $locale)
{
// Directories to look for translation file(s)
$transDirs = array_unique(
[
$app['path_resolver']->resolve('%site%/app/translation/'),
$app['path_resolver']->resolve("%site%/app/translation/{... | php | public static function addResources(Application $app, $locale)
{
// Directories to look for translation file(s)
$transDirs = array_unique(
[
$app['path_resolver']->resolve('%site%/app/translation/'),
$app['path_resolver']->resolve("%site%/app/translation/{... | [
"public",
"static",
"function",
"addResources",
"(",
"Application",
"$",
"app",
",",
"$",
"locale",
")",
"{",
"// Directories to look for translation file(s)",
"$",
"transDirs",
"=",
"array_unique",
"(",
"[",
"$",
"app",
"[",
"'path_resolver'",
"]",
"->",
"resolve... | Adds all resources that belong to a locale.
@param Application $app
@param string $locale
@return array | [
"Adds",
"all",
"resources",
"that",
"belong",
"to",
"a",
"locale",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Provider/TranslationServiceProvider.php#L117-L155 |
bolt/bolt | src/Provider/TranslationServiceProvider.php | TranslationServiceProvider.mergeGenericLocales | protected function mergeGenericLocales(array $inputLocales)
{
$locales = [];
foreach ($inputLocales as $locale) {
$locales[] = $locale;
if (strlen($locale) === 5) {
$locale = substr($locale, 0, 2);
$locales[] = $locale;
}
}
... | php | protected function mergeGenericLocales(array $inputLocales)
{
$locales = [];
foreach ($inputLocales as $locale) {
$locales[] = $locale;
if (strlen($locale) === 5) {
$locale = substr($locale, 0, 2);
$locales[] = $locale;
}
}
... | [
"protected",
"function",
"mergeGenericLocales",
"(",
"array",
"$",
"inputLocales",
")",
"{",
"$",
"locales",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"inputLocales",
"as",
"$",
"locale",
")",
"{",
"$",
"locales",
"[",
"]",
"=",
"$",
"locale",
";",
"if"... | Adds generic locales into a given list.
[fr_FR, es, en_GB, en_US] -> [fr_FR, fr, es, en_GB, en_US, en]
@param string[] $inputLocales
@return string[] | [
"Adds",
"generic",
"locales",
"into",
"a",
"given",
"list",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Provider/TranslationServiceProvider.php#L166-L180 |
bolt/bolt | src/Provider/TranslationServiceProvider.php | TranslationServiceProvider.mergeUtf8Locales | protected function mergeUtf8Locales(array $inputLocales)
{
$locales = [];
foreach ($inputLocales as $locale) {
$locales[] = $locale . '.UTF-8';
$locales[] = $locale . '.utf8';
$locales[] = $locale;
}
return $locales;
} | php | protected function mergeUtf8Locales(array $inputLocales)
{
$locales = [];
foreach ($inputLocales as $locale) {
$locales[] = $locale . '.UTF-8';
$locales[] = $locale . '.utf8';
$locales[] = $locale;
}
return $locales;
} | [
"protected",
"function",
"mergeUtf8Locales",
"(",
"array",
"$",
"inputLocales",
")",
"{",
"$",
"locales",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"inputLocales",
"as",
"$",
"locale",
")",
"{",
"$",
"locales",
"[",
"]",
"=",
"$",
"locale",
".",
"'.UTF-... | Adds UTF-8 suffixes for each locale in given list.
@param string[] $inputLocales
@return string[] | [
"Adds",
"UTF",
"-",
"8",
"suffixes",
"for",
"each",
"locale",
"in",
"given",
"list",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Provider/TranslationServiceProvider.php#L189-L199 |
bolt/bolt | src/Helpers/Excerpt.php | Excerpt.getExcerpt | public function getExcerpt($length = 200, $includeTitle = false, $focus = null, $stripFields = [])
{
$title = null;
if ($includeTitle && $this->title !== null) {
$title = Html::trimText(strip_tags($this->title), $length);
$length -= strlen($title);
}
if ($thi... | php | public function getExcerpt($length = 200, $includeTitle = false, $focus = null, $stripFields = [])
{
$title = null;
if ($includeTitle && $this->title !== null) {
$title = Html::trimText(strip_tags($this->title), $length);
$length -= strlen($title);
}
if ($thi... | [
"public",
"function",
"getExcerpt",
"(",
"$",
"length",
"=",
"200",
",",
"$",
"includeTitle",
"=",
"false",
",",
"$",
"focus",
"=",
"null",
",",
"$",
"stripFields",
"=",
"[",
"]",
")",
"{",
"$",
"title",
"=",
"null",
";",
"if",
"(",
"$",
"includeTi... | Get the excerpt of a given piece of text.
@param int $length
@param bool $includeTitle
@param array|string|null $focus
@param array $stripFields
@return string|null | [
"Get",
"the",
"excerpt",
"of",
"a",
"given",
"piece",
"of",
"text",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Helpers/Excerpt.php#L41-L116 |
bolt/bolt | src/Helpers/Excerpt.php | Excerpt.createFromEntity | public static function createFromEntity(Content $entity, Bag $contentType, $length, Parsedown $markdown)
{
$parts = new MutableBag();
foreach ($contentType->get('fields', []) as $key => $field) {
// Skip empty fields, and fields used as 'title'.
$fieldValue = $entity->get($k... | php | public static function createFromEntity(Content $entity, Bag $contentType, $length, Parsedown $markdown)
{
$parts = new MutableBag();
foreach ($contentType->get('fields', []) as $key => $field) {
// Skip empty fields, and fields used as 'title'.
$fieldValue = $entity->get($k... | [
"public",
"static",
"function",
"createFromEntity",
"(",
"Content",
"$",
"entity",
",",
"Bag",
"$",
"contentType",
",",
"$",
"length",
",",
"Parsedown",
"$",
"markdown",
")",
"{",
"$",
"parts",
"=",
"new",
"MutableBag",
"(",
")",
";",
"foreach",
"(",
"$"... | @internal
@param Content $entity
@param Bag $contentType
@param int $length
@param Parsedown $markdown
@return string | [
"@internal"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Helpers/Excerpt.php#L128-L150 |
bolt/bolt | src/Helpers/Excerpt.php | Excerpt.extractLocations | private function extractLocations(array $words, $fulltext)
{
$locations = [];
foreach ($words as $word) {
$wordLen = strlen($word);
$loc = stripos($fulltext, $word);
while ($loc !== false) {
$locations[] = $loc;
$loc = stripos($full... | php | private function extractLocations(array $words, $fulltext)
{
$locations = [];
foreach ($words as $word) {
$wordLen = strlen($word);
$loc = stripos($fulltext, $word);
while ($loc !== false) {
$locations[] = $loc;
$loc = stripos($full... | [
"private",
"function",
"extractLocations",
"(",
"array",
"$",
"words",
",",
"$",
"fulltext",
")",
"{",
"$",
"locations",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"words",
"as",
"$",
"word",
")",
"{",
"$",
"wordLen",
"=",
"strlen",
"(",
"$",
"word",
... | Find the locations of each of the words.
Nothing exciting here. The array_unique is required, unless you decide
to make the words unique before passing in.
@param array $words
@param string $fulltext
@return array | [
"Find",
"the",
"locations",
"of",
"each",
"of",
"the",
"words",
".",
"Nothing",
"exciting",
"here",
".",
"The",
"array_unique",
"is",
"required",
"unless",
"you",
"decide",
"to",
"make",
"the",
"words",
"unique",
"before",
"passing",
"in",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Helpers/Excerpt.php#L162-L177 |
bolt/bolt | src/Helpers/Excerpt.php | Excerpt.determineSnipLocation | private function determineSnipLocation(array $locations, $prevCount)
{
// If we only have 1 match we don't actually do the for loop so set to the first
$startPos = (int) reset($locations);
$locCount = count($locations);
$smallestDiff = PHP_INT_MAX;
// If we only have 2, skip... | php | private function determineSnipLocation(array $locations, $prevCount)
{
// If we only have 1 match we don't actually do the for loop so set to the first
$startPos = (int) reset($locations);
$locCount = count($locations);
$smallestDiff = PHP_INT_MAX;
// If we only have 2, skip... | [
"private",
"function",
"determineSnipLocation",
"(",
"array",
"$",
"locations",
",",
"$",
"prevCount",
")",
"{",
"// If we only have 1 match we don't actually do the for loop so set to the first",
"$",
"startPos",
"=",
"(",
"int",
")",
"reset",
"(",
"$",
"locations",
")... | Work out which is the most relevant portion to display
This is done by looping over each match and finding the smallest distance between two found
strings. The idea being that the closer the terms are the better match the snippet would be.
When checking for matches we only change the location if there is a better match... | [
"Work",
"out",
"which",
"is",
"the",
"most",
"relevant",
"portion",
"to",
"display",
"This",
"is",
"done",
"by",
"looping",
"over",
"each",
"match",
"and",
"finding",
"the",
"smallest",
"distance",
"between",
"two",
"found",
"strings",
".",
"The",
"idea",
... | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Helpers/Excerpt.php#L192-L219 |
bolt/bolt | src/Helpers/Excerpt.php | Excerpt.extractRelevant | private function extractRelevant($words, $fulltext, $relLength = 300)
{
if (!is_array($words)) {
$words = explode(' ', $words);
}
// 1/6 ratio on prevcount tends to work pretty well and puts the terms
// in the middle of the extract
$prevCount = floor($relLength ... | php | private function extractRelevant($words, $fulltext, $relLength = 300)
{
if (!is_array($words)) {
$words = explode(' ', $words);
}
// 1/6 ratio on prevcount tends to work pretty well and puts the terms
// in the middle of the extract
$prevCount = floor($relLength ... | [
"private",
"function",
"extractRelevant",
"(",
"$",
"words",
",",
"$",
"fulltext",
",",
"$",
"relLength",
"=",
"300",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"words",
")",
")",
"{",
"$",
"words",
"=",
"explode",
"(",
"' '",
",",
"$",
"words... | Center on, and highlight search terms in excerpts.
@see: http://www.boyter.org/2013/04/building-a-search-result-extract-generator-in-php/
@param string|array $words
@param string $fulltext
@param int $relLength
@return string | [
"Center",
"on",
"and",
"highlight",
"search",
"terms",
"in",
"excerpts",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Helpers/Excerpt.php#L232-L277 |
bolt/bolt | src/EventListener/NotFoundListener.php | NotFoundListener.onKernelException | public function onKernelException(GetResponseForExceptionEvent $event)
{
$request = $event->getRequest();
$exception = $event->getException();
if (!$exception instanceof HttpExceptionInterface || Zone::isBackend($request)) {
return;
}
if ($exception->getStatusCode... | php | public function onKernelException(GetResponseForExceptionEvent $event)
{
$request = $event->getRequest();
$exception = $event->getException();
if (!$exception instanceof HttpExceptionInterface || Zone::isBackend($request)) {
return;
}
if ($exception->getStatusCode... | [
"public",
"function",
"onKernelException",
"(",
"GetResponseForExceptionEvent",
"$",
"event",
")",
"{",
"$",
"request",
"=",
"$",
"event",
"->",
"getRequest",
"(",
")",
";",
"$",
"exception",
"=",
"$",
"event",
"->",
"getException",
"(",
")",
";",
"if",
"(... | Render the not found page if on frontend and http exception.
@param GetResponseForExceptionEvent $event | [
"Render",
"the",
"not",
"found",
"page",
"if",
"on",
"frontend",
"and",
"http",
"exception",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/EventListener/NotFoundListener.php#L57-L96 |
bolt/bolt | src/EventListener/NotFoundListener.php | NotFoundListener.renderNotFound | private function renderNotFound(GetResponseForExceptionEvent $event, $template, array $context = [])
{
try {
$html = $this->twig->resolveTemplate($template)->render($context);
$event->setResponse(new Response($html, Response::HTTP_NOT_FOUND));
} catch (RuntimeError $e) {
... | php | private function renderNotFound(GetResponseForExceptionEvent $event, $template, array $context = [])
{
try {
$html = $this->twig->resolveTemplate($template)->render($context);
$event->setResponse(new Response($html, Response::HTTP_NOT_FOUND));
} catch (RuntimeError $e) {
... | [
"private",
"function",
"renderNotFound",
"(",
"GetResponseForExceptionEvent",
"$",
"event",
",",
"$",
"template",
",",
"array",
"$",
"context",
"=",
"[",
"]",
")",
"{",
"try",
"{",
"$",
"html",
"=",
"$",
"this",
"->",
"twig",
"->",
"resolveTemplate",
"(",
... | Render a not found template.
@param GetResponseForExceptionEvent $event
@param string|string[] $template
@param array $context
@throws RuntimeException | [
"Render",
"a",
"not",
"found",
"template",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/EventListener/NotFoundListener.php#L118-L126 |
bolt/bolt | src/Stack.php | Stack.add | public function add($filename, FileInterface &$removed = null)
{
$this->initialize();
$file = $this->matcher->getFile($filename);
if (!$this->isStackable($file)) {
throw new FileNotStackableException($file);
}
array_unshift($this->files, $file);
if (co... | php | public function add($filename, FileInterface &$removed = null)
{
$this->initialize();
$file = $this->matcher->getFile($filename);
if (!$this->isStackable($file)) {
throw new FileNotStackableException($file);
}
array_unshift($this->files, $file);
if (co... | [
"public",
"function",
"add",
"(",
"$",
"filename",
",",
"FileInterface",
"&",
"$",
"removed",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"initialize",
"(",
")",
";",
"$",
"file",
"=",
"$",
"this",
"->",
"matcher",
"->",
"getFile",
"(",
"$",
"filename"... | Add a file to the stack.
@param FileInterface|string $filename the file to add
@param FileInterface|null $removed returns the removed file, if one was removed
@throws FileNotStackableException if file is not stackable
@return FileInterface if filename cannot be matched to filesystem | [
"Add",
"a",
"file",
"to",
"the",
"stack",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Stack.php#L60-L79 |
bolt/bolt | src/Stack.php | Stack.delete | public function delete($filename)
{
$this->initialize();
try {
$file = $this->matcher->getFile($filename);
} catch (FileNotFoundException $e) {
return;
}
foreach ($this->files as $key => $item) {
if ($item->getFullPath() === $file->getFul... | php | public function delete($filename)
{
$this->initialize();
try {
$file = $this->matcher->getFile($filename);
} catch (FileNotFoundException $e) {
return;
}
foreach ($this->files as $key => $item) {
if ($item->getFullPath() === $file->getFul... | [
"public",
"function",
"delete",
"(",
"$",
"filename",
")",
"{",
"$",
"this",
"->",
"initialize",
"(",
")",
";",
"try",
"{",
"$",
"file",
"=",
"$",
"this",
"->",
"matcher",
"->",
"getFile",
"(",
"$",
"filename",
")",
";",
"}",
"catch",
"(",
"FileNot... | Delete a file from the stack.
@param FileInterface|string $filename | [
"Delete",
"a",
"file",
"from",
"the",
"stack",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Stack.php#L86-L104 |
bolt/bolt | src/Stack.php | Stack.contains | public function contains($filename)
{
$this->initialize();
try {
$file = $this->matcher->getFile($filename);
} catch (FileNotFoundException $e) {
return false;
}
foreach ($this->files as $item) {
if ($item->getFullPath() === $file->getFul... | php | public function contains($filename)
{
$this->initialize();
try {
$file = $this->matcher->getFile($filename);
} catch (FileNotFoundException $e) {
return false;
}
foreach ($this->files as $item) {
if ($item->getFullPath() === $file->getFul... | [
"public",
"function",
"contains",
"(",
"$",
"filename",
")",
"{",
"$",
"this",
"->",
"initialize",
"(",
")",
";",
"try",
"{",
"$",
"file",
"=",
"$",
"this",
"->",
"matcher",
"->",
"getFile",
"(",
"$",
"filename",
")",
";",
"}",
"catch",
"(",
"FileN... | Check if a given file is present on the stack.
@param FileInterface|string $filename
@return bool | [
"Check",
"if",
"a",
"given",
"file",
"is",
"present",
"on",
"the",
"stack",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Stack.php#L113-L130 |
bolt/bolt | src/Stack.php | Stack.isStackable | public function isStackable($filename)
{
try {
$file = $this->matcher->getFile($filename);
} catch (FileNotFoundException $e) {
return false;
}
if (!in_array($file->getExtension(), $this->acceptedFileTypes)) {
return false;
}
retu... | php | public function isStackable($filename)
{
try {
$file = $this->matcher->getFile($filename);
} catch (FileNotFoundException $e) {
return false;
}
if (!in_array($file->getExtension(), $this->acceptedFileTypes)) {
return false;
}
retu... | [
"public",
"function",
"isStackable",
"(",
"$",
"filename",
")",
"{",
"try",
"{",
"$",
"file",
"=",
"$",
"this",
"->",
"matcher",
"->",
"getFile",
"(",
"$",
"filename",
")",
";",
"}",
"catch",
"(",
"FileNotFoundException",
"$",
"e",
")",
"{",
"return",
... | Check if a given file can be added to the stack.
Requirements:
- File's extension is accepted
- File can be matched to filesystem
- File is not currently on the stack
@param FileInterface|string $filename
@return bool | [
"Check",
"if",
"a",
"given",
"file",
"can",
"be",
"added",
"to",
"the",
"stack",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Stack.php#L144-L157 |
bolt/bolt | src/Stack.php | Stack.getList | public function getList(array $types = [])
{
$this->initialize();
if (empty($types)) {
return $this->files;
}
$images = in_array('image', $types);
$docs = in_array('document', $types);
$other = in_array('other', $types);
$files = array_filter($th... | php | public function getList(array $types = [])
{
$this->initialize();
if (empty($types)) {
return $this->files;
}
$images = in_array('image', $types);
$docs = in_array('document', $types);
$other = in_array('other', $types);
$files = array_filter($th... | [
"public",
"function",
"getList",
"(",
"array",
"$",
"types",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"initialize",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"types",
")",
")",
"{",
"return",
"$",
"this",
"->",
"files",
";",
"}",
"$",
"im... | Returns the list of files in the stack, filtered by type (if given).
@param string[] $types Filter files by type. Valid types: "image", "document", "other"
@return FileInterface[] | [
"Returns",
"the",
"list",
"of",
"files",
"in",
"the",
"stack",
"filtered",
"by",
"type",
"(",
"if",
"given",
")",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Stack.php#L166-L190 |
bolt/bolt | src/Stack.php | Stack.initialize | private function initialize()
{
if ($this->initialized) {
return;
}
if ($this->session->isStarted() && $this->session->get('stack') !== null) {
$paths = $this->session->get('stack');
$this->files = $this->hydrateList($paths);
} else {
... | php | private function initialize()
{
if ($this->initialized) {
return;
}
if ($this->session->isStarted() && $this->session->get('stack') !== null) {
$paths = $this->session->get('stack');
$this->files = $this->hydrateList($paths);
} else {
... | [
"private",
"function",
"initialize",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"initialized",
")",
"{",
"return",
";",
"}",
"if",
"(",
"$",
"this",
"->",
"session",
"->",
"isStarted",
"(",
")",
"&&",
"$",
"this",
"->",
"session",
"->",
"get",
"(... | Initialize file list for current user, either from session or database. | [
"Initialize",
"file",
"list",
"for",
"current",
"user",
"either",
"from",
"session",
"or",
"database",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Stack.php#L213-L229 |
bolt/bolt | src/Stack.php | Stack.persist | private function persist()
{
$items = $this->persistableList();
$this->session->set('stack', $items);
$user = $this->users->getCurrentUser();
$user['stack'] = $items;
$this->users->saveUser($user);
} | php | private function persist()
{
$items = $this->persistableList();
$this->session->set('stack', $items);
$user = $this->users->getCurrentUser();
$user['stack'] = $items;
$this->users->saveUser($user);
} | [
"private",
"function",
"persist",
"(",
")",
"{",
"$",
"items",
"=",
"$",
"this",
"->",
"persistableList",
"(",
")",
";",
"$",
"this",
"->",
"session",
"->",
"set",
"(",
"'stack'",
",",
"$",
"items",
")",
";",
"$",
"user",
"=",
"$",
"this",
"->",
... | Persist the contents of the current stack to the session, as well as the database. | [
"Persist",
"the",
"contents",
"of",
"the",
"current",
"stack",
"to",
"the",
"session",
"as",
"well",
"as",
"the",
"database",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Stack.php#L234-L243 |
bolt/bolt | src/Stack.php | Stack.hydrateList | private function hydrateList($paths)
{
$files = array_filter(array_map(function ($path) {
try {
return $this->matcher->getFile($path);
} catch (FileNotFoundException $e) {
// Guess it doesn't exist anymore or we can't find it, remove from list.
... | php | private function hydrateList($paths)
{
$files = array_filter(array_map(function ($path) {
try {
return $this->matcher->getFile($path);
} catch (FileNotFoundException $e) {
// Guess it doesn't exist anymore or we can't find it, remove from list.
... | [
"private",
"function",
"hydrateList",
"(",
"$",
"paths",
")",
"{",
"$",
"files",
"=",
"array_filter",
"(",
"array_map",
"(",
"function",
"(",
"$",
"path",
")",
"{",
"try",
"{",
"return",
"$",
"this",
"->",
"matcher",
"->",
"getFile",
"(",
"$",
"path",
... | Converts a list of paths to file objects.
@param string[] $paths
@return FileInterface[] | [
"Converts",
"a",
"list",
"of",
"paths",
"to",
"file",
"objects",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Stack.php#L252-L266 |
bolt/bolt | src/Composer/ScriptHandler.php | ScriptHandler.installAssets | public static function installAssets(Event $event, $checkForCreateProject = true)
{
/*
* Ugly hack to prevent application from being booted before configureProject can be called.
*/
global $argv;
if ($checkForCreateProject && strpos(implode(' ', $argv), 'create-project') > ... | php | public static function installAssets(Event $event, $checkForCreateProject = true)
{
/*
* Ugly hack to prevent application from being booted before configureProject can be called.
*/
global $argv;
if ($checkForCreateProject && strpos(implode(' ', $argv), 'create-project') > ... | [
"public",
"static",
"function",
"installAssets",
"(",
"Event",
"$",
"event",
",",
"$",
"checkForCreateProject",
"=",
"true",
")",
"{",
"/*\n * Ugly hack to prevent application from being booted before configureProject can be called.\n */",
"global",
"$",
"argv",
... | Install Bolt's assets.
This should be ran on "post-install-cmd" and "post-update-cmd" events.
@param Event $event
@param bool $checkForCreateProject | [
"Install",
"Bolt",
"s",
"assets",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/ScriptHandler.php#L28-L42 |
bolt/bolt | src/Composer/ScriptHandler.php | ScriptHandler.installThemesAndFiles | public static function installThemesAndFiles(Event $event)
{
$syncer = DirectorySyncer::fromEvent($event);
$syncer->sync('files', 'files');
$syncer->sync('%vendor%/bolt/themes', 'themes', true, ['base-2016', 'base-2018', 'skeleton']);
} | php | public static function installThemesAndFiles(Event $event)
{
$syncer = DirectorySyncer::fromEvent($event);
$syncer->sync('files', 'files');
$syncer->sync('%vendor%/bolt/themes', 'themes', true, ['base-2016', 'base-2018', 'skeleton']);
} | [
"public",
"static",
"function",
"installThemesAndFiles",
"(",
"Event",
"$",
"event",
")",
"{",
"$",
"syncer",
"=",
"DirectorySyncer",
"::",
"fromEvent",
"(",
"$",
"event",
")",
";",
"$",
"syncer",
"->",
"sync",
"(",
"'files'",
",",
"'files'",
")",
";",
"... | Install Bolt's default themes and files.
This should be ran on "post-create-project-cmd" event.
@param Event $event | [
"Install",
"Bolt",
"s",
"default",
"themes",
"and",
"files",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/ScriptHandler.php#L51-L57 |
bolt/bolt | src/Composer/ScriptHandler.php | ScriptHandler.configureProject | public static function configureProject(Event $event)
{
DirectoryConfigurator::fromEvent($event)->run();
BundleConfigurator::fromEvent($event)->run();
// Install assets here since they they were skipped above
static::installAssets($event, false);
} | php | public static function configureProject(Event $event)
{
DirectoryConfigurator::fromEvent($event)->run();
BundleConfigurator::fromEvent($event)->run();
// Install assets here since they they were skipped above
static::installAssets($event, false);
} | [
"public",
"static",
"function",
"configureProject",
"(",
"Event",
"$",
"event",
")",
"{",
"DirectoryConfigurator",
"::",
"fromEvent",
"(",
"$",
"event",
")",
"->",
"run",
"(",
")",
";",
"BundleConfigurator",
"::",
"fromEvent",
"(",
"$",
"event",
")",
"->",
... | Configures installation's directory structure and default site bundle.
The configured paths & extensions are written to .bolt.yml
and the skeleton structure is modified accordingly.
@param Event $event | [
"Configures",
"installation",
"s",
"directory",
"structure",
"and",
"default",
"site",
"bundle",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/ScriptHandler.php#L77-L84 |
bolt/bolt | src/Composer/ScriptHandler.php | ScriptHandler.runUpdateProjectFromAssets | private static function runUpdateProjectFromAssets(Event $event)
{
if ($event->getName() !== ScriptEvents::POST_UPDATE_CMD) {
return;
}
$updater = new ScriptHandlerUpdater($event);
if (!$updater->needsUpdate()) {
return;
}
$updater->update();... | php | private static function runUpdateProjectFromAssets(Event $event)
{
if ($event->getName() !== ScriptEvents::POST_UPDATE_CMD) {
return;
}
$updater = new ScriptHandlerUpdater($event);
if (!$updater->needsUpdate()) {
return;
}
$updater->update();... | [
"private",
"static",
"function",
"runUpdateProjectFromAssets",
"(",
"Event",
"$",
"event",
")",
"{",
"if",
"(",
"$",
"event",
"->",
"getName",
"(",
")",
"!==",
"ScriptEvents",
"::",
"POST_UPDATE_CMD",
")",
"{",
"return",
";",
"}",
"$",
"updater",
"=",
"new... | Checks if updateProject is in composer.json. If not,
this adds it / shows how to add it, and then runs updateProject.
@param Event $event | [
"Checks",
"if",
"updateProject",
"is",
"in",
"composer",
".",
"json",
".",
"If",
"not",
"this",
"adds",
"it",
"/",
"shows",
"how",
"to",
"add",
"it",
"and",
"then",
"runs",
"updateProject",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/ScriptHandler.php#L92-L106 |
bolt/bolt | src/Embed/GuzzleDispatcher.php | GuzzleDispatcher.dispatch | public function dispatch(Url $url)
{
$result = $this->getGuzzleResponse($url);
return $this->responses[] = new Response(
$url,
Url::create($result['url']),
$result['statusCode'],
$result['contentType'],
$result['content'],
$res... | php | public function dispatch(Url $url)
{
$result = $this->getGuzzleResponse($url);
return $this->responses[] = new Response(
$url,
Url::create($result['url']),
$result['statusCode'],
$result['contentType'],
$result['content'],
$res... | [
"public",
"function",
"dispatch",
"(",
"Url",
"$",
"url",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"getGuzzleResponse",
"(",
"$",
"url",
")",
";",
"return",
"$",
"this",
"->",
"responses",
"[",
"]",
"=",
"new",
"Response",
"(",
"$",
"url",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Embed/GuzzleDispatcher.php#L47-L60 |
bolt/bolt | src/Embed/GuzzleDispatcher.php | GuzzleDispatcher.dispatchImages | public function dispatchImages(array $urls)
{
$responses = [];
$promises = [];
$mimeTypes = [
'image/jpeg',
'image/png',
'image/gif',
'image/bmp',
'image/x-icon',
];
/** @var Url $url */
foreach ($urls as $k... | php | public function dispatchImages(array $urls)
{
$responses = [];
$promises = [];
$mimeTypes = [
'image/jpeg',
'image/png',
'image/gif',
'image/bmp',
'image/x-icon',
];
/** @var Url $url */
foreach ($urls as $k... | [
"public",
"function",
"dispatchImages",
"(",
"array",
"$",
"urls",
")",
"{",
"$",
"responses",
"=",
"[",
"]",
";",
"$",
"promises",
"=",
"[",
"]",
";",
"$",
"mimeTypes",
"=",
"[",
"'image/jpeg'",
",",
"'image/png'",
",",
"'image/gif'",
",",
"'image/bmp'"... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Embed/GuzzleDispatcher.php#L65-L130 |
bolt/bolt | src/Embed/GuzzleDispatcher.php | GuzzleDispatcher.getGuzzleResponse | protected function getGuzzleResponse(Url $url, array $options = [])
{
if (version_compare(Client::VERSION, '6.0.0', '<')) {
/** @deprecated Deprecated since 3.0, to be removed in 4.0. */
$options['allow_redirects'] = [
'max' => 10,
];
$response... | php | protected function getGuzzleResponse(Url $url, array $options = [])
{
if (version_compare(Client::VERSION, '6.0.0', '<')) {
/** @deprecated Deprecated since 3.0, to be removed in 4.0. */
$options['allow_redirects'] = [
'max' => 10,
];
$response... | [
"protected",
"function",
"getGuzzleResponse",
"(",
"Url",
"$",
"url",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"version_compare",
"(",
"Client",
"::",
"VERSION",
",",
"'6.0.0'",
",",
"'<'",
")",
")",
"{",
"/** @deprecated Deprecate... | Execute a Guzzle request, and return an API response.
@param Url $url
@param array $options
@return array | [
"Execute",
"a",
"Guzzle",
"request",
"and",
"return",
"an",
"API",
"response",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Embed/GuzzleDispatcher.php#L140-L171 |
bolt/bolt | src/Embed/GuzzleDispatcher.php | GuzzleDispatcher.getMimeType | private function getMimeType(Psr7\Response $response)
{
$header = $response->getHeader('Content-Type');
if ($header !== []) {
return reset($header);
}
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$mime = finfo_buffer($finfo, $response->getBody()->getContents());
... | php | private function getMimeType(Psr7\Response $response)
{
$header = $response->getHeader('Content-Type');
if ($header !== []) {
return reset($header);
}
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$mime = finfo_buffer($finfo, $response->getBody()->getContents());
... | [
"private",
"function",
"getMimeType",
"(",
"Psr7",
"\\",
"Response",
"$",
"response",
")",
"{",
"$",
"header",
"=",
"$",
"response",
"->",
"getHeader",
"(",
"'Content-Type'",
")",
";",
"if",
"(",
"$",
"header",
"!==",
"[",
"]",
")",
"{",
"return",
"res... | @param Psr7\Response $response
@return string | [
"@param",
"Psr7",
"\\",
"Response",
"$response"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Embed/GuzzleDispatcher.php#L178-L190 |
bolt/bolt | src/Composer/Action/RemovePackage.php | RemovePackage.execute | public function execute(array $packages)
{
if (empty($packages)) {
throw new PackageManagerException('No package specified for removal');
}
/** @var \Bolt\Filesystem\Handler\JsonFile $jsonFile */
$jsonFile = $this->getOptions()->composerJson();
$composerJson = $c... | php | public function execute(array $packages)
{
if (empty($packages)) {
throw new PackageManagerException('No package specified for removal');
}
/** @var \Bolt\Filesystem\Handler\JsonFile $jsonFile */
$jsonFile = $this->getOptions()->composerJson();
$composerJson = $c... | [
"public",
"function",
"execute",
"(",
"array",
"$",
"packages",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"packages",
")",
")",
"{",
"throw",
"new",
"PackageManagerException",
"(",
"'No package specified for removal'",
")",
";",
"}",
"/** @var \\Bolt\\Filesystem\\Ha... | Remove packages from the root install.
@param $packages array Indexed array of package names to remove
@throws \Bolt\Exception\PackageManagerException
@return int 0 on success or a positive error code on failure | [
"Remove",
"packages",
"from",
"the",
"root",
"install",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/Action/RemovePackage.php#L24-L75 |
bolt/bolt | src/DeepDiff.php | DeepDiff.diff | public static function diff($a, $b)
{
Deprecated::method(3.3);
$cls = new \ReflectionClass(RecordChangeHandler::class);
$method = $cls->getMethod('diff');
$method->setAccessible(true);
$obj = $cls->newInstanceWithoutConstructor();
return $method->invoke($obj, $a, $b... | php | public static function diff($a, $b)
{
Deprecated::method(3.3);
$cls = new \ReflectionClass(RecordChangeHandler::class);
$method = $cls->getMethod('diff');
$method->setAccessible(true);
$obj = $cls->newInstanceWithoutConstructor();
return $method->invoke($obj, $a, $b... | [
"public",
"static",
"function",
"diff",
"(",
"$",
"a",
",",
"$",
"b",
")",
"{",
"Deprecated",
"::",
"method",
"(",
"3.3",
")",
";",
"$",
"cls",
"=",
"new",
"\\",
"ReflectionClass",
"(",
"RecordChangeHandler",
"::",
"class",
")",
";",
"$",
"method",
"... | @deprecated since 3.3, to be removed in 4.0.
@param array $a
@param array $b
@return array | [
"@deprecated",
"since",
"3",
".",
"3",
"to",
"be",
"removed",
"in",
"4",
".",
"0",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/DeepDiff.php#L21-L31 |
bolt/bolt | src/EventListener/TemplateViewListener.php | TemplateViewListener.onView | public function onView(GetResponseForControllerResultEvent $event)
{
$result = $event->getControllerResult();
if (!$result instanceof TemplateView) {
return;
}
$response = $this->render($result);
$event->setResponse($response);
} | php | public function onView(GetResponseForControllerResultEvent $event)
{
$result = $event->getControllerResult();
if (!$result instanceof TemplateView) {
return;
}
$response = $this->render($result);
$event->setResponse($response);
} | [
"public",
"function",
"onView",
"(",
"GetResponseForControllerResultEvent",
"$",
"event",
")",
"{",
"$",
"result",
"=",
"$",
"event",
"->",
"getControllerResult",
"(",
")",
";",
"if",
"(",
"!",
"$",
"result",
"instanceof",
"TemplateView",
")",
"{",
"return",
... | If controller result is a TemplateView, convert it to a TemplateResponse.
@param GetResponseForControllerResultEvent $event | [
"If",
"controller",
"result",
"is",
"a",
"TemplateView",
"convert",
"it",
"to",
"a",
"TemplateResponse",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/EventListener/TemplateViewListener.php#L37-L48 |
bolt/bolt | src/EventListener/TemplateViewListener.php | TemplateViewListener.render | public function render(TemplateView $view)
{
$content = $this->twig->render($view->getTemplate(), $view->getContext()->toArray());
$response = new TemplateResponse($view->getTemplate(), $view->getContext(), $content);
return $response;
} | php | public function render(TemplateView $view)
{
$content = $this->twig->render($view->getTemplate(), $view->getContext()->toArray());
$response = new TemplateResponse($view->getTemplate(), $view->getContext(), $content);
return $response;
} | [
"public",
"function",
"render",
"(",
"TemplateView",
"$",
"view",
")",
"{",
"$",
"content",
"=",
"$",
"this",
"->",
"twig",
"->",
"render",
"(",
"$",
"view",
"->",
"getTemplate",
"(",
")",
",",
"$",
"view",
"->",
"getContext",
"(",
")",
"->",
"toArra... | Render TemplateView to a TemplateResponse.
@param TemplateView $view
@return TemplateResponse | [
"Render",
"TemplateView",
"to",
"a",
"TemplateResponse",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/EventListener/TemplateViewListener.php#L57-L64 |
bolt/bolt | src/Provider/DumperServiceProvider.php | DumperServiceProvider.register | public function register(Application $app)
{
$app['dump'] = $app->protect(
function ($var) use ($app) {
if (!$app['debug']) {
return;
}
$app['dumper']->dump($app['dumper.cloner']->cloneVar($var));
}
);
... | php | public function register(Application $app)
{
$app['dump'] = $app->protect(
function ($var) use ($app) {
if (!$app['debug']) {
return;
}
$app['dumper']->dump($app['dumper.cloner']->cloneVar($var));
}
);
... | [
"public",
"function",
"register",
"(",
"Application",
"$",
"app",
")",
"{",
"$",
"app",
"[",
"'dump'",
"]",
"=",
"$",
"app",
"->",
"protect",
"(",
"function",
"(",
"$",
"var",
")",
"use",
"(",
"$",
"app",
")",
"{",
"if",
"(",
"!",
"$",
"app",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Provider/DumperServiceProvider.php#L24-L74 |
bolt/bolt | src/Twig/Runtime/RoutingRuntime.php | RoutingRuntime.editlink | public function editlink($record)
{
$perm = 'contenttype:' . $record->contenttype['slug'] . ':edit:' . $record->id;
if ($this->users->isAllowed($perm)) {
return $this->urlGenerator->generate('editcontent', ['contenttypeslug' => $record->contenttype['slug'], 'id' => $record->id]);
... | php | public function editlink($record)
{
$perm = 'contenttype:' . $record->contenttype['slug'] . ':edit:' . $record->id;
if ($this->users->isAllowed($perm)) {
return $this->urlGenerator->generate('editcontent', ['contenttypeslug' => $record->contenttype['slug'], 'id' => $record->id]);
... | [
"public",
"function",
"editlink",
"(",
"$",
"record",
")",
"{",
"$",
"perm",
"=",
"'contenttype:'",
".",
"$",
"record",
"->",
"contenttype",
"[",
"'slug'",
"]",
".",
"':edit:'",
".",
"$",
"record",
"->",
"id",
";",
"if",
"(",
"$",
"this",
"->",
"user... | Generate a backend edit link for a given record if the user has the permission
@param $record
@return bool | [
"Generate",
"a",
"backend",
"edit",
"link",
"for",
"a",
"given",
"record",
"if",
"the",
"user",
"has",
"the",
"permission"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/Runtime/RoutingRuntime.php#L69-L78 |
bolt/bolt | src/Twig/Runtime/RoutingRuntime.php | RoutingRuntime.htmlLang | public function htmlLang()
{
$request = $this->requestStack->getCurrentRequest();
$locale = $request ? $request->getLocale() : $this->locale;
return str_replace('_', '-', $locale);
} | php | public function htmlLang()
{
$request = $this->requestStack->getCurrentRequest();
$locale = $request ? $request->getLocale() : $this->locale;
return str_replace('_', '-', $locale);
} | [
"public",
"function",
"htmlLang",
"(",
")",
"{",
"$",
"request",
"=",
"$",
"this",
"->",
"requestStack",
"->",
"getCurrentRequest",
"(",
")",
";",
"$",
"locale",
"=",
"$",
"request",
"?",
"$",
"request",
"->",
"getLocale",
"(",
")",
":",
"$",
"this",
... | Returns the language value for in tags where the language attribute is
required. The underscore '_' in the locale will be replaced with a
hyphen '-'.
@return string | [
"Returns",
"the",
"language",
"value",
"for",
"in",
"tags",
"where",
"the",
"language",
"attribute",
"is",
"required",
".",
"The",
"underscore",
"_",
"in",
"the",
"locale",
"will",
"be",
"replaced",
"with",
"a",
"hyphen",
"-",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/Runtime/RoutingRuntime.php#L87-L93 |
bolt/bolt | src/Twig/Runtime/RoutingRuntime.php | RoutingRuntime.isMobileClient | public function isMobileClient()
{
$request = $this->requestStack->getCurrentRequest();
if ($request === null) {
return false;
}
return preg_match(
'/(android|blackberry|htc|iemobile|iphone|ipad|ipaq|ipod|nokia|playbook|smartphone)/i',
$request->h... | php | public function isMobileClient()
{
$request = $this->requestStack->getCurrentRequest();
if ($request === null) {
return false;
}
return preg_match(
'/(android|blackberry|htc|iemobile|iphone|ipad|ipaq|ipod|nokia|playbook|smartphone)/i',
$request->h... | [
"public",
"function",
"isMobileClient",
"(",
")",
"{",
"$",
"request",
"=",
"$",
"this",
"->",
"requestStack",
"->",
"getCurrentRequest",
"(",
")",
";",
"if",
"(",
"$",
"request",
"===",
"null",
")",
"{",
"return",
"false",
";",
"}",
"return",
"preg_matc... | Check if the page is viewed on a mobile device.
@return bool | [
"Check",
"if",
"the",
"page",
"is",
"viewed",
"on",
"a",
"mobile",
"device",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/Runtime/RoutingRuntime.php#L100-L111 |
bolt/bolt | src/Twig/Runtime/RoutingRuntime.php | RoutingRuntime.request | public function request($parameter, $from = '', $stripSlashes = false)
{
$request = $this->requestStack->getCurrentRequest();
if ($request === null) {
return null;
}
$from = strtoupper($from);
if ($from === 'GET') {
$value = $request->query->get($par... | php | public function request($parameter, $from = '', $stripSlashes = false)
{
$request = $this->requestStack->getCurrentRequest();
if ($request === null) {
return null;
}
$from = strtoupper($from);
if ($from === 'GET') {
$value = $request->query->get($par... | [
"public",
"function",
"request",
"(",
"$",
"parameter",
",",
"$",
"from",
"=",
"''",
",",
"$",
"stripSlashes",
"=",
"false",
")",
"{",
"$",
"request",
"=",
"$",
"this",
"->",
"requestStack",
"->",
"getCurrentRequest",
"(",
")",
";",
"if",
"(",
"$",
"... | Return the requested parameter from $_REQUEST, $_GET or $_POST.
@param string $parameter The parameter to get
@param string $from 'GET' or 'POST', all the others falls back to REQUEST
@param bool $stripSlashes Apply stripslashes. Defaults to false.
@return mixed | [
"Return",
"the",
"requested",
"parameter",
"from",
"$_REQUEST",
"$_GET",
"or",
"$_POST",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/Runtime/RoutingRuntime.php#L136-L158 |
bolt/bolt | src/Legacy/BaseExtension.php | BaseExtension.getComposerJSON | public function getComposerJSON()
{
if (!$this->composerJsonLoaded && !$this->composerJson) {
$this->composerJsonLoaded = true;
$this->composerJson = null;
$jsonFile = new JsonFile(__DIR__ . '/composer.json');
if ($jsonFile->exists()) {
$this->... | php | public function getComposerJSON()
{
if (!$this->composerJsonLoaded && !$this->composerJson) {
$this->composerJsonLoaded = true;
$this->composerJson = null;
$jsonFile = new JsonFile(__DIR__ . '/composer.json');
if ($jsonFile->exists()) {
$this->... | [
"public",
"function",
"getComposerJSON",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"composerJsonLoaded",
"&&",
"!",
"$",
"this",
"->",
"composerJson",
")",
"{",
"$",
"this",
"->",
"composerJsonLoaded",
"=",
"true",
";",
"$",
"this",
"->",
"compos... | Get the contents of the extension's composer.json file, lazy-loading
as needed. | [
"Get",
"the",
"contents",
"of",
"the",
"extension",
"s",
"composer",
".",
"json",
"file",
"lazy",
"-",
"loading",
"as",
"needed",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Legacy/BaseExtension.php#L84-L96 |
bolt/bolt | src/Legacy/BaseExtension.php | BaseExtension.setComposerConfiguration | public function setComposerConfiguration(array $configuration)
{
$this->composerJsonLoaded = true;
$this->composerJson = null;
$this->composerJson = $configuration;
return $this->composerJson;
} | php | public function setComposerConfiguration(array $configuration)
{
$this->composerJsonLoaded = true;
$this->composerJson = null;
$this->composerJson = $configuration;
return $this->composerJson;
} | [
"public",
"function",
"setComposerConfiguration",
"(",
"array",
"$",
"configuration",
")",
"{",
"$",
"this",
"->",
"composerJsonLoaded",
"=",
"true",
";",
"$",
"this",
"->",
"composerJson",
"=",
"null",
";",
"$",
"this",
"->",
"composerJson",
"=",
"$",
"conf... | This allows write access to the composer config, allowing simulation of this feature
even if the extension doesn't have a physical composer.json file.
@param array $configuration
@return array | [
"This",
"allows",
"write",
"access",
"to",
"the",
"composer",
"config",
"allowing",
"simulation",
"of",
"this",
"feature",
"even",
"if",
"the",
"extension",
"doesn",
"t",
"have",
"a",
"physical",
"composer",
".",
"json",
"file",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Legacy/BaseExtension.php#L106-L113 |
bolt/bolt | src/Legacy/BaseExtension.php | BaseExtension.getExtensionConfig | public function getExtensionConfig()
{
if (!is_array($this->extensionConfig)) {
$composerjson = $this->getComposerJSON();
if (is_array($composerjson)) {
$this->extensionConfig = [
strtolower($composerjson['name']) => [
'name... | php | public function getExtensionConfig()
{
if (!is_array($this->extensionConfig)) {
$composerjson = $this->getComposerJSON();
if (is_array($composerjson)) {
$this->extensionConfig = [
strtolower($composerjson['name']) => [
'name... | [
"public",
"function",
"getExtensionConfig",
"(",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"this",
"->",
"extensionConfig",
")",
")",
"{",
"$",
"composerjson",
"=",
"$",
"this",
"->",
"getComposerJSON",
"(",
")",
";",
"if",
"(",
"is_array",
"(",
... | Builds an array suitable for conversion to JSON, which in turn will end
up in a consolidated JSON file containing the configurations of all
installed extensions. | [
"Builds",
"an",
"array",
"suitable",
"for",
"conversion",
"to",
"JSON",
"which",
"in",
"turn",
"will",
"end",
"up",
"in",
"a",
"consolidated",
"JSON",
"file",
"containing",
"the",
"configurations",
"of",
"all",
"installed",
"extensions",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Legacy/BaseExtension.php#L120-L142 |
bolt/bolt | src/Legacy/BaseExtension.php | BaseExtension.getSnippets | public function getSnippets()
{
$snippets = [];
foreach ($this->app['asset.queue.snippet']->getQueue() as $snippet) {
$snippets[] = (string) $snippet;
}
return $snippets;
} | php | public function getSnippets()
{
$snippets = [];
foreach ($this->app['asset.queue.snippet']->getQueue() as $snippet) {
$snippets[] = (string) $snippet;
}
return $snippets;
} | [
"public",
"function",
"getSnippets",
"(",
")",
"{",
"$",
"snippets",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"app",
"[",
"'asset.queue.snippet'",
"]",
"->",
"getQueue",
"(",
")",
"as",
"$",
"snippet",
")",
"{",
"$",
"snippets",
"[",
"]... | Return the available Snippets, used in \Bolt\Extensions.
@deprecated Deprecated since 3.0, to be removed in 4.0. Use $app['asset.queue.snippet']->getQueue()
@return array | [
"Return",
"the",
"available",
"Snippets",
"used",
"in",
"\\",
"Bolt",
"\\",
"Extensions",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Legacy/BaseExtension.php#L162-L170 |
bolt/bolt | src/Legacy/BaseExtension.php | BaseExtension.parseSnippet | public function parseSnippet($callback, $var1 = '', $var2 = '', $var3 = '')
{
if (method_exists($this, $callback)) {
return call_user_func([$this, $callback], $var1, $var2, $var3);
}
return false;
} | php | public function parseSnippet($callback, $var1 = '', $var2 = '', $var3 = '')
{
if (method_exists($this, $callback)) {
return call_user_func([$this, $callback], $var1, $var2, $var3);
}
return false;
} | [
"public",
"function",
"parseSnippet",
"(",
"$",
"callback",
",",
"$",
"var1",
"=",
"''",
",",
"$",
"var2",
"=",
"''",
",",
"$",
"var3",
"=",
"''",
")",
"{",
"if",
"(",
"method_exists",
"(",
"$",
"this",
",",
"$",
"callback",
")",
")",
"{",
"retur... | Parse a snippet, an pass on the generated HTML to the caller (Extensions).
@deprecated Deprecated since 3.0, to be removed in 4.0.
@param string $callback
@param string $var1
@param string $var2
@param string $var3
@return bool|string | [
"Parse",
"a",
"snippet",
"an",
"pass",
"on",
"the",
"generated",
"HTML",
"to",
"the",
"caller",
"(",
"Extensions",
")",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Legacy/BaseExtension.php#L212-L219 |
bolt/bolt | src/Controller/Async/Stack.php | Stack.add | public function add(Request $request)
{
$fileName = $request->request->get('filename');
$stack = $this->app['stack'];
$twig = $this->app['twig'];
/** @var FileInterface|null $removed */
$file = $stack->add($fileName, $removed);
$type = $file->getType();
$type... | php | public function add(Request $request)
{
$fileName = $request->request->get('filename');
$stack = $this->app['stack'];
$twig = $this->app['twig'];
/** @var FileInterface|null $removed */
$file = $stack->add($fileName, $removed);
$type = $file->getType();
$type... | [
"public",
"function",
"add",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"fileName",
"=",
"$",
"request",
"->",
"request",
"->",
"get",
"(",
"'filename'",
")",
";",
"$",
"stack",
"=",
"$",
"this",
"->",
"app",
"[",
"'stack'",
"]",
";",
"$",
"twi... | Add a file to the user's stack.
@param Request $request
@return JsonResponse | [
"Add",
"a",
"file",
"to",
"the",
"user",
"s",
"stack",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Async/Stack.php#L37-L56 |
bolt/bolt | src/Controller/Async/Stack.php | Stack.show | public function show(Request $request)
{
$count = $request->query->get('count', \Bolt\Stack::MAX_ITEMS);
$options = $request->query->get('options');
if ($options === 'ck') {
$template = '@bolt/components/stack/ck.twig';
} elseif ($options === 'list') {
$templ... | php | public function show(Request $request)
{
$count = $request->query->get('count', \Bolt\Stack::MAX_ITEMS);
$options = $request->query->get('options');
if ($options === 'ck') {
$template = '@bolt/components/stack/ck.twig';
} elseif ($options === 'list') {
$templ... | [
"public",
"function",
"show",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"count",
"=",
"$",
"request",
"->",
"query",
"->",
"get",
"(",
"'count'",
",",
"\\",
"Bolt",
"\\",
"Stack",
"::",
"MAX_ITEMS",
")",
";",
"$",
"options",
"=",
"$",
"request",... | Render a user's current stack.
@param Request $request
@return TemplateResponse | [
"Render",
"a",
"user",
"s",
"current",
"stack",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Async/Stack.php#L65-L86 |
bolt/bolt | src/Storage/Field/Type/FieldTypeBase.php | FieldTypeBase.persist | public function persist(QuerySet $queries, $entity)
{
$attribute = $this->getMappingAttribute();
$key = $this->mapping['fieldname'];
$qb = &$queries[0];
$valueMethod = 'serialize' . ucfirst($this->camelize($attribute));
$value = $entity->$valueMethod();
if ($this in... | php | public function persist(QuerySet $queries, $entity)
{
$attribute = $this->getMappingAttribute();
$key = $this->mapping['fieldname'];
$qb = &$queries[0];
$valueMethod = 'serialize' . ucfirst($this->camelize($attribute));
$value = $entity->$valueMethod();
if ($this in... | [
"public",
"function",
"persist",
"(",
"QuerySet",
"$",
"queries",
",",
"$",
"entity",
")",
"{",
"$",
"attribute",
"=",
"$",
"this",
"->",
"getMappingAttribute",
"(",
")",
";",
"$",
"key",
"=",
"$",
"this",
"->",
"mapping",
"[",
"'fieldname'",
"]",
";",... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Field/Type/FieldTypeBase.php#L89-L113 |
bolt/bolt | src/Storage/Field/Type/FieldTypeBase.php | FieldTypeBase.hydrate | public function hydrate($data, $entity)
{
$key = $this->mapping['fieldname'];
$type = $this->getStorageTypeObject();
$val = isset($data[$key]) ? $data[$key] : null;
if ($val !== null) {
$value = $type->convertToPHPValue($val, $this->getPlatform());
$this->set(... | php | public function hydrate($data, $entity)
{
$key = $this->mapping['fieldname'];
$type = $this->getStorageTypeObject();
$val = isset($data[$key]) ? $data[$key] : null;
if ($val !== null) {
$value = $type->convertToPHPValue($val, $this->getPlatform());
$this->set(... | [
"public",
"function",
"hydrate",
"(",
"$",
"data",
",",
"$",
"entity",
")",
"{",
"$",
"key",
"=",
"$",
"this",
"->",
"mapping",
"[",
"'fieldname'",
"]",
";",
"$",
"type",
"=",
"$",
"this",
"->",
"getStorageTypeObject",
"(",
")",
";",
"$",
"val",
"=... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Field/Type/FieldTypeBase.php#L118-L127 |
bolt/bolt | src/Storage/Field/Type/FieldTypeBase.php | FieldTypeBase.set | public function set($entity, $value)
{
$key = $this->mapping['fieldname'];
if ($value === null && isset($this->mapping['data']['default'])) {
$value = $this->mapping['data']['default'];
}
$entity->$key = $value;
} | php | public function set($entity, $value)
{
$key = $this->mapping['fieldname'];
if ($value === null && isset($this->mapping['data']['default'])) {
$value = $this->mapping['data']['default'];
}
$entity->$key = $value;
} | [
"public",
"function",
"set",
"(",
"$",
"entity",
",",
"$",
"value",
")",
"{",
"$",
"key",
"=",
"$",
"this",
"->",
"mapping",
"[",
"'fieldname'",
"]",
";",
"if",
"(",
"$",
"value",
"===",
"null",
"&&",
"isset",
"(",
"$",
"this",
"->",
"mapping",
"... | The set method takes a raw php value and performs the conversion to the entity value.
Normally this is as simple as $entity->$key = $value although more complicated transforms
can happen should a field type choose to override this method.
Note too that this will also be the default method called for an entity builder ... | [
"The",
"set",
"method",
"takes",
"a",
"raw",
"php",
"value",
"and",
"performs",
"the",
"conversion",
"to",
"the",
"entity",
"value",
".",
"Normally",
"this",
"is",
"as",
"simple",
"as",
"$entity",
"-",
">",
"$key",
"=",
"$value",
"although",
"more",
"com... | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Field/Type/FieldTypeBase.php#L140-L147 |
bolt/bolt | src/Storage/Field/Type/FieldTypeBase.php | FieldTypeBase.get | public function get($entity)
{
$key = $this->mapping['fieldname'];
$valueMethod = 'get' . ucfirst($key);
$value = $entity->$valueMethod();
return $value;
} | php | public function get($entity)
{
$key = $this->mapping['fieldname'];
$valueMethod = 'get' . ucfirst($key);
$value = $entity->$valueMethod();
return $value;
} | [
"public",
"function",
"get",
"(",
"$",
"entity",
")",
"{",
"$",
"key",
"=",
"$",
"this",
"->",
"mapping",
"[",
"'fieldname'",
"]",
";",
"$",
"valueMethod",
"=",
"'get'",
".",
"ucfirst",
"(",
"$",
"key",
")",
";",
"$",
"value",
"=",
"$",
"entity",
... | Reads the current value of the field from an entity and returns value.
@param $entity
@return mixed | [
"Reads",
"the",
"current",
"value",
"of",
"the",
"field",
"from",
"an",
"entity",
"and",
"returns",
"value",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Field/Type/FieldTypeBase.php#L156-L163 |
bolt/bolt | src/Storage/Field/Type/FieldTypeBase.php | FieldTypeBase.getStorageTypeObject | protected function getStorageTypeObject()
{
$type = $this->getStorageType();
if (is_string($type)) {
$type = Type::getType($type);
}
return $type;
} | php | protected function getStorageTypeObject()
{
$type = $this->getStorageType();
if (is_string($type)) {
$type = Type::getType($type);
}
return $type;
} | [
"protected",
"function",
"getStorageTypeObject",
"(",
")",
"{",
"$",
"type",
"=",
"$",
"this",
"->",
"getStorageType",
"(",
")",
";",
"if",
"(",
"is_string",
"(",
"$",
"type",
")",
")",
"{",
"$",
"type",
"=",
"Type",
"::",
"getType",
"(",
"$",
"type"... | Helper method to bridge compatibility between old and new Field interfaces. Previously a string storage
type was allowed whereas new behaviour is to expect a Type object.
@return Type | [
"Helper",
"method",
"to",
"bridge",
"compatibility",
"between",
"old",
"and",
"new",
"Field",
"interfaces",
".",
"Previously",
"a",
"string",
"storage",
"type",
"was",
"allowed",
"whereas",
"new",
"behaviour",
"is",
"to",
"expect",
"a",
"Type",
"object",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Field/Type/FieldTypeBase.php#L196-L204 |
bolt/bolt | src/Legacy/Content.php | Content.setContenttype | public function setContenttype($contenttype)
{
if (is_string($contenttype)) {
$contenttype = $this->app['storage']->getContenttype($contenttype);
}
$this->contenttype = $contenttype;
} | php | public function setContenttype($contenttype)
{
if (is_string($contenttype)) {
$contenttype = $this->app['storage']->getContenttype($contenttype);
}
$this->contenttype = $contenttype;
} | [
"public",
"function",
"setContenttype",
"(",
"$",
"contenttype",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"contenttype",
")",
")",
"{",
"$",
"contenttype",
"=",
"$",
"this",
"->",
"app",
"[",
"'storage'",
"]",
"->",
"getContenttype",
"(",
"$",
"conten... | Set the Contenttype for the record.
@param array|string $contenttype | [
"Set",
"the",
"Contenttype",
"for",
"the",
"record",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Legacy/Content.php#L127-L134 |
bolt/bolt | src/Legacy/Content.php | Content.getDecodedValue | public function getDecodedValue($name)
{
$value = null;
if (isset($this->values[$name])) {
$fieldtype = $this->fieldType($name);
$fieldinfo = $this->fieldInfo($name);
$allowtwig = !empty($fieldinfo['allowtwig']);
switch ($fieldtype) {
... | php | public function getDecodedValue($name)
{
$value = null;
if (isset($this->values[$name])) {
$fieldtype = $this->fieldType($name);
$fieldinfo = $this->fieldInfo($name);
$allowtwig = !empty($fieldinfo['allowtwig']);
switch ($fieldtype) {
... | [
"public",
"function",
"getDecodedValue",
"(",
"$",
"name",
")",
"{",
"$",
"value",
"=",
"null",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"values",
"[",
"$",
"name",
"]",
")",
")",
"{",
"$",
"fieldtype",
"=",
"$",
"this",
"->",
"fieldType",
... | Get the decoded version of a value of the current object.
@param string $name name of the value to get
@return mixed The decoded value or null when no value available | [
"Get",
"the",
"decoded",
"version",
"of",
"a",
"value",
"of",
"the",
"current",
"object",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Legacy/Content.php#L143-L196 |
bolt/bolt | src/Legacy/Content.php | Content.preParse | public function preParse($snippet, $allowtwig)
{
// Quickly verify that we actually need to parse the snippet!
if (!$allowtwig || !preg_match('/[{][{%#]/', $snippet)) {
return $snippet;
}
// Don't parse Twig for live editor.
$request = $this->app['request_stack']... | php | public function preParse($snippet, $allowtwig)
{
// Quickly verify that we actually need to parse the snippet!
if (!$allowtwig || !preg_match('/[{][{%#]/', $snippet)) {
return $snippet;
}
// Don't parse Twig for live editor.
$request = $this->app['request_stack']... | [
"public",
"function",
"preParse",
"(",
"$",
"snippet",
",",
"$",
"allowtwig",
")",
"{",
"// Quickly verify that we actually need to parse the snippet!",
"if",
"(",
"!",
"$",
"allowtwig",
"||",
"!",
"preg_match",
"(",
"'/[{][{%#]/'",
",",
"$",
"snippet",
")",
")",
... | If passed snippet contains Twig tags, parse the string as Twig, and return the results.
@param string $snippet
@param boolean $allowtwig
@return string | [
"If",
"passed",
"snippet",
"contains",
"Twig",
"tags",
"parse",
"the",
"string",
"as",
"Twig",
"and",
"return",
"the",
"results",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Legacy/Content.php#L236-L254 |
bolt/bolt | src/Legacy/Content.php | Content.previous | public function previous($field = 'datepublish', $where = [])
{
list($field, $asc) = $this->app['storage']->getSortOrder($field);
$operator = $asc ? '<' : '>';
$order = $asc ? ' DESC' : ' ASC';
$value = isset($this->values[$field]) ? $this->values[$field] : null;
$params = ... | php | public function previous($field = 'datepublish', $where = [])
{
list($field, $asc) = $this->app['storage']->getSortOrder($field);
$operator = $asc ? '<' : '>';
$order = $asc ? ' DESC' : ' ASC';
$value = isset($this->values[$field]) ? $this->values[$field] : null;
$params = ... | [
"public",
"function",
"previous",
"(",
"$",
"field",
"=",
"'datepublish'",
",",
"$",
"where",
"=",
"[",
"]",
")",
"{",
"list",
"(",
"$",
"field",
",",
"$",
"asc",
")",
"=",
"$",
"this",
"->",
"app",
"[",
"'storage'",
"]",
"->",
"getSortOrder",
"(",... | Get the previous record. In this case 'previous' is defined as 'latest one published before
this one' by default. You can pass a parameter like 'id' or '-title' to use that as
the column to sort on.
@param string $field
@param array $where
@return \Bolt\Legacy\Content | [
"Get",
"the",
"previous",
"record",
".",
"In",
"this",
"case",
"previous",
"is",
"defined",
"as",
"latest",
"one",
"published",
"before",
"this",
"one",
"by",
"default",
".",
"You",
"can",
"pass",
"a",
"parameter",
"like",
"id",
"or",
"-",
"title",
"to",... | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Legacy/Content.php#L294-L314 |
bolt/bolt | src/Storage/Database/Schema/Builder/BaseTables.php | BaseTables.getSchemaTables | public function getSchemaTables(Schema $schema)
{
$tables = [];
foreach ($this->tables->keys() as $name) {
/** @var BaseTable $table */
$table = $this->tables[$name];
$tables[$name] = $table->buildTable($schema, $name, $this->charset, $this->collate);
}
... | php | public function getSchemaTables(Schema $schema)
{
$tables = [];
foreach ($this->tables->keys() as $name) {
/** @var BaseTable $table */
$table = $this->tables[$name];
$tables[$name] = $table->buildTable($schema, $name, $this->charset, $this->collate);
}
... | [
"public",
"function",
"getSchemaTables",
"(",
"Schema",
"$",
"schema",
")",
"{",
"$",
"tables",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"tables",
"->",
"keys",
"(",
")",
"as",
"$",
"name",
")",
"{",
"/** @var BaseTable $table */",
"$",
"... | Build the schema for base Bolt tables.
@param Schema $schema
@return \Doctrine\DBAL\Schema\Table[] | [
"Build",
"the",
"schema",
"for",
"base",
"Bolt",
"tables",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Database/Schema/Builder/BaseTables.php#L22-L32 |
bolt/bolt | src/Helpers/Deprecated.php | Deprecated.service | public static function service($name, $since = null, $suggest = '')
{
if ($suggest && preg_match('/\s/', $suggest) === 0) {
$suggest = sprintf("Use \$app['%s'] instead.", $suggest);
}
static::warn(sprintf("Accessing \$app['%s']", $name), $since, $suggest);
} | php | public static function service($name, $since = null, $suggest = '')
{
if ($suggest && preg_match('/\s/', $suggest) === 0) {
$suggest = sprintf("Use \$app['%s'] instead.", $suggest);
}
static::warn(sprintf("Accessing \$app['%s']", $name), $since, $suggest);
} | [
"public",
"static",
"function",
"service",
"(",
"$",
"name",
",",
"$",
"since",
"=",
"null",
",",
"$",
"suggest",
"=",
"''",
")",
"{",
"if",
"(",
"$",
"suggest",
"&&",
"preg_match",
"(",
"'/\\s/'",
",",
"$",
"suggest",
")",
"===",
"0",
")",
"{",
... | Shortcut for triggering a deprecation warning for a DI service.
Example:
Deprecated::service('foo', 3.3, 'bar'); // triggers warning: "Accessing $app['foo'] is deprecated since 3.3 and will be removed in 4.0. Use $app['bar'] instead."
@param string $name the service that is deprecated
@param float|null $since ... | [
"Shortcut",
"for",
"triggering",
"a",
"deprecation",
"warning",
"for",
"a",
"DI",
"service",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Helpers/Deprecated.php#L22-L29 |
bolt/bolt | src/EventListener/SnippetListener.php | SnippetListener.onResponse | public function onResponse(FilterResponseEvent $event)
{
if (!$event->isMasterRequest()) {
return;
}
$request = $event->getRequest();
if (Zone::isAsync($request) || $request->isXmlHttpRequest()) {
return;
}
$response = $event->getResponse();
... | php | public function onResponse(FilterResponseEvent $event)
{
if (!$event->isMasterRequest()) {
return;
}
$request = $event->getRequest();
if (Zone::isAsync($request) || $request->isXmlHttpRequest()) {
return;
}
$response = $event->getResponse();
... | [
"public",
"function",
"onResponse",
"(",
"FilterResponseEvent",
"$",
"event",
")",
"{",
"if",
"(",
"!",
"$",
"event",
"->",
"isMasterRequest",
"(",
")",
")",
"{",
"return",
";",
"}",
"$",
"request",
"=",
"$",
"event",
"->",
"getRequest",
"(",
")",
";",... | Callback for response event.
@param FilterResponseEvent $event | [
"Callback",
"for",
"response",
"event",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/EventListener/SnippetListener.php#L49-L73 |
bolt/bolt | src/EventListener/SnippetListener.php | SnippetListener.addSnippets | protected function addSnippets()
{
$queue = null;
foreach ($this->queues as $q) {
if ($q instanceof SnippetQueue) {
$queue = $q;
break;
}
}
if (!$queue) {
return;
}
$generatorSnippet = (new Snippet()... | php | protected function addSnippets()
{
$queue = null;
foreach ($this->queues as $q) {
if ($q instanceof SnippetQueue) {
$queue = $q;
break;
}
}
if (!$queue) {
return;
}
$generatorSnippet = (new Snippet()... | [
"protected",
"function",
"addSnippets",
"(",
")",
"{",
"$",
"queue",
"=",
"null",
";",
"foreach",
"(",
"$",
"this",
"->",
"queues",
"as",
"$",
"q",
")",
"{",
"if",
"(",
"$",
"q",
"instanceof",
"SnippetQueue",
")",
"{",
"$",
"queue",
"=",
"$",
"q",
... | Add base snippets to the response. | [
"Add",
"base",
"snippets",
"to",
"the",
"response",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/EventListener/SnippetListener.php#L78-L113 |
bolt/bolt | src/EventListener/SnippetListener.php | SnippetListener.encode | protected function encode($str)
{
$args = func_get_args();
array_shift($args);
$args = array_map(
function ($str) {
return htmlspecialchars($str, ENT_QUOTES);
},
$args
);
array_unshift($args, $str);
return call_user... | php | protected function encode($str)
{
$args = func_get_args();
array_shift($args);
$args = array_map(
function ($str) {
return htmlspecialchars($str, ENT_QUOTES);
},
$args
);
array_unshift($args, $str);
return call_user... | [
"protected",
"function",
"encode",
"(",
"$",
"str",
")",
"{",
"$",
"args",
"=",
"func_get_args",
"(",
")",
";",
"array_shift",
"(",
"$",
"args",
")",
";",
"$",
"args",
"=",
"array_map",
"(",
"function",
"(",
"$",
"str",
")",
"{",
"return",
"htmlspeci... | Encode the snippet string and make it HTML safe.
@param string $str
@return string | [
"Encode",
"the",
"snippet",
"string",
"and",
"make",
"it",
"HTML",
"safe",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/EventListener/SnippetListener.php#L122-L135 |
bolt/bolt | src/Form/BoltExtension.php | BoltExtension.loadTypes | protected function loadTypes()
{
return [
// User editing fields
new FieldType\UserRoleType($this->app['session'], $this->app['permissions']),
// Form
new FormType\UserEditType(),
new FormType\UserLoginType(),
new FormType\UserNewType(... | php | protected function loadTypes()
{
return [
// User editing fields
new FieldType\UserRoleType($this->app['session'], $this->app['permissions']),
// Form
new FormType\UserEditType(),
new FormType\UserLoginType(),
new FormType\UserNewType(... | [
"protected",
"function",
"loadTypes",
"(",
")",
"{",
"return",
"[",
"// User editing fields",
"new",
"FieldType",
"\\",
"UserRoleType",
"(",
"$",
"this",
"->",
"app",
"[",
"'session'",
"]",
",",
"$",
"this",
"->",
"app",
"[",
"'permissions'",
"]",
")",
","... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Form/BoltExtension.php#L26-L38 |
bolt/bolt | src/Storage/Mapping/ContentTypeTitleTrait.php | ContentTypeTitleTrait.getTitleColumnName | protected function getTitleColumnName($contentType)
{
Deprecated::method();
$names = $this->getTitleColumnNames($contentType);
return reset($names);
} | php | protected function getTitleColumnName($contentType)
{
Deprecated::method();
$names = $this->getTitleColumnNames($contentType);
return reset($names);
} | [
"protected",
"function",
"getTitleColumnName",
"(",
"$",
"contentType",
")",
"{",
"Deprecated",
"::",
"method",
"(",
")",
";",
"$",
"names",
"=",
"$",
"this",
"->",
"getTitleColumnNames",
"(",
"$",
"contentType",
")",
";",
"return",
"reset",
"(",
"$",
"nam... | Get the likely column name of the title.
@param ContentType|array $contentType
@return string | [
"Get",
"the",
"likely",
"column",
"name",
"of",
"the",
"title",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Mapping/ContentTypeTitleTrait.php#L23-L30 |
bolt/bolt | src/Storage/Mapping/ContentTypeTitleTrait.php | ContentTypeTitleTrait.getTitleColumnNames | protected function getTitleColumnNames($contentType)
{
Deprecated::method();
// If we specified a specific field name or array of field names as 'title'.
if (!empty($contentType['title_format'])) {
return (array) $contentType['title_format'];
}
$names = [
... | php | protected function getTitleColumnNames($contentType)
{
Deprecated::method();
// If we specified a specific field name or array of field names as 'title'.
if (!empty($contentType['title_format'])) {
return (array) $contentType['title_format'];
}
$names = [
... | [
"protected",
"function",
"getTitleColumnNames",
"(",
"$",
"contentType",
")",
"{",
"Deprecated",
"::",
"method",
"(",
")",
";",
"// If we specified a specific field name or array of field names as 'title'.",
"if",
"(",
"!",
"empty",
"(",
"$",
"contentType",
"[",
"'title... | Get an array of the column name(s) of the title.
@param ContentType|array $contentType
@return array | [
"Get",
"an",
"array",
"of",
"the",
"column",
"name",
"(",
"s",
")",
"of",
"the",
"title",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Mapping/ContentTypeTitleTrait.php#L39-L73 |
bolt/bolt | src/Application.php | Application.run | public function run(Request $request = null)
{
if (!$this->booted) {
$this->boot();
}
if ($this['config']->get('general/caching/request')) {
$this['http_cache']->run($request);
} else {
parent::run($request);
}
} | php | public function run(Request $request = null)
{
if (!$this->booted) {
$this->boot();
}
if ($this['config']->get('general/caching/request')) {
$this['http_cache']->run($request);
} else {
parent::run($request);
}
} | [
"public",
"function",
"run",
"(",
"Request",
"$",
"request",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"booted",
")",
"{",
"$",
"this",
"->",
"boot",
"(",
")",
";",
"}",
"if",
"(",
"$",
"this",
"[",
"'config'",
"]",
"->",
"get",... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Application.php#L88-L99 |
bolt/bolt | src/Application.php | Application.initRendering | public function initRendering()
{
$this
->register(new Provider\TwigServiceProvider())
->register(new Provider\RenderServiceProvider())
->register(new Silex\Provider\HttpCacheServiceProvider())
;
$this['http_cache.cache_dir'] = function () {
re... | php | public function initRendering()
{
$this
->register(new Provider\TwigServiceProvider())
->register(new Provider\RenderServiceProvider())
->register(new Silex\Provider\HttpCacheServiceProvider())
;
$this['http_cache.cache_dir'] = function () {
re... | [
"public",
"function",
"initRendering",
"(",
")",
"{",
"$",
"this",
"->",
"register",
"(",
"new",
"Provider",
"\\",
"TwigServiceProvider",
"(",
")",
")",
"->",
"register",
"(",
"new",
"Provider",
"\\",
"RenderServiceProvider",
"(",
")",
")",
"->",
"register",... | Initialize the rendering providers. | [
"Initialize",
"the",
"rendering",
"providers",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Application.php#L186-L199 |
bolt/bolt | src/Application.php | Application.mount | public function mount($prefix, $controllers)
{
if (!$this->booted) {
// Forward call to mount event if we can (which handles prioritization).
$this->on(
ControllerEvents::MOUNT,
function (MountEvent $event) use ($prefix, $controllers) {
... | php | public function mount($prefix, $controllers)
{
if (!$this->booted) {
// Forward call to mount event if we can (which handles prioritization).
$this->on(
ControllerEvents::MOUNT,
function (MountEvent $event) use ($prefix, $controllers) {
... | [
"public",
"function",
"mount",
"(",
"$",
"prefix",
",",
"$",
"controllers",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"booted",
")",
"{",
"// Forward call to mount event if we can (which handles prioritization).",
"$",
"this",
"->",
"on",
"(",
"ControllerEvents... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Application.php#L280-L296 |
bolt/bolt | src/Helpers/Str.php | Str.makeSafe | public static function makeSafe($str, $strict = false, $extrachars = '')
{
$str = str_replace('&', '', $str);
$delim = '/';
if ($extrachars != '') {
$extrachars = preg_quote($extrachars, $delim);
}
if ($strict) {
$slugify = Slugify::create([
... | php | public static function makeSafe($str, $strict = false, $extrachars = '')
{
$str = str_replace('&', '', $str);
$delim = '/';
if ($extrachars != '') {
$extrachars = preg_quote($extrachars, $delim);
}
if ($strict) {
$slugify = Slugify::create([
... | [
"public",
"static",
"function",
"makeSafe",
"(",
"$",
"str",
",",
"$",
"strict",
"=",
"false",
",",
"$",
"extrachars",
"=",
"''",
")",
"{",
"$",
"str",
"=",
"str_replace",
"(",
"'&'",
",",
"''",
",",
"$",
"str",
")",
";",
"$",
"delim",
"=",
"... | Returns a "safe" version of the given string - basically only US-ASCII and
numbers. Needed because filenames and titles and such, can't use all characters.
@param string $str
@param bool $strict
@param string $extrachars
@return string | [
"Returns",
"a",
"safe",
"version",
"of",
"the",
"given",
"string",
"-",
"basically",
"only",
"US",
"-",
"ASCII",
"and",
"numbers",
".",
"Needed",
"because",
"filenames",
"and",
"titles",
"and",
"such",
"can",
"t",
"use",
"all",
"characters",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Helpers/Str.php#L19-L43 |
bolt/bolt | src/Helpers/Str.php | Str.replaceFirst | public static function replaceFirst($search, $replace, $subject, $caseSensitive = true)
{
Deprecated::method(3.4, parent::class);
return parent::replaceFirst($subject, $search, $replace);
} | php | public static function replaceFirst($search, $replace, $subject, $caseSensitive = true)
{
Deprecated::method(3.4, parent::class);
return parent::replaceFirst($subject, $search, $replace);
} | [
"public",
"static",
"function",
"replaceFirst",
"(",
"$",
"search",
",",
"$",
"replace",
",",
"$",
"subject",
",",
"$",
"caseSensitive",
"=",
"true",
")",
"{",
"Deprecated",
"::",
"method",
"(",
"3.4",
",",
"parent",
"::",
"class",
")",
";",
"return",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Helpers/Str.php#L48-L53 |
bolt/bolt | src/Helpers/Str.php | Str.shyphenate | public static function shyphenate($str)
{
$res = preg_match_all('/([a-z0-9]{19,})/i', $str, $matches);
if ($res) {
foreach ($matches[1] as $key => $match) {
$str = str_replace($match, wordwrap($match, 10, '­', true), $str);
}
}
return $st... | php | public static function shyphenate($str)
{
$res = preg_match_all('/([a-z0-9]{19,})/i', $str, $matches);
if ($res) {
foreach ($matches[1] as $key => $match) {
$str = str_replace($match, wordwrap($match, 10, '­', true), $str);
}
}
return $st... | [
"public",
"static",
"function",
"shyphenate",
"(",
"$",
"str",
")",
"{",
"$",
"res",
"=",
"preg_match_all",
"(",
"'/([a-z0-9]{19,})/i'",
",",
"$",
"str",
",",
"$",
"matches",
")",
";",
"if",
"(",
"$",
"res",
")",
"{",
"foreach",
"(",
"$",
"matches",
... | Add 'soft hyphens' ­ to a string, so that it won't break layout in HTML when
using strings without spaces or dashes. Only breaks in long (> 19 chars) words.
@param string $str
@return string | [
"Add",
"soft",
"hyphens",
"­",
";",
"to",
"a",
"string",
"so",
"that",
"it",
"won",
"t",
"break",
"layout",
"in",
"HTML",
"when",
"using",
"strings",
"without",
"spaces",
"or",
"dashes",
".",
"Only",
"breaks",
"in",
"long",
"(",
">",
"19",
"chars",
... | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Helpers/Str.php#L73-L84 |
bolt/bolt | src/Helpers/Str.php | Str.endsWith | public static function endsWith($subject, $search, $caseSensitive = true)
{
Deprecated::method(3.4, parent::class);
return parent::endsWith($subject, $search, $caseSensitive);
} | php | public static function endsWith($subject, $search, $caseSensitive = true)
{
Deprecated::method(3.4, parent::class);
return parent::endsWith($subject, $search, $caseSensitive);
} | [
"public",
"static",
"function",
"endsWith",
"(",
"$",
"subject",
",",
"$",
"search",
",",
"$",
"caseSensitive",
"=",
"true",
")",
"{",
"Deprecated",
"::",
"method",
"(",
"3.4",
",",
"parent",
"::",
"class",
")",
";",
"return",
"parent",
"::",
"endsWith",... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Helpers/Str.php#L89-L94 |
bolt/bolt | src/Twig/Runtime/WidgetRuntime.php | WidgetRuntime.countWidgets | public function countWidgets(Environment $env, $location = null, $zone = Zone::FRONTEND)
{
if ($location === null && $env->isStrictVariables()) {
throw new \InvalidArgumentException('countwidgets() requires a location, none given');
}
return $this->widgetQueue->count($location, ... | php | public function countWidgets(Environment $env, $location = null, $zone = Zone::FRONTEND)
{
if ($location === null && $env->isStrictVariables()) {
throw new \InvalidArgumentException('countwidgets() requires a location, none given');
}
return $this->widgetQueue->count($location, ... | [
"public",
"function",
"countWidgets",
"(",
"Environment",
"$",
"env",
",",
"$",
"location",
"=",
"null",
",",
"$",
"zone",
"=",
"Zone",
"::",
"FRONTEND",
")",
"{",
"if",
"(",
"$",
"location",
"===",
"null",
"&&",
"$",
"env",
"->",
"isStrictVariables",
... | Return the number of widgets in the queue for a given type / location.
@param Environment $env
@param string $location Location (e.g. 'dashboard_aside_top')
@param string $zone Either Zone::FRONTEND or Zone::BACKEND
@return int | [
"Return",
"the",
"number",
"of",
"widgets",
"in",
"the",
"queue",
"for",
"a",
"given",
"type",
"/",
"location",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/Runtime/WidgetRuntime.php#L39-L46 |
bolt/bolt | src/Twig/Runtime/WidgetRuntime.php | WidgetRuntime.hasWidgets | public function hasWidgets(Environment $env, $location = null, $zone = Zone::FRONTEND)
{
if ($location === null && $env->isStrictVariables()) {
throw new \InvalidArgumentException('haswidgets() requires a location, none given');
}
return $this->widgetQueue->has($location, $zone)... | php | public function hasWidgets(Environment $env, $location = null, $zone = Zone::FRONTEND)
{
if ($location === null && $env->isStrictVariables()) {
throw new \InvalidArgumentException('haswidgets() requires a location, none given');
}
return $this->widgetQueue->has($location, $zone)... | [
"public",
"function",
"hasWidgets",
"(",
"Environment",
"$",
"env",
",",
"$",
"location",
"=",
"null",
",",
"$",
"zone",
"=",
"Zone",
"::",
"FRONTEND",
")",
"{",
"if",
"(",
"$",
"location",
"===",
"null",
"&&",
"$",
"env",
"->",
"isStrictVariables",
"(... | Check if a type / location has widgets in the queue.
@param Environment $env
@param string $location Location (e.g. 'dashboard_aside_top')
@param string $zone Either Zone::FRONTEND or Zone::BACKEND
@return bool | [
"Check",
"if",
"a",
"type",
"/",
"location",
"has",
"widgets",
"in",
"the",
"queue",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/Runtime/WidgetRuntime.php#L67-L74 |
bolt/bolt | src/Twig/Runtime/WidgetRuntime.php | WidgetRuntime.widgets | public function widgets(Environment $env, $location = null, $zone = Zone::FRONTEND, $wrapper = 'widgetwrapper.twig')
{
if ($location === null && $env->isStrictVariables()) {
throw new \InvalidArgumentException('widgets() requires a location, none given');
}
return $this->widgetQ... | php | public function widgets(Environment $env, $location = null, $zone = Zone::FRONTEND, $wrapper = 'widgetwrapper.twig')
{
if ($location === null && $env->isStrictVariables()) {
throw new \InvalidArgumentException('widgets() requires a location, none given');
}
return $this->widgetQ... | [
"public",
"function",
"widgets",
"(",
"Environment",
"$",
"env",
",",
"$",
"location",
"=",
"null",
",",
"$",
"zone",
"=",
"Zone",
"::",
"FRONTEND",
",",
"$",
"wrapper",
"=",
"'widgetwrapper.twig'",
")",
"{",
"if",
"(",
"$",
"location",
"===",
"null",
... | Renders a particular widget type on the given location.
@param Environment $env
@param string $location Location (e.g. 'dashboard_aside_top')
@param string $zone Either Zone::FRONTEND or Zone::BACKEND
@param string $wrapper
@return string|Markup | [
"Renders",
"a",
"particular",
"widget",
"type",
"on",
"the",
"given",
"location",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/Runtime/WidgetRuntime.php#L86-L93 |
bolt/bolt | src/Extension/NutTrait.php | NutTrait.addConsoleCommand | protected function addConsoleCommand(Command $command)
{
Deprecated::method(3.0, 'registerNutCommands');
$app = $this->getContainer();
$app['nut.commands.add']($command);
} | php | protected function addConsoleCommand(Command $command)
{
Deprecated::method(3.0, 'registerNutCommands');
$app = $this->getContainer();
$app['nut.commands.add']($command);
} | [
"protected",
"function",
"addConsoleCommand",
"(",
"Command",
"$",
"command",
")",
"{",
"Deprecated",
"::",
"method",
"(",
"3.0",
",",
"'registerNutCommands'",
")",
";",
"$",
"app",
"=",
"$",
"this",
"->",
"getContainer",
"(",
")",
";",
"$",
"app",
"[",
... | Add a console command.
@param Command $command
@deprecated since 3.0, will be removed in 4.0. Use registerNutCommands() instead. | [
"Add",
"a",
"console",
"command",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Extension/NutTrait.php#L46-L52 |
bolt/bolt | src/Form/FormType/AbstractUserType.php | AbstractUserType.configureOptions | public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefined(['roles', 'mutable']);
$resolver->setDefaults([
'data_class' => UserData::class,
'empty_data' => null,
'mutable' => [],
]);
$resolver->setDefined([
'... | php | public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefined(['roles', 'mutable']);
$resolver->setDefaults([
'data_class' => UserData::class,
'empty_data' => null,
'mutable' => [],
]);
$resolver->setDefined([
'... | [
"public",
"function",
"configureOptions",
"(",
"OptionsResolver",
"$",
"resolver",
")",
"{",
"$",
"resolver",
"->",
"setDefined",
"(",
"[",
"'roles'",
",",
"'mutable'",
"]",
")",
";",
"$",
"resolver",
"->",
"setDefaults",
"(",
"[",
"'data_class'",
"=>",
"Use... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Form/FormType/AbstractUserType.php#L35-L54 |
bolt/bolt | src/Form/FormType/AbstractUserType.php | AbstractUserType.addUserName | protected function addUserName(FormBuilderInterface $builder, array $options = [])
{
$builder
->add(
'username',
TextType::class,
[
'constraints' => [
new Assert\NotBlank(),
new As... | php | protected function addUserName(FormBuilderInterface $builder, array $options = [])
{
$builder
->add(
'username',
TextType::class,
[
'constraints' => [
new Assert\NotBlank(),
new As... | [
"protected",
"function",
"addUserName",
"(",
"FormBuilderInterface",
"$",
"builder",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"builder",
"->",
"add",
"(",
"'username'",
",",
"TextType",
"::",
"class",
",",
"[",
"'constraints'",
"=>",
"["... | @param FormBuilderInterface $builder
@param array $options
@return AbstractUserType | [
"@param",
"FormBuilderInterface",
"$builder",
"@param",
"array",
"$options"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Form/FormType/AbstractUserType.php#L87-L116 |
bolt/bolt | src/Form/FormType/AbstractUserType.php | AbstractUserType.addDisplayName | protected function addDisplayName(FormBuilderInterface $builder, array $options = [])
{
$builder
->add(
'displayname',
TextType::class,
[
'label' => Trans::__('page.edit-users.label.display-name'),
'attr' =>... | php | protected function addDisplayName(FormBuilderInterface $builder, array $options = [])
{
$builder
->add(
'displayname',
TextType::class,
[
'label' => Trans::__('page.edit-users.label.display-name'),
'attr' =>... | [
"protected",
"function",
"addDisplayName",
"(",
"FormBuilderInterface",
"$",
"builder",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"builder",
"->",
"add",
"(",
"'displayname'",
",",
"TextType",
"::",
"class",
",",
"[",
"'label'",
"=>",
"Tr... | @param FormBuilderInterface $builder
@param array $options
@return AbstractUserType | [
"@param",
"FormBuilderInterface",
"$builder",
"@param",
"array",
"$options"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Form/FormType/AbstractUserType.php#L124-L149 |
bolt/bolt | src/Form/FormType/AbstractUserType.php | AbstractUserType.addEmail | protected function addEmail(FormBuilderInterface $builder, array $options = [], $checkMx = false)
{
$builder
->add(
'email',
EmailType::class,
[
'label' => Trans::__('page.edit-users.label.email'),
'attr' =>... | php | protected function addEmail(FormBuilderInterface $builder, array $options = [], $checkMx = false)
{
$builder
->add(
'email',
EmailType::class,
[
'label' => Trans::__('page.edit-users.label.email'),
'attr' =>... | [
"protected",
"function",
"addEmail",
"(",
"FormBuilderInterface",
"$",
"builder",
",",
"array",
"$",
"options",
"=",
"[",
"]",
",",
"$",
"checkMx",
"=",
"false",
")",
"{",
"$",
"builder",
"->",
"add",
"(",
"'email'",
",",
"EmailType",
"::",
"class",
",",... | @param FormBuilderInterface $builder
@param array $options
@param bool $checkMx
@return AbstractUserType | [
"@param",
"FormBuilderInterface",
"$builder",
"@param",
"array",
"$options",
"@param",
"bool",
"$checkMx"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Form/FormType/AbstractUserType.php#L158-L187 |
bolt/bolt | src/Form/FormType/AbstractUserType.php | AbstractUserType.addPassword | protected function addPassword(FormBuilderInterface $builder, array $options = [])
{
$builder
->add(
'password',
RepeatedType::class,
[
'type' => PasswordType::class,
'first_options' => [
... | php | protected function addPassword(FormBuilderInterface $builder, array $options = [])
{
$builder
->add(
'password',
RepeatedType::class,
[
'type' => PasswordType::class,
'first_options' => [
... | [
"protected",
"function",
"addPassword",
"(",
"FormBuilderInterface",
"$",
"builder",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"builder",
"->",
"add",
"(",
"'password'",
",",
"RepeatedType",
"::",
"class",
",",
"[",
"'type'",
"=>",
"Passw... | Regarding the autocomplete on the passwords:
@see https://bugs.chromium.org/p/chromium/issues/detail?id=468153#c150
@param FormBuilderInterface $builder
@param array $options
@return AbstractUserType | [
"Regarding",
"the",
"autocomplete",
"on",
"the",
"passwords",
":"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Form/FormType/AbstractUserType.php#L199-L250 |
bolt/bolt | src/Form/FormType/AbstractUserType.php | AbstractUserType.addEnabled | protected function addEnabled(FormBuilderInterface $builder, array $options = [])
{
$enabledOptions = [
Trans::__('page.edit-users.activated.yes') => 1,
Trans::__('page.edit-users.activated.no') => 0,
];
$builder
->add(
'enabled',
... | php | protected function addEnabled(FormBuilderInterface $builder, array $options = [])
{
$enabledOptions = [
Trans::__('page.edit-users.activated.yes') => 1,
Trans::__('page.edit-users.activated.no') => 0,
];
$builder
->add(
'enabled',
... | [
"protected",
"function",
"addEnabled",
"(",
"FormBuilderInterface",
"$",
"builder",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"enabledOptions",
"=",
"[",
"Trans",
"::",
"__",
"(",
"'page.edit-users.activated.yes'",
")",
"=>",
"1",
",",
"Tra... | @param FormBuilderInterface $builder
@param array $options
@return AbstractUserType | [
"@param",
"FormBuilderInterface",
"$builder",
"@param",
"array",
"$options"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Form/FormType/AbstractUserType.php#L258-L280 |
bolt/bolt | src/Form/FormType/AbstractUserType.php | AbstractUserType.addLastSeen | protected function addLastSeen(FormBuilderInterface $builder, array $options = [])
{
$builder
->add(
'lastseen',
DateTimeType::class,
[
'widget' => 'single_text',
'format' => 'yyyy-MM-dd HH:mm:ss',
... | php | protected function addLastSeen(FormBuilderInterface $builder, array $options = [])
{
$builder
->add(
'lastseen',
DateTimeType::class,
[
'widget' => 'single_text',
'format' => 'yyyy-MM-dd HH:mm:ss',
... | [
"protected",
"function",
"addLastSeen",
"(",
"FormBuilderInterface",
"$",
"builder",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"builder",
"->",
"add",
"(",
"'lastseen'",
",",
"DateTimeType",
"::",
"class",
",",
"[",
"'widget'",
"=>",
"'si... | @param FormBuilderInterface $builder
@param array $options
@return AbstractUserType | [
"@param",
"FormBuilderInterface",
"$builder",
"@param",
"array",
"$options"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Form/FormType/AbstractUserType.php#L288-L304 |
bolt/bolt | src/Form/FormType/AbstractUserType.php | AbstractUserType.addLastIp | protected function addLastIp(FormBuilderInterface $builder, array $options = [])
{
$builder
->add(
'lastip',
TextType::class,
[
'disabled' => true,
'label' => Trans::__('page.edit-users.label.last-ip'),
... | php | protected function addLastIp(FormBuilderInterface $builder, array $options = [])
{
$builder
->add(
'lastip',
TextType::class,
[
'disabled' => true,
'label' => Trans::__('page.edit-users.label.last-ip'),
... | [
"protected",
"function",
"addLastIp",
"(",
"FormBuilderInterface",
"$",
"builder",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"builder",
"->",
"add",
"(",
"'lastip'",
",",
"TextType",
"::",
"class",
",",
"[",
"'disabled'",
"=>",
"true",
... | @param FormBuilderInterface $builder
@param array $options
@return AbstractUserType | [
"@param",
"FormBuilderInterface",
"$builder",
"@param",
"array",
"$options"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Form/FormType/AbstractUserType.php#L312-L326 |
bolt/bolt | src/Form/FormType/AbstractUserType.php | AbstractUserType.addRoles | protected function addRoles(FormBuilderInterface $builder, array $options = [])
{
$builder
->add(
'roles',
ChoiceType::class,
[
'label' => Trans::__('page.edit-users.label.assigned-roles'),
'multi... | php | protected function addRoles(FormBuilderInterface $builder, array $options = [])
{
$builder
->add(
'roles',
ChoiceType::class,
[
'label' => Trans::__('page.edit-users.label.assigned-roles'),
'multi... | [
"protected",
"function",
"addRoles",
"(",
"FormBuilderInterface",
"$",
"builder",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"builder",
"->",
"add",
"(",
"'roles'",
",",
"ChoiceType",
"::",
"class",
",",
"[",
"'label'",
"=>",
"Trans",
":... | @param FormBuilderInterface $builder
@param array $options
@return AbstractUserType | [
"@param",
"FormBuilderInterface",
"$builder",
"@param",
"array",
"$options"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Form/FormType/AbstractUserType.php#L334-L355 |
bolt/bolt | src/Storage/Database/Schema/Table/Cron.php | Cron.addColumns | protected function addColumns()
{
// @codingStandardsIgnoreStart
$this->table->addColumn('id', 'integer', ['autoincrement' => true]);
$this->table->addColumn('interim', 'string', ['length' => 16]);
$this->table->addColumn('lastrun', 'datetime', []);
// @codingStandard... | php | protected function addColumns()
{
// @codingStandardsIgnoreStart
$this->table->addColumn('id', 'integer', ['autoincrement' => true]);
$this->table->addColumn('interim', 'string', ['length' => 16]);
$this->table->addColumn('lastrun', 'datetime', []);
// @codingStandard... | [
"protected",
"function",
"addColumns",
"(",
")",
"{",
"// @codingStandardsIgnoreStart",
"$",
"this",
"->",
"table",
"->",
"addColumn",
"(",
"'id'",
",",
"'integer'",
",",
"[",
"'autoincrement'",
"=>",
"true",
"]",
")",
";",
"$",
"this",
"->",
"table",
"->",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Database/Schema/Table/Cron.php#L15-L22 |
bolt/bolt | src/Twig/Runtime/HtmlRuntime.php | HtmlRuntime.editable | public function editable($html, Content $content, $field)
{
$contentTypeName = $content->contenttype['slug'];
$output = sprintf(
'<div class="Bolt-editable" data-id="%s" data-contenttype="%s" data-field="%s">%s</div>',
$content->id,
$contentTypeName,
... | php | public function editable($html, Content $content, $field)
{
$contentTypeName = $content->contenttype['slug'];
$output = sprintf(
'<div class="Bolt-editable" data-id="%s" data-contenttype="%s" data-field="%s">%s</div>',
$content->id,
$contentTypeName,
... | [
"public",
"function",
"editable",
"(",
"$",
"html",
",",
"Content",
"$",
"content",
",",
"$",
"field",
")",
"{",
"$",
"contentTypeName",
"=",
"$",
"content",
"->",
"contenttype",
"[",
"'slug'",
"]",
";",
"$",
"output",
"=",
"sprintf",
"(",
"'<div class=\... | Makes a piece of HTML editable.
@param string $html The HTML to be editable
@param \Bolt\Legacy\Content $content The actual content
@param string $field
@return string | [
"Makes",
"a",
"piece",
"of",
"HTML",
"editable",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/Runtime/HtmlRuntime.php#L74-L87 |
bolt/bolt | src/Twig/Runtime/HtmlRuntime.php | HtmlRuntime.markdown | public function markdown($content)
{
// Parse the field as Markdown, return HTML
$output = $this->markdown->text($content);
$config = $this->config->get('general/htmlcleaner');
$allowedTags = !empty($config['allowed_tags']) ? $config['allowed_tags'] :
['div', 'p', 'br', ... | php | public function markdown($content)
{
// Parse the field as Markdown, return HTML
$output = $this->markdown->text($content);
$config = $this->config->get('general/htmlcleaner');
$allowedTags = !empty($config['allowed_tags']) ? $config['allowed_tags'] :
['div', 'p', 'br', ... | [
"public",
"function",
"markdown",
"(",
"$",
"content",
")",
"{",
"// Parse the field as Markdown, return HTML",
"$",
"output",
"=",
"$",
"this",
"->",
"markdown",
"->",
"text",
"(",
"$",
"content",
")",
";",
"$",
"config",
"=",
"$",
"this",
"->",
"config",
... | Formats the given string as Markdown in HTML.
@param string $content
@return string Markdown output | [
"Formats",
"the",
"given",
"string",
"as",
"Markdown",
"in",
"HTML",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/Runtime/HtmlRuntime.php#L96-L118 |
bolt/bolt | src/Twig/Runtime/HtmlRuntime.php | HtmlRuntime.link | public function link($location, $label = '[link]')
{
if ((string) $location === '') {
return '';
}
if (Html::isURL($location)) {
$location = Html::addScheme($location);
} elseif ($record = $this->em->getContent($location)) {
$location = $record->l... | php | public function link($location, $label = '[link]')
{
if ((string) $location === '') {
return '';
}
if (Html::isURL($location)) {
$location = Html::addScheme($location);
} elseif ($record = $this->em->getContent($location)) {
$location = $record->l... | [
"public",
"function",
"link",
"(",
"$",
"location",
",",
"$",
"label",
"=",
"'[link]'",
")",
"{",
"if",
"(",
"(",
"string",
")",
"$",
"location",
"===",
"''",
")",
"{",
"return",
"''",
";",
"}",
"if",
"(",
"Html",
"::",
"isURL",
"(",
"$",
"locati... | Create an HTML link to a given URL or ContentType/slug pair.
@param string $location
@param string $label
@return string | [
"Create",
"an",
"HTML",
"link",
"to",
"a",
"given",
"URL",
"or",
"ContentType",
"/",
"slug",
"pair",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/Runtime/HtmlRuntime.php#L128-L141 |
bolt/bolt | src/Twig/Runtime/HtmlRuntime.php | HtmlRuntime.menu | public function menu(Environment $env, $identifier = '', $template = '_sub_menu.twig', $params = [])
{
$menu = $this->menu->menu($identifier);
$context = [
'name' => $menu->getName(),
'menu' => $menu->getItems(),
];
$context += (array) $params;
retur... | php | public function menu(Environment $env, $identifier = '', $template = '_sub_menu.twig', $params = [])
{
$menu = $this->menu->menu($identifier);
$context = [
'name' => $menu->getName(),
'menu' => $menu->getItems(),
];
$context += (array) $params;
retur... | [
"public",
"function",
"menu",
"(",
"Environment",
"$",
"env",
",",
"$",
"identifier",
"=",
"''",
",",
"$",
"template",
"=",
"'_sub_menu.twig'",
",",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"$",
"menu",
"=",
"$",
"this",
"->",
"menu",
"->",
"menu",
... | Output a menu.
@param Environment $env
@param string $identifier Identifier for a particular menu
@param string $template the template to use
@param array $params extra parameters to pass on to the menu template
@return string|null | [
"Output",
"a",
"menu",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/Runtime/HtmlRuntime.php#L153-L164 |
bolt/bolt | src/Twig/Runtime/HtmlRuntime.php | HtmlRuntime.twig | public function twig(Environment $env, $snippet, $context = [])
{
Deprecated::warn('Using the Twig filter |twig', 3.3, 'Use import(template_from_string()) instead');
$template = $env->createTemplate((string) $snippet);
return twig_include($env, $context, $template, [], true, false, true);
... | php | public function twig(Environment $env, $snippet, $context = [])
{
Deprecated::warn('Using the Twig filter |twig', 3.3, 'Use import(template_from_string()) instead');
$template = $env->createTemplate((string) $snippet);
return twig_include($env, $context, $template, [], true, false, true);
... | [
"public",
"function",
"twig",
"(",
"Environment",
"$",
"env",
",",
"$",
"snippet",
",",
"$",
"context",
"=",
"[",
"]",
")",
"{",
"Deprecated",
"::",
"warn",
"(",
"'Using the Twig filter |twig'",
",",
"3.3",
",",
"'Use import(template_from_string()) instead'",
")... | @deprecated since 3.3. To be removed in 4.0.
Formats the given string as Twig in HTML.
Use template_from_string instead:
http://twig.sensiolabs.org/doc/functions/template_from_string.html
@param Environment $env
@param string $snippet
@param array $context
@return string Twig output | [
"@deprecated",
"since",
"3",
".",
"3",
".",
"To",
"be",
"removed",
"in",
"4",
".",
"0",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Twig/Runtime/HtmlRuntime.php#L197-L204 |
bolt/bolt | src/Nut/DebugServiceProviders.php | DebugServiceProviders.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
$table = new Table($output);
$rightAligned = new TableStyle();
$rightAligned->setPadType(STR_PAD_LEFT);
$table->setHeaders([['Provider Class Name', 'Order']]);
$table->setColumnStyle(1, $rightAligne... | php | protected function execute(InputInterface $input, OutputInterface $output)
{
$table = new Table($output);
$rightAligned = new TableStyle();
$rightAligned->setPadType(STR_PAD_LEFT);
$table->setHeaders([['Provider Class Name', 'Order']]);
$table->setColumnStyle(1, $rightAligne... | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"table",
"=",
"new",
"Table",
"(",
"$",
"output",
")",
";",
"$",
"rightAligned",
"=",
"new",
"TableStyle",
"(",
")",
";",
"$",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Nut/DebugServiceProviders.php#L35-L65 |
bolt/bolt | src/Configuration/Check/PhpExtensions.php | PhpExtensions.runCheck | public function runCheck()
{
foreach ($this->options['extensions'] as $extension) {
try {
if (extension_loaded($extension)) {
$this->createResult()->pass()->setMessage("PHP extension $extension is loaded.");
} else {
$this->... | php | public function runCheck()
{
foreach ($this->options['extensions'] as $extension) {
try {
if (extension_loaded($extension)) {
$this->createResult()->pass()->setMessage("PHP extension $extension is loaded.");
} else {
$this->... | [
"public",
"function",
"runCheck",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"options",
"[",
"'extensions'",
"]",
"as",
"$",
"extension",
")",
"{",
"try",
"{",
"if",
"(",
"extension_loaded",
"(",
"$",
"extension",
")",
")",
"{",
"$",
"this",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Configuration/Check/PhpExtensions.php#L57-L72 |
bolt/bolt | src/Controller/Async/Records.php | Records.action | public function action(Request $request)
{
$this->validateCsrfToken();
$contentType = $request->get('contenttype');
$actionData = $request->get('actions');
if ($actionData === null) {
throw new \UnexpectedValueException('No content action data provided in the request.');... | php | public function action(Request $request)
{
$this->validateCsrfToken();
$contentType = $request->get('contenttype');
$actionData = $request->get('actions');
if ($actionData === null) {
throw new \UnexpectedValueException('No content action data provided in the request.');... | [
"public",
"function",
"action",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"this",
"->",
"validateCsrfToken",
"(",
")",
";",
"$",
"contentType",
"=",
"$",
"request",
"->",
"get",
"(",
"'contenttype'",
")",
";",
"$",
"actionData",
"=",
"$",
"request",... | Perform an action on a ContentType record.
The action part of the POST request should take the form:
[
contenttype => [
id => [
action => [field => value]
]
]
]
For example:
[
'pages' => [
3 => ['modify' => ['status' => 'held']],
5 => null,
4 => ['modify' => ['status' => 'draft']],
1 => ['delete' => null],
2 => ['m... | [
"Perform",
"an",
"action",
"on",
"a",
"ContentType",
"record",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Controller/Async/Records.php#L59-L102 |
bolt/bolt | src/Composer/Satis/QueryService.php | QueryService.info | public function info($package, $bolt)
{
$url = $this->urls['info'];
$params = ['package' => $package, 'bolt' => $bolt];
return $this->execute($url, $params);
} | php | public function info($package, $bolt)
{
$url = $this->urls['info'];
$params = ['package' => $package, 'bolt' => $bolt];
return $this->execute($url, $params);
} | [
"public",
"function",
"info",
"(",
"$",
"package",
",",
"$",
"bolt",
")",
"{",
"$",
"url",
"=",
"$",
"this",
"->",
"urls",
"[",
"'info'",
"]",
";",
"$",
"params",
"=",
"[",
"'package'",
"=>",
"$",
"package",
",",
"'bolt'",
"=>",
"$",
"bolt",
"]",... | Make an extension package info request.
@param string $package Composer package name 'author/extension'
@param string $bolt Bolt version number
@return string|bool|object | [
"Make",
"an",
"extension",
"package",
"info",
"request",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/Satis/QueryService.php#L54-L60 |
bolt/bolt | src/Composer/Satis/QueryService.php | QueryService.execute | public function execute($url, $params = [])
{
$uri = rtrim(rtrim($this->site, '/') . '/' . ltrim($url, '/') . '?' . http_build_query($params), '?');
try {
$result = $this->client->get($uri, ['timeout' => 10])->getBody();
return ($this->format === 'json') ? json_decode($resu... | php | public function execute($url, $params = [])
{
$uri = rtrim(rtrim($this->site, '/') . '/' . ltrim($url, '/') . '?' . http_build_query($params), '?');
try {
$result = $this->client->get($uri, ['timeout' => 10])->getBody();
return ($this->format === 'json') ? json_decode($resu... | [
"public",
"function",
"execute",
"(",
"$",
"url",
",",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"$",
"uri",
"=",
"rtrim",
"(",
"rtrim",
"(",
"$",
"this",
"->",
"site",
",",
"'/'",
")",
".",
"'/'",
".",
"ltrim",
"(",
"$",
"url",
",",
"'/'",
")"... | Execute the query.
@param string $url
@param array $params
@throws SatisQueryException
@return string|bool|object | [
"Execute",
"the",
"query",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Composer/Satis/QueryService.php#L77-L95 |
bolt/bolt | src/Response/TemplateResponse.php | TemplateResponse.create | public static function create($template = '', $context = [], $content = '', $status = 200, $headers = [])
{
return new static($template, $context, $content, $status, $headers);
} | php | public static function create($template = '', $context = [], $content = '', $status = 200, $headers = [])
{
return new static($template, $context, $content, $status, $headers);
} | [
"public",
"static",
"function",
"create",
"(",
"$",
"template",
"=",
"''",
",",
"$",
"context",
"=",
"[",
"]",
",",
"$",
"content",
"=",
"''",
",",
"$",
"status",
"=",
"200",
",",
"$",
"headers",
"=",
"[",
"]",
")",
"{",
"return",
"new",
"static"... | Factory method for chainability.
@param string $template The template name
@param iterable $context The context given to the template
@param mixed $content The response content, see setContent()
@param int $status The response status code
@param array $headers An array of response headers
@return Te... | [
"Factory",
"method",
"for",
"chainability",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Response/TemplateResponse.php#L50-L53 |
bolt/bolt | src/Storage/Database/Schema/SchemaCheck.php | SchemaCheck.addMessage | public function addMessage($tableName, $message)
{
$this->pending[$tableName] = true;
$this->messages[$tableName][] = $message;
} | php | public function addMessage($tableName, $message)
{
$this->pending[$tableName] = true;
$this->messages[$tableName][] = $message;
} | [
"public",
"function",
"addMessage",
"(",
"$",
"tableName",
",",
"$",
"message",
")",
"{",
"$",
"this",
"->",
"pending",
"[",
"$",
"tableName",
"]",
"=",
"true",
";",
"$",
"this",
"->",
"messages",
"[",
"$",
"tableName",
"]",
"[",
"]",
"=",
"$",
"me... | Add a message.
@param string $tableName
@param string $message | [
"Add",
"a",
"message",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Database/Schema/SchemaCheck.php#L72-L76 |
bolt/bolt | src/Storage/Database/Schema/SchemaCheck.php | SchemaCheck.getResponseStrings | public function getResponseStrings()
{
$response = [];
foreach (array_keys($this->pending) as $tableName) {
$message = isset($this->titles[$tableName]) ? $this->titles[$tableName] . ' ' : '';
if (!empty($this->messages[$tableName])) {
$message .= implode(', ',... | php | public function getResponseStrings()
{
$response = [];
foreach (array_keys($this->pending) as $tableName) {
$message = isset($this->titles[$tableName]) ? $this->titles[$tableName] . ' ' : '';
if (!empty($this->messages[$tableName])) {
$message .= implode(', ',... | [
"public",
"function",
"getResponseStrings",
"(",
")",
"{",
"$",
"response",
"=",
"[",
"]",
";",
"foreach",
"(",
"array_keys",
"(",
"$",
"this",
"->",
"pending",
")",
"as",
"$",
"tableName",
")",
"{",
"$",
"message",
"=",
"isset",
"(",
"$",
"this",
"-... | Get the response messages as a string.
@return string[] | [
"Get",
"the",
"response",
"messages",
"as",
"a",
"string",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Database/Schema/SchemaCheck.php#L93-L106 |
bolt/bolt | src/Storage/Database/Schema/SchemaCheck.php | SchemaCheck.addTitle | public function addTitle($tableName, $title)
{
$this->pending[$tableName] = true;
$this->titles[$tableName] = $title;
} | php | public function addTitle($tableName, $title)
{
$this->pending[$tableName] = true;
$this->titles[$tableName] = $title;
} | [
"public",
"function",
"addTitle",
"(",
"$",
"tableName",
",",
"$",
"title",
")",
"{",
"$",
"this",
"->",
"pending",
"[",
"$",
"tableName",
"]",
"=",
"true",
";",
"$",
"this",
"->",
"titles",
"[",
"$",
"tableName",
"]",
"=",
"$",
"title",
";",
"}"
] | Add title message.
@param string $tableName
@param string $title | [
"Add",
"title",
"message",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Database/Schema/SchemaCheck.php#L124-L128 |
bolt/bolt | src/Storage/Database/Schema/SchemaCheck.php | SchemaCheck.checkDiff | public function checkDiff($tableName, TableDiff $diff)
{
$this->diffs[$tableName] = $diff;
// Adds
$this->getAddedColumns($tableName, $diff);
$this->getAddedIndexes($tableName, $diff);
$this->getAddedForeignKeys($tableName, $diff);
// Changes
$this->getChang... | php | public function checkDiff($tableName, TableDiff $diff)
{
$this->diffs[$tableName] = $diff;
// Adds
$this->getAddedColumns($tableName, $diff);
$this->getAddedIndexes($tableName, $diff);
$this->getAddedForeignKeys($tableName, $diff);
// Changes
$this->getChang... | [
"public",
"function",
"checkDiff",
"(",
"$",
"tableName",
",",
"TableDiff",
"$",
"diff",
")",
"{",
"$",
"this",
"->",
"diffs",
"[",
"$",
"tableName",
"]",
"=",
"$",
"diff",
";",
"// Adds",
"$",
"this",
"->",
"getAddedColumns",
"(",
"$",
"tableName",
",... | Check a Comparator diff and store the messages that make it up.
@param string $tableName
@param TableDiff $diff | [
"Check",
"a",
"Comparator",
"diff",
"and",
"store",
"the",
"messages",
"that",
"make",
"it",
"up",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Database/Schema/SchemaCheck.php#L146-L176 |
bolt/bolt | src/Storage/Database/Schema/SchemaCheck.php | SchemaCheck.getAddedColumns | private function getAddedColumns($tableName, TableDiff $diff)
{
/** @var $col \Doctrine\DBAL\Schema\Column */
foreach ($diff->addedColumns as $col) {
$this->addMessage($tableName, sprintf('missing column `%s`', $col->getName()));
}
} | php | private function getAddedColumns($tableName, TableDiff $diff)
{
/** @var $col \Doctrine\DBAL\Schema\Column */
foreach ($diff->addedColumns as $col) {
$this->addMessage($tableName, sprintf('missing column `%s`', $col->getName()));
}
} | [
"private",
"function",
"getAddedColumns",
"(",
"$",
"tableName",
",",
"TableDiff",
"$",
"diff",
")",
"{",
"/** @var $col \\Doctrine\\DBAL\\Schema\\Column */",
"foreach",
"(",
"$",
"diff",
"->",
"addedColumns",
"as",
"$",
"col",
")",
"{",
"$",
"this",
"->",
"addM... | Record added columns.
@param string $tableName
@param TableDiff $diff | [
"Record",
"added",
"columns",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Database/Schema/SchemaCheck.php#L184-L190 |
bolt/bolt | src/Storage/Database/Schema/SchemaCheck.php | SchemaCheck.getAddedIndexes | private function getAddedIndexes($tableName, TableDiff $diff)
{
/** @var $index \Doctrine\DBAL\Schema\Index */
foreach ($diff->addedIndexes as $index) {
$this->addMessage($tableName, sprintf('missing index on `%s`', implode(', ', $index->getUnquotedColumns())));
}
} | php | private function getAddedIndexes($tableName, TableDiff $diff)
{
/** @var $index \Doctrine\DBAL\Schema\Index */
foreach ($diff->addedIndexes as $index) {
$this->addMessage($tableName, sprintf('missing index on `%s`', implode(', ', $index->getUnquotedColumns())));
}
} | [
"private",
"function",
"getAddedIndexes",
"(",
"$",
"tableName",
",",
"TableDiff",
"$",
"diff",
")",
"{",
"/** @var $index \\Doctrine\\DBAL\\Schema\\Index */",
"foreach",
"(",
"$",
"diff",
"->",
"addedIndexes",
"as",
"$",
"index",
")",
"{",
"$",
"this",
"->",
"a... | Record added indexes.
@param string $tableName
@param TableDiff $diff | [
"Record",
"added",
"indexes",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Database/Schema/SchemaCheck.php#L198-L204 |
bolt/bolt | src/Storage/Database/Schema/SchemaCheck.php | SchemaCheck.getChangedColumns | private function getChangedColumns($tableName, TableDiff $diff)
{
/** @var $col \Doctrine\DBAL\Schema\ColumnDiff */
foreach ($diff->changedColumns as $col) {
$this->addMessage($tableName, sprintf('invalid column `%s`', $col->oldColumnName));
}
} | php | private function getChangedColumns($tableName, TableDiff $diff)
{
/** @var $col \Doctrine\DBAL\Schema\ColumnDiff */
foreach ($diff->changedColumns as $col) {
$this->addMessage($tableName, sprintf('invalid column `%s`', $col->oldColumnName));
}
} | [
"private",
"function",
"getChangedColumns",
"(",
"$",
"tableName",
",",
"TableDiff",
"$",
"diff",
")",
"{",
"/** @var $col \\Doctrine\\DBAL\\Schema\\ColumnDiff */",
"foreach",
"(",
"$",
"diff",
"->",
"changedColumns",
"as",
"$",
"col",
")",
"{",
"$",
"this",
"->",... | Record changed columns.
@param string $tableName
@param TableDiff $diff | [
"Record",
"changed",
"columns",
"."
] | train | https://github.com/bolt/bolt/blob/127434d79990b54abfb3e830243deaf725baa4de/src/Storage/Database/Schema/SchemaCheck.php#L212-L218 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.