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
sifophp/sifo-common-instance
controllers/error/common.php
ErrorCommonController.getErrorMetadata
public function getErrorMetadata() { try { $metadata = \Sifo\Config::getInstance()->getConfig( 'lang/metadata_' . $this->getParam( 'lang' ) ); } catch ( Exception_Configuration $e ) { $metadata = \Sifo\Config::getInstance()->getConfig( 'lang/metadata_en_US' ); } $error_code = $this->getParam( 'cod...
php
public function getErrorMetadata() { try { $metadata = \Sifo\Config::getInstance()->getConfig( 'lang/metadata_' . $this->getParam( 'lang' ) ); } catch ( Exception_Configuration $e ) { $metadata = \Sifo\Config::getInstance()->getConfig( 'lang/metadata_en_US' ); } $error_code = $this->getParam( 'cod...
[ "public", "function", "getErrorMetadata", "(", ")", "{", "try", "{", "$", "metadata", "=", "\\", "Sifo", "\\", "Config", "::", "getInstance", "(", ")", "->", "getConfig", "(", "'lang/metadata_'", ".", "$", "this", "->", "getParam", "(", "'lang'", ")", ")...
Assign selected error code metadata to page to allow error translations. @return array
[ "Assign", "selected", "error", "code", "metadata", "to", "page", "to", "allow", "error", "translations", "." ]
train
https://github.com/sifophp/sifo-common-instance/blob/52d54ea3e565bd2bccd77e0b0a6a99b5cae3aff5/controllers/error/common.php#L58-L72
Guzzle3/guzzle-silex-extension
GuzzleServiceProvider.php
GuzzleServiceProvider.register
public function register(Application $app) { $app['guzzle.base_url'] = '/'; if(!isset($app['guzzle.plugins'])){ $app['guzzle.plugins'] = array(); } // Register a Guzzle ServiceBuilder $app['guzzle'] = $app->share(function () use ($app) { if (!isset($a...
php
public function register(Application $app) { $app['guzzle.base_url'] = '/'; if(!isset($app['guzzle.plugins'])){ $app['guzzle.plugins'] = array(); } // Register a Guzzle ServiceBuilder $app['guzzle'] = $app->share(function () use ($app) { if (!isset($a...
[ "public", "function", "register", "(", "Application", "$", "app", ")", "{", "$", "app", "[", "'guzzle.base_url'", "]", "=", "'/'", ";", "if", "(", "!", "isset", "(", "$", "app", "[", "'guzzle.plugins'", "]", ")", ")", "{", "$", "app", "[", "'guzzle.p...
Register Guzzle with Silex @param Application $app Application to register with
[ "Register", "Guzzle", "with", "Silex" ]
train
https://github.com/Guzzle3/guzzle-silex-extension/blob/557d0205d8691d0702380102fac5a662854e0691/GuzzleServiceProvider.php#L34-L62
christophe-brachet/aspi-framework
src/Framework/Provider/DoctrineServiceProvider.php
DoctrineServiceProvider.register
public function register(Container $container) { $container['SchemaManager'] = function (Container $container): \Aspi\Framework\Manager\Doctrine\Schema { return new \Aspi\Framework\Manager\Doctrine\Schema($container); }; $container['TemplateManager'] = function (Container...
php
public function register(Container $container) { $container['SchemaManager'] = function (Container $container): \Aspi\Framework\Manager\Doctrine\Schema { return new \Aspi\Framework\Manager\Doctrine\Schema($container); }; $container['TemplateManager'] = function (Container...
[ "public", "function", "register", "(", "Container", "$", "container", ")", "{", "$", "container", "[", "'SchemaManager'", "]", "=", "function", "(", "Container", "$", "container", ")", ":", "\\", "Aspi", "\\", "Framework", "\\", "Manager", "\\", "Doctrine", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Provider/DoctrineServiceProvider.php#L51-L205
nyeholt/silverstripe-simplewiki
thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/PercentEncoder.php
HTMLPurifier_PercentEncoder.normalize
public function normalize($string) { if ($string == '') return ''; $parts = explode('%', $string); $ret = array_shift($parts); foreach ($parts as $part) { $length = strlen($part); if ($length < 2) { $ret .= '%25' . $part; continue; ...
php
public function normalize($string) { if ($string == '') return ''; $parts = explode('%', $string); $ret = array_shift($parts); foreach ($parts as $part) { $length = strlen($part); if ($length < 2) { $ret .= '%25' . $part; continue; ...
[ "public", "function", "normalize", "(", "$", "string", ")", "{", "if", "(", "$", "string", "==", "''", ")", "return", "''", ";", "$", "parts", "=", "explode", "(", "'%'", ",", "$", "string", ")", ";", "$", "ret", "=", "array_shift", "(", "$", "pa...
Fix up percent-encoding by decoding unreserved characters and normalizing. @warning This function is affected by $preserve, even though the usual desired behavior is for this not to preserve those characters. Be careful when reusing instances of PercentEncoder! @param $string String to normalize
[ "Fix", "up", "percent", "-", "encoding", "by", "decoding", "unreserved", "characters", "and", "normalizing", "." ]
train
https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/PercentEncoder.php#L69-L94
DevGroup-ru/yii2-data-structure-tools
src/propertyStorage/StaticValues.php
StaticValues.getStaticValueIdsSql
protected function getStaticValueIdsSql($id) { return (new Query()) ->select('id') ->from(StaticValue::tableName()) ->where(['property_id' => $id]) ->createCommand() ->getRawSql(); }
php
protected function getStaticValueIdsSql($id) { return (new Query()) ->select('id') ->from(StaticValue::tableName()) ->where(['property_id' => $id]) ->createCommand() ->getRawSql(); }
[ "protected", "function", "getStaticValueIdsSql", "(", "$", "id", ")", "{", "return", "(", "new", "Query", "(", ")", ")", "->", "select", "(", "'id'", ")", "->", "from", "(", "StaticValue", "::", "tableName", "(", ")", ")", "->", "where", "(", "[", "'...
Get static value ids sql by property id(s). @param int | int[] $id @return string
[ "Get", "static", "value", "ids", "sql", "by", "property", "id", "(", "s", ")", "." ]
train
https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/propertyStorage/StaticValues.php#L32-L40
ssnepenthe/soter
src/class-options-page.php
Options_Page.admin_init
public function admin_init() { add_settings_section( 'soter_general', 'General Settings', [ $this, 'render_section_general' ], 'soter' ); add_settings_section( 'soter_email', 'Email Settings', [ $this, 'render_section_email' ], 'soter' ); add_settings_section( 'soter_slack', 'S...
php
public function admin_init() { add_settings_section( 'soter_general', 'General Settings', [ $this, 'render_section_general' ], 'soter' ); add_settings_section( 'soter_email', 'Email Settings', [ $this, 'render_section_email' ], 'soter' ); add_settings_section( 'soter_slack', 'S...
[ "public", "function", "admin_init", "(", ")", "{", "add_settings_section", "(", "'soter_general'", ",", "'General Settings'", ",", "[", "$", "this", ",", "'render_section_general'", "]", ",", "'soter'", ")", ";", "add_settings_section", "(", "'soter_email'", ",", ...
Registers settings, sections and fields. @return void
[ "Registers", "settings", "sections", "and", "fields", "." ]
train
https://github.com/ssnepenthe/soter/blob/f6d7032f8562e23c2ee8dbf9d60ef1114c8cdce7/src/class-options-page.php#L50-L135
ssnepenthe/soter
src/class-options-page.php
Options_Page.print_notice_when_no_notifiers_active
public function print_notice_when_no_notifiers_active() { if ( 'settings_page_soter' !== get_current_screen()->base || $this->options->email_enabled || $this->options->slack_enabled ) { return; } echo $this->template->render( 'admin-notice.php', [ // WPCS: XSS OK. 'type' => 'error', 'message'...
php
public function print_notice_when_no_notifiers_active() { if ( 'settings_page_soter' !== get_current_screen()->base || $this->options->email_enabled || $this->options->slack_enabled ) { return; } echo $this->template->render( 'admin-notice.php', [ // WPCS: XSS OK. 'type' => 'error', 'message'...
[ "public", "function", "print_notice_when_no_notifiers_active", "(", ")", "{", "if", "(", "'settings_page_soter'", "!==", "get_current_screen", "(", ")", "->", "base", "||", "$", "this", "->", "options", "->", "email_enabled", "||", "$", "this", "->", "options", ...
Print an admin notice indicating to user that no notifiers are currently enabled. @return void
[ "Print", "an", "admin", "notice", "indicating", "to", "user", "that", "no", "notifiers", "are", "currently", "enabled", "." ]
train
https://github.com/ssnepenthe/soter/blob/f6d7032f8562e23c2ee8dbf9d60ef1114c8cdce7/src/class-options-page.php#L157-L170
ssnepenthe/soter
src/class-options-page.php
Options_Page.render_email_address
public function render_email_address() { $placeholder = get_bloginfo( 'admin_email' ); $current = $this->options->email_address; $value = $placeholder === $current ? '' : $current; echo $this->template->render( // WPCS: XSS OK. 'options/email-address.php', compact( 'placeholder', 'value' ) ); }
php
public function render_email_address() { $placeholder = get_bloginfo( 'admin_email' ); $current = $this->options->email_address; $value = $placeholder === $current ? '' : $current; echo $this->template->render( // WPCS: XSS OK. 'options/email-address.php', compact( 'placeholder', 'value' ) ); }
[ "public", "function", "render_email_address", "(", ")", "{", "$", "placeholder", "=", "get_bloginfo", "(", "'admin_email'", ")", ";", "$", "current", "=", "$", "this", "->", "options", "->", "email_address", ";", "$", "value", "=", "$", "placeholder", "===",...
Renders the email address field. @return void
[ "Renders", "the", "email", "address", "field", "." ]
train
https://github.com/ssnepenthe/soter/blob/f6d7032f8562e23c2ee8dbf9d60ef1114c8cdce7/src/class-options-page.php#L177-L186
ssnepenthe/soter
src/class-options-page.php
Options_Page.render_ignored_plugins
public function render_ignored_plugins() { $plugins = get_plugins(); $plugins = array_map( function( $key, $value ) { if ( false === strpos( $key, '/' ) ) { $slug = basename( $key, '.php' ); } else { $slug = dirname( $key ); } return [ 'name' => $value['Name'], 'slug' => $slug, ]; ...
php
public function render_ignored_plugins() { $plugins = get_plugins(); $plugins = array_map( function( $key, $value ) { if ( false === strpos( $key, '/' ) ) { $slug = basename( $key, '.php' ); } else { $slug = dirname( $key ); } return [ 'name' => $value['Name'], 'slug' => $slug, ]; ...
[ "public", "function", "render_ignored_plugins", "(", ")", "{", "$", "plugins", "=", "get_plugins", "(", ")", ";", "$", "plugins", "=", "array_map", "(", "function", "(", "$", "key", ",", "$", "value", ")", "{", "if", "(", "false", "===", "strpos", "(",...
Renders the ignored plugins field. @return void
[ "Renders", "the", "ignored", "plugins", "field", "." ]
train
https://github.com/ssnepenthe/soter/blob/f6d7032f8562e23c2ee8dbf9d60ef1114c8cdce7/src/class-options-page.php#L217-L237
ssnepenthe/soter
src/class-options-page.php
Options_Page.render_ignored_themes
public function render_ignored_themes() { $themes = array_map( function( $value ) { return [ 'name' => $value->display( 'Name' ), 'slug' => $value->get_stylesheet(), ]; }, wp_get_themes() ); echo $this->template->render( 'options/ignored-packages.php', [ // WPCS: XSS OK. 'ignored_packages' => $t...
php
public function render_ignored_themes() { $themes = array_map( function( $value ) { return [ 'name' => $value->display( 'Name' ), 'slug' => $value->get_stylesheet(), ]; }, wp_get_themes() ); echo $this->template->render( 'options/ignored-packages.php', [ // WPCS: XSS OK. 'ignored_packages' => $t...
[ "public", "function", "render_ignored_themes", "(", ")", "{", "$", "themes", "=", "array_map", "(", "function", "(", "$", "value", ")", "{", "return", "[", "'name'", "=>", "$", "value", "->", "display", "(", "'Name'", ")", ",", "'slug'", "=>", "$", "va...
Renders the ignored themes field. @return void
[ "Renders", "the", "ignored", "themes", "field", "." ]
train
https://github.com/ssnepenthe/soter/blob/f6d7032f8562e23c2ee8dbf9d60ef1114c8cdce7/src/class-options-page.php#L244-L257
bariew/yii2-rbac-cms-module
components/TreeBuilder.php
TreeBuilder.menuCallback
public function menuCallback($data) { $contextMenu = ARTreeMenuWidget::this()->commonOptions()['contextmenu']; $contextMenu['items'] = [ 'create' => $contextMenu['items']['create'], 'delete' => $contextMenu['items']['delete'] ]; $data['options'] ...
php
public function menuCallback($data) { $contextMenu = ARTreeMenuWidget::this()->commonOptions()['contextmenu']; $contextMenu['items'] = [ 'create' => $contextMenu['items']['create'], 'delete' => $contextMenu['items']['delete'] ]; $data['options'] ...
[ "public", "function", "menuCallback", "(", "$", "data", ")", "{", "$", "contextMenu", "=", "ARTreeMenuWidget", "::", "this", "(", ")", "->", "commonOptions", "(", ")", "[", "'contextmenu'", "]", ";", "$", "contextMenu", "[", "'items'", "]", "=", "[", "'c...
Callback for $this->menuWidget() method. @param array $data data to process. @return array processed data.
[ "Callback", "for", "$this", "-", ">", "menuWidget", "()", "method", "." ]
train
https://github.com/bariew/yii2-rbac-cms-module/blob/c1f0fd05bf6d1951a3fd929d974e6f4cc2b52262/components/TreeBuilder.php#L41-L55
bariew/yii2-rbac-cms-module
components/TreeBuilder.php
TreeBuilder.nodeAttributes
public function nodeAttributes($model = false, $pid = '', $uniqueKey = false) { $uniqueKey = $uniqueKey ? $uniqueKey : self::$uniqueKey++; $model = ($model) ? $model : $this->owner; $id = $model[$this->id]; $nodeId = $uniqueKey . '-id-' . $id; return array( ...
php
public function nodeAttributes($model = false, $pid = '', $uniqueKey = false) { $uniqueKey = $uniqueKey ? $uniqueKey : self::$uniqueKey++; $model = ($model) ? $model : $this->owner; $id = $model[$this->id]; $nodeId = $uniqueKey . '-id-' . $id; return array( ...
[ "public", "function", "nodeAttributes", "(", "$", "model", "=", "false", ",", "$", "pid", "=", "''", ",", "$", "uniqueKey", "=", "false", ")", "{", "$", "uniqueKey", "=", "$", "uniqueKey", "?", "$", "uniqueKey", ":", "self", "::", "$", "uniqueKey", "...
Generates attributes for jstree item from owner model. @param mixed $model model @param mixed $pid view item parent id. @param bool $uniqueKey unique node view id prefix. @return array attributes
[ "Generates", "attributes", "for", "jstree", "item", "from", "owner", "model", "." ]
train
https://github.com/bariew/yii2-rbac-cms-module/blob/c1f0fd05bf6d1951a3fd929d974e6f4cc2b52262/components/TreeBuilder.php#L64-L84
bariew/yii2-rbac-cms-module
components/TreeBuilder.php
TreeBuilder.generateTree
public function generateTree($items, $relations) { $children = ArrayHelper::map($relations, 'child', 'parent'); foreach ($relations as $relation) { if (!isset($items[$relation['child']]) || !isset($items[$relation['parent']])) { continue; } $tree =...
php
public function generateTree($items, $relations) { $children = ArrayHelper::map($relations, 'child', 'parent'); foreach ($relations as $relation) { if (!isset($items[$relation['child']]) || !isset($items[$relation['parent']])) { continue; } $tree =...
[ "public", "function", "generateTree", "(", "$", "items", ",", "$", "relations", ")", "{", "$", "children", "=", "ArrayHelper", "::", "map", "(", "$", "relations", ",", "'child'", ",", "'parent'", ")", ";", "foreach", "(", "$", "relations", "as", "$", "...
Generates children tree. @param $items @param $relations @return array $items children tree.
[ "Generates", "children", "tree", "." ]
train
https://github.com/bariew/yii2-rbac-cms-module/blob/c1f0fd05bf6d1951a3fd929d974e6f4cc2b52262/components/TreeBuilder.php#L92-L105
webbuilders-group/silverstripe-gridfield-deleted-items
src/Forms/GridFieldDeletedManipulator.php
GridFieldDeletedManipulator.getManipulatedData
public function getManipulatedData(GridField $gridField, SS_List $dataList) { if($gridField->State->ListDisplayMode->ShowDeletedItems=='Y') { if(!DataObject::has_extension($gridField->getModelClass(), Versioned::class)) { user_error($gridField->getModelClass().' does not have the Ver...
php
public function getManipulatedData(GridField $gridField, SS_List $dataList) { if($gridField->State->ListDisplayMode->ShowDeletedItems=='Y') { if(!DataObject::has_extension($gridField->getModelClass(), Versioned::class)) { user_error($gridField->getModelClass().' does not have the Ver...
[ "public", "function", "getManipulatedData", "(", "GridField", "$", "gridField", ",", "SS_List", "$", "dataList", ")", "{", "if", "(", "$", "gridField", "->", "State", "->", "ListDisplayMode", "->", "ShowDeletedItems", "==", "'Y'", ")", "{", "if", "(", "!", ...
Manipulate the {@link DataList} as needed by this grid modifier. @param GridField $gridField Grid Field Reference @param SS_List @return DataList
[ "Manipulate", "the", "{" ]
train
https://github.com/webbuilders-group/silverstripe-gridfield-deleted-items/blob/fd4e90701357de00acf06f4b820b745817f4ce9c/src/Forms/GridFieldDeletedManipulator.php#L17-L31
dphn/ScContent
src/ScContent/Listener/Back/ContentListReorder.php
ContentListReorder.process
public function process(EventInterface $event) { $mapper = $this->getMapper(); $optionsProvider = $this->getOptionsProvider(); $translator = $this->getTranslator(); $pane = $event->getParam('pane'); if (! $optionsProvider->hasIdentifier($pane)) { return; }...
php
public function process(EventInterface $event) { $mapper = $this->getMapper(); $optionsProvider = $this->getOptionsProvider(); $translator = $this->getTranslator(); $pane = $event->getParam('pane'); if (! $optionsProvider->hasIdentifier($pane)) { return; }...
[ "public", "function", "process", "(", "EventInterface", "$", "event", ")", "{", "$", "mapper", "=", "$", "this", "->", "getMapper", "(", ")", ";", "$", "optionsProvider", "=", "$", "this", "->", "getOptionsProvider", "(", ")", ";", "$", "translator", "="...
Reorder elements @param \Zend\EventManager\EventInterface $event @return null|\Zend\Http\Response
[ "Reorder", "elements" ]
train
https://github.com/dphn/ScContent/blob/9dd5732490c45fd788b96cedf7b3c7adfacb30d2/src/ScContent/Listener/Back/ContentListReorder.php#L74-L136
AbuseIO/parser-common
src/Parser.php
Parser.startup
protected function startup($parser) { $reflect = new ReflectionClass($parser); $this->configBase = 'parsers.' . $reflect->getShortName(); if (empty(config("{$this->configBase}.parser.name"))) { $this->failed("Required parser.name is missing in parser configuration"); } ...
php
protected function startup($parser) { $reflect = new ReflectionClass($parser); $this->configBase = 'parsers.' . $reflect->getShortName(); if (empty(config("{$this->configBase}.parser.name"))) { $this->failed("Required parser.name is missing in parser configuration"); } ...
[ "protected", "function", "startup", "(", "$", "parser", ")", "{", "$", "reflect", "=", "new", "ReflectionClass", "(", "$", "parser", ")", ";", "$", "this", "->", "configBase", "=", "'parsers.'", ".", "$", "reflect", "->", "getShortName", "(", ")", ";", ...
Generalize the local config based on the parser class object. @param object $parser @return void
[ "Generalize", "the", "local", "config", "based", "on", "the", "parser", "class", "object", "." ]
train
https://github.com/AbuseIO/parser-common/blob/a77707df73908a3e9770f5bd8504fe444b5576b8/src/Parser.php#L85-L102
AbuseIO/parser-common
src/Parser.php
Parser.cleanup
protected function cleanup() { // if $this->fs is an object, the Filesystem has been used, clean it up. if (is_object($this->fs)) { if ($this->fs->isDirectory($this->tempPath)) { $this->fs->deleteDirectory($this->tempPath, false); } } }
php
protected function cleanup() { // if $this->fs is an object, the Filesystem has been used, clean it up. if (is_object($this->fs)) { if ($this->fs->isDirectory($this->tempPath)) { $this->fs->deleteDirectory($this->tempPath, false); } } }
[ "protected", "function", "cleanup", "(", ")", "{", "// if $this->fs is an object, the Filesystem has been used, clean it up.", "if", "(", "is_object", "(", "$", "this", "->", "fs", ")", ")", "{", "if", "(", "$", "this", "->", "fs", "->", "isDirectory", "(", "$",...
Cleanup anything a parser might have left (basically, remove the working dir) @return void
[ "Cleanup", "anything", "a", "parser", "might", "have", "left", "(", "basically", "remove", "the", "working", "dir", ")" ]
train
https://github.com/AbuseIO/parser-common/blob/a77707df73908a3e9770f5bd8504fe444b5576b8/src/Parser.php#L165-L173
AbuseIO/parser-common
src/Parser.php
Parser.createWorkingDir
protected function createWorkingDir() { $uuid = Uuid::generate(4); $this->tempPath = "/tmp/abuseio-{$uuid}/"; $this->fs = new Filesystem; if (!$this->fs->makeDirectory($this->tempPath)) { return $this->failed("Unable to create directory {$this->tempPath}"); } ...
php
protected function createWorkingDir() { $uuid = Uuid::generate(4); $this->tempPath = "/tmp/abuseio-{$uuid}/"; $this->fs = new Filesystem; if (!$this->fs->makeDirectory($this->tempPath)) { return $this->failed("Unable to create directory {$this->tempPath}"); } ...
[ "protected", "function", "createWorkingDir", "(", ")", "{", "$", "uuid", "=", "Uuid", "::", "generate", "(", "4", ")", ";", "$", "this", "->", "tempPath", "=", "\"/tmp/abuseio-{$uuid}/\"", ";", "$", "this", "->", "fs", "=", "new", "Filesystem", ";", "if"...
Setup a working directory for the parser @return boolean Returns true or call $this->failed()
[ "Setup", "a", "working", "directory", "for", "the", "parser" ]
train
https://github.com/AbuseIO/parser-common/blob/a77707df73908a3e9770f5bd8504fe444b5576b8/src/Parser.php#L179-L190
AbuseIO/parser-common
src/Parser.php
Parser.isKnownFeed
protected function isKnownFeed() { if ($this->feedName === false) { return $this->failed("Parser did not set the required feedName value"); } if (empty(config("{$this->configBase}.feeds.{$this->feedName}"))) { $this->warningCount++; Log::warning( ...
php
protected function isKnownFeed() { if ($this->feedName === false) { return $this->failed("Parser did not set the required feedName value"); } if (empty(config("{$this->configBase}.feeds.{$this->feedName}"))) { $this->warningCount++; Log::warning( ...
[ "protected", "function", "isKnownFeed", "(", ")", "{", "if", "(", "$", "this", "->", "feedName", "===", "false", ")", "{", "return", "$", "this", "->", "failed", "(", "\"Parser did not set the required feedName value\"", ")", ";", "}", "if", "(", "empty", "(...
Check if the feed specified is known in the parser config. @return boolean Returns true or false
[ "Check", "if", "the", "feed", "specified", "is", "known", "in", "the", "parser", "config", "." ]
train
https://github.com/AbuseIO/parser-common/blob/a77707df73908a3e9770f5bd8504fe444b5576b8/src/Parser.php#L196-L214
AbuseIO/parser-common
src/Parser.php
Parser.hasArfMail
protected function hasArfMail() { if ($this->arfMail === false) { $this->warningCount++; Log::warning( get_class($this) . ': ' . "The feed referred as '{$this->feedName}' has an ARF requirement that was not met" ); return false;...
php
protected function hasArfMail() { if ($this->arfMail === false) { $this->warningCount++; Log::warning( get_class($this) . ': ' . "The feed referred as '{$this->feedName}' has an ARF requirement that was not met" ); return false;...
[ "protected", "function", "hasArfMail", "(", ")", "{", "if", "(", "$", "this", "->", "arfMail", "===", "false", ")", "{", "$", "this", "->", "warningCount", "++", ";", "Log", "::", "warning", "(", "get_class", "(", "$", "this", ")", ".", "': '", ".", ...
Check if a valid arfMail was passed along which is required when called. @return boolean Returns true or false
[ "Check", "if", "a", "valid", "arfMail", "was", "passed", "along", "which", "is", "required", "when", "called", "." ]
train
https://github.com/AbuseIO/parser-common/blob/a77707df73908a3e9770f5bd8504fe444b5576b8/src/Parser.php#L220-L232
AbuseIO/parser-common
src/Parser.php
Parser.isEnabledFeed
protected function isEnabledFeed() { if (config("{$this->configBase}.feeds.{$this->feedName}.enabled") !== true) { Log::warning( get_class($this) . ': ' . "The feed '{$this->feedName}' is disabled in the configuration of parser " . config("{$this->...
php
protected function isEnabledFeed() { if (config("{$this->configBase}.feeds.{$this->feedName}.enabled") !== true) { Log::warning( get_class($this) . ': ' . "The feed '{$this->feedName}' is disabled in the configuration of parser " . config("{$this->...
[ "protected", "function", "isEnabledFeed", "(", ")", "{", "if", "(", "config", "(", "\"{$this->configBase}.feeds.{$this->feedName}.enabled\"", ")", "!==", "true", ")", "{", "Log", "::", "warning", "(", "get_class", "(", "$", "this", ")", ".", "': '", ".", "\"Th...
Check and see if a feed is enabled. @return boolean Returns true or false
[ "Check", "and", "see", "if", "a", "feed", "is", "enabled", "." ]
train
https://github.com/AbuseIO/parser-common/blob/a77707df73908a3e9770f5bd8504fe444b5576b8/src/Parser.php#L238-L250
AbuseIO/parser-common
src/Parser.php
Parser.hasRequiredFields
protected function hasRequiredFields($report) { if (is_array(config("{$this->configBase}.feeds.{$this->feedName}.fields"))) { $columns = array_filter(config("{$this->configBase}.feeds.{$this->feedName}.fields")); if (count($columns) > 0) { foreach ($columns as $column...
php
protected function hasRequiredFields($report) { if (is_array(config("{$this->configBase}.feeds.{$this->feedName}.fields"))) { $columns = array_filter(config("{$this->configBase}.feeds.{$this->feedName}.fields")); if (count($columns) > 0) { foreach ($columns as $column...
[ "protected", "function", "hasRequiredFields", "(", "$", "report", ")", "{", "if", "(", "is_array", "(", "config", "(", "\"{$this->configBase}.feeds.{$this->feedName}.fields\"", ")", ")", ")", "{", "$", "columns", "=", "array_filter", "(", "config", "(", "\"{$this-...
Check if all required fields are in the report. @param array $report Report data @return boolean Returns true or false
[ "Check", "if", "all", "required", "fields", "are", "in", "the", "report", "." ]
train
https://github.com/AbuseIO/parser-common/blob/a77707df73908a3e9770f5bd8504fe444b5576b8/src/Parser.php#L257-L277
AbuseIO/parser-common
src/Parser.php
Parser.applyFilters
protected function applyFilters($report, $removeEmpty = true) { if ((!empty(config("{$this->configBase}.feeds.{$this->feedName}.filters"))) && (is_array(config("{$this->configBase}.feeds.{$this->feedName}.filters"))) ) { $filter_columns = array_filter(config("{$this->configBa...
php
protected function applyFilters($report, $removeEmpty = true) { if ((!empty(config("{$this->configBase}.feeds.{$this->feedName}.filters"))) && (is_array(config("{$this->configBase}.feeds.{$this->feedName}.filters"))) ) { $filter_columns = array_filter(config("{$this->configBa...
[ "protected", "function", "applyFilters", "(", "$", "report", ",", "$", "removeEmpty", "=", "true", ")", "{", "if", "(", "(", "!", "empty", "(", "config", "(", "\"{$this->configBase}.feeds.{$this->feedName}.filters\"", ")", ")", ")", "&&", "(", "is_array", "(",...
Filter the unwanted and empty fields from the report. @param array $report The report that needs filtering base on config elements @param boolean $removeEmpty Option to remove empty fields from report, default is true @return array $report The filtered version of the report
[ "Filter", "the", "unwanted", "and", "empty", "fields", "from", "the", "report", "." ]
train
https://github.com/AbuseIO/parser-common/blob/a77707df73908a3e9770f5bd8504fe444b5576b8/src/Parser.php#L285-L308
buonzz/laravel-4-freegeoip
src/Buonzz/GeoIP/GeoIP.php
GeoIP.getItem
private function getItem($name){ if($this->geoip_data == NULL) $this->retrievefromCache(); return $this->geoip_data->$name; }
php
private function getItem($name){ if($this->geoip_data == NULL) $this->retrievefromCache(); return $this->geoip_data->$name; }
[ "private", "function", "getItem", "(", "$", "name", ")", "{", "if", "(", "$", "this", "->", "geoip_data", "==", "NULL", ")", "$", "this", "->", "retrievefromCache", "(", ")", ";", "return", "$", "this", "->", "geoip_data", "->", "$", "name", ";", "}"...
generic property retriever. @return string
[ "generic", "property", "retriever", "." ]
train
https://github.com/buonzz/laravel-4-freegeoip/blob/0944809d7b98f7beea00b1614f33d74b60931272/src/Buonzz/GeoIP/GeoIP.php#L143-L149
buonzz/laravel-4-freegeoip
src/Buonzz/GeoIP/GeoIP.php
GeoIP.retrievefromCache
private function retrievefromCache(){ if (class_exists('\\Cache')) { $cache_key = 'laravel-4-freegeoip-'. $this->ip; if (\Cache::has($cache_key)) $this->geoip_data = \Cache::get($cache_key); else { $this->geoip_data =...
php
private function retrievefromCache(){ if (class_exists('\\Cache')) { $cache_key = 'laravel-4-freegeoip-'. $this->ip; if (\Cache::has($cache_key)) $this->geoip_data = \Cache::get($cache_key); else { $this->geoip_data =...
[ "private", "function", "retrievefromCache", "(", ")", "{", "if", "(", "class_exists", "(", "'\\\\Cache'", ")", ")", "{", "$", "cache_key", "=", "'laravel-4-freegeoip-'", ".", "$", "this", "->", "ip", ";", "if", "(", "\\", "Cache", "::", "has", "(", "$", ...
check if the Cache class exists and use caching mechanism if there is, otherwise just call the API directly. @return void
[ "check", "if", "the", "Cache", "class", "exists", "and", "use", "caching", "mechanism", "if", "there", "is", "otherwise", "just", "call", "the", "API", "directly", "." ]
train
https://github.com/buonzz/laravel-4-freegeoip/blob/0944809d7b98f7beea00b1614f33d74b60931272/src/Buonzz/GeoIP/GeoIP.php#L156-L173
buonzz/laravel-4-freegeoip
src/Buonzz/GeoIP/GeoIP.php
GeoIP.resolve
function resolve($ip){ $url = \Config::get('laravel-4-freegeoip::freegeoipURL').$ip; $ch = curl_init(); curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, \Config::get('laravel-4-freegeoip::timeout'));...
php
function resolve($ip){ $url = \Config::get('laravel-4-freegeoip::freegeoipURL').$ip; $ch = curl_init(); curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, \Config::get('laravel-4-freegeoip::timeout'));...
[ "function", "resolve", "(", "$", "ip", ")", "{", "$", "url", "=", "\\", "Config", "::", "get", "(", "'laravel-4-freegeoip::freegeoipURL'", ")", ".", "$", "ip", ";", "$", "ch", "=", "curl_init", "(", ")", ";", "curl_setopt", "(", "$", "ch", ",", "CURL...
call the freegeoip.net for data, retrieve it as JSON and convert it to stdclass. @todo make this thing use Guzzle instead, you novice kid! @return void
[ "call", "the", "freegeoip", ".", "net", "for", "data", "retrieve", "it", "as", "JSON", "and", "convert", "it", "to", "stdclass", "." ]
train
https://github.com/buonzz/laravel-4-freegeoip/blob/0944809d7b98f7beea00b1614f33d74b60931272/src/Buonzz/GeoIP/GeoIP.php#L183-L201
kriskbx/mikado
src/Mikado.php
Mikado.get
public function get($identifier) { if(!isset($this->managers[$identifier])) throw new InvalidArgumentException('A manager with that identifier does not exist.'); return $this->managers[$identifier]; }
php
public function get($identifier) { if(!isset($this->managers[$identifier])) throw new InvalidArgumentException('A manager with that identifier does not exist.'); return $this->managers[$identifier]; }
[ "public", "function", "get", "(", "$", "identifier", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "managers", "[", "$", "identifier", "]", ")", ")", "throw", "new", "InvalidArgumentException", "(", "'A manager with that identifier does not exist.'"...
Get manager by the given identifier. @param $identifier @throws InvalidArgumentException @return mixed
[ "Get", "manager", "by", "the", "given", "identifier", "." ]
train
https://github.com/kriskbx/mikado/blob/f00e566d682a66796f3f8a68b348920fadd9ee87/src/Mikado.php#L40-L46
ionutmilica/laravel-settings
src/Drivers/Database.php
Database.load
public function load() { $data = []; $settings = $this->database->select('SELECT * FROM '.$this->table); foreach ($settings as $setting) { $id = $setting->id; $value = $setting->value; $decoded = json_decode($value, 1, 512); if (is_array($de...
php
public function load() { $data = []; $settings = $this->database->select('SELECT * FROM '.$this->table); foreach ($settings as $setting) { $id = $setting->id; $value = $setting->value; $decoded = json_decode($value, 1, 512); if (is_array($de...
[ "public", "function", "load", "(", ")", "{", "$", "data", "=", "[", "]", ";", "$", "settings", "=", "$", "this", "->", "database", "->", "select", "(", "'SELECT * FROM '", ".", "$", "this", "->", "table", ")", ";", "foreach", "(", "$", "settings", ...
Fetch the settings from the database @return array
[ "Fetch", "the", "settings", "from", "the", "database" ]
train
https://github.com/ionutmilica/laravel-settings/blob/becbd839f8c1c1bcbfde42ea808f1c69e5233dee/src/Drivers/Database.php#L38-L57
ionutmilica/laravel-settings
src/Drivers/Database.php
Database.save
public function save(array $data = [], array $dirt = []) { foreach ($dirt as $field => $data) { switch ($data['type']) { case 'created': $this->createSetting($field, $data['value']); break; case 'updated': ...
php
public function save(array $data = [], array $dirt = []) { foreach ($dirt as $field => $data) { switch ($data['type']) { case 'created': $this->createSetting($field, $data['value']); break; case 'updated': ...
[ "public", "function", "save", "(", "array", "$", "data", "=", "[", "]", ",", "array", "$", "dirt", "=", "[", "]", ")", "{", "foreach", "(", "$", "dirt", "as", "$", "field", "=>", "$", "data", ")", "{", "switch", "(", "$", "data", "[", "'type'",...
Save the data into the database @param array $data @param array $dirt @return bool
[ "Save", "the", "data", "into", "the", "database", "@param", "array", "$data", "@param", "array", "$dirt" ]
train
https://github.com/ionutmilica/laravel-settings/blob/becbd839f8c1c1bcbfde42ea808f1c69e5233dee/src/Drivers/Database.php#L66-L81
ionutmilica/laravel-settings
src/Drivers/Database.php
Database.createSetting
protected function createSetting($field, $value) { $value = is_array($value) ? json_encode($value) : $value; return $this->getTableObject()->insert([ 'id' => $field, 'value' => $value ]); }
php
protected function createSetting($field, $value) { $value = is_array($value) ? json_encode($value) : $value; return $this->getTableObject()->insert([ 'id' => $field, 'value' => $value ]); }
[ "protected", "function", "createSetting", "(", "$", "field", ",", "$", "value", ")", "{", "$", "value", "=", "is_array", "(", "$", "value", ")", "?", "json_encode", "(", "$", "value", ")", ":", "$", "value", ";", "return", "$", "this", "->", "getTabl...
Create setting @param $field @param $value
[ "Create", "setting" ]
train
https://github.com/ionutmilica/laravel-settings/blob/becbd839f8c1c1bcbfde42ea808f1c69e5233dee/src/Drivers/Database.php#L89-L97
ionutmilica/laravel-settings
src/Drivers/Database.php
Database.updateSetting
protected function updateSetting($field, $value) { $value = is_array($value) ? json_encode($value) : $value; return $this->getTableObject() ->where('id', $field) ->update(['value' => $value]); }
php
protected function updateSetting($field, $value) { $value = is_array($value) ? json_encode($value) : $value; return $this->getTableObject() ->where('id', $field) ->update(['value' => $value]); }
[ "protected", "function", "updateSetting", "(", "$", "field", ",", "$", "value", ")", "{", "$", "value", "=", "is_array", "(", "$", "value", ")", "?", "json_encode", "(", "$", "value", ")", ":", "$", "value", ";", "return", "$", "this", "->", "getTabl...
Update setting @param $field @param $value @return mixed
[ "Update", "setting" ]
train
https://github.com/ionutmilica/laravel-settings/blob/becbd839f8c1c1bcbfde42ea808f1c69e5233dee/src/Drivers/Database.php#L106-L113
itrnka/ha-framework
src/ha/Access/HTTP/Router/Builder/HTTPRouterBuilderExample.php
HTTPRouterBuilderExample.buildRouter
public function buildRouter() : HTTPRouter { // create router dependencies and router instance $request = new HTTPInputRequestDefault(); $response = new HTTPOutputResponseDefault($request); $errHandler = new HTTPErrorHandlerDefault(); $router = new HTTPRouterDefault($request,...
php
public function buildRouter() : HTTPRouter { // create router dependencies and router instance $request = new HTTPInputRequestDefault(); $response = new HTTPOutputResponseDefault($request); $errHandler = new HTTPErrorHandlerDefault(); $router = new HTTPRouterDefault($request,...
[ "public", "function", "buildRouter", "(", ")", ":", "HTTPRouter", "{", "// create router dependencies and router instance", "$", "request", "=", "new", "HTTPInputRequestDefault", "(", ")", ";", "$", "response", "=", "new", "HTTPOutputResponseDefault", "(", "$", "reque...
Build and return Router. @return HTTPRouter
[ "Build", "and", "return", "Router", "." ]
train
https://github.com/itrnka/ha-framework/blob/a72b09c28f8e966c37f98a0004e4fbbce80df42c/src/ha/Access/HTTP/Router/Builder/HTTPRouterBuilderExample.php#L37-L53
jimmyoak/utilities
src/Utility/StringUtils.php
StringUtils.beginsWith
public function beginsWith($haystack, $needle, $modifiers = null) { $this->prepareHaystackAndNeedle($haystack, $needle, $modifiers); $parsedModifiers = $this->parseModifiers($modifiers); $pattern = '/^' . preg_quote($needle) . '/'; return (bool)preg_match($pattern . $parsedModifier...
php
public function beginsWith($haystack, $needle, $modifiers = null) { $this->prepareHaystackAndNeedle($haystack, $needle, $modifiers); $parsedModifiers = $this->parseModifiers($modifiers); $pattern = '/^' . preg_quote($needle) . '/'; return (bool)preg_match($pattern . $parsedModifier...
[ "public", "function", "beginsWith", "(", "$", "haystack", ",", "$", "needle", ",", "$", "modifiers", "=", "null", ")", "{", "$", "this", "->", "prepareHaystackAndNeedle", "(", "$", "haystack", ",", "$", "needle", ",", "$", "modifiers", ")", ";", "$", "...
@param string $haystack @param string $needle @param int|null $modifiers @return bool
[ "@param", "string", "$haystack", "@param", "string", "$needle", "@param", "int|null", "$modifiers" ]
train
https://github.com/jimmyoak/utilities/blob/ab2b4a574bd67c04784695a3c206daf5800979a4/src/Utility/StringUtils.php#L97-L105
rfdy/imagemagick
CLI/Operation/Quality.php
Quality.process
public function process(Image $image, $command_line = '') { $result = new Result(); $result->setCommandLine($command_line . ' -quality ' . escapeshellarg($this->quality)); return $result; }
php
public function process(Image $image, $command_line = '') { $result = new Result(); $result->setCommandLine($command_line . ' -quality ' . escapeshellarg($this->quality)); return $result; }
[ "public", "function", "process", "(", "Image", "$", "image", ",", "$", "command_line", "=", "''", ")", "{", "$", "result", "=", "new", "Result", "(", ")", ";", "$", "result", "->", "setCommandLine", "(", "$", "command_line", ".", "' -quality '", ".", "...
@param Image $image @param string $command_line @return Result
[ "@param", "Image", "$image", "@param", "string", "$command_line" ]
train
https://github.com/rfdy/imagemagick/blob/dd1e52fbd66093828dd013e64c53dc7d68f1bc91/CLI/Operation/Quality.php#L14-L20
delatbabel/site-config
database/seeds/ExampleConfigSeeder.php
ExampleConfigSeeder.run
public function run() { // Base configuration data // This configuration will be saved as "global" -- for all websites // and environments. SiteConfigSaver::set('site.sysadmin.page_title', 'System Administrator Dashboard'); SiteConfigSaver::set('site.sysadmin.description', 'C...
php
public function run() { // Base configuration data // This configuration will be saved as "global" -- for all websites // and environments. SiteConfigSaver::set('site.sysadmin.page_title', 'System Administrator Dashboard'); SiteConfigSaver::set('site.sysadmin.description', 'C...
[ "public", "function", "run", "(", ")", "{", "// Base configuration data", "// This configuration will be saved as \"global\" -- for all websites", "// and environments.", "SiteConfigSaver", "::", "set", "(", "'site.sysadmin.page_title'", ",", "'System Administrator Dashboard'", ")", ...
Run the database seeds. @return void
[ "Run", "the", "database", "seeds", "." ]
train
https://github.com/delatbabel/site-config/blob/e547e63f5ea7140036bb3fe46ff47143b4f93d0f/database/seeds/ExampleConfigSeeder.php#L21-L40
mimmi20/Wurfl
src/Handlers/SanyoHandler.php
SanyoHandler.canHandle
public function canHandle($userAgent) { if (Utils::isDesktopBrowser($userAgent)) { return false; } return Utils::checkIfStartsWithAnyOf($userAgent, array('Sanyo', 'SANYO')) || Utils::checkIfContains($userAgent, 'MobilePhone'); }
php
public function canHandle($userAgent) { if (Utils::isDesktopBrowser($userAgent)) { return false; } return Utils::checkIfStartsWithAnyOf($userAgent, array('Sanyo', 'SANYO')) || Utils::checkIfContains($userAgent, 'MobilePhone'); }
[ "public", "function", "canHandle", "(", "$", "userAgent", ")", "{", "if", "(", "Utils", "::", "isDesktopBrowser", "(", "$", "userAgent", ")", ")", "{", "return", "false", ";", "}", "return", "Utils", "::", "checkIfStartsWithAnyOf", "(", "$", "userAgent", "...
@param string $userAgent @return bool
[ "@param", "string", "$userAgent" ]
train
https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/SanyoHandler.php#L39-L47
mimmi20/Wurfl
src/Handlers/SanyoHandler.php
SanyoHandler.applyConclusiveMatch
public function applyConclusiveMatch($userAgent) { $idx = strpos($userAgent, 'MobilePhone'); if ($idx !== false) { $tolerance = Utils::indexOfOrLength($userAgent, '/', $idx); } else { $tolerance = Utils::firstSlash($userAgent); } return $this->getDevi...
php
public function applyConclusiveMatch($userAgent) { $idx = strpos($userAgent, 'MobilePhone'); if ($idx !== false) { $tolerance = Utils::indexOfOrLength($userAgent, '/', $idx); } else { $tolerance = Utils::firstSlash($userAgent); } return $this->getDevi...
[ "public", "function", "applyConclusiveMatch", "(", "$", "userAgent", ")", "{", "$", "idx", "=", "strpos", "(", "$", "userAgent", ",", "'MobilePhone'", ")", ";", "if", "(", "$", "idx", "!==", "false", ")", "{", "$", "tolerance", "=", "Utils", "::", "ind...
@param string $userAgent @return null|string
[ "@param", "string", "$userAgent" ]
train
https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/SanyoHandler.php#L54-L64
chippyash/Strong-Type
src/Chippyash/Type/RequiredType.php
RequiredType.get
public function get() { if ($this->requiredType == self::TYPE_DEFAULT) { $this->requiredType = (extension_loaded('gmp') ? self::TYPE_GMP : self::TYPE_NATIVE); } return $this->requiredType; }
php
public function get() { if ($this->requiredType == self::TYPE_DEFAULT) { $this->requiredType = (extension_loaded('gmp') ? self::TYPE_GMP : self::TYPE_NATIVE); } return $this->requiredType; }
[ "public", "function", "get", "(", ")", "{", "if", "(", "$", "this", "->", "requiredType", "==", "self", "::", "TYPE_DEFAULT", ")", "{", "$", "this", "->", "requiredType", "=", "(", "extension_loaded", "(", "'gmp'", ")", "?", "self", "::", "TYPE_GMP", "...
Return required number base type @return string
[ "Return", "required", "number", "base", "type" ]
train
https://github.com/chippyash/Strong-Type/blob/9d364c10c68c10f768254fb25b0b1db3dbef6fa9/src/Chippyash/Type/RequiredType.php#L46-L53
chippyash/Strong-Type
src/Chippyash/Type/RequiredType.php
RequiredType.set
public function set($requiredType) { if (!in_array($requiredType, $this->validTypes)) { throw new \InvalidArgumentException("{$requiredType} is not a supported number type"); } if ($requiredType == self::TYPE_GMP && !extension_loaded('gmp')) { throw new \InvalidArgume...
php
public function set($requiredType) { if (!in_array($requiredType, $this->validTypes)) { throw new \InvalidArgumentException("{$requiredType} is not a supported number type"); } if ($requiredType == self::TYPE_GMP && !extension_loaded('gmp')) { throw new \InvalidArgume...
[ "public", "function", "set", "(", "$", "requiredType", ")", "{", "if", "(", "!", "in_array", "(", "$", "requiredType", ",", "$", "this", "->", "validTypes", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "\"{$requiredType} is not a suppo...
Set the required number base type @param $requiredType @return $this
[ "Set", "the", "required", "number", "base", "type" ]
train
https://github.com/chippyash/Strong-Type/blob/9d364c10c68c10f768254fb25b0b1db3dbef6fa9/src/Chippyash/Type/RequiredType.php#L62-L74
granulephp/util
lib/Map/ObjectMap.php
ObjectMap.containsKey
public function containsKey($key): bool { TypeHelper::validateKey($key, $this); return $this->elements->contains($key); }
php
public function containsKey($key): bool { TypeHelper::validateKey($key, $this); return $this->elements->contains($key); }
[ "public", "function", "containsKey", "(", "$", "key", ")", ":", "bool", "{", "TypeHelper", "::", "validateKey", "(", "$", "key", ",", "$", "this", ")", ";", "return", "$", "this", "->", "elements", "->", "contains", "(", "$", "key", ")", ";", "}" ]
{@inheritdoc}
[ "{" ]
train
https://github.com/granulephp/util/blob/8dcac627fbf9cf5e4219b6dec8ba8ad7c0a3186e/lib/Map/ObjectMap.php#L89-L93
granulephp/util
lib/Map/ObjectMap.php
ObjectMap.containsValue
public function containsValue($value): bool { TypeHelper::validateValue($value, $this); foreach ($this as $v) { if ($value == $v) { return true; } } return false; }
php
public function containsValue($value): bool { TypeHelper::validateValue($value, $this); foreach ($this as $v) { if ($value == $v) { return true; } } return false; }
[ "public", "function", "containsValue", "(", "$", "value", ")", ":", "bool", "{", "TypeHelper", "::", "validateValue", "(", "$", "value", ",", "$", "this", ")", ";", "foreach", "(", "$", "this", "as", "$", "v", ")", "{", "if", "(", "$", "value", "==...
{@inheritdoc} @deprecated Don't use as it a heavy one (because of @see \SplObjectStorage)
[ "{" ]
train
https://github.com/granulephp/util/blob/8dcac627fbf9cf5e4219b6dec8ba8ad7c0a3186e/lib/Map/ObjectMap.php#L99-L108
granulephp/util
lib/Map/ObjectMap.php
ObjectMap.equals
public function equals(Map $map): bool { if ($map instanceof ObjectMap) { return $map->hash() === $this->hash(); } return false; }
php
public function equals(Map $map): bool { if ($map instanceof ObjectMap) { return $map->hash() === $this->hash(); } return false; }
[ "public", "function", "equals", "(", "Map", "$", "map", ")", ":", "bool", "{", "if", "(", "$", "map", "instanceof", "ObjectMap", ")", "{", "return", "$", "map", "->", "hash", "(", ")", "===", "$", "this", "->", "hash", "(", ")", ";", "}", "return...
{@inheritdoc}
[ "{" ]
train
https://github.com/granulephp/util/blob/8dcac627fbf9cf5e4219b6dec8ba8ad7c0a3186e/lib/Map/ObjectMap.php#L111-L117
granulephp/util
lib/Map/ObjectMap.php
ObjectMap.filter
public function filter(callable $filter): Map { $newElements = new SplObjectStorage(); foreach ($this as $key => $element) { if ($filter($element, $key)) { $newElements[$key] = $element; } } return static::fromStorage($newElements); }
php
public function filter(callable $filter): Map { $newElements = new SplObjectStorage(); foreach ($this as $key => $element) { if ($filter($element, $key)) { $newElements[$key] = $element; } } return static::fromStorage($newElements); }
[ "public", "function", "filter", "(", "callable", "$", "filter", ")", ":", "Map", "{", "$", "newElements", "=", "new", "SplObjectStorage", "(", ")", ";", "foreach", "(", "$", "this", "as", "$", "key", "=>", "$", "element", ")", "{", "if", "(", "$", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/granulephp/util/blob/8dcac627fbf9cf5e4219b6dec8ba8ad7c0a3186e/lib/Map/ObjectMap.php#L120-L129
granulephp/util
lib/Map/ObjectMap.php
ObjectMap.values
public function values(string $collectionClass = null): Collection { return call_user_func([ $collectionClass ?: Collection\ArrayCollection::class, 'fromArray' ], $this->toArray()); }
php
public function values(string $collectionClass = null): Collection { return call_user_func([ $collectionClass ?: Collection\ArrayCollection::class, 'fromArray' ], $this->toArray()); }
[ "public", "function", "values", "(", "string", "$", "collectionClass", "=", "null", ")", ":", "Collection", "{", "return", "call_user_func", "(", "[", "$", "collectionClass", "?", ":", "Collection", "\\", "ArrayCollection", "::", "class", ",", "'fromArray'", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/granulephp/util/blob/8dcac627fbf9cf5e4219b6dec8ba8ad7c0a3186e/lib/Map/ObjectMap.php#L172-L176
nyeholt/silverstripe-simplewiki
thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/HTMLModule.php
HTMLPurifier_HTMLModule.parseContents
public function parseContents($contents) { if (!is_string($contents)) return array(null, null); // defer switch ($contents) { // check for shorthand content model forms case 'Empty': return array('empty', ''); case 'Inline': return arra...
php
public function parseContents($contents) { if (!is_string($contents)) return array(null, null); // defer switch ($contents) { // check for shorthand content model forms case 'Empty': return array('empty', ''); case 'Inline': return arra...
[ "public", "function", "parseContents", "(", "$", "contents", ")", "{", "if", "(", "!", "is_string", "(", "$", "contents", ")", ")", "return", "array", "(", "null", ",", "null", ")", ";", "// defer", "switch", "(", "$", "contents", ")", "{", "// check f...
Convenience function that transforms single-string contents into separate content model and content model type @param $contents Allowed children in form of: "$content_model_type: $content_model" @note If contents is an object, an array of two nulls will be returned, and the callee needs to take the original $contents a...
[ "Convenience", "function", "that", "transforms", "single", "-", "string", "contents", "into", "separate", "content", "model", "and", "content", "model", "type" ]
train
https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/HTMLModule.php#L185-L200
nyeholt/silverstripe-simplewiki
thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/HTMLModule.php
HTMLPurifier_HTMLModule.mergeInAttrIncludes
public function mergeInAttrIncludes(&$attr, $attr_includes) { if (!is_array($attr_includes)) { if (empty($attr_includes)) $attr_includes = array(); else $attr_includes = array($attr_includes); } $attr[0] = $attr_includes; }
php
public function mergeInAttrIncludes(&$attr, $attr_includes) { if (!is_array($attr_includes)) { if (empty($attr_includes)) $attr_includes = array(); else $attr_includes = array($attr_includes); } $attr[0] = $attr_includes; }
[ "public", "function", "mergeInAttrIncludes", "(", "&", "$", "attr", ",", "$", "attr_includes", ")", "{", "if", "(", "!", "is_array", "(", "$", "attr_includes", ")", ")", "{", "if", "(", "empty", "(", "$", "attr_includes", ")", ")", "$", "attr_includes", ...
Convenience function that merges a list of attribute includes into an attribute array. @param $attr Reference to attr array to modify @param $attr_includes Array of includes / string include to merge in
[ "Convenience", "function", "that", "merges", "a", "list", "of", "attribute", "includes", "into", "an", "attribute", "array", "." ]
train
https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/HTMLModule.php#L208-L214
nyeholt/silverstripe-simplewiki
thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/HTMLModule.php
HTMLPurifier_HTMLModule.makeLookup
public function makeLookup($list) { if (is_string($list)) $list = func_get_args(); $ret = array(); foreach ($list as $value) { if (is_null($value)) continue; $ret[$value] = true; } return $ret; }
php
public function makeLookup($list) { if (is_string($list)) $list = func_get_args(); $ret = array(); foreach ($list as $value) { if (is_null($value)) continue; $ret[$value] = true; } return $ret; }
[ "public", "function", "makeLookup", "(", "$", "list", ")", "{", "if", "(", "is_string", "(", "$", "list", ")", ")", "$", "list", "=", "func_get_args", "(", ")", ";", "$", "ret", "=", "array", "(", ")", ";", "foreach", "(", "$", "list", "as", "$",...
Convenience function that generates a lookup table with boolean true as value. @param $list List of values to turn into a lookup @note You can also pass an arbitrary number of arguments in place of the regular argument @return Lookup array equivalent of list
[ "Convenience", "function", "that", "generates", "a", "lookup", "table", "with", "boolean", "true", "as", "value", "." ]
train
https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/HTMLModule.php#L224-L232
wshafer/assetmanager-core
src/Resolver/FileResolverAbstract.php
FileResolverAbstract.resolveFile
public function resolveFile($file) { if (filter_var($file, FILTER_VALIDATE_URL)) { return $this->getHttpAsset($file); } return $this->getFileAsset($file); }
php
public function resolveFile($file) { if (filter_var($file, FILTER_VALIDATE_URL)) { return $this->getHttpAsset($file); } return $this->getFileAsset($file); }
[ "public", "function", "resolveFile", "(", "$", "file", ")", "{", "if", "(", "filter_var", "(", "$", "file", ",", "FILTER_VALIDATE_URL", ")", ")", "{", "return", "$", "this", "->", "getHttpAsset", "(", "$", "file", ")", ";", "}", "return", "$", "this", ...
{@inheritDoc}
[ "{" ]
train
https://github.com/wshafer/assetmanager-core/blob/b1bf9b3ab3b28f847fbe3f57d6c2c32b98c1431d/src/Resolver/FileResolverAbstract.php#L21-L28
wshafer/assetmanager-core
src/Resolver/FileResolverAbstract.php
FileResolverAbstract.getFileAsset
protected function getFileAsset($filePath) { $file = new \SplFileInfo($filePath); if (!$file->isReadable() || $file->isDir()) { return null; } $filePath = $file->getRealPath(); return new FileAsset($filePath); }
php
protected function getFileAsset($filePath) { $file = new \SplFileInfo($filePath); if (!$file->isReadable() || $file->isDir()) { return null; } $filePath = $file->getRealPath(); return new FileAsset($filePath); }
[ "protected", "function", "getFileAsset", "(", "$", "filePath", ")", "{", "$", "file", "=", "new", "\\", "SplFileInfo", "(", "$", "filePath", ")", ";", "if", "(", "!", "$", "file", "->", "isReadable", "(", ")", "||", "$", "file", "->", "isDir", "(", ...
Get a File Asset @param string $filePath @return FileAsset|null
[ "Get", "a", "File", "Asset" ]
train
https://github.com/wshafer/assetmanager-core/blob/b1bf9b3ab3b28f847fbe3f57d6c2c32b98c1431d/src/Resolver/FileResolverAbstract.php#L49-L60
joomla-projects/jorobo
src/Tasks/Build/Language.php
Language.run
public function run() { if ($this->type != "plu") { $this->analyze(); } if (!$this->hasAdminLang && !$this->hasFrontLang) { // No Language files return true; } $this->say("Building language for " . $this->ext . " | Type " . $this->type); // Make sure we have the language folders in our targ...
php
public function run() { if ($this->type != "plu") { $this->analyze(); } if (!$this->hasAdminLang && !$this->hasFrontLang) { // No Language files return true; } $this->say("Building language for " . $this->ext . " | Type " . $this->type); // Make sure we have the language folders in our targ...
[ "public", "function", "run", "(", ")", "{", "if", "(", "$", "this", "->", "type", "!=", "\"plu\"", ")", "{", "$", "this", "->", "analyze", "(", ")", ";", "}", "if", "(", "!", "$", "this", "->", "hasAdminLang", "&&", "!", "$", "this", "->", "has...
Returns true @return bool @since 1.0
[ "Returns", "true" ]
train
https://github.com/joomla-projects/jorobo/blob/e72dd0ed15f387739f67cacdbc2c0bd1b427f317/src/Tasks/Build/Language.php#L69-L139
joomla-projects/jorobo
src/Tasks/Build/Language.php
Language.analyze
private function analyze() { // Check for all languages here if (empty(glob($this->adminLangPath . "/*/*." . $this->ext . "*.ini"))) { $this->hasAdminLang = false; } if (empty(glob($this->frontLangPath . "/*/*." . $this->ext . "*.ini"))) { $this->hasFrontLang = false; } }
php
private function analyze() { // Check for all languages here if (empty(glob($this->adminLangPath . "/*/*." . $this->ext . "*.ini"))) { $this->hasAdminLang = false; } if (empty(glob($this->frontLangPath . "/*/*." . $this->ext . "*.ini"))) { $this->hasFrontLang = false; } }
[ "private", "function", "analyze", "(", ")", "{", "// Check for all languages here", "if", "(", "empty", "(", "glob", "(", "$", "this", "->", "adminLangPath", ".", "\"/*/*.\"", ".", "$", "this", "->", "ext", ".", "\"*.ini\"", ")", ")", ")", "{", "$", "thi...
Analyze the extension structure @return void @since 1.0
[ "Analyze", "the", "extension", "structure" ]
train
https://github.com/joomla-projects/jorobo/blob/e72dd0ed15f387739f67cacdbc2c0bd1b427f317/src/Tasks/Build/Language.php#L148-L160
joomla-projects/jorobo
src/Tasks/Build/Language.php
Language.prepareDirectories
private function prepareDirectories() { if ($this->type == "com") { if ($this->hasAdminLang) { $this->_mkdir($this->getBuildFolder() . "/administrator/language"); } if ($this->hasFrontLang) { $this->_mkdir($this->getBuildFolder() . "/language"); } } if ($this->type == "mod") { ...
php
private function prepareDirectories() { if ($this->type == "com") { if ($this->hasAdminLang) { $this->_mkdir($this->getBuildFolder() . "/administrator/language"); } if ($this->hasFrontLang) { $this->_mkdir($this->getBuildFolder() . "/language"); } } if ($this->type == "mod") { ...
[ "private", "function", "prepareDirectories", "(", ")", "{", "if", "(", "$", "this", "->", "type", "==", "\"com\"", ")", "{", "if", "(", "$", "this", "->", "hasAdminLang", ")", "{", "$", "this", "->", "_mkdir", "(", "$", "this", "->", "getBuildFolder", ...
Prepare the directory structure @return bool @since 1.0
[ "Prepare", "the", "directory", "structure" ]
train
https://github.com/joomla-projects/jorobo/blob/e72dd0ed15f387739f67cacdbc2c0bd1b427f317/src/Tasks/Build/Language.php#L169-L204
joomla-projects/jorobo
src/Tasks/Build/Language.php
Language.copyLanguage
public function copyLanguage($dir, $target) { // Equals administrator/language or language $path = $this->getSourceFolder() . "/" . $dir; $files = array(); $hdl = opendir($path); while ($entry = readdir($hdl)) { $p = $path . "/" . $entry; // Which languages do we have // Ignore hidden files ...
php
public function copyLanguage($dir, $target) { // Equals administrator/language or language $path = $this->getSourceFolder() . "/" . $dir; $files = array(); $hdl = opendir($path); while ($entry = readdir($hdl)) { $p = $path . "/" . $entry; // Which languages do we have // Ignore hidden files ...
[ "public", "function", "copyLanguage", "(", "$", "dir", ",", "$", "target", ")", "{", "// Equals administrator/language or language", "$", "path", "=", "$", "this", "->", "getSourceFolder", "(", ")", ".", "\"/\"", ".", "$", "dir", ";", "$", "files", "=", "a...
Copy language files @param string $dir The directory (administrator/language or language or mod_xy/language etc) @param String $target The target directory @return array @since 1.0
[ "Copy", "language", "files" ]
train
https://github.com/joomla-projects/jorobo/blob/e72dd0ed15f387739f67cacdbc2c0bd1b427f317/src/Tasks/Build/Language.php#L216-L260
mimmi20/Wurfl
src/Handlers/LGUPLUSHandler.php
LGUPLUSHandler.applyRecoveryMatch
public function applyRecoveryMatch($userAgent) { if (Utils::checkIfContainsAll( $userAgent, array('Windows NT 5', 'POLARIS') ) ) { return 'generic_lguplus_rexos_facebook_browser'; } if (Utils::checkIfContains($userAgent, 'Windows NT 5')) {...
php
public function applyRecoveryMatch($userAgent) { if (Utils::checkIfContainsAll( $userAgent, array('Windows NT 5', 'POLARIS') ) ) { return 'generic_lguplus_rexos_facebook_browser'; } if (Utils::checkIfContains($userAgent, 'Windows NT 5')) {...
[ "public", "function", "applyRecoveryMatch", "(", "$", "userAgent", ")", "{", "if", "(", "Utils", "::", "checkIfContainsAll", "(", "$", "userAgent", ",", "array", "(", "'Windows NT 5'", ",", "'POLARIS'", ")", ")", ")", "{", "return", "'generic_lguplus_rexos_faceb...
@param string $userAgent @return null|string
[ "@param", "string", "$userAgent" ]
train
https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/LGUPLUSHandler.php#L72-L103
skeeks-semenov/yii2-dadata-suggest-api
helpers/YandexGecodeHelper.php
YandexGecodeHelper.getYandexCoordinatesByAdress
static public function getYandexCoordinatesByAdress($addressString) { if ($data = static::getYandexFirstFutureMemeber($addressString)) { if ($coordinates = ArrayHelper::getValue($data, 'GeoObject.Point.pos')) { if ($coordinates) { ...
php
static public function getYandexCoordinatesByAdress($addressString) { if ($data = static::getYandexFirstFutureMemeber($addressString)) { if ($coordinates = ArrayHelper::getValue($data, 'GeoObject.Point.pos')) { if ($coordinates) { ...
[ "static", "public", "function", "getYandexCoordinatesByAdress", "(", "$", "addressString", ")", "{", "if", "(", "$", "data", "=", "static", "::", "getYandexFirstFutureMemeber", "(", "$", "addressString", ")", ")", "{", "if", "(", "$", "coordinates", "=", "Arra...
@param $addressString @return array
[ "@param", "$addressString" ]
train
https://github.com/skeeks-semenov/yii2-dadata-suggest-api/blob/9ff6e7af54344d059dce0ed08797880142d0ff6b/helpers/YandexGecodeHelper.php#L49-L64
skeeks-semenov/yii2-dadata-suggest-api
helpers/YandexGecodeHelper.php
YandexGecodeHelper.getYandexFirstFutureMemeber
static public function getYandexFirstFutureMemeber($addressString) { if ($data = static::getYandexData($addressString)) { if ($featureMember = ArrayHelper::getValue($data, 'response.GeoObjectCollection.featureMember')) { if (isset($featureMember[0])) ...
php
static public function getYandexFirstFutureMemeber($addressString) { if ($data = static::getYandexData($addressString)) { if ($featureMember = ArrayHelper::getValue($data, 'response.GeoObjectCollection.featureMember')) { if (isset($featureMember[0])) ...
[ "static", "public", "function", "getYandexFirstFutureMemeber", "(", "$", "addressString", ")", "{", "if", "(", "$", "data", "=", "static", "::", "getYandexData", "(", "$", "addressString", ")", ")", "{", "if", "(", "$", "featureMember", "=", "ArrayHelper", "...
TODO:: add cache @param $addressString @return array
[ "TODO", "::", "add", "cache", "@param", "$addressString" ]
train
https://github.com/skeeks-semenov/yii2-dadata-suggest-api/blob/9ff6e7af54344d059dce0ed08797880142d0ff6b/helpers/YandexGecodeHelper.php#L72-L86
skeeks-semenov/yii2-dadata-suggest-api
helpers/YandexGecodeHelper.php
YandexGecodeHelper.getYandexData
static public function getYandexData($addressString) { $request = (new Client([ 'formatters' => [ Client::FORMAT_JSON => JsonFormatter::class ] ]))->createRequest() ...
php
static public function getYandexData($addressString) { $request = (new Client([ 'formatters' => [ Client::FORMAT_JSON => JsonFormatter::class ] ]))->createRequest() ...
[ "static", "public", "function", "getYandexData", "(", "$", "addressString", ")", "{", "$", "request", "=", "(", "new", "Client", "(", "[", "'formatters'", "=>", "[", "Client", "::", "FORMAT_JSON", "=>", "JsonFormatter", "::", "class", "]", "]", ")", ")", ...
Полный ответ yandex api @param $address @return array
[ "Полный", "ответ", "yandex", "api" ]
train
https://github.com/skeeks-semenov/yii2-dadata-suggest-api/blob/9ff6e7af54344d059dce0ed08797880142d0ff6b/helpers/YandexGecodeHelper.php#L94-L115
markwatkinson/luminous
src/Luminous/Scanners/ScalaScanner.php
ScalaScanner.xmlOverride
public function xmlOverride($matches) { // this might just be an inequality, so we first need to disambiguate // that // 1.5 - the disambiguation is pretty simple, an XML tag must // follow either whitespace, (, or {, and the '<' must be followed // by '[!?_a-zA-Z] /...
php
public function xmlOverride($matches) { // this might just be an inequality, so we first need to disambiguate // that // 1.5 - the disambiguation is pretty simple, an XML tag must // follow either whitespace, (, or {, and the '<' must be followed // by '[!?_a-zA-Z] /...
[ "public", "function", "xmlOverride", "(", "$", "matches", ")", "{", "// this might just be an inequality, so we first need to disambiguate", "// that", "// 1.5 - the disambiguation is pretty simple, an XML tag must", "// follow either whitespace, (, or {, and the '<' must be followed", "// b...
Scala has XML literals.
[ "Scala", "has", "XML", "literals", "." ]
train
https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Scanners/ScalaScanner.php#L35-L76
ptlis/conneg
src/Preference/Matched/MatchedPreference.php
MatchedPreference.getVariant
public function getVariant() { // Special handling for language partial matches. These require that the returned variant name is the portion of // the language before the wildcard as this is what the application will be using to encode the response. if ($this->isLanguageWildcard()) { ...
php
public function getVariant() { // Special handling for language partial matches. These require that the returned variant name is the portion of // the language before the wildcard as this is what the application will be using to encode the response. if ($this->isLanguageWildcard()) { ...
[ "public", "function", "getVariant", "(", ")", "{", "// Special handling for language partial matches. These require that the returned variant name is the portion of", "// the language before the wildcard as this is what the application will be using to encode the response.", "if", "(", "$", "t...
Get the shared variant for this pair. @return string
[ "Get", "the", "shared", "variant", "for", "this", "pair", "." ]
train
https://github.com/ptlis/conneg/blob/04afb568f368ecdd81c13277006c4be041ccb58b/src/Preference/Matched/MatchedPreference.php#L75-L90
ptlis/conneg
src/Preference/Matched/MatchedPreference.php
MatchedPreference.isLanguageWildcard
private function isLanguageWildcard() { return PreferenceInterface::LANGUAGE === $this->fromField && PreferenceInterface::PARTIAL_WILDCARD === $this->serverPref->getPrecedence(); }
php
private function isLanguageWildcard() { return PreferenceInterface::LANGUAGE === $this->fromField && PreferenceInterface::PARTIAL_WILDCARD === $this->serverPref->getPrecedence(); }
[ "private", "function", "isLanguageWildcard", "(", ")", "{", "return", "PreferenceInterface", "::", "LANGUAGE", "===", "$", "this", "->", "fromField", "&&", "PreferenceInterface", "::", "PARTIAL_WILDCARD", "===", "$", "this", "->", "serverPref", "->", "getPrecedence"...
Returns true if the match was by partial language wildcard. @return bool
[ "Returns", "true", "if", "the", "match", "was", "by", "partial", "language", "wildcard", "." ]
train
https://github.com/ptlis/conneg/blob/04afb568f368ecdd81c13277006c4be041ccb58b/src/Preference/Matched/MatchedPreference.php#L97-L101
o2system/parser
src/Compiler.php
Compiler.loadFile
public function loadFile($filePath) { if ($filePath instanceof \SplFileInfo) { $filePath = $filePath->getRealPath(); } if (isset($this->sourceFileDirectory)) { if (is_file($this->sourceFileDirectory . $filePath)) { $filePath = $this->sourceFil...
php
public function loadFile($filePath) { if ($filePath instanceof \SplFileInfo) { $filePath = $filePath->getRealPath(); } if (isset($this->sourceFileDirectory)) { if (is_file($this->sourceFileDirectory . $filePath)) { $filePath = $this->sourceFil...
[ "public", "function", "loadFile", "(", "$", "filePath", ")", "{", "if", "(", "$", "filePath", "instanceof", "\\", "SplFileInfo", ")", "{", "$", "filePath", "=", "$", "filePath", "->", "getRealPath", "(", ")", ";", "}", "if", "(", "isset", "(", "$", "...
Compiler::loadFile @param string $filePath @return bool
[ "Compiler", "::", "loadFile" ]
train
https://github.com/o2system/parser/blob/1b85fe676ea043a500842e61731ab4d38e5323e4/src/Compiler.php#L142-L162
o2system/parser
src/Compiler.php
Compiler.loadString
public function loadString($string) { $this->sourceString = $string; if ($this->config->allowPhpScripts === false) { $this->sourceString = preg_replace( '/<\\?.*(\\?>|$)/Us', '', str_replace('<?=', '<?php echo ', $this->sourceStrin...
php
public function loadString($string) { $this->sourceString = $string; if ($this->config->allowPhpScripts === false) { $this->sourceString = preg_replace( '/<\\?.*(\\?>|$)/Us', '', str_replace('<?=', '<?php echo ', $this->sourceStrin...
[ "public", "function", "loadString", "(", "$", "string", ")", "{", "$", "this", "->", "sourceString", "=", "$", "string", ";", "if", "(", "$", "this", "->", "config", "->", "allowPhpScripts", "===", "false", ")", "{", "$", "this", "->", "sourceString", ...
Compiler::loadString @param string $string @return bool
[ "Compiler", "::", "loadString" ]
train
https://github.com/o2system/parser/blob/1b85fe676ea043a500842e61731ab4d38e5323e4/src/Compiler.php#L173-L198
o2system/parser
src/Compiler.php
Compiler.parse
public function parse(array $vars = []) { $this->loadVars($vars); $output = $this->parsePhp(); // Run Template Engines $output = $this->template->parse($output, $this->vars); // Run String Engines $output = $this->string->parse($output, $this->vars); ...
php
public function parse(array $vars = []) { $this->loadVars($vars); $output = $this->parsePhp(); // Run Template Engines $output = $this->template->parse($output, $this->vars); // Run String Engines $output = $this->string->parse($output, $this->vars); ...
[ "public", "function", "parse", "(", "array", "$", "vars", "=", "[", "]", ")", "{", "$", "this", "->", "loadVars", "(", "$", "vars", ")", ";", "$", "output", "=", "$", "this", "->", "parsePhp", "(", ")", ";", "// Run Template Engines\r", "$", "output"...
Compiler::parse @param array $vars @return bool|string Returns FALSE if failed.
[ "Compiler", "::", "parse" ]
train
https://github.com/o2system/parser/blob/1b85fe676ea043a500842e61731ab4d38e5323e4/src/Compiler.php#L233-L246
o2system/parser
src/Compiler.php
Compiler.parsePhp
public function parsePhp(array $vars = []) { if(count($vars)) { $this->loadVars($vars); } extract($this->vars); /* * Buffer the output * * We buffer the output for two reasons: * 1. Speed. You get a significant speed boost...
php
public function parsePhp(array $vars = []) { if(count($vars)) { $this->loadVars($vars); } extract($this->vars); /* * Buffer the output * * We buffer the output for two reasons: * 1. Speed. You get a significant speed boost...
[ "public", "function", "parsePhp", "(", "array", "$", "vars", "=", "[", "]", ")", "{", "if", "(", "count", "(", "$", "vars", ")", ")", "{", "$", "this", "->", "loadVars", "(", "$", "vars", ")", ";", "}", "extract", "(", "$", "this", "->", "vars"...
Compiler::parsePhp @param array $vars @return bool|string Returns FALSE if failed
[ "Compiler", "::", "parsePhp" ]
train
https://github.com/o2system/parser/blob/1b85fe676ea043a500842e61731ab4d38e5323e4/src/Compiler.php#L257-L290
o2system/parser
src/Compiler.php
Compiler.loadVars
public function loadVars(array $vars) { $this->vars = array_merge($this->vars, $vars); return (bool)empty($this->vars); }
php
public function loadVars(array $vars) { $this->vars = array_merge($this->vars, $vars); return (bool)empty($this->vars); }
[ "public", "function", "loadVars", "(", "array", "$", "vars", ")", "{", "$", "this", "->", "vars", "=", "array_merge", "(", "$", "this", "->", "vars", ",", "$", "vars", ")", ";", "return", "(", "bool", ")", "empty", "(", "$", "this", "->", "vars", ...
Compiler::loadVars @param array $vars @return bool
[ "Compiler", "::", "loadVars" ]
train
https://github.com/o2system/parser/blob/1b85fe676ea043a500842e61731ab4d38e5323e4/src/Compiler.php#L301-L306
mimmi20/Wurfl
src/Handlers/Normalizer/Specific/OperaMobiOrTabletOnAndroid.php
OperaMobiOrTabletOnAndroid.normalize
public function normalize($userAgent) { $isOperaMobile = Utils::checkIfContains($userAgent, 'Opera Mobi'); $isOperaTablet = Utils::checkIfContains($userAgent, 'Opera Tablet'); if ($isOperaMobile || $isOperaTablet) { $operaVersion = OperaMobiOrTabletOnAndroidHandler::getOperaOn...
php
public function normalize($userAgent) { $isOperaMobile = Utils::checkIfContains($userAgent, 'Opera Mobi'); $isOperaTablet = Utils::checkIfContains($userAgent, 'Opera Tablet'); if ($isOperaMobile || $isOperaTablet) { $operaVersion = OperaMobiOrTabletOnAndroidHandler::getOperaOn...
[ "public", "function", "normalize", "(", "$", "userAgent", ")", "{", "$", "isOperaMobile", "=", "Utils", "::", "checkIfContains", "(", "$", "userAgent", ",", "'Opera Mobi'", ")", ";", "$", "isOperaTablet", "=", "Utils", "::", "checkIfContains", "(", "$", "use...
@param string $userAgent @return string
[ "@param", "string", "$userAgent" ]
train
https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/Normalizer/Specific/OperaMobiOrTabletOnAndroid.php#L37-L55
DevGroup-ru/yii2-data-structure-tools
src/propertyHandler/StaticValues.php
StaticValues.beforePropertyModelSave
public function beforePropertyModelSave(Property &$property, $insert) { // static values are forced to be of integer data type $property->data_type = Property::DATA_TYPE_INTEGER; return parent::beforePropertyModelSave($property, $insert); }
php
public function beforePropertyModelSave(Property &$property, $insert) { // static values are forced to be of integer data type $property->data_type = Property::DATA_TYPE_INTEGER; return parent::beforePropertyModelSave($property, $insert); }
[ "public", "function", "beforePropertyModelSave", "(", "Property", "&", "$", "property", ",", "$", "insert", ")", "{", "// static values are forced to be of integer data type", "$", "property", "->", "data_type", "=", "Property", "::", "DATA_TYPE_INTEGER", ";", "return",...
Forces property to be of integer data type @param \DevGroup\DataStructure\models\Property $property @param $insert @return bool
[ "Forces", "property", "to", "be", "of", "integer", "data", "type", "@param", "\\", "DevGroup", "\\", "DataStructure", "\\", "models", "\\", "Property", "$property", "@param", "$insert" ]
train
https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/propertyHandler/StaticValues.php#L56-L61
DevGroup-ru/yii2-data-structure-tools
src/propertyHandler/StaticValues.php
StaticValues.existenceValidation
private function existenceValidation(Property $property) { $key = $property->key; return [ $key, 'exist', 'targetClass' => StaticValue::className(), 'targetAttribute' => 'id', 'allowArray' => $property->allow_multiple_values, '...
php
private function existenceValidation(Property $property) { $key = $property->key; return [ $key, 'exist', 'targetClass' => StaticValue::className(), 'targetAttribute' => 'id', 'allowArray' => $property->allow_multiple_values, '...
[ "private", "function", "existenceValidation", "(", "Property", "$", "property", ")", "{", "$", "key", "=", "$", "property", "->", "key", ";", "return", "[", "$", "key", ",", "'exist'", ",", "'targetClass'", "=>", "StaticValue", "::", "className", "(", ")",...
@param Property $property @return array Validation rule for checking existence of static_value row with specified ID @warning If we are updating multiple models properties at once - we get lots of queries to db(1 for each model in array)
[ "@param", "Property", "$property", "@return", "array", "Validation", "rule", "for", "checking", "existence", "of", "static_value", "row", "with", "specified", "ID" ]
train
https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/propertyHandler/StaticValues.php#L88-L102
PandaPlatform/framework
src/Panda/Support/Configuration/Handlers/ViewsConfiguration.php
ViewsConfiguration.getViewsPath
public function getViewsPath($basePath = null) { $views = $this->get('views'); if (empty($views)) { // Fallback to default return $basePath . DIRECTORY_SEPARATOR . 'resources' . DIRECTORY_SEPARATOR . 'views'; } return $basePath . DIRECTORY_SEPARATOR . $views[...
php
public function getViewsPath($basePath = null) { $views = $this->get('views'); if (empty($views)) { // Fallback to default return $basePath . DIRECTORY_SEPARATOR . 'resources' . DIRECTORY_SEPARATOR . 'views'; } return $basePath . DIRECTORY_SEPARATOR . $views[...
[ "public", "function", "getViewsPath", "(", "$", "basePath", "=", "null", ")", "{", "$", "views", "=", "$", "this", "->", "get", "(", "'views'", ")", ";", "if", "(", "empty", "(", "$", "views", ")", ")", "{", "// Fallback to default", "return", "$", "...
@param string $basePath @return string
[ "@param", "string", "$basePath" ]
train
https://github.com/PandaPlatform/framework/blob/a78cf051b379896b5a4d5df620988e37a0e632f5/src/Panda/Support/Configuration/Handlers/ViewsConfiguration.php#L27-L36
antarestupin/Accessible
lib/Accessible/AutomatedBehaviorTrait.php
AutomatedBehaviorTrait.assertPropertyValue
protected function assertPropertyValue($property, $value) { $this->getPropertiesInfo(); if ($this->_constraintsValidationEnabled) { $constraintsViolations = ConstraintsReader::validatePropertyValue($this, $property, $value); if ($constraintsViolations->count()) { ...
php
protected function assertPropertyValue($property, $value) { $this->getPropertiesInfo(); if ($this->_constraintsValidationEnabled) { $constraintsViolations = ConstraintsReader::validatePropertyValue($this, $property, $value); if ($constraintsViolations->count()) { ...
[ "protected", "function", "assertPropertyValue", "(", "$", "property", ",", "$", "value", ")", "{", "$", "this", "->", "getPropertiesInfo", "(", ")", ";", "if", "(", "$", "this", "->", "_constraintsValidationEnabled", ")", "{", "$", "constraintsViolations", "="...
Validates the given value compared to given property constraints. If the value is not valid, an InvalidArgumentException will be thrown. @param string $property The name of the reference property. @param mixed $value The value to check. @throws \InvalidArgumentException If the value is not valid.
[ "Validates", "the", "given", "value", "compared", "to", "given", "property", "constraints", ".", "If", "the", "value", "is", "not", "valid", "an", "InvalidArgumentException", "will", "be", "thrown", "." ]
train
https://github.com/antarestupin/Accessible/blob/d12ce93d72f74c099dfd2109371fcd6ddfffdca4/lib/Accessible/AutomatedBehaviorTrait.php#L110-L127
antarestupin/Accessible
lib/Accessible/AutomatedBehaviorTrait.php
AutomatedBehaviorTrait.updatePropertyAssociation
protected function updatePropertyAssociation($property, array $values) { $this->getPropertiesInfo(); $oldValue = empty($values['oldValue']) ? null : $values['oldValue']; $newValue = empty($values['newValue']) ? null : $values['newValue']; $association = $this->_associationsList[$pr...
php
protected function updatePropertyAssociation($property, array $values) { $this->getPropertiesInfo(); $oldValue = empty($values['oldValue']) ? null : $values['oldValue']; $newValue = empty($values['newValue']) ? null : $values['newValue']; $association = $this->_associationsList[$pr...
[ "protected", "function", "updatePropertyAssociation", "(", "$", "property", ",", "array", "$", "values", ")", "{", "$", "this", "->", "getPropertiesInfo", "(", ")", ";", "$", "oldValue", "=", "empty", "(", "$", "values", "[", "'oldValue'", "]", ")", "?", ...
Update the property associated to the given property. You can pass the old or the new value given to the property. @param string $property The property of the current class to update @param object $values An array of old a new value under the following form: ['oldValue' => $oldvalue, 'newValue' => $newValue] If on...
[ "Update", "the", "property", "associated", "to", "the", "given", "property", ".", "You", "can", "pass", "the", "old", "or", "the", "new", "value", "given", "to", "the", "property", "." ]
train
https://github.com/antarestupin/Accessible/blob/d12ce93d72f74c099dfd2109371fcd6ddfffdca4/lib/Accessible/AutomatedBehaviorTrait.php#L138-L175
antarestupin/Accessible
lib/Accessible/AutomatedBehaviorTrait.php
AutomatedBehaviorTrait.getPropertiesInfo
private function getPropertiesInfo() { if (!$this->_automatedBehaviorInitialized) { $classInfo = Reader::getClassInformation($this); $this->_accessProperties = $classInfo['accessProperties']; $this->_collectionsItemNames = $classInfo['collectionsItemNames']; ...
php
private function getPropertiesInfo() { if (!$this->_automatedBehaviorInitialized) { $classInfo = Reader::getClassInformation($this); $this->_accessProperties = $classInfo['accessProperties']; $this->_collectionsItemNames = $classInfo['collectionsItemNames']; ...
[ "private", "function", "getPropertiesInfo", "(", ")", "{", "if", "(", "!", "$", "this", "->", "_automatedBehaviorInitialized", ")", "{", "$", "classInfo", "=", "Reader", "::", "getClassInformation", "(", "$", "this", ")", ";", "$", "this", "->", "_accessProp...
Get every information needed from this class.
[ "Get", "every", "information", "needed", "from", "this", "class", "." ]
train
https://github.com/antarestupin/Accessible/blob/d12ce93d72f74c099dfd2109371fcd6ddfffdca4/lib/Accessible/AutomatedBehaviorTrait.php#L180-L197
venta/framework
src/Console/src/Command/SignatureParser.php
SignatureParser.defineType
private function defineType($array = false, $optional = false): int { $type = ($optional) ? InputArgument::OPTIONAL : InputArgument::REQUIRED; if ($array) { $type = InputArgument::IS_ARRAY | $type; } return $type; }
php
private function defineType($array = false, $optional = false): int { $type = ($optional) ? InputArgument::OPTIONAL : InputArgument::REQUIRED; if ($array) { $type = InputArgument::IS_ARRAY | $type; } return $type; }
[ "private", "function", "defineType", "(", "$", "array", "=", "false", ",", "$", "optional", "=", "false", ")", ":", "int", "{", "$", "type", "=", "(", "$", "optional", ")", "?", "InputArgument", "::", "OPTIONAL", ":", "InputArgument", "::", "REQUIRED", ...
Defines type of an argument or option based on options @param bool $array @param bool $optional @return int
[ "Defines", "type", "of", "an", "argument", "or", "option", "based", "on", "options" ]
train
https://github.com/venta/framework/blob/514a7854cc69f84f47e62a58cc55efd68b7c9f83/src/Console/src/Command/SignatureParser.php#L57-L66
venta/framework
src/Console/src/Command/SignatureParser.php
SignatureParser.parseParameters
private function parseParameters(): array { $arguments = []; $options = []; $signatureArguments = $this->getParameters(); foreach ($signatureArguments as $value) { $item = []; $matches = []; $exploded = explode(':', $value); if (count...
php
private function parseParameters(): array { $arguments = []; $options = []; $signatureArguments = $this->getParameters(); foreach ($signatureArguments as $value) { $item = []; $matches = []; $exploded = explode(':', $value); if (count...
[ "private", "function", "parseParameters", "(", ")", ":", "array", "{", "$", "arguments", "=", "[", "]", ";", "$", "options", "=", "[", "]", ";", "$", "signatureArguments", "=", "$", "this", "->", "getParameters", "(", ")", ";", "foreach", "(", "$", "...
Parses arguments and options from signature string, returns an array with definitions @return array
[ "Parses", "arguments", "and", "options", "from", "signature", "string", "returns", "an", "array", "with", "definitions" ]
train
https://github.com/venta/framework/blob/514a7854cc69f84f47e62a58cc55efd68b7c9f83/src/Console/src/Command/SignatureParser.php#L87-L120
cicada/cicada
src/RequestProcessorTrait.php
RequestProcessorTrait.invokeBefore
private function invokeBefore(array $namedParams, array $classParams) { $invoker = new Invoker(); foreach ($this->before as $function) { $response = $invoker->invoke($function, $namedParams, $classParams); if ($response !== null) { return $response; ...
php
private function invokeBefore(array $namedParams, array $classParams) { $invoker = new Invoker(); foreach ($this->before as $function) { $response = $invoker->invoke($function, $namedParams, $classParams); if ($response !== null) { return $response; ...
[ "private", "function", "invokeBefore", "(", "array", "$", "namedParams", ",", "array", "$", "classParams", ")", "{", "$", "invoker", "=", "new", "Invoker", "(", ")", ";", "foreach", "(", "$", "this", "->", "before", "as", "$", "function", ")", "{", "$"...
Invokes callbacks from `$this->before`, and if any of them returns a Response stops processing others and returns the given response.
[ "Invokes", "callbacks", "from", "$this", "-", ">", "before", "and", "if", "any", "of", "them", "returns", "a", "Response", "stops", "processing", "others", "and", "returns", "the", "given", "response", "." ]
train
https://github.com/cicada/cicada/blob/5a54bd05dfa1df38e7aa3d704d270853f0329e13/src/RequestProcessorTrait.php#L93-L102
cicada/cicada
src/RequestProcessorTrait.php
RequestProcessorTrait.invokeAfter
private function invokeAfter(array $namedParams, array $classParams) { $invoker = new Invoker(); foreach ($this->after as $function) { $invoker->invoke($function, $namedParams, $classParams); } }
php
private function invokeAfter(array $namedParams, array $classParams) { $invoker = new Invoker(); foreach ($this->after as $function) { $invoker->invoke($function, $namedParams, $classParams); } }
[ "private", "function", "invokeAfter", "(", "array", "$", "namedParams", ",", "array", "$", "classParams", ")", "{", "$", "invoker", "=", "new", "Invoker", "(", ")", ";", "foreach", "(", "$", "this", "->", "after", "as", "$", "function", ")", "{", "$", ...
Invokes the callbacks from `$this->after`, ignoring any returned values.
[ "Invokes", "the", "callbacks", "from", "$this", "-", ">", "after", "ignoring", "any", "returned", "values", "." ]
train
https://github.com/cicada/cicada/blob/5a54bd05dfa1df38e7aa3d704d270853f0329e13/src/RequestProcessorTrait.php#L107-L113
mimmi20/Wurfl
src/Handlers/Normalizer/Specific/Android.php
Android.normalize
public function normalize($userAgent) { // Normalize Android version $model = AndroidHandler::getAndroidModel($userAgent, false); $version = AndroidHandler::getAndroidVersion($userAgent, false); if ($model !== null && $version !== null) { $prefix = $version . ' ' . $mod...
php
public function normalize($userAgent) { // Normalize Android version $model = AndroidHandler::getAndroidModel($userAgent, false); $version = AndroidHandler::getAndroidVersion($userAgent, false); if ($model !== null && $version !== null) { $prefix = $version . ' ' . $mod...
[ "public", "function", "normalize", "(", "$", "userAgent", ")", "{", "// Normalize Android version", "$", "model", "=", "AndroidHandler", "::", "getAndroidModel", "(", "$", "userAgent", ",", "false", ")", ";", "$", "version", "=", "AndroidHandler", "::", "getAndr...
@param string $userAgent @return string
[ "@param", "string", "$userAgent" ]
train
https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/Normalizer/Specific/Android.php#L35-L47
fetus-hina/docomo-dialogue
src/validators/Text.php
Text.validate
public static function validate($value, $maxLen, $errorMessage) { if (mb_strlen($value, 'UTF-8') <= $maxLen) { return true; } throw new DomainError($errorMessage); }
php
public static function validate($value, $maxLen, $errorMessage) { if (mb_strlen($value, 'UTF-8') <= $maxLen) { return true; } throw new DomainError($errorMessage); }
[ "public", "static", "function", "validate", "(", "$", "value", ",", "$", "maxLen", ",", "$", "errorMessage", ")", "{", "if", "(", "mb_strlen", "(", "$", "value", ",", "'UTF-8'", ")", "<=", "$", "maxLen", ")", "{", "return", "true", ";", "}", "throw",...
文字列を検査する @param string $value 対象にする文字列 @param int $maxLen 許容される文字列の最大長 @param string $errorMessage 異常時に発生する例外のメッセージ @throws \jp3cki\docomoDialogue\DomainError
[ "文字列を検査する" ]
train
https://github.com/fetus-hina/docomo-dialogue/blob/cf985fdc93c09f93181081038eccd1d2dbb3f08c/src/validators/Text.php#L27-L33
wangsir0624/queue
src/Worker.php
Worker.bootstrap
protected function bootstrap() { if($this->_isBooted) { return; } swoole_set_process_name($this->name . ':master'); $this->installSignals(); $this->_isBooted = true; }
php
protected function bootstrap() { if($this->_isBooted) { return; } swoole_set_process_name($this->name . ':master'); $this->installSignals(); $this->_isBooted = true; }
[ "protected", "function", "bootstrap", "(", ")", "{", "if", "(", "$", "this", "->", "_isBooted", ")", "{", "return", ";", "}", "swoole_set_process_name", "(", "$", "this", "->", "name", ".", "':master'", ")", ";", "$", "this", "->", "installSignals", "(",...
bootstrap the worker
[ "bootstrap", "the", "worker" ]
train
https://github.com/wangsir0624/queue/blob/10541f9694b5d9759329ae908033dd3097ce6923/src/Worker.php#L149-L158
wangsir0624/queue
src/Worker.php
Worker.installSignals
protected function installSignals() { $worker = $this; swoole_process::signal(SIGTERM, function() use($worker) { $worker->stop(); }); swoole_process::signal(SIGINT, function() use($worker) { $worker->stop(); }); swoole_process::signal(SIGQUIT, ...
php
protected function installSignals() { $worker = $this; swoole_process::signal(SIGTERM, function() use($worker) { $worker->stop(); }); swoole_process::signal(SIGINT, function() use($worker) { $worker->stop(); }); swoole_process::signal(SIGQUIT, ...
[ "protected", "function", "installSignals", "(", ")", "{", "$", "worker", "=", "$", "this", ";", "swoole_process", "::", "signal", "(", "SIGTERM", ",", "function", "(", ")", "use", "(", "$", "worker", ")", "{", "$", "worker", "->", "stop", "(", ")", "...
register master signal handlers
[ "register", "master", "signal", "handlers" ]
train
https://github.com/wangsir0624/queue/blob/10541f9694b5d9759329ae908033dd3097ce6923/src/Worker.php#L163-L178
wangsir0624/queue
src/Worker.php
Worker.handleWorkerExit
protected function handleWorkerExit() { $result = swoole_process::wait(); if(!empty($this->_noRestartProcesses[$result['pid']])) { unset($this->_noRestartProcesses[$result['pid']]); return; } if($result['signal'] > 0) { if($this->restartPolicy & ...
php
protected function handleWorkerExit() { $result = swoole_process::wait(); if(!empty($this->_noRestartProcesses[$result['pid']])) { unset($this->_noRestartProcesses[$result['pid']]); return; } if($result['signal'] > 0) { if($this->restartPolicy & ...
[ "protected", "function", "handleWorkerExit", "(", ")", "{", "$", "result", "=", "swoole_process", "::", "wait", "(", ")", ";", "if", "(", "!", "empty", "(", "$", "this", "->", "_noRestartProcesses", "[", "$", "result", "[", "'pid'", "]", "]", ")", ")",...
handler worker exit signal
[ "handler", "worker", "exit", "signal" ]
train
https://github.com/wangsir0624/queue/blob/10541f9694b5d9759329ae908033dd3097ce6923/src/Worker.php#L213-L244
wangsir0624/queue
src/Worker.php
Worker.forkOneWorker
protected function forkOneWorker() { $worker = $this; $process = new swoole_process(function (swoole_process $process) use ($worker) { swoole_set_process_name($worker->name . ':worker'); call_user_func($worker->_work, $process); }, false, false); $pid = $pro...
php
protected function forkOneWorker() { $worker = $this; $process = new swoole_process(function (swoole_process $process) use ($worker) { swoole_set_process_name($worker->name . ':worker'); call_user_func($worker->_work, $process); }, false, false); $pid = $pro...
[ "protected", "function", "forkOneWorker", "(", ")", "{", "$", "worker", "=", "$", "this", ";", "$", "process", "=", "new", "swoole_process", "(", "function", "(", "swoole_process", "$", "process", ")", "use", "(", "$", "worker", ")", "{", "swoole_set_proce...
create a worker process @return bool
[ "create", "a", "worker", "process" ]
train
https://github.com/wangsir0624/queue/blob/10541f9694b5d9759329ae908033dd3097ce6923/src/Worker.php#L260-L277
wangsir0624/queue
src/Worker.php
Worker.tooManyErrors
protected function tooManyErrors() { $count = count($this->_errors); if($count < $this->maxErrorTimes) { return false; } return ($this->_errors[$count - 1] - $this->_errors[$count - $this->maxErrorTimes]) <= $this->errorInterval; }
php
protected function tooManyErrors() { $count = count($this->_errors); if($count < $this->maxErrorTimes) { return false; } return ($this->_errors[$count - 1] - $this->_errors[$count - $this->maxErrorTimes]) <= $this->errorInterval; }
[ "protected", "function", "tooManyErrors", "(", ")", "{", "$", "count", "=", "count", "(", "$", "this", "->", "_errors", ")", ";", "if", "(", "$", "count", "<", "$", "this", "->", "maxErrorTimes", ")", "{", "return", "false", ";", "}", "return", "(", ...
whether exceed the maximum error frequency @return bool
[ "whether", "exceed", "the", "maximum", "error", "frequency" ]
train
https://github.com/wangsir0624/queue/blob/10541f9694b5d9759329ae908033dd3097ce6923/src/Worker.php#L283-L291
crysalead/net
src/Http/Psr7/RequestTrait.php
RequestTrait.withRequestTarget
public function withRequestTarget($requestTarget) { $request = clone $this; if (preg_match('~^(?:[a-z]+:)?//~i', $requestTarget)) { $result = parse_url($requestTarget); if (isset($result['user'])) { $result['username'] = $result['user']; unset(...
php
public function withRequestTarget($requestTarget) { $request = clone $this; if (preg_match('~^(?:[a-z]+:)?//~i', $requestTarget)) { $result = parse_url($requestTarget); if (isset($result['user'])) { $result['username'] = $result['user']; unset(...
[ "public", "function", "withRequestTarget", "(", "$", "requestTarget", ")", "{", "$", "request", "=", "clone", "$", "this", ";", "if", "(", "preg_match", "(", "'~^(?:[a-z]+:)?//~i'", ",", "$", "requestTarget", ")", ")", "{", "$", "result", "=", "parse_url", ...
Returns a new instance with the specific request-target. If the request needs a non-origin-form request-target — e.g., for specifying an absolute-form, authority-form, or asterisk-form — this method may be used to create an instance with the specified request-target, verbatim. @link http://tools.ietf.org/html/rfc7230...
[ "Returns", "a", "new", "instance", "with", "the", "specific", "request", "-", "target", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Psr7/RequestTrait.php#L75-L115
crysalead/net
src/Http/Psr7/RequestTrait.php
RequestTrait.getUri
public function getUri() { $uri = new Uri($this->url()); if ($this->username()) { $uri = $uri->withUserInfo($this->username(), $this->password()); } return $uri; }
php
public function getUri() { $uri = new Uri($this->url()); if ($this->username()) { $uri = $uri->withUserInfo($this->username(), $this->password()); } return $uri; }
[ "public", "function", "getUri", "(", ")", "{", "$", "uri", "=", "new", "Uri", "(", "$", "this", "->", "url", "(", ")", ")", ";", "if", "(", "$", "this", "->", "username", "(", ")", ")", "{", "$", "uri", "=", "$", "uri", "->", "withUserInfo", ...
Retrieves the URI instance. Updating the URI will have no effect on the request. use `withUri()` to apply any changes. @link http://tools.ietf.org/html/rfc3986#section-4.3 @return UriInterface Returns a UriInterface instance representing the URI of the request.
[ "Retrieves", "the", "URI", "instance", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Psr7/RequestTrait.php#L126-L133
crysalead/net
src/Http/Psr7/RequestTrait.php
RequestTrait.withUri
public function withUri(UriInterface $uri, $preserveHost = false) { $request = clone $this; $request->scheme($uri->getScheme()); $userInfo = $uri->getUserInfo(); $parts = explode(':', $userInfo); $request->username($parts[0] ?: null); $request->password(!empty($parts...
php
public function withUri(UriInterface $uri, $preserveHost = false) { $request = clone $this; $request->scheme($uri->getScheme()); $userInfo = $uri->getUserInfo(); $parts = explode(':', $userInfo); $request->username($parts[0] ?: null); $request->password(!empty($parts...
[ "public", "function", "withUri", "(", "UriInterface", "$", "uri", ",", "$", "preserveHost", "=", "false", ")", "{", "$", "request", "=", "clone", "$", "this", ";", "$", "request", "->", "scheme", "(", "$", "uri", "->", "getScheme", "(", ")", ")", ";"...
Returns an instance with the provided URI. This method MUST update the Host header of the returned request by default if the URI contains a host component. If the URI does not contain a host component, any pre-existing Host header MUST be carried over to the returned request. You can opt-in to preserving the original...
[ "Returns", "an", "instance", "with", "the", "provided", "URI", "." ]
train
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Psr7/RequestTrait.php#L162-L182
bariew/yii2-rbac-cms-module
models/search/AuthRuleSearch.php
AuthRuleSearch.search
public function search($params) { $query = AuthRule::find(); $dataProvider = new ActiveDataProvider([ 'query' => $query, ]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere([ 'c...
php
public function search($params) { $query = AuthRule::find(); $dataProvider = new ActiveDataProvider([ 'query' => $query, ]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere([ 'c...
[ "public", "function", "search", "(", "$", "params", ")", "{", "$", "query", "=", "AuthRule", "::", "find", "(", ")", ";", "$", "dataProvider", "=", "new", "ActiveDataProvider", "(", "[", "'query'", "=>", "$", "query", ",", "]", ")", ";", "if", "(", ...
Creates data provider instance with search query applied @param array $params @return ActiveDataProvider
[ "Creates", "data", "provider", "instance", "with", "search", "query", "applied" ]
train
https://github.com/bariew/yii2-rbac-cms-module/blob/c1f0fd05bf6d1951a3fd929d974e6f4cc2b52262/models/search/AuthRuleSearch.php#L37-L53
boxberry-delivery/php-api-common
src/Helper.php
Helper.getDeliveryShortName
public static function getDeliveryShortName($className) { if (0 === strpos($className, '\\')) { $className = substr($className, 1); } if (0 === strpos($className, 'Boxberry\\')) { return trim(str_replace('\\', '_', substr($className, 8, -7)), '_'); } ...
php
public static function getDeliveryShortName($className) { if (0 === strpos($className, '\\')) { $className = substr($className, 1); } if (0 === strpos($className, 'Boxberry\\')) { return trim(str_replace('\\', '_', substr($className, 8, -7)), '_'); } ...
[ "public", "static", "function", "getDeliveryShortName", "(", "$", "className", ")", "{", "if", "(", "0", "===", "strpos", "(", "$", "className", ",", "'\\\\'", ")", ")", "{", "$", "className", "=", "substr", "(", "$", "className", ",", "1", ")", ";", ...
@internal @param $className @return string
[ "@internal" ]
train
https://github.com/boxberry-delivery/php-api-common/blob/4fab9ad184968ead3bfcb98b491e289bfb589098/src/Helper.php#L91-L101
boxberry-delivery/php-api-common
src/Helper.php
Helper.getDeliveryClassName
public static function getDeliveryClassName($shortName) { if (0 === strpos($shortName, '\\')) { return $shortName; } $shortName = str_replace('_', '\\', $shortName); if (false === strpos($shortName, '\\')) { $shortName .= '\\'; } return '\\Bo...
php
public static function getDeliveryClassName($shortName) { if (0 === strpos($shortName, '\\')) { return $shortName; } $shortName = str_replace('_', '\\', $shortName); if (false === strpos($shortName, '\\')) { $shortName .= '\\'; } return '\\Bo...
[ "public", "static", "function", "getDeliveryClassName", "(", "$", "shortName", ")", "{", "if", "(", "0", "===", "strpos", "(", "$", "shortName", ",", "'\\\\'", ")", ")", "{", "return", "$", "shortName", ";", "}", "$", "shortName", "=", "str_replace", "("...
@param string $shortName @return string
[ "@param", "string", "$shortName" ]
train
https://github.com/boxberry-delivery/php-api-common/blob/4fab9ad184968ead3bfcb98b491e289bfb589098/src/Helper.php#L108-L120
phlib/beanstalk
src/Command/StatsTrait.php
StatsTrait.decode
protected function decode($response) { $lines = array_slice(explode("\n", trim($response)), 1); $result = []; foreach ($lines as $line) { if ($line[0] == '-') { $result[] = trim(ltrim($line, '- ')); } else { $key = strtok($line, ': ');...
php
protected function decode($response) { $lines = array_slice(explode("\n", trim($response)), 1); $result = []; foreach ($lines as $line) { if ($line[0] == '-') { $result[] = trim(ltrim($line, '- ')); } else { $key = strtok($line, ': ');...
[ "protected", "function", "decode", "(", "$", "response", ")", "{", "$", "lines", "=", "array_slice", "(", "explode", "(", "\"\\n\"", ",", "trim", "(", "$", "response", ")", ")", ",", "1", ")", ";", "$", "result", "=", "[", "]", ";", "foreach", "(",...
Decodes the YAML string into an array of data. @param string $response @return array
[ "Decodes", "the", "YAML", "string", "into", "an", "array", "of", "data", "." ]
train
https://github.com/phlib/beanstalk/blob/cc37083f506b65a5f005ca7a8920072d292a1d83/src/Command/StatsTrait.php#L45-L68
ipunkt/social-auth
src/migrations/2014_10_14_155418_alter_social_profiles_add_profile_fields.php
AlterSocialProfilesAddProfileFields.up
public function up() { Schema::table('social_profiles', function($table) { $table->string('profile_url')->nullable(); $table->string('website_url')->nullable(); $table->string('photo_url')->nullable(); $table->string('display_name')->nullable(); $table->string('description')->nullable(); $table->st...
php
public function up() { Schema::table('social_profiles', function($table) { $table->string('profile_url')->nullable(); $table->string('website_url')->nullable(); $table->string('photo_url')->nullable(); $table->string('display_name')->nullable(); $table->string('description')->nullable(); $table->st...
[ "public", "function", "up", "(", ")", "{", "Schema", "::", "table", "(", "'social_profiles'", ",", "function", "(", "$", "table", ")", "{", "$", "table", "->", "string", "(", "'profile_url'", ")", "->", "nullable", "(", ")", ";", "$", "table", "->", ...
Run the migrations. @return void
[ "Run", "the", "migrations", "." ]
train
https://github.com/ipunkt/social-auth/blob/28723a8e449612789a2cd7d21137996c48b62229/src/migrations/2014_10_14_155418_alter_social_profiles_add_profile_fields.php#L13-L38
ipunkt/social-auth
src/migrations/2014_10_14_155418_alter_social_profiles_add_profile_fields.php
AlterSocialProfilesAddProfileFields.down
public function down() { Schema::table('social_profiles', function($table) { $table->dropColumn('profile_url'); $table->dropColumn('website_url'); $table->dropColumn('photo_url'); $table->dropColumn('display_name'); $table->dropColumn('description'); $table->dropColumn('first_name'); $table->dro...
php
public function down() { Schema::table('social_profiles', function($table) { $table->dropColumn('profile_url'); $table->dropColumn('website_url'); $table->dropColumn('photo_url'); $table->dropColumn('display_name'); $table->dropColumn('description'); $table->dropColumn('first_name'); $table->dro...
[ "public", "function", "down", "(", ")", "{", "Schema", "::", "table", "(", "'social_profiles'", ",", "function", "(", "$", "table", ")", "{", "$", "table", "->", "dropColumn", "(", "'profile_url'", ")", ";", "$", "table", "->", "dropColumn", "(", "'websi...
Reverse the migrations. @return void
[ "Reverse", "the", "migrations", "." ]
train
https://github.com/ipunkt/social-auth/blob/28723a8e449612789a2cd7d21137996c48b62229/src/migrations/2014_10_14_155418_alter_social_profiles_add_profile_fields.php#L45-L70
keboola/juicer
Pagination/PageScroller.php
PageScroller.getParams
private function getParams(JobConfig $jobConfig) { $params = [$this->pageParam => $this->page]; if (!empty($this->limitParam) && !is_null($this->getLimit($jobConfig))) { $params[$this->limitParam] = $this->getLimit($jobConfig); } $config = $jobConfig->getConfig(); ...
php
private function getParams(JobConfig $jobConfig) { $params = [$this->pageParam => $this->page]; if (!empty($this->limitParam) && !is_null($this->getLimit($jobConfig))) { $params[$this->limitParam] = $this->getLimit($jobConfig); } $config = $jobConfig->getConfig(); ...
[ "private", "function", "getParams", "(", "JobConfig", "$", "jobConfig", ")", "{", "$", "params", "=", "[", "$", "this", "->", "pageParam", "=>", "$", "this", "->", "page", "]", ";", "if", "(", "!", "empty", "(", "$", "this", "->", "limitParam", ")", ...
Returns a config with scroller params @param JobConfig $jobConfig @return array
[ "Returns", "a", "config", "with", "scroller", "params" ]
train
https://github.com/keboola/juicer/blob/780e7900ccd23082ed234cc2c51b279a4223e9f5/Pagination/PageScroller.php#L124-L137
ptlis/conneg
src/Negotiator/Matcher/PartialLanguageMatcher.php
PartialLanguageMatcher.getMatchingIndexes
private function getMatchingIndexes($fromField, array $matchingList, PreferenceInterface $clientPref) { $matchingIndexList = array(); foreach ($matchingList as $key => $matching) { if ($this->partialLangMatches($fromField, $matching, $clientPref)) { $matchingIndexList[] ...
php
private function getMatchingIndexes($fromField, array $matchingList, PreferenceInterface $clientPref) { $matchingIndexList = array(); foreach ($matchingList as $key => $matching) { if ($this->partialLangMatches($fromField, $matching, $clientPref)) { $matchingIndexList[] ...
[ "private", "function", "getMatchingIndexes", "(", "$", "fromField", ",", "array", "$", "matchingList", ",", "PreferenceInterface", "$", "clientPref", ")", "{", "$", "matchingIndexList", "=", "array", "(", ")", ";", "foreach", "(", "$", "matchingList", "as", "$...
Returns an array of indexes for of matches of higher precedence than the existing pairing. @param string $fromField @param MatchedPreferenceInterface[] $matchingList @param PreferenceInterface $clientPref @return int[]
[ "Returns", "an", "array", "of", "indexes", "for", "of", "matches", "of", "higher", "precedence", "than", "the", "existing", "pairing", "." ]
train
https://github.com/ptlis/conneg/blob/04afb568f368ecdd81c13277006c4be041ccb58b/src/Negotiator/Matcher/PartialLanguageMatcher.php#L55-L66
ptlis/conneg
src/Negotiator/Matcher/PartialLanguageMatcher.php
PartialLanguageMatcher.partialLangMatches
private function partialLangMatches( $fromField, MatchedPreferenceInterface $matchedPreference, PreferenceInterface $newClientPref ) { $serverPref = $matchedPreference->getServerPreference(); $oldClientPref = $matchedPreference->getClientPreference(); // Note that th...
php
private function partialLangMatches( $fromField, MatchedPreferenceInterface $matchedPreference, PreferenceInterface $newClientPref ) { $serverPref = $matchedPreference->getServerPreference(); $oldClientPref = $matchedPreference->getClientPreference(); // Note that th...
[ "private", "function", "partialLangMatches", "(", "$", "fromField", ",", "MatchedPreferenceInterface", "$", "matchedPreference", ",", "PreferenceInterface", "$", "newClientPref", ")", "{", "$", "serverPref", "=", "$", "matchedPreference", "->", "getServerPreference", "(...
Returns true if the server preference contains a partial language that matches the language in the client preference. e.g. An server variant of en-* would match en, en-US but not es-ES @param string $fromField @param MatchedPreferenceInterface $matchedPreference @param PreferenceInterface $newClientPref @return bool
[ "Returns", "true", "if", "the", "server", "preference", "contains", "a", "partial", "language", "that", "matches", "the", "language", "in", "the", "client", "preference", "." ]
train
https://github.com/ptlis/conneg/blob/04afb568f368ecdd81c13277006c4be041ccb58b/src/Negotiator/Matcher/PartialLanguageMatcher.php#L80-L97
myzero1/yii2-theme-layui
src/controllers/UserController.php
UserController.actionInit
public function actionInit() { if (\Yii::$app->request->isPost) { $iniSql = ' CREATE TABLE IF NOT EXISTS `z1_user` ( `id` int(11) NOT NULL AUTO_INCREMENT, `username` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `auth_key` va...
php
public function actionInit() { if (\Yii::$app->request->isPost) { $iniSql = ' CREATE TABLE IF NOT EXISTS `z1_user` ( `id` int(11) NOT NULL AUTO_INCREMENT, `username` varchar(255) COLLATE utf8_unicode_ci NOT NULL, `auth_key` va...
[ "public", "function", "actionInit", "(", ")", "{", "if", "(", "\\", "Yii", "::", "$", "app", "->", "request", "->", "isPost", ")", "{", "$", "iniSql", "=", "'\n CREATE TABLE IF NOT EXISTS `z1_user` (\n `id` int(11) NOT NULL AUTO_INCREMENT,\...
Renders the index view for the module,render the layout @return string
[ "Renders", "the", "index", "view", "for", "the", "module,render", "the", "layout" ]
train
https://github.com/myzero1/yii2-theme-layui/blob/47e4796b35b8354e50359a489499ee598edd68e1/src/controllers/UserController.php#L34-L60
mimmi20/Wurfl
src/Handlers/Chain/UserAgentHandlerChainFactory.php
UserAgentHandlerChainFactory.createFrom
public static function createFrom( Storage $persistenceProvider, Storage $cacheProvider, LoggerInterface $logger = null ) { /** @var $userAgentHandlerChain \Wurfl\Handlers\Chain\UserAgentHandlerChain */ $userAgentHandlerChain = $cacheProvider->load('UserAgentHandlerChain'); ...
php
public static function createFrom( Storage $persistenceProvider, Storage $cacheProvider, LoggerInterface $logger = null ) { /** @var $userAgentHandlerChain \Wurfl\Handlers\Chain\UserAgentHandlerChain */ $userAgentHandlerChain = $cacheProvider->load('UserAgentHandlerChain'); ...
[ "public", "static", "function", "createFrom", "(", "Storage", "$", "persistenceProvider", ",", "Storage", "$", "cacheProvider", ",", "LoggerInterface", "$", "logger", "=", "null", ")", "{", "/** @var $userAgentHandlerChain \\Wurfl\\Handlers\\Chain\\UserAgentHandlerChain */", ...
Create a \Wurfl\Handlers\Chain\UserAgentHandlerChain @param \Wurfl\Storage\Storage $persistenceProvider @param \Wurfl\Storage\Storage $cacheProvider @param \Psr\Log\LoggerInterface $logger @return UserAgentHandlerChain
[ "Create", "a", "\\", "Wurfl", "\\", "Handlers", "\\", "Chain", "\\", "UserAgentHandlerChain" ]
train
https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/Chain/UserAgentHandlerChainFactory.php#L130-L153
mimmi20/Wurfl
src/Handlers/Chain/UserAgentHandlerChainFactory.php
UserAgentHandlerChainFactory.init
private static function init() { $userAgentHandlerChain = new UserAgentHandlerChain(); /** @var $genericNormalizers UserAgentNormalizer */ $genericNormalizers = self::createGenericNormalizers(); /**** Smart TVs ****/ $userAgentHandlerChain->addUserAgentHandler(new SmartTVHa...
php
private static function init() { $userAgentHandlerChain = new UserAgentHandlerChain(); /** @var $genericNormalizers UserAgentNormalizer */ $genericNormalizers = self::createGenericNormalizers(); /**** Smart TVs ****/ $userAgentHandlerChain->addUserAgentHandler(new SmartTVHa...
[ "private", "static", "function", "init", "(", ")", "{", "$", "userAgentHandlerChain", "=", "new", "UserAgentHandlerChain", "(", ")", ";", "/** @var $genericNormalizers UserAgentNormalizer */", "$", "genericNormalizers", "=", "self", "::", "createGenericNormalizers", "(", ...
Initializes the factory with an instance of all possible \Wurfl\Handlers\AbstractHandler objects @return \Wurfl\Handlers\Chain\UserAgentHandlerChain
[ "Initializes", "the", "factory", "with", "an", "instance", "of", "all", "possible", "\\", "Wurfl", "\\", "Handlers", "\\", "AbstractHandler", "objects" ]
train
https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/Chain/UserAgentHandlerChainFactory.php#L160-L367
mimmi20/Wurfl
src/Handlers/Chain/UserAgentHandlerChainFactory.php
UserAgentHandlerChainFactory.createGenericNormalizers
public static function createGenericNormalizers() { return new UserAgentNormalizer( array( new UCWEB(), new UPLink(), new SerialNumbers(), new LocaleRemover(), new CFNetwork(), new BlackBerry(), ...
php
public static function createGenericNormalizers() { return new UserAgentNormalizer( array( new UCWEB(), new UPLink(), new SerialNumbers(), new LocaleRemover(), new CFNetwork(), new BlackBerry(), ...
[ "public", "static", "function", "createGenericNormalizers", "(", ")", "{", "return", "new", "UserAgentNormalizer", "(", "array", "(", "new", "UCWEB", "(", ")", ",", "new", "UPLink", "(", ")", ",", "new", "SerialNumbers", "(", ")", ",", "new", "LocaleRemover"...
Returns a User Agent Normalizer chain containing all generic normalizers @return \Wurfl\Handlers\Normalizer\UserAgentNormalizer
[ "Returns", "a", "User", "Agent", "Normalizer", "chain", "containing", "all", "generic", "normalizers" ]
train
https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/Chain/UserAgentHandlerChainFactory.php#L374-L388
opis/http-routing
src/RouteCollection.php
RouteCollection.callback
public function callback(string $name, callable $callback): self { $this->callbacks[$name] = $callback; return $this; }
php
public function callback(string $name, callable $callback): self { $this->callbacks[$name] = $callback; return $this; }
[ "public", "function", "callback", "(", "string", "$", "name", ",", "callable", "$", "callback", ")", ":", "self", "{", "$", "this", "->", "callbacks", "[", "$", "name", "]", "=", "$", "callback", ";", "return", "$", "this", ";", "}" ]
Add a callback @param string $name @param callable $callback @return static|RouteCollection
[ "Add", "a", "callback" ]
train
https://github.com/opis/http-routing/blob/cac9017434bfb281081547479169d90f0572c393/src/RouteCollection.php#L162-L166