repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
ho-nl/magento2-Ho_Templatehints
Block/Hints/Init.php
Init.addAssets
public function addAssets() { $js = $this->assetRepository->createAsset('Ho_Templatehints::js/hints.js'); $this->assetCollection->add('Ho_Templatehints::js/hints.js', $js); $css = $this->assetRepository->createAsset('Ho_Templatehints::css/hints.css'); $this->assetCollection->add('cH...
php
public function addAssets() { $js = $this->assetRepository->createAsset('Ho_Templatehints::js/hints.js'); $this->assetCollection->add('Ho_Templatehints::js/hints.js', $js); $css = $this->assetRepository->createAsset('Ho_Templatehints::css/hints.css'); $this->assetCollection->add('cH...
[ "public", "function", "addAssets", "(", ")", "{", "$", "js", "=", "$", "this", "->", "assetRepository", "->", "createAsset", "(", "'Ho_Templatehints::js/hints.js'", ")", ";", "$", "this", "->", "assetCollection", "->", "add", "(", "'Ho_Templatehints::js/hints.js'"...
Add assets to the header required for the initialisation of the scripts @todo figure out how to include .less files instead of .css files for easier syntax. http://devdocs.magento.com/guides/v2.0/architecture/view/page-assets.html#m2devgde-page-assets-api @return void
[ "Add", "assets", "to", "the", "header", "required", "for", "the", "initialisation", "of", "the", "scripts" ]
train
https://github.com/ho-nl/magento2-Ho_Templatehints/blob/97ff376b373c623cded1c077f513652291c69607/Block/Hints/Init.php#L58-L65
ho-nl/magento2-Ho_Templatehints
Helper/Config.php
Config.isHintEnabled
public function isHintEnabled() { $isParamPresent = $this->_request->getParam('ath', false) === '1'; if ($isParamPresent) { $applicationMode = $this->appState->getMode(); $storeId = $this->storeManager->getStore()->getId(); if ($applicationMode === AppState::MOD...
php
public function isHintEnabled() { $isParamPresent = $this->_request->getParam('ath', false) === '1'; if ($isParamPresent) { $applicationMode = $this->appState->getMode(); $storeId = $this->storeManager->getStore()->getId(); if ($applicationMode === AppState::MOD...
[ "public", "function", "isHintEnabled", "(", ")", "{", "$", "isParamPresent", "=", "$", "this", "->", "_request", "->", "getParam", "(", "'ath'", ",", "false", ")", "===", "'1'", ";", "if", "(", "$", "isParamPresent", ")", "{", "$", "applicationMode", "="...
Check if the hints can be displayed. It will check if the url parameter is present. For production mode it will also check if the IP-address is in Developer Client Restrictions. @return bool
[ "Check", "if", "the", "hints", "can", "be", "displayed", "." ]
train
https://github.com/ho-nl/magento2-Ho_Templatehints/blob/97ff376b373c623cded1c077f513652291c69607/Helper/Config.php#L53-L67
ho-nl/magento2-Ho_Templatehints
Plugin/View/LayoutPlugin.php
LayoutPlugin.aroundRenderElement
public function aroundRenderElement(Layout $layout, Closure $proceed, $name, $useCache = false) // @codingStandardsIgnoreLine { $result = $proceed($name, $useCache); if ($this->hintConfig->isHintEnabled() === false) { return $result; } return $this->_decorateElement($res...
php
public function aroundRenderElement(Layout $layout, Closure $proceed, $name, $useCache = false) // @codingStandardsIgnoreLine { $result = $proceed($name, $useCache); if ($this->hintConfig->isHintEnabled() === false) { return $result; } return $this->_decorateElement($res...
[ "public", "function", "aroundRenderElement", "(", "Layout", "$", "layout", ",", "Closure", "$", "proceed", ",", "$", "name", ",", "$", "useCache", "=", "false", ")", "// @codingStandardsIgnoreLine", "{", "$", "result", "=", "$", "proceed", "(", "$", "name", ...
@param Layout $layout @param Closure $proceed @param string $name @param bool $useCache @return string @SuppressWarnings(PHPMD.UnusedFormalParameter)
[ "@param", "Layout", "$layout", "@param", "Closure", "$proceed", "@param", "string", "$name", "@param", "bool", "$useCache" ]
train
https://github.com/ho-nl/magento2-Ho_Templatehints/blob/97ff376b373c623cded1c077f513652291c69607/Plugin/View/LayoutPlugin.php#L68-L76
ho-nl/magento2-Ho_Templatehints
Plugin/View/LayoutPlugin.php
LayoutPlugin._decorateElement
private function _decorateElement($result, $name) { if (! $result) { $result = '<div style="display:none;"></div>'; } if ($this->layout->isUiComponent($name)) { /** @var \Magento\Framework\View\Element\AbstractBlock $block */ $block = $this->layout->getBl...
php
private function _decorateElement($result, $name) { if (! $result) { $result = '<div style="display:none;"></div>'; } if ($this->layout->isUiComponent($name)) { /** @var \Magento\Framework\View\Element\AbstractBlock $block */ $block = $this->layout->getBl...
[ "private", "function", "_decorateElement", "(", "$", "result", ",", "$", "name", ")", "{", "if", "(", "!", "$", "result", ")", "{", "$", "result", "=", "'<div style=\"display:none;\"></div>'", ";", "}", "if", "(", "$", "this", "->", "layout", "->", "isUi...
@param string $result @param string $name @return string
[ "@param", "string", "$result", "@param", "string", "$name" ]
train
https://github.com/ho-nl/magento2-Ho_Templatehints/blob/97ff376b373c623cded1c077f513652291c69607/Plugin/View/LayoutPlugin.php#L84-L109
ho-nl/magento2-Ho_Templatehints
Plugin/View/LayoutPlugin.php
LayoutPlugin.decorateOuterElement
public function decorateOuterElement($html, $attributes) { if (! $html) { return $html; } $htmlAttr = []; foreach ($attributes as $key => $value) { $htmlAttr[] = sprintf('%s="%s"', $key, htmlspecialchars($value)); } $htmlAttr = implode(' ', $h...
php
public function decorateOuterElement($html, $attributes) { if (! $html) { return $html; } $htmlAttr = []; foreach ($attributes as $key => $value) { $htmlAttr[] = sprintf('%s="%s"', $key, htmlspecialchars($value)); } $htmlAttr = implode(' ', $h...
[ "public", "function", "decorateOuterElement", "(", "$", "html", ",", "$", "attributes", ")", "{", "if", "(", "!", "$", "html", ")", "{", "return", "$", "html", ";", "}", "$", "htmlAttr", "=", "[", "]", ";", "foreach", "(", "$", "attributes", "as", ...
@param string $html @param array $attributes @return string
[ "@param", "string", "$html", "@param", "array", "$attributes" ]
train
https://github.com/ho-nl/magento2-Ho_Templatehints/blob/97ff376b373c623cded1c077f513652291c69607/Plugin/View/LayoutPlugin.php#L117-L137
ho-nl/magento2-Ho_Templatehints
Plugin/View/LayoutPlugin.php
LayoutPlugin.getContainerInfo
private function getContainerInfo(string $nameInLayout, array $container) { $result = self::filterEscapeEncode([ 'info' => [ 'nameInLayout' => $nameInLayout, 'label' => $container['label'] ?? null ], 'extra' => [ 'parent' =>...
php
private function getContainerInfo(string $nameInLayout, array $container) { $result = self::filterEscapeEncode([ 'info' => [ 'nameInLayout' => $nameInLayout, 'label' => $container['label'] ?? null ], 'extra' => [ 'parent' =>...
[ "private", "function", "getContainerInfo", "(", "string", "$", "nameInLayout", ",", "array", "$", "container", ")", "{", "$", "result", "=", "self", "::", "filterEscapeEncode", "(", "[", "'info'", "=>", "[", "'nameInLayout'", "=>", "$", "nameInLayout", ",", ...
@param string $nameInLayout @param array $container @return string
[ "@param", "string", "$nameInLayout", "@param", "array", "$container" ]
train
https://github.com/ho-nl/magento2-Ho_Templatehints/blob/97ff376b373c623cded1c077f513652291c69607/Plugin/View/LayoutPlugin.php#L145-L159
ho-nl/magento2-Ho_Templatehints
Plugin/View/LayoutPlugin.php
LayoutPlugin.getBlockInfo
private function getBlockInfo(\Magento\Framework\View\Element\AbstractBlock $block) { $result = self::filterEscapeEncode([ 'info' => [ 'nameInLayout' => $block->getNameInLayout(), 'moduleName' => $block->getModuleName(), 'phpClass' => $this->getBlo...
php
private function getBlockInfo(\Magento\Framework\View\Element\AbstractBlock $block) { $result = self::filterEscapeEncode([ 'info' => [ 'nameInLayout' => $block->getNameInLayout(), 'moduleName' => $block->getModuleName(), 'phpClass' => $this->getBlo...
[ "private", "function", "getBlockInfo", "(", "\\", "Magento", "\\", "Framework", "\\", "View", "\\", "Element", "\\", "AbstractBlock", "$", "block", ")", "{", "$", "result", "=", "self", "::", "filterEscapeEncode", "(", "[", "'info'", "=>", "[", "'nameInLayou...
Returns the blockInfo as a json encoded array @param \Magento\Framework\View\Element\AbstractBlock $block @return string
[ "Returns", "the", "blockInfo", "as", "a", "json", "encoded", "array" ]
train
https://github.com/ho-nl/magento2-Ho_Templatehints/blob/97ff376b373c623cded1c077f513652291c69607/Plugin/View/LayoutPlugin.php#L167-L184
ho-nl/magento2-Ho_Templatehints
Plugin/View/LayoutPlugin.php
LayoutPlugin.filterEscape
private static function filterEscape($data) { return array_filter(array_map(function ($elem) { if (is_array($elem)) { return self::filterEscape($elem); } return addslashes($elem); // @codingStandardsIgnoreLine }, $data)); }
php
private static function filterEscape($data) { return array_filter(array_map(function ($elem) { if (is_array($elem)) { return self::filterEscape($elem); } return addslashes($elem); // @codingStandardsIgnoreLine }, $data)); }
[ "private", "static", "function", "filterEscape", "(", "$", "data", ")", "{", "return", "array_filter", "(", "array_map", "(", "function", "(", "$", "elem", ")", "{", "if", "(", "is_array", "(", "$", "elem", ")", ")", "{", "return", "self", "::", "filte...
Filter and escape the complete array. @param $data @return array
[ "Filter", "and", "escape", "the", "complete", "array", "." ]
train
https://github.com/ho-nl/magento2-Ho_Templatehints/blob/97ff376b373c623cded1c077f513652291c69607/Plugin/View/LayoutPlugin.php#L203-L211
ho-nl/magento2-Ho_Templatehints
Plugin/View/LayoutPlugin.php
LayoutPlugin.getBlockPaths
private function getBlockPaths(\Magento\Framework\View\Element\AbstractBlock $block) { $reflector = new \ReflectionClass($block); //@codingStandardsIgnoreLine $classFileName = $reflector->getFileName(); if ($block instanceof \Magento\Framework\Interception\InterceptorInterface) { ...
php
private function getBlockPaths(\Magento\Framework\View\Element\AbstractBlock $block) { $reflector = new \ReflectionClass($block); //@codingStandardsIgnoreLine $classFileName = $reflector->getFileName(); if ($block instanceof \Magento\Framework\Interception\InterceptorInterface) { ...
[ "private", "function", "getBlockPaths", "(", "\\", "Magento", "\\", "Framework", "\\", "View", "\\", "Element", "\\", "AbstractBlock", "$", "block", ")", "{", "$", "reflector", "=", "new", "\\", "ReflectionClass", "(", "$", "block", ")", ";", "//@codingStand...
@param \Magento\Framework\View\Element\AbstractBlock $block @return string[string]
[ "@param", "\\", "Magento", "\\", "Framework", "\\", "View", "\\", "Element", "\\", "AbstractBlock", "$block" ]
train
https://github.com/ho-nl/magento2-Ho_Templatehints/blob/97ff376b373c623cded1c077f513652291c69607/Plugin/View/LayoutPlugin.php#L218-L228
nWidart/laravel-menus
src/Presenters/Presenter.php
Presenter.getChildMenuItems
public function getChildMenuItems(MenuItem $item) { $results = ''; foreach ($item->getChilds() as $child) { if ($child->hidden()) { continue; } if ($child->hasSubMenu()) { $results .= $this->getMultiLevelDropdownWrapper($child); ...
php
public function getChildMenuItems(MenuItem $item) { $results = ''; foreach ($item->getChilds() as $child) { if ($child->hidden()) { continue; } if ($child->hasSubMenu()) { $results .= $this->getMultiLevelDropdownWrapper($child); ...
[ "public", "function", "getChildMenuItems", "(", "MenuItem", "$", "item", ")", "{", "$", "results", "=", "''", ";", "foreach", "(", "$", "item", "->", "getChilds", "(", ")", "as", "$", "child", ")", "{", "if", "(", "$", "child", "->", "hidden", "(", ...
Get child menu items. @param \Nwidart\Menus\MenuItem $item @return string
[ "Get", "child", "menu", "items", "." ]
train
https://github.com/nWidart/laravel-menus/blob/65a052af4d88ec1f23b3ea92863c1dfa0fd6c832/src/Presenters/Presenter.php#L87-L107
nWidart/laravel-menus
src/Presenters/Bootstrap/SidebarMenuPresenter.php
SidebarMenuPresenter.getMenuWithoutDropdownWrapper
public function getMenuWithoutDropdownWrapper($item) { return '<li' . $this->getActiveState($item) . '> <a href="' . $item->getUrl() . '" ' . $item->getAttributes() . '>' . $item->getIcon() . ' ' . $item->title . '</a></li>' . PHP_EOL; }
php
public function getMenuWithoutDropdownWrapper($item) { return '<li' . $this->getActiveState($item) . '> <a href="' . $item->getUrl() . '" ' . $item->getAttributes() . '>' . $item->getIcon() . ' ' . $item->title . '</a></li>' . PHP_EOL; }
[ "public", "function", "getMenuWithoutDropdownWrapper", "(", "$", "item", ")", "{", "return", "'<li'", ".", "$", "this", "->", "getActiveState", "(", "$", "item", ")", ".", "'>\n\t\t\t<a href=\"'", ".", "$", "item", "->", "getUrl", "(", ")", ".", "'\" '", "...
Get menu tag without dropdown wrapper. @param \Nwidart\Menus\MenuItem $item @return string
[ "Get", "menu", "tag", "without", "dropdown", "wrapper", "." ]
train
https://github.com/nWidart/laravel-menus/blob/65a052af4d88ec1f23b3ea92863c1dfa0fd6c832/src/Presenters/Bootstrap/SidebarMenuPresenter.php#L36-L41
nWidart/laravel-menus
src/Presenters/Bootstrap/SidebarMenuPresenter.php
SidebarMenuPresenter.getMenuWithDropDownWrapper
public function getMenuWithDropDownWrapper($item) { $id = str_random(); return ' <li class="' . $this->getActiveStateOnChild($item) . ' panel panel-default" id="dropdown"> <a data-toggle="collapse" href="#' . $id . '"> ' . $item->getIcon() . ' ' . $item->title . ' <span class="caret"></spa...
php
public function getMenuWithDropDownWrapper($item) { $id = str_random(); return ' <li class="' . $this->getActiveStateOnChild($item) . ' panel panel-default" id="dropdown"> <a data-toggle="collapse" href="#' . $id . '"> ' . $item->getIcon() . ' ' . $item->title . ' <span class="caret"></spa...
[ "public", "function", "getMenuWithDropDownWrapper", "(", "$", "item", ")", "{", "$", "id", "=", "str_random", "(", ")", ";", "return", "'\n\t\t<li class=\"'", ".", "$", "this", "->", "getActiveStateOnChild", "(", "$", "item", ")", ".", "' panel panel-default\" i...
{@inheritdoc }.
[ "{" ]
train
https://github.com/nWidart/laravel-menus/blob/65a052af4d88ec1f23b3ea92863c1dfa0fd6c832/src/Presenters/Bootstrap/SidebarMenuPresenter.php#L83-L101
nWidart/laravel-menus
src/Menu.php
Menu.create
public function create($name, Closure $resolver) { $builder = new MenuBuilder($name, $this->config); $builder->setViewFactory($this->views); $this->menus[$name] = $builder; return $resolver($builder); }
php
public function create($name, Closure $resolver) { $builder = new MenuBuilder($name, $this->config); $builder->setViewFactory($this->views); $this->menus[$name] = $builder; return $resolver($builder); }
[ "public", "function", "create", "(", "$", "name", ",", "Closure", "$", "resolver", ")", "{", "$", "builder", "=", "new", "MenuBuilder", "(", "$", "name", ",", "$", "this", "->", "config", ")", ";", "$", "builder", "->", "setViewFactory", "(", "$", "t...
Create new menu. @param string $name @param Callable $resolver @return \Nwidart\Menus\MenuBuilder
[ "Create", "new", "menu", "." ]
train
https://github.com/nWidart/laravel-menus/blob/65a052af4d88ec1f23b3ea92863c1dfa0fd6c832/src/Menu.php#L60-L69
nWidart/laravel-menus
src/Menu.php
Menu.modify
public function modify($name, Closure $callback) { $menu = collect($this->menus)->filter(function ($menu) use ($name) { return $menu->getName() == $name; })->first(); $callback($menu); }
php
public function modify($name, Closure $callback) { $menu = collect($this->menus)->filter(function ($menu) use ($name) { return $menu->getName() == $name; })->first(); $callback($menu); }
[ "public", "function", "modify", "(", "$", "name", ",", "Closure", "$", "callback", ")", "{", "$", "menu", "=", "collect", "(", "$", "this", "->", "menus", ")", "->", "filter", "(", "function", "(", "$", "menu", ")", "use", "(", "$", "name", ")", ...
Modify a specific menu. @param string $name @param Closure $callback @return void
[ "Modify", "a", "specific", "menu", "." ]
train
https://github.com/nWidart/laravel-menus/blob/65a052af4d88ec1f23b3ea92863c1dfa0fd6c832/src/Menu.php#L102-L109
nWidart/laravel-menus
src/Menu.php
Menu.render
public function render($name, $presenter = null, $bindings = array()) { return $this->get($name, $presenter, $bindings); }
php
public function render($name, $presenter = null, $bindings = array()) { return $this->get($name, $presenter, $bindings); }
[ "public", "function", "render", "(", "$", "name", ",", "$", "presenter", "=", "null", ",", "$", "bindings", "=", "array", "(", ")", ")", "{", "return", "$", "this", "->", "get", "(", "$", "name", ",", "$", "presenter", ",", "$", "bindings", ")", ...
Render the menu tag by given name. @param $name @param null $presenter @return string
[ "Render", "the", "menu", "tag", "by", "given", "name", "." ]
train
https://github.com/nWidart/laravel-menus/blob/65a052af4d88ec1f23b3ea92863c1dfa0fd6c832/src/Menu.php#L133-L136
nWidart/laravel-menus
src/MenusServiceProvider.php
MenusServiceProvider.register
public function register() { $this->registerHtmlPackage(); $this->app->singleton('menus', function ($app) { return new Menu($app['view'], $app['config']); }); }
php
public function register() { $this->registerHtmlPackage(); $this->app->singleton('menus', function ($app) { return new Menu($app['view'], $app['config']); }); }
[ "public", "function", "register", "(", ")", "{", "$", "this", "->", "registerHtmlPackage", "(", ")", ";", "$", "this", "->", "app", "->", "singleton", "(", "'menus'", ",", "function", "(", "$", "app", ")", "{", "return", "new", "Menu", "(", "$", "app...
Register the service provider.
[ "Register", "the", "service", "provider", "." ]
train
https://github.com/nWidart/laravel-menus/blob/65a052af4d88ec1f23b3ea92863c1dfa0fd6c832/src/MenusServiceProvider.php#L39-L46
nWidart/laravel-menus
src/MenusServiceProvider.php
MenusServiceProvider.registerNamespaces
protected function registerNamespaces() { $configPath = __DIR__ . '/../config/config.php'; $viewsPath = __DIR__ . '/../views'; $this->mergeConfigFrom($configPath, 'menus'); $this->loadViewsFrom($viewsPath, 'menus'); $this->publishes([ $configPath => config_path('...
php
protected function registerNamespaces() { $configPath = __DIR__ . '/../config/config.php'; $viewsPath = __DIR__ . '/../views'; $this->mergeConfigFrom($configPath, 'menus'); $this->loadViewsFrom($viewsPath, 'menus'); $this->publishes([ $configPath => config_path('...
[ "protected", "function", "registerNamespaces", "(", ")", "{", "$", "configPath", "=", "__DIR__", ".", "'/../config/config.php'", ";", "$", "viewsPath", "=", "__DIR__", ".", "'/../views'", ";", "$", "this", "->", "mergeConfigFrom", "(", "$", "configPath", ",", ...
Register package's namespaces.
[ "Register", "package", "s", "namespaces", "." ]
train
https://github.com/nWidart/laravel-menus/blob/65a052af4d88ec1f23b3ea92863c1dfa0fd6c832/src/MenusServiceProvider.php#L76-L90
nWidart/laravel-menus
src/MenuItem.php
MenuItem.setIconAttribute
protected static function setIconAttribute(array $properties) { $icon = array_get($properties, 'attributes.icon'); if (!is_null($icon)) { $properties['icon'] = $icon; array_forget($properties, 'attributes.icon'); return $properties; } return $pr...
php
protected static function setIconAttribute(array $properties) { $icon = array_get($properties, 'attributes.icon'); if (!is_null($icon)) { $properties['icon'] = $icon; array_forget($properties, 'attributes.icon'); return $properties; } return $pr...
[ "protected", "static", "function", "setIconAttribute", "(", "array", "$", "properties", ")", "{", "$", "icon", "=", "array_get", "(", "$", "properties", ",", "'attributes.icon'", ")", ";", "if", "(", "!", "is_null", "(", "$", "icon", ")", ")", "{", "$", ...
Set the icon property when the icon is defined in the link attributes. @param array $properties @return array
[ "Set", "the", "icon", "property", "when", "the", "icon", "is", "defined", "in", "the", "link", "attributes", "." ]
train
https://github.com/nWidart/laravel-menus/blob/65a052af4d88ec1f23b3ea92863c1dfa0fd6c832/src/MenuItem.php#L80-L92
nWidart/laravel-menus
src/MenuItem.php
MenuItem.fill
public function fill($attributes) { foreach ($attributes as $key => $value) { if (in_array($key, $this->fillable)) { $this->{$key} = $value; } } }
php
public function fill($attributes) { foreach ($attributes as $key => $value) { if (in_array($key, $this->fillable)) { $this->{$key} = $value; } } }
[ "public", "function", "fill", "(", "$", "attributes", ")", "{", "foreach", "(", "$", "attributes", "as", "$", "key", "=>", "$", "value", ")", "{", "if", "(", "in_array", "(", "$", "key", ",", "$", "this", "->", "fillable", ")", ")", "{", "$", "th...
Fill the attributes. @param array $attributes
[ "Fill", "the", "attributes", "." ]
train
https://github.com/nWidart/laravel-menus/blob/65a052af4d88ec1f23b3ea92863c1dfa0fd6c832/src/MenuItem.php#L125-L132
nWidart/laravel-menus
src/MenuItem.php
MenuItem.addDivider
public function addDivider($order = null) { $item = static::make(array('name' => 'divider', 'order' => $order)); $this->childs[] = $item; return $item; }
php
public function addDivider($order = null) { $item = static::make(array('name' => 'divider', 'order' => $order)); $this->childs[] = $item; return $item; }
[ "public", "function", "addDivider", "(", "$", "order", "=", "null", ")", "{", "$", "item", "=", "static", "::", "make", "(", "array", "(", "'name'", "=>", "'divider'", ",", "'order'", "=>", "$", "order", ")", ")", ";", "$", "this", "->", "childs", ...
Add new divider. @param int $order @return self
[ "Add", "new", "divider", "." ]
train
https://github.com/nWidart/laravel-menus/blob/65a052af4d88ec1f23b3ea92863c1dfa0fd6c832/src/MenuItem.php#L252-L259
nWidart/laravel-menus
src/MenuItem.php
MenuItem.getUrl
public function getUrl() { if ($this->route !== null) { return route($this->route[0], $this->route[1]); } return url($this->url); }
php
public function getUrl() { if ($this->route !== null) { return route($this->route[0], $this->route[1]); } return url($this->url); }
[ "public", "function", "getUrl", "(", ")", "{", "if", "(", "$", "this", "->", "route", "!==", "null", ")", "{", "return", "route", "(", "$", "this", "->", "route", "[", "0", "]", ",", "$", "this", "->", "route", "[", "1", "]", ")", ";", "}", "...
Get url. @return string
[ "Get", "url", "." ]
train
https://github.com/nWidart/laravel-menus/blob/65a052af4d88ec1f23b3ea92863c1dfa0fd6c832/src/MenuItem.php#L323-L330
nWidart/laravel-menus
src/MenuItem.php
MenuItem.getIcon
public function getIcon($default = null) { if ($this->icon !== null && $this->icon !== '') { return '<i class="' . $this->icon . '"></i>'; } if ($default === null) { return $default; } return '<i class="' . $default . '"></i>'; }
php
public function getIcon($default = null) { if ($this->icon !== null && $this->icon !== '') { return '<i class="' . $this->icon . '"></i>'; } if ($default === null) { return $default; } return '<i class="' . $default . '"></i>'; }
[ "public", "function", "getIcon", "(", "$", "default", "=", "null", ")", "{", "if", "(", "$", "this", "->", "icon", "!==", "null", "&&", "$", "this", "->", "icon", "!==", "''", ")", "{", "return", "'<i class=\"'", ".", "$", "this", "->", "icon", "."...
Get icon. @param null|string $default @return string
[ "Get", "icon", "." ]
train
https://github.com/nWidart/laravel-menus/blob/65a052af4d88ec1f23b3ea92863c1dfa0fd6c832/src/MenuItem.php#L349-L359
nWidart/laravel-menus
src/MenuItem.php
MenuItem.getAttributes
public function getAttributes() { $attributes = $this->attributes ? $this->attributes : []; array_forget($attributes, ['active', 'icon']); return HTML::attributes($attributes); }
php
public function getAttributes() { $attributes = $this->attributes ? $this->attributes : []; array_forget($attributes, ['active', 'icon']); return HTML::attributes($attributes); }
[ "public", "function", "getAttributes", "(", ")", "{", "$", "attributes", "=", "$", "this", "->", "attributes", "?", "$", "this", "->", "attributes", ":", "[", "]", ";", "array_forget", "(", "$", "attributes", ",", "[", "'active'", ",", "'icon'", "]", "...
Get HTML attribute data. @return mixed
[ "Get", "HTML", "attribute", "data", "." ]
train
https://github.com/nWidart/laravel-menus/blob/65a052af4d88ec1f23b3ea92863c1dfa0fd6c832/src/MenuItem.php#L376-L383
nWidart/laravel-menus
src/MenuItem.php
MenuItem.inactive
public function inactive() { $inactive = $this->getInactiveAttribute(); if (is_bool($inactive)) { return $inactive; } if ($inactive instanceof \Closure) { return call_user_func($inactive); } return false; }
php
public function inactive() { $inactive = $this->getInactiveAttribute(); if (is_bool($inactive)) { return $inactive; } if ($inactive instanceof \Closure) { return call_user_func($inactive); } return false; }
[ "public", "function", "inactive", "(", ")", "{", "$", "inactive", "=", "$", "this", "->", "getInactiveAttribute", "(", ")", ";", "if", "(", "is_bool", "(", "$", "inactive", ")", ")", "{", "return", "$", "inactive", ";", "}", "if", "(", "$", "inactive...
Get inactive state. @return bool
[ "Get", "inactive", "state", "." ]
train
https://github.com/nWidart/laravel-menus/blob/65a052af4d88ec1f23b3ea92863c1dfa0fd6c832/src/MenuItem.php#L483-L496
nWidart/laravel-menus
src/MenuItem.php
MenuItem.isActive
public function isActive() { if ($this->inactive()) { return false; } $active = $this->getActiveAttribute(); if (is_bool($active)) { return $active; } if ($active instanceof \Closure) { return call_user_func($active); } ...
php
public function isActive() { if ($this->inactive()) { return false; } $active = $this->getActiveAttribute(); if (is_bool($active)) { return $active; } if ($active instanceof \Closure) { return call_user_func($active); } ...
[ "public", "function", "isActive", "(", ")", "{", "if", "(", "$", "this", "->", "inactive", "(", ")", ")", "{", "return", "false", ";", "}", "$", "active", "=", "$", "this", "->", "getActiveAttribute", "(", ")", ";", "if", "(", "is_bool", "(", "$", ...
Get active state for current item. @return mixed
[ "Get", "active", "state", "for", "current", "item", "." ]
train
https://github.com/nWidart/laravel-menus/blob/65a052af4d88ec1f23b3ea92863c1dfa0fd6c832/src/MenuItem.php#L523-L544
nWidart/laravel-menus
src/MenuBuilder.php
MenuBuilder.whereTitle
public function whereTitle($title, callable $callback = null) { $item = $this->findBy('title', $title); if (is_callable($callback)) { return call_user_func($callback, $item); } return $item; }
php
public function whereTitle($title, callable $callback = null) { $item = $this->findBy('title', $title); if (is_callable($callback)) { return call_user_func($callback, $item); } return $item; }
[ "public", "function", "whereTitle", "(", "$", "title", ",", "callable", "$", "callback", "=", "null", ")", "{", "$", "item", "=", "$", "this", "->", "findBy", "(", "'title'", ",", "$", "title", ")", ";", "if", "(", "is_callable", "(", "$", "callback"...
Find menu item by given its title. @param string $title @param callable|null $callback @return mixed
[ "Find", "menu", "item", "by", "given", "its", "title", "." ]
train
https://github.com/nWidart/laravel-menus/blob/65a052af4d88ec1f23b3ea92863c1dfa0fd6c832/src/MenuBuilder.php#L107-L116
nWidart/laravel-menus
src/MenuBuilder.php
MenuBuilder.findBy
public function findBy($key, $value) { return collect($this->items)->filter(function ($item) use ($key, $value) { return $item->{$key} == $value; })->first(); }
php
public function findBy($key, $value) { return collect($this->items)->filter(function ($item) use ($key, $value) { return $item->{$key} == $value; })->first(); }
[ "public", "function", "findBy", "(", "$", "key", ",", "$", "value", ")", "{", "return", "collect", "(", "$", "this", "->", "items", ")", "->", "filter", "(", "function", "(", "$", "item", ")", "use", "(", "$", "key", ",", "$", "value", ")", "{", ...
Find menu item by given key and value. @param string $key @param string $value @return \Nwidart\Menus\MenuItem
[ "Find", "menu", "item", "by", "given", "key", "and", "value", "." ]
train
https://github.com/nWidart/laravel-menus/blob/65a052af4d88ec1f23b3ea92863c1dfa0fd6c832/src/MenuBuilder.php#L125-L130
nWidart/laravel-menus
src/MenuBuilder.php
MenuBuilder.style
public function style($name) { if ($this->hasStyle($name)) { $this->setPresenter($this->getStyle($name)); } return $this; }
php
public function style($name) { if ($this->hasStyle($name)) { $this->setPresenter($this->getStyle($name)); } return $this; }
[ "public", "function", "style", "(", "$", "name", ")", "{", "if", "(", "$", "this", "->", "hasStyle", "(", "$", "name", ")", ")", "{", "$", "this", "->", "setPresenter", "(", "$", "this", "->", "getStyle", "(", "$", "name", ")", ")", ";", "}", "...
Set new presenter class by given style name. @param string $name @return self
[ "Set", "new", "presenter", "class", "by", "given", "style", "name", "." ]
train
https://github.com/nWidart/laravel-menus/blob/65a052af4d88ec1f23b3ea92863c1dfa0fd6c832/src/MenuBuilder.php#L211-L218
nWidart/laravel-menus
src/MenuBuilder.php
MenuBuilder.resolve
public function resolve($key) { if (is_array($key)) { foreach ($key as $k => $v) { $key[$k] = $this->resolve($v); } } elseif (is_string($key)) { $matches = array(); preg_match_all('/{[\s]*?([^\s]+)[\s]*?}/i', $key, $matches, PREG_SET_OR...
php
public function resolve($key) { if (is_array($key)) { foreach ($key as $k => $v) { $key[$k] = $this->resolve($v); } } elseif (is_string($key)) { $matches = array(); preg_match_all('/{[\s]*?([^\s]+)[\s]*?}/i', $key, $matches, PREG_SET_OR...
[ "public", "function", "resolve", "(", "$", "key", ")", "{", "if", "(", "is_array", "(", "$", "key", ")", ")", "{", "foreach", "(", "$", "key", "as", "$", "k", "=>", "$", "v", ")", "{", "$", "key", "[", "$", "k", "]", "=", "$", "this", "->",...
Resolves a key from the bindings array. @param string|array $key @return mixed
[ "Resolves", "a", "key", "from", "the", "bindings", "array", "." ]
train
https://github.com/nWidart/laravel-menus/blob/65a052af4d88ec1f23b3ea92863c1dfa0fd6c832/src/MenuBuilder.php#L285-L302
nWidart/laravel-menus
src/MenuBuilder.php
MenuBuilder.add
public function add(array $attributes = array()) { $item = MenuItem::make($attributes); $this->items[] = $item; return $item; }
php
public function add(array $attributes = array()) { $item = MenuItem::make($attributes); $this->items[] = $item; return $item; }
[ "public", "function", "add", "(", "array", "$", "attributes", "=", "array", "(", ")", ")", "{", "$", "item", "=", "MenuItem", "::", "make", "(", "$", "attributes", ")", ";", "$", "this", "->", "items", "[", "]", "=", "$", "item", ";", "return", "...
Add new child menu. @param array $attributes @return \Nwidart\Menus\MenuItem
[ "Add", "new", "child", "menu", "." ]
train
https://github.com/nWidart/laravel-menus/blob/65a052af4d88ec1f23b3ea92863c1dfa0fd6c832/src/MenuBuilder.php#L329-L336
nWidart/laravel-menus
src/MenuBuilder.php
MenuBuilder.dropdown
public function dropdown($title, \Closure $callback, $order = null, array $attributes = array()) { $properties = compact('title', 'order', 'attributes'); if (func_num_args() == 3) { $arguments = func_get_args(); $title = array_get($arguments, 0); $attributes = a...
php
public function dropdown($title, \Closure $callback, $order = null, array $attributes = array()) { $properties = compact('title', 'order', 'attributes'); if (func_num_args() == 3) { $arguments = func_get_args(); $title = array_get($arguments, 0); $attributes = a...
[ "public", "function", "dropdown", "(", "$", "title", ",", "\\", "Closure", "$", "callback", ",", "$", "order", "=", "null", ",", "array", "$", "attributes", "=", "array", "(", ")", ")", "{", "$", "properties", "=", "compact", "(", "'title'", ",", "'o...
Create new menu with dropdown. @param $title @param callable $callback @param array $attributes @return $this
[ "Create", "new", "menu", "with", "dropdown", "." ]
train
https://github.com/nWidart/laravel-menus/blob/65a052af4d88ec1f23b3ea92863c1dfa0fd6c832/src/MenuBuilder.php#L347-L367
nWidart/laravel-menus
src/MenuBuilder.php
MenuBuilder.formatUrl
protected function formatUrl($url) { $uri = !is_null($this->prefixUrl) ? $this->prefixUrl . $url : $url; return $uri == '/' ? '/' : ltrim(rtrim($uri, '/'), '/'); }
php
protected function formatUrl($url) { $uri = !is_null($this->prefixUrl) ? $this->prefixUrl . $url : $url; return $uri == '/' ? '/' : ltrim(rtrim($uri, '/'), '/'); }
[ "protected", "function", "formatUrl", "(", "$", "url", ")", "{", "$", "uri", "=", "!", "is_null", "(", "$", "this", "->", "prefixUrl", ")", "?", "$", "this", "->", "prefixUrl", ".", "$", "url", ":", "$", "url", ";", "return", "$", "uri", "==", "'...
Format URL. @param string $url @return string
[ "Format", "URL", "." ]
train
https://github.com/nWidart/laravel-menus/blob/65a052af4d88ec1f23b3ea92863c1dfa0fd6c832/src/MenuBuilder.php#L409-L414
nWidart/laravel-menus
src/MenuBuilder.php
MenuBuilder.addHeader
public function addHeader($title, $order = null) { $this->items[] = new MenuItem(array( 'name' => 'header', 'title' => $title, 'order' => $order, )); return $this; }
php
public function addHeader($title, $order = null) { $this->items[] = new MenuItem(array( 'name' => 'header', 'title' => $title, 'order' => $order, )); return $this; }
[ "public", "function", "addHeader", "(", "$", "title", ",", "$", "order", "=", "null", ")", "{", "$", "this", "->", "items", "[", "]", "=", "new", "MenuItem", "(", "array", "(", "'name'", "=>", "'header'", ",", "'title'", "=>", "$", "title", ",", "'...
Add new header item. @return \Nwidart\Menus\MenuItem
[ "Add", "new", "header", "item", "." ]
train
https://github.com/nWidart/laravel-menus/blob/65a052af4d88ec1f23b3ea92863c1dfa0fd6c832/src/MenuBuilder.php#L464-L473
nWidart/laravel-menus
src/MenuBuilder.php
MenuBuilder.render
public function render($presenter = null) { $this->resolveItems($this->items); if (!is_null($this->view)) { return $this->renderView($presenter); } if ($this->hasStyle($presenter)) { $this->setPresenterFromStyle($presenter); } if (!is_null($...
php
public function render($presenter = null) { $this->resolveItems($this->items); if (!is_null($this->view)) { return $this->renderView($presenter); } if ($this->hasStyle($presenter)) { $this->setPresenterFromStyle($presenter); } if (!is_null($...
[ "public", "function", "render", "(", "$", "presenter", "=", "null", ")", "{", "$", "this", "->", "resolveItems", "(", "$", "this", "->", "items", ")", ";", "if", "(", "!", "is_null", "(", "$", "this", "->", "view", ")", ")", "{", "return", "$", "...
Render the menu to HTML tag. @param string $presenter @return string
[ "Render", "the", "menu", "to", "HTML", "tag", "." ]
train
https://github.com/nWidart/laravel-menus/blob/65a052af4d88ec1f23b3ea92863c1dfa0fd6c832/src/MenuBuilder.php#L524-L541
nWidart/laravel-menus
src/MenuBuilder.php
MenuBuilder.renderView
public function renderView($presenter = null) { return $this->views->make($presenter ?: $this->view, [ 'items' => $this->getOrderedItems(), ]); }
php
public function renderView($presenter = null) { return $this->views->make($presenter ?: $this->view, [ 'items' => $this->getOrderedItems(), ]); }
[ "public", "function", "renderView", "(", "$", "presenter", "=", "null", ")", "{", "return", "$", "this", "->", "views", "->", "make", "(", "$", "presenter", "?", ":", "$", "this", "->", "view", ",", "[", "'items'", "=>", "$", "this", "->", "getOrdere...
Render menu via view presenter. @return \Illuminate\View\View
[ "Render", "menu", "via", "view", "presenter", "." ]
train
https://github.com/nWidart/laravel-menus/blob/65a052af4d88ec1f23b3ea92863c1dfa0fd6c832/src/MenuBuilder.php#L548-L553
nWidart/laravel-menus
src/MenuBuilder.php
MenuBuilder.getOrderedItems
public function getOrderedItems() { if (config('menus.ordering') || $this->ordering) { return $this->toCollection()->sortBy(function ($item) { return $item->order; })->all(); } return $this->items; }
php
public function getOrderedItems() { if (config('menus.ordering') || $this->ordering) { return $this->toCollection()->sortBy(function ($item) { return $item->order; })->all(); } return $this->items; }
[ "public", "function", "getOrderedItems", "(", ")", "{", "if", "(", "config", "(", "'menus.ordering'", ")", "||", "$", "this", "->", "ordering", ")", "{", "return", "$", "this", "->", "toCollection", "(", ")", "->", "sortBy", "(", "function", "(", "$", ...
Get menu items and order it by 'order' key. @return array
[ "Get", "menu", "items", "and", "order", "it", "by", "order", "key", "." ]
train
https://github.com/nWidart/laravel-menus/blob/65a052af4d88ec1f23b3ea92863c1dfa0fd6c832/src/MenuBuilder.php#L614-L623
nWidart/laravel-menus
src/MenuBuilder.php
MenuBuilder.renderMenu
protected function renderMenu() { $presenter = $this->getPresenter(); $menu = $presenter->getOpenTagWrapper(); foreach ($this->getOrderedItems() as $item) { if ($item->hidden()) { continue; } if ($item->hasSubMenu()) { $me...
php
protected function renderMenu() { $presenter = $this->getPresenter(); $menu = $presenter->getOpenTagWrapper(); foreach ($this->getOrderedItems() as $item) { if ($item->hidden()) { continue; } if ($item->hasSubMenu()) { $me...
[ "protected", "function", "renderMenu", "(", ")", "{", "$", "presenter", "=", "$", "this", "->", "getPresenter", "(", ")", ";", "$", "menu", "=", "$", "presenter", "->", "getOpenTagWrapper", "(", ")", ";", "foreach", "(", "$", "this", "->", "getOrderedIte...
Render the menu. @return string
[ "Render", "the", "menu", "." ]
train
https://github.com/nWidart/laravel-menus/blob/65a052af4d88ec1f23b3ea92863c1dfa0fd6c832/src/MenuBuilder.php#L630-L654
nWidart/laravel-menus
src/Presenters/Metronic/MetronicHorizontalMenuPresenter.php
MetronicHorizontalMenuPresenter.getMenuWithoutDropdownWrapper
public function getMenuWithoutDropdownWrapper($item) { return '<li ' . $this->getActiveState($item) . '>' . $item->getIcon() . '<a href="' . $item->getUrl() . '" class="m-menu__link"><span class="m-menu__item-here"></span><span class="m-menu__link-text">' . $item->title . '</span></a></li>'; }
php
public function getMenuWithoutDropdownWrapper($item) { return '<li ' . $this->getActiveState($item) . '>' . $item->getIcon() . '<a href="' . $item->getUrl() . '" class="m-menu__link"><span class="m-menu__item-here"></span><span class="m-menu__link-text">' . $item->title . '</span></a></li>'; }
[ "public", "function", "getMenuWithoutDropdownWrapper", "(", "$", "item", ")", "{", "return", "'<li '", ".", "$", "this", "->", "getActiveState", "(", "$", "item", ")", ".", "'>'", ".", "$", "item", "->", "getIcon", "(", ")", ".", "'<a href=\"'", ".", "$"...
{@inheritdoc }
[ "{" ]
train
https://github.com/nWidart/laravel-menus/blob/65a052af4d88ec1f23b3ea92863c1dfa0fd6c832/src/Presenters/Metronic/MetronicHorizontalMenuPresenter.php#L32-L34
KnpLabs/KnpMarkdownBundle
Parser/Preset/Flavored.php
Flavored.transformMarkdown
public function transformMarkdown($text) { $types = array(); $markdown = preg_replace_callback("@```[ ]*([^\n]*)(.+?)```@smi", function ($m) use (&$types) { $types[] = trim($m[1]); return ' '.str_replace("\n", "\n ", trim($m[2], "\r\n")); }, parent::transfor...
php
public function transformMarkdown($text) { $types = array(); $markdown = preg_replace_callback("@```[ ]*([^\n]*)(.+?)```@smi", function ($m) use (&$types) { $types[] = trim($m[1]); return ' '.str_replace("\n", "\n ", trim($m[2], "\r\n")); }, parent::transfor...
[ "public", "function", "transformMarkdown", "(", "$", "text", ")", "{", "$", "types", "=", "array", "(", ")", ";", "$", "markdown", "=", "preg_replace_callback", "(", "\"@```[ ]*([^\\n]*)(.+?)```@smi\"", ",", "function", "(", "$", "m", ")", "use", "(", "&", ...
{@inheritDoc}
[ "{" ]
train
https://github.com/KnpLabs/KnpMarkdownBundle/blob/c055def2e67fe0d3b3d2e993584f01ff222eff86/Parser/Preset/Flavored.php#L13-L23
KnpLabs/KnpMarkdownBundle
DependencyInjection/KnpMarkdownExtension.php
KnpMarkdownExtension.load
public function load(array $configs , ContainerBuilder $container) { $configuration = new Configuration(); $config = $this->processConfiguration($configuration, $configs); $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); $loader->load('parse...
php
public function load(array $configs , ContainerBuilder $container) { $configuration = new Configuration(); $config = $this->processConfiguration($configuration, $configs); $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); $loader->load('parse...
[ "public", "function", "load", "(", "array", "$", "configs", ",", "ContainerBuilder", "$", "container", ")", "{", "$", "configuration", "=", "new", "Configuration", "(", ")", ";", "$", "config", "=", "$", "this", "->", "processConfiguration", "(", "$", "con...
Handles the knp_markdown configuration. @param array $configs The configurations being loaded @param ContainerBuilder $container @throws InvalidConfigurationException When Sundown parser was selected, but extension is not available
[ "Handles", "the", "knp_markdown", "configuration", "." ]
train
https://github.com/KnpLabs/KnpMarkdownBundle/blob/c055def2e67fe0d3b3d2e993584f01ff222eff86/DependencyInjection/KnpMarkdownExtension.php#L25-L56
KnpLabs/KnpMarkdownBundle
Parser/ParserManager.php
ParserManager.transform
public function transform($markdownText, $parserName = null) { if (null === $parserName) { $parserName = 'default'; } if (!isset($this->parsers[$parserName])) { throw new \RuntimeException(sprintf('Unknown parser selected ("%s"), available are: %s', $parserName, impl...
php
public function transform($markdownText, $parserName = null) { if (null === $parserName) { $parserName = 'default'; } if (!isset($this->parsers[$parserName])) { throw new \RuntimeException(sprintf('Unknown parser selected ("%s"), available are: %s', $parserName, impl...
[ "public", "function", "transform", "(", "$", "markdownText", ",", "$", "parserName", "=", "null", ")", "{", "if", "(", "null", "===", "$", "parserName", ")", "{", "$", "parserName", "=", "'default'", ";", "}", "if", "(", "!", "isset", "(", "$", "this...
Transforms markdown syntax to HTML @param string $markdownText The markdown syntax text @param null|string $parserName @return string The HTML code @throws \RuntimeException
[ "Transforms", "markdown", "syntax", "to", "HTML" ]
train
https://github.com/KnpLabs/KnpMarkdownBundle/blob/c055def2e67fe0d3b3d2e993584f01ff222eff86/Parser/ParserManager.php#L33-L46
KnpLabs/KnpMarkdownBundle
DependencyInjection/Configuration.php
Configuration.getConfigTreeBuilder
public function getConfigTreeBuilder() { $treeBuilder = new TreeBuilder('knp_markdown'); // BC layer for symfony/config < 4.2 $rootNode = method_exists($treeBuilder, 'getRootNode') ? $treeBuilder->getRootNode() : $treeBuilder->root('knp_markdown'); $rootNode ->addDefault...
php
public function getConfigTreeBuilder() { $treeBuilder = new TreeBuilder('knp_markdown'); // BC layer for symfony/config < 4.2 $rootNode = method_exists($treeBuilder, 'getRootNode') ? $treeBuilder->getRootNode() : $treeBuilder->root('knp_markdown'); $rootNode ->addDefault...
[ "public", "function", "getConfigTreeBuilder", "(", ")", "{", "$", "treeBuilder", "=", "new", "TreeBuilder", "(", "'knp_markdown'", ")", ";", "// BC layer for symfony/config < 4.2", "$", "rootNode", "=", "method_exists", "(", "$", "treeBuilder", ",", "'getRootNode'", ...
Generates the configuration tree builder. @return TreeBuilder
[ "Generates", "the", "configuration", "tree", "builder", "." ]
train
https://github.com/KnpLabs/KnpMarkdownBundle/blob/c055def2e67fe0d3b3d2e993584f01ff222eff86/DependencyInjection/Configuration.php#L15-L65
KnpLabs/KnpMarkdownBundle
Helper/MarkdownHelper.php
MarkdownHelper.transform
public function transform($markdownText, $parserName = null) { trigger_error('The MarkdownHelper was deprecated in 1.7 and will be removed in KnpMarkdownBundle 2.0.', E_USER_DEPRECATED); return $this->parserManager->transform($markdownText, $parserName); }
php
public function transform($markdownText, $parserName = null) { trigger_error('The MarkdownHelper was deprecated in 1.7 and will be removed in KnpMarkdownBundle 2.0.', E_USER_DEPRECATED); return $this->parserManager->transform($markdownText, $parserName); }
[ "public", "function", "transform", "(", "$", "markdownText", ",", "$", "parserName", "=", "null", ")", "{", "trigger_error", "(", "'The MarkdownHelper was deprecated in 1.7 and will be removed in KnpMarkdownBundle 2.0.'", ",", "E_USER_DEPRECATED", ")", ";", "return", "$", ...
Transforms markdown syntax to HTML @param string $markdownText The markdown syntax text @param null|string $parserName @return string The HTML code @throws \RuntimeException
[ "Transforms", "markdown", "syntax", "to", "HTML" ]
train
https://github.com/KnpLabs/KnpMarkdownBundle/blob/c055def2e67fe0d3b3d2e993584f01ff222eff86/Helper/MarkdownHelper.php#L31-L36
php-lock/lock
classes/util/Loop.php
Loop.execute
public function execute(callable $code) { $this->looping = true; $deadline = microtime(true) + $this->timeout; // At this time, the lock will time out. $result = null; for ($i = 0; $this->looping && microtime(true) < $deadline; $i++) { $result = $code(); if ...
php
public function execute(callable $code) { $this->looping = true; $deadline = microtime(true) + $this->timeout; // At this time, the lock will time out. $result = null; for ($i = 0; $this->looping && microtime(true) < $deadline; $i++) { $result = $code(); if ...
[ "public", "function", "execute", "(", "callable", "$", "code", ")", "{", "$", "this", "->", "looping", "=", "true", ";", "$", "deadline", "=", "microtime", "(", "true", ")", "+", "$", "this", "->", "timeout", ";", "// At this time, the lock will time out.", ...
Repeats executing a code until it was successful. The code has to be designed in a way that it can be repeated without any side effects. When execution was successful it should notify that event by calling {@link Loop::end()}. I.e. the only side effects of the code may happen after a successful execution. If the code...
[ "Repeats", "executing", "a", "code", "until", "it", "was", "successful", "." ]
train
https://github.com/php-lock/lock/blob/a7fa87768a07f6957b7e51fbc95e928430f12db8/classes/util/Loop.php#L82-L120
php-lock/lock
classes/mutex/PHPRedisMutex.php
PHPRedisMutex.hasLzfCompression
private function hasLzfCompression($redis): bool { if (!\defined('Redis::COMPRESSION_LZF')) { return false; } return Redis::COMPRESSION_LZF === $redis->getOption(Redis::OPT_COMPRESSION); }
php
private function hasLzfCompression($redis): bool { if (!\defined('Redis::COMPRESSION_LZF')) { return false; } return Redis::COMPRESSION_LZF === $redis->getOption(Redis::OPT_COMPRESSION); }
[ "private", "function", "hasLzfCompression", "(", "$", "redis", ")", ":", "bool", "{", "if", "(", "!", "\\", "defined", "(", "'Redis::COMPRESSION_LZF'", ")", ")", "{", "return", "false", ";", "}", "return", "Redis", "::", "COMPRESSION_LZF", "===", "$", "red...
Determines if lzf compression is enabled for the given connection. @param \Redis|\RedisCluster $redis Redis connection. @return bool TRUE if lzf compression is enabled, false otherwise.
[ "Determines", "if", "lzf", "compression", "is", "enabled", "for", "the", "given", "connection", "." ]
train
https://github.com/php-lock/lock/blob/a7fa87768a07f6957b7e51fbc95e928430f12db8/classes/mutex/PHPRedisMutex.php#L100-L107
php-lock/lock
classes/util/DoubleCheckedLocking.php
DoubleCheckedLocking.then
public function then(callable $code) { if (!call_user_func($this->check)) { return false; } return $this->mutex->synchronized(function () use ($code) { if (!call_user_func($this->check)) { return false; } return $code(); ...
php
public function then(callable $code) { if (!call_user_func($this->check)) { return false; } return $this->mutex->synchronized(function () use ($code) { if (!call_user_func($this->check)) { return false; } return $code(); ...
[ "public", "function", "then", "(", "callable", "$", "code", ")", "{", "if", "(", "!", "call_user_func", "(", "$", "this", "->", "check", ")", ")", "{", "return", "false", ";", "}", "return", "$", "this", "->", "mutex", "->", "synchronized", "(", "fun...
Executes a code only if a check is true. Both the check and the code execution are locked by a mutex. Only if the check fails the method returns before acquiring a lock. If then returns boolean FALSE, the check did not pass before or after acquiring the lock. A boolean FALSE can also be returned from the synchronized...
[ "Executes", "a", "code", "only", "if", "a", "check", "is", "true", "." ]
train
https://github.com/php-lock/lock/blob/a7fa87768a07f6957b7e51fbc95e928430f12db8/classes/util/DoubleCheckedLocking.php#L56-L69
php-lock/lock
classes/util/PcntlTimeout.php
PcntlTimeout.timeBoxed
public function timeBoxed(callable $code) { $existingHandler = pcntl_signal_get_handler(SIGALRM); $signal = pcntl_signal(SIGALRM, function (): void { throw new DeadlineException(sprintf("Timebox hit deadline of %d seconds", $this->timeout)); }); if (!$signal) { ...
php
public function timeBoxed(callable $code) { $existingHandler = pcntl_signal_get_handler(SIGALRM); $signal = pcntl_signal(SIGALRM, function (): void { throw new DeadlineException(sprintf("Timebox hit deadline of %d seconds", $this->timeout)); }); if (!$signal) { ...
[ "public", "function", "timeBoxed", "(", "callable", "$", "code", ")", "{", "$", "existingHandler", "=", "pcntl_signal_get_handler", "(", "SIGALRM", ")", ";", "$", "signal", "=", "pcntl_signal", "(", "SIGALRM", ",", "function", "(", ")", ":", "void", "{", "...
Runs the code and would eventually time out. This method has the side effect, that any signal handler for SIGALRM will be reset to the default hanlder (SIG_DFL). It also expects that there is no previously scheduled alarm. If your application uses alarms ({@link pcntl_alarm()}) or a signal handler for SIGALRM, don't u...
[ "Runs", "the", "code", "and", "would", "eventually", "time", "out", "." ]
train
https://github.com/php-lock/lock/blob/a7fa87768a07f6957b7e51fbc95e928430f12db8/classes/util/PcntlTimeout.php#L59-L80
php-lock/lock
classes/mutex/TransactionalMutex.php
TransactionalMutex.checkAutocommit
private static function checkAutocommit(\PDO $pdo): void { $vendor = $pdo->getAttribute(\PDO::ATTR_DRIVER_NAME); // MySQL turns autocommit off during a transaction. if ($vendor == "mysql") { return; } try { if ($pdo->getAttribute(\PDO::ATTR_A...
php
private static function checkAutocommit(\PDO $pdo): void { $vendor = $pdo->getAttribute(\PDO::ATTR_DRIVER_NAME); // MySQL turns autocommit off during a transaction. if ($vendor == "mysql") { return; } try { if ($pdo->getAttribute(\PDO::ATTR_A...
[ "private", "static", "function", "checkAutocommit", "(", "\\", "PDO", "$", "pdo", ")", ":", "void", "{", "$", "vendor", "=", "$", "pdo", "->", "getAttribute", "(", "\\", "PDO", "::", "ATTR_DRIVER_NAME", ")", ";", "// MySQL turns autocommit off during a transacti...
Checks that the AUTOCOMMIT mode is turned off. @param \PDO $pdo PDO
[ "Checks", "that", "the", "AUTOCOMMIT", "mode", "is", "turned", "off", "." ]
train
https://github.com/php-lock/lock/blob/a7fa87768a07f6957b7e51fbc95e928430f12db8/classes/mutex/TransactionalMutex.php#L63-L82
php-lock/lock
classes/mutex/TransactionalMutex.php
TransactionalMutex.synchronized
public function synchronized(callable $code) { return $this->loop->execute(function () use ($code) { try { // BEGIN $this->pdo->beginTransaction(); } catch (\PDOException $e) { throw new LockAcquireException("Could not begin transaction...
php
public function synchronized(callable $code) { return $this->loop->execute(function () use ($code) { try { // BEGIN $this->pdo->beginTransaction(); } catch (\PDOException $e) { throw new LockAcquireException("Could not begin transaction...
[ "public", "function", "synchronized", "(", "callable", "$", "code", ")", "{", "return", "$", "this", "->", "loop", "->", "execute", "(", "function", "(", ")", "use", "(", "$", "code", ")", "{", "try", "{", "// BEGIN", "$", "this", "->", "pdo", "->", ...
Executes the critical code within a transaction. It's up to the user to set the correct transaction isolation level. However if the transaction fails, the code will be executed again in a new transaction. Therefore the code must not have any side effects besides SQL statements. Also the isolation level should be conse...
[ "Executes", "the", "critical", "code", "within", "a", "transaction", "." ]
train
https://github.com/php-lock/lock/blob/a7fa87768a07f6957b7e51fbc95e928430f12db8/classes/mutex/TransactionalMutex.php#L106-L132
php-lock/lock
classes/mutex/TransactionalMutex.php
TransactionalMutex.hasPDOException
private static function hasPDOException(\Exception $exception) { if ($exception instanceof \PDOException) { return true; } if ($exception->getPrevious() === null) { return false; } return self::hasPDOException($exception->getPrevious()); }
php
private static function hasPDOException(\Exception $exception) { if ($exception instanceof \PDOException) { return true; } if ($exception->getPrevious() === null) { return false; } return self::hasPDOException($exception->getPrevious()); }
[ "private", "static", "function", "hasPDOException", "(", "\\", "Exception", "$", "exception", ")", "{", "if", "(", "$", "exception", "instanceof", "\\", "PDOException", ")", "{", "return", "true", ";", "}", "if", "(", "$", "exception", "->", "getPrevious", ...
Checks if an exception or any of its previous exceptions is a PDOException. @param \Exception $exception The exception. @return boolean True if there's a PDOException.
[ "Checks", "if", "an", "exception", "or", "any", "of", "its", "previous", "exceptions", "is", "a", "PDOException", "." ]
train
https://github.com/php-lock/lock/blob/a7fa87768a07f6957b7e51fbc95e928430f12db8/classes/mutex/TransactionalMutex.php#L140-L149
php-lock/lock
classes/mutex/TransactionalMutex.php
TransactionalMutex.rollBack
private function rollBack(\Exception $exception) { try { $this->pdo->rollBack(); } catch (\PDOException $e2) { throw new LockAcquireException( "Could not roll back transaction: {$e2->getMessage()})", 0, $exception );...
php
private function rollBack(\Exception $exception) { try { $this->pdo->rollBack(); } catch (\PDOException $e2) { throw new LockAcquireException( "Could not roll back transaction: {$e2->getMessage()})", 0, $exception );...
[ "private", "function", "rollBack", "(", "\\", "Exception", "$", "exception", ")", "{", "try", "{", "$", "this", "->", "pdo", "->", "rollBack", "(", ")", ";", "}", "catch", "(", "\\", "PDOException", "$", "e2", ")", "{", "throw", "new", "LockAcquireExce...
Rolls back a transaction. @param \Exception $exception The causing exception. @throws LockAcquireException The roll back failed.
[ "Rolls", "back", "a", "transaction", "." ]
train
https://github.com/php-lock/lock/blob/a7fa87768a07f6957b7e51fbc95e928430f12db8/classes/mutex/TransactionalMutex.php#L158-L169
Microsoft/tolerant-php-parser
src/Node.php
Node.getStart
public function getStart() : int { $child = $this->getChildNodesAndTokens()->current(); if ($child instanceof Node) { return $child->getStart(); } elseif ($child instanceof Token) { return $child->start; } throw new \Exception("Unknown type in AST"); }
php
public function getStart() : int { $child = $this->getChildNodesAndTokens()->current(); if ($child instanceof Node) { return $child->getStart(); } elseif ($child instanceof Token) { return $child->start; } throw new \Exception("Unknown type in AST"); }
[ "public", "function", "getStart", "(", ")", ":", "int", "{", "$", "child", "=", "$", "this", "->", "getChildNodesAndTokens", "(", ")", "->", "current", "(", ")", ";", "if", "(", "$", "child", "instanceof", "Node", ")", "{", "return", "$", "child", "-...
Gets start position of Node, not including leading comments and whitespace. @return int @throws \Exception
[ "Gets", "start", "position", "of", "Node", "not", "including", "leading", "comments", "and", "whitespace", "." ]
train
https://github.com/Microsoft/tolerant-php-parser/blob/c74eb57ee5e534e4df5a87e4d131bbd95a8d9eb1/src/Node.php#L34-L42
Microsoft/tolerant-php-parser
src/Node.php
Node.getFullStart
public function getFullStart() : int { foreach($this::CHILD_NAMES as $name) { if (($child = $this->$name) !== null) { if (\is_array($child)) { if(!isset($child[0])) { continue; } $child = $child[0];...
php
public function getFullStart() : int { foreach($this::CHILD_NAMES as $name) { if (($child = $this->$name) !== null) { if (\is_array($child)) { if(!isset($child[0])) { continue; } $child = $child[0];...
[ "public", "function", "getFullStart", "(", ")", ":", "int", "{", "foreach", "(", "$", "this", "::", "CHILD_NAMES", "as", "$", "name", ")", "{", "if", "(", "(", "$", "child", "=", "$", "this", "->", "$", "name", ")", "!==", "null", ")", "{", "if",...
Gets start position of Node, including leading comments and whitespace @return int @throws \Exception
[ "Gets", "start", "position", "of", "Node", "including", "leading", "comments", "and", "whitespace" ]
train
https://github.com/Microsoft/tolerant-php-parser/blob/c74eb57ee5e534e4df5a87e4d131bbd95a8d9eb1/src/Node.php#L49-L74
Microsoft/tolerant-php-parser
src/Node.php
Node.getFirstAncestor
public function getFirstAncestor(...$classNames) { $ancestor = $this; while (($ancestor = $ancestor->parent) !== null) { foreach ($classNames as $className) { if ($ancestor instanceof $className) { return $ancestor; } } ...
php
public function getFirstAncestor(...$classNames) { $ancestor = $this; while (($ancestor = $ancestor->parent) !== null) { foreach ($classNames as $className) { if ($ancestor instanceof $className) { return $ancestor; } } ...
[ "public", "function", "getFirstAncestor", "(", "...", "$", "classNames", ")", "{", "$", "ancestor", "=", "$", "this", ";", "while", "(", "(", "$", "ancestor", "=", "$", "ancestor", "->", "parent", ")", "!==", "null", ")", "{", "foreach", "(", "$", "c...
Gets first ancestor that is an instance of one of the provided classes. Returns null if there is no match. @param string ...$classNames @return Node|null
[ "Gets", "first", "ancestor", "that", "is", "an", "instance", "of", "one", "of", "the", "provided", "classes", ".", "Returns", "null", "if", "there", "is", "no", "match", "." ]
train
https://github.com/Microsoft/tolerant-php-parser/blob/c74eb57ee5e534e4df5a87e4d131bbd95a8d9eb1/src/Node.php#L91-L101
Microsoft/tolerant-php-parser
src/Node.php
Node.getFirstChildNode
public function getFirstChildNode(...$classNames) { foreach ($this::CHILD_NAMES as $name) { $val = $this->$name; foreach ($classNames as $className) { if (\is_array($val)) { foreach ($val as $child) { if ($child instanceof $clas...
php
public function getFirstChildNode(...$classNames) { foreach ($this::CHILD_NAMES as $name) { $val = $this->$name; foreach ($classNames as $className) { if (\is_array($val)) { foreach ($val as $child) { if ($child instanceof $clas...
[ "public", "function", "getFirstChildNode", "(", "...", "$", "classNames", ")", "{", "foreach", "(", "$", "this", "::", "CHILD_NAMES", "as", "$", "name", ")", "{", "$", "val", "=", "$", "this", "->", "$", "name", ";", "foreach", "(", "$", "classNames", ...
Gets first child that is an instance of one of the provided classes. Returns null if there is no match. @param array ...$classNames @return Node|null
[ "Gets", "first", "child", "that", "is", "an", "instance", "of", "one", "of", "the", "provided", "classes", ".", "Returns", "null", "if", "there", "is", "no", "match", "." ]
train
https://github.com/Microsoft/tolerant-php-parser/blob/c74eb57ee5e534e4df5a87e4d131bbd95a8d9eb1/src/Node.php#L110-L127
Microsoft/tolerant-php-parser
src/Node.php
Node.getFirstDescendantNode
public function getFirstDescendantNode(...$classNames) { foreach ($this->getDescendantNodes() as $descendant) { foreach ($classNames as $className) { if ($descendant instanceof $className) { return $descendant; } } } ret...
php
public function getFirstDescendantNode(...$classNames) { foreach ($this->getDescendantNodes() as $descendant) { foreach ($classNames as $className) { if ($descendant instanceof $className) { return $descendant; } } } ret...
[ "public", "function", "getFirstDescendantNode", "(", "...", "$", "classNames", ")", "{", "foreach", "(", "$", "this", "->", "getDescendantNodes", "(", ")", "as", "$", "descendant", ")", "{", "foreach", "(", "$", "classNames", "as", "$", "className", ")", "...
Gets first descendant node that is an instance of one of the provided classes. Returns null if there is no match. @param array ...$classNames @return Node|null
[ "Gets", "first", "descendant", "node", "that", "is", "an", "instance", "of", "one", "of", "the", "provided", "classes", ".", "Returns", "null", "if", "there", "is", "no", "match", "." ]
train
https://github.com/Microsoft/tolerant-php-parser/blob/c74eb57ee5e534e4df5a87e4d131bbd95a8d9eb1/src/Node.php#L136-L145
Microsoft/tolerant-php-parser
src/Node.php
Node.getRoot
public function getRoot() : Node { $node = $this; while ($node->parent !== null) { $node = $node->parent; } return $node; }
php
public function getRoot() : Node { $node = $this; while ($node->parent !== null) { $node = $node->parent; } return $node; }
[ "public", "function", "getRoot", "(", ")", ":", "Node", "{", "$", "node", "=", "$", "this", ";", "while", "(", "$", "node", "->", "parent", "!==", "null", ")", "{", "$", "node", "=", "$", "node", "->", "parent", ";", "}", "return", "$", "node", ...
Gets root of the syntax tree (returns self if has no parents) @return SourceFileNode (expect root to be SourceFileNode unless the tree was manipulated)
[ "Gets", "root", "of", "the", "syntax", "tree", "(", "returns", "self", "if", "has", "no", "parents", ")" ]
train
https://github.com/Microsoft/tolerant-php-parser/blob/c74eb57ee5e534e4df5a87e4d131bbd95a8d9eb1/src/Node.php#L151-L157
Microsoft/tolerant-php-parser
src/Node.php
Node.walkDescendantNodesAndTokens
public function walkDescendantNodesAndTokens(callable $callback, callable $shouldDescendIntoChildrenFn = null) { // TODO - write unit tests to prove invariants // (concatenating all descendant Tokens should produce document, concatenating all Nodes should produce document) foreach (static::CHILD...
php
public function walkDescendantNodesAndTokens(callable $callback, callable $shouldDescendIntoChildrenFn = null) { // TODO - write unit tests to prove invariants // (concatenating all descendant Tokens should produce document, concatenating all Nodes should produce document) foreach (static::CHILD...
[ "public", "function", "walkDescendantNodesAndTokens", "(", "callable", "$", "callback", ",", "callable", "$", "shouldDescendIntoChildrenFn", "=", "null", ")", "{", "// TODO - write unit tests to prove invariants", "// (concatenating all descendant Tokens should produce document, conc...
Iterate over all descendant Nodes and Tokens, calling $callback. This can often be faster than getDescendantNodesAndTokens if you just need to call something and don't need a generator. @param callable $callback a callback that accepts Node|Token @param callable|null $shouldDescendIntoChildrenFn @return void
[ "Iterate", "over", "all", "descendant", "Nodes", "and", "Tokens", "calling", "$callback", ".", "This", "can", "often", "be", "faster", "than", "getDescendantNodesAndTokens", "if", "you", "just", "need", "to", "call", "something", "and", "don", "t", "need", "a"...
train
https://github.com/Microsoft/tolerant-php-parser/blob/c74eb57ee5e534e4df5a87e4d131bbd95a8d9eb1/src/Node.php#L190-L216
Microsoft/tolerant-php-parser
src/Node.php
Node.getDescendantNodes
public function getDescendantNodes(callable $shouldDescendIntoChildrenFn = null) { foreach ($this->getChildNodes() as $child) { yield $child; if ($shouldDescendIntoChildrenFn === null || $shouldDescendIntoChildrenFn($child)) { yield from $child->getDescendantNodes($should...
php
public function getDescendantNodes(callable $shouldDescendIntoChildrenFn = null) { foreach ($this->getChildNodes() as $child) { yield $child; if ($shouldDescendIntoChildrenFn === null || $shouldDescendIntoChildrenFn($child)) { yield from $child->getDescendantNodes($should...
[ "public", "function", "getDescendantNodes", "(", "callable", "$", "shouldDescendIntoChildrenFn", "=", "null", ")", "{", "foreach", "(", "$", "this", "->", "getChildNodes", "(", ")", "as", "$", "child", ")", "{", "yield", "$", "child", ";", "if", "(", "$", ...
Gets a generator containing all descendant Nodes. @param callable|null $shouldDescendIntoChildrenFn @return \Generator|Node[]
[ "Gets", "a", "generator", "containing", "all", "descendant", "Nodes", "." ]
train
https://github.com/Microsoft/tolerant-php-parser/blob/c74eb57ee5e534e4df5a87e4d131bbd95a8d9eb1/src/Node.php#L223-L230
Microsoft/tolerant-php-parser
src/Node.php
Node.getDescendantTokens
public function getDescendantTokens(callable $shouldDescendIntoChildrenFn = null) { foreach ($this->getChildNodesAndTokens() as $child) { if ($child instanceof Node) { if ($shouldDescendIntoChildrenFn == null || $shouldDescendIntoChildrenFn($child)) { yield from $...
php
public function getDescendantTokens(callable $shouldDescendIntoChildrenFn = null) { foreach ($this->getChildNodesAndTokens() as $child) { if ($child instanceof Node) { if ($shouldDescendIntoChildrenFn == null || $shouldDescendIntoChildrenFn($child)) { yield from $...
[ "public", "function", "getDescendantTokens", "(", "callable", "$", "shouldDescendIntoChildrenFn", "=", "null", ")", "{", "foreach", "(", "$", "this", "->", "getChildNodesAndTokens", "(", ")", "as", "$", "child", ")", "{", "if", "(", "$", "child", "instanceof",...
Gets generator containing all descendant Tokens. @param callable|null $shouldDescendIntoChildrenFn @return \Generator|Token[]
[ "Gets", "generator", "containing", "all", "descendant", "Tokens", "." ]
train
https://github.com/Microsoft/tolerant-php-parser/blob/c74eb57ee5e534e4df5a87e4d131bbd95a8d9eb1/src/Node.php#L237-L247
Microsoft/tolerant-php-parser
src/Node.php
Node.getChildNodesAndTokens
public function getChildNodesAndTokens() : \Generator { foreach ($this::CHILD_NAMES as $name) { $val = $this->$name; if (\is_array($val)) { foreach ($val as $child) { if ($child !== null) { yield $name => $child; ...
php
public function getChildNodesAndTokens() : \Generator { foreach ($this::CHILD_NAMES as $name) { $val = $this->$name; if (\is_array($val)) { foreach ($val as $child) { if ($child !== null) { yield $name => $child; ...
[ "public", "function", "getChildNodesAndTokens", "(", ")", ":", "\\", "Generator", "{", "foreach", "(", "$", "this", "::", "CHILD_NAMES", "as", "$", "name", ")", "{", "$", "val", "=", "$", "this", "->", "$", "name", ";", "if", "(", "\\", "is_array", "...
Gets generator containing all child Nodes and Tokens (direct descendants). Does not return null elements. @return \Generator|Token[]|Node[]
[ "Gets", "generator", "containing", "all", "child", "Nodes", "and", "Tokens", "(", "direct", "descendants", ")", ".", "Does", "not", "return", "null", "elements", "." ]
train
https://github.com/Microsoft/tolerant-php-parser/blob/c74eb57ee5e534e4df5a87e4d131bbd95a8d9eb1/src/Node.php#L255-L271
Microsoft/tolerant-php-parser
src/Node.php
Node.getChildNodes
public function getChildNodes() : \Generator { foreach ($this::CHILD_NAMES as $name) { $val = $this->$name; if (\is_array($val)) { foreach ($val as $child) { if ($child instanceof Node) { yield $child; } ...
php
public function getChildNodes() : \Generator { foreach ($this::CHILD_NAMES as $name) { $val = $this->$name; if (\is_array($val)) { foreach ($val as $child) { if ($child instanceof Node) { yield $child; } ...
[ "public", "function", "getChildNodes", "(", ")", ":", "\\", "Generator", "{", "foreach", "(", "$", "this", "::", "CHILD_NAMES", "as", "$", "name", ")", "{", "$", "val", "=", "$", "this", "->", "$", "name", ";", "if", "(", "\\", "is_array", "(", "$"...
Gets generator containing all child Nodes (direct descendants) @return \Generator|Node[]
[ "Gets", "generator", "containing", "all", "child", "Nodes", "(", "direct", "descendants", ")" ]
train
https://github.com/Microsoft/tolerant-php-parser/blob/c74eb57ee5e534e4df5a87e4d131bbd95a8d9eb1/src/Node.php#L277-L291
Microsoft/tolerant-php-parser
src/Node.php
Node.getChildTokens
public function getChildTokens() { foreach ($this::CHILD_NAMES as $name) { $val = $this->$name; if (\is_array($val)) { foreach ($val as $child) { if ($child instanceof Token) { yield $child; } ...
php
public function getChildTokens() { foreach ($this::CHILD_NAMES as $name) { $val = $this->$name; if (\is_array($val)) { foreach ($val as $child) { if ($child instanceof Token) { yield $child; } ...
[ "public", "function", "getChildTokens", "(", ")", "{", "foreach", "(", "$", "this", "::", "CHILD_NAMES", "as", "$", "name", ")", "{", "$", "val", "=", "$", "this", "->", "$", "name", ";", "if", "(", "\\", "is_array", "(", "$", "val", ")", ")", "{...
Gets generator containing all child Tokens (direct descendants) @return \Generator|Token[]
[ "Gets", "generator", "containing", "all", "child", "Tokens", "(", "direct", "descendants", ")" ]
train
https://github.com/Microsoft/tolerant-php-parser/blob/c74eb57ee5e534e4df5a87e4d131bbd95a8d9eb1/src/Node.php#L298-L312
Microsoft/tolerant-php-parser
src/Node.php
Node.getWidth
public function getWidth() : int { $first = $this->getStart(); $last = $this->getEndPosition(); return $last - $first; }
php
public function getWidth() : int { $first = $this->getStart(); $last = $this->getEndPosition(); return $last - $first; }
[ "public", "function", "getWidth", "(", ")", ":", "int", "{", "$", "first", "=", "$", "this", "->", "getStart", "(", ")", ";", "$", "last", "=", "$", "this", "->", "getEndPosition", "(", ")", ";", "return", "$", "last", "-", "$", "first", ";", "}"...
Gets width of a Node (not including comment / whitespace trivia) @return int
[ "Gets", "width", "of", "a", "Node", "(", "not", "including", "comment", "/", "whitespace", "trivia", ")" ]
train
https://github.com/Microsoft/tolerant-php-parser/blob/c74eb57ee5e534e4df5a87e4d131bbd95a8d9eb1/src/Node.php#L332-L337
Microsoft/tolerant-php-parser
src/Node.php
Node.getFullWidth
public function getFullWidth() : int { $first = $this->getFullStart(); $last = $this->getEndPosition(); return $last - $first; }
php
public function getFullWidth() : int { $first = $this->getFullStart(); $last = $this->getEndPosition(); return $last - $first; }
[ "public", "function", "getFullWidth", "(", ")", ":", "int", "{", "$", "first", "=", "$", "this", "->", "getFullStart", "(", ")", ";", "$", "last", "=", "$", "this", "->", "getEndPosition", "(", ")", ";", "return", "$", "last", "-", "$", "first", ";...
Gets width of a Node (including comment / whitespace trivia) @return int
[ "Gets", "width", "of", "a", "Node", "(", "including", "comment", "/", "whitespace", "trivia", ")" ]
train
https://github.com/Microsoft/tolerant-php-parser/blob/c74eb57ee5e534e4df5a87e4d131bbd95a8d9eb1/src/Node.php#L344-L349
Microsoft/tolerant-php-parser
src/Node.php
Node.getText
public function getText() : string { $start = $this->getStart(); $end = $this->getEndPosition(); $fileContents = $this->getFileContents(); return \substr($fileContents, $start, $end - $start); }
php
public function getText() : string { $start = $this->getStart(); $end = $this->getEndPosition(); $fileContents = $this->getFileContents(); return \substr($fileContents, $start, $end - $start); }
[ "public", "function", "getText", "(", ")", ":", "string", "{", "$", "start", "=", "$", "this", "->", "getStart", "(", ")", ";", "$", "end", "=", "$", "this", "->", "getEndPosition", "(", ")", ";", "$", "fileContents", "=", "$", "this", "->", "getFi...
Gets string representing Node text (not including leading comment + whitespace trivia) @return string
[ "Gets", "string", "representing", "Node", "text", "(", "not", "including", "leading", "comment", "+", "whitespace", "trivia", ")" ]
train
https://github.com/Microsoft/tolerant-php-parser/blob/c74eb57ee5e534e4df5a87e4d131bbd95a8d9eb1/src/Node.php#L355-L361
Microsoft/tolerant-php-parser
src/Node.php
Node.getFullText
public function getFullText() : string { $start = $this->getFullStart(); $end = $this->getEndPosition(); $fileContents = $this->getFileContents(); return \substr($fileContents, $start, $end - $start); }
php
public function getFullText() : string { $start = $this->getFullStart(); $end = $this->getEndPosition(); $fileContents = $this->getFileContents(); return \substr($fileContents, $start, $end - $start); }
[ "public", "function", "getFullText", "(", ")", ":", "string", "{", "$", "start", "=", "$", "this", "->", "getFullStart", "(", ")", ";", "$", "end", "=", "$", "this", "->", "getEndPosition", "(", ")", ";", "$", "fileContents", "=", "$", "this", "->", ...
Gets full text of Node (including leading comment + whitespace trivia) @return string
[ "Gets", "full", "text", "of", "Node", "(", "including", "leading", "comment", "+", "whitespace", "trivia", ")" ]
train
https://github.com/Microsoft/tolerant-php-parser/blob/c74eb57ee5e534e4df5a87e4d131bbd95a8d9eb1/src/Node.php#L367-L374
Microsoft/tolerant-php-parser
src/Node.php
Node.getLeadingCommentAndWhitespaceText
public function getLeadingCommentAndWhitespaceText() : string { // TODO re-tokenize comments and whitespace $fileContents = $this->getFileContents(); foreach ($this->getDescendantTokens() as $token) { return $token->getLeadingCommentsAndWhitespaceText($fileContents); } }
php
public function getLeadingCommentAndWhitespaceText() : string { // TODO re-tokenize comments and whitespace $fileContents = $this->getFileContents(); foreach ($this->getDescendantTokens() as $token) { return $token->getLeadingCommentsAndWhitespaceText($fileContents); } }
[ "public", "function", "getLeadingCommentAndWhitespaceText", "(", ")", ":", "string", "{", "// TODO re-tokenize comments and whitespace", "$", "fileContents", "=", "$", "this", "->", "getFileContents", "(", ")", ";", "foreach", "(", "$", "this", "->", "getDescendantTok...
Gets string representing Node's leading comment and whitespace text. @return string
[ "Gets", "string", "representing", "Node", "s", "leading", "comment", "and", "whitespace", "text", "." ]
train
https://github.com/Microsoft/tolerant-php-parser/blob/c74eb57ee5e534e4df5a87e4d131bbd95a8d9eb1/src/Node.php#L380-L386
Microsoft/tolerant-php-parser
src/Node.php
Node.getEndPosition
public function getEndPosition() { // TODO test invariant - start of next node is end of previous node for ($i = \count($childKeys = $this::CHILD_NAMES) - 1; $i >= 0; $i--) { $lastChildKey = $childKeys[$i]; $lastChild = $this->$lastChildKey; if (\is_array($lastChild)...
php
public function getEndPosition() { // TODO test invariant - start of next node is end of previous node for ($i = \count($childKeys = $this::CHILD_NAMES) - 1; $i >= 0; $i--) { $lastChildKey = $childKeys[$i]; $lastChild = $this->$lastChildKey; if (\is_array($lastChild)...
[ "public", "function", "getEndPosition", "(", ")", "{", "// TODO test invariant - start of next node is end of previous node", "for", "(", "$", "i", "=", "\\", "count", "(", "$", "childKeys", "=", "$", "this", "::", "CHILD_NAMES", ")", "-", "1", ";", "$", "i", ...
Get the end index of a Node. @return int @throws \Exception
[ "Get", "the", "end", "index", "of", "a", "Node", "." ]
train
https://github.com/Microsoft/tolerant-php-parser/blob/c74eb57ee5e534e4df5a87e4d131bbd95a8d9eb1/src/Node.php#L406-L424
Microsoft/tolerant-php-parser
src/Node.php
Node.getDescendantNodeAtPosition
public function getDescendantNodeAtPosition(int $pos) { foreach ($this->getChildNodes() as $child) { if ($child->containsPosition($pos)) { $node = $child->getDescendantNodeAtPosition($pos); if (!is_null($node)) { return $node; } ...
php
public function getDescendantNodeAtPosition(int $pos) { foreach ($this->getChildNodes() as $child) { if ($child->containsPosition($pos)) { $node = $child->getDescendantNodeAtPosition($pos); if (!is_null($node)) { return $node; } ...
[ "public", "function", "getDescendantNodeAtPosition", "(", "int", "$", "pos", ")", "{", "foreach", "(", "$", "this", "->", "getChildNodes", "(", ")", "as", "$", "child", ")", "{", "if", "(", "$", "child", "->", "containsPosition", "(", "$", "pos", ")", ...
Searches descendants to find a Node at the given position. @param int $pos @return Node
[ "Searches", "descendants", "to", "find", "a", "Node", "at", "the", "given", "position", "." ]
train
https://github.com/Microsoft/tolerant-php-parser/blob/c74eb57ee5e534e4df5a87e4d131bbd95a8d9eb1/src/Node.php#L446-L457
Microsoft/tolerant-php-parser
src/Node.php
Node.containsPosition
private function containsPosition(int $pos): bool { return $this->getStart() <= $pos && $pos <= $this->getEndPosition(); }
php
private function containsPosition(int $pos): bool { return $this->getStart() <= $pos && $pos <= $this->getEndPosition(); }
[ "private", "function", "containsPosition", "(", "int", "$", "pos", ")", ":", "bool", "{", "return", "$", "this", "->", "getStart", "(", ")", "<=", "$", "pos", "&&", "$", "pos", "<=", "$", "this", "->", "getEndPosition", "(", ")", ";", "}" ]
Returns true if the given Node or Token contains the given position. @param int $pos @return bool
[ "Returns", "true", "if", "the", "given", "Node", "or", "Token", "contains", "the", "given", "position", "." ]
train
https://github.com/Microsoft/tolerant-php-parser/blob/c74eb57ee5e534e4df5a87e4d131bbd95a8d9eb1/src/Node.php#L464-L466
Microsoft/tolerant-php-parser
src/Node.php
Node.getDocCommentText
public function getDocCommentText() { $leadingTriviaText = $this->getLeadingCommentAndWhitespaceText(); $leadingTriviaTokens = PhpTokenizer::getTokensArrayFromContent( $leadingTriviaText, ParseContext::SourceElements, $this->getFullStart(), false ); for ($i = \count($leadingT...
php
public function getDocCommentText() { $leadingTriviaText = $this->getLeadingCommentAndWhitespaceText(); $leadingTriviaTokens = PhpTokenizer::getTokensArrayFromContent( $leadingTriviaText, ParseContext::SourceElements, $this->getFullStart(), false ); for ($i = \count($leadingT...
[ "public", "function", "getDocCommentText", "(", ")", "{", "$", "leadingTriviaText", "=", "$", "this", "->", "getLeadingCommentAndWhitespaceText", "(", ")", ";", "$", "leadingTriviaTokens", "=", "PhpTokenizer", "::", "getTokensArrayFromContent", "(", "$", "leadingTrivi...
Gets leading PHP Doc Comment text corresponding to the current Node. Returns last doc comment in leading comment / whitespace trivia, and returns null if there is no preceding doc comment. @return string|null
[ "Gets", "leading", "PHP", "Doc", "Comment", "text", "corresponding", "to", "the", "current", "Node", ".", "Returns", "last", "doc", "comment", "in", "leading", "comment", "/", "whitespace", "trivia", "and", "returns", "null", "if", "there", "is", "no", "prec...
train
https://github.com/Microsoft/tolerant-php-parser/blob/c74eb57ee5e534e4df5a87e4d131bbd95a8d9eb1/src/Node.php#L475-L487
Microsoft/tolerant-php-parser
src/Node.php
Node.getNamespaceDefinition
public function getNamespaceDefinition() { $namespaceDefinition = $this instanceof NamespaceDefinition ? $this : $this->getFirstAncestor(NamespaceDefinition::class, SourceFileNode::class); if ($namespaceDefinition instanceof NamespaceDefinition && !($namespaceDefinition->parent ...
php
public function getNamespaceDefinition() { $namespaceDefinition = $this instanceof NamespaceDefinition ? $this : $this->getFirstAncestor(NamespaceDefinition::class, SourceFileNode::class); if ($namespaceDefinition instanceof NamespaceDefinition && !($namespaceDefinition->parent ...
[ "public", "function", "getNamespaceDefinition", "(", ")", "{", "$", "namespaceDefinition", "=", "$", "this", "instanceof", "NamespaceDefinition", "?", "$", "this", ":", "$", "this", "->", "getFirstAncestor", "(", "NamespaceDefinition", "::", "class", ",", "SourceF...
Gets corresponding NamespaceDefinition for Node. Returns null if in global namespace. @return NamespaceDefinition|null
[ "Gets", "corresponding", "NamespaceDefinition", "for", "Node", ".", "Returns", "null", "if", "in", "global", "namespace", "." ]
train
https://github.com/Microsoft/tolerant-php-parser/blob/c74eb57ee5e534e4df5a87e4d131bbd95a8d9eb1/src/Node.php#L597-L628
Microsoft/tolerant-php-parser
src/Node.php
Node.addToImportTable
private function addToImportTable($alias, $functionOrConst, $namespaceNameParts, $contents, & $namespaceImportTable, & $functionImportTable, & $constImportTable):array { if ($alias !== null) { if ($functionOrConst === null) { // namespaces are case-insensitive // $...
php
private function addToImportTable($alias, $functionOrConst, $namespaceNameParts, $contents, & $namespaceImportTable, & $functionImportTable, & $constImportTable):array { if ($alias !== null) { if ($functionOrConst === null) { // namespaces are case-insensitive // $...
[ "private", "function", "addToImportTable", "(", "$", "alias", ",", "$", "functionOrConst", ",", "$", "namespaceNameParts", ",", "$", "contents", ",", "&", "$", "namespaceImportTable", ",", "&", "$", "functionImportTable", ",", "&", "$", "constImportTable", ")", ...
Add the alias and resolved name to the corresponding namespace, function, or const import table. If the alias already exists, it will get replaced by the most recent using. TODO - worth throwing an error here in stead?
[ "Add", "the", "alias", "and", "resolved", "name", "to", "the", "corresponding", "namespace", "function", "or", "const", "import", "table", ".", "If", "the", "alias", "already", "exists", "it", "will", "get", "replaced", "by", "the", "most", "recent", "using"...
train
https://github.com/Microsoft/tolerant-php-parser/blob/c74eb57ee5e534e4df5a87e4d131bbd95a8d9eb1/src/Node.php#L666-L687
Microsoft/tolerant-php-parser
src/Node/QualifiedName.php
QualifiedName.getResolvedName
public function getResolvedName($namespaceDefinition = null) { // Name resolution not applicable to constructs that define symbol names or aliases. if (($this->parent instanceof Node\Statement\NamespaceDefinition && $this->parent->name->getStart() === $this->getStart()) || $this->parent inst...
php
public function getResolvedName($namespaceDefinition = null) { // Name resolution not applicable to constructs that define symbol names or aliases. if (($this->parent instanceof Node\Statement\NamespaceDefinition && $this->parent->name->getStart() === $this->getStart()) || $this->parent inst...
[ "public", "function", "getResolvedName", "(", "$", "namespaceDefinition", "=", "null", ")", "{", "// Name resolution not applicable to constructs that define symbol names or aliases.", "if", "(", "(", "$", "this", "->", "parent", "instanceof", "Node", "\\", "Statement", "...
Gets resolved name based on name resolution rules defined in: http://php.net/manual/en/language.namespaces.rules.php Returns null if one of the following conditions is met: - name resolution is not valid for this element (e.g. part of the name in a namespace definition) - name cannot be resolved (unqualified namespace...
[ "Gets", "resolved", "name", "based", "on", "name", "resolution", "rules", "defined", "in", ":", "http", ":", "//", "php", ".", "net", "/", "manual", "/", "en", "/", "language", ".", "namespaces", ".", "rules", ".", "php" ]
train
https://github.com/Microsoft/tolerant-php-parser/blob/c74eb57ee5e534e4df5a87e4d131bbd95a8d9eb1/src/Node/QualifiedName.php#L81-L144
Microsoft/tolerant-php-parser
src/DiagnosticsProvider.php
DiagnosticsProvider.initTokenKindToText
public static function initTokenKindToText() { self::$tokenKindToText = \array_flip(\array_merge( TokenStringMaps::OPERATORS_AND_PUNCTUATORS, TokenStringMaps::KEYWORDS, TokenStringMaps::RESERVED_WORDS )); }
php
public static function initTokenKindToText() { self::$tokenKindToText = \array_flip(\array_merge( TokenStringMaps::OPERATORS_AND_PUNCTUATORS, TokenStringMaps::KEYWORDS, TokenStringMaps::RESERVED_WORDS )); }
[ "public", "static", "function", "initTokenKindToText", "(", ")", "{", "self", "::", "$", "tokenKindToText", "=", "\\", "array_flip", "(", "\\", "array_merge", "(", "TokenStringMaps", "::", "OPERATORS_AND_PUNCTUATORS", ",", "TokenStringMaps", "::", "KEYWORDS", ",", ...
This is called when this class is loaded, at the bottom of this file. @return void
[ "This", "is", "called", "when", "this", "class", "is", "loaded", "at", "the", "bottom", "of", "this", "file", "." ]
train
https://github.com/Microsoft/tolerant-php-parser/blob/c74eb57ee5e534e4df5a87e4d131bbd95a8d9eb1/src/DiagnosticsProvider.php#L30-L36
Microsoft/tolerant-php-parser
src/DiagnosticsProvider.php
DiagnosticsProvider.checkDiagnostics
public static function checkDiagnostics($node) { if ($node instanceof Token) { if (\get_class($node) === Token::class) { return null; } return self::checkDiagnosticForUnexpectedToken($node); } if ($node instanceof Node) { return $n...
php
public static function checkDiagnostics($node) { if ($node instanceof Token) { if (\get_class($node) === Token::class) { return null; } return self::checkDiagnosticForUnexpectedToken($node); } if ($node instanceof Node) { return $n...
[ "public", "static", "function", "checkDiagnostics", "(", "$", "node", ")", "{", "if", "(", "$", "node", "instanceof", "Token", ")", "{", "if", "(", "\\", "get_class", "(", "$", "node", ")", "===", "Token", "::", "class", ")", "{", "return", "null", "...
Returns the diagnostic for $node, or null. @param \Microsoft\PhpParser\Node|\Microsoft\PhpParser\Token $node @return Diagnostic|null
[ "Returns", "the", "diagnostic", "for", "$node", "or", "null", "." ]
train
https://github.com/Microsoft/tolerant-php-parser/blob/c74eb57ee5e534e4df5a87e4d131bbd95a8d9eb1/src/DiagnosticsProvider.php#L43-L55
Microsoft/tolerant-php-parser
src/DiagnosticsProvider.php
DiagnosticsProvider.getDiagnostics
public static function getDiagnostics(Node $n) : array { $diagnostics = []; /** * @param \Microsoft\PhpParser\Node|\Microsoft\PhpParser\Token $node */ $n->walkDescendantNodesAndTokens(function($node) use (&$diagnostics) { if (($diagnostic = self::checkDiagnostics($...
php
public static function getDiagnostics(Node $n) : array { $diagnostics = []; /** * @param \Microsoft\PhpParser\Node|\Microsoft\PhpParser\Token $node */ $n->walkDescendantNodesAndTokens(function($node) use (&$diagnostics) { if (($diagnostic = self::checkDiagnostics($...
[ "public", "static", "function", "getDiagnostics", "(", "Node", "$", "n", ")", ":", "array", "{", "$", "diagnostics", "=", "[", "]", ";", "/**\n * @param \\Microsoft\\PhpParser\\Node|\\Microsoft\\PhpParser\\Token $node\n */", "$", "n", "->", "walkDescendant...
Traverses AST to generate diagnostics. @param \Microsoft\PhpParser\Node $n @return Diagnostic[]
[ "Traverses", "AST", "to", "generate", "diagnostics", "." ]
train
https://github.com/Microsoft/tolerant-php-parser/blob/c74eb57ee5e534e4df5a87e4d131bbd95a8d9eb1/src/DiagnosticsProvider.php#L93-L106
Microsoft/tolerant-php-parser
src/Parser.php
Parser.parseSourceFile
public function parseSourceFile(string $fileContents, string $uri = null) : SourceFileNode { $this->lexer = TokenStreamProviderFactory::GetTokenStreamProvider($fileContents); $this->reset(); $sourceFile = new SourceFileNode(); $this->sourceFile = $sourceFile; $sourceFile->fileC...
php
public function parseSourceFile(string $fileContents, string $uri = null) : SourceFileNode { $this->lexer = TokenStreamProviderFactory::GetTokenStreamProvider($fileContents); $this->reset(); $sourceFile = new SourceFileNode(); $this->sourceFile = $sourceFile; $sourceFile->fileC...
[ "public", "function", "parseSourceFile", "(", "string", "$", "fileContents", ",", "string", "$", "uri", "=", "null", ")", ":", "SourceFileNode", "{", "$", "this", "->", "lexer", "=", "TokenStreamProviderFactory", "::", "GetTokenStreamProvider", "(", "$", "fileCo...
Generates AST from source file contents. Returns an instance of SourceFileNode, which is always the top-most Node-type of the tree. @param string $fileContents @return SourceFileNode
[ "Generates", "AST", "from", "source", "file", "contents", ".", "Returns", "an", "instance", "of", "SourceFileNode", "which", "is", "always", "the", "top", "-", "most", "Node", "-", "type", "of", "the", "tree", "." ]
train
https://github.com/Microsoft/tolerant-php-parser/blob/c74eb57ee5e534e4df5a87e4d131bbd95a8d9eb1/src/Parser.php#L144-L172
Microsoft/tolerant-php-parser
src/Parser.php
Parser.parseList
private function parseList($parentNode, int $listParseContext) { $savedParseContext = $this->currentParseContext; $this->currentParseContext |= 1 << $listParseContext; $parseListElementFn = $this->getParseListElementFn($listParseContext); $nodeArray = array(); while (!$this->isL...
php
private function parseList($parentNode, int $listParseContext) { $savedParseContext = $this->currentParseContext; $this->currentParseContext |= 1 << $listParseContext; $parseListElementFn = $this->getParseListElementFn($listParseContext); $nodeArray = array(); while (!$this->isL...
[ "private", "function", "parseList", "(", "$", "parentNode", ",", "int", "$", "listParseContext", ")", "{", "$", "savedParseContext", "=", "$", "this", "->", "currentParseContext", ";", "$", "this", "->", "currentParseContext", "|=", "1", "<<", "$", "listParseC...
Parse a list of elements for a given ParseContext until a list terminator associated with that ParseContext is reached. Additionally abort parsing when an element is reached that is invalid in the current context, but valid in an enclosing context. If an element is invalid in both current and enclosing contexts, genera...
[ "Parse", "a", "list", "of", "elements", "for", "a", "given", "ParseContext", "until", "a", "list", "terminator", "associated", "with", "that", "ParseContext", "is", "reached", ".", "Additionally", "abort", "parsing", "when", "an", "element", "is", "reached", "...
train
https://github.com/Microsoft/tolerant-php-parser/blob/c74eb57ee5e534e4df5a87e4d131bbd95a8d9eb1/src/Parser.php#L190-L251
Microsoft/tolerant-php-parser
src/Parser.php
Parser.isCurrentTokenValidInEnclosingContexts
private function isCurrentTokenValidInEnclosingContexts() { for ($contextKind = 0; $contextKind < ParseContext::Count; $contextKind++) { if ($this->isInParseContext($contextKind)) { if ($this->isValidListElement($contextKind, $this->getCurrentToken()) || $this->isListTerminator($cont...
php
private function isCurrentTokenValidInEnclosingContexts() { for ($contextKind = 0; $contextKind < ParseContext::Count; $contextKind++) { if ($this->isInParseContext($contextKind)) { if ($this->isValidListElement($contextKind, $this->getCurrentToken()) || $this->isListTerminator($cont...
[ "private", "function", "isCurrentTokenValidInEnclosingContexts", "(", ")", "{", "for", "(", "$", "contextKind", "=", "0", ";", "$", "contextKind", "<", "ParseContext", "::", "Count", ";", "$", "contextKind", "++", ")", "{", "if", "(", "$", "this", "->", "i...
Aborts parsing list when one of the parent contexts understands something @return bool
[ "Aborts", "parsing", "list", "when", "one", "of", "the", "parent", "contexts", "understands", "something" ]
train
https://github.com/Microsoft/tolerant-php-parser/blob/c74eb57ee5e534e4df5a87e4d131bbd95a8d9eb1/src/Parser.php#L361-L370
Microsoft/tolerant-php-parser
src/Parser.php
Parser.eat
private function eat(...$kinds) { $token = $this->token; if (\is_array($kinds[0])) { $kinds = $kinds[0]; } foreach ($kinds as $kind) { if ($token->kind === $kind) { $this->token = $this->lexer->scanNextToken(); return $token; ...
php
private function eat(...$kinds) { $token = $this->token; if (\is_array($kinds[0])) { $kinds = $kinds[0]; } foreach ($kinds as $kind) { if ($token->kind === $kind) { $this->token = $this->lexer->scanNextToken(); return $token; ...
[ "private", "function", "eat", "(", "...", "$", "kinds", ")", "{", "$", "token", "=", "$", "this", "->", "token", ";", "if", "(", "\\", "is_array", "(", "$", "kinds", "[", "0", "]", ")", ")", "{", "$", "kinds", "=", "$", "kinds", "[", "0", "]"...
Retrieve the current token, and check that it's of the expected TokenKind. If so, advance and return the token. Otherwise return a MissingToken for the expected token. @param int|int[] ...$kinds @return Token
[ "Retrieve", "the", "current", "token", "and", "check", "that", "it", "s", "of", "the", "expected", "TokenKind", ".", "If", "so", "advance", "and", "return", "the", "token", ".", "Otherwise", "return", "a", "MissingToken", "for", "the", "expected", "token", ...
train
https://github.com/Microsoft/tolerant-php-parser/blob/c74eb57ee5e534e4df5a87e4d131bbd95a8d9eb1/src/Parser.php#L383-L396
Microsoft/tolerant-php-parser
src/Parser.php
Parser.eat1
private function eat1($kind) { $token = $this->token; if ($token->kind === $kind) { $this->token = $this->lexer->scanNextToken(); return $token; } // TODO include optional grouping for token kinds return new MissingToken($kind, $token->fullStart); }
php
private function eat1($kind) { $token = $this->token; if ($token->kind === $kind) { $this->token = $this->lexer->scanNextToken(); return $token; } // TODO include optional grouping for token kinds return new MissingToken($kind, $token->fullStart); }
[ "private", "function", "eat1", "(", "$", "kind", ")", "{", "$", "token", "=", "$", "this", "->", "token", ";", "if", "(", "$", "token", "->", "kind", "===", "$", "kind", ")", "{", "$", "this", "->", "token", "=", "$", "this", "->", "lexer", "->...
Retrieve the current token, and check that it's of the kind $kind. If so, advance and return the token. Otherwise return a MissingToken for the expected token. This is faster than calling eat() if there is a single token. @param int $kind @return Token
[ "Retrieve", "the", "current", "token", "and", "check", "that", "it", "s", "of", "the", "kind", "$kind", ".", "If", "so", "advance", "and", "return", "the", "token", ".", "Otherwise", "return", "a", "MissingToken", "for", "the", "expected", "token", "." ]
train
https://github.com/Microsoft/tolerant-php-parser/blob/c74eb57ee5e534e4df5a87e4d131bbd95a8d9eb1/src/Parser.php#L408-L416
Microsoft/tolerant-php-parser
src/Parser.php
Parser.parseComplexDollarTemplateStringExpression
private function parseComplexDollarTemplateStringExpression($parentNode) { $var = $this->parseSimpleVariable($parentNode); $token = $this->getCurrentToken(); if ($token->kind === TokenKind::OpenBracketToken) { return $this->parseTemplateStringSubscriptExpression($var); } ...
php
private function parseComplexDollarTemplateStringExpression($parentNode) { $var = $this->parseSimpleVariable($parentNode); $token = $this->getCurrentToken(); if ($token->kind === TokenKind::OpenBracketToken) { return $this->parseTemplateStringSubscriptExpression($var); } ...
[ "private", "function", "parseComplexDollarTemplateStringExpression", "(", "$", "parentNode", ")", "{", "$", "var", "=", "$", "this", "->", "parseSimpleVariable", "(", "$", "parentNode", ")", ";", "$", "token", "=", "$", "this", "->", "getCurrentToken", "(", ")...
This is used to parse the contents of `"${...}"` expressions. Supported: x, x[0], x[$y] Not supported: $x->p1, x[0][1], etc. @see parseTemplateStringExpression Precondition: getCurrentToken()->kind === TokenKind::StringVarname
[ "This", "is", "used", "to", "parse", "the", "contents", "of", "$", "{", "...", "}", "expressions", "." ]
train
https://github.com/Microsoft/tolerant-php-parser/blob/c74eb57ee5e534e4df5a87e4d131bbd95a8d9eb1/src/Parser.php#L1067-L1074
Microsoft/tolerant-php-parser
src/Parser.php
Parser.parseTemplateStringExpression
private function parseTemplateStringExpression($parentNode) { $token = $this->getCurrentToken(); if ($token->kind === TokenKind::VariableName) { $var = $this->parseSimpleVariable($parentNode); $token = $this->getCurrentToken(); if ($token->kind === TokenKind::OpenBrac...
php
private function parseTemplateStringExpression($parentNode) { $token = $this->getCurrentToken(); if ($token->kind === TokenKind::VariableName) { $var = $this->parseSimpleVariable($parentNode); $token = $this->getCurrentToken(); if ($token->kind === TokenKind::OpenBrac...
[ "private", "function", "parseTemplateStringExpression", "(", "$", "parentNode", ")", "{", "$", "token", "=", "$", "this", "->", "getCurrentToken", "(", ")", ";", "if", "(", "$", "token", "->", "kind", "===", "TokenKind", "::", "VariableName", ")", "{", "$"...
Double-quoted and heredoc strings support a basic set of expression types, described in http://php.net/manual/en/language.types.string.php#language.types.string.parsing Supported: $x, $x->p, $x[0], $x[$y] Not supported: $x->p1->p2, $x[0][1], etc. Since there is a relatively small finite set of allowed forms, I implemen...
[ "Double", "-", "quoted", "and", "heredoc", "strings", "support", "a", "basic", "set", "of", "expression", "types", "described", "in", "http", ":", "//", "php", ".", "net", "/", "manual", "/", "en", "/", "language", ".", "types", ".", "string", ".", "ph...
train
https://github.com/Microsoft/tolerant-php-parser/blob/c74eb57ee5e534e4df5a87e4d131bbd95a8d9eb1/src/Parser.php#L1082-L1097
Microsoft/tolerant-php-parser
src/NamespacedNameTrait.php
NamespacedNameTrait.getNamespacedName
public function getNamespacedName() : ResolvedName { $namespaceDefinition = $this->getNamespaceDefinition(); $content = $this->getFileContents(); if ($namespaceDefinition === null) { // global namespace -> strip namespace\ prefix return ResolvedName::buildName($this->getN...
php
public function getNamespacedName() : ResolvedName { $namespaceDefinition = $this->getNamespaceDefinition(); $content = $this->getFileContents(); if ($namespaceDefinition === null) { // global namespace -> strip namespace\ prefix return ResolvedName::buildName($this->getN...
[ "public", "function", "getNamespacedName", "(", ")", ":", "ResolvedName", "{", "$", "namespaceDefinition", "=", "$", "this", "->", "getNamespaceDefinition", "(", ")", ";", "$", "content", "=", "$", "this", "->", "getFileContents", "(", ")", ";", "if", "(", ...
Gets resolved name from current namespace. Note that this is not necessarily the *actual* name that is resolved during compilation or at runtime. For that, see QualifiedName::getResolvedName(). @return ResolvedName
[ "Gets", "resolved", "name", "from", "current", "namespace", ".", "Note", "that", "this", "is", "not", "necessarily", "the", "*", "actual", "*", "name", "that", "is", "resolved", "during", "compilation", "or", "at", "runtime", ".", "For", "that", "see", "Qu...
train
https://github.com/Microsoft/tolerant-php-parser/blob/c74eb57ee5e534e4df5a87e4d131bbd95a8d9eb1/src/NamespacedNameTrait.php#L26-L49
Microsoft/tolerant-php-parser
src/PhpTokenizer.php
PhpTokenizer.getTokensArrayFromContent
public static function getTokensArrayFromContent( $content, $parseContext = null, $initialPos = 0, $treatCommentsAsTrivia = true ) : array { if ($parseContext !== null) { // If needed, add a prefix so that token_get_all will tokenize the remaining $contents $prefix = self::PA...
php
public static function getTokensArrayFromContent( $content, $parseContext = null, $initialPos = 0, $treatCommentsAsTrivia = true ) : array { if ($parseContext !== null) { // If needed, add a prefix so that token_get_all will tokenize the remaining $contents $prefix = self::PA...
[ "public", "static", "function", "getTokensArrayFromContent", "(", "$", "content", ",", "$", "parseContext", "=", "null", ",", "$", "initialPos", "=", "0", ",", "$", "treatCommentsAsTrivia", "=", "true", ")", ":", "array", "{", "if", "(", "$", "parseContext",...
Return an array of Token object instances created from $content. This method is optimized heavily - this processes every single token being created. @param string $content the raw php code @param ?int $parseContext can be SourceElements when extracting doc comments @param int $initialPos @param bool $treatCommentsAsT...
[ "Return", "an", "array", "of", "Token", "object", "instances", "created", "from", "$content", "." ]
train
https://github.com/Microsoft/tolerant-php-parser/blob/c74eb57ee5e534e4df5a87e4d131bbd95a8d9eb1/src/PhpTokenizer.php#L67-L147
Microsoft/tolerant-php-parser
src/PositionUtilities.php
PositionUtilities.getRangeFromPosition
public static function getRangeFromPosition(int $pos, int $length, string $text): Range { $start = self::getLineCharacterPositionFromPosition($pos, $text); $end = self::getLineCharacterPositionFromPosition($pos + $length, $text); return new Range($start, $end); }
php
public static function getRangeFromPosition(int $pos, int $length, string $text): Range { $start = self::getLineCharacterPositionFromPosition($pos, $text); $end = self::getLineCharacterPositionFromPosition($pos + $length, $text); return new Range($start, $end); }
[ "public", "static", "function", "getRangeFromPosition", "(", "int", "$", "pos", ",", "int", "$", "length", ",", "string", "$", "text", ")", ":", "Range", "{", "$", "start", "=", "self", "::", "getLineCharacterPositionFromPosition", "(", "$", "pos", ",", "$...
Gets a Range from 0-indexed position into $text. Out of bounds positions are handled gracefully. Positions greater than the length of text length are resolved to the end of the text, and negative positions are resolved to the beginning.
[ "Gets", "a", "Range", "from", "0", "-", "indexed", "position", "into", "$text", "." ]
train
https://github.com/Microsoft/tolerant-php-parser/blob/c74eb57ee5e534e4df5a87e4d131bbd95a8d9eb1/src/PositionUtilities.php#L16-L21
Microsoft/tolerant-php-parser
src/PositionUtilities.php
PositionUtilities.getLineCharacterPositionFromPosition
public static function getLineCharacterPositionFromPosition(int $pos, string $text) : LineCharacterPosition { $textLength = \strlen($text); if ($pos >= $textLength) { $pos = $textLength; } elseif ($pos < 0) { $pos = 0; } // Start strrpos check from the ch...
php
public static function getLineCharacterPositionFromPosition(int $pos, string $text) : LineCharacterPosition { $textLength = \strlen($text); if ($pos >= $textLength) { $pos = $textLength; } elseif ($pos < 0) { $pos = 0; } // Start strrpos check from the ch...
[ "public", "static", "function", "getLineCharacterPositionFromPosition", "(", "int", "$", "pos", ",", "string", "$", "text", ")", ":", "LineCharacterPosition", "{", "$", "textLength", "=", "\\", "strlen", "(", "$", "text", ")", ";", "if", "(", "$", "pos", "...
Gets 0-indexed LineCharacterPosition from 0-indexed position into $text. Out of bounds positions are handled gracefully. Positions greater than the length of text length are resolved to text length, and negative positions are resolved to 0. TODO consider throwing exception instead.
[ "Gets", "0", "-", "indexed", "LineCharacterPosition", "from", "0", "-", "indexed", "position", "into", "$text", "." ]
train
https://github.com/Microsoft/tolerant-php-parser/blob/c74eb57ee5e534e4df5a87e4d131bbd95a8d9eb1/src/PositionUtilities.php#L30-L45
beyondcode/laravel-self-diagnosis
src/Checks/CorrectPhpVersionIsInstalled.php
CorrectPhpVersionIsInstalled.check
public function check(array $config): bool { // we dont use the phpversion function because that adds more data to the number (Like: -1+ubuntu16.04) // that conflicts with the semver check return Semver::satisfies( PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION . '.' . PHP_RELEASE_V...
php
public function check(array $config): bool { // we dont use the phpversion function because that adds more data to the number (Like: -1+ubuntu16.04) // that conflicts with the semver check return Semver::satisfies( PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION . '.' . PHP_RELEASE_V...
[ "public", "function", "check", "(", "array", "$", "config", ")", ":", "bool", "{", "// we dont use the phpversion function because that adds more data to the number (Like: -1+ubuntu16.04)", "// that conflicts with the semver check", "return", "Semver", "::", "satisfies", "(", "PH...
Perform the actual verification of this check. @param array $config @throws \Illuminate\Contracts\Filesystem\FileNotFoundException @return bool
[ "Perform", "the", "actual", "verification", "of", "this", "check", "." ]
train
https://github.com/beyondcode/laravel-self-diagnosis/blob/0d9a06d774a8cc20806879a2e831075b17d8f0ac/src/Checks/CorrectPhpVersionIsInstalled.php#L37-L45
beyondcode/laravel-self-diagnosis
src/Checks/RedisCanBeAccessed.php
RedisCanBeAccessed.check
public function check(array $config): bool { try { if (Arr::get($config, 'default_connection', true)) { if (!$this->testConnection()) { $this->message = trans('self-diagnosis::checks.redis_can_be_accessed.message.default_cache'); return fal...
php
public function check(array $config): bool { try { if (Arr::get($config, 'default_connection', true)) { if (!$this->testConnection()) { $this->message = trans('self-diagnosis::checks.redis_can_be_accessed.message.default_cache'); return fal...
[ "public", "function", "check", "(", "array", "$", "config", ")", ":", "bool", "{", "try", "{", "if", "(", "Arr", "::", "get", "(", "$", "config", ",", "'default_connection'", ",", "true", ")", ")", "{", "if", "(", "!", "$", "this", "->", "testConne...
Perform the actual verification of this check. @param array $config @return bool
[ "Perform", "the", "actual", "verification", "of", "this", "check", "." ]
train
https://github.com/beyondcode/laravel-self-diagnosis/blob/0d9a06d774a8cc20806879a2e831075b17d8f0ac/src/Checks/RedisCanBeAccessed.php#L29-L53
beyondcode/laravel-self-diagnosis
src/Checks/DatabaseCanBeAccessed.php
DatabaseCanBeAccessed.check
public function check(array $config): bool { try { if (Arr::get($config, 'default_connection', true)) { DB::connection()->getPdo(); } foreach (Arr::get($config, 'connections', []) as $connection) { DB::connection($connection)->getPdo(); ...
php
public function check(array $config): bool { try { if (Arr::get($config, 'default_connection', true)) { DB::connection()->getPdo(); } foreach (Arr::get($config, 'connections', []) as $connection) { DB::connection($connection)->getPdo(); ...
[ "public", "function", "check", "(", "array", "$", "config", ")", ":", "bool", "{", "try", "{", "if", "(", "Arr", "::", "get", "(", "$", "config", ",", "'default_connection'", ",", "true", ")", ")", "{", "DB", "::", "connection", "(", ")", "->", "ge...
Perform the actual verification of this check. @param array $config @return bool
[ "Perform", "the", "actual", "verification", "of", "this", "check", "." ]
train
https://github.com/beyondcode/laravel-self-diagnosis/blob/0d9a06d774a8cc20806879a2e831075b17d8f0ac/src/Checks/DatabaseCanBeAccessed.php#L29-L45
beyondcode/laravel-self-diagnosis
src/Checks/MigrationsAreUpToDate.php
MigrationsAreUpToDate.check
public function check(array $config): bool { try { Artisan::call('migrate', ['--pretend' => 'true', '--force' => 'true']); $output = Artisan::output(); return strstr($output, 'Nothing to migrate.'); } catch (\PDOException $e) { $this->databaseError = $...
php
public function check(array $config): bool { try { Artisan::call('migrate', ['--pretend' => 'true', '--force' => 'true']); $output = Artisan::output(); return strstr($output, 'Nothing to migrate.'); } catch (\PDOException $e) { $this->databaseError = $...
[ "public", "function", "check", "(", "array", "$", "config", ")", ":", "bool", "{", "try", "{", "Artisan", "::", "call", "(", "'migrate'", ",", "[", "'--pretend'", "=>", "'true'", ",", "'--force'", "=>", "'true'", "]", ")", ";", "$", "output", "=", "A...
Perform the actual verification of this check. @param array $config @return bool
[ "Perform", "the", "actual", "verification", "of", "this", "check", "." ]
train
https://github.com/beyondcode/laravel-self-diagnosis/blob/0d9a06d774a8cc20806879a2e831075b17d8f0ac/src/Checks/MigrationsAreUpToDate.php#L28-L38
beyondcode/laravel-self-diagnosis
src/Checks/MigrationsAreUpToDate.php
MigrationsAreUpToDate.message
public function message(array $config): string { if ($this->databaseError !== null) { return trans('self-diagnosis::checks.migrations_are_up_to_date.message.unable_to_check', [ 'reason' => $this->databaseError, ]); } return trans('self-diagnosis::check...
php
public function message(array $config): string { if ($this->databaseError !== null) { return trans('self-diagnosis::checks.migrations_are_up_to_date.message.unable_to_check', [ 'reason' => $this->databaseError, ]); } return trans('self-diagnosis::check...
[ "public", "function", "message", "(", "array", "$", "config", ")", ":", "string", "{", "if", "(", "$", "this", "->", "databaseError", "!==", "null", ")", "{", "return", "trans", "(", "'self-diagnosis::checks.migrations_are_up_to_date.message.unable_to_check'", ",", ...
The error message to display in case the check does not pass. @param array $config @return string
[ "The", "error", "message", "to", "display", "in", "case", "the", "check", "does", "not", "pass", "." ]
train
https://github.com/beyondcode/laravel-self-diagnosis/blob/0d9a06d774a8cc20806879a2e831075b17d8f0ac/src/Checks/MigrationsAreUpToDate.php#L46-L54
beyondcode/laravel-self-diagnosis
src/Checks/PhpExtensionsAreInstalled.php
PhpExtensionsAreInstalled.check
public function check(array $config): bool { $this->extensions = Collection::make(Arr::get($config, 'extensions', [])); if (Arr::get($config, 'include_composer_extensions', false)) { $this->extensions = $this->extensions->merge($this->getExtensionsRequiredInComposerFile()); $...
php
public function check(array $config): bool { $this->extensions = Collection::make(Arr::get($config, 'extensions', [])); if (Arr::get($config, 'include_composer_extensions', false)) { $this->extensions = $this->extensions->merge($this->getExtensionsRequiredInComposerFile()); $...
[ "public", "function", "check", "(", "array", "$", "config", ")", ":", "bool", "{", "$", "this", "->", "extensions", "=", "Collection", "::", "make", "(", "Arr", "::", "get", "(", "$", "config", ",", "'extensions'", ",", "[", "]", ")", ")", ";", "if...
Perform the actual verification of this check. @param array $config @return bool
[ "Perform", "the", "actual", "verification", "of", "this", "check", "." ]
train
https://github.com/beyondcode/laravel-self-diagnosis/blob/0d9a06d774a8cc20806879a2e831075b17d8f0ac/src/Checks/PhpExtensionsAreInstalled.php#L55-L67
beyondcode/laravel-self-diagnosis
src/Checks/SupervisorProgramsAreRunning.php
SupervisorProgramsAreRunning.check
public function check(array $config): bool { $this->notRunningPrograms = new Collection(Arr::get($config, 'programs', [])); if ($this->notRunningPrograms->isEmpty()) { return true; } if (!$this->systemFunctions->isFunctionAvailable('shell_exec')) { $this->mes...
php
public function check(array $config): bool { $this->notRunningPrograms = new Collection(Arr::get($config, 'programs', [])); if ($this->notRunningPrograms->isEmpty()) { return true; } if (!$this->systemFunctions->isFunctionAvailable('shell_exec')) { $this->mes...
[ "public", "function", "check", "(", "array", "$", "config", ")", ":", "bool", "{", "$", "this", "->", "notRunningPrograms", "=", "new", "Collection", "(", "Arr", "::", "get", "(", "$", "config", ",", "'programs'", ",", "[", "]", ")", ")", ";", "if", ...
Perform the actual verification of this check. @param array $config @return bool
[ "Perform", "the", "actual", "verification", "of", "this", "check", "." ]
train
https://github.com/beyondcode/laravel-self-diagnosis/blob/0d9a06d774a8cc20806879a2e831075b17d8f0ac/src/Checks/SupervisorProgramsAreRunning.php#L50-L96
beyondcode/laravel-self-diagnosis
src/Checks/SupervisorProgramsAreRunning.php
SupervisorProgramsAreRunning.message
public function message(array $config): string { if ($this->message) { return $this->message; } return trans('self-diagnosis::checks.supervisor_programs_are_running.message.not_running_programs', [ 'programs' => $this->notRunningPrograms->implode(PHP_EOL), ])...
php
public function message(array $config): string { if ($this->message) { return $this->message; } return trans('self-diagnosis::checks.supervisor_programs_are_running.message.not_running_programs', [ 'programs' => $this->notRunningPrograms->implode(PHP_EOL), ])...
[ "public", "function", "message", "(", "array", "$", "config", ")", ":", "string", "{", "if", "(", "$", "this", "->", "message", ")", "{", "return", "$", "this", "->", "message", ";", "}", "return", "trans", "(", "'self-diagnosis::checks.supervisor_programs_a...
The error message to display in case the check does not pass. @param array $config @return string
[ "The", "error", "message", "to", "display", "in", "case", "the", "check", "does", "not", "pass", "." ]
train
https://github.com/beyondcode/laravel-self-diagnosis/blob/0d9a06d774a8cc20806879a2e831075b17d8f0ac/src/Checks/SupervisorProgramsAreRunning.php#L104-L113
beyondcode/laravel-self-diagnosis
src/Checks/ServersArePingable.php
ServersArePingable.check
public function check(array $config): bool { $this->notReachableServers = $this->parseConfiguredServers(Arr::get($config, 'servers', [])); if ($this->notReachableServers->isEmpty()) { return true; } $this->notReachableServers = $this->notReachableServers->reject(function...
php
public function check(array $config): bool { $this->notReachableServers = $this->parseConfiguredServers(Arr::get($config, 'servers', [])); if ($this->notReachableServers->isEmpty()) { return true; } $this->notReachableServers = $this->notReachableServers->reject(function...
[ "public", "function", "check", "(", "array", "$", "config", ")", ":", "bool", "{", "$", "this", "->", "notReachableServers", "=", "$", "this", "->", "parseConfiguredServers", "(", "Arr", "::", "get", "(", "$", "config", ",", "'servers'", ",", "[", "]", ...
Perform the actual verification of this check. @param array $config @return bool @throws InvalidConfigurationException
[ "Perform", "the", "actual", "verification", "of", "this", "check", "." ]
train
https://github.com/beyondcode/laravel-self-diagnosis/blob/0d9a06d774a8cc20806879a2e831075b17d8f0ac/src/Checks/ServersArePingable.php#L36-L58
beyondcode/laravel-self-diagnosis
src/Checks/ServersArePingable.php
ServersArePingable.message
public function message(array $config): string { return $this->notReachableServers->map(function (Server $server) { return trans('self-diagnosis::checks.servers_are_pingable.message', [ 'host' => $server->getHost(), 'port' => $server->getPort() ?? 'n/a', ...
php
public function message(array $config): string { return $this->notReachableServers->map(function (Server $server) { return trans('self-diagnosis::checks.servers_are_pingable.message', [ 'host' => $server->getHost(), 'port' => $server->getPort() ?? 'n/a', ...
[ "public", "function", "message", "(", "array", "$", "config", ")", ":", "string", "{", "return", "$", "this", "->", "notReachableServers", "->", "map", "(", "function", "(", "Server", "$", "server", ")", "{", "return", "trans", "(", "'self-diagnosis::checks....
The error message to display in case the check does not pass. @param array $config @return string
[ "The", "error", "message", "to", "display", "in", "case", "the", "check", "does", "not", "pass", "." ]
train
https://github.com/beyondcode/laravel-self-diagnosis/blob/0d9a06d774a8cc20806879a2e831075b17d8f0ac/src/Checks/ServersArePingable.php#L66-L75
beyondcode/laravel-self-diagnosis
src/Checks/ServersArePingable.php
ServersArePingable.parseConfiguredServers
private function parseConfiguredServers(array $servers): Collection { $result = new Collection(); foreach ($servers as $server) { if (is_array($server)) { if (!empty(array_except($server, ['host', 'port', 'timeout']))) { throw new InvalidConfiguration...
php
private function parseConfiguredServers(array $servers): Collection { $result = new Collection(); foreach ($servers as $server) { if (is_array($server)) { if (!empty(array_except($server, ['host', 'port', 'timeout']))) { throw new InvalidConfiguration...
[ "private", "function", "parseConfiguredServers", "(", "array", "$", "servers", ")", ":", "Collection", "{", "$", "result", "=", "new", "Collection", "(", ")", ";", "foreach", "(", "$", "servers", "as", "$", "server", ")", "{", "if", "(", "is_array", "(",...
Parses an array of servers which can be given in different formats. Unifies the format for the resulting collection. @param array $servers @return Collection @throws InvalidConfigurationException
[ "Parses", "an", "array", "of", "servers", "which", "can", "be", "given", "in", "different", "formats", ".", "Unifies", "the", "format", "for", "the", "resulting", "collection", "." ]
train
https://github.com/beyondcode/laravel-self-diagnosis/blob/0d9a06d774a8cc20806879a2e831075b17d8f0ac/src/Checks/ServersArePingable.php#L85-L111