id
int32
0
241k
repo
stringlengths
6
63
path
stringlengths
5
140
func_name
stringlengths
3
151
original_string
stringlengths
84
13k
language
stringclasses
1 value
code
stringlengths
84
13k
code_tokens
list
docstring
stringlengths
3
47.2k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
91
247
13,000
nyeholt/silverstripe-simplewiki
thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/Context.php
HTMLPurifier_Context.destroy
public function destroy($name) { if (!isset($this->_storage[$name])) { trigger_error("Attempted to destroy non-existent variable $name", E_USER_ERROR); return; } unset($this->_storage[$name]); }
php
public function destroy($name) { if (!isset($this->_storage[$name])) { trigger_error("Attempted to destroy non-existent variable $name", E_USER_ERROR); return; } unset($this->_storage[$name]); }
[ "public", "function", "destroy", "(", "$", "name", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "_storage", "[", "$", "name", "]", ")", ")", "{", "trigger_error", "(", "\"Attempted to destroy non-existent variable $name\"", ",", "E_USER_ERROR", ...
Destorys a variable in the context. @param $name String name
[ "Destorys", "a", "variable", "in", "the", "context", "." ]
ecffed0d75be1454901e1cb24633472b8f67c967
https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/Context.php#L53-L60
13,001
cauditor/php-analyzer
src/Api.php
Api.get
public function get($uri) { $options = array( CURLOPT_URL => $this->domain.'/'.ltrim($uri, '/'), CURLOPT_FOLLOWLOCATION => 1, CURLOPT_RETURNTRANSFER => 1, ); return $this->exec($options); }
php
public function get($uri) { $options = array( CURLOPT_URL => $this->domain.'/'.ltrim($uri, '/'), CURLOPT_FOLLOWLOCATION => 1, CURLOPT_RETURNTRANSFER => 1, ); return $this->exec($options); }
[ "public", "function", "get", "(", "$", "uri", ")", "{", "$", "options", "=", "array", "(", "CURLOPT_URL", "=>", "$", "this", "->", "domain", ".", "'/'", ".", "ltrim", "(", "$", "uri", ",", "'/'", ")", ",", "CURLOPT_FOLLOWLOCATION", "=>", "1", ",", ...
Read data from cauditor API. @param string $uri @return string|bool API response (on success) or false (on failure)
[ "Read", "data", "from", "cauditor", "API", "." ]
0d86686d64d01e6aaed433898841894fa3ce1101
https://github.com/cauditor/php-analyzer/blob/0d86686d64d01e6aaed433898841894fa3ce1101/src/Api.php#L40-L49
13,002
cauditor/php-analyzer
src/Api.php
Api.put
public function put($uri, array $data) { // PUT requests need an fopen wrapper, so we'll create a temporary one // for the data to submit... $json = json_encode($data); $file = fopen('php://temp', 'w+'); fwrite($file, $json, strlen($json)); fseek($file, 0); $...
php
public function put($uri, array $data) { // PUT requests need an fopen wrapper, so we'll create a temporary one // for the data to submit... $json = json_encode($data); $file = fopen('php://temp', 'w+'); fwrite($file, $json, strlen($json)); fseek($file, 0); $...
[ "public", "function", "put", "(", "$", "uri", ",", "array", "$", "data", ")", "{", "// PUT requests need an fopen wrapper, so we'll create a temporary one", "// for the data to submit...", "$", "json", "=", "json_encode", "(", "$", "data", ")", ";", "$", "file", "="...
Submit the data to cauditor API. @param string $uri @param array $data @return string|bool API response (on success) or false (on failure)
[ "Submit", "the", "data", "to", "cauditor", "API", "." ]
0d86686d64d01e6aaed433898841894fa3ce1101
https://github.com/cauditor/php-analyzer/blob/0d86686d64d01e6aaed433898841894fa3ce1101/src/Api.php#L59-L82
13,003
liip/LiipDrupalConnectorModule
src/Liip/Drupal/Modules/DrupalConnector/Form.php
Form.form_set_error
public function form_set_error($name = NULL, $message = '', $limit_validation_errors = NULL) { return form_set_error($name, $message, $limit_validation_errors); }
php
public function form_set_error($name = NULL, $message = '', $limit_validation_errors = NULL) { return form_set_error($name, $message, $limit_validation_errors); }
[ "public", "function", "form_set_error", "(", "$", "name", "=", "NULL", ",", "$", "message", "=", "''", ",", "$", "limit_validation_errors", "=", "NULL", ")", "{", "return", "form_set_error", "(", "$", "name", ",", "$", "message", ",", "$", "limit_validatio...
Files an error against a form element. When a validation error is detected, the validator calls form_set_error() to indicate which element needs to be changed and provide an error message. This causes the Form API to not execute the form submit handlers, and instead to re-display the form to the user with the correspo...
[ "Files", "an", "error", "against", "a", "form", "element", "." ]
6ba161ef0d3a27c108e533f1adbea22ed73b78ce
https://github.com/liip/LiipDrupalConnectorModule/blob/6ba161ef0d3a27c108e533f1adbea22ed73b78ce/src/Liip/Drupal/Modules/DrupalConnector/Form.php#L147-L150
13,004
DevGroup-ru/yii2-data-structure-tools
src/searchOld/base/AbstractWatch.php
AbstractWatch.init
public function init() { if (true === $this->beforeInit()) { HasPropertiesEvent::on(HasProperties::class, HasProperties::EVENT_AFTER_SAVE, [$this, 'onSave']); HasPropertiesEvent::on(HasProperties::class, HasProperties::EVENT_AFTER_UPDATE, [$this, 'onUpdate']); HasProperti...
php
public function init() { if (true === $this->beforeInit()) { HasPropertiesEvent::on(HasProperties::class, HasProperties::EVENT_AFTER_SAVE, [$this, 'onSave']); HasPropertiesEvent::on(HasProperties::class, HasProperties::EVENT_AFTER_UPDATE, [$this, 'onUpdate']); HasProperti...
[ "public", "function", "init", "(", ")", "{", "if", "(", "true", "===", "$", "this", "->", "beforeInit", "(", ")", ")", "{", "HasPropertiesEvent", "::", "on", "(", "HasProperties", "::", "class", ",", "HasProperties", "::", "EVENT_AFTER_SAVE", ",", "[", "...
Adds event listeners to perform search index actualization if pre initialization was successful
[ "Adds", "event", "listeners", "to", "perform", "search", "index", "actualization", "if", "pre", "initialization", "was", "successful" ]
a5b24d7c0b24d4b0d58cacd91ec7fd876e979097
https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/searchOld/base/AbstractWatch.php#L20-L27
13,005
PandaPlatform/framework
src/Panda/Support/Helpers/NumberHelper.php
NumberHelper.isEqual
public static function isEqual($value1, $value2, $roundPrecision = 0) { $equal = false; if (static::floor($value1, $roundPrecision) == static::floor($value2, $roundPrecision)) { $equal = true; } return $equal; }
php
public static function isEqual($value1, $value2, $roundPrecision = 0) { $equal = false; if (static::floor($value1, $roundPrecision) == static::floor($value2, $roundPrecision)) { $equal = true; } return $equal; }
[ "public", "static", "function", "isEqual", "(", "$", "value1", ",", "$", "value2", ",", "$", "roundPrecision", "=", "0", ")", "{", "$", "equal", "=", "false", ";", "if", "(", "static", "::", "floor", "(", "$", "value1", ",", "$", "roundPrecision", ")...
Checks if of two numbers are equal. Optional to set a required precision @param float $value1 @param float $value2 @param int $roundPrecision @return bool
[ "Checks", "if", "of", "two", "numbers", "are", "equal", ".", "Optional", "to", "set", "a", "required", "precision" ]
a78cf051b379896b5a4d5df620988e37a0e632f5
https://github.com/PandaPlatform/framework/blob/a78cf051b379896b5a4d5df620988e37a0e632f5/src/Panda/Support/Helpers/NumberHelper.php#L60-L69
13,006
Arcavias/ext-phpexcel
lib/custom/src/MW/Container/Content/PHPExcel.php
MW_Container_Content_PHPExcel.add
public function add( $data ) { $columnNum = 0; $rowNum = $this->_iterator->current()->getRowIndex(); foreach( (array) $data as $value ) { $this->_sheet->setCellValueByColumnAndRow( $columnNum++, $rowNum, $value ); } $this->_iterator->next(); }
php
public function add( $data ) { $columnNum = 0; $rowNum = $this->_iterator->current()->getRowIndex(); foreach( (array) $data as $value ) { $this->_sheet->setCellValueByColumnAndRow( $columnNum++, $rowNum, $value ); } $this->_iterator->next(); }
[ "public", "function", "add", "(", "$", "data", ")", "{", "$", "columnNum", "=", "0", ";", "$", "rowNum", "=", "$", "this", "->", "_iterator", "->", "current", "(", ")", "->", "getRowIndex", "(", ")", ";", "foreach", "(", "(", "array", ")", "$", "...
Adds a row to the content object. @param mixed $data Data to add
[ "Adds", "a", "row", "to", "the", "content", "object", "." ]
00e6ce6205e4f44eb0c438093b523b084a019e8d
https://github.com/Arcavias/ext-phpexcel/blob/00e6ce6205e4f44eb0c438093b523b084a019e8d/lib/custom/src/MW/Container/Content/PHPExcel.php#L54-L64
13,007
unimapper/unimapper
src/Association.php
Association.groupResult
public static function groupResult(array $original, array $keys, $level = 0) { $converted = []; $key = $keys[$level]; $isDeepest = sizeof($keys) - 1 == $level; $level++; $filtered = []; foreach ($original as $k => $subArray) { $subArray = (array) $subAr...
php
public static function groupResult(array $original, array $keys, $level = 0) { $converted = []; $key = $keys[$level]; $isDeepest = sizeof($keys) - 1 == $level; $level++; $filtered = []; foreach ($original as $k => $subArray) { $subArray = (array) $subAr...
[ "public", "static", "function", "groupResult", "(", "array", "$", "original", ",", "array", "$", "keys", ",", "$", "level", "=", "0", ")", "{", "$", "converted", "=", "[", "]", ";", "$", "key", "=", "$", "keys", "[", "$", "level", "]", ";", "$", ...
Group associative array @param array $original @param array $keys @param int $level @return array @link http://tigrou.nl/2012/11/26/group-a-php-array-to-a-tree-structure/ @throws \Exception
[ "Group", "associative", "array" ]
a63b39f38a790fec7e852c8ef1e4c31653e689f7
https://github.com/unimapper/unimapper/blob/a63b39f38a790fec7e852c8ef1e4c31653e689f7/src/Association.php#L111-L154
13,008
christophe-brachet/aspi-framework
src/Framework/Form/Element/Select.php
Select.setValue
public function setValue($value) { $this->selected = $value; if ($this->hasChildren()) { foreach ($this->childNodes as $child) { if ($child instanceof Select\Option) { if ($child->getValue() == $this->selected) { $child->select(...
php
public function setValue($value) { $this->selected = $value; if ($this->hasChildren()) { foreach ($this->childNodes as $child) { if ($child instanceof Select\Option) { if ($child->getValue() == $this->selected) { $child->select(...
[ "public", "function", "setValue", "(", "$", "value", ")", "{", "$", "this", "->", "selected", "=", "$", "value", ";", "if", "(", "$", "this", "->", "hasChildren", "(", ")", ")", "{", "foreach", "(", "$", "this", "->", "childNodes", "as", "$", "chil...
Set the selected value of the select form element @param mixed $value @return Select
[ "Set", "the", "selected", "value", "of", "the", "select", "form", "element" ]
17a36c8a8582e0b8d8bff7087590c09a9bd4af1e
https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/Element/Select.php#L83-L107
13,009
cauditor/php-analyzer
src/Aggregator.php
Aggregator.average
public function average() { $flat = $this->flatten(); $avg = array(); foreach ($flat as $metric => $values) { $avg[$metric] = (float) number_format(array_sum($values) / count($values), 2, '.', ''); } return $avg; }
php
public function average() { $flat = $this->flatten(); $avg = array(); foreach ($flat as $metric => $values) { $avg[$metric] = (float) number_format(array_sum($values) / count($values), 2, '.', ''); } return $avg; }
[ "public", "function", "average", "(", ")", "{", "$", "flat", "=", "$", "this", "->", "flatten", "(", ")", ";", "$", "avg", "=", "array", "(", ")", ";", "foreach", "(", "$", "flat", "as", "$", "metric", "=>", "$", "values", ")", "{", "$", "avg",...
Get metric averages. @return float[]
[ "Get", "metric", "averages", "." ]
0d86686d64d01e6aaed433898841894fa3ce1101
https://github.com/cauditor/php-analyzer/blob/0d86686d64d01e6aaed433898841894fa3ce1101/src/Aggregator.php#L35-L45
13,010
joomla-projects/jorobo
src/Tasks/Build/CBPlugin.php
CBPlugin.createInstaller
private function createInstaller($files) { $this->say("Creating plugin installer"); $xmlFile = $this->target . "/" . str_replace('plug_', '', $this->plgName) . ".xml"; // Version & Date Replace $this->replaceInFile($xmlFile); }
php
private function createInstaller($files) { $this->say("Creating plugin installer"); $xmlFile = $this->target . "/" . str_replace('plug_', '', $this->plgName) . ".xml"; // Version & Date Replace $this->replaceInFile($xmlFile); }
[ "private", "function", "createInstaller", "(", "$", "files", ")", "{", "$", "this", "->", "say", "(", "\"Creating plugin installer\"", ")", ";", "$", "xmlFile", "=", "$", "this", "->", "target", ".", "\"/\"", ".", "str_replace", "(", "'plug_'", ",", "''", ...
Generate the installer xml file for the plugin @param array $files The module files @return void @since 1.0
[ "Generate", "the", "installer", "xml", "file", "for", "the", "plugin" ]
e72dd0ed15f387739f67cacdbc2c0bd1b427f317
https://github.com/joomla-projects/jorobo/blob/e72dd0ed15f387739f67cacdbc2c0bd1b427f317/src/Tasks/Build/CBPlugin.php#L108-L116
13,011
terdia/legato-framework
src/Security/Auth/Auth.php
Auth.remembered
public static function remembered(Request $request) { $remember = readCookie($request, 'remember_token'); if ($remember != null) { try { $decrypted = decrypt($remember); $authConfig = getConfigPath('app', 'auth'); return Gate::user($authCo...
php
public static function remembered(Request $request) { $remember = readCookie($request, 'remember_token'); if ($remember != null) { try { $decrypted = decrypt($remember); $authConfig = getConfigPath('app', 'auth'); return Gate::user($authCo...
[ "public", "static", "function", "remembered", "(", "Request", "$", "request", ")", "{", "$", "remember", "=", "readCookie", "(", "$", "request", ",", "'remember_token'", ")", ";", "if", "(", "$", "remember", "!=", "null", ")", "{", "try", "{", "$", "de...
Check remember user. @param Request $request @return bool|mixed
[ "Check", "remember", "user", "." ]
44057c1c3c6f3e9643e9fade51bd417860fafda8
https://github.com/terdia/legato-framework/blob/44057c1c3c6f3e9643e9fade51bd417860fafda8/src/Security/Auth/Auth.php#L71-L86
13,012
falkmueller/hubert
src/generic/controller.php
controller.responseRedirect
protected function responseRedirect($url, $status = null) { $responseWithRedirect = $this->_response->withHeader('Location', (string)$url); if (is_null($status) && $this->_response->getStatusCode() === 200) { $status = 302; } if (!is_null($status)) { return $r...
php
protected function responseRedirect($url, $status = null) { $responseWithRedirect = $this->_response->withHeader('Location', (string)$url); if (is_null($status) && $this->_response->getStatusCode() === 200) { $status = 302; } if (!is_null($status)) { return $r...
[ "protected", "function", "responseRedirect", "(", "$", "url", ",", "$", "status", "=", "null", ")", "{", "$", "responseWithRedirect", "=", "$", "this", "->", "_response", "->", "withHeader", "(", "'Location'", ",", "(", "string", ")", "$", "url", ")", ";...
set redirekt url in response @param string $url @param int $status @return \Zend\Diactoros\Response
[ "set", "redirekt", "url", "in", "response" ]
a4fa52de158262dddd9cf349bf5267f7923874f9
https://github.com/falkmueller/hubert/blob/a4fa52de158262dddd9cf349bf5267f7923874f9/src/generic/controller.php#L40-L50
13,013
falkmueller/hubert
src/generic/controller.php
controller.responseJson
protected function responseJson($data, $status = null, $encodingOptions = 0) { $body = $this->_response->getBody(); $body->rewind(); $body->write($json = json_encode($data, $encodingOptions)); // Ensure that the json encoding passed successfully if ($json === false) { ...
php
protected function responseJson($data, $status = null, $encodingOptions = 0) { $body = $this->_response->getBody(); $body->rewind(); $body->write($json = json_encode($data, $encodingOptions)); // Ensure that the json encoding passed successfully if ($json === false) { ...
[ "protected", "function", "responseJson", "(", "$", "data", ",", "$", "status", "=", "null", ",", "$", "encodingOptions", "=", "0", ")", "{", "$", "body", "=", "$", "this", "->", "_response", "->", "getBody", "(", ")", ";", "$", "body", "->", "rewind"...
transform response for with json-data @param type $data @param int $status @param type $encodingOptions @return \Zend\Diactoros\Response @throws \RuntimeException
[ "transform", "response", "for", "with", "json", "-", "data" ]
a4fa52de158262dddd9cf349bf5267f7923874f9
https://github.com/falkmueller/hubert/blob/a4fa52de158262dddd9cf349bf5267f7923874f9/src/generic/controller.php#L60-L74
13,014
falkmueller/hubert
src/generic/controller.php
controller.responseTemplate
protected function responseTemplate($template, $data = array()){ if(!isset(hubert()->template)){ throw new \Exception("no template engine installed"); } $html = hubert()->template->render($template, $data); $this->_response->getBody()->write($html); ...
php
protected function responseTemplate($template, $data = array()){ if(!isset(hubert()->template)){ throw new \Exception("no template engine installed"); } $html = hubert()->template->render($template, $data); $this->_response->getBody()->write($html); ...
[ "protected", "function", "responseTemplate", "(", "$", "template", ",", "$", "data", "=", "array", "(", ")", ")", "{", "if", "(", "!", "isset", "(", "hubert", "(", ")", "->", "template", ")", ")", "{", "throw", "new", "\\", "Exception", "(", "\"no te...
render template in response @param string $template @param array $data @return \Zend\Diactoros\Response
[ "render", "template", "in", "response" ]
a4fa52de158262dddd9cf349bf5267f7923874f9
https://github.com/falkmueller/hubert/blob/a4fa52de158262dddd9cf349bf5267f7923874f9/src/generic/controller.php#L82-L92
13,015
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", "." ]
52d54ea3e565bd2bccd77e0b0a6a99b5cae3aff5
https://github.com/sifophp/sifo-common-instance/blob/52d54ea3e565bd2bccd77e0b0a6a99b5cae3aff5/controllers/error/common.php#L58-L72
13,016
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" ]
557d0205d8691d0702380102fac5a662854e0691
https://github.com/Guzzle3/guzzle-silex-extension/blob/557d0205d8691d0702380102fac5a662854e0691/GuzzleServiceProvider.php#L34-L62
13,017
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", "." ]
ecffed0d75be1454901e1cb24633472b8f67c967
https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/PercentEncoder.php#L69-L94
13,018
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", "." ]
f6d7032f8562e23c2ee8dbf9d60ef1114c8cdce7
https://github.com/ssnepenthe/soter/blob/f6d7032f8562e23c2ee8dbf9d60ef1114c8cdce7/src/class-options-page.php#L50-L135
13,019
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", "." ]
f6d7032f8562e23c2ee8dbf9d60ef1114c8cdce7
https://github.com/ssnepenthe/soter/blob/f6d7032f8562e23c2ee8dbf9d60ef1114c8cdce7/src/class-options-page.php#L157-L170
13,020
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", "." ]
f6d7032f8562e23c2ee8dbf9d60ef1114c8cdce7
https://github.com/ssnepenthe/soter/blob/f6d7032f8562e23c2ee8dbf9d60ef1114c8cdce7/src/class-options-page.php#L177-L186
13,021
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", "." ]
f6d7032f8562e23c2ee8dbf9d60ef1114c8cdce7
https://github.com/ssnepenthe/soter/blob/f6d7032f8562e23c2ee8dbf9d60ef1114c8cdce7/src/class-options-page.php#L217-L237
13,022
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", "." ]
f6d7032f8562e23c2ee8dbf9d60ef1114c8cdce7
https://github.com/ssnepenthe/soter/blob/f6d7032f8562e23c2ee8dbf9d60ef1114c8cdce7/src/class-options-page.php#L244-L257
13,023
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", "." ]
c1f0fd05bf6d1951a3fd929d974e6f4cc2b52262
https://github.com/bariew/yii2-rbac-cms-module/blob/c1f0fd05bf6d1951a3fd929d974e6f4cc2b52262/components/TreeBuilder.php#L64-L84
13,024
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", "." ]
c1f0fd05bf6d1951a3fd929d974e6f4cc2b52262
https://github.com/bariew/yii2-rbac-cms-module/blob/c1f0fd05bf6d1951a3fd929d974e6f4cc2b52262/components/TreeBuilder.php#L92-L105
13,025
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", "." ]
a77707df73908a3e9770f5bd8504fe444b5576b8
https://github.com/AbuseIO/parser-common/blob/a77707df73908a3e9770f5bd8504fe444b5576b8/src/Parser.php#L85-L102
13,026
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" ]
a77707df73908a3e9770f5bd8504fe444b5576b8
https://github.com/AbuseIO/parser-common/blob/a77707df73908a3e9770f5bd8504fe444b5576b8/src/Parser.php#L179-L190
13,027
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", "." ]
a77707df73908a3e9770f5bd8504fe444b5576b8
https://github.com/AbuseIO/parser-common/blob/a77707df73908a3e9770f5bd8504fe444b5576b8/src/Parser.php#L196-L214
13,028
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", "." ]
a77707df73908a3e9770f5bd8504fe444b5576b8
https://github.com/AbuseIO/parser-common/blob/a77707df73908a3e9770f5bd8504fe444b5576b8/src/Parser.php#L220-L232
13,029
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", "." ]
a77707df73908a3e9770f5bd8504fe444b5576b8
https://github.com/AbuseIO/parser-common/blob/a77707df73908a3e9770f5bd8504fe444b5576b8/src/Parser.php#L238-L250
13,030
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", "." ]
a77707df73908a3e9770f5bd8504fe444b5576b8
https://github.com/AbuseIO/parser-common/blob/a77707df73908a3e9770f5bd8504fe444b5576b8/src/Parser.php#L257-L277
13,031
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", "." ]
a77707df73908a3e9770f5bd8504fe444b5576b8
https://github.com/AbuseIO/parser-common/blob/a77707df73908a3e9770f5bd8504fe444b5576b8/src/Parser.php#L285-L308
13,032
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", "." ]
0944809d7b98f7beea00b1614f33d74b60931272
https://github.com/buonzz/laravel-4-freegeoip/blob/0944809d7b98f7beea00b1614f33d74b60931272/src/Buonzz/GeoIP/GeoIP.php#L143-L149
13,033
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", "." ]
0944809d7b98f7beea00b1614f33d74b60931272
https://github.com/buonzz/laravel-4-freegeoip/blob/0944809d7b98f7beea00b1614f33d74b60931272/src/Buonzz/GeoIP/GeoIP.php#L156-L173
13,034
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", "." ]
0944809d7b98f7beea00b1614f33d74b60931272
https://github.com/buonzz/laravel-4-freegeoip/blob/0944809d7b98f7beea00b1614f33d74b60931272/src/Buonzz/GeoIP/GeoIP.php#L183-L201
13,035
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", "." ]
f00e566d682a66796f3f8a68b348920fadd9ee87
https://github.com/kriskbx/mikado/blob/f00e566d682a66796f3f8a68b348920fadd9ee87/src/Mikado.php#L40-L46
13,036
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" ]
becbd839f8c1c1bcbfde42ea808f1c69e5233dee
https://github.com/ionutmilica/laravel-settings/blob/becbd839f8c1c1bcbfde42ea808f1c69e5233dee/src/Drivers/Database.php#L38-L57
13,037
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", "." ]
a72b09c28f8e966c37f98a0004e4fbbce80df42c
https://github.com/itrnka/ha-framework/blob/a72b09c28f8e966c37f98a0004e4fbbce80df42c/src/ha/Access/HTTP/Router/Builder/HTTPRouterBuilderExample.php#L37-L53
13,038
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" ]
9d364c10c68c10f768254fb25b0b1db3dbef6fa9
https://github.com/chippyash/Strong-Type/blob/9d364c10c68c10f768254fb25b0b1db3dbef6fa9/src/Chippyash/Type/RequiredType.php#L46-L53
13,039
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" ]
9d364c10c68c10f768254fb25b0b1db3dbef6fa9
https://github.com/chippyash/Strong-Type/blob/9d364c10c68c10f768254fb25b0b1db3dbef6fa9/src/Chippyash/Type/RequiredType.php#L62-L74
13,040
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" ]
ecffed0d75be1454901e1cb24633472b8f67c967
https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/HTMLModule.php#L185-L200
13,041
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", "." ]
ecffed0d75be1454901e1cb24633472b8f67c967
https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/HTMLModule.php#L208-L214
13,042
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", "." ]
ecffed0d75be1454901e1cb24633472b8f67c967
https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/HTMLModule.php#L224-L232
13,043
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" ]
b1bf9b3ab3b28f847fbe3f57d6c2c32b98c1431d
https://github.com/wshafer/assetmanager-core/blob/b1bf9b3ab3b28f847fbe3f57d6c2c32b98c1431d/src/Resolver/FileResolverAbstract.php#L49-L60
13,044
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" ]
e72dd0ed15f387739f67cacdbc2c0bd1b427f317
https://github.com/joomla-projects/jorobo/blob/e72dd0ed15f387739f67cacdbc2c0bd1b427f317/src/Tasks/Build/Language.php#L216-L260
13,045
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", "." ]
4adc18f414534abe986133d6d38e8e9787d32e69
https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Scanners/ScalaScanner.php#L35-L76
13,046
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", "." ]
04afb568f368ecdd81c13277006c4be041ccb58b
https://github.com/ptlis/conneg/blob/04afb568f368ecdd81c13277006c4be041ccb58b/src/Preference/Matched/MatchedPreference.php#L75-L90
13,047
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", "." ]
04afb568f368ecdd81c13277006c4be041ccb58b
https://github.com/ptlis/conneg/blob/04afb568f368ecdd81c13277006c4be041ccb58b/src/Preference/Matched/MatchedPreference.php#L97-L101
13,048
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", "." ]
d12ce93d72f74c099dfd2109371fcd6ddfffdca4
https://github.com/antarestupin/Accessible/blob/d12ce93d72f74c099dfd2109371fcd6ddfffdca4/lib/Accessible/AutomatedBehaviorTrait.php#L110-L127
13,049
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", "." ]
d12ce93d72f74c099dfd2109371fcd6ddfffdca4
https://github.com/antarestupin/Accessible/blob/d12ce93d72f74c099dfd2109371fcd6ddfffdca4/lib/Accessible/AutomatedBehaviorTrait.php#L138-L175
13,050
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", "." ]
d12ce93d72f74c099dfd2109371fcd6ddfffdca4
https://github.com/antarestupin/Accessible/blob/d12ce93d72f74c099dfd2109371fcd6ddfffdca4/lib/Accessible/AutomatedBehaviorTrait.php#L180-L197
13,051
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" ]
514a7854cc69f84f47e62a58cc55efd68b7c9f83
https://github.com/venta/framework/blob/514a7854cc69f84f47e62a58cc55efd68b7c9f83/src/Console/src/Command/SignatureParser.php#L57-L66
13,052
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" ]
514a7854cc69f84f47e62a58cc55efd68b7c9f83
https://github.com/venta/framework/blob/514a7854cc69f84f47e62a58cc55efd68b7c9f83/src/Console/src/Command/SignatureParser.php#L87-L120
13,053
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" ]
10541f9694b5d9759329ae908033dd3097ce6923
https://github.com/wangsir0624/queue/blob/10541f9694b5d9759329ae908033dd3097ce6923/src/Worker.php#L149-L158
13,054
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" ]
10541f9694b5d9759329ae908033dd3097ce6923
https://github.com/wangsir0624/queue/blob/10541f9694b5d9759329ae908033dd3097ce6923/src/Worker.php#L163-L178
13,055
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" ]
10541f9694b5d9759329ae908033dd3097ce6923
https://github.com/wangsir0624/queue/blob/10541f9694b5d9759329ae908033dd3097ce6923/src/Worker.php#L213-L244
13,056
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" ]
10541f9694b5d9759329ae908033dd3097ce6923
https://github.com/wangsir0624/queue/blob/10541f9694b5d9759329ae908033dd3097ce6923/src/Worker.php#L260-L277
13,057
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" ]
10541f9694b5d9759329ae908033dd3097ce6923
https://github.com/wangsir0624/queue/blob/10541f9694b5d9759329ae908033dd3097ce6923/src/Worker.php#L283-L291
13,058
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", "." ]
4d75abead39e954529b56cbffa3841a9cd3044bb
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Psr7/RequestTrait.php#L75-L115
13,059
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", "." ]
cc37083f506b65a5f005ca7a8920072d292a1d83
https://github.com/phlib/beanstalk/blob/cc37083f506b65a5f005ca7a8920072d292a1d83/src/Command/StatsTrait.php#L45-L68
13,060
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", "." ]
04afb568f368ecdd81c13277006c4be041ccb58b
https://github.com/ptlis/conneg/blob/04afb568f368ecdd81c13277006c4be041ccb58b/src/Negotiator/Matcher/PartialLanguageMatcher.php#L80-L97
13,061
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" ]
443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec
https://github.com/mimmi20/Wurfl/blob/443ed0d73a0b9a21ebd0d6ddf1e32669b9de44ec/src/Handlers/Chain/UserAgentHandlerChainFactory.php#L130-L153
13,062
kriskbx/mikado
src/Data/FormatAbleObject.php
FormatAbleObject.getProperty
public function getProperty($name) { if (!$this->hasProperty($name)) { return; } if (strstr($name, '.')) { $value = false; @eval('$value = '.$this->resolveArrayPath($name).';'); return $value; } if ($this->isArray()) { ...
php
public function getProperty($name) { if (!$this->hasProperty($name)) { return; } if (strstr($name, '.')) { $value = false; @eval('$value = '.$this->resolveArrayPath($name).';'); return $value; } if ($this->isArray()) { ...
[ "public", "function", "getProperty", "(", "$", "name", ")", "{", "if", "(", "!", "$", "this", "->", "hasProperty", "(", "$", "name", ")", ")", "{", "return", ";", "}", "if", "(", "strstr", "(", "$", "name", ",", "'.'", ")", ")", "{", "$", "valu...
Get Property. @param string $name @return mixed
[ "Get", "Property", "." ]
f00e566d682a66796f3f8a68b348920fadd9ee87
https://github.com/kriskbx/mikado/blob/f00e566d682a66796f3f8a68b348920fadd9ee87/src/Data/FormatAbleObject.php#L60-L78
13,063
kriskbx/mikado
src/Data/FormatAbleObject.php
FormatAbleObject.setProperty
public function setProperty($name, $value) { if (strstr($name, '.')) { $this->setPropertyByPath($name, $value); return true; } if ($this->isArray()) { $this->object[$name] = $value; } else { $this->object->$name = $value; } ...
php
public function setProperty($name, $value) { if (strstr($name, '.')) { $this->setPropertyByPath($name, $value); return true; } if ($this->isArray()) { $this->object[$name] = $value; } else { $this->object->$name = $value; } ...
[ "public", "function", "setProperty", "(", "$", "name", ",", "$", "value", ")", "{", "if", "(", "strstr", "(", "$", "name", ",", "'.'", ")", ")", "{", "$", "this", "->", "setPropertyByPath", "(", "$", "name", ",", "$", "value", ")", ";", "return", ...
Set Property. @param string $name @param mixed $value @return bool
[ "Set", "Property", "." ]
f00e566d682a66796f3f8a68b348920fadd9ee87
https://github.com/kriskbx/mikado/blob/f00e566d682a66796f3f8a68b348920fadd9ee87/src/Data/FormatAbleObject.php#L88-L103
13,064
kriskbx/mikado
src/Data/FormatAbleObject.php
FormatAbleObject.setPropertyByPath
protected function setPropertyByPath($path, $value) { $path = explode('.', $path); $root = $path[0]; unset($path[0]); $array = ($this->hasProperty($root) ? $this->getProperty($root) : []); $pointer = &$array; // Loop through the array path and set array parts ...
php
protected function setPropertyByPath($path, $value) { $path = explode('.', $path); $root = $path[0]; unset($path[0]); $array = ($this->hasProperty($root) ? $this->getProperty($root) : []); $pointer = &$array; // Loop through the array path and set array parts ...
[ "protected", "function", "setPropertyByPath", "(", "$", "path", ",", "$", "value", ")", "{", "$", "path", "=", "explode", "(", "'.'", ",", "$", "path", ")", ";", "$", "root", "=", "$", "path", "[", "0", "]", ";", "unset", "(", "$", "path", "[", ...
Set a property by looping through. @param string $path
[ "Set", "a", "property", "by", "looping", "through", "." ]
f00e566d682a66796f3f8a68b348920fadd9ee87
https://github.com/kriskbx/mikado/blob/f00e566d682a66796f3f8a68b348920fadd9ee87/src/Data/FormatAbleObject.php#L110-L136
13,065
kriskbx/mikado
src/Data/FormatAbleObject.php
FormatAbleObject.unsetProperty
public function unsetProperty($name) { if (!$this->hasProperty($name)) { return false; } if (strstr($name, '.')) { try { $path = explode('.', $name); $root = $path[0]; unset($path[0]); $array = ($this->...
php
public function unsetProperty($name) { if (!$this->hasProperty($name)) { return false; } if (strstr($name, '.')) { try { $path = explode('.', $name); $root = $path[0]; unset($path[0]); $array = ($this->...
[ "public", "function", "unsetProperty", "(", "$", "name", ")", "{", "if", "(", "!", "$", "this", "->", "hasProperty", "(", "$", "name", ")", ")", "{", "return", "false", ";", "}", "if", "(", "strstr", "(", "$", "name", ",", "'.'", ")", ")", "{", ...
Unset Property. @param string $name @return bool
[ "Unset", "Property", "." ]
f00e566d682a66796f3f8a68b348920fadd9ee87
https://github.com/kriskbx/mikado/blob/f00e566d682a66796f3f8a68b348920fadd9ee87/src/Data/FormatAbleObject.php#L145-L177
13,066
kriskbx/mikado
src/Data/FormatAbleObject.php
FormatAbleObject.resolveArrayPath
public function resolveArrayPath($path) { $path = explode('.', $this->escape($path)); $root = $path[0]; unset($path[0]); $arrayPath = '["'.implode('"]["', $path).'"]'; $arrayBracket = '->'; $arrayBracketEnd = ''; if ($this->isArray()) { $arrayBr...
php
public function resolveArrayPath($path) { $path = explode('.', $this->escape($path)); $root = $path[0]; unset($path[0]); $arrayPath = '["'.implode('"]["', $path).'"]'; $arrayBracket = '->'; $arrayBracketEnd = ''; if ($this->isArray()) { $arrayBr...
[ "public", "function", "resolveArrayPath", "(", "$", "path", ")", "{", "$", "path", "=", "explode", "(", "'.'", ",", "$", "this", "->", "escape", "(", "$", "path", ")", ")", ";", "$", "root", "=", "$", "path", "[", "0", "]", ";", "unset", "(", "...
Resolve punctuation format and return path. @param string $path @return string
[ "Resolve", "punctuation", "format", "and", "return", "path", "." ]
f00e566d682a66796f3f8a68b348920fadd9ee87
https://github.com/kriskbx/mikado/blob/f00e566d682a66796f3f8a68b348920fadd9ee87/src/Data/FormatAbleObject.php#L186-L203
13,067
kriskbx/mikado
src/Data/FormatAbleObject.php
FormatAbleObject.loopThrough
public function loopThrough(Closure $callable) { $reference = $this->getReference(); if (is_null($reference)) { $reference = $this->object; } $this->loop($reference, $callable); }
php
public function loopThrough(Closure $callable) { $reference = $this->getReference(); if (is_null($reference)) { $reference = $this->object; } $this->loop($reference, $callable); }
[ "public", "function", "loopThrough", "(", "Closure", "$", "callable", ")", "{", "$", "reference", "=", "$", "this", "->", "getReference", "(", ")", ";", "if", "(", "is_null", "(", "$", "reference", ")", ")", "{", "$", "reference", "=", "$", "this", "...
Loop through the stored data. @param Closure $callable
[ "Loop", "through", "the", "stored", "data", "." ]
f00e566d682a66796f3f8a68b348920fadd9ee87
https://github.com/kriskbx/mikado/blob/f00e566d682a66796f3f8a68b348920fadd9ee87/src/Data/FormatAbleObject.php#L218-L227
13,068
kriskbx/mikado
src/Data/FormatAbleObject.php
FormatAbleObject.loop
protected function loop($data, Closure $callable) { if (!is_array($data) && !is_object($data)) { return; } foreach ($data as $key => $value) { call_user_func_array($callable, [$key, $value]); } }
php
protected function loop($data, Closure $callable) { if (!is_array($data) && !is_object($data)) { return; } foreach ($data as $key => $value) { call_user_func_array($callable, [$key, $value]); } }
[ "protected", "function", "loop", "(", "$", "data", ",", "Closure", "$", "callable", ")", "{", "if", "(", "!", "is_array", "(", "$", "data", ")", "&&", "!", "is_object", "(", "$", "data", ")", ")", "{", "return", ";", "}", "foreach", "(", "$", "da...
Loop through the given data and call the given function. @param array|object $data @param Closure $callable
[ "Loop", "through", "the", "given", "data", "and", "call", "the", "given", "function", "." ]
f00e566d682a66796f3f8a68b348920fadd9ee87
https://github.com/kriskbx/mikado/blob/f00e566d682a66796f3f8a68b348920fadd9ee87/src/Data/FormatAbleObject.php#L275-L284
13,069
kriskbx/mikado
src/Data/FormatAbleObject.php
FormatAbleObject.unsetNullRecursively
protected function unsetNullRecursively($data, $reference = null) { if (is_null($reference)) { $reference = $data; } $this->loop($reference, function ($key, $value) use (&$data) { if (is_array($data)) { if (is_null($value)) { unset...
php
protected function unsetNullRecursively($data, $reference = null) { if (is_null($reference)) { $reference = $data; } $this->loop($reference, function ($key, $value) use (&$data) { if (is_array($data)) { if (is_null($value)) { unset...
[ "protected", "function", "unsetNullRecursively", "(", "$", "data", ",", "$", "reference", "=", "null", ")", "{", "if", "(", "is_null", "(", "$", "reference", ")", ")", "{", "$", "reference", "=", "$", "data", ";", "}", "$", "this", "->", "loop", "(",...
Unset null properties and keys of the given data. @param array|object $data @return array|object
[ "Unset", "null", "properties", "and", "keys", "of", "the", "given", "data", "." ]
f00e566d682a66796f3f8a68b348920fadd9ee87
https://github.com/kriskbx/mikado/blob/f00e566d682a66796f3f8a68b348920fadd9ee87/src/Data/FormatAbleObject.php#L293-L318
13,070
DevGroup-ru/yii2-data-structure-tools
src/Properties/Module.php
Module.prepareWizardData
public function prepareWizardData() { $cacheKey = 'property-wizard' . md5(implode(':', $this->handlersList)); $data = Yii::$app->cache->get($cacheKey); if (false === $data) { $query = (new Query())->from(PropertyHandlers::tableName())->indexBy('id')->select('class_name'); ...
php
public function prepareWizardData() { $cacheKey = 'property-wizard' . md5(implode(':', $this->handlersList)); $data = Yii::$app->cache->get($cacheKey); if (false === $data) { $query = (new Query())->from(PropertyHandlers::tableName())->indexBy('id')->select('class_name'); ...
[ "public", "function", "prepareWizardData", "(", ")", "{", "$", "cacheKey", "=", "'property-wizard'", ".", "md5", "(", "implode", "(", "':'", ",", "$", "this", "->", "handlersList", ")", ")", ";", "$", "data", "=", "Yii", "::", "$", "app", "->", "cache"...
Prepares json string to use in js property creation wizard @return array
[ "Prepares", "json", "string", "to", "use", "in", "js", "property", "creation", "wizard" ]
a5b24d7c0b24d4b0d58cacd91ec7fd876e979097
https://github.com/DevGroup-ru/yii2-data-structure-tools/blob/a5b24d7c0b24d4b0d58cacd91ec7fd876e979097/src/Properties/Module.php#L72-L106
13,071
ahuggins/utilities
src/Console/Commands/SetDatabaseCredentials.php
SetDatabaseCredentials.handle
public function handle() { if (! $this->confirm('Set up DB creds now? [y|N]')) { return; } $connected = false; while (! $connected) { $host = $this->askDatabaseHost(); $name = $this->askDatabaseName(); $user = $this->askDatabaseUser...
php
public function handle() { if (! $this->confirm('Set up DB creds now? [y|N]')) { return; } $connected = false; while (! $connected) { $host = $this->askDatabaseHost(); $name = $this->askDatabaseName(); $user = $this->askDatabaseUser...
[ "public", "function", "handle", "(", ")", "{", "if", "(", "!", "$", "this", "->", "confirm", "(", "'Set up DB creds now? [y|N]'", ")", ")", "{", "return", ";", "}", "$", "connected", "=", "false", ";", "while", "(", "!", "$", "connected", ")", "{", "...
Handle the Command @return mixed
[ "Handle", "the", "Command" ]
efb79f2dd12335e8115722568239ee22c899e0f1
https://github.com/ahuggins/utilities/blob/efb79f2dd12335e8115722568239ee22c899e0f1/src/Console/Commands/SetDatabaseCredentials.php#L56-L85
13,072
Webiny/AnalyticsDb
src/Webiny/AnalyticsDb/Query.php
Query.stats
public function stats() { return new Query\Stats($this->mongo, $this->entity, $this->ref, $this->dateRange); }
php
public function stats() { return new Query\Stats($this->mongo, $this->entity, $this->ref, $this->dateRange); }
[ "public", "function", "stats", "(", ")", "{", "return", "new", "Query", "\\", "Stats", "(", "$", "this", "->", "mongo", ",", "$", "this", "->", "entity", ",", "$", "this", "->", "ref", ",", "$", "this", "->", "dateRange", ")", ";", "}" ]
Query daily or monthly statistics. @return Query\Stats
[ "Query", "daily", "or", "monthly", "statistics", "." ]
e0b1e920643cd63071406520767243736004052e
https://github.com/Webiny/AnalyticsDb/blob/e0b1e920643cd63071406520767243736004052e/src/Webiny/AnalyticsDb/Query.php#L62-L65
13,073
Webiny/AnalyticsDb
src/Webiny/AnalyticsDb/Query.php
Query.dimension
public function dimension($name = null, $value = null) { $query = new Query\Dimensions($this->mongo, $this->entity, $this->ref, $this->dateRange); if (!empty($name)) { if (!empty($value)) { $query->setDimension($name, $value); } else { $query->...
php
public function dimension($name = null, $value = null) { $query = new Query\Dimensions($this->mongo, $this->entity, $this->ref, $this->dateRange); if (!empty($name)) { if (!empty($value)) { $query->setDimension($name, $value); } else { $query->...
[ "public", "function", "dimension", "(", "$", "name", "=", "null", ",", "$", "value", "=", "null", ")", "{", "$", "query", "=", "new", "Query", "\\", "Dimensions", "(", "$", "this", "->", "mongo", ",", "$", "this", "->", "entity", ",", "$", "this", ...
Query the dimensions. @param string $name Dimension name @param string $value Dimension value @return Query\Dimensions
[ "Query", "the", "dimensions", "." ]
e0b1e920643cd63071406520767243736004052e
https://github.com/Webiny/AnalyticsDb/blob/e0b1e920643cd63071406520767243736004052e/src/Webiny/AnalyticsDb/Query.php#L75-L87
13,074
crysalead/net
src/Http/Cookie/Cookie.php
Cookie.discard
public function discard($discard = null) { if (func_num_args() === 0) { return $this->_data['discard']; } return $this->_data['discard'] = (boolean) $discard; }
php
public function discard($discard = null) { if (func_num_args() === 0) { return $this->_data['discard']; } return $this->_data['discard'] = (boolean) $discard; }
[ "public", "function", "discard", "(", "$", "discard", "=", "null", ")", "{", "if", "(", "func_num_args", "(", ")", "===", "0", ")", "{", "return", "$", "this", "->", "_data", "[", "'discard'", "]", ";", "}", "return", "$", "this", "->", "_data", "[...
Set whether or not this is a session cookie. @param boolean $discard The discard value. @return boolean Returns discard value.
[ "Set", "whether", "or", "not", "this", "is", "a", "session", "cookie", "." ]
4d75abead39e954529b56cbffa3841a9cd3044bb
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Cookie/Cookie.php#L202-L208
13,075
crysalead/net
src/Http/Cookie/Cookie.php
Cookie.matches
public function matches($url) { $infos = parse_url($url); if ($this->expired()) { return false; } if (!$this->matchesScheme($infos['scheme'])) { return false; } if (!$this->matchesDomain($infos['host'])) { return false; }...
php
public function matches($url) { $infos = parse_url($url); if ($this->expired()) { return false; } if (!$this->matchesScheme($infos['scheme'])) { return false; } if (!$this->matchesDomain($infos['host'])) { return false; }...
[ "public", "function", "matches", "(", "$", "url", ")", "{", "$", "infos", "=", "parse_url", "(", "$", "url", ")", ";", "if", "(", "$", "this", "->", "expired", "(", ")", ")", "{", "return", "false", ";", "}", "if", "(", "!", "$", "this", "->", ...
Checks if a scheme, domain and path match the Cookie ones. @param string $url The URL path. @return boolean Returns `true` if it matches, `false otherwise`.
[ "Checks", "if", "a", "scheme", "domain", "and", "path", "match", "the", "Cookie", "ones", "." ]
4d75abead39e954529b56cbffa3841a9cd3044bb
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Cookie/Cookie.php#L226-L243
13,076
crysalead/net
src/Http/Cookie/Cookie.php
Cookie.matchesPath
public function matchesPath($path) { if ($this->_data['path'] === '/' || $this->_data['path'] === $path) { return true; } if (strpos($path, $this->_data['path']) !== 0) { return false; } if (substr($this->_data['path'], -1, 1) === '/') { ...
php
public function matchesPath($path) { if ($this->_data['path'] === '/' || $this->_data['path'] === $path) { return true; } if (strpos($path, $this->_data['path']) !== 0) { return false; } if (substr($this->_data['path'], -1, 1) === '/') { ...
[ "public", "function", "matchesPath", "(", "$", "path", ")", "{", "if", "(", "$", "this", "->", "_data", "[", "'path'", "]", "===", "'/'", "||", "$", "this", "->", "_data", "[", "'path'", "]", "===", "$", "path", ")", "{", "return", "true", ";", "...
Checks if a path match the Cookie path. @param string $scheme The scheme name. @return boolean Returns `true` if schemes match, `false otherwise`.
[ "Checks", "if", "a", "path", "match", "the", "Cookie", "path", "." ]
4d75abead39e954529b56cbffa3841a9cd3044bb
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Cookie/Cookie.php#L251-L266
13,077
crysalead/net
src/Http/Cookie/Cookie.php
Cookie.matchesScheme
public function matchesScheme($scheme) { $scheme = strtolower($scheme); $secure = $this->_data['secure']; return ($secure && $scheme === 'https') || (!$secure && $scheme === 'http'); }
php
public function matchesScheme($scheme) { $scheme = strtolower($scheme); $secure = $this->_data['secure']; return ($secure && $scheme === 'https') || (!$secure && $scheme === 'http'); }
[ "public", "function", "matchesScheme", "(", "$", "scheme", ")", "{", "$", "scheme", "=", "strtolower", "(", "$", "scheme", ")", ";", "$", "secure", "=", "$", "this", "->", "_data", "[", "'secure'", "]", ";", "return", "(", "$", "secure", "&&", "$", ...
Checks if a domain match the Cookie scheme. @param string $scheme The scheme name. @return boolean Returns `true` if schemes match, `false otherwise`.
[ "Checks", "if", "a", "domain", "match", "the", "Cookie", "scheme", "." ]
4d75abead39e954529b56cbffa3841a9cd3044bb
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Cookie/Cookie.php#L274-L279
13,078
crysalead/net
src/Http/Cookie/Cookie.php
Cookie.expired
public function expired($onSessionExpires = false) { if (!$this->_data['expires'] && $onSessionExpires) { return true; } return $this->_data['expires'] < time() && $this->_data['expires']; }
php
public function expired($onSessionExpires = false) { if (!$this->_data['expires'] && $onSessionExpires) { return true; } return $this->_data['expires'] < time() && $this->_data['expires']; }
[ "public", "function", "expired", "(", "$", "onSessionExpires", "=", "false", ")", "{", "if", "(", "!", "$", "this", "->", "_data", "[", "'expires'", "]", "&&", "$", "onSessionExpires", ")", "{", "return", "true", ";", "}", "return", "$", "this", "->", ...
Checks if the Cookie expired. @param boolean $onSessionExpires Sets to `true` to check if the Cookie will expires when the session expires. @return boolean
[ "Checks", "if", "the", "Cookie", "expired", "." ]
4d75abead39e954529b56cbffa3841a9cd3044bb
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Cookie/Cookie.php#L314-L321
13,079
crysalead/net
src/Http/Cookie/Cookie.php
Cookie.toString
public function toString() { $parts = []; $data = $this->data(); $parts[] = $data['name'] . '=' . rawurlencode($data['value']); if ($data['domain']) { $parts[] = 'Domain=' . $data['domain']; } if ($data['path']) { $parts[] = 'Path=' . $data['p...
php
public function toString() { $parts = []; $data = $this->data(); $parts[] = $data['name'] . '=' . rawurlencode($data['value']); if ($data['domain']) { $parts[] = 'Domain=' . $data['domain']; } if ($data['path']) { $parts[] = 'Path=' . $data['p...
[ "public", "function", "toString", "(", ")", "{", "$", "parts", "=", "[", "]", ";", "$", "data", "=", "$", "this", "->", "data", "(", ")", ";", "$", "parts", "[", "]", "=", "$", "data", "[", "'name'", "]", ".", "'='", ".", "rawurlencode", "(", ...
Return a Set-Cookie string representation of a Cookie. @param string $cookie The Cookie. @return string
[ "Return", "a", "Set", "-", "Cookie", "string", "representation", "of", "a", "Cookie", "." ]
4d75abead39e954529b56cbffa3841a9cd3044bb
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Cookie/Cookie.php#L360-L384
13,080
crysalead/net
src/Http/Cookie/Cookie.php
Cookie.fromString
public static function fromString($value) { $parts = array_filter(array_map('trim', explode(';', $value))); if (empty($parts) || !strpos($parts[0], '=')) { return []; } $config = []; $pieces = explode('=', array_shift($parts), 2); if (count($pieces) !==...
php
public static function fromString($value) { $parts = array_filter(array_map('trim', explode(';', $value))); if (empty($parts) || !strpos($parts[0], '=')) { return []; } $config = []; $pieces = explode('=', array_shift($parts), 2); if (count($pieces) !==...
[ "public", "static", "function", "fromString", "(", "$", "value", ")", "{", "$", "parts", "=", "array_filter", "(", "array_map", "(", "'trim'", ",", "explode", "(", "';'", ",", "$", "value", ")", ")", ")", ";", "if", "(", "empty", "(", "$", "parts", ...
Create a new Cookie object from a Set-Cookie header value @param string $value Set-Cookie header value. @return self
[ "Create", "a", "new", "Cookie", "object", "from", "a", "Set", "-", "Cookie", "header", "value" ]
4d75abead39e954529b56cbffa3841a9cd3044bb
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Cookie/Cookie.php#L393-L420
13,081
crysalead/net
src/Http/Cookie/Cookie.php
Cookie.isValidTimeStamp
public static function isValidTimeStamp($timestamp) { return ((string) (integer) $timestamp === (string) $timestamp) && $timestamp <= PHP_INT_MAX && $timestamp >= ~PHP_INT_MAX; }
php
public static function isValidTimeStamp($timestamp) { return ((string) (integer) $timestamp === (string) $timestamp) && $timestamp <= PHP_INT_MAX && $timestamp >= ~PHP_INT_MAX; }
[ "public", "static", "function", "isValidTimeStamp", "(", "$", "timestamp", ")", "{", "return", "(", "(", "string", ")", "(", "integer", ")", "$", "timestamp", "===", "(", "string", ")", "$", "timestamp", ")", "&&", "$", "timestamp", "<=", "PHP_INT_MAX", ...
Checks if a timestamp is valid. @param integer|string $timestamp The timestamp to check. @return boolean
[ "Checks", "if", "a", "timestamp", "is", "valid", "." ]
4d75abead39e954529b56cbffa3841a9cd3044bb
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Http/Cookie/Cookie.php#L445-L448
13,082
abhi1693/yii2-enum
helpers/EnumException.php
EnumException.invalidValue
public static function invalidValue($type, $value) { if (is_object($value)) { $value = get_class($value); } elseif (is_bool($value) || is_null($value)) { $value = var_export($value, true); } return new self(sprintf('The type "%s" does not have a name for the ...
php
public static function invalidValue($type, $value) { if (is_object($value)) { $value = get_class($value); } elseif (is_bool($value) || is_null($value)) { $value = var_export($value, true); } return new self(sprintf('The type "%s" does not have a name for the ...
[ "public", "static", "function", "invalidValue", "(", "$", "type", ",", "$", "value", ")", "{", "if", "(", "is_object", "(", "$", "value", ")", ")", "{", "$", "value", "=", "get_class", "(", "$", "value", ")", ";", "}", "elseif", "(", "is_bool", "("...
Creates a new exception for a value that is not valid for a type @param string $type The name of the type @param string $value The invalid value @return EnumException The new exception
[ "Creates", "a", "new", "exception", "for", "a", "value", "that", "is", "not", "valid", "for", "a", "type" ]
1def6522303fa8f0277f09d1123229c32c942cd9
https://github.com/abhi1693/yii2-enum/blob/1def6522303fa8f0277f09d1123229c32c942cd9/helpers/EnumException.php#L38-L47
13,083
sifophp/sifo-common-instance
controllers/shared/commandLine.php
SharedCommandLineController.showMessage
protected function showMessage( $message, $in_mode = self::ALL, $params = NULL ) { if ( isset( $params ) && is_array( $params ) ) { $color_codes = ''; $tabs = ''; foreach ( $params as $key => $value ) { switch ( $key ) { case 'foreground': { $color_codes .= "\033[" . $this->_...
php
protected function showMessage( $message, $in_mode = self::ALL, $params = NULL ) { if ( isset( $params ) && is_array( $params ) ) { $color_codes = ''; $tabs = ''; foreach ( $params as $key => $value ) { switch ( $key ) { case 'foreground': { $color_codes .= "\033[" . $this->_...
[ "protected", "function", "showMessage", "(", "$", "message", ",", "$", "in_mode", "=", "self", "::", "ALL", ",", "$", "params", "=", "NULL", ")", "{", "if", "(", "isset", "(", "$", "params", ")", "&&", "is_array", "(", "$", "params", ")", ")", "{",...
Print a message on the console. Usage example: $this->showMessage( 'Example message', self::VERBOSE, array( 'background' => 'red', 'indent' => 4 ) ); @param string $message @param string $in_mode (by default: self::ALL) @param array $params (optional array keys: indent, foreground and background) @throws \OutOfBound...
[ "Print", "a", "message", "on", "the", "console", "." ]
52d54ea3e565bd2bccd77e0b0a6a99b5cae3aff5
https://github.com/sifophp/sifo-common-instance/blob/52d54ea3e565bd2bccd77e0b0a6a99b5cae3aff5/controllers/shared/commandLine.php#L166-L226
13,084
sifophp/sifo-common-instance
controllers/shared/commandLine.php
SharedCommandLineController.setNewParam
protected function setNewParam( $short_param_name, $long_param_name, $help_string, $need_second_param, $is_required ) { foreach ( $this->_shell_common_params as $param ) { if ( ( $short_param_name == $param['short_param_name'] ) || ( $long_param_name == $param['long_param_name'] ) ) { throw new \RuntimeE...
php
protected function setNewParam( $short_param_name, $long_param_name, $help_string, $need_second_param, $is_required ) { foreach ( $this->_shell_common_params as $param ) { if ( ( $short_param_name == $param['short_param_name'] ) || ( $long_param_name == $param['long_param_name'] ) ) { throw new \RuntimeE...
[ "protected", "function", "setNewParam", "(", "$", "short_param_name", ",", "$", "long_param_name", ",", "$", "help_string", ",", "$", "need_second_param", ",", "$", "is_required", ")", "{", "foreach", "(", "$", "this", "->", "_shell_common_params", "as", "$", ...
Set a new exec param. @param string $short_param_name The short option id. @param string $long_param_name The long name option. @param string $help_string The help string. @param boolean $need_second_param True if needs a param. @param boolean $is_required Must be set. @throws \RuntimeException
[ "Set", "a", "new", "exec", "param", "." ]
52d54ea3e565bd2bccd77e0b0a6a99b5cae3aff5
https://github.com/sifophp/sifo-common-instance/blob/52d54ea3e565bd2bccd77e0b0a6a99b5cae3aff5/controllers/shared/commandLine.php#L243-L261
13,085
sifophp/sifo-common-instance
controllers/shared/commandLine.php
SharedCommandLineController.parseParams
protected function parseParams() { $this->params['parsed_params'] = array(); foreach ( $this->_shell_common_params as $common_param ) { $value = false; foreach ( $this->command_options as $option ) { if ( $option[0] === $common_param['short_param_name'] || $option[0] === $common_param['long_param_na...
php
protected function parseParams() { $this->params['parsed_params'] = array(); foreach ( $this->_shell_common_params as $common_param ) { $value = false; foreach ( $this->command_options as $option ) { if ( $option[0] === $common_param['short_param_name'] || $option[0] === $common_param['long_param_na...
[ "protected", "function", "parseParams", "(", ")", "{", "$", "this", "->", "params", "[", "'parsed_params'", "]", "=", "array", "(", ")", ";", "foreach", "(", "$", "this", "->", "_shell_common_params", "as", "$", "common_param", ")", "{", "$", "value", "=...
Parse the input arguments and store them in a class property for later usage. @internal param array $params Get params. @return array
[ "Parse", "the", "input", "arguments", "and", "store", "them", "in", "a", "class", "property", "for", "later", "usage", "." ]
52d54ea3e565bd2bccd77e0b0a6a99b5cae3aff5
https://github.com/sifophp/sifo-common-instance/blob/52d54ea3e565bd2bccd77e0b0a6a99b5cae3aff5/controllers/shared/commandLine.php#L568-L593
13,086
crysalead/net
src/MixedPart.php
MixedPart._updateContentType
public function _updateContentType() { unset($this->_headers['Content-Type']); $suffix = ''; if ($this->isMultipart()) { $suffix = '; boundary=' . $this->boundary(); } elseif ($this->_charset) { $suffix = '; charset=' . $this->_charset . $suffix; } ...
php
public function _updateContentType() { unset($this->_headers['Content-Type']); $suffix = ''; if ($this->isMultipart()) { $suffix = '; boundary=' . $this->boundary(); } elseif ($this->_charset) { $suffix = '; charset=' . $this->_charset . $suffix; } ...
[ "public", "function", "_updateContentType", "(", ")", "{", "unset", "(", "$", "this", "->", "_headers", "[", "'Content-Type'", "]", ")", ";", "$", "suffix", "=", "''", ";", "if", "(", "$", "this", "->", "isMultipart", "(", ")", ")", "{", "$", "suffix...
Update Content-Type helper
[ "Update", "Content", "-", "Type", "helper" ]
4d75abead39e954529b56cbffa3841a9cd3044bb
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/MixedPart.php#L152-L164
13,087
crysalead/net
src/MixedPart.php
MixedPart.syncContentType
public function syncContentType() { $stream = reset($this->_streams); if (!$this->isMultipart() && $stream) { unset($this->_headers['Content-Type']); $this->mime($stream->mime()); $this->charset($stream->charset()); unset($this->_headers['Content-Trans...
php
public function syncContentType() { $stream = reset($this->_streams); if (!$this->isMultipart() && $stream) { unset($this->_headers['Content-Type']); $this->mime($stream->mime()); $this->charset($stream->charset()); unset($this->_headers['Content-Trans...
[ "public", "function", "syncContentType", "(", ")", "{", "$", "stream", "=", "reset", "(", "$", "this", "->", "_streams", ")", ";", "if", "(", "!", "$", "this", "->", "isMultipart", "(", ")", "&&", "$", "stream", ")", "{", "unset", "(", "$", "this",...
Sync Content-Type helper.
[ "Sync", "Content", "-", "Type", "helper", "." ]
4d75abead39e954529b56cbffa3841a9cd3044bb
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/MixedPart.php#L299-L311
13,088
crysalead/net
src/MixedPart.php
MixedPart._headers
protected function _headers($options, $mime, $charset, $encoding, $length) { $headers = !empty($options['headers']) ? $options['headers'] : []; if (!empty($options['disposition'])) { $parts = [$options['disposition']]; foreach (['name', 'filename'] as $name) { ...
php
protected function _headers($options, $mime, $charset, $encoding, $length) { $headers = !empty($options['headers']) ? $options['headers'] : []; if (!empty($options['disposition'])) { $parts = [$options['disposition']]; foreach (['name', 'filename'] as $name) { ...
[ "protected", "function", "_headers", "(", "$", "options", ",", "$", "mime", ",", "$", "charset", ",", "$", "encoding", ",", "$", "length", ")", "{", "$", "headers", "=", "!", "empty", "(", "$", "options", "[", "'headers'", "]", ")", "?", "$", "opti...
Extract headers form streams options. @param array $options The stream end user options. @param string $length The length of the encoded stream. @return array
[ "Extract", "headers", "form", "streams", "options", "." ]
4d75abead39e954529b56cbffa3841a9cd3044bb
https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/MixedPart.php#L364-L410
13,089
transfer-framework/transfer
src/Transfer/Adapter/LocalDirectoryAdapter.php
LocalDirectoryAdapter.currentCallback
public function currentCallback(CallbackIterator $iterator) { $clientFilename = $this->fileNames[$iterator->key()]; $filename = $this->directory.DIRECTORY_SEPARATOR.$clientFilename; $fileObject = new ValueObject(file_get_contents($filename)); $fileObject->setProperty('filename', $fi...
php
public function currentCallback(CallbackIterator $iterator) { $clientFilename = $this->fileNames[$iterator->key()]; $filename = $this->directory.DIRECTORY_SEPARATOR.$clientFilename; $fileObject = new ValueObject(file_get_contents($filename)); $fileObject->setProperty('filename', $fi...
[ "public", "function", "currentCallback", "(", "CallbackIterator", "$", "iterator", ")", "{", "$", "clientFilename", "=", "$", "this", "->", "fileNames", "[", "$", "iterator", "->", "key", "(", ")", "]", ";", "$", "filename", "=", "$", "this", "->", "dire...
Returns a file object. @param CallbackIterator $iterator @return ValueObject
[ "Returns", "a", "file", "object", "." ]
9225ae068d5924982f14ad4446b15f75384a058a
https://github.com/transfer-framework/transfer/blob/9225ae068d5924982f14ad4446b15f75384a058a/src/Transfer/Adapter/LocalDirectoryAdapter.php#L94-L104
13,090
dekuan/delib
src/CMIdLib.php
CMIdLib.isValidMId
static function isValidMId( $vMId ) { $bRet = false; if ( is_array( $vMId ) && count( $vMId ) > 0 ) { $bRet = true; foreach ( $vMId as $vItem ) { if ( ! CDId::getInstance()->isValidId( $vItem ) ) { $bRet = false; break; } } } else { $bRet = CDId::getInstance()->isValid...
php
static function isValidMId( $vMId ) { $bRet = false; if ( is_array( $vMId ) && count( $vMId ) > 0 ) { $bRet = true; foreach ( $vMId as $vItem ) { if ( ! CDId::getInstance()->isValidId( $vItem ) ) { $bRet = false; break; } } } else { $bRet = CDId::getInstance()->isValid...
[ "static", "function", "isValidMId", "(", "$", "vMId", ")", "{", "$", "bRet", "=", "false", ";", "if", "(", "is_array", "(", "$", "vMId", ")", "&&", "count", "(", "$", "vMId", ")", ">", "0", ")", "{", "$", "bRet", "=", "true", ";", "foreach", "(...
check if a mid is valid @param $vMId mixed @return boolean
[ "check", "if", "a", "mid", "is", "valid" ]
a0b82c5f1eb0cf7379eac3670ebf362787a7c6f8
https://github.com/dekuan/delib/blob/a0b82c5f1eb0cf7379eac3670ebf362787a7c6f8/src/CMIdLib.php#L19-L41
13,091
dekuan/delib
src/CMIdLib.php
CMIdLib.createMId
static function createMId( $nCenter = 0, $nNode = 0, $sSource = null, & $arrData = null ) { return CDId::getInstance()->createId( $nCenter, $nNode, $sSource, $arrData ); }
php
static function createMId( $nCenter = 0, $nNode = 0, $sSource = null, & $arrData = null ) { return CDId::getInstance()->createId( $nCenter, $nNode, $sSource, $arrData ); }
[ "static", "function", "createMId", "(", "$", "nCenter", "=", "0", ",", "$", "nNode", "=", "0", ",", "$", "sSource", "=", "null", ",", "&", "$", "arrData", "=", "null", ")", "{", "return", "CDId", "::", "getInstance", "(", ")", "->", "createId", "("...
create a new mid @param $nCenter int @param $nNode int @param $sSource string @param $arrData array @return int
[ "create", "a", "new", "mid" ]
a0b82c5f1eb0cf7379eac3670ebf362787a7c6f8
https://github.com/dekuan/delib/blob/a0b82c5f1eb0cf7379eac3670ebf362787a7c6f8/src/CMIdLib.php#L52-L55
13,092
christophe-brachet/aspi-framework
src/Framework/Form/Element/Input/Captcha.php
Captcha.createNewToken
public function createNewToken($captcha = null, $answer = null, $expire = 300) { if ((null === $captcha) || (null === $answer)) { $captcha = $this->generateEquation(); $answer = $this->evaluateEquation($captcha); } $this->token = [ 'captcha' => $captcha, ...
php
public function createNewToken($captcha = null, $answer = null, $expire = 300) { if ((null === $captcha) || (null === $answer)) { $captcha = $this->generateEquation(); $answer = $this->evaluateEquation($captcha); } $this->token = [ 'captcha' => $captcha, ...
[ "public", "function", "createNewToken", "(", "$", "captcha", "=", "null", ",", "$", "answer", "=", "null", ",", "$", "expire", "=", "300", ")", "{", "if", "(", "(", "null", "===", "$", "captcha", ")", "||", "(", "null", "===", "$", "answer", ")", ...
Set the token of the CAPTCHA form element @param string $captcha @param string $answer @param int $expire @return Captcha
[ "Set", "the", "token", "of", "the", "CAPTCHA", "form", "element" ]
17a36c8a8582e0b8d8bff7087590c09a9bd4af1e
https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/Element/Input/Captcha.php#L66-L80
13,093
christophe-brachet/aspi-framework
src/Framework/Form/Element/Input/Captcha.php
Captcha.setLabel
public function setLabel($label) { parent::setLabel($label); if (isset($this->token['captcha'])) { if ((strpos($this->token['captcha'], '<img') === false) && ((strpos($this->token['captcha'], ' + ') !== false) || (strpos($this->token['captcha'], ' - ') !=...
php
public function setLabel($label) { parent::setLabel($label); if (isset($this->token['captcha'])) { if ((strpos($this->token['captcha'], '<img') === false) && ((strpos($this->token['captcha'], ' + ') !== false) || (strpos($this->token['captcha'], ' - ') !=...
[ "public", "function", "setLabel", "(", "$", "label", ")", "{", "parent", "::", "setLabel", "(", "$", "label", ")", ";", "if", "(", "isset", "(", "$", "this", "->", "token", "[", "'captcha'", "]", ")", ")", "{", "if", "(", "(", "strpos", "(", "$",...
Set the label of the captcha form element @param string $label @return Captcha
[ "Set", "the", "label", "of", "the", "captcha", "form", "element" ]
17a36c8a8582e0b8d8bff7087590c09a9bd4af1e
https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/Element/Input/Captcha.php#L96-L112
13,094
christophe-brachet/aspi-framework
src/Framework/Form/Element/Input/Captcha.php
Captcha.generateEquation
protected function generateEquation() { $ops = [' + ', ' - ', ' * ', ' / ']; $equation = null; $rand1 = rand(1, 10); $rand2 = rand(1, 10); $op = $ops[rand(0, 3)]; // If the operator is division, keep the equation very simple, with no remainder if ($op == ' ...
php
protected function generateEquation() { $ops = [' + ', ' - ', ' * ', ' / ']; $equation = null; $rand1 = rand(1, 10); $rand2 = rand(1, 10); $op = $ops[rand(0, 3)]; // If the operator is division, keep the equation very simple, with no remainder if ($op == ' ...
[ "protected", "function", "generateEquation", "(", ")", "{", "$", "ops", "=", "[", "' + '", ",", "' - '", ",", "' * '", ",", "' / '", "]", ";", "$", "equation", "=", "null", ";", "$", "rand1", "=", "rand", "(", "1", ",", "10", ")", ";", "$", "rand...
Randomly generate a simple, basic equation @return string
[ "Randomly", "generate", "a", "simple", "basic", "equation" ]
17a36c8a8582e0b8d8bff7087590c09a9bd4af1e
https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/Element/Input/Captcha.php#L161-L179
13,095
breadlesscode/neos-listable
Classes/Fusion/PaginationArrayImplementation.php
PaginationArrayImplementation.calculateFirstAndLastPage
protected function calculateFirstAndLastPage() { $delta = \floor($this->maximumNumberOfLinks / 2); $firstPage = $this->currentPage - $delta; $lastPage = $this->currentPage + $delta + ($this->maximumNumberOfLinks % 2 === 0 ? 1 : 0); if ($firstPage < 1) { $lastPage -= $fir...
php
protected function calculateFirstAndLastPage() { $delta = \floor($this->maximumNumberOfLinks / 2); $firstPage = $this->currentPage - $delta; $lastPage = $this->currentPage + $delta + ($this->maximumNumberOfLinks % 2 === 0 ? 1 : 0); if ($firstPage < 1) { $lastPage -= $fir...
[ "protected", "function", "calculateFirstAndLastPage", "(", ")", "{", "$", "delta", "=", "\\", "floor", "(", "$", "this", "->", "maximumNumberOfLinks", "/", "2", ")", ";", "$", "firstPage", "=", "$", "this", "->", "currentPage", "-", "$", "delta", ";", "$...
calculates the first and last page to show @return void
[ "calculates", "the", "first", "and", "last", "page", "to", "show" ]
a1d77ab86f4f9b12a81bbe86959be0874d4a1b92
https://github.com/breadlesscode/neos-listable/blob/a1d77ab86f4f9b12a81bbe86959be0874d4a1b92/Classes/Fusion/PaginationArrayImplementation.php#L39-L54
13,096
breadlesscode/neos-listable
Classes/Fusion/PaginationArrayImplementation.php
PaginationArrayImplementation.getNumberOfPages
protected function getNumberOfPages() { $numberOfPages = \ceil($this->totalCount / $this->itemsPerPage); if ($this->maximumNumberOfLinks > $numberOfPages) { return $numberOfPages; } return $numberOfPages; }
php
protected function getNumberOfPages() { $numberOfPages = \ceil($this->totalCount / $this->itemsPerPage); if ($this->maximumNumberOfLinks > $numberOfPages) { return $numberOfPages; } return $numberOfPages; }
[ "protected", "function", "getNumberOfPages", "(", ")", "{", "$", "numberOfPages", "=", "\\", "ceil", "(", "$", "this", "->", "totalCount", "/", "$", "this", "->", "itemsPerPage", ")", ";", "if", "(", "$", "this", "->", "maximumNumberOfLinks", ">", "$", "...
calculates the number of pages @return integer
[ "calculates", "the", "number", "of", "pages" ]
a1d77ab86f4f9b12a81bbe86959be0874d4a1b92
https://github.com/breadlesscode/neos-listable/blob/a1d77ab86f4f9b12a81bbe86959be0874d4a1b92/Classes/Fusion/PaginationArrayImplementation.php#L60-L68
13,097
breadlesscode/neos-listable
Classes/Fusion/PaginationArrayImplementation.php
PaginationArrayImplementation.getPageArray
protected function getPageArray() { $range = \range($this->firstPage, $this->lastPage); $pageArray = []; foreach ($range as $page) { $pageArray[] = [ 'page' => $page, 'label' => $page, 'type' => 'page' ]; } ...
php
protected function getPageArray() { $range = \range($this->firstPage, $this->lastPage); $pageArray = []; foreach ($range as $page) { $pageArray[] = [ 'page' => $page, 'label' => $page, 'type' => 'page' ]; } ...
[ "protected", "function", "getPageArray", "(", ")", "{", "$", "range", "=", "\\", "range", "(", "$", "this", "->", "firstPage", ",", "$", "this", "->", "lastPage", ")", ";", "$", "pageArray", "=", "[", "]", ";", "foreach", "(", "$", "range", "as", "...
get an array of pages to display @return array
[ "get", "an", "array", "of", "pages", "to", "display" ]
a1d77ab86f4f9b12a81bbe86959be0874d4a1b92
https://github.com/breadlesscode/neos-listable/blob/a1d77ab86f4f9b12a81bbe86959be0874d4a1b92/Classes/Fusion/PaginationArrayImplementation.php#L74-L88
13,098
breadlesscode/neos-listable
Classes/Fusion/PaginationArrayImplementation.php
PaginationArrayImplementation.addItemToTheStartOfPageArray
protected function addItemToTheStartOfPageArray($pageArray, $page, $type) { array_unshift($pageArray, [ 'page' => $page, 'label' => $this->paginationConfig['labels'][$type], 'type' => $type ]); return $pageArray; }
php
protected function addItemToTheStartOfPageArray($pageArray, $page, $type) { array_unshift($pageArray, [ 'page' => $page, 'label' => $this->paginationConfig['labels'][$type], 'type' => $type ]); return $pageArray; }
[ "protected", "function", "addItemToTheStartOfPageArray", "(", "$", "pageArray", ",", "$", "page", ",", "$", "type", ")", "{", "array_unshift", "(", "$", "pageArray", ",", "[", "'page'", "=>", "$", "page", ",", "'label'", "=>", "$", "this", "->", "paginatio...
add a item to the start of the page array @param array $pageArray @param integer $page @param string $type @return array
[ "add", "a", "item", "to", "the", "start", "of", "the", "page", "array" ]
a1d77ab86f4f9b12a81bbe86959be0874d4a1b92
https://github.com/breadlesscode/neos-listable/blob/a1d77ab86f4f9b12a81bbe86959be0874d4a1b92/Classes/Fusion/PaginationArrayImplementation.php#L97-L106
13,099
breadlesscode/neos-listable
Classes/Fusion/PaginationArrayImplementation.php
PaginationArrayImplementation.addItemToTheEndOfPageArray
protected function addItemToTheEndOfPageArray($pageArray, $page, $type) { $pageArray[] = [ 'page' => $page, 'label' => $this->paginationConfig['labels'][$type], 'type' => $type ]; return $pageArray; }
php
protected function addItemToTheEndOfPageArray($pageArray, $page, $type) { $pageArray[] = [ 'page' => $page, 'label' => $this->paginationConfig['labels'][$type], 'type' => $type ]; return $pageArray; }
[ "protected", "function", "addItemToTheEndOfPageArray", "(", "$", "pageArray", ",", "$", "page", ",", "$", "type", ")", "{", "$", "pageArray", "[", "]", "=", "[", "'page'", "=>", "$", "page", ",", "'label'", "=>", "$", "this", "->", "paginationConfig", "[...
add a item to the end of the page array @param array $pageArray @param integer $page @param string $type @return array
[ "add", "a", "item", "to", "the", "end", "of", "the", "page", "array" ]
a1d77ab86f4f9b12a81bbe86959be0874d4a1b92
https://github.com/breadlesscode/neos-listable/blob/a1d77ab86f4f9b12a81bbe86959be0874d4a1b92/Classes/Fusion/PaginationArrayImplementation.php#L115-L124