id int32 0 241k | repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 |
|---|---|---|---|---|---|---|---|---|---|---|---|
222,400 | codefog/tags-bundle | src/Model/TagModel.php | TagModel.findByCriteria | public static function findByCriteria(array $criteria): ?Model\Collection
{
try {
list($columns, $values, $options) = static::parseCriteria($criteria);
} catch (NoTagsException $e) {
return null;
}
if (\count($columns) < 1) {
return static::findAl... | php | public static function findByCriteria(array $criteria): ?Model\Collection
{
try {
list($columns, $values, $options) = static::parseCriteria($criteria);
} catch (NoTagsException $e) {
return null;
}
if (\count($columns) < 1) {
return static::findAl... | [
"public",
"static",
"function",
"findByCriteria",
"(",
"array",
"$",
"criteria",
")",
":",
"?",
"Model",
"\\",
"Collection",
"{",
"try",
"{",
"list",
"(",
"$",
"columns",
",",
"$",
"values",
",",
"$",
"options",
")",
"=",
"static",
"::",
"parseCriteria",... | Find the records by criteria.
@param array $criteria
@return Model\Collection|null | [
"Find",
"the",
"records",
"by",
"criteria",
"."
] | 5fca40497b3a921c2cae28446753185adb240a5c | https://github.com/codefog/tags-bundle/blob/5fca40497b3a921c2cae28446753185adb240a5c/src/Model/TagModel.php#L37-L50 |
222,401 | codefog/tags-bundle | src/Model/TagModel.php | TagModel.findOneByCriteria | public static function findOneByCriteria(array $criteria): ?self
{
try {
list($columns, $values, $options) = static::parseCriteria($criteria);
} catch (NoTagsException $e) {
return null;
}
if (\count($columns) < 1) {
return null;
}
... | php | public static function findOneByCriteria(array $criteria): ?self
{
try {
list($columns, $values, $options) = static::parseCriteria($criteria);
} catch (NoTagsException $e) {
return null;
}
if (\count($columns) < 1) {
return null;
}
... | [
"public",
"static",
"function",
"findOneByCriteria",
"(",
"array",
"$",
"criteria",
")",
":",
"?",
"self",
"{",
"try",
"{",
"list",
"(",
"$",
"columns",
",",
"$",
"values",
",",
"$",
"options",
")",
"=",
"static",
"::",
"parseCriteria",
"(",
"$",
"crit... | Find the record by criteria.
@param array $criteria
@return TagModel|null | [
"Find",
"the",
"record",
"by",
"criteria",
"."
] | 5fca40497b3a921c2cae28446753185adb240a5c | https://github.com/codefog/tags-bundle/blob/5fca40497b3a921c2cae28446753185adb240a5c/src/Model/TagModel.php#L59-L72 |
222,402 | codefog/tags-bundle | src/Model/TagModel.php | TagModel.parseCriteria | protected static function parseCriteria(array $criteria): array
{
$columns = [];
$values = [];
$options = ['order' => 'name'];
// Find by source
if ($criteria['source']) {
$columns[] = 'source=?';
$values[] = $criteria['source'];
}
//... | php | protected static function parseCriteria(array $criteria): array
{
$columns = [];
$values = [];
$options = ['order' => 'name'];
// Find by source
if ($criteria['source']) {
$columns[] = 'source=?';
$values[] = $criteria['source'];
}
//... | [
"protected",
"static",
"function",
"parseCriteria",
"(",
"array",
"$",
"criteria",
")",
":",
"array",
"{",
"$",
"columns",
"=",
"[",
"]",
";",
"$",
"values",
"=",
"[",
"]",
";",
"$",
"options",
"=",
"[",
"'order'",
"=>",
"'name'",
"]",
";",
"// Find ... | Parse the criteria.
@param array $criteria
@throws NoTagsException
@return array | [
"Parse",
"the",
"criteria",
"."
] | 5fca40497b3a921c2cae28446753185adb240a5c | https://github.com/codefog/tags-bundle/blob/5fca40497b3a921c2cae28446753185adb240a5c/src/Model/TagModel.php#L83-L131 |
222,403 | php-soft/laravel-users | packages/Users/Middleware/Authenticate.php | Authenticate.respond | protected function respond($event, $error, $status, $payload = [])
{
$response = $this->events->fire($event, $payload, true);
return $response ?: $this->response->json(arrayView('phpsoft.users::errors/authenticate', [
'error' => $error
]), $status);
} | php | protected function respond($event, $error, $status, $payload = [])
{
$response = $this->events->fire($event, $payload, true);
return $response ?: $this->response->json(arrayView('phpsoft.users::errors/authenticate', [
'error' => $error
]), $status);
} | [
"protected",
"function",
"respond",
"(",
"$",
"event",
",",
"$",
"error",
",",
"$",
"status",
",",
"$",
"payload",
"=",
"[",
"]",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"events",
"->",
"fire",
"(",
"$",
"event",
",",
"$",
"payload",
"... | Fire event and return the response
@param string $event
@param string $error
@param integer $status
@param array $payload
@return mixed | [
"Fire",
"event",
"and",
"return",
"the",
"response"
] | cd8d696dbf7337002188576d8a143cbc19d86b40 | https://github.com/php-soft/laravel-users/blob/cd8d696dbf7337002188576d8a143cbc19d86b40/packages/Users/Middleware/Authenticate.php#L84-L91 |
222,404 | justinrainbow/epub | src/ePub/Loader/ZipFileLoader.php | ZipFileLoader.load | public function load($file)
{
$resource = new ZipFileResource($file);
$package = $resource->getXML('META-INF/container.xml');
if (!$opfFile = (string) $package->rootfiles->rootfile['full-path']) {
$ns = $package->getNamespaces();
foreach ($ns as $key => $value) {
... | php | public function load($file)
{
$resource = new ZipFileResource($file);
$package = $resource->getXML('META-INF/container.xml');
if (!$opfFile = (string) $package->rootfiles->rootfile['full-path']) {
$ns = $package->getNamespaces();
foreach ($ns as $key => $value) {
... | [
"public",
"function",
"load",
"(",
"$",
"file",
")",
"{",
"$",
"resource",
"=",
"new",
"ZipFileResource",
"(",
"$",
"file",
")",
";",
"$",
"package",
"=",
"$",
"resource",
"->",
"getXML",
"(",
"'META-INF/container.xml'",
")",
";",
"if",
"(",
"!",
"$",
... | Reads in a ePub file and builds the Package definition
@param string $file
@return \ePub\Definition\Package | [
"Reads",
"in",
"a",
"ePub",
"file",
"and",
"builds",
"the",
"Package",
"definition"
] | fbdc795f74907066283418bf1c5022b707a2abe8 | https://github.com/justinrainbow/epub/blob/fbdc795f74907066283418bf1c5022b707a2abe8/src/ePub/Loader/ZipFileLoader.php#L30-L64 |
222,405 | codete/FormGeneratorBundle | AdjusterRegistry.php | AdjusterRegistry.addFormConfigurationModifier | public function addFormConfigurationModifier(FormConfigurationModifierInterface $modifier, $priority = 0)
{
$this->formConfigurationModifiers[$priority][] = $modifier;
$this->needsSorting = true;
} | php | public function addFormConfigurationModifier(FormConfigurationModifierInterface $modifier, $priority = 0)
{
$this->formConfigurationModifiers[$priority][] = $modifier;
$this->needsSorting = true;
} | [
"public",
"function",
"addFormConfigurationModifier",
"(",
"FormConfigurationModifierInterface",
"$",
"modifier",
",",
"$",
"priority",
"=",
"0",
")",
"{",
"$",
"this",
"->",
"formConfigurationModifiers",
"[",
"$",
"priority",
"]",
"[",
"]",
"=",
"$",
"modifier",
... | Adds modifier for form's configuration
@param FormConfigurationModifierInterface $modifier
@param int $priority | [
"Adds",
"modifier",
"for",
"form",
"s",
"configuration"
] | c0bc3704d3f6df505ec232aa32b345159fffd980 | https://github.com/codete/FormGeneratorBundle/blob/c0bc3704d3f6df505ec232aa32b345159fffd980/AdjusterRegistry.php#L39-L43 |
222,406 | codete/FormGeneratorBundle | AdjusterRegistry.php | AdjusterRegistry.addFormFieldResolver | public function addFormFieldResolver(FormFieldResolverInterface $resolver, $priority = 0)
{
$this->formFieldResolvers[$priority][] = $resolver;
$this->needsSorting = true;
} | php | public function addFormFieldResolver(FormFieldResolverInterface $resolver, $priority = 0)
{
$this->formFieldResolvers[$priority][] = $resolver;
$this->needsSorting = true;
} | [
"public",
"function",
"addFormFieldResolver",
"(",
"FormFieldResolverInterface",
"$",
"resolver",
",",
"$",
"priority",
"=",
"0",
")",
"{",
"$",
"this",
"->",
"formFieldResolvers",
"[",
"$",
"priority",
"]",
"[",
"]",
"=",
"$",
"resolver",
";",
"$",
"this",
... | Adds resolver for form's fields
@param FormFieldResolverInterface $resolver
@param int $priority | [
"Adds",
"resolver",
"for",
"form",
"s",
"fields"
] | c0bc3704d3f6df505ec232aa32b345159fffd980 | https://github.com/codete/FormGeneratorBundle/blob/c0bc3704d3f6df505ec232aa32b345159fffd980/AdjusterRegistry.php#L51-L55 |
222,407 | codete/FormGeneratorBundle | AdjusterRegistry.php | AdjusterRegistry.addFormViewProvider | public function addFormViewProvider(FormViewProviderInterface $provider, $priority = 0)
{
$this->formViewProviders[$priority][] = $provider;
$this->needsSorting = true;
} | php | public function addFormViewProvider(FormViewProviderInterface $provider, $priority = 0)
{
$this->formViewProviders[$priority][] = $provider;
$this->needsSorting = true;
} | [
"public",
"function",
"addFormViewProvider",
"(",
"FormViewProviderInterface",
"$",
"provider",
",",
"$",
"priority",
"=",
"0",
")",
"{",
"$",
"this",
"->",
"formViewProviders",
"[",
"$",
"priority",
"]",
"[",
"]",
"=",
"$",
"provider",
";",
"$",
"this",
"... | Adds provider for defining default fields for form
@param FormViewProviderInterface $provider
@param int $priority | [
"Adds",
"provider",
"for",
"defining",
"default",
"fields",
"for",
"form"
] | c0bc3704d3f6df505ec232aa32b345159fffd980 | https://github.com/codete/FormGeneratorBundle/blob/c0bc3704d3f6df505ec232aa32b345159fffd980/AdjusterRegistry.php#L63-L67 |
222,408 | codete/FormGeneratorBundle | AdjusterRegistry.php | AdjusterRegistry.sortRegisteredServices | private function sortRegisteredServices()
{
krsort($this->formConfigurationModifiers);
if ( ! empty($this->formConfigurationModifiers)) {
$this->sortedFormConfigurationModifiers = call_user_func_array('array_merge', $this->formConfigurationModifiers);
}
krsort($this->form... | php | private function sortRegisteredServices()
{
krsort($this->formConfigurationModifiers);
if ( ! empty($this->formConfigurationModifiers)) {
$this->sortedFormConfigurationModifiers = call_user_func_array('array_merge', $this->formConfigurationModifiers);
}
krsort($this->form... | [
"private",
"function",
"sortRegisteredServices",
"(",
")",
"{",
"krsort",
"(",
"$",
"this",
"->",
"formConfigurationModifiers",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"formConfigurationModifiers",
")",
")",
"{",
"$",
"this",
"->",
"sorted... | Sorts all registered adjusters by priority. | [
"Sorts",
"all",
"registered",
"adjusters",
"by",
"priority",
"."
] | c0bc3704d3f6df505ec232aa32b345159fffd980 | https://github.com/codete/FormGeneratorBundle/blob/c0bc3704d3f6df505ec232aa32b345159fffd980/AdjusterRegistry.php#L111-L125 |
222,409 | ramsey/twig-codeblock | src/Node/CodeBlockNode.php | CodeBlockNode.compile | public function compile(\Twig_Compiler $compiler)
{
$compiler->addDebugInfo($this);
$compiler
->write('$highlighter = \Ramsey\Twig\CodeBlock\Highlighter\HighlighterFactory::getHighlighter(')
->string($this->getHighlighterName())
->raw(', ')
->repr($th... | php | public function compile(\Twig_Compiler $compiler)
{
$compiler->addDebugInfo($this);
$compiler
->write('$highlighter = \Ramsey\Twig\CodeBlock\Highlighter\HighlighterFactory::getHighlighter(')
->string($this->getHighlighterName())
->raw(', ')
->repr($th... | [
"public",
"function",
"compile",
"(",
"\\",
"Twig_Compiler",
"$",
"compiler",
")",
"{",
"$",
"compiler",
"->",
"addDebugInfo",
"(",
"$",
"this",
")",
";",
"$",
"compiler",
"->",
"write",
"(",
"'$highlighter = \\Ramsey\\Twig\\CodeBlock\\Highlighter\\HighlighterFactory:... | Compiles the node into PHP code for execution by Twig
@param \Twig_Compiler $compiler The compiler to which we add the node's PHP code | [
"Compiles",
"the",
"node",
"into",
"PHP",
"code",
"for",
"execution",
"by",
"Twig"
] | bf3a940af4c5d5a66b1e66e9464fccc29579b23f | https://github.com/ramsey/twig-codeblock/blob/bf3a940af4c5d5a66b1e66e9464fccc29579b23f/src/Node/CodeBlockNode.php#L64-L99 |
222,410 | ramsey/twig-codeblock | src/Node/CodeBlockNode.php | CodeBlockNode.getFigcaption | protected function getFigcaption()
{
$figcaption = '';
if ($this->hasAttribute('title')) {
$figcaption = '<figcaption class="code-highlight-caption">';
$figcaption .= '<span class="code-highlight-caption-title">';
$figcaption .= $this->getAttribute('title');
... | php | protected function getFigcaption()
{
$figcaption = '';
if ($this->hasAttribute('title')) {
$figcaption = '<figcaption class="code-highlight-caption">';
$figcaption .= '<span class="code-highlight-caption-title">';
$figcaption .= $this->getAttribute('title');
... | [
"protected",
"function",
"getFigcaption",
"(",
")",
"{",
"$",
"figcaption",
"=",
"''",
";",
"if",
"(",
"$",
"this",
"->",
"hasAttribute",
"(",
"'title'",
")",
")",
"{",
"$",
"figcaption",
"=",
"'<figcaption class=\"code-highlight-caption\">'",
";",
"$",
"figca... | Returns the figcaption HTML element for the codeblock
@return string | [
"Returns",
"the",
"figcaption",
"HTML",
"element",
"for",
"the",
"codeblock"
] | bf3a940af4c5d5a66b1e66e9464fccc29579b23f | https://github.com/ramsey/twig-codeblock/blob/bf3a940af4c5d5a66b1e66e9464fccc29579b23f/src/Node/CodeBlockNode.php#L126-L140 |
222,411 | ramsey/twig-codeblock | src/Node/CodeBlockNode.php | CodeBlockNode.getFigcaptionLink | protected function getFigcaptionLink()
{
$link = '';
if ($this->hasAttribute('linkUrl')) {
$link = '<a class="code-highlight-caption-link" href="'
. $this->getAttribute('linkUrl')
. '">';
$link .= $this->getFigcaptionLinkText();
$l... | php | protected function getFigcaptionLink()
{
$link = '';
if ($this->hasAttribute('linkUrl')) {
$link = '<a class="code-highlight-caption-link" href="'
. $this->getAttribute('linkUrl')
. '">';
$link .= $this->getFigcaptionLinkText();
$l... | [
"protected",
"function",
"getFigcaptionLink",
"(",
")",
"{",
"$",
"link",
"=",
"''",
";",
"if",
"(",
"$",
"this",
"->",
"hasAttribute",
"(",
"'linkUrl'",
")",
")",
"{",
"$",
"link",
"=",
"'<a class=\"code-highlight-caption-link\" href=\"'",
".",
"$",
"this",
... | Returns the link for the figcaption, if applicable
@return string | [
"Returns",
"the",
"link",
"for",
"the",
"figcaption",
"if",
"applicable"
] | bf3a940af4c5d5a66b1e66e9464fccc29579b23f | https://github.com/ramsey/twig-codeblock/blob/bf3a940af4c5d5a66b1e66e9464fccc29579b23f/src/Node/CodeBlockNode.php#L147-L160 |
222,412 | codefog/tags-bundle | src/Widget/TagsWidget.php | TagsWidget.generateConfig | protected function generateConfig(): array
{
$config = [
'addLabel' => $GLOBALS['TL_LANG']['MSC']['cfg_tags.add'],
'allowCreate' => isset($this->tagsCreate) ? (bool) $this->tagsCreate : true,
];
// Maximum number of items
if (isset($this->maxItems)) {
... | php | protected function generateConfig(): array
{
$config = [
'addLabel' => $GLOBALS['TL_LANG']['MSC']['cfg_tags.add'],
'allowCreate' => isset($this->tagsCreate) ? (bool) $this->tagsCreate : true,
];
// Maximum number of items
if (isset($this->maxItems)) {
... | [
"protected",
"function",
"generateConfig",
"(",
")",
":",
"array",
"{",
"$",
"config",
"=",
"[",
"'addLabel'",
"=>",
"$",
"GLOBALS",
"[",
"'TL_LANG'",
"]",
"[",
"'MSC'",
"]",
"[",
"'cfg_tags.add'",
"]",
",",
"'allowCreate'",
"=>",
"isset",
"(",
"$",
"thi... | Generate the widget configuration.
@return array | [
"Generate",
"the",
"widget",
"configuration",
"."
] | 5fca40497b3a921c2cae28446753185adb240a5c | https://github.com/codefog/tags-bundle/blob/5fca40497b3a921c2cae28446753185adb240a5c/src/Widget/TagsWidget.php#L122-L135 |
222,413 | codefog/tags-bundle | src/Widget/TagsWidget.php | TagsWidget.getValueTags | protected function getValueTags(): CollectionInterface
{
return $this->tagsManager->findMultiple(['values' => \is_array($this->varValue) ? $this->varValue : []]);
} | php | protected function getValueTags(): CollectionInterface
{
return $this->tagsManager->findMultiple(['values' => \is_array($this->varValue) ? $this->varValue : []]);
} | [
"protected",
"function",
"getValueTags",
"(",
")",
":",
"CollectionInterface",
"{",
"return",
"$",
"this",
"->",
"tagsManager",
"->",
"findMultiple",
"(",
"[",
"'values'",
"=>",
"\\",
"is_array",
"(",
"$",
"this",
"->",
"varValue",
")",
"?",
"$",
"this",
"... | Get the value tags.
@return CollectionInterface | [
"Get",
"the",
"value",
"tags",
"."
] | 5fca40497b3a921c2cae28446753185adb240a5c | https://github.com/codefog/tags-bundle/blob/5fca40497b3a921c2cae28446753185adb240a5c/src/Widget/TagsWidget.php#L142-L145 |
222,414 | codefog/tags-bundle | src/Widget/TagsWidget.php | TagsWidget.generateAllTags | private function generateAllTags(CollectionInterface $tags): array
{
$return = [];
/** @var Tag $tag */
foreach ($tags as $tag) {
$return[] = ['value' => $tag->getValue(), 'text' => StringUtil::decodeEntities($tag->getName())];
}
return $return;
} | php | private function generateAllTags(CollectionInterface $tags): array
{
$return = [];
/** @var Tag $tag */
foreach ($tags as $tag) {
$return[] = ['value' => $tag->getValue(), 'text' => StringUtil::decodeEntities($tag->getName())];
}
return $return;
} | [
"private",
"function",
"generateAllTags",
"(",
"CollectionInterface",
"$",
"tags",
")",
":",
"array",
"{",
"$",
"return",
"=",
"[",
"]",
";",
"/** @var Tag $tag */",
"foreach",
"(",
"$",
"tags",
"as",
"$",
"tag",
")",
"{",
"$",
"return",
"[",
"]",
"=",
... | Generate all tags.
@param CollectionInterface $tags
@return array | [
"Generate",
"all",
"tags",
"."
] | 5fca40497b3a921c2cae28446753185adb240a5c | https://github.com/codefog/tags-bundle/blob/5fca40497b3a921c2cae28446753185adb240a5c/src/Widget/TagsWidget.php#L183-L193 |
222,415 | php-soft/laravel-users | packages/Users/Controllers/RoutePermissionController.php | RoutePermissionController.store | public function store(Request $request)
{
// validate
$this->registerValidators();
$validator = Validator::make($request->all(), [
'route' => 'required|max:255|string|unique:route_permission,route',
'permissions' => 'required|max:255|array|rolePermission',
... | php | public function store(Request $request)
{
// validate
$this->registerValidators();
$validator = Validator::make($request->all(), [
'route' => 'required|max:255|string|unique:route_permission,route',
'permissions' => 'required|max:255|array|rolePermission',
... | [
"public",
"function",
"store",
"(",
"Request",
"$",
"request",
")",
"{",
"// validate",
"$",
"this",
"->",
"registerValidators",
"(",
")",
";",
"$",
"validator",
"=",
"Validator",
"::",
"make",
"(",
"$",
"request",
"->",
"all",
"(",
")",
",",
"[",
"'ro... | Create route permission action
@param Request $request
@return Response | [
"Create",
"route",
"permission",
"action"
] | cd8d696dbf7337002188576d8a143cbc19d86b40 | https://github.com/php-soft/laravel-users/blob/cd8d696dbf7337002188576d8a143cbc19d86b40/packages/Users/Controllers/RoutePermissionController.php#L52-L84 |
222,416 | php-soft/laravel-users | packages/Users/Controllers/RoutePermissionController.php | RoutePermissionController.update | public function update($id, Request $request)
{
$routePermission = RoutePermission::find($id);
if ($routePermission == null) {
return response()->json(null, 404);
}
// validate
$this->registerValidators();
$validator = Validator::make($request->all(), [... | php | public function update($id, Request $request)
{
$routePermission = RoutePermission::find($id);
if ($routePermission == null) {
return response()->json(null, 404);
}
// validate
$this->registerValidators();
$validator = Validator::make($request->all(), [... | [
"public",
"function",
"update",
"(",
"$",
"id",
",",
"Request",
"$",
"request",
")",
"{",
"$",
"routePermission",
"=",
"RoutePermission",
"::",
"find",
"(",
"$",
"id",
")",
";",
"if",
"(",
"$",
"routePermission",
"==",
"null",
")",
"{",
"return",
"resp... | Update permissions and roles for a route
@param Request $request
@return Response | [
"Update",
"permissions",
"and",
"roles",
"for",
"a",
"route"
] | cd8d696dbf7337002188576d8a143cbc19d86b40 | https://github.com/php-soft/laravel-users/blob/cd8d696dbf7337002188576d8a143cbc19d86b40/packages/Users/Controllers/RoutePermissionController.php#L92-L131 |
222,417 | php-soft/laravel-users | packages/Users/Controllers/RoutePermissionController.php | RoutePermissionController.destroy | public function destroy($id)
{
// get route permission by id
$routePermission = RoutePermission::find($id);
if (!$routePermission) {
return response()->json(null, 404);
}
// check current user is admin
if (!(Auth::user() && Auth::user()->hasRole('admin')... | php | public function destroy($id)
{
// get route permission by id
$routePermission = RoutePermission::find($id);
if (!$routePermission) {
return response()->json(null, 404);
}
// check current user is admin
if (!(Auth::user() && Auth::user()->hasRole('admin')... | [
"public",
"function",
"destroy",
"(",
"$",
"id",
")",
"{",
"// get route permission by id",
"$",
"routePermission",
"=",
"RoutePermission",
"::",
"find",
"(",
"$",
"id",
")",
";",
"if",
"(",
"!",
"$",
"routePermission",
")",
"{",
"return",
"response",
"(",
... | Delete route permission
@param int $id
@return Response | [
"Delete",
"route",
"permission"
] | cd8d696dbf7337002188576d8a143cbc19d86b40 | https://github.com/php-soft/laravel-users/blob/cd8d696dbf7337002188576d8a143cbc19d86b40/packages/Users/Controllers/RoutePermissionController.php#L138-L160 |
222,418 | php-soft/laravel-users | packages/Users/Controllers/RoutePermissionController.php | RoutePermissionController.show | public function show($id)
{
// get permissions and roles of a route by id
$routePermission = RoutePermission::find($id);
if (!$routePermission) {
return response()->json(null, 404);
}
return response()->json(arrayView('phpsoft.users::routePermission/read', [
... | php | public function show($id)
{
// get permissions and roles of a route by id
$routePermission = RoutePermission::find($id);
if (!$routePermission) {
return response()->json(null, 404);
}
return response()->json(arrayView('phpsoft.users::routePermission/read', [
... | [
"public",
"function",
"show",
"(",
"$",
"id",
")",
"{",
"// get permissions and roles of a route by id",
"$",
"routePermission",
"=",
"RoutePermission",
"::",
"find",
"(",
"$",
"id",
")",
";",
"if",
"(",
"!",
"$",
"routePermission",
")",
"{",
"return",
"respon... | View route permission
@param int $id
@return Response | [
"View",
"route",
"permission"
] | cd8d696dbf7337002188576d8a143cbc19d86b40 | https://github.com/php-soft/laravel-users/blob/cd8d696dbf7337002188576d8a143cbc19d86b40/packages/Users/Controllers/RoutePermissionController.php#L167-L179 |
222,419 | php-soft/laravel-users | packages/Users/Controllers/RoutePermissionController.php | RoutePermissionController.getAllRoutes | public function getAllRoutes()
{
$routes = Route::getRoutes();
$results = [];
if ($routes != null) {
foreach ($routes as $route) {
$route = array(
'method' => $route->getMethods(),
'uri' => $route->getPath()
... | php | public function getAllRoutes()
{
$routes = Route::getRoutes();
$results = [];
if ($routes != null) {
foreach ($routes as $route) {
$route = array(
'method' => $route->getMethods(),
'uri' => $route->getPath()
... | [
"public",
"function",
"getAllRoutes",
"(",
")",
"{",
"$",
"routes",
"=",
"Route",
"::",
"getRoutes",
"(",
")",
";",
"$",
"results",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"routes",
"!=",
"null",
")",
"{",
"foreach",
"(",
"$",
"routes",
"as",
"$",
"r... | List all routes in app
@param
@return Response | [
"List",
"all",
"routes",
"in",
"app"
] | cd8d696dbf7337002188576d8a143cbc19d86b40 | https://github.com/php-soft/laravel-users/blob/cd8d696dbf7337002188576d8a143cbc19d86b40/packages/Users/Controllers/RoutePermissionController.php#L205-L223 |
222,420 | ramsey/twig-codeblock | src/TokenParser/CodeBlockParser.php | CodeBlockParser.parse | public function parse(\Twig_Token $token)
{
$this->parseCodeBlock();
return new CodeBlockNode(
$this->highlighterName,
$this->highlighterArgs,
$this->getAttributes(),
$this->getBody(),
$token->getLine(),
$this->getTag()
... | php | public function parse(\Twig_Token $token)
{
$this->parseCodeBlock();
return new CodeBlockNode(
$this->highlighterName,
$this->highlighterArgs,
$this->getAttributes(),
$this->getBody(),
$token->getLine(),
$this->getTag()
... | [
"public",
"function",
"parse",
"(",
"\\",
"Twig_Token",
"$",
"token",
")",
"{",
"$",
"this",
"->",
"parseCodeBlock",
"(",
")",
";",
"return",
"new",
"CodeBlockNode",
"(",
"$",
"this",
"->",
"highlighterName",
",",
"$",
"this",
"->",
"highlighterArgs",
",",... | Parses the codeblock tag and returns a node for Twig to use
@param \Twig_Token $token The codeblock tag to parse
@return CodeBlockNode | [
"Parses",
"the",
"codeblock",
"tag",
"and",
"returns",
"a",
"node",
"for",
"Twig",
"to",
"use"
] | bf3a940af4c5d5a66b1e66e9464fccc29579b23f | https://github.com/ramsey/twig-codeblock/blob/bf3a940af4c5d5a66b1e66e9464fccc29579b23f/src/TokenParser/CodeBlockParser.php#L75-L87 |
222,421 | ramsey/twig-codeblock | src/TokenParser/CodeBlockParser.php | CodeBlockParser.parseCodeBlock | protected function parseCodeBlock()
{
$stream = $this->parser->getStream();
while (!$stream->getCurrent()->test(\Twig_Token::BLOCK_END_TYPE)) {
$this->parseEncounteredToken($stream->getCurrent(), $stream);
}
$stream->expect(\Twig_Token::BLOCK_END_TYPE);
$this->b... | php | protected function parseCodeBlock()
{
$stream = $this->parser->getStream();
while (!$stream->getCurrent()->test(\Twig_Token::BLOCK_END_TYPE)) {
$this->parseEncounteredToken($stream->getCurrent(), $stream);
}
$stream->expect(\Twig_Token::BLOCK_END_TYPE);
$this->b... | [
"protected",
"function",
"parseCodeBlock",
"(",
")",
"{",
"$",
"stream",
"=",
"$",
"this",
"->",
"parser",
"->",
"getStream",
"(",
")",
";",
"while",
"(",
"!",
"$",
"stream",
"->",
"getCurrent",
"(",
")",
"->",
"test",
"(",
"\\",
"Twig_Token",
"::",
... | Parses the options found on the codeblock tag for use by the node | [
"Parses",
"the",
"options",
"found",
"on",
"the",
"codeblock",
"tag",
"for",
"use",
"by",
"the",
"node"
] | bf3a940af4c5d5a66b1e66e9464fccc29579b23f | https://github.com/ramsey/twig-codeblock/blob/bf3a940af4c5d5a66b1e66e9464fccc29579b23f/src/TokenParser/CodeBlockParser.php#L134-L145 |
222,422 | ramsey/twig-codeblock | src/TokenParser/CodeBlockParser.php | CodeBlockParser.parseEncounteredToken | protected function parseEncounteredToken(\Twig_Token $token, \Twig_TokenStream $stream)
{
switch ($token->getValue()) {
case 'lang':
$this->attributes['lang'] = $this->parseLangOption($token, $stream);
break;
case 'format':
$this->attr... | php | protected function parseEncounteredToken(\Twig_Token $token, \Twig_TokenStream $stream)
{
switch ($token->getValue()) {
case 'lang':
$this->attributes['lang'] = $this->parseLangOption($token, $stream);
break;
case 'format':
$this->attr... | [
"protected",
"function",
"parseEncounteredToken",
"(",
"\\",
"Twig_Token",
"$",
"token",
",",
"\\",
"Twig_TokenStream",
"$",
"stream",
")",
"{",
"switch",
"(",
"$",
"token",
"->",
"getValue",
"(",
")",
")",
"{",
"case",
"'lang'",
":",
"$",
"this",
"->",
... | Parses each specific token found when looping through the codeblock tag
@param \Twig_Token $token The token being parsed
@param \Twig_TokenStream $stream The token stream being traversed | [
"Parses",
"each",
"specific",
"token",
"found",
"when",
"looping",
"through",
"the",
"codeblock",
"tag"
] | bf3a940af4c5d5a66b1e66e9464fccc29579b23f | https://github.com/ramsey/twig-codeblock/blob/bf3a940af4c5d5a66b1e66e9464fccc29579b23f/src/TokenParser/CodeBlockParser.php#L153-L192 |
222,423 | ramsey/twig-codeblock | src/TokenParser/CodeBlockParser.php | CodeBlockParser.parseLangOption | protected function parseLangOption(\Twig_Token $token, \Twig_TokenStream $stream)
{
$this->testToken('lang', $token, $stream);
return $this->getNextExpectedStringValueFromStream($stream, \Twig_Token::STRING_TYPE);
} | php | protected function parseLangOption(\Twig_Token $token, \Twig_TokenStream $stream)
{
$this->testToken('lang', $token, $stream);
return $this->getNextExpectedStringValueFromStream($stream, \Twig_Token::STRING_TYPE);
} | [
"protected",
"function",
"parseLangOption",
"(",
"\\",
"Twig_Token",
"$",
"token",
",",
"\\",
"Twig_TokenStream",
"$",
"stream",
")",
"{",
"$",
"this",
"->",
"testToken",
"(",
"'lang'",
",",
"$",
"token",
",",
"$",
"stream",
")",
";",
"return",
"$",
"thi... | Returns the programming language option value from the lang token
@param \Twig_Token $token The token to parse
@param \Twig_TokenStream $stream The token stream being traversed
@return string | [
"Returns",
"the",
"programming",
"language",
"option",
"value",
"from",
"the",
"lang",
"token"
] | bf3a940af4c5d5a66b1e66e9464fccc29579b23f | https://github.com/ramsey/twig-codeblock/blob/bf3a940af4c5d5a66b1e66e9464fccc29579b23f/src/TokenParser/CodeBlockParser.php#L222-L227 |
222,424 | ramsey/twig-codeblock | src/TokenParser/CodeBlockParser.php | CodeBlockParser.parseStartOption | protected function parseStartOption(\Twig_Token $token, \Twig_TokenStream $stream)
{
$this->testToken('start', $token, $stream);
return $this->getNextExpectedStringValueFromStream($stream, \Twig_Token::NUMBER_TYPE);
} | php | protected function parseStartOption(\Twig_Token $token, \Twig_TokenStream $stream)
{
$this->testToken('start', $token, $stream);
return $this->getNextExpectedStringValueFromStream($stream, \Twig_Token::NUMBER_TYPE);
} | [
"protected",
"function",
"parseStartOption",
"(",
"\\",
"Twig_Token",
"$",
"token",
",",
"\\",
"Twig_TokenStream",
"$",
"stream",
")",
"{",
"$",
"this",
"->",
"testToken",
"(",
"'start'",
",",
"$",
"token",
",",
"$",
"stream",
")",
";",
"return",
"$",
"t... | Returns the start option value from the start token
@param \Twig_Token $token The token to parse
@param \Twig_TokenStream $stream The token stream being traversed
@return integer | [
"Returns",
"the",
"start",
"option",
"value",
"from",
"the",
"start",
"token"
] | bf3a940af4c5d5a66b1e66e9464fccc29579b23f | https://github.com/ramsey/twig-codeblock/blob/bf3a940af4c5d5a66b1e66e9464fccc29579b23f/src/TokenParser/CodeBlockParser.php#L250-L255 |
222,425 | ramsey/twig-codeblock | src/TokenParser/CodeBlockParser.php | CodeBlockParser.parseMarkOption | protected function parseMarkOption(\Twig_Token $token, \Twig_TokenStream $stream)
{
$this->testToken('mark', $token, $stream);
$markValue = $this->getNextExpectedStringValueFromStream($stream, \Twig_Token::NUMBER_TYPE);
while ($stream->test(\Twig_Token::OPERATOR_TYPE)
|| $strea... | php | protected function parseMarkOption(\Twig_Token $token, \Twig_TokenStream $stream)
{
$this->testToken('mark', $token, $stream);
$markValue = $this->getNextExpectedStringValueFromStream($stream, \Twig_Token::NUMBER_TYPE);
while ($stream->test(\Twig_Token::OPERATOR_TYPE)
|| $strea... | [
"protected",
"function",
"parseMarkOption",
"(",
"\\",
"Twig_Token",
"$",
"token",
",",
"\\",
"Twig_TokenStream",
"$",
"stream",
")",
"{",
"$",
"this",
"->",
"testToken",
"(",
"'mark'",
",",
"$",
"token",
",",
"$",
"stream",
")",
";",
"$",
"markValue",
"... | Returns the mark option value from the mark token
@param \Twig_Token $token The token to parse
@param \Twig_TokenStream $stream The token stream being traversed
@return string | [
"Returns",
"the",
"mark",
"option",
"value",
"from",
"the",
"mark",
"token"
] | bf3a940af4c5d5a66b1e66e9464fccc29579b23f | https://github.com/ramsey/twig-codeblock/blob/bf3a940af4c5d5a66b1e66e9464fccc29579b23f/src/TokenParser/CodeBlockParser.php#L264-L279 |
222,426 | ramsey/twig-codeblock | src/TokenParser/CodeBlockParser.php | CodeBlockParser.parseLinenosOption | protected function parseLinenosOption(\Twig_Token $token, \Twig_TokenStream $stream)
{
$this->testToken('linenos', $token, $stream);
return $this->getNextExpectedBoolValueFromStream($stream, 'linenos');
} | php | protected function parseLinenosOption(\Twig_Token $token, \Twig_TokenStream $stream)
{
$this->testToken('linenos', $token, $stream);
return $this->getNextExpectedBoolValueFromStream($stream, 'linenos');
} | [
"protected",
"function",
"parseLinenosOption",
"(",
"\\",
"Twig_Token",
"$",
"token",
",",
"\\",
"Twig_TokenStream",
"$",
"stream",
")",
"{",
"$",
"this",
"->",
"testToken",
"(",
"'linenos'",
",",
"$",
"token",
",",
"$",
"stream",
")",
";",
"return",
"$",
... | Returns the linenos option value from the linenos token
@param \Twig_Token $token The token to parse
@param \Twig_TokenStream $stream The token stream being traversed
@return boolean | [
"Returns",
"the",
"linenos",
"option",
"value",
"from",
"the",
"linenos",
"token"
] | bf3a940af4c5d5a66b1e66e9464fccc29579b23f | https://github.com/ramsey/twig-codeblock/blob/bf3a940af4c5d5a66b1e66e9464fccc29579b23f/src/TokenParser/CodeBlockParser.php#L288-L293 |
222,427 | ramsey/twig-codeblock | src/TokenParser/CodeBlockParser.php | CodeBlockParser.getNextExpectedStringValueFromStream | protected function getNextExpectedStringValueFromStream(
\Twig_TokenStream $stream,
$type
) {
$stream->next();
$stream->expect(\Twig_Token::PUNCTUATION_TYPE);
return $stream->expect($type)->getValue();
} | php | protected function getNextExpectedStringValueFromStream(
\Twig_TokenStream $stream,
$type
) {
$stream->next();
$stream->expect(\Twig_Token::PUNCTUATION_TYPE);
return $stream->expect($type)->getValue();
} | [
"protected",
"function",
"getNextExpectedStringValueFromStream",
"(",
"\\",
"Twig_TokenStream",
"$",
"stream",
",",
"$",
"type",
")",
"{",
"$",
"stream",
"->",
"next",
"(",
")",
";",
"$",
"stream",
"->",
"expect",
"(",
"\\",
"Twig_Token",
"::",
"PUNCTUATION_TY... | Helper method for the common operation of grabbing the next string value
from the stream
@param \Twig_TokenStream $stream
@param int $type
@return string | [
"Helper",
"method",
"for",
"the",
"common",
"operation",
"of",
"grabbing",
"the",
"next",
"string",
"value",
"from",
"the",
"stream"
] | bf3a940af4c5d5a66b1e66e9464fccc29579b23f | https://github.com/ramsey/twig-codeblock/blob/bf3a940af4c5d5a66b1e66e9464fccc29579b23f/src/TokenParser/CodeBlockParser.php#L359-L367 |
222,428 | ramsey/twig-codeblock | src/TokenParser/CodeBlockParser.php | CodeBlockParser.getNextExpectedBoolValueFromStream | protected function getNextExpectedBoolValueFromStream(
\Twig_TokenStream $stream,
$optionName
) {
$stream->next();
$stream->expect(\Twig_Token::PUNCTUATION_TYPE);
$expr = $this->parser->getExpressionParser()->parseExpression();
if (!($expr instanceof \Twig_Node_Expre... | php | protected function getNextExpectedBoolValueFromStream(
\Twig_TokenStream $stream,
$optionName
) {
$stream->next();
$stream->expect(\Twig_Token::PUNCTUATION_TYPE);
$expr = $this->parser->getExpressionParser()->parseExpression();
if (!($expr instanceof \Twig_Node_Expre... | [
"protected",
"function",
"getNextExpectedBoolValueFromStream",
"(",
"\\",
"Twig_TokenStream",
"$",
"stream",
",",
"$",
"optionName",
")",
"{",
"$",
"stream",
"->",
"next",
"(",
")",
";",
"$",
"stream",
"->",
"expect",
"(",
"\\",
"Twig_Token",
"::",
"PUNCTUATIO... | Helper method for the common operation of grabbing the next boolean value
from the stream
@param \Twig_TokenStream $stream
@param string $optionName
@return string | [
"Helper",
"method",
"for",
"the",
"common",
"operation",
"of",
"grabbing",
"the",
"next",
"boolean",
"value",
"from",
"the",
"stream"
] | bf3a940af4c5d5a66b1e66e9464fccc29579b23f | https://github.com/ramsey/twig-codeblock/blob/bf3a940af4c5d5a66b1e66e9464fccc29579b23f/src/TokenParser/CodeBlockParser.php#L377-L398 |
222,429 | ramsey/twig-codeblock | src/TokenParser/CodeBlockParser.php | CodeBlockParser.getStreamFilename | private function getStreamFilename(\Twig_TokenStream $stream)
{
if (method_exists($stream, 'getFilename')) {
// Support for 1.x versions of Twig.
// @codeCoverageIgnoreStart
return $stream->getFilename();
// @codeCoverageIgnoreEnd
}
return $st... | php | private function getStreamFilename(\Twig_TokenStream $stream)
{
if (method_exists($stream, 'getFilename')) {
// Support for 1.x versions of Twig.
// @codeCoverageIgnoreStart
return $stream->getFilename();
// @codeCoverageIgnoreEnd
}
return $st... | [
"private",
"function",
"getStreamFilename",
"(",
"\\",
"Twig_TokenStream",
"$",
"stream",
")",
"{",
"if",
"(",
"method_exists",
"(",
"$",
"stream",
",",
"'getFilename'",
")",
")",
"{",
"// Support for 1.x versions of Twig.",
"// @codeCoverageIgnoreStart",
"return",
"$... | Returns the filename for the given stream
@param \Twig_TokenStream $stream
@return string | [
"Returns",
"the",
"filename",
"for",
"the",
"given",
"stream"
] | bf3a940af4c5d5a66b1e66e9464fccc29579b23f | https://github.com/ramsey/twig-codeblock/blob/bf3a940af4c5d5a66b1e66e9464fccc29579b23f/src/TokenParser/CodeBlockParser.php#L406-L416 |
222,430 | joomla-framework/di | src/Container.php | Container.tag | public function tag($tag, array $keys)
{
foreach ($keys as $key)
{
$resolvedKey = $this->resolveAlias($key);
if (!isset($this->tags[$tag]))
{
$this->tags[$tag] = array();
}
$this->tags[$tag][] = $resolvedKey;
}
// Prune duplicates
$this->tags[$tag] = array_unique($this->tags[$tag]);
... | php | public function tag($tag, array $keys)
{
foreach ($keys as $key)
{
$resolvedKey = $this->resolveAlias($key);
if (!isset($this->tags[$tag]))
{
$this->tags[$tag] = array();
}
$this->tags[$tag][] = $resolvedKey;
}
// Prune duplicates
$this->tags[$tag] = array_unique($this->tags[$tag]);
... | [
"public",
"function",
"tag",
"(",
"$",
"tag",
",",
"array",
"$",
"keys",
")",
"{",
"foreach",
"(",
"$",
"keys",
"as",
"$",
"key",
")",
"{",
"$",
"resolvedKey",
"=",
"$",
"this",
"->",
"resolveAlias",
"(",
"$",
"key",
")",
";",
"if",
"(",
"!",
"... | Assign a tag to services.
@param string $tag The tag name
@param array $keys The service keys to tag
@return Container This object for chaining.
@since 1.5.0 | [
"Assign",
"a",
"tag",
"to",
"services",
"."
] | f3098a4f6528098d48e6d694ae3ee79dd8fe6b92 | https://github.com/joomla-framework/di/blob/f3098a4f6528098d48e6d694ae3ee79dd8fe6b92/src/Container.php#L127-L145 |
222,431 | joomla-framework/di | src/Container.php | Container.getTagged | public function getTagged($tag)
{
$services = array();
if (isset($this->tags[$tag]))
{
foreach ($this->tags[$tag] as $service)
{
$services[] = $this->get($service);
}
}
return $services;
} | php | public function getTagged($tag)
{
$services = array();
if (isset($this->tags[$tag]))
{
foreach ($this->tags[$tag] as $service)
{
$services[] = $this->get($service);
}
}
return $services;
} | [
"public",
"function",
"getTagged",
"(",
"$",
"tag",
")",
"{",
"$",
"services",
"=",
"array",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"tags",
"[",
"$",
"tag",
"]",
")",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"tags",
"[",... | Fetch all services registered to the given tag.
@param string $tag The tag name
@return array The resolved services for the given tag
@since 1.5.0 | [
"Fetch",
"all",
"services",
"registered",
"to",
"the",
"given",
"tag",
"."
] | f3098a4f6528098d48e6d694ae3ee79dd8fe6b92 | https://github.com/joomla-framework/di/blob/f3098a4f6528098d48e6d694ae3ee79dd8fe6b92/src/Container.php#L156-L169 |
222,432 | joomla-framework/di | src/Container.php | Container.has | public function has($key)
{
$key = $this->resolveAlias($key);
$exists = (bool) $this->getRaw($key);
if ($exists === false && $this->parent instanceof ContainerInterface)
{
$exists = $this->parent->has($key);
}
return $exists;
} | php | public function has($key)
{
$key = $this->resolveAlias($key);
$exists = (bool) $this->getRaw($key);
if ($exists === false && $this->parent instanceof ContainerInterface)
{
$exists = $this->parent->has($key);
}
return $exists;
} | [
"public",
"function",
"has",
"(",
"$",
"key",
")",
"{",
"$",
"key",
"=",
"$",
"this",
"->",
"resolveAlias",
"(",
"$",
"key",
")",
";",
"$",
"exists",
"=",
"(",
"bool",
")",
"$",
"this",
"->",
"getRaw",
"(",
"$",
"key",
")",
";",
"if",
"(",
"$... | Method to check if specified dataStore key exists.
@param string $key Name of the dataStore key to check.
@return boolean True for success
@since 1.5.0 | [
"Method",
"to",
"check",
"if",
"specified",
"dataStore",
"key",
"exists",
"."
] | f3098a4f6528098d48e6d694ae3ee79dd8fe6b92 | https://github.com/joomla-framework/di/blob/f3098a4f6528098d48e6d694ae3ee79dd8fe6b92/src/Container.php#L481-L493 |
222,433 | codefog/tags-bundle | src/ManagerRegistry.php | ManagerRegistry.add | public function add(ManagerInterface $manager, string $alias): void
{
$manager->setAlias($alias);
// @todo – change this in 3.0
if ($manager instanceof DefaultManager) {
$manager->setDatabase($this->db);
}
$this->managers[$alias] = $manager;
} | php | public function add(ManagerInterface $manager, string $alias): void
{
$manager->setAlias($alias);
// @todo – change this in 3.0
if ($manager instanceof DefaultManager) {
$manager->setDatabase($this->db);
}
$this->managers[$alias] = $manager;
} | [
"public",
"function",
"add",
"(",
"ManagerInterface",
"$",
"manager",
",",
"string",
"$",
"alias",
")",
":",
"void",
"{",
"$",
"manager",
"->",
"setAlias",
"(",
"$",
"alias",
")",
";",
"// @todo – change this in 3.0",
"if",
"(",
"$",
"manager",
"instanceof",... | Add the manager.
@param ManagerInterface $manager
@param string $alias | [
"Add",
"the",
"manager",
"."
] | 5fca40497b3a921c2cae28446753185adb240a5c | https://github.com/codefog/tags-bundle/blob/5fca40497b3a921c2cae28446753185adb240a5c/src/ManagerRegistry.php#L49-L59 |
222,434 | codefog/tags-bundle | src/ManagerRegistry.php | ManagerRegistry.get | public function get(string $alias): ManagerInterface
{
if (!\array_key_exists($alias, $this->managers)) {
throw new \InvalidArgumentException(\sprintf('The manager "%s" does not exist', $alias));
}
return $this->managers[$alias];
} | php | public function get(string $alias): ManagerInterface
{
if (!\array_key_exists($alias, $this->managers)) {
throw new \InvalidArgumentException(\sprintf('The manager "%s" does not exist', $alias));
}
return $this->managers[$alias];
} | [
"public",
"function",
"get",
"(",
"string",
"$",
"alias",
")",
":",
"ManagerInterface",
"{",
"if",
"(",
"!",
"\\",
"array_key_exists",
"(",
"$",
"alias",
",",
"$",
"this",
"->",
"managers",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
... | Get the manager.
@param string $alias
@throws \InvalidArgumentException
@return ManagerInterface | [
"Get",
"the",
"manager",
"."
] | 5fca40497b3a921c2cae28446753185adb240a5c | https://github.com/codefog/tags-bundle/blob/5fca40497b3a921c2cae28446753185adb240a5c/src/ManagerRegistry.php#L70-L77 |
222,435 | justinrainbow/epub | src/ePub/Resource/OpfResource.php | OpfResource.getXmlAttributes | private function getXmlAttributes($xml)
{
$attributes = array();
foreach ($this->namespaces as $prefix => $namespace) {
foreach ($xml->attributes($namespace) as $attr => $value) {
if ($prefix !== "") {
$attr = "{$prefix}:{$attr}";
}
... | php | private function getXmlAttributes($xml)
{
$attributes = array();
foreach ($this->namespaces as $prefix => $namespace) {
foreach ($xml->attributes($namespace) as $attr => $value) {
if ($prefix !== "") {
$attr = "{$prefix}:{$attr}";
}
... | [
"private",
"function",
"getXmlAttributes",
"(",
"$",
"xml",
")",
"{",
"$",
"attributes",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"namespaces",
"as",
"$",
"prefix",
"=>",
"$",
"namespace",
")",
"{",
"foreach",
"(",
"$",
"xml",
... | Builds an array from XML attributes
For instance:
<tag
xmlns:opf="http://www.idpf.org/2007/opf"
opf:file-as="Some Guy"
id="name"/>
Will become:
array('opf:file-as' => 'Some Guy', 'id' => 'name')
**NOTE**: Namespaced attributes will have the namespace prefix
prepended to the attribute name
@param \SimpleXMLElement... | [
"Builds",
"an",
"array",
"from",
"XML",
"attributes"
] | fbdc795f74907066283418bf1c5022b707a2abe8 | https://github.com/justinrainbow/epub/blob/fbdc795f74907066283418bf1c5022b707a2abe8/src/ePub/Resource/OpfResource.php#L189-L203 |
222,436 | codete/FormGeneratorBundle | FormGenerator.php | FormGenerator.createFormBuilder | public function createFormBuilder($model, $form = 'default', $context = [], $options=[])
{
$fb = $this->formFactory->createBuilder(FormType::class, $model, $options);
$this->populateFormBuilder($fb, $model, $form, $context);
return $fb;
} | php | public function createFormBuilder($model, $form = 'default', $context = [], $options=[])
{
$fb = $this->formFactory->createBuilder(FormType::class, $model, $options);
$this->populateFormBuilder($fb, $model, $form, $context);
return $fb;
} | [
"public",
"function",
"createFormBuilder",
"(",
"$",
"model",
",",
"$",
"form",
"=",
"'default'",
",",
"$",
"context",
"=",
"[",
"]",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"fb",
"=",
"$",
"this",
"->",
"formFactory",
"->",
"createBuilder... | Creates FormBuilder and populates it.
@param object $model data object
@param string $form view to generate
@param array $context
@param array $options
@return FormBuilderInterface | [
"Creates",
"FormBuilder",
"and",
"populates",
"it",
"."
] | c0bc3704d3f6df505ec232aa32b345159fffd980 | https://github.com/codete/FormGeneratorBundle/blob/c0bc3704d3f6df505ec232aa32b345159fffd980/FormGenerator.php#L77-L83 |
222,437 | codete/FormGeneratorBundle | FormGenerator.php | FormGenerator.createNamedFormBuilder | public function createNamedFormBuilder($name, $model, $form = 'default', $context = [], $options=[])
{
$fb = $this->formFactory->createNamedBuilder($name, FormType::class, $model, $options);
$this->populateFormBuilder($fb, $model, $form, $context);
return $fb;
} | php | public function createNamedFormBuilder($name, $model, $form = 'default', $context = [], $options=[])
{
$fb = $this->formFactory->createNamedBuilder($name, FormType::class, $model, $options);
$this->populateFormBuilder($fb, $model, $form, $context);
return $fb;
} | [
"public",
"function",
"createNamedFormBuilder",
"(",
"$",
"name",
",",
"$",
"model",
",",
"$",
"form",
"=",
"'default'",
",",
"$",
"context",
"=",
"[",
"]",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"fb",
"=",
"$",
"this",
"->",
"formFacto... | Creates named FormBuilder and populates it.
@param string $name
@param object $model data object
@param string $form view to generate
@param array $context
@param array $options
@return FormBuilderInterface | [
"Creates",
"named",
"FormBuilder",
"and",
"populates",
"it",
"."
] | c0bc3704d3f6df505ec232aa32b345159fffd980 | https://github.com/codete/FormGeneratorBundle/blob/c0bc3704d3f6df505ec232aa32b345159fffd980/FormGenerator.php#L95-L101 |
222,438 | codete/FormGeneratorBundle | FormGenerator.php | FormGenerator.populateFormBuilder | public function populateFormBuilder(FormBuilderInterface $fb, $model, $form = 'default', $context = [])
{
$configuration = $this->formConfigurationFactory->getConfiguration($form, $model, $context);
foreach ($this->adjusterRegistry->getFormConfigurationModifiers() as $modifier) {
if ($mo... | php | public function populateFormBuilder(FormBuilderInterface $fb, $model, $form = 'default', $context = [])
{
$configuration = $this->formConfigurationFactory->getConfiguration($form, $model, $context);
foreach ($this->adjusterRegistry->getFormConfigurationModifiers() as $modifier) {
if ($mo... | [
"public",
"function",
"populateFormBuilder",
"(",
"FormBuilderInterface",
"$",
"fb",
",",
"$",
"model",
",",
"$",
"form",
"=",
"'default'",
",",
"$",
"context",
"=",
"[",
"]",
")",
"{",
"$",
"configuration",
"=",
"$",
"this",
"->",
"formConfigurationFactory"... | Populates FormBuilder.
@param FormBuilderInterface $fb
@param object $model
@param string $form view to generate
@param array $context | [
"Populates",
"FormBuilder",
"."
] | c0bc3704d3f6df505ec232aa32b345159fffd980 | https://github.com/codete/FormGeneratorBundle/blob/c0bc3704d3f6df505ec232aa32b345159fffd980/FormGenerator.php#L111-L136 |
222,439 | codefog/tags-bundle | src/EventListener/InsertTagsListener.php | InsertTagsListener.replaceInsertTag | private function replaceInsertTag(array $elements): string
{
if (3 !== \count($elements)) {
return '';
}
list($source, $value, $property) = $elements;
$tag = $this->registry->get($source)->find($value);
if (null === $tag) {
return '';
}
... | php | private function replaceInsertTag(array $elements): string
{
if (3 !== \count($elements)) {
return '';
}
list($source, $value, $property) = $elements;
$tag = $this->registry->get($source)->find($value);
if (null === $tag) {
return '';
}
... | [
"private",
"function",
"replaceInsertTag",
"(",
"array",
"$",
"elements",
")",
":",
"string",
"{",
"if",
"(",
"3",
"!==",
"\\",
"count",
"(",
"$",
"elements",
")",
")",
"{",
"return",
"''",
";",
"}",
"list",
"(",
"$",
"source",
",",
"$",
"value",
"... | Replace the insert tag.
@param array $elements
@return string | [
"Replace",
"the",
"insert",
"tag",
"."
] | 5fca40497b3a921c2cae28446753185adb240a5c | https://github.com/codefog/tags-bundle/blob/5fca40497b3a921c2cae28446753185adb240a5c/src/EventListener/InsertTagsListener.php#L60-L81 |
222,440 | codefog/tags-bundle | src/Collection/ModelCollection.php | ModelCollection.createTagFromModel | public static function createTagFromModel(Model $model)
{
return new Tag((string) $model->id, $model->name, $model->row());
} | php | public static function createTagFromModel(Model $model)
{
return new Tag((string) $model->id, $model->name, $model->row());
} | [
"public",
"static",
"function",
"createTagFromModel",
"(",
"Model",
"$",
"model",
")",
"{",
"return",
"new",
"Tag",
"(",
"(",
"string",
")",
"$",
"model",
"->",
"id",
",",
"$",
"model",
"->",
"name",
",",
"$",
"model",
"->",
"row",
"(",
")",
")",
"... | Create the tag from model.
@param Model $model
@return Tag | [
"Create",
"the",
"tag",
"from",
"model",
"."
] | 5fca40497b3a921c2cae28446753185adb240a5c | https://github.com/codefog/tags-bundle/blob/5fca40497b3a921c2cae28446753185adb240a5c/src/Collection/ModelCollection.php#L40-L43 |
222,441 | codefog/tags-bundle | src/Collection/ModelCollection.php | ModelCollection.createTags | private function createTags(Collection $models): array
{
$tags = [];
/** @var Model $model */
foreach ($models as $model) {
$tags[] = static::createTagFromModel($model);
}
return $tags;
} | php | private function createTags(Collection $models): array
{
$tags = [];
/** @var Model $model */
foreach ($models as $model) {
$tags[] = static::createTagFromModel($model);
}
return $tags;
} | [
"private",
"function",
"createTags",
"(",
"Collection",
"$",
"models",
")",
":",
"array",
"{",
"$",
"tags",
"=",
"[",
"]",
";",
"/** @var Model $model */",
"foreach",
"(",
"$",
"models",
"as",
"$",
"model",
")",
"{",
"$",
"tags",
"[",
"]",
"=",
"static... | Create the tags.
@param Collection $models
@return array | [
"Create",
"the",
"tags",
"."
] | 5fca40497b3a921c2cae28446753185adb240a5c | https://github.com/codefog/tags-bundle/blob/5fca40497b3a921c2cae28446753185adb240a5c/src/Collection/ModelCollection.php#L52-L62 |
222,442 | ramsey/twig-codeblock | src/Highlighter/HighlighterFactory.php | HighlighterFactory.getHighlighter | public static function getHighlighter($highlighter = null, array $arguments = [])
{
if ($highlighter instanceof HighlighterInterface) {
return $highlighter;
}
switch ($highlighter) {
case 'pygments':
case null:
$highlighterClass = Pygments... | php | public static function getHighlighter($highlighter = null, array $arguments = [])
{
if ($highlighter instanceof HighlighterInterface) {
return $highlighter;
}
switch ($highlighter) {
case 'pygments':
case null:
$highlighterClass = Pygments... | [
"public",
"static",
"function",
"getHighlighter",
"(",
"$",
"highlighter",
"=",
"null",
",",
"array",
"$",
"arguments",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"$",
"highlighter",
"instanceof",
"HighlighterInterface",
")",
"{",
"return",
"$",
"highlighter",
";",... | Returns an instance of a highlighter by name or fully-qualified classname
@param string $highlighter Name or fully-qualified classname of the highlighter
@param array $arguments Array of arguments to pass to the highlighter upon instantiation
@return HighlighterInterface
@throws \RuntimeException if highlighter class ... | [
"Returns",
"an",
"instance",
"of",
"a",
"highlighter",
"by",
"name",
"or",
"fully",
"-",
"qualified",
"classname"
] | bf3a940af4c5d5a66b1e66e9464fccc29579b23f | https://github.com/ramsey/twig-codeblock/blob/bf3a940af4c5d5a66b1e66e9464fccc29579b23f/src/Highlighter/HighlighterFactory.php#L27-L61 |
222,443 | php-soft/laravel-users | packages/Users/Middleware/RoutePermission.php | RoutePermission.user | protected function user($request)
{
if (!$token = $this->auth->setRequest($request)->getToken()) {
return 401;
}
try {
$user = $this->auth->authenticate($token);
} catch (JWTException $e) {
return 401;
}
if (!$user) {
... | php | protected function user($request)
{
if (!$token = $this->auth->setRequest($request)->getToken()) {
return 401;
}
try {
$user = $this->auth->authenticate($token);
} catch (JWTException $e) {
return 401;
}
if (!$user) {
... | [
"protected",
"function",
"user",
"(",
"$",
"request",
")",
"{",
"if",
"(",
"!",
"$",
"token",
"=",
"$",
"this",
"->",
"auth",
"->",
"setRequest",
"(",
"$",
"request",
")",
"->",
"getToken",
"(",
")",
")",
"{",
"return",
"401",
";",
"}",
"try",
"{... | Get the currently authenticated user or null.
@return Illuminate\Auth\UserInterface|null | [
"Get",
"the",
"currently",
"authenticated",
"user",
"or",
"null",
"."
] | cd8d696dbf7337002188576d8a143cbc19d86b40 | https://github.com/php-soft/laravel-users/blob/cd8d696dbf7337002188576d8a143cbc19d86b40/packages/Users/Middleware/RoutePermission.php#L92-L109 |
222,444 | codete/FormGeneratorBundle | FormConfigurationFactory.php | FormConfigurationFactory.getConfiguration | public function getConfiguration($form, $model, $context)
{
$fields = null;
foreach ($this->adjusterRegistry->getFormViewProviders() as $provider) {
if ($provider->supports($form, $model, $context)) {
$fields = $provider->getFields($model, $context);
break... | php | public function getConfiguration($form, $model, $context)
{
$fields = null;
foreach ($this->adjusterRegistry->getFormViewProviders() as $provider) {
if ($provider->supports($form, $model, $context)) {
$fields = $provider->getFields($model, $context);
break... | [
"public",
"function",
"getConfiguration",
"(",
"$",
"form",
",",
"$",
"model",
",",
"$",
"context",
")",
"{",
"$",
"fields",
"=",
"null",
";",
"foreach",
"(",
"$",
"this",
"->",
"adjusterRegistry",
"->",
"getFormViewProviders",
"(",
")",
"as",
"$",
"prov... | Generates initial form configuration.
@param string $form
@param object $model
@param array $context
@return array | [
"Generates",
"initial",
"form",
"configuration",
"."
] | c0bc3704d3f6df505ec232aa32b345159fffd980 | https://github.com/codete/FormGeneratorBundle/blob/c0bc3704d3f6df505ec232aa32b345159fffd980/FormConfigurationFactory.php#L52-L66 |
222,445 | codefog/tags-bundle | src/EventListener/TagManagerListener.php | TagManagerListener.onLoadDataContainer | public function onLoadDataContainer(string $table): void
{
if (!isset($GLOBALS['TL_DCA'][$table]['fields']) || !\is_array($GLOBALS['TL_DCA'][$table]['fields'])) {
return;
}
$hasTagsFields = false;
foreach ($GLOBALS['TL_DCA'][$table]['fields'] as $name => &$field) {
... | php | public function onLoadDataContainer(string $table): void
{
if (!isset($GLOBALS['TL_DCA'][$table]['fields']) || !\is_array($GLOBALS['TL_DCA'][$table]['fields'])) {
return;
}
$hasTagsFields = false;
foreach ($GLOBALS['TL_DCA'][$table]['fields'] as $name => &$field) {
... | [
"public",
"function",
"onLoadDataContainer",
"(",
"string",
"$",
"table",
")",
":",
"void",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"GLOBALS",
"[",
"'TL_DCA'",
"]",
"[",
"$",
"table",
"]",
"[",
"'fields'",
"]",
")",
"||",
"!",
"\\",
"is_array",
"(",
... | On load the data container.
@param string $table | [
"On",
"load",
"the",
"data",
"container",
"."
] | 5fca40497b3a921c2cae28446753185adb240a5c | https://github.com/codefog/tags-bundle/blob/5fca40497b3a921c2cae28446753185adb240a5c/src/EventListener/TagManagerListener.php#L44-L69 |
222,446 | codefog/tags-bundle | src/EventListener/TagManagerListener.php | TagManagerListener.onFieldSave | public function onFieldSave(string $value, DataContainer $dc): string
{
$manager = $this->getManagerFromDca($dc);
if ($manager instanceof DcaAwareInterface) {
$value = $manager->saveDcaField($value, $dc);
}
return $value;
} | php | public function onFieldSave(string $value, DataContainer $dc): string
{
$manager = $this->getManagerFromDca($dc);
if ($manager instanceof DcaAwareInterface) {
$value = $manager->saveDcaField($value, $dc);
}
return $value;
} | [
"public",
"function",
"onFieldSave",
"(",
"string",
"$",
"value",
",",
"DataContainer",
"$",
"dc",
")",
":",
"string",
"{",
"$",
"manager",
"=",
"$",
"this",
"->",
"getManagerFromDca",
"(",
"$",
"dc",
")",
";",
"if",
"(",
"$",
"manager",
"instanceof",
... | On the field save.
@param string $value
@param DataContainer $dc
@return string | [
"On",
"the",
"field",
"save",
"."
] | 5fca40497b3a921c2cae28446753185adb240a5c | https://github.com/codefog/tags-bundle/blob/5fca40497b3a921c2cae28446753185adb240a5c/src/EventListener/TagManagerListener.php#L79-L88 |
222,447 | codefog/tags-bundle | src/EventListener/TagManagerListener.php | TagManagerListener.onOptionsCallback | public function onOptionsCallback(DataContainer $dc): array
{
$value = [];
$manager = $this->getManagerFromDca($dc);
if ($manager instanceof DcaFilterAwareInterface) {
$value = $manager->getFilterOptions($dc);
}
return $value;
} | php | public function onOptionsCallback(DataContainer $dc): array
{
$value = [];
$manager = $this->getManagerFromDca($dc);
if ($manager instanceof DcaFilterAwareInterface) {
$value = $manager->getFilterOptions($dc);
}
return $value;
} | [
"public",
"function",
"onOptionsCallback",
"(",
"DataContainer",
"$",
"dc",
")",
":",
"array",
"{",
"$",
"value",
"=",
"[",
"]",
";",
"$",
"manager",
"=",
"$",
"this",
"->",
"getManagerFromDca",
"(",
"$",
"dc",
")",
";",
"if",
"(",
"$",
"manager",
"i... | On options callback.
@param DataContainer $dc
@return array | [
"On",
"options",
"callback",
"."
] | 5fca40497b3a921c2cae28446753185adb240a5c | https://github.com/codefog/tags-bundle/blob/5fca40497b3a921c2cae28446753185adb240a5c/src/EventListener/TagManagerListener.php#L97-L107 |
222,448 | codefog/tags-bundle | src/EventListener/TagManagerListener.php | TagManagerListener.getManagerFromDca | private function getManagerFromDca(DataContainer $dc): ManagerInterface
{
return $this->registry->get($GLOBALS['TL_DCA'][$dc->table]['fields'][$dc->field]['eval']['tagsManager']);
} | php | private function getManagerFromDca(DataContainer $dc): ManagerInterface
{
return $this->registry->get($GLOBALS['TL_DCA'][$dc->table]['fields'][$dc->field]['eval']['tagsManager']);
} | [
"private",
"function",
"getManagerFromDca",
"(",
"DataContainer",
"$",
"dc",
")",
":",
"ManagerInterface",
"{",
"return",
"$",
"this",
"->",
"registry",
"->",
"get",
"(",
"$",
"GLOBALS",
"[",
"'TL_DCA'",
"]",
"[",
"$",
"dc",
"->",
"table",
"]",
"[",
"'fi... | Get the manager from DCA.
@param DataContainer $dc
@return ManagerInterface | [
"Get",
"the",
"manager",
"from",
"DCA",
"."
] | 5fca40497b3a921c2cae28446753185adb240a5c | https://github.com/codefog/tags-bundle/blob/5fca40497b3a921c2cae28446753185adb240a5c/src/EventListener/TagManagerListener.php#L116-L119 |
222,449 | codefog/tags-bundle | src/EventListener/TagManagerListener.php | TagManagerListener.addAssets | private function addAssets(): void
{
$GLOBALS['TL_CSS'][] = Debug::uncompressedFile('bundles/codefogtags/selectize.min.css');
$GLOBALS['TL_CSS'][] = Debug::uncompressedFile('bundles/codefogtags/backend.min.css');
if (!\in_array('assets/jquery/js/jquery.min.js', (array) $GLOBALS['TL_JAVASCRI... | php | private function addAssets(): void
{
$GLOBALS['TL_CSS'][] = Debug::uncompressedFile('bundles/codefogtags/selectize.min.css');
$GLOBALS['TL_CSS'][] = Debug::uncompressedFile('bundles/codefogtags/backend.min.css');
if (!\in_array('assets/jquery/js/jquery.min.js', (array) $GLOBALS['TL_JAVASCRI... | [
"private",
"function",
"addAssets",
"(",
")",
":",
"void",
"{",
"$",
"GLOBALS",
"[",
"'TL_CSS'",
"]",
"[",
"]",
"=",
"Debug",
"::",
"uncompressedFile",
"(",
"'bundles/codefogtags/selectize.min.css'",
")",
";",
"$",
"GLOBALS",
"[",
"'TL_CSS'",
"]",
"[",
"]",
... | Add the widget assets. | [
"Add",
"the",
"widget",
"assets",
"."
] | 5fca40497b3a921c2cae28446753185adb240a5c | https://github.com/codefog/tags-bundle/blob/5fca40497b3a921c2cae28446753185adb240a5c/src/EventListener/TagManagerListener.php#L124-L138 |
222,450 | codefog/tags-bundle | src/EventListener/DataContainer/TagListener.php | TagListener.onLoadCallback | public function onLoadCallback(DataContainer $dc): void
{
if (!($dc instanceof Driver)) {
return;
}
$ids = [];
// Collect the top tags from all registries
foreach ($this->registry->getAliases() as $alias) {
$manager = $this->registry->get($alias);
... | php | public function onLoadCallback(DataContainer $dc): void
{
if (!($dc instanceof Driver)) {
return;
}
$ids = [];
// Collect the top tags from all registries
foreach ($this->registry->getAliases() as $alias) {
$manager = $this->registry->get($alias);
... | [
"public",
"function",
"onLoadCallback",
"(",
"DataContainer",
"$",
"dc",
")",
":",
"void",
"{",
"if",
"(",
"!",
"(",
"$",
"dc",
"instanceof",
"Driver",
")",
")",
"{",
"return",
";",
"}",
"$",
"ids",
"=",
"[",
"]",
";",
"// Collect the top tags from all r... | On load callback.
@param DataContainer $dc | [
"On",
"load",
"callback",
"."
] | 5fca40497b3a921c2cae28446753185adb240a5c | https://github.com/codefog/tags-bundle/blob/5fca40497b3a921c2cae28446753185adb240a5c/src/EventListener/DataContainer/TagListener.php#L87-L138 |
222,451 | codefog/tags-bundle | src/EventListener/DataContainer/TagListener.php | TagListener.onPanelCallback | public function onPanelCallback(DataContainer $dc): string
{
/** @var AttributeBagInterface $bag */
$bag = $this->session->getBag('contao_backend');
$session = $bag->all();
$sorting = ['_default', 'total_asc', 'total_desc'];
$request = $this->requestStack->getCurrentRequest(... | php | public function onPanelCallback(DataContainer $dc): string
{
/** @var AttributeBagInterface $bag */
$bag = $this->session->getBag('contao_backend');
$session = $bag->all();
$sorting = ['_default', 'total_asc', 'total_desc'];
$request = $this->requestStack->getCurrentRequest(... | [
"public",
"function",
"onPanelCallback",
"(",
"DataContainer",
"$",
"dc",
")",
":",
"string",
"{",
"/** @var AttributeBagInterface $bag */",
"$",
"bag",
"=",
"$",
"this",
"->",
"session",
"->",
"getBag",
"(",
"'contao_backend'",
")",
";",
"$",
"session",
"=",
... | On generate panel callback.
@param DataContainer $dc
@return string | [
"On",
"generate",
"panel",
"callback",
"."
] | 5fca40497b3a921c2cae28446753185adb240a5c | https://github.com/codefog/tags-bundle/blob/5fca40497b3a921c2cae28446753185adb240a5c/src/EventListener/DataContainer/TagListener.php#L147-L189 |
222,452 | codefog/tags-bundle | src/EventListener/DataContainer/TagListener.php | TagListener.generateLabel | public function generateLabel(array $row, $label, DataContainer $dc, array $args): array
{
$manager = $this->getManager($row['source']);
if (null !== ($tag = $manager->find($row['id']))) {
$args[2] = $manager->countSourceRecords($tag);
}
return $args;
} | php | public function generateLabel(array $row, $label, DataContainer $dc, array $args): array
{
$manager = $this->getManager($row['source']);
if (null !== ($tag = $manager->find($row['id']))) {
$args[2] = $manager->countSourceRecords($tag);
}
return $args;
} | [
"public",
"function",
"generateLabel",
"(",
"array",
"$",
"row",
",",
"$",
"label",
",",
"DataContainer",
"$",
"dc",
",",
"array",
"$",
"args",
")",
":",
"array",
"{",
"$",
"manager",
"=",
"$",
"this",
"->",
"getManager",
"(",
"$",
"row",
"[",
"'sour... | Generate the label.
@param array $row
@param string $label
@param DataContainer $dc
@param array $args
@return array | [
"Generate",
"the",
"label",
"."
] | 5fca40497b3a921c2cae28446753185adb240a5c | https://github.com/codefog/tags-bundle/blob/5fca40497b3a921c2cae28446753185adb240a5c/src/EventListener/DataContainer/TagListener.php#L201-L210 |
222,453 | codefog/tags-bundle | src/EventListener/DataContainer/TagListener.php | TagListener.addAliasButton | public function addAliasButton(array $buttons, DataContainer $dc)
{
$request = $this->requestStack->getCurrentRequest();
// Generate the aliases
if ('tl_select' === $request->request->get('FORM_SUBMIT') && $request->request->has('alias')) {
$ids = $this->session->all()['CURRENT'... | php | public function addAliasButton(array $buttons, DataContainer $dc)
{
$request = $this->requestStack->getCurrentRequest();
// Generate the aliases
if ('tl_select' === $request->request->get('FORM_SUBMIT') && $request->request->has('alias')) {
$ids = $this->session->all()['CURRENT'... | [
"public",
"function",
"addAliasButton",
"(",
"array",
"$",
"buttons",
",",
"DataContainer",
"$",
"dc",
")",
"{",
"$",
"request",
"=",
"$",
"this",
"->",
"requestStack",
"->",
"getCurrentRequest",
"(",
")",
";",
"// Generate the aliases",
"if",
"(",
"'tl_select... | Automatically generate the folder URL aliases.
@param array $buttons
@param DataContainer $dc
@return array | [
"Automatically",
"generate",
"the",
"folder",
"URL",
"aliases",
"."
] | 5fca40497b3a921c2cae28446753185adb240a5c | https://github.com/codefog/tags-bundle/blob/5fca40497b3a921c2cae28446753185adb240a5c/src/EventListener/DataContainer/TagListener.php#L220-L280 |
222,454 | php-soft/laravel-users | packages/Users/Models/RoutePermission.php | RoutePermission.setRoutePermissionsRoles | public static function setRoutePermissionsRoles($route, $permissions = [], $roles = [])
{
$routePermission = parent::firstOrNew(['route' => $route]);
if (count($permissions)) {
$routePermission->permissions = json_encode($permissions);
}
if (count($roles)) {
... | php | public static function setRoutePermissionsRoles($route, $permissions = [], $roles = [])
{
$routePermission = parent::firstOrNew(['route' => $route]);
if (count($permissions)) {
$routePermission->permissions = json_encode($permissions);
}
if (count($roles)) {
... | [
"public",
"static",
"function",
"setRoutePermissionsRoles",
"(",
"$",
"route",
",",
"$",
"permissions",
"=",
"[",
"]",
",",
"$",
"roles",
"=",
"[",
"]",
")",
"{",
"$",
"routePermission",
"=",
"parent",
"::",
"firstOrNew",
"(",
"[",
"'route'",
"=>",
"$",
... | Set route permissions and roles
@param string
@param array | [
"Set",
"route",
"permissions",
"and",
"roles"
] | cd8d696dbf7337002188576d8a143cbc19d86b40 | https://github.com/php-soft/laravel-users/blob/cd8d696dbf7337002188576d8a143cbc19d86b40/packages/Users/Models/RoutePermission.php#L52-L66 |
222,455 | php-soft/laravel-users | packages/Users/Models/RoutePermission.php | RoutePermission.getRoutePermissionsRoles | public static function getRoutePermissionsRoles($route)
{
$routePermission = parent::where('route', $route)->first();
if (empty($routePermission)) {
return null;
}
$routePermission->permissions = json_decode($routePermission->permissions);
$routePermission->roles ... | php | public static function getRoutePermissionsRoles($route)
{
$routePermission = parent::where('route', $route)->first();
if (empty($routePermission)) {
return null;
}
$routePermission->permissions = json_decode($routePermission->permissions);
$routePermission->roles ... | [
"public",
"static",
"function",
"getRoutePermissionsRoles",
"(",
"$",
"route",
")",
"{",
"$",
"routePermission",
"=",
"parent",
"::",
"where",
"(",
"'route'",
",",
"$",
"route",
")",
"->",
"first",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"routePermi... | Get permissions and roles of an route
@param string
@return RoutePermission | [
"Get",
"permissions",
"and",
"roles",
"of",
"an",
"route"
] | cd8d696dbf7337002188576d8a143cbc19d86b40 | https://github.com/php-soft/laravel-users/blob/cd8d696dbf7337002188576d8a143cbc19d86b40/packages/Users/Models/RoutePermission.php#L74-L83 |
222,456 | php-soft/laravel-users | packages/Users/Models/RoutePermission.php | RoutePermission.browse | public static function browse($options = [])
{
$find = new RoutePermission();
$fillable = $find->fillable;
if (!empty($options['filters'])) {
$inFilters = array_intersect($fillable, array_keys($options['filters']));
if (!empty($inFilters)) {
foreach ... | php | public static function browse($options = [])
{
$find = new RoutePermission();
$fillable = $find->fillable;
if (!empty($options['filters'])) {
$inFilters = array_intersect($fillable, array_keys($options['filters']));
if (!empty($inFilters)) {
foreach ... | [
"public",
"static",
"function",
"browse",
"(",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"find",
"=",
"new",
"RoutePermission",
"(",
")",
";",
"$",
"fillable",
"=",
"$",
"find",
"->",
"fillable",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"options... | List permissions and roles of all route
@param array $options
@return array | [
"List",
"permissions",
"and",
"roles",
"of",
"all",
"route"
] | cd8d696dbf7337002188576d8a143cbc19d86b40 | https://github.com/php-soft/laravel-users/blob/cd8d696dbf7337002188576d8a143cbc19d86b40/packages/Users/Models/RoutePermission.php#L106-L147 |
222,457 | codefog/tags-bundle | src/Manager/DefaultManager.php | DefaultManager.findByAlias | public function findByAlias(string $alias): ?Tag
{
/** @var TagModel $adapter */
$adapter = $this->framework->getAdapter(TagModel::class);
$criteria = $this->getCriteria();
$criteria['alias'] = $alias;
if (null === ($model = $adapter->findOneByCriteria($criteria))) {
... | php | public function findByAlias(string $alias): ?Tag
{
/** @var TagModel $adapter */
$adapter = $this->framework->getAdapter(TagModel::class);
$criteria = $this->getCriteria();
$criteria['alias'] = $alias;
if (null === ($model = $adapter->findOneByCriteria($criteria))) {
... | [
"public",
"function",
"findByAlias",
"(",
"string",
"$",
"alias",
")",
":",
"?",
"Tag",
"{",
"/** @var TagModel $adapter */",
"$",
"adapter",
"=",
"$",
"this",
"->",
"framework",
"->",
"getAdapter",
"(",
"TagModel",
"::",
"class",
")",
";",
"$",
"criteria",
... | Find the tag by alias.
@param string $alias
@return Tag|null | [
"Find",
"the",
"tag",
"by",
"alias",
"."
] | 5fca40497b3a921c2cae28446753185adb240a5c | https://github.com/codefog/tags-bundle/blob/5fca40497b3a921c2cae28446753185adb240a5c/src/Manager/DefaultManager.php#L112-L125 |
222,458 | codefog/tags-bundle | src/Manager/DefaultManager.php | DefaultManager.findRelatedSourceRecords | public function findRelatedSourceRecords(int $sourceId, int $limit = null): array
{
/** @var Relations $relations */
$relations = $this->framework->getAdapter(Relations::class);
if (false === ($relation = $relations->getRelation($this->sourceTable, $this->sourceField))) {
throw ... | php | public function findRelatedSourceRecords(int $sourceId, int $limit = null): array
{
/** @var Relations $relations */
$relations = $this->framework->getAdapter(Relations::class);
if (false === ($relation = $relations->getRelation($this->sourceTable, $this->sourceField))) {
throw ... | [
"public",
"function",
"findRelatedSourceRecords",
"(",
"int",
"$",
"sourceId",
",",
"int",
"$",
"limit",
"=",
"null",
")",
":",
"array",
"{",
"/** @var Relations $relations */",
"$",
"relations",
"=",
"$",
"this",
"->",
"framework",
"->",
"getAdapter",
"(",
"R... | Find the related source records.
@param int $sourceId
@param int|null $limit
@throws \RuntimeException
@return array | [
"Find",
"the",
"related",
"source",
"records",
"."
] | 5fca40497b3a921c2cae28446753185adb240a5c | https://github.com/codefog/tags-bundle/blob/5fca40497b3a921c2cae28446753185adb240a5c/src/Manager/DefaultManager.php#L137-L185 |
222,459 | codefog/tags-bundle | src/Manager/DefaultManager.php | DefaultManager.getTopTagIds | public function getTopTagIds(array $sourceIds = [], int $limit = null, bool $withCount = false): array
{
/** @var Model $model */
$model = $this->framework->getAdapter(Model::class);
$tagIds = $model->getRelatedValues($this->sourceTable, $this->sourceField, $sourceIds);
$tagIds = \a... | php | public function getTopTagIds(array $sourceIds = [], int $limit = null, bool $withCount = false): array
{
/** @var Model $model */
$model = $this->framework->getAdapter(Model::class);
$tagIds = $model->getRelatedValues($this->sourceTable, $this->sourceField, $sourceIds);
$tagIds = \a... | [
"public",
"function",
"getTopTagIds",
"(",
"array",
"$",
"sourceIds",
"=",
"[",
"]",
",",
"int",
"$",
"limit",
"=",
"null",
",",
"bool",
"$",
"withCount",
"=",
"false",
")",
":",
"array",
"{",
"/** @var Model $model */",
"$",
"model",
"=",
"$",
"this",
... | Get the top tag IDs.
@param array $sourceIds
@param int|null $limit
@param bool $withCount
@return array | [
"Get",
"the",
"top",
"tag",
"IDs",
"."
] | 5fca40497b3a921c2cae28446753185adb240a5c | https://github.com/codefog/tags-bundle/blob/5fca40497b3a921c2cae28446753185adb240a5c/src/Manager/DefaultManager.php#L196-L224 |
222,460 | codefog/tags-bundle | src/Manager/DefaultManager.php | DefaultManager.createTag | protected function createTag(string $value): Tag
{
/** @var TagModel $model */
$model = $this->framework->createInstance(TagModel::class);
$model->tstamp = \time();
$model->name = $value;
$model->source = $this->alias;
$model->save();
return ModelCollection::... | php | protected function createTag(string $value): Tag
{
/** @var TagModel $model */
$model = $this->framework->createInstance(TagModel::class);
$model->tstamp = \time();
$model->name = $value;
$model->source = $this->alias;
$model->save();
return ModelCollection::... | [
"protected",
"function",
"createTag",
"(",
"string",
"$",
"value",
")",
":",
"Tag",
"{",
"/** @var TagModel $model */",
"$",
"model",
"=",
"$",
"this",
"->",
"framework",
"->",
"createInstance",
"(",
"TagModel",
"::",
"class",
")",
";",
"$",
"model",
"->",
... | Create the tag.
@param string $value
@return Tag | [
"Create",
"the",
"tag",
"."
] | 5fca40497b3a921c2cae28446753185adb240a5c | https://github.com/codefog/tags-bundle/blob/5fca40497b3a921c2cae28446753185adb240a5c/src/Manager/DefaultManager.php#L338-L348 |
222,461 | codefog/tags-bundle | src/Manager/DefaultManager.php | DefaultManager.getCriteria | protected function getCriteria(array $criteria = []): array
{
$criteria['source'] = $this->alias;
$criteria['sourceTable'] = $this->sourceTable;
$criteria['sourceField'] = $this->sourceField;
return $criteria;
} | php | protected function getCriteria(array $criteria = []): array
{
$criteria['source'] = $this->alias;
$criteria['sourceTable'] = $this->sourceTable;
$criteria['sourceField'] = $this->sourceField;
return $criteria;
} | [
"protected",
"function",
"getCriteria",
"(",
"array",
"$",
"criteria",
"=",
"[",
"]",
")",
":",
"array",
"{",
"$",
"criteria",
"[",
"'source'",
"]",
"=",
"$",
"this",
"->",
"alias",
";",
"$",
"criteria",
"[",
"'sourceTable'",
"]",
"=",
"$",
"this",
"... | Get the criteria with necessary data.
@param array $criteria
@return array | [
"Get",
"the",
"criteria",
"with",
"necessary",
"data",
"."
] | 5fca40497b3a921c2cae28446753185adb240a5c | https://github.com/codefog/tags-bundle/blob/5fca40497b3a921c2cae28446753185adb240a5c/src/Manager/DefaultManager.php#L357-L364 |
222,462 | ramsey/twig-codeblock | src/Highlighter/PygmentsHighlighter.php | PygmentsHighlighter.parseLexer | protected function parseLexer(array $options)
{
if (!empty($options['lang']) && strtolower($options['lang']) === 'plain') {
return static::DEFAULT_LEXER;
}
if (!empty($options['lang'])) {
return $options['lang'];
}
return static::DEFAULT_LEXER;
} | php | protected function parseLexer(array $options)
{
if (!empty($options['lang']) && strtolower($options['lang']) === 'plain') {
return static::DEFAULT_LEXER;
}
if (!empty($options['lang'])) {
return $options['lang'];
}
return static::DEFAULT_LEXER;
} | [
"protected",
"function",
"parseLexer",
"(",
"array",
"$",
"options",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"options",
"[",
"'lang'",
"]",
")",
"&&",
"strtolower",
"(",
"$",
"options",
"[",
"'lang'",
"]",
")",
"===",
"'plain'",
")",
"{",
"retur... | Returns the programming language from the options
@return string | [
"Returns",
"the",
"programming",
"language",
"from",
"the",
"options"
] | bf3a940af4c5d5a66b1e66e9464fccc29579b23f | https://github.com/ramsey/twig-codeblock/blob/bf3a940af4c5d5a66b1e66e9464fccc29579b23f/src/Highlighter/PygmentsHighlighter.php#L65-L76 |
222,463 | ramsey/twig-codeblock | src/Highlighter/PygmentsHighlighter.php | PygmentsHighlighter.parsePygmentsOptions | protected function parsePygmentsOptions(array $options, $code)
{
$pygmentsOptions = ['encoding' => 'utf-8'];
if (!empty($options['linenos']) && $options['linenos'] === true) {
$pygmentsOptions['linenos'] = 'table';
}
if (!empty($options['start'])) {
$pygment... | php | protected function parsePygmentsOptions(array $options, $code)
{
$pygmentsOptions = ['encoding' => 'utf-8'];
if (!empty($options['linenos']) && $options['linenos'] === true) {
$pygmentsOptions['linenos'] = 'table';
}
if (!empty($options['start'])) {
$pygment... | [
"protected",
"function",
"parsePygmentsOptions",
"(",
"array",
"$",
"options",
",",
"$",
"code",
")",
"{",
"$",
"pygmentsOptions",
"=",
"[",
"'encoding'",
"=>",
"'utf-8'",
"]",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"options",
"[",
"'linenos'",
"]",
")"... | Returns an array of options formatted for use with pygmentize
@param array $options Options passed to the highlighter
@param string $code The code to highlight
@return array | [
"Returns",
"an",
"array",
"of",
"options",
"formatted",
"for",
"use",
"with",
"pygmentize"
] | bf3a940af4c5d5a66b1e66e9464fccc29579b23f | https://github.com/ramsey/twig-codeblock/blob/bf3a940af4c5d5a66b1e66e9464fccc29579b23f/src/Highlighter/PygmentsHighlighter.php#L85-L109 |
222,464 | ramsey/twig-codeblock | src/Highlighter/PygmentsHighlighter.php | PygmentsHighlighter.parseMarks | protected function parseMarks($marks)
{
$markedLines = [];
foreach (explode(',', $marks) as $nums) {
if (strpos($nums, '-') !== false) {
list($from, $to) = explode('-', $nums);
$markedLines = array_merge($markedLines, range($from, $to));
} els... | php | protected function parseMarks($marks)
{
$markedLines = [];
foreach (explode(',', $marks) as $nums) {
if (strpos($nums, '-') !== false) {
list($from, $to) = explode('-', $nums);
$markedLines = array_merge($markedLines, range($from, $to));
} els... | [
"protected",
"function",
"parseMarks",
"(",
"$",
"marks",
")",
"{",
"$",
"markedLines",
"=",
"[",
"]",
";",
"foreach",
"(",
"explode",
"(",
"','",
",",
"$",
"marks",
")",
"as",
"$",
"nums",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"nums",
",",
"'... | Parses the marked lines in a way that pygmentize can use
@param string $marks The marks received from the codeblock
@return string | [
"Parses",
"the",
"marked",
"lines",
"in",
"a",
"way",
"that",
"pygmentize",
"can",
"use"
] | bf3a940af4c5d5a66b1e66e9464fccc29579b23f | https://github.com/ramsey/twig-codeblock/blob/bf3a940af4c5d5a66b1e66e9464fccc29579b23f/src/Highlighter/PygmentsHighlighter.php#L117-L131 |
222,465 | contao-bootstrap/grid | src/Listener/Dca/FormListener.php | FormListener.generateColumns | public function generateColumns($value, $dataContainer)
{
if (!$dataContainer->activeRecord) {
return null;
}
/** @var FormModel|Result $current */
$current = $dataContainer->activeRecord;
if ($value && $dataContainer->activeRecord) {
$stopElement =... | php | public function generateColumns($value, $dataContainer)
{
if (!$dataContainer->activeRecord) {
return null;
}
/** @var FormModel|Result $current */
$current = $dataContainer->activeRecord;
if ($value && $dataContainer->activeRecord) {
$stopElement =... | [
"public",
"function",
"generateColumns",
"(",
"$",
"value",
",",
"$",
"dataContainer",
")",
"{",
"if",
"(",
"!",
"$",
"dataContainer",
"->",
"activeRecord",
")",
"{",
"return",
"null",
";",
"}",
"/** @var FormModel|Result $current */",
"$",
"current",
"=",
"$"... | Generate the columns.
@param int $value Number of columns which should be generated.
@param DataContainer $dataContainer Data container driver.
@return null
@SuppressWarnings(PHPMD.UnusedFormalParameters) | [
"Generate",
"the",
"columns",
"."
] | 6e41d00822afa52eac46eb20fb49ce4abcdc199b | https://github.com/contao-bootstrap/grid/blob/6e41d00822afa52eac46eb20fb49ce4abcdc199b/src/Listener/Dca/FormListener.php#L39-L60 |
222,466 | contao-bootstrap/grid | src/Definition/Grid.php | Grid.addClass | public function addClass(string $class): self
{
$classes = explode(' ', $class);
foreach ($classes as $class) {
if (!in_array($class, $this->rowClasses)) {
$this->rowClasses[] = $class;
}
}
return $this;
} | php | public function addClass(string $class): self
{
$classes = explode(' ', $class);
foreach ($classes as $class) {
if (!in_array($class, $this->rowClasses)) {
$this->rowClasses[] = $class;
}
}
return $this;
} | [
"public",
"function",
"addClass",
"(",
"string",
"$",
"class",
")",
":",
"self",
"{",
"$",
"classes",
"=",
"explode",
"(",
"' '",
",",
"$",
"class",
")",
";",
"foreach",
"(",
"$",
"classes",
"as",
"$",
"class",
")",
"{",
"if",
"(",
"!",
"in_array",... | Add a class to the row.
@param string $class Row class.
@return Grid | [
"Add",
"a",
"class",
"to",
"the",
"row",
"."
] | 6e41d00822afa52eac46eb20fb49ce4abcdc199b | https://github.com/contao-bootstrap/grid/blob/6e41d00822afa52eac46eb20fb49ce4abcdc199b/src/Definition/Grid.php#L114-L125 |
222,467 | contao-bootstrap/grid | src/Definition/Grid.php | Grid.buildResets | public function buildResets(int $index): array
{
$resets = [];
foreach ($this->columns as $size => $columns) {
$column = $this->getColumnByIndex($columns, $index);
if ($column) {
$resets = $column->buildReset($resets, $size);
}
}
... | php | public function buildResets(int $index): array
{
$resets = [];
foreach ($this->columns as $size => $columns) {
$column = $this->getColumnByIndex($columns, $index);
if ($column) {
$resets = $column->buildReset($resets, $size);
}
}
... | [
"public",
"function",
"buildResets",
"(",
"int",
"$",
"index",
")",
":",
"array",
"{",
"$",
"resets",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"columns",
"as",
"$",
"size",
"=>",
"$",
"columns",
")",
"{",
"$",
"column",
"=",
"$",
"t... | Build reset classes.
@param int $index Column index.
@return array | [
"Build",
"reset",
"classes",
"."
] | 6e41d00822afa52eac46eb20fb49ce4abcdc199b | https://github.com/contao-bootstrap/grid/blob/6e41d00822afa52eac46eb20fb49ce4abcdc199b/src/Definition/Grid.php#L192-L205 |
222,468 | contao-bootstrap/grid | src/Definition/Grid.php | Grid.getColumnByIndex | private function getColumnByIndex(array $columns, int $index):? Column
{
$currentIndex = $index;
if (!array_key_exists($currentIndex, $columns) && $currentIndex > 0) {
$currentIndex = ($currentIndex % count($columns));
}
if (array_key_exists($currentIndex, $columns)) {
... | php | private function getColumnByIndex(array $columns, int $index):? Column
{
$currentIndex = $index;
if (!array_key_exists($currentIndex, $columns) && $currentIndex > 0) {
$currentIndex = ($currentIndex % count($columns));
}
if (array_key_exists($currentIndex, $columns)) {
... | [
"private",
"function",
"getColumnByIndex",
"(",
"array",
"$",
"columns",
",",
"int",
"$",
"index",
")",
":",
"?",
"Column",
"{",
"$",
"currentIndex",
"=",
"$",
"index",
";",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"currentIndex",
",",
"$",
"columns... | Get a column by index.
@param Column[] $columns Column.
@param int $index Column index.
@return null|Column | [
"Get",
"a",
"column",
"by",
"index",
"."
] | 6e41d00822afa52eac46eb20fb49ce4abcdc199b | https://github.com/contao-bootstrap/grid/blob/6e41d00822afa52eac46eb20fb49ce4abcdc199b/src/Definition/Grid.php#L215-L228 |
222,469 | contao-bootstrap/grid | src/Listener/Dca/AbstractWrapperDcaListener.php | AbstractWrapperDcaListener.createSeparators | protected function createSeparators(int $value, $current, int $sorting): int
{
for ($count = 1; $count <= $value; $count++) {
$sorting = ($sorting + 8);
$this->createGridElement($current, 'bs_gridSeparator', $sorting);
}
return $sorting;
} | php | protected function createSeparators(int $value, $current, int $sorting): int
{
for ($count = 1; $count <= $value; $count++) {
$sorting = ($sorting + 8);
$this->createGridElement($current, 'bs_gridSeparator', $sorting);
}
return $sorting;
} | [
"protected",
"function",
"createSeparators",
"(",
"int",
"$",
"value",
",",
"$",
"current",
",",
"int",
"$",
"sorting",
")",
":",
"int",
"{",
"for",
"(",
"$",
"count",
"=",
"1",
";",
"$",
"count",
"<=",
"$",
"value",
";",
"$",
"count",
"++",
")",
... | Create separators.
@param int $value Number of separators being created.
@param Model $current Current model.
@param int $sorting Current sorting value.
@return int | [
"Create",
"separators",
"."
] | 6e41d00822afa52eac46eb20fb49ce4abcdc199b | https://github.com/contao-bootstrap/grid/blob/6e41d00822afa52eac46eb20fb49ce4abcdc199b/src/Listener/Dca/AbstractWrapperDcaListener.php#L74-L82 |
222,470 | contao-bootstrap/grid | src/Listener/Dca/AbstractWrapperDcaListener.php | AbstractWrapperDcaListener.updateSortings | protected function updateSortings(array $elements, int $lastSorting): int
{
foreach ($elements as $element) {
if ($lastSorting > $element->sorting) {
$element->sorting = ($lastSorting + 8);
$element->save();
}
$lastSorting = (int) $element... | php | protected function updateSortings(array $elements, int $lastSorting): int
{
foreach ($elements as $element) {
if ($lastSorting > $element->sorting) {
$element->sorting = ($lastSorting + 8);
$element->save();
}
$lastSorting = (int) $element... | [
"protected",
"function",
"updateSortings",
"(",
"array",
"$",
"elements",
",",
"int",
"$",
"lastSorting",
")",
":",
"int",
"{",
"foreach",
"(",
"$",
"elements",
"as",
"$",
"element",
")",
"{",
"if",
"(",
"$",
"lastSorting",
">",
"$",
"element",
"->",
"... | Update the sorting of given elements.
@param Model[] $elements Model collection.
@param int $lastSorting Last sorting value.
@return int | [
"Update",
"the",
"sorting",
"of",
"given",
"elements",
"."
] | 6e41d00822afa52eac46eb20fb49ce4abcdc199b | https://github.com/contao-bootstrap/grid/blob/6e41d00822afa52eac46eb20fb49ce4abcdc199b/src/Listener/Dca/AbstractWrapperDcaListener.php#L92-L104 |
222,471 | contao-bootstrap/grid | src/Listener/Dca/AbstractWrapperDcaListener.php | AbstractWrapperDcaListener.createStopElement | protected function createStopElement($current, int $sorting): Model
{
$sorting = ($sorting + 8);
return $this->createGridElement($current, 'bs_gridStop', $sorting);
} | php | protected function createStopElement($current, int $sorting): Model
{
$sorting = ($sorting + 8);
return $this->createGridElement($current, 'bs_gridStop', $sorting);
} | [
"protected",
"function",
"createStopElement",
"(",
"$",
"current",
",",
"int",
"$",
"sorting",
")",
":",
"Model",
"{",
"$",
"sorting",
"=",
"(",
"$",
"sorting",
"+",
"8",
")",
";",
"return",
"$",
"this",
"->",
"createGridElement",
"(",
"$",
"current",
... | Create the stop element.
@param Model $current Model.
@param int $sorting Last sorting value.
@return Model | [
"Create",
"the",
"stop",
"element",
"."
] | 6e41d00822afa52eac46eb20fb49ce4abcdc199b | https://github.com/contao-bootstrap/grid/blob/6e41d00822afa52eac46eb20fb49ce4abcdc199b/src/Listener/Dca/AbstractWrapperDcaListener.php#L114-L119 |
222,472 | shiftonelabs/laravel-cascade-deletes | src/CascadesDeletes.php | CascadesDeletes.bootCascadesDeletes | public static function bootCascadesDeletes()
{
// Setup the 'deleting' event listener.
static::deleting(function ($model) {
// Wrap all of the cascading deletes inside of a transaction to make this an
// all or nothing operation. Any exceptions thrown inside the transaction
... | php | public static function bootCascadesDeletes()
{
// Setup the 'deleting' event listener.
static::deleting(function ($model) {
// Wrap all of the cascading deletes inside of a transaction to make this an
// all or nothing operation. Any exceptions thrown inside the transaction
... | [
"public",
"static",
"function",
"bootCascadesDeletes",
"(",
")",
"{",
"// Setup the 'deleting' event listener.",
"static",
"::",
"deleting",
"(",
"function",
"(",
"$",
"model",
")",
"{",
"// Wrap all of the cascading deletes inside of a transaction to make this an",
"// all or ... | Use the boot function to setup model event listeners.
@return void | [
"Use",
"the",
"boot",
"function",
"to",
"setup",
"model",
"event",
"listeners",
"."
] | 4302f0ecb7c0a166b9c4977cfbc10fe6ebedff0a | https://github.com/shiftonelabs/laravel-cascade-deletes/blob/4302f0ecb7c0a166b9c4977cfbc10fe6ebedff0a/src/CascadesDeletes.php#L19-L87 |
222,473 | shiftonelabs/laravel-cascade-deletes | src/CascadesDeletes.php | CascadesDeletes.getCascadeDeletesRelations | public function getCascadeDeletesRelations()
{
$names = $this->getCascadeDeletesRelationNames();
return array_combine($names, array_map(function ($name) {
$relation = method_exists($this, $name) ? $this->$name() : null;
return $relation instanceof Relation ? $relation : nul... | php | public function getCascadeDeletesRelations()
{
$names = $this->getCascadeDeletesRelationNames();
return array_combine($names, array_map(function ($name) {
$relation = method_exists($this, $name) ? $this->$name() : null;
return $relation instanceof Relation ? $relation : nul... | [
"public",
"function",
"getCascadeDeletesRelations",
"(",
")",
"{",
"$",
"names",
"=",
"$",
"this",
"->",
"getCascadeDeletesRelationNames",
"(",
")",
";",
"return",
"array_combine",
"(",
"$",
"names",
",",
"array_map",
"(",
"function",
"(",
"$",
"name",
")",
... | Get an array of the cascading relation names mapped to their relation types.
@return array | [
"Get",
"an",
"array",
"of",
"the",
"cascading",
"relation",
"names",
"mapped",
"to",
"their",
"relation",
"types",
"."
] | 4302f0ecb7c0a166b9c4977cfbc10fe6ebedff0a | https://github.com/shiftonelabs/laravel-cascade-deletes/blob/4302f0ecb7c0a166b9c4977cfbc10fe6ebedff0a/src/CascadesDeletes.php#L128-L137 |
222,474 | shiftonelabs/laravel-cascade-deletes | src/CascadesDeletes.php | CascadesDeletes.getCascadeDeletesRelationQuery | public function getCascadeDeletesRelationQuery($relation)
{
$query = $this->$relation();
// If this is a force delete and the related model is using soft deletes,
// we need to use the withTrashed() scope on the relationship query to
// ensure all related records, plus soft deleted,... | php | public function getCascadeDeletesRelationQuery($relation)
{
$query = $this->$relation();
// If this is a force delete and the related model is using soft deletes,
// we need to use the withTrashed() scope on the relationship query to
// ensure all related records, plus soft deleted,... | [
"public",
"function",
"getCascadeDeletesRelationQuery",
"(",
"$",
"relation",
")",
"{",
"$",
"query",
"=",
"$",
"this",
"->",
"$",
"relation",
"(",
")",
";",
"// If this is a force delete and the related model is using soft deletes,",
"// we need to use the withTrashed() scop... | Get the relationship query to use for the specified relation.
@param string $relation
@return \Illuminate\Database\Eloquent\Relations\Relation | [
"Get",
"the",
"relationship",
"query",
"to",
"use",
"for",
"the",
"specified",
"relation",
"."
] | 4302f0ecb7c0a166b9c4977cfbc10fe6ebedff0a | https://github.com/shiftonelabs/laravel-cascade-deletes/blob/4302f0ecb7c0a166b9c4977cfbc10fe6ebedff0a/src/CascadesDeletes.php#L158-L175 |
222,475 | shiftonelabs/laravel-cascade-deletes | src/CascadesDeletes.php | CascadesDeletes.isCascadeDeletesForceDeleting | public function isCascadeDeletesForceDeleting()
{
// Laravel 4.1 uses the softDelete property, and the only
// indication that the delete should be forced is when
// the softDelete property is set to false.
if (property_exists($this, 'softDelete') && !class_exists(SoftDeletingScope::... | php | public function isCascadeDeletesForceDeleting()
{
// Laravel 4.1 uses the softDelete property, and the only
// indication that the delete should be forced is when
// the softDelete property is set to false.
if (property_exists($this, 'softDelete') && !class_exists(SoftDeletingScope::... | [
"public",
"function",
"isCascadeDeletesForceDeleting",
"(",
")",
"{",
"// Laravel 4.1 uses the softDelete property, and the only",
"// indication that the delete should be forced is when",
"// the softDelete property is set to false.",
"if",
"(",
"property_exists",
"(",
"$",
"this",
",... | Check if this cascading delete is a force delete.
@return boolean | [
"Check",
"if",
"this",
"cascading",
"delete",
"is",
"a",
"force",
"delete",
"."
] | 4302f0ecb7c0a166b9c4977cfbc10fe6ebedff0a | https://github.com/shiftonelabs/laravel-cascade-deletes/blob/4302f0ecb7c0a166b9c4977cfbc10fe6ebedff0a/src/CascadesDeletes.php#L182-L194 |
222,476 | contao-bootstrap/grid | src/Definition/Column.php | Column.build | public function build(array $classes, string $size = ''): array
{
$sizeSuffix = $size ? '-' . $size : $size;
if ($this->width === 'auto') {
$classes[] = 'col' . $sizeSuffix . '-auto';
} elseif ($this->width === null || $this->width > 0) {
$widthSuffix = ($this->width... | php | public function build(array $classes, string $size = ''): array
{
$sizeSuffix = $size ? '-' . $size : $size;
if ($this->width === 'auto') {
$classes[] = 'col' . $sizeSuffix . '-auto';
} elseif ($this->width === null || $this->width > 0) {
$widthSuffix = ($this->width... | [
"public",
"function",
"build",
"(",
"array",
"$",
"classes",
",",
"string",
"$",
"size",
"=",
"''",
")",
":",
"array",
"{",
"$",
"sizeSuffix",
"=",
"$",
"size",
"?",
"'-'",
".",
"$",
"size",
":",
"$",
"size",
";",
"if",
"(",
"$",
"this",
"->",
... | Build the column definition.
@param array $classes List of classes.
@param string $size Column size.
@return array | [
"Build",
"the",
"column",
"definition",
"."
] | 6e41d00822afa52eac46eb20fb49ce4abcdc199b | https://github.com/contao-bootstrap/grid/blob/6e41d00822afa52eac46eb20fb49ce4abcdc199b/src/Definition/Column.php#L197-L222 |
222,477 | contao-bootstrap/grid | src/Definition/Column.php | Column.buildReset | public function buildReset(array $resets, string $size = ''): array
{
if ($this->reset === true) {
$resets[] = sprintf('d-none d%s-block', $size ? '-' . $size : '');
} elseif ($this->reset !== false) {
$resets[] = sprintf('d-none d%s-block d-%s-none', $size ? '-' . $size : ''... | php | public function buildReset(array $resets, string $size = ''): array
{
if ($this->reset === true) {
$resets[] = sprintf('d-none d%s-block', $size ? '-' . $size : '');
} elseif ($this->reset !== false) {
$resets[] = sprintf('d-none d%s-block d-%s-none', $size ? '-' . $size : ''... | [
"public",
"function",
"buildReset",
"(",
"array",
"$",
"resets",
",",
"string",
"$",
"size",
"=",
"''",
")",
":",
"array",
"{",
"if",
"(",
"$",
"this",
"->",
"reset",
"===",
"true",
")",
"{",
"$",
"resets",
"[",
"]",
"=",
"sprintf",
"(",
"'d-none d... | Build the reset for the column.
@param array $resets Reset definitions.
@param string $size Column size.
@return array | [
"Build",
"the",
"reset",
"for",
"the",
"column",
"."
] | 6e41d00822afa52eac46eb20fb49ce4abcdc199b | https://github.com/contao-bootstrap/grid/blob/6e41d00822afa52eac46eb20fb49ce4abcdc199b/src/Definition/Column.php#L232-L241 |
222,478 | contao-bootstrap/grid | src/Definition/Column.php | Column.buildAlign | private function buildAlign(array &$classes, string $sizeSuffix = ''): void
{
if ($this->align) {
$classes[] = 'align-self'. $sizeSuffix . '-' . $this->align;
}
} | php | private function buildAlign(array &$classes, string $sizeSuffix = ''): void
{
if ($this->align) {
$classes[] = 'align-self'. $sizeSuffix . '-' . $this->align;
}
} | [
"private",
"function",
"buildAlign",
"(",
"array",
"&",
"$",
"classes",
",",
"string",
"$",
"sizeSuffix",
"=",
"''",
")",
":",
"void",
"{",
"if",
"(",
"$",
"this",
"->",
"align",
")",
"{",
"$",
"classes",
"[",
"]",
"=",
"'align-self'",
".",
"$",
"s... | Build the align setting.
@param array $classes Column classes.
@param string $sizeSuffix Bootstrap Size suffix like 'md' or 'lg'.
@return void | [
"Build",
"the",
"align",
"setting",
"."
] | 6e41d00822afa52eac46eb20fb49ce4abcdc199b | https://github.com/contao-bootstrap/grid/blob/6e41d00822afa52eac46eb20fb49ce4abcdc199b/src/Definition/Column.php#L261-L266 |
222,479 | contao-bootstrap/grid | src/Definition/Column.php | Column.buildJustify | private function buildJustify(array &$classes, string $sizeSuffix = ''): void
{
if ($this->justify) {
$classes[] = 'justify-content' . $sizeSuffix . '-' . $this->justify;
}
} | php | private function buildJustify(array &$classes, string $sizeSuffix = ''): void
{
if ($this->justify) {
$classes[] = 'justify-content' . $sizeSuffix . '-' . $this->justify;
}
} | [
"private",
"function",
"buildJustify",
"(",
"array",
"&",
"$",
"classes",
",",
"string",
"$",
"sizeSuffix",
"=",
"''",
")",
":",
"void",
"{",
"if",
"(",
"$",
"this",
"->",
"justify",
")",
"{",
"$",
"classes",
"[",
"]",
"=",
"'justify-content'",
".",
... | Build the justify setting.
@param array $classes Column classes.
@param string $sizeSuffix Bootstrap Size suffix like 'md' or 'lg'.
@return void | [
"Build",
"the",
"justify",
"setting",
"."
] | 6e41d00822afa52eac46eb20fb49ce4abcdc199b | https://github.com/contao-bootstrap/grid/blob/6e41d00822afa52eac46eb20fb49ce4abcdc199b/src/Definition/Column.php#L276-L281 |
222,480 | contao-bootstrap/grid | src/Definition/Column.php | Column.buildOrder | private function buildOrder(array &$classes, string $sizeSuffix): void
{
if ($this->order) {
$classes[] = 'order' . $sizeSuffix . '-' . $this->order;
}
} | php | private function buildOrder(array &$classes, string $sizeSuffix): void
{
if ($this->order) {
$classes[] = 'order' . $sizeSuffix . '-' . $this->order;
}
} | [
"private",
"function",
"buildOrder",
"(",
"array",
"&",
"$",
"classes",
",",
"string",
"$",
"sizeSuffix",
")",
":",
"void",
"{",
"if",
"(",
"$",
"this",
"->",
"order",
")",
"{",
"$",
"classes",
"[",
"]",
"=",
"'order'",
".",
"$",
"sizeSuffix",
".",
... | Build the order setting.
@param array $classes Column classes.
@param string $sizeSuffix Size suffix.
@return void | [
"Build",
"the",
"order",
"setting",
"."
] | 6e41d00822afa52eac46eb20fb49ce4abcdc199b | https://github.com/contao-bootstrap/grid/blob/6e41d00822afa52eac46eb20fb49ce4abcdc199b/src/Definition/Column.php#L291-L296 |
222,481 | contao-bootstrap/grid | src/Definition/Column.php | Column.buildOffset | private function buildOffset(array &$classes, string $sizeSuffix): void
{
if ($this->offset === null) {
return;
}
if (is_int($this->offset)) {
$classes[] = 'offset' . $sizeSuffix . '-' . $this->offset;
} elseif (strlen($this->offset)) {
$classes[]... | php | private function buildOffset(array &$classes, string $sizeSuffix): void
{
if ($this->offset === null) {
return;
}
if (is_int($this->offset)) {
$classes[] = 'offset' . $sizeSuffix . '-' . $this->offset;
} elseif (strlen($this->offset)) {
$classes[]... | [
"private",
"function",
"buildOffset",
"(",
"array",
"&",
"$",
"classes",
",",
"string",
"$",
"sizeSuffix",
")",
":",
"void",
"{",
"if",
"(",
"$",
"this",
"->",
"offset",
"===",
"null",
")",
"{",
"return",
";",
"}",
"if",
"(",
"is_int",
"(",
"$",
"t... | Build offset setting.
@param array $classes Column classes.
@param string $sizeSuffix Size suffix.
@return void | [
"Build",
"offset",
"setting",
"."
] | 6e41d00822afa52eac46eb20fb49ce4abcdc199b | https://github.com/contao-bootstrap/grid/blob/6e41d00822afa52eac46eb20fb49ce4abcdc199b/src/Definition/Column.php#L306-L317 |
222,482 | contao-bootstrap/grid | src/Listener/ThemeImportListener.php | ThemeImportListener.onExtractThemeFiles | public function onExtractThemeFiles(\DOMDocument $xml, ZipReader $archive, $themeId): void
{
$tables = $xml->getElementsByTagName('table');
for ($index = 0; $index < $tables->length; $index++) {
if ($tables->item($index)->getAttribute('name') !== 'tl_bs_grid') {
continue... | php | public function onExtractThemeFiles(\DOMDocument $xml, ZipReader $archive, $themeId): void
{
$tables = $xml->getElementsByTagName('table');
for ($index = 0; $index < $tables->length; $index++) {
if ($tables->item($index)->getAttribute('name') !== 'tl_bs_grid') {
continue... | [
"public",
"function",
"onExtractThemeFiles",
"(",
"\\",
"DOMDocument",
"$",
"xml",
",",
"ZipReader",
"$",
"archive",
",",
"$",
"themeId",
")",
":",
"void",
"{",
"$",
"tables",
"=",
"$",
"xml",
"->",
"getElementsByTagName",
"(",
"'table'",
")",
";",
"for",
... | Handle the extract theme files hook.
@param \DOMDocument $xml Theme xml document.
@param ZipReader $archive Zip archive.
@param int|string $themeId Theme id.
@return void
@SuppressWarnings(PHPMD.UnusedFormalParameter) | [
"Handle",
"the",
"extract",
"theme",
"files",
"hook",
"."
] | 6e41d00822afa52eac46eb20fb49ce4abcdc199b | https://github.com/contao-bootstrap/grid/blob/6e41d00822afa52eac46eb20fb49ce4abcdc199b/src/Listener/ThemeImportListener.php#L37-L48 |
222,483 | contao-bootstrap/grid | src/Listener/ThemeImportListener.php | ThemeImportListener.importGrid | private function importGrid(\DOMElement $item, int $themeId): void
{
$rows = $item->childNodes;
for ($index = 0; $index < $rows->length; $index++) {
$values = $this->getRowValues($rows->item($index), $themeId);
$model = new GridModel();
$model->setRow($values);... | php | private function importGrid(\DOMElement $item, int $themeId): void
{
$rows = $item->childNodes;
for ($index = 0; $index < $rows->length; $index++) {
$values = $this->getRowValues($rows->item($index), $themeId);
$model = new GridModel();
$model->setRow($values);... | [
"private",
"function",
"importGrid",
"(",
"\\",
"DOMElement",
"$",
"item",
",",
"int",
"$",
"themeId",
")",
":",
"void",
"{",
"$",
"rows",
"=",
"$",
"item",
"->",
"childNodes",
";",
"for",
"(",
"$",
"index",
"=",
"0",
";",
"$",
"index",
"<",
"$",
... | Import the grid definition.
@param \DOMElement $item Table item.
@param int $themeId Theme id.
@return void | [
"Import",
"the",
"grid",
"definition",
"."
] | 6e41d00822afa52eac46eb20fb49ce4abcdc199b | https://github.com/contao-bootstrap/grid/blob/6e41d00822afa52eac46eb20fb49ce4abcdc199b/src/Listener/ThemeImportListener.php#L58-L69 |
222,484 | contao-bootstrap/grid | src/Listener/ThemeImportListener.php | ThemeImportListener.getRowValues | private function getRowValues(\DOMElement $item, int $themeId): array
{
$fields = $item->childNodes;
$values = [];
for ($index = 0; $index < $fields->length; $index++) {
$value = $fields->item($index)->nodeValue;
$name = $fields->item($index)->getAttribute('name');
... | php | private function getRowValues(\DOMElement $item, int $themeId): array
{
$fields = $item->childNodes;
$values = [];
for ($index = 0; $index < $fields->length; $index++) {
$value = $fields->item($index)->nodeValue;
$name = $fields->item($index)->getAttribute('name');
... | [
"private",
"function",
"getRowValues",
"(",
"\\",
"DOMElement",
"$",
"item",
",",
"int",
"$",
"themeId",
")",
":",
"array",
"{",
"$",
"fields",
"=",
"$",
"item",
"->",
"childNodes",
";",
"$",
"values",
"=",
"[",
"]",
";",
"for",
"(",
"$",
"index",
... | Prepare row values.
@param \DOMElement $item Row item element.
@param int $themeId Theme id.
@return array | [
"Prepare",
"row",
"values",
"."
] | 6e41d00822afa52eac46eb20fb49ce4abcdc199b | https://github.com/contao-bootstrap/grid/blob/6e41d00822afa52eac46eb20fb49ce4abcdc199b/src/Listener/ThemeImportListener.php#L79-L107 |
222,485 | contao-bootstrap/grid | src/Listener/BuildContextConfigListener.php | BuildContextConfigListener.buildThemeConfig | public function buildThemeConfig(BuildContextConfig $command): void
{
$context = $command->getContext();
if (!$context instanceof ThemeContext) {
return;
}
$theme = ThemeModel::findByPk($context->getThemeId());
if ($theme && $theme->bs_grid_columns) {
... | php | public function buildThemeConfig(BuildContextConfig $command): void
{
$context = $command->getContext();
if (!$context instanceof ThemeContext) {
return;
}
$theme = ThemeModel::findByPk($context->getThemeId());
if ($theme && $theme->bs_grid_columns) {
... | [
"public",
"function",
"buildThemeConfig",
"(",
"BuildContextConfig",
"$",
"command",
")",
":",
"void",
"{",
"$",
"context",
"=",
"$",
"command",
"->",
"getContext",
"(",
")",
";",
"if",
"(",
"!",
"$",
"context",
"instanceof",
"ThemeContext",
")",
"{",
"ret... | Build theme config.
@param BuildContextConfig $command Command.
@return void | [
"Build",
"theme",
"config",
"."
] | 6e41d00822afa52eac46eb20fb49ce4abcdc199b | https://github.com/contao-bootstrap/grid/blob/6e41d00822afa52eac46eb20fb49ce4abcdc199b/src/Listener/BuildContextConfigListener.php#L36-L57 |
222,486 | contao-bootstrap/grid | src/Component/ContentElement/GalleryElement.php | GalleryElement.prepareFiles | protected function prepareFiles(Collection $collection, array $auxDate = [], $deep = true): array
{
// Get all images
foreach ($collection as $fileModel) {
// Continue if the files has been processed or does not exist
if (isset($this->images[$fileModel->path]) || !file_exists... | php | protected function prepareFiles(Collection $collection, array $auxDate = [], $deep = true): array
{
// Get all images
foreach ($collection as $fileModel) {
// Continue if the files has been processed or does not exist
if (isset($this->images[$fileModel->path]) || !file_exists... | [
"protected",
"function",
"prepareFiles",
"(",
"Collection",
"$",
"collection",
",",
"array",
"$",
"auxDate",
"=",
"[",
"]",
",",
"$",
"deep",
"=",
"true",
")",
":",
"array",
"{",
"// Get all images",
"foreach",
"(",
"$",
"collection",
"as",
"$",
"fileModel... | Prepare all file data and return the aux dates.
@param Collection $collection File model collection.
@param array $auxDate Aux date array.
@param bool $deep If true sub files are added as well.
@return array
@throws \Exception If file could not be opened. | [
"Prepare",
"all",
"file",
"data",
"and",
"return",
"the",
"aux",
"dates",
"."
] | 6e41d00822afa52eac46eb20fb49ce4abcdc199b | https://github.com/contao-bootstrap/grid/blob/6e41d00822afa52eac46eb20fb49ce4abcdc199b/src/Component/ContentElement/GalleryElement.php#L184-L223 |
222,487 | contao-bootstrap/grid | src/Component/ContentElement/GalleryElement.php | GalleryElement.applySorting | protected function applySorting(array $auxDate, array &$data): void
{
// Sort array
switch ($this->get('sortBy')) {
default:
case 'name_asc':
uksort($this->images, 'basename_natcasecmp');
break;
case 'name_desc':
uk... | php | protected function applySorting(array $auxDate, array &$data): void
{
// Sort array
switch ($this->get('sortBy')) {
default:
case 'name_asc':
uksort($this->images, 'basename_natcasecmp');
break;
case 'name_desc':
uk... | [
"protected",
"function",
"applySorting",
"(",
"array",
"$",
"auxDate",
",",
"array",
"&",
"$",
"data",
")",
":",
"void",
"{",
"// Sort array",
"switch",
"(",
"$",
"this",
"->",
"get",
"(",
"'sortBy'",
")",
")",
"{",
"default",
":",
"case",
"'name_asc'",
... | Apply the sorting.
@param array $auxDate Aux dates.
@param array $data Template data.
@return void | [
"Apply",
"the",
"sorting",
"."
] | 6e41d00822afa52eac46eb20fb49ce4abcdc199b | https://github.com/contao-bootstrap/grid/blob/6e41d00822afa52eac46eb20fb49ce4abcdc199b/src/Component/ContentElement/GalleryElement.php#L233-L275 |
222,488 | contao-bootstrap/grid | src/Component/ContentElement/GalleryElement.php | GalleryElement.preparePagination | protected function preparePagination(&$offset, &$limit): ?string
{
$total = count($this->images);
$perPage = $this->get('perPage');
// Paginate the result of not randomly sorted (see #8033)
if ($perPage > 0 && $this->get('sortBy') != 'random') {
// Get the current page... | php | protected function preparePagination(&$offset, &$limit): ?string
{
$total = count($this->images);
$perPage = $this->get('perPage');
// Paginate the result of not randomly sorted (see #8033)
if ($perPage > 0 && $this->get('sortBy') != 'random') {
// Get the current page... | [
"protected",
"function",
"preparePagination",
"(",
"&",
"$",
"offset",
",",
"&",
"$",
"limit",
")",
":",
"?",
"string",
"{",
"$",
"total",
"=",
"count",
"(",
"$",
"this",
"->",
"images",
")",
";",
"$",
"perPage",
"=",
"$",
"this",
"->",
"get",
"(",... | Prepare pagination.
@param int $offset Offset number.
@param int $limit Limit.
@return string|null
@throws PageNotFoundException When page parameter is out of bounds. | [
"Prepare",
"pagination",
"."
] | 6e41d00822afa52eac46eb20fb49ce4abcdc199b | https://github.com/contao-bootstrap/grid/blob/6e41d00822afa52eac46eb20fb49ce4abcdc199b/src/Component/ContentElement/GalleryElement.php#L287-L318 |
222,489 | contao-bootstrap/grid | src/Component/ContentElement/GalleryElement.php | GalleryElement.compileImages | protected function compileImages($offset, $limit): array
{
$lightBoxId = 'lightbox[lb' . $this->get('id') . ']';
$body = [];
$imageSizes = StringUtil::deserialize($this->get('bs_image_sizes'), true);
for ($index = $offset; $index < $limit; $index++) {
if (!isset($... | php | protected function compileImages($offset, $limit): array
{
$lightBoxId = 'lightbox[lb' . $this->get('id') . ']';
$body = [];
$imageSizes = StringUtil::deserialize($this->get('bs_image_sizes'), true);
for ($index = $offset; $index < $limit; $index++) {
if (!isset($... | [
"protected",
"function",
"compileImages",
"(",
"$",
"offset",
",",
"$",
"limit",
")",
":",
"array",
"{",
"$",
"lightBoxId",
"=",
"'lightbox[lb'",
".",
"$",
"this",
"->",
"get",
"(",
"'id'",
")",
".",
"']'",
";",
"$",
"body",
"=",
"[",
"]",
";",
"$"... | Compile all images.
@param int $offset Offset.
@param int $limit Limit.
@return array | [
"Compile",
"all",
"images",
"."
] | 6e41d00822afa52eac46eb20fb49ce4abcdc199b | https://github.com/contao-bootstrap/grid/blob/6e41d00822afa52eac46eb20fb49ce4abcdc199b/src/Component/ContentElement/GalleryElement.php#L328-L372 |
222,490 | contao-bootstrap/grid | src/Component/ContentElement/GalleryElement.php | GalleryElement.getGalleryTemplateName | protected function getGalleryTemplateName(): string
{
$templateName = 'bs_gallery_default';
// Use a custom template
if (TL_MODE == 'FE' && $this->get('galleryTpl') != '') {
return (string) $this->get('galleryTpl');
}
return $templateName;
} | php | protected function getGalleryTemplateName(): string
{
$templateName = 'bs_gallery_default';
// Use a custom template
if (TL_MODE == 'FE' && $this->get('galleryTpl') != '') {
return (string) $this->get('galleryTpl');
}
return $templateName;
} | [
"protected",
"function",
"getGalleryTemplateName",
"(",
")",
":",
"string",
"{",
"$",
"templateName",
"=",
"'bs_gallery_default'",
";",
"// Use a custom template",
"if",
"(",
"TL_MODE",
"==",
"'FE'",
"&&",
"$",
"this",
"->",
"get",
"(",
"'galleryTpl'",
")",
"!="... | Get the gallery template name.
@return string | [
"Get",
"the",
"gallery",
"template",
"name",
"."
] | 6e41d00822afa52eac46eb20fb49ce4abcdc199b | https://github.com/contao-bootstrap/grid/blob/6e41d00822afa52eac46eb20fb49ce4abcdc199b/src/Component/ContentElement/GalleryElement.php#L379-L389 |
222,491 | contao-bootstrap/grid | src/Component/ContentElement/GalleryElement.php | GalleryElement.applyCustomSorting | protected function applyCustomSorting(): void
{
if ($this->get('orderSRC') != '') {
$tmp = StringUtil::deserialize($this->get('orderSRC'));
if (!empty($tmp) && is_array($tmp)) {
// Remove all values
$order = array_map(
function () ... | php | protected function applyCustomSorting(): void
{
if ($this->get('orderSRC') != '') {
$tmp = StringUtil::deserialize($this->get('orderSRC'));
if (!empty($tmp) && is_array($tmp)) {
// Remove all values
$order = array_map(
function () ... | [
"protected",
"function",
"applyCustomSorting",
"(",
")",
":",
"void",
"{",
"if",
"(",
"$",
"this",
"->",
"get",
"(",
"'orderSRC'",
")",
"!=",
"''",
")",
"{",
"$",
"tmp",
"=",
"StringUtil",
"::",
"deserialize",
"(",
"$",
"this",
"->",
"get",
"(",
"'or... | Apply custom sorting.
@return void | [
"Apply",
"custom",
"sorting",
"."
] | 6e41d00822afa52eac46eb20fb49ce4abcdc199b | https://github.com/contao-bootstrap/grid/blob/6e41d00822afa52eac46eb20fb49ce4abcdc199b/src/Component/ContentElement/GalleryElement.php#L396-L427 |
222,492 | contao-bootstrap/grid | src/GridProvider.php | GridProvider.getGrid | public function getGrid(int $gridId): Grid
{
if (!isset($this->grids[$gridId])) {
$this->grids[$gridId] = $this->builder->build($gridId);
}
return $this->grids[$gridId];
} | php | public function getGrid(int $gridId): Grid
{
if (!isset($this->grids[$gridId])) {
$this->grids[$gridId] = $this->builder->build($gridId);
}
return $this->grids[$gridId];
} | [
"public",
"function",
"getGrid",
"(",
"int",
"$",
"gridId",
")",
":",
"Grid",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"grids",
"[",
"$",
"gridId",
"]",
")",
")",
"{",
"$",
"this",
"->",
"grids",
"[",
"$",
"gridId",
"]",
"=",
"$",
... | Get a grid.
@param int $gridId Grid id.
@return Grid
@throws \RuntimeException When grid could not be build. | [
"Get",
"a",
"grid",
"."
] | 6e41d00822afa52eac46eb20fb49ce4abcdc199b | https://github.com/contao-bootstrap/grid/blob/6e41d00822afa52eac46eb20fb49ce4abcdc199b/src/GridProvider.php#L67-L74 |
222,493 | contao-bootstrap/grid | src/Component/Module/GridModule.php | GridModule.generateModules | protected function generateModules(array $config, array $modules, ?GridIterator $iterator = null): array
{
$buffer = [];
foreach ($config as $entry) {
if ($entry['inactive'] || !$entry['module']) {
continue;
}
if (is_numeric($entry['module'])) {
... | php | protected function generateModules(array $config, array $modules, ?GridIterator $iterator = null): array
{
$buffer = [];
foreach ($config as $entry) {
if ($entry['inactive'] || !$entry['module']) {
continue;
}
if (is_numeric($entry['module'])) {
... | [
"protected",
"function",
"generateModules",
"(",
"array",
"$",
"config",
",",
"array",
"$",
"modules",
",",
"?",
"GridIterator",
"$",
"iterator",
"=",
"null",
")",
":",
"array",
"{",
"$",
"buffer",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"config",
"as... | Generate all modules.
@param array $config Module config.
@param array $modules Generated modules.
@param GridIterator|null $iterator Grid iterator.
@return array | [
"Generate",
"all",
"modules",
"."
] | 6e41d00822afa52eac46eb20fb49ce4abcdc199b | https://github.com/contao-bootstrap/grid/blob/6e41d00822afa52eac46eb20fb49ce4abcdc199b/src/Component/Module/GridModule.php#L133-L165 |
222,494 | contao-bootstrap/grid | src/Component/Module/GridModule.php | GridModule.getModuleIds | protected function getModuleIds(array $config): array
{
$moduleIds = array_filter(
array_map(
function ($item) {
return $item['module'];
},
array_filter(
$config,
function ($item) {
... | php | protected function getModuleIds(array $config): array
{
$moduleIds = array_filter(
array_map(
function ($item) {
return $item['module'];
},
array_filter(
$config,
function ($item) {
... | [
"protected",
"function",
"getModuleIds",
"(",
"array",
"$",
"config",
")",
":",
"array",
"{",
"$",
"moduleIds",
"=",
"array_filter",
"(",
"array_map",
"(",
"function",
"(",
"$",
"item",
")",
"{",
"return",
"$",
"item",
"[",
"'module'",
"]",
";",
"}",
"... | Get the module ids.
@param array $config Config.
@return array | [
"Get",
"the",
"module",
"ids",
"."
] | 6e41d00822afa52eac46eb20fb49ce4abcdc199b | https://github.com/contao-bootstrap/grid/blob/6e41d00822afa52eac46eb20fb49ce4abcdc199b/src/Component/Module/GridModule.php#L174-L192 |
222,495 | contao-bootstrap/grid | src/Component/Module/GridModule.php | GridModule.preCompileModules | protected function preCompileModules(array $moduleIds): array
{
$collection = ModuleModel::findMultipleByIds($moduleIds);
$modules = [];
if ($collection) {
foreach ($collection as $model) {
$modules[$model->id] = Controller::getFrontendModule($model, $this->ge... | php | protected function preCompileModules(array $moduleIds): array
{
$collection = ModuleModel::findMultipleByIds($moduleIds);
$modules = [];
if ($collection) {
foreach ($collection as $model) {
$modules[$model->id] = Controller::getFrontendModule($model, $this->ge... | [
"protected",
"function",
"preCompileModules",
"(",
"array",
"$",
"moduleIds",
")",
":",
"array",
"{",
"$",
"collection",
"=",
"ModuleModel",
"::",
"findMultipleByIds",
"(",
"$",
"moduleIds",
")",
";",
"$",
"modules",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"... | Precompile the modules.
@param array $moduleIds List of module ids.
@return array | [
"Precompile",
"the",
"modules",
"."
] | 6e41d00822afa52eac46eb20fb49ce4abcdc199b | https://github.com/contao-bootstrap/grid/blob/6e41d00822afa52eac46eb20fb49ce4abcdc199b/src/Component/Module/GridModule.php#L201-L213 |
222,496 | contao-bootstrap/grid | src/Migration/MigrateAutoGridWidths.php | MigrateAutoGridWidths.migrateRow | private function migrateRow(array $row): void
{
$data = ['tstamp' => time()];
foreach (self::SIZES as $size) {
$size .= 'Size';
$data[$size] = $this->migrateSize($row[$size]);
}
$this->connection->update('tl_bs_grid', $data, ['id' => $row['id']]);
... | php | private function migrateRow(array $row): void
{
$data = ['tstamp' => time()];
foreach (self::SIZES as $size) {
$size .= 'Size';
$data[$size] = $this->migrateSize($row[$size]);
}
$this->connection->update('tl_bs_grid', $data, ['id' => $row['id']]);
... | [
"private",
"function",
"migrateRow",
"(",
"array",
"$",
"row",
")",
":",
"void",
"{",
"$",
"data",
"=",
"[",
"'tstamp'",
"=>",
"time",
"(",
")",
"]",
";",
"foreach",
"(",
"self",
"::",
"SIZES",
"as",
"$",
"size",
")",
"{",
"$",
"size",
".=",
"'Si... | Migrate a grid definition row.
@param array $row The grid definition row.
@return void | [
"Migrate",
"a",
"grid",
"definition",
"row",
"."
] | 6e41d00822afa52eac46eb20fb49ce4abcdc199b | https://github.com/contao-bootstrap/grid/blob/6e41d00822afa52eac46eb20fb49ce4abcdc199b/src/Migration/MigrateAutoGridWidths.php#L70-L80 |
222,497 | contao-bootstrap/grid | src/Migration/MigrateAutoGridWidths.php | MigrateAutoGridWidths.migrateSize | private function migrateSize(?string $size): ?string
{
if ($size === null) {
return null;
}
$columns = array_map(
function (array $column) {
if ($column['width'] === 'auto') {
$column['width'] = 'equal';
}
... | php | private function migrateSize(?string $size): ?string
{
if ($size === null) {
return null;
}
$columns = array_map(
function (array $column) {
if ($column['width'] === 'auto') {
$column['width'] = 'equal';
}
... | [
"private",
"function",
"migrateSize",
"(",
"?",
"string",
"$",
"size",
")",
":",
"?",
"string",
"{",
"if",
"(",
"$",
"size",
"===",
"null",
")",
"{",
"return",
"null",
";",
"}",
"$",
"columns",
"=",
"array_map",
"(",
"function",
"(",
"array",
"$",
... | Migrate a grid size.
@param string|null $size The grid size definition.
@return string|null | [
"Migrate",
"a",
"grid",
"size",
"."
] | 6e41d00822afa52eac46eb20fb49ce4abcdc199b | https://github.com/contao-bootstrap/grid/blob/6e41d00822afa52eac46eb20fb49ce4abcdc199b/src/Migration/MigrateAutoGridWidths.php#L89-L108 |
222,498 | contao-bootstrap/grid | src/GridBuilder.php | GridBuilder.loadModel | protected function loadModel(int $gridId): void
{
$model = GridModel::findByPk($gridId);
if (!$model) {
throw new RuntimeException(sprintf('Grid ID "%s" not found', $gridId));
}
$this->model = $model;
} | php | protected function loadModel(int $gridId): void
{
$model = GridModel::findByPk($gridId);
if (!$model) {
throw new RuntimeException(sprintf('Grid ID "%s" not found', $gridId));
}
$this->model = $model;
} | [
"protected",
"function",
"loadModel",
"(",
"int",
"$",
"gridId",
")",
":",
"void",
"{",
"$",
"model",
"=",
"GridModel",
"::",
"findByPk",
"(",
"$",
"gridId",
")",
";",
"if",
"(",
"!",
"$",
"model",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"... | Load grid model from the database.
@param int $gridId THe grid id.
@return void
@throws RuntimeException When Grid does not exist. | [
"Load",
"grid",
"model",
"from",
"the",
"database",
"."
] | 6e41d00822afa52eac46eb20fb49ce4abcdc199b | https://github.com/contao-bootstrap/grid/blob/6e41d00822afa52eac46eb20fb49ce4abcdc199b/src/GridBuilder.php#L72-L80 |
222,499 | contao-bootstrap/grid | src/GridBuilder.php | GridBuilder.createGrid | private function createGrid(): void
{
$this->grid = new Grid();
$sizes = StringUtil::deserialize($this->model->sizes, true);
$this->buildRow();
foreach ($sizes as $size) {
$field = $size . 'Size';
$definition = StringUtil::deserialize($this->model-... | php | private function createGrid(): void
{
$this->grid = new Grid();
$sizes = StringUtil::deserialize($this->model->sizes, true);
$this->buildRow();
foreach ($sizes as $size) {
$field = $size . 'Size';
$definition = StringUtil::deserialize($this->model-... | [
"private",
"function",
"createGrid",
"(",
")",
":",
"void",
"{",
"$",
"this",
"->",
"grid",
"=",
"new",
"Grid",
"(",
")",
";",
"$",
"sizes",
"=",
"StringUtil",
"::",
"deserialize",
"(",
"$",
"this",
"->",
"model",
"->",
"sizes",
",",
"true",
")",
"... | Create the grid from the model.
@return void | [
"Create",
"the",
"grid",
"from",
"the",
"model",
"."
] | 6e41d00822afa52eac46eb20fb49ce4abcdc199b | https://github.com/contao-bootstrap/grid/blob/6e41d00822afa52eac46eb20fb49ce4abcdc199b/src/GridBuilder.php#L87-L104 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.