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
35,500
hail-framework/framework
src/Template/Engine.php
Engine.compile
public function compile($name): string { [ 'template' => $template, 'cache' => $cache, ] = $this->getTemplateFile($name); if (\filemtime($template) < @\filemtime($cache)) { return $cache; } $root = Tokenizer\Tokenizer::parseFile($template...
php
public function compile($name): string { [ 'template' => $template, 'cache' => $cache, ] = $this->getTemplateFile($name); if (\filemtime($template) < @\filemtime($cache)) { return $cache; } $root = Tokenizer\Tokenizer::parseFile($template...
[ "public", "function", "compile", "(", "$", "name", ")", ":", "string", "{", "[", "'template'", "=>", "$", "template", ",", "'cache'", "=>", "$", "cache", ",", "]", "=", "$", "this", "->", "getTemplateFile", "(", "$", "name", ")", ";", "if", "(", "\...
Compile the html, and return the compiled file. @return string the compiled file.
[ "Compile", "the", "html", "and", "return", "the", "compiled", "file", "." ]
d419e6c098d29ef9b62192b74050e51985b94f90
https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Template/Engine.php#L340-L358
35,501
hail-framework/framework
src/Filesystem/Adapter/Memory.php
Memory.doListContents
protected function doListContents($directory, $recursive) { $filter = function ($path) use ($directory, $recursive) { // Remove the root directory from any listing. if ($path === '') { return false; } if (Util::dirname($path) === $directory) { return true; } return $recursive && $this->pa...
php
protected function doListContents($directory, $recursive) { $filter = function ($path) use ($directory, $recursive) { // Remove the root directory from any listing. if ($path === '') { return false; } if (Util::dirname($path) === $directory) { return true; } return $recursive && $this->pa...
[ "protected", "function", "doListContents", "(", "$", "directory", ",", "$", "recursive", ")", "{", "$", "filter", "=", "function", "(", "$", "path", ")", "use", "(", "$", "directory", ",", "$", "recursive", ")", "{", "// Remove the root directory from any list...
Filters the file system returning paths inside the directory. @param string $directory @param bool $recursive @return string[]
[ "Filters", "the", "file", "system", "returning", "paths", "inside", "the", "directory", "." ]
d419e6c098d29ef9b62192b74050e51985b94f90
https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Filesystem/Adapter/Memory.php#L269-L285
35,502
hail-framework/framework
src/Util/Validator.php
Validator.validateRequired
protected function validateRequired($field, $value, array $params = [], array $fields = []) { if (isset($params[0]) && (bool) $params[0]) { $find = $this->getPart($fields, \explode('.', $field), true); return $find[1]; } if (null === $value) { return fal...
php
protected function validateRequired($field, $value, array $params = [], array $fields = []) { if (isset($params[0]) && (bool) $params[0]) { $find = $this->getPart($fields, \explode('.', $field), true); return $find[1]; } if (null === $value) { return fal...
[ "protected", "function", "validateRequired", "(", "$", "field", ",", "$", "value", ",", "array", "$", "params", "=", "[", "]", ",", "array", "$", "fields", "=", "[", "]", ")", "{", "if", "(", "isset", "(", "$", "params", "[", "0", "]", ")", "&&",...
Required field validator @param string $field @param mixed $value @param array $params @param array $fields @return bool
[ "Required", "field", "validator" ]
d419e6c098d29ef9b62192b74050e51985b94f90
https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Util/Validator.php#L131-L148
35,503
hail-framework/framework
src/Util/Validator.php
Validator.validateEquals
protected function validateEquals($field, $value, array $params) { // extract the second field value, this accounts for nested array values [$field2Value, $multiple] = $this->getPart($this->_fields, \explode('.', $params[0])); return null !== $field2Value && $value === $field2Value; }
php
protected function validateEquals($field, $value, array $params) { // extract the second field value, this accounts for nested array values [$field2Value, $multiple] = $this->getPart($this->_fields, \explode('.', $params[0])); return null !== $field2Value && $value === $field2Value; }
[ "protected", "function", "validateEquals", "(", "$", "field", ",", "$", "value", ",", "array", "$", "params", ")", "{", "// extract the second field value, this accounts for nested array values", "[", "$", "field2Value", ",", "$", "multiple", "]", "=", "$", "this", ...
Validate that two values match @param string $field @param mixed $value @param array $params @internal param array $fields @return bool
[ "Validate", "that", "two", "values", "match" ]
d419e6c098d29ef9b62192b74050e51985b94f90
https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Util/Validator.php#L160-L166
35,504
hail-framework/framework
src/Util/Validator.php
Validator.validateInteger
protected function validateInteger($field, $value, $params) { if (isset($params[0]) && (bool) $params[0]) { //strict mode return preg_match('/^(\d|-[1-9]|-?[1-9]\d*)$/i', $value); } return \filter_var($value, \FILTER_VALIDATE_INT) !== false; }
php
protected function validateInteger($field, $value, $params) { if (isset($params[0]) && (bool) $params[0]) { //strict mode return preg_match('/^(\d|-[1-9]|-?[1-9]\d*)$/i', $value); } return \filter_var($value, \FILTER_VALIDATE_INT) !== false; }
[ "protected", "function", "validateInteger", "(", "$", "field", ",", "$", "value", ",", "$", "params", ")", "{", "if", "(", "isset", "(", "$", "params", "[", "0", "]", ")", "&&", "(", "bool", ")", "$", "params", "[", "0", "]", ")", "{", "//strict ...
Validate that a field is an integer @param string $field @param mixed $value @return bool
[ "Validate", "that", "a", "field", "is", "an", "integer" ]
d419e6c098d29ef9b62192b74050e51985b94f90
https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Util/Validator.php#L237-L245
35,505
hail-framework/framework
src/Util/Validator.php
Validator.validateLength
protected function validateLength($field, $value, $params) { $length = $this->stringLength($value); // Length between if (isset($params[1])) { return $length >= $params[0] && $length <= $params[1]; } // Length same return ($length !== false) && $length ==...
php
protected function validateLength($field, $value, $params) { $length = $this->stringLength($value); // Length between if (isset($params[1])) { return $length >= $params[0] && $length <= $params[1]; } // Length same return ($length !== false) && $length ==...
[ "protected", "function", "validateLength", "(", "$", "field", ",", "$", "value", ",", "$", "params", ")", "{", "$", "length", "=", "$", "this", "->", "stringLength", "(", "$", "value", ")", ";", "// Length between", "if", "(", "isset", "(", "$", "param...
Validate the length of a string @param string $field @param mixed $value @param array $params @internal param array $fields @return bool
[ "Validate", "the", "length", "of", "a", "string" ]
d419e6c098d29ef9b62192b74050e51985b94f90
https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Util/Validator.php#L257-L267
35,506
hail-framework/framework
src/Util/Validator.php
Validator.validateMin
protected function validateMin($field, $value, $params) { if (!\is_numeric($value)) { return false; } if (\function_exists('\bccomp')) { return !(\bccomp($params[0], $value, 14) === 1); } return $params[0] <= $value; }
php
protected function validateMin($field, $value, $params) { if (!\is_numeric($value)) { return false; } if (\function_exists('\bccomp')) { return !(\bccomp($params[0], $value, 14) === 1); } return $params[0] <= $value; }
[ "protected", "function", "validateMin", "(", "$", "field", ",", "$", "value", ",", "$", "params", ")", "{", "if", "(", "!", "\\", "is_numeric", "(", "$", "value", ")", ")", "{", "return", "false", ";", "}", "if", "(", "\\", "function_exists", "(", ...
Validate the size of a field is greater than a minimum value. @param string $field @param mixed $value @param array $params @internal param array $fields @return bool
[ "Validate", "the", "size", "of", "a", "field", "is", "greater", "than", "a", "minimum", "value", "." ]
d419e6c098d29ef9b62192b74050e51985b94f90
https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Util/Validator.php#L343-L354
35,507
hail-framework/framework
src/Util/Validator.php
Validator.validateMax
protected function validateMax($field, $value, $params) { if (!\is_numeric($value)) { return false; } if (\function_exists('\bccomp')) { return !(\bccomp($value, $params[0], 14) === 1); } return $params[0] >= $value; }
php
protected function validateMax($field, $value, $params) { if (!\is_numeric($value)) { return false; } if (\function_exists('\bccomp')) { return !(\bccomp($value, $params[0], 14) === 1); } return $params[0] >= $value; }
[ "protected", "function", "validateMax", "(", "$", "field", ",", "$", "value", ",", "$", "params", ")", "{", "if", "(", "!", "\\", "is_numeric", "(", "$", "value", ")", ")", "{", "return", "false", ";", "}", "if", "(", "\\", "function_exists", "(", ...
Validate the size of a field is less than a maximum value @param string $field @param mixed $value @param array $params @internal param array $fields @return bool
[ "Validate", "the", "size", "of", "a", "field", "is", "less", "than", "a", "maximum", "value" ]
d419e6c098d29ef9b62192b74050e51985b94f90
https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Util/Validator.php#L366-L377
35,508
hail-framework/framework
src/Util/Validator.php
Validator.validateBetween
protected function validateBetween($field, $value, $params) { if (!\is_numeric($value)) { return false; } if (!isset($params[0]) || !\is_array($params[0]) || \count($params[0]) !== 2) { return false; } list($min, $max) = $params[0]; return $t...
php
protected function validateBetween($field, $value, $params) { if (!\is_numeric($value)) { return false; } if (!isset($params[0]) || !\is_array($params[0]) || \count($params[0]) !== 2) { return false; } list($min, $max) = $params[0]; return $t...
[ "protected", "function", "validateBetween", "(", "$", "field", ",", "$", "value", ",", "$", "params", ")", "{", "if", "(", "!", "\\", "is_numeric", "(", "$", "value", ")", ")", "{", "return", "false", ";", "}", "if", "(", "!", "isset", "(", "$", ...
Validate the size of a field is between min and max values @param string $field @param mixed $value @param array $params @return bool
[ "Validate", "the", "size", "of", "a", "field", "is", "between", "min", "and", "max", "values" ]
d419e6c098d29ef9b62192b74050e51985b94f90
https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Util/Validator.php#L388-L400
35,509
hail-framework/framework
src/Util/Validator.php
Validator.validateIn
protected function validateIn($field, $value, $params) { $isAssoc = \array_values($params[0]) !== $params[0]; if ($isAssoc) { $params[0] = \array_keys($params[0]); } $strict = false; if (isset($params[1])) { $strict = $params[1]; } re...
php
protected function validateIn($field, $value, $params) { $isAssoc = \array_values($params[0]) !== $params[0]; if ($isAssoc) { $params[0] = \array_keys($params[0]); } $strict = false; if (isset($params[1])) { $strict = $params[1]; } re...
[ "protected", "function", "validateIn", "(", "$", "field", ",", "$", "value", ",", "$", "params", ")", "{", "$", "isAssoc", "=", "\\", "array_values", "(", "$", "params", "[", "0", "]", ")", "!==", "$", "params", "[", "0", "]", ";", "if", "(", "$"...
Validate a field is contained within a list of values @param string $field @param mixed $value @param array $params @internal param array $fields @return bool
[ "Validate", "a", "field", "is", "contained", "within", "a", "list", "of", "values" ]
d419e6c098d29ef9b62192b74050e51985b94f90
https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Util/Validator.php#L412-L425
35,510
hail-framework/framework
src/Util/Validator.php
Validator.validateContains
protected function validateContains($field, $value, $params) { if (!isset($params[0])) { return false; } if (!\is_string($value) || !\is_string($params[0])) { return false; } $strict = true; if (isset($params[1])) { $strict = (bool...
php
protected function validateContains($field, $value, $params) { if (!isset($params[0])) { return false; } if (!\is_string($value) || !\is_string($params[0])) { return false; } $strict = true; if (isset($params[1])) { $strict = (bool...
[ "protected", "function", "validateContains", "(", "$", "field", ",", "$", "value", ",", "$", "params", ")", "{", "if", "(", "!", "isset", "(", "$", "params", "[", "0", "]", ")", ")", "{", "return", "false", ";", "}", "if", "(", "!", "\\", "is_str...
Validate a field contains a given string @param string $field @param string $value @param array $params @return bool
[ "Validate", "a", "field", "contains", "a", "given", "string" ]
d419e6c098d29ef9b62192b74050e51985b94f90
https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Util/Validator.php#L451-L470
35,511
hail-framework/framework
src/Util/Validator.php
Validator.validateSubset
protected function validateSubset($field, $value, $params) { if (!isset($params[0])) { return false; } if (!\is_array($params[0])) { $params[0] = [$params[0]]; } if (\is_scalar($value)) { return $this->validateIn($field, $value, $params); ...
php
protected function validateSubset($field, $value, $params) { if (!isset($params[0])) { return false; } if (!\is_array($params[0])) { $params[0] = [$params[0]]; } if (\is_scalar($value)) { return $this->validateIn($field, $value, $params); ...
[ "protected", "function", "validateSubset", "(", "$", "field", ",", "$", "value", ",", "$", "params", ")", "{", "if", "(", "!", "isset", "(", "$", "params", "[", "0", "]", ")", ")", "{", "return", "false", ";", "}", "if", "(", "!", "\\", "is_array...
Validate that all field values contains a given array @param string $field @param array $value @param array $params @return bool
[ "Validate", "that", "all", "field", "values", "contains", "a", "given", "array" ]
d419e6c098d29ef9b62192b74050e51985b94f90
https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Util/Validator.php#L481-L495
35,512
hail-framework/framework
src/Util/Validator.php
Validator.validateContainsUnique
protected function validateContainsUnique($field, $value) { if (!\is_array($value)) { return false; } return $value === \array_unique($value, SORT_REGULAR); }
php
protected function validateContainsUnique($field, $value) { if (!\is_array($value)) { return false; } return $value === \array_unique($value, SORT_REGULAR); }
[ "protected", "function", "validateContainsUnique", "(", "$", "field", ",", "$", "value", ")", "{", "if", "(", "!", "\\", "is_array", "(", "$", "value", ")", ")", "{", "return", "false", ";", "}", "return", "$", "value", "===", "\\", "array_unique", "("...
Validate that field array has only unique values @param string $field @param array $value @return bool
[ "Validate", "that", "field", "array", "has", "only", "unique", "values" ]
d419e6c098d29ef9b62192b74050e51985b94f90
https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Util/Validator.php#L505-L512
35,513
hail-framework/framework
src/Util/Validator.php
Validator.validateEmailDNS
protected function validateEmailDNS($field, $value) { if ($this->validateEmail($field, $value)) { $domain = \ltrim(\strstr($value, '@'), '@') . '.'; if (\defined('INTL_IDNA_VARIANT_UTS46') && \function_exists('\idn_to_ascii')) { $domain = \idn_to_ascii($domain, 0, INT...
php
protected function validateEmailDNS($field, $value) { if ($this->validateEmail($field, $value)) { $domain = \ltrim(\strstr($value, '@'), '@') . '.'; if (\defined('INTL_IDNA_VARIANT_UTS46') && \function_exists('\idn_to_ascii')) { $domain = \idn_to_ascii($domain, 0, INT...
[ "protected", "function", "validateEmailDNS", "(", "$", "field", ",", "$", "value", ")", "{", "if", "(", "$", "this", "->", "validateEmail", "(", "$", "field", ",", "$", "value", ")", ")", "{", "$", "domain", "=", "\\", "ltrim", "(", "\\", "strstr", ...
Validate that a field is a valid e-mail address and the domain name is active @param string $field @param mixed $value @return bool
[ "Validate", "that", "a", "field", "is", "a", "valid", "e", "-", "mail", "address", "and", "the", "domain", "name", "is", "active" ]
d419e6c098d29ef9b62192b74050e51985b94f90
https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Util/Validator.php#L593-L605
35,514
hail-framework/framework
src/Util/Validator.php
Validator.validateUrl
protected function validateUrl($field, $value) { foreach (static::$validUrlPrefixes as $prefix) { if (\strpos($value, $prefix) !== false) { return \filter_var($value, \FILTER_VALIDATE_URL) !== false; } } return false; }
php
protected function validateUrl($field, $value) { foreach (static::$validUrlPrefixes as $prefix) { if (\strpos($value, $prefix) !== false) { return \filter_var($value, \FILTER_VALIDATE_URL) !== false; } } return false; }
[ "protected", "function", "validateUrl", "(", "$", "field", ",", "$", "value", ")", "{", "foreach", "(", "static", "::", "$", "validUrlPrefixes", "as", "$", "prefix", ")", "{", "if", "(", "\\", "strpos", "(", "$", "value", ",", "$", "prefix", ")", "!=...
Validate that a field is a valid URL by syntax @param string $field @param mixed $value @return bool
[ "Validate", "that", "a", "field", "is", "a", "valid", "URL", "by", "syntax" ]
d419e6c098d29ef9b62192b74050e51985b94f90
https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Util/Validator.php#L615-L624
35,515
hail-framework/framework
src/Util/Validator.php
Validator.validateUrlActive
protected function validateUrlActive($field, $value) { foreach (static::$validUrlPrefixes as $prefix) { if (\strpos($value, $prefix) !== false) { $host = \parse_url(\strtolower($value), PHP_URL_HOST); return \checkdnsrr($host, 'A') || \checkdnsrr($host, 'AAAA') |...
php
protected function validateUrlActive($field, $value) { foreach (static::$validUrlPrefixes as $prefix) { if (\strpos($value, $prefix) !== false) { $host = \parse_url(\strtolower($value), PHP_URL_HOST); return \checkdnsrr($host, 'A') || \checkdnsrr($host, 'AAAA') |...
[ "protected", "function", "validateUrlActive", "(", "$", "field", ",", "$", "value", ")", "{", "foreach", "(", "static", "::", "$", "validUrlPrefixes", "as", "$", "prefix", ")", "{", "if", "(", "\\", "strpos", "(", "$", "value", ",", "$", "prefix", ")",...
Validate that a field is an active URL by verifying DNS record @param string $field @param mixed $value @return bool
[ "Validate", "that", "a", "field", "is", "an", "active", "URL", "by", "verifying", "DNS", "record" ]
d419e6c098d29ef9b62192b74050e51985b94f90
https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Util/Validator.php#L634-L645
35,516
hail-framework/framework
src/Util/Validator.php
Validator.validateDateFormat
protected function validateDateFormat($field, $value, $params) { $parsed = \date_parse_from_format($params[0], $value); return $parsed['error_count'] === 0 && $parsed['warning_count'] === 0; }
php
protected function validateDateFormat($field, $value, $params) { $parsed = \date_parse_from_format($params[0], $value); return $parsed['error_count'] === 0 && $parsed['warning_count'] === 0; }
[ "protected", "function", "validateDateFormat", "(", "$", "field", ",", "$", "value", ",", "$", "params", ")", "{", "$", "parsed", "=", "\\", "date_parse_from_format", "(", "$", "params", "[", "0", "]", ",", "$", "value", ")", ";", "return", "$", "parse...
Validate that a field matches a date format @param string $field @param mixed $value @param array $params @internal param array $fields @return bool
[ "Validate", "that", "a", "field", "matches", "a", "date", "format" ]
d419e6c098d29ef9b62192b74050e51985b94f90
https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Util/Validator.php#L731-L736
35,517
hail-framework/framework
src/Util/Validator.php
Validator.validateCreditCard
protected function validateCreditCard($field, $value, $params) { /** * I there has been an array of valid cards supplied, or the name of the users card * or the name and an array of valid cards */ if (!empty($params)) { /** * array of valid cards ...
php
protected function validateCreditCard($field, $value, $params) { /** * I there has been an array of valid cards supplied, or the name of the users card * or the name and an array of valid cards */ if (!empty($params)) { /** * array of valid cards ...
[ "protected", "function", "validateCreditCard", "(", "$", "field", ",", "$", "value", ",", "$", "params", ")", "{", "/**\n * I there has been an array of valid cards supplied, or the name of the users card\n * or the name and an array of valid cards\n */", "if", ...
Validate that a field contains a valid credit card optionally filtered by an array @param string $field @param mixed $value @param array $params @return bool
[ "Validate", "that", "a", "field", "contains", "a", "valid", "credit", "card", "optionally", "filtered", "by", "an", "array" ]
d419e6c098d29ef9b62192b74050e51985b94f90
https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Util/Validator.php#L797-L863
35,518
hail-framework/framework
src/Util/Validator.php
Validator.data
public function data(array $data, array $fields = []) { // Allows filtering of used input fields against optional second array of field names allowed // This is useful for limiting raw $_POST or $_GET data to only known fields $this->_fields = $fields !== [] ? \array_intersect_key($data, \ar...
php
public function data(array $data, array $fields = []) { // Allows filtering of used input fields against optional second array of field names allowed // This is useful for limiting raw $_POST or $_GET data to only known fields $this->_fields = $fields !== [] ? \array_intersect_key($data, \ar...
[ "public", "function", "data", "(", "array", "$", "data", ",", "array", "$", "fields", "=", "[", "]", ")", "{", "// Allows filtering of used input fields against optional second array of field names allowed", "// This is useful for limiting raw $_POST or $_GET data to only known fie...
Set data for validator @param array $data @param array $fields @return $this
[ "Set", "data", "for", "validator" ]
d419e6c098d29ef9b62192b74050e51985b94f90
https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Util/Validator.php#L936-L943
35,519
hail-framework/framework
src/Util/Validator.php
Validator.errors
public function errors(string $field = null) { if ($field !== null) { return $this->_errors[$field] ?? false; } return $this->_errors; }
php
public function errors(string $field = null) { if ($field !== null) { return $this->_errors[$field] ?? false; } return $this->_errors; }
[ "public", "function", "errors", "(", "string", "$", "field", "=", "null", ")", "{", "if", "(", "$", "field", "!==", "null", ")", "{", "return", "$", "this", "->", "_errors", "[", "$", "field", "]", "??", "false", ";", "}", "return", "$", "this", ...
Get array of error messages @param null|string $field @return array|bool
[ "Get", "array", "of", "error", "messages" ]
d419e6c098d29ef9b62192b74050e51985b94f90
https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Util/Validator.php#L962-L969
35,520
hail-framework/framework
src/Util/Validator.php
Validator.error
public function error(string $field, string $message, array $params = []) { $message = $this->checkAndSetLabel($field, $message, $params); $values = []; // Printed values need to be in string format foreach ($params as $param) { if (\is_array($param)) { $...
php
public function error(string $field, string $message, array $params = []) { $message = $this->checkAndSetLabel($field, $message, $params); $values = []; // Printed values need to be in string format foreach ($params as $param) { if (\is_array($param)) { $...
[ "public", "function", "error", "(", "string", "$", "field", ",", "string", "$", "message", ",", "array", "$", "params", "=", "[", "]", ")", "{", "$", "message", "=", "$", "this", "->", "checkAndSetLabel", "(", "$", "field", ",", "$", "message", ",", ...
Add an error to error messages array @param string $field @param string $message @param array $params
[ "Add", "an", "error", "to", "error", "messages", "array" ]
d419e6c098d29ef9b62192b74050e51985b94f90
https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Util/Validator.php#L978-L1001
35,521
hail-framework/framework
src/Util/Validator.php
Validator.message
public function message(string $message) { $this->_validations[\count($this->_validations) - 1]['message'] = $message; return $this; }
php
public function message(string $message) { $this->_validations[\count($this->_validations) - 1]['message'] = $message; return $this; }
[ "public", "function", "message", "(", "string", "$", "message", ")", "{", "$", "this", "->", "_validations", "[", "\\", "count", "(", "$", "this", "->", "_validations", ")", "-", "1", "]", "[", "'message'", "]", "=", "$", "message", ";", "return", "$...
Specify validation message to use for error for the last validation rule @param string $message @return $this
[ "Specify", "validation", "message", "to", "use", "for", "error", "for", "the", "last", "validation", "rule" ]
d419e6c098d29ef9b62192b74050e51985b94f90
https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Util/Validator.php#L1010-L1015
35,522
hail-framework/framework
src/Util/Validator.php
Validator.reset
public function reset() { $this->_fields = []; $this->_errors = []; $this->_validations = []; $this->_labels = []; $this->_skips = []; return $this; }
php
public function reset() { $this->_fields = []; $this->_errors = []; $this->_validations = []; $this->_labels = []; $this->_skips = []; return $this; }
[ "public", "function", "reset", "(", ")", "{", "$", "this", "->", "_fields", "=", "[", "]", ";", "$", "this", "->", "_errors", "=", "[", "]", ";", "$", "this", "->", "_validations", "=", "[", "]", ";", "$", "this", "->", "_labels", "=", "[", "]"...
Reset object properties @return $this
[ "Reset", "object", "properties" ]
d419e6c098d29ef9b62192b74050e51985b94f90
https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Util/Validator.php#L1022-L1031
35,523
hail-framework/framework
src/Util/Validator.php
Validator.validate
public function validate() { $setToBreak = false; foreach ($this->_validations as $v) { foreach ($v['fields'] as $field) { if (isset($this->_skips[$field])) { if ($this->_skips[$field] === self::SKIP_ALL) { break 2; ...
php
public function validate() { $setToBreak = false; foreach ($this->_validations as $v) { foreach ($v['fields'] as $field) { if (isset($this->_skips[$field])) { if ($this->_skips[$field] === self::SKIP_ALL) { break 2; ...
[ "public", "function", "validate", "(", ")", "{", "$", "setToBreak", "=", "false", ";", "foreach", "(", "$", "this", "->", "_validations", "as", "$", "v", ")", "{", "foreach", "(", "$", "v", "[", "'fields'", "]", "as", "$", "field", ")", "{", "if", ...
Run validations and return boolean result @return bool
[ "Run", "validations", "and", "return", "boolean", "result" ]
d419e6c098d29ef9b62192b74050e51985b94f90
https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Util/Validator.php#L1094-L1156
35,524
hail-framework/framework
src/Util/Validator.php
Validator.onErrorSkipField
public function onErrorSkipField(): self { $this->_validations[\count($this->_validations) - 1]['skip'] = self::SKIP_ONE; return $this; }
php
public function onErrorSkipField(): self { $this->_validations[\count($this->_validations) - 1]['skip'] = self::SKIP_ONE; return $this; }
[ "public", "function", "onErrorSkipField", "(", ")", ":", "self", "{", "$", "this", "->", "_validations", "[", "\\", "count", "(", "$", "this", "->", "_validations", ")", "-", "1", "]", "[", "'skip'", "]", "=", "self", "::", "SKIP_ONE", ";", "return", ...
If the validation for a field fails, skip all other checks for this field. @return static
[ "If", "the", "validation", "for", "a", "field", "fails", "skip", "all", "other", "checks", "for", "this", "field", "." ]
d419e6c098d29ef9b62192b74050e51985b94f90
https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Util/Validator.php#L1177-L1182
35,525
hail-framework/framework
src/Util/Validator.php
Validator.onErrorQuit
public function onErrorQuit(): self { $this->_validations[\count($this->_validations) - 1]['skip'] = self::SKIP_ALL; return $this; }
php
public function onErrorQuit(): self { $this->_validations[\count($this->_validations) - 1]['skip'] = self::SKIP_ALL; return $this; }
[ "public", "function", "onErrorQuit", "(", ")", ":", "self", "{", "$", "this", "->", "_validations", "[", "\\", "count", "(", "$", "this", "->", "_validations", ")", "-", "1", "]", "[", "'skip'", "]", "=", "self", "::", "SKIP_ALL", ";", "return", "$",...
If the validation of a field fails, stop the validation process. @return static
[ "If", "the", "validation", "of", "a", "field", "fails", "stop", "the", "validation", "process", "." ]
d419e6c098d29ef9b62192b74050e51985b94f90
https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Util/Validator.php#L1189-L1194
35,526
hail-framework/framework
src/Util/Validator.php
Validator.hasRule
protected function hasRule(string $name, string $field): bool { foreach ($this->_validations as $validation) { if ($validation['rule'] === $name && \in_array($field, $validation['fields'], true)) { return true; } } return false; }
php
protected function hasRule(string $name, string $field): bool { foreach ($this->_validations as $validation) { if ($validation['rule'] === $name && \in_array($field, $validation['fields'], true)) { return true; } } return false; }
[ "protected", "function", "hasRule", "(", "string", "$", "name", ",", "string", "$", "field", ")", ":", "bool", "{", "foreach", "(", "$", "this", "->", "_validations", "as", "$", "validation", ")", "{", "if", "(", "$", "validation", "[", "'rule'", "]", ...
Determine whether a field is being validated by the given rule. @param string $name The name of the rule @param string $field The name of the field @return bool
[ "Determine", "whether", "a", "field", "is", "being", "validated", "by", "the", "given", "rule", "." ]
d419e6c098d29ef9b62192b74050e51985b94f90
https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Util/Validator.php#L1224-L1233
35,527
hail-framework/framework
src/Util/Validator.php
Validator.addInstanceRule
public function addInstanceRule(string $name, callable $callback, string $message = null): self { static::assertRuleCallback($callback); $this->_instanceRules[$name] = $callback; $this->_instanceRuleMessage[$name] = $message; return $this; }
php
public function addInstanceRule(string $name, callable $callback, string $message = null): self { static::assertRuleCallback($callback); $this->_instanceRules[$name] = $callback; $this->_instanceRuleMessage[$name] = $message; return $this; }
[ "public", "function", "addInstanceRule", "(", "string", "$", "name", ",", "callable", "$", "callback", ",", "string", "$", "message", "=", "null", ")", ":", "self", "{", "static", "::", "assertRuleCallback", "(", "$", "callback", ")", ";", "$", "this", "...
Adds a new validation rule callback that is tied to the current instance only. @param string $name @param callable $callback @param string $message @return $this @throws \InvalidArgumentException
[ "Adds", "a", "new", "validation", "rule", "callback", "that", "is", "tied", "to", "the", "current", "instance", "only", "." ]
d419e6c098d29ef9b62192b74050e51985b94f90
https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Util/Validator.php#L1253-L1261
35,528
hail-framework/framework
src/Util/Validator.php
Validator.addRule
public function addRule(string $name, callable $callback, string $message = null): self { if ($message === null) { $message = static::ERROR_DEFAULT; } static::assertRuleCallback($callback); static::$_rules[$name] = $callback; static::$_ruleMessages[$name] = $mes...
php
public function addRule(string $name, callable $callback, string $message = null): self { if ($message === null) { $message = static::ERROR_DEFAULT; } static::assertRuleCallback($callback); static::$_rules[$name] = $callback; static::$_ruleMessages[$name] = $mes...
[ "public", "function", "addRule", "(", "string", "$", "name", ",", "callable", "$", "callback", ",", "string", "$", "message", "=", "null", ")", ":", "self", "{", "if", "(", "$", "message", "===", "null", ")", "{", "$", "message", "=", "static", "::",...
Register new validation rule callback @param string $name @param callable $callback @param string $message @return $this @throws \InvalidArgumentException
[ "Register", "new", "validation", "rule", "callback" ]
d419e6c098d29ef9b62192b74050e51985b94f90
https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Util/Validator.php#L1273-L1285
35,529
hail-framework/framework
src/Util/Validator.php
Validator.hasValidator
public function hasValidator(string $name): bool { $rules = $this->getRules(); return \method_exists($this, 'validate' . \ucfirst($name)) || isset($rules[$name]); }
php
public function hasValidator(string $name): bool { $rules = $this->getRules(); return \method_exists($this, 'validate' . \ucfirst($name)) || isset($rules[$name]); }
[ "public", "function", "hasValidator", "(", "string", "$", "name", ")", ":", "bool", "{", "$", "rules", "=", "$", "this", "->", "getRules", "(", ")", ";", "return", "\\", "method_exists", "(", "$", "this", ",", "'validate'", ".", "\\", "ucfirst", "(", ...
Returns true if either a validator with the given name has been registered or there is a default validator by that name. @param string $name @return bool
[ "Returns", "true", "if", "either", "a", "validator", "with", "the", "given", "name", "has", "been", "registered", "or", "there", "is", "a", "default", "validator", "by", "that", "name", "." ]
d419e6c098d29ef9b62192b74050e51985b94f90
https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Util/Validator.php#L1316-L1321
35,530
hail-framework/framework
src/Util/Validator.php
Validator.rule
public function rule($rule, $fields, ...$params) { if (\is_callable($rule) && !(\is_string($rule) && $this->hasValidator($rule)) ) { $name = $this->getUniqueRuleName($fields); $message = $params[0] ?? null; $this->addInstanceRule($name, $rule, $message...
php
public function rule($rule, $fields, ...$params) { if (\is_callable($rule) && !(\is_string($rule) && $this->hasValidator($rule)) ) { $name = $this->getUniqueRuleName($fields); $message = $params[0] ?? null; $this->addInstanceRule($name, $rule, $message...
[ "public", "function", "rule", "(", "$", "rule", ",", "$", "fields", ",", "...", "$", "params", ")", "{", "if", "(", "\\", "is_callable", "(", "$", "rule", ")", "&&", "!", "(", "\\", "is_string", "(", "$", "rule", ")", "&&", "$", "this", "->", "...
Convenience method to add a single validation rule @param string|callable $rule @param array|string $fields @param mixed ...$params @return $this @throws \InvalidArgumentException
[ "Convenience", "method", "to", "add", "a", "single", "validation", "rule" ]
d419e6c098d29ef9b62192b74050e51985b94f90
https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Util/Validator.php#L1333-L1370
35,531
hail-framework/framework
src/Util/Validator.php
Validator.rules
public function rules(array $rules) { foreach ($rules as $ruleType => $params) { if (\is_array($params)) { foreach ($params as $innerParams) { $innerParams = (array) $innerParams; $this->rule($ruleType, ...$innerParams); } ...
php
public function rules(array $rules) { foreach ($rules as $ruleType => $params) { if (\is_array($params)) { foreach ($params as $innerParams) { $innerParams = (array) $innerParams; $this->rule($ruleType, ...$innerParams); } ...
[ "public", "function", "rules", "(", "array", "$", "rules", ")", "{", "foreach", "(", "$", "rules", "as", "$", "ruleType", "=>", "$", "params", ")", "{", "if", "(", "\\", "is_array", "(", "$", "params", ")", ")", "{", "foreach", "(", "$", "params", ...
Convenience method to add multiple validation rules with an array @param array $rules @return $this @throws \InvalidArgumentException
[ "Convenience", "method", "to", "add", "multiple", "validation", "rules", "with", "an", "array" ]
d419e6c098d29ef9b62192b74050e51985b94f90
https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Util/Validator.php#L1441-L1455
35,532
hail-framework/framework
src/Util/Validator.php
Validator.withData
public function withData(array $data, array $fields = []) { $clone = clone $this; $clone->_fields = !empty($fields) ? \array_intersect_key($data, \array_flip($fields)) : $data; $clone->_errors = []; return $clone; }
php
public function withData(array $data, array $fields = []) { $clone = clone $this; $clone->_fields = !empty($fields) ? \array_intersect_key($data, \array_flip($fields)) : $data; $clone->_errors = []; return $clone; }
[ "public", "function", "withData", "(", "array", "$", "data", ",", "array", "$", "fields", "=", "[", "]", ")", "{", "$", "clone", "=", "clone", "$", "this", ";", "$", "clone", "->", "_fields", "=", "!", "empty", "(", "$", "fields", ")", "?", "\\",...
Replace data on cloned instance @param array $data @param array $fields @return \Hail\Util\Validator
[ "Replace", "data", "on", "cloned", "instance" ]
d419e6c098d29ef9b62192b74050e51985b94f90
https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Util/Validator.php#L1465-L1472
35,533
hail-framework/framework
src/Console/Buffer.php
Buffer.appendLine
public function appendLine($line, $indent = 0) { $this->content .= ($indent ? $this->makeIndent($indent) : $this->indentCache) . $line . $this->newline; }
php
public function appendLine($line, $indent = 0) { $this->content .= ($indent ? $this->makeIndent($indent) : $this->indentCache) . $line . $this->newline; }
[ "public", "function", "appendLine", "(", "$", "line", ",", "$", "indent", "=", "0", ")", "{", "$", "this", "->", "content", ".=", "(", "$", "indent", "?", "$", "this", "->", "makeIndent", "(", "$", "indent", ")", ":", "$", "this", "->", "indentCach...
Append a line with indent to the buffer @param string $line @param int $indent
[ "Append", "a", "line", "with", "indent", "to", "the", "buffer" ]
d419e6c098d29ef9b62192b74050e51985b94f90
https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Console/Buffer.php#L99-L102
35,534
hail-framework/framework
src/Console/Buffer.php
Buffer.appendLines
public function appendLines($lines, $indent = 0) { foreach ($lines as $line) { $this->appendLine($line, $indent); } }
php
public function appendLines($lines, $indent = 0) { foreach ($lines as $line) { $this->appendLine($line, $indent); } }
[ "public", "function", "appendLines", "(", "$", "lines", ",", "$", "indent", "=", "0", ")", "{", "foreach", "(", "$", "lines", "as", "$", "line", ")", "{", "$", "this", "->", "appendLine", "(", "$", "line", ",", "$", "indent", ")", ";", "}", "}" ]
Append multiple lines with indent to the buffer @param string[] $lines @param int $indent
[ "Append", "multiple", "lines", "with", "indent", "to", "the", "buffer" ]
d419e6c098d29ef9b62192b74050e51985b94f90
https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Console/Buffer.php#L111-L116
35,535
hail-framework/framework
src/Console/Buffer.php
Buffer.setFormat
public function setFormat($format) { $this->format = $format; if ($this->format === self::FORMAT_UNIX) { $this->newline = "\n"; } elseif ($this->format === self::FORMAT_DOS) { $this->newline = "\r\n"; } }
php
public function setFormat($format) { $this->format = $format; if ($this->format === self::FORMAT_UNIX) { $this->newline = "\n"; } elseif ($this->format === self::FORMAT_DOS) { $this->newline = "\r\n"; } }
[ "public", "function", "setFormat", "(", "$", "format", ")", "{", "$", "this", "->", "format", "=", "$", "format", ";", "if", "(", "$", "this", "->", "format", "===", "self", "::", "FORMAT_UNIX", ")", "{", "$", "this", "->", "newline", "=", "\"\\n\"",...
Set line format @param int $format Buffer::FORMAT_UNIX or Buffer::FORMAT_DOS
[ "Set", "line", "format" ]
d419e6c098d29ef9b62192b74050e51985b94f90
https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Console/Buffer.php#L175-L183
35,536
hail-framework/framework
src/Console/Buffer.php
Buffer.appendBuffer
public function appendBuffer(Buffer $buf, $indent = 0) { if ($indent) { $this->setIndent($indent); $lines = $buf->lines(); foreach ($lines as $line) { $this->appendLine($line); } } else { $this->content .= $buf->__toString()...
php
public function appendBuffer(Buffer $buf, $indent = 0) { if ($indent) { $this->setIndent($indent); $lines = $buf->lines(); foreach ($lines as $line) { $this->appendLine($line); } } else { $this->content .= $buf->__toString()...
[ "public", "function", "appendBuffer", "(", "Buffer", "$", "buf", ",", "$", "indent", "=", "0", ")", "{", "if", "(", "$", "indent", ")", "{", "$", "this", "->", "setIndent", "(", "$", "indent", ")", ";", "$", "lines", "=", "$", "buf", "->", "lines...
Append a buffer object @param Buffer $buf @param int $indent = 0
[ "Append", "a", "buffer", "object" ]
d419e6c098d29ef9b62192b74050e51985b94f90
https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Console/Buffer.php#L207-L218
35,537
htmlburger/wpemerge-cli
src/App.php
App.install
public static function install( Event $event ) { $binary_name = 'wpemerge'; $binary = dirname( __DIR__ ) . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR . $binary_name; $event->getIO()->write( '' ); $process = new Process( $binary . ' install' ); $process->setTimeout( null ); try { $process->setTt...
php
public static function install( Event $event ) { $binary_name = 'wpemerge'; $binary = dirname( __DIR__ ) . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR . $binary_name; $event->getIO()->write( '' ); $process = new Process( $binary . ' install' ); $process->setTimeout( null ); try { $process->setTt...
[ "public", "static", "function", "install", "(", "Event", "$", "event", ")", "{", "$", "binary_name", "=", "'wpemerge'", ";", "$", "binary", "=", "dirname", "(", "__DIR__", ")", ".", "DIRECTORY_SEPARATOR", ".", "'bin'", ".", "DIRECTORY_SEPARATOR", ".", "$", ...
Run with the install command. @param Event $event @return void
[ "Run", "with", "the", "install", "command", "." ]
075f1982b7dd87039a4e7bbc05caf676a10fe862
https://github.com/htmlburger/wpemerge-cli/blob/075f1982b7dd87039a4e7bbc05caf676a10fe862/src/App.php#L71-L91
35,538
htmlburger/wpemerge-cli
src/App.php
App.createConfigJson
public static function createConfigJson( Event $event ) { if ( ! defined( 'WPEMERGE_CLI_DIR' ) ) { define( 'WPEMERGE_CLI_DIR', dirname( __DIR__ ) ); } $input = new ArrayInput( [ 'config:create' ] ); $output = new BufferedOutput(); try { $application = static::create(); $command = $application->find...
php
public static function createConfigJson( Event $event ) { if ( ! defined( 'WPEMERGE_CLI_DIR' ) ) { define( 'WPEMERGE_CLI_DIR', dirname( __DIR__ ) ); } $input = new ArrayInput( [ 'config:create' ] ); $output = new BufferedOutput(); try { $application = static::create(); $command = $application->find...
[ "public", "static", "function", "createConfigJson", "(", "Event", "$", "event", ")", "{", "if", "(", "!", "defined", "(", "'WPEMERGE_CLI_DIR'", ")", ")", "{", "define", "(", "'WPEMERGE_CLI_DIR'", ",", "dirname", "(", "__DIR__", ")", ")", ";", "}", "$", "...
Create a config.json in the theme root directory. @param Event $event @return void
[ "Create", "a", "config", ".", "json", "in", "the", "theme", "root", "directory", "." ]
075f1982b7dd87039a4e7bbc05caf676a10fe862
https://github.com/htmlburger/wpemerge-cli/blob/075f1982b7dd87039a4e7bbc05caf676a10fe862/src/App.php#L99-L115
35,539
htmlburger/wpemerge-cli
src/App.php
App.installDependencies
public static function installDependencies( Event $event ) { if ( ! defined( 'WPEMERGE_CLI_DIR' ) ) { define( 'WPEMERGE_CLI_DIR', dirname( __DIR__ ) ); } $input = new ArrayInput( [ 'install:dependencies' ] ); $output = new ConsoleOutput(); try { $application = static::create(); $command = $applicat...
php
public static function installDependencies( Event $event ) { if ( ! defined( 'WPEMERGE_CLI_DIR' ) ) { define( 'WPEMERGE_CLI_DIR', dirname( __DIR__ ) ); } $input = new ArrayInput( [ 'install:dependencies' ] ); $output = new ConsoleOutput(); try { $application = static::create(); $command = $applicat...
[ "public", "static", "function", "installDependencies", "(", "Event", "$", "event", ")", "{", "if", "(", "!", "defined", "(", "'WPEMERGE_CLI_DIR'", ")", ")", "{", "define", "(", "'WPEMERGE_CLI_DIR'", ",", "dirname", "(", "__DIR__", ")", ")", ";", "}", "$", ...
Install dependencies in the theme root directory. @param Event $event @return void
[ "Install", "dependencies", "in", "the", "theme", "root", "directory", "." ]
075f1982b7dd87039a4e7bbc05caf676a10fe862
https://github.com/htmlburger/wpemerge-cli/blob/075f1982b7dd87039a4e7bbc05caf676a10fe862/src/App.php#L123-L138
35,540
htmlburger/wpemerge-cli
src/App.php
App.isWordPressThemeDirectory
protected static function isWordPressThemeDirectory( $directory ) { $composer = Composer::getComposerJson( $directory ); if ( ! $composer ) { return false; } if ( $composer['type'] !== 'wordpress-theme' ) { return false; } return true; }
php
protected static function isWordPressThemeDirectory( $directory ) { $composer = Composer::getComposerJson( $directory ); if ( ! $composer ) { return false; } if ( $composer['type'] !== 'wordpress-theme' ) { return false; } return true; }
[ "protected", "static", "function", "isWordPressThemeDirectory", "(", "$", "directory", ")", "{", "$", "composer", "=", "Composer", "::", "getComposerJson", "(", "$", "directory", ")", ";", "if", "(", "!", "$", "composer", ")", "{", "return", "false", ";", ...
Check if a directory is a WordPress theme root. @param string $directory @return boolean
[ "Check", "if", "a", "directory", "is", "a", "WordPress", "theme", "root", "." ]
075f1982b7dd87039a4e7bbc05caf676a10fe862
https://github.com/htmlburger/wpemerge-cli/blob/075f1982b7dd87039a4e7bbc05caf676a10fe862/src/App.php#L207-L219
35,541
htmlburger/wpemerge-cli
src/App.php
App.execute
public static function execute( $command, $directory = null, $timeout = 120 ) { $directory = $directory !== null ? $directory : getcwd(); $process = new Process( $command, null, null, null, $timeout ); $process->setWorkingDirectory( $directory ); $process->mustRun(); return $process->getOutput(); }
php
public static function execute( $command, $directory = null, $timeout = 120 ) { $directory = $directory !== null ? $directory : getcwd(); $process = new Process( $command, null, null, null, $timeout ); $process->setWorkingDirectory( $directory ); $process->mustRun(); return $process->getOutput(); }
[ "public", "static", "function", "execute", "(", "$", "command", ",", "$", "directory", "=", "null", ",", "$", "timeout", "=", "120", ")", "{", "$", "directory", "=", "$", "directory", "!==", "null", "?", "$", "directory", ":", "getcwd", "(", ")", ";"...
Run a shell command. @param string $command @param string|null $directory @param integer $timeout @return string
[ "Run", "a", "shell", "command", "." ]
075f1982b7dd87039a4e7bbc05caf676a10fe862
https://github.com/htmlburger/wpemerge-cli/blob/075f1982b7dd87039a4e7bbc05caf676a10fe862/src/App.php#L229-L237
35,542
htmlburger/wpemerge-cli
src/App.php
App.liveExecute
public static function liveExecute( $command, OutputInterface $output, $directory = null, $timeout = 120 ) { $directory = $directory !== null ? $directory : getcwd(); $process = new Process( $command, null, null, null, $timeout ); $process->setWorkingDirectory( $directory ); $process->start(); $process->wai...
php
public static function liveExecute( $command, OutputInterface $output, $directory = null, $timeout = 120 ) { $directory = $directory !== null ? $directory : getcwd(); $process = new Process( $command, null, null, null, $timeout ); $process->setWorkingDirectory( $directory ); $process->start(); $process->wai...
[ "public", "static", "function", "liveExecute", "(", "$", "command", ",", "OutputInterface", "$", "output", ",", "$", "directory", "=", "null", ",", "$", "timeout", "=", "120", ")", "{", "$", "directory", "=", "$", "directory", "!==", "null", "?", "$", ...
Run a shell command and return the output as it comes in. @param string $command @param OutputInterface $output @param string|null $directory @param integer $timeout @return Process
[ "Run", "a", "shell", "command", "and", "return", "the", "output", "as", "it", "comes", "in", "." ]
075f1982b7dd87039a4e7bbc05caf676a10fe862
https://github.com/htmlburger/wpemerge-cli/blob/075f1982b7dd87039a4e7bbc05caf676a10fe862/src/App.php#L248-L264
35,543
wikimedia/ObjectFactory
src/ObjectFactory.php
ObjectFactory.getObjectFromSpec
public static function getObjectFromSpec( $spec ) { $args = isset( $spec['args'] ) ? $spec['args'] : []; $expandArgs = !isset( $spec['closure_expansion'] ) || $spec['closure_expansion'] === true; if ( $expandArgs ) { $args = static::expandClosures( $args ); } if ( isset( $spec['class'] ) ) { $clazz...
php
public static function getObjectFromSpec( $spec ) { $args = isset( $spec['args'] ) ? $spec['args'] : []; $expandArgs = !isset( $spec['closure_expansion'] ) || $spec['closure_expansion'] === true; if ( $expandArgs ) { $args = static::expandClosures( $args ); } if ( isset( $spec['class'] ) ) { $clazz...
[ "public", "static", "function", "getObjectFromSpec", "(", "$", "spec", ")", "{", "$", "args", "=", "isset", "(", "$", "spec", "[", "'args'", "]", ")", "?", "$", "spec", "[", "'args'", "]", ":", "[", "]", ";", "$", "expandArgs", "=", "!", "isset", ...
Instantiate an object based on a specification array. The specification array must contain a 'class' key with string value that specifies the class name to instantiate or a 'factory' key with a callable (is_callable() === true). It can optionally contain an 'args' key that provides arguments to pass to the constructor...
[ "Instantiate", "an", "object", "based", "on", "a", "specification", "array", "." ]
7e7ed475dfa09516f2d06a5cf0b61b8e3afba170
https://github.com/wikimedia/ObjectFactory/blob/7e7ed475dfa09516f2d06a5cf0b61b8e3afba170/src/ObjectFactory.php#L64-L99
35,544
wikimedia/ObjectFactory
src/ObjectFactory.php
ObjectFactory.expandClosures
protected static function expandClosures( $list ) { return array_map( function ( $value ) { if ( is_object( $value ) && $value instanceof Closure ) { // If $value is a Closure, call it. return $value(); } else { return $value; } }, $list ); }
php
protected static function expandClosures( $list ) { return array_map( function ( $value ) { if ( is_object( $value ) && $value instanceof Closure ) { // If $value is a Closure, call it. return $value(); } else { return $value; } }, $list ); }
[ "protected", "static", "function", "expandClosures", "(", "$", "list", ")", "{", "return", "array_map", "(", "function", "(", "$", "value", ")", "{", "if", "(", "is_object", "(", "$", "value", ")", "&&", "$", "value", "instanceof", "Closure", ")", "{", ...
Iterate a list and call any closures it contains. @param array $list List of things @return array List with any Closures replaced with their output
[ "Iterate", "a", "list", "and", "call", "any", "closures", "it", "contains", "." ]
7e7ed475dfa09516f2d06a5cf0b61b8e3afba170
https://github.com/wikimedia/ObjectFactory/blob/7e7ed475dfa09516f2d06a5cf0b61b8e3afba170/src/ObjectFactory.php#L107-L116
35,545
wikimedia/ObjectFactory
src/ObjectFactory.php
ObjectFactory.constructClassInstance
public static function constructClassInstance( $clazz, $args ) { // $args should be a non-associative array; show nice error if that's not the case if ( $args && array_keys( $args ) !== range( 0, count( $args ) - 1 ) ) { throw new InvalidArgumentException( __METHOD__ . ': $args cannot be an associative array' );...
php
public static function constructClassInstance( $clazz, $args ) { // $args should be a non-associative array; show nice error if that's not the case if ( $args && array_keys( $args ) !== range( 0, count( $args ) - 1 ) ) { throw new InvalidArgumentException( __METHOD__ . ': $args cannot be an associative array' );...
[ "public", "static", "function", "constructClassInstance", "(", "$", "clazz", ",", "$", "args", ")", "{", "// $args should be a non-associative array; show nice error if that's not the case", "if", "(", "$", "args", "&&", "array_keys", "(", "$", "args", ")", "!==", "ra...
Construct an instance of the given class using the given arguments. @param string $clazz Class name @param array $args Constructor arguments @return mixed Constructed instance
[ "Construct", "an", "instance", "of", "the", "given", "class", "using", "the", "given", "arguments", "." ]
7e7ed475dfa09516f2d06a5cf0b61b8e3afba170
https://github.com/wikimedia/ObjectFactory/blob/7e7ed475dfa09516f2d06a5cf0b61b8e3afba170/src/ObjectFactory.php#L125-L132
35,546
cedx/enum.php
lib/EnumTrait.php
EnumTrait.getEntries
final static function getEntries(): array { static $entries; if (!isset($entries)) { $entries = []; foreach ((new \ReflectionClass(static::class))->getConstants() as $name => $value) { $reflection = new \ReflectionClassConstant(static::class, $name); if ($reflection->isPublic()) $ent...
php
final static function getEntries(): array { static $entries; if (!isset($entries)) { $entries = []; foreach ((new \ReflectionClass(static::class))->getConstants() as $name => $value) { $reflection = new \ReflectionClassConstant(static::class, $name); if ($reflection->isPublic()) $ent...
[ "final", "static", "function", "getEntries", "(", ")", ":", "array", "{", "static", "$", "entries", ";", "if", "(", "!", "isset", "(", "$", "entries", ")", ")", "{", "$", "entries", "=", "[", "]", ";", "foreach", "(", "(", "new", "\\", "ReflectionC...
Gets an associative array of the pairs of names and values of the constants in this enumeration. @return array An associative array that contains the pairs of names and values of the constants in this enumeration.
[ "Gets", "an", "associative", "array", "of", "the", "pairs", "of", "names", "and", "values", "of", "the", "constants", "in", "this", "enumeration", "." ]
96ad9b95bb140ef009148aaa66598c7bbbd21c5a
https://github.com/cedx/enum.php/blob/96ad9b95bb140ef009148aaa66598c7bbbd21c5a/lib/EnumTrait.php#L44-L55
35,547
cedx/enum.php
lib/EnumTrait.php
EnumTrait.getIndex
final static function getIndex($value): int { $index = array_search($value, static::getValues(), true); return $index !== false ? $index : -1; }
php
final static function getIndex($value): int { $index = array_search($value, static::getValues(), true); return $index !== false ? $index : -1; }
[ "final", "static", "function", "getIndex", "(", "$", "value", ")", ":", "int", "{", "$", "index", "=", "array_search", "(", "$", "value", ",", "static", "::", "getValues", "(", ")", ",", "true", ")", ";", "return", "$", "index", "!==", "false", "?", ...
Gets the zero-based position of the constant in this enumeration that has the specified value. @param mixed $value The value of a constant in this enumeration. @return int The zero-based position of the constant that has the specified value, or `-1` if no such constant is found.
[ "Gets", "the", "zero", "-", "based", "position", "of", "the", "constant", "in", "this", "enumeration", "that", "has", "the", "specified", "value", "." ]
96ad9b95bb140ef009148aaa66598c7bbbd21c5a
https://github.com/cedx/enum.php/blob/96ad9b95bb140ef009148aaa66598c7bbbd21c5a/lib/EnumTrait.php#L62-L65
35,548
hail-framework/framework
src/Image/Commands/EllipseCommand.php
EllipseCommand.execute
public function execute($image) { $width = $this->argument(0)->type('numeric')->required()->value(); $height = $this->argument(1)->type('numeric')->required()->value(); $x = $this->argument(2)->type('numeric')->required()->value(); $y = $this->argument(3)->type('numeric')->required()...
php
public function execute($image) { $width = $this->argument(0)->type('numeric')->required()->value(); $height = $this->argument(1)->type('numeric')->required()->value(); $x = $this->argument(2)->type('numeric')->required()->value(); $y = $this->argument(3)->type('numeric')->required()...
[ "public", "function", "execute", "(", "$", "image", ")", "{", "$", "width", "=", "$", "this", "->", "argument", "(", "0", ")", "->", "type", "(", "'numeric'", ")", "->", "required", "(", ")", "->", "value", "(", ")", ";", "$", "height", "=", "$",...
Draws ellipse on given image @param \Hail\Image\Image $image @return bool
[ "Draws", "ellipse", "on", "given", "image" ]
d419e6c098d29ef9b62192b74050e51985b94f90
https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Image/Commands/EllipseCommand.php#L16-L36
35,549
Kajna/K-Core
Core/Core/Core.php
Core.getInstance
public static function getInstance(Container $container = null) { if (null === self::$instance) { self::$instance = new Core($container); } return self::$instance; }
php
public static function getInstance(Container $container = null) { if (null === self::$instance) { self::$instance = new Core($container); } return self::$instance; }
[ "public", "static", "function", "getInstance", "(", "Container", "$", "container", "=", "null", ")", "{", "if", "(", "null", "===", "self", "::", "$", "instance", ")", "{", "self", "::", "$", "instance", "=", "new", "Core", "(", "$", "container", ")", ...
Get singleton instance of Core class. @param Container|null $container @return Core
[ "Get", "singleton", "instance", "of", "Core", "class", "." ]
6a354056cf95e471b9b1eb372c5626123fd77df2
https://github.com/Kajna/K-Core/blob/6a354056cf95e471b9b1eb372c5626123fd77df2/Core/Core/Core.php#L81-L87
35,550
Kajna/K-Core
Core/Core/Core.php
Core.execute
public function execute($silent = false) { try { // Execute middleware stack /** @var callable $start */ $start = $this->middleware->top(); $response = $start(); } catch (NotFoundException $e) { $response = $this->notFound($e); } ca...
php
public function execute($silent = false) { try { // Execute middleware stack /** @var callable $start */ $start = $this->middleware->top(); $response = $start(); } catch (NotFoundException $e) { $response = $this->notFound($e); } ca...
[ "public", "function", "execute", "(", "$", "silent", "=", "false", ")", "{", "try", "{", "// Execute middleware stack", "/** @var callable $start */", "$", "start", "=", "$", "this", "->", "middleware", "->", "top", "(", ")", ";", "$", "response", "=", "$", ...
Route request and execute associated action. @param bool $silent @return ResponseInterface @throws Exception
[ "Route", "request", "and", "execute", "associated", "action", "." ]
6a354056cf95e471b9b1eb372c5626123fd77df2
https://github.com/Kajna/K-Core/blob/6a354056cf95e471b9b1eb372c5626123fd77df2/Core/Core/Core.php#L96-L123
35,551
Kajna/K-Core
Core/Core/Core.php
Core.notFound
protected function notFound(NotFoundException $e) { if (isset($this->hooks['not.found'])) { return $this->hooks['not.found']($e); } else { return (new Response()) ->setStatusCode(404) ->setBody($e->getMessage()); } }
php
protected function notFound(NotFoundException $e) { if (isset($this->hooks['not.found'])) { return $this->hooks['not.found']($e); } else { return (new Response()) ->setStatusCode(404) ->setBody($e->getMessage()); } }
[ "protected", "function", "notFound", "(", "NotFoundException", "$", "e", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "hooks", "[", "'not.found'", "]", ")", ")", "{", "return", "$", "this", "->", "hooks", "[", "'not.found'", "]", "(", "$", "...
Handle 404. @param NotFoundException $e @return ResponseInterface
[ "Handle", "404", "." ]
6a354056cf95e471b9b1eb372c5626123fd77df2
https://github.com/Kajna/K-Core/blob/6a354056cf95e471b9b1eb372c5626123fd77df2/Core/Core/Core.php#L170-L179
35,552
hail-framework/framework
src/Image/Commands/RectangleCommand.php
RectangleCommand.execute
public function execute($image) { $x1 = $this->argument(0)->type('numeric')->required()->value(); $y1 = $this->argument(1)->type('numeric')->required()->value(); $x2 = $this->argument(2)->type('numeric')->required()->value(); $y2 = $this->argument(3)->type('numeric')->required()->val...
php
public function execute($image) { $x1 = $this->argument(0)->type('numeric')->required()->value(); $y1 = $this->argument(1)->type('numeric')->required()->value(); $x2 = $this->argument(2)->type('numeric')->required()->value(); $y2 = $this->argument(3)->type('numeric')->required()->val...
[ "public", "function", "execute", "(", "$", "image", ")", "{", "$", "x1", "=", "$", "this", "->", "argument", "(", "0", ")", "->", "type", "(", "'numeric'", ")", "->", "required", "(", ")", "->", "value", "(", ")", ";", "$", "y1", "=", "$", "thi...
Draws rectangle on given image @param \Hail\Image\Image $image @return bool
[ "Draws", "rectangle", "on", "given", "image" ]
d419e6c098d29ef9b62192b74050e51985b94f90
https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Image/Commands/RectangleCommand.php#L16-L36
35,553
hail-framework/framework
src/Redis/Sentinel.php
Sentinel.createMasterClient
public function createMasterClient($name) { $master = $this->getMasterAddressByName($name); if (!isset($master[0], $master[1])) { throw new RedisException('Master not found'); } return Factory::client([ 'host' => $master[0], 'port' => $master[1], ...
php
public function createMasterClient($name) { $master = $this->getMasterAddressByName($name); if (!isset($master[0], $master[1])) { throw new RedisException('Master not found'); } return Factory::client([ 'host' => $master[0], 'port' => $master[1], ...
[ "public", "function", "createMasterClient", "(", "$", "name", ")", "{", "$", "master", "=", "$", "this", "->", "getMasterAddressByName", "(", "$", "name", ")", ";", "if", "(", "!", "isset", "(", "$", "master", "[", "0", "]", ",", "$", "master", "[", ...
Discover the master node automatically and return an instance of Credis_Client that connects to the master @param string $name @return RedisInterface @throws RedisException
[ "Discover", "the", "master", "node", "automatically", "and", "return", "an", "instance", "of", "Credis_Client", "that", "connects", "to", "the", "master" ]
d419e6c098d29ef9b62192b74050e51985b94f90
https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Redis/Sentinel.php#L127-L142
35,554
hail-framework/framework
src/Redis/Sentinel.php
Sentinel.getMasterClient
public function getMasterClient($name) { if (!isset($this->master[$name])) { $this->master[$name] = $this->createMasterClient($name); } return $this->master[$name]; }
php
public function getMasterClient($name) { if (!isset($this->master[$name])) { $this->master[$name] = $this->createMasterClient($name); } return $this->master[$name]; }
[ "public", "function", "getMasterClient", "(", "$", "name", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "master", "[", "$", "name", "]", ")", ")", "{", "$", "this", "->", "master", "[", "$", "name", "]", "=", "$", "this", "->", "c...
If a Credis_Client object exists for a master, return it. Otherwise create one and return it @param string $name @return Client @throws RedisException
[ "If", "a", "Credis_Client", "object", "exists", "for", "a", "master", "return", "it", ".", "Otherwise", "create", "one", "and", "return", "it" ]
d419e6c098d29ef9b62192b74050e51985b94f90
https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Redis/Sentinel.php#L152-L159
35,555
hail-framework/framework
src/Redis/Sentinel.php
Sentinel.createSlaveClients
public function createSlaveClients($name) { $slaves = $this->slaves($name); $workingSlaves = []; foreach ($slaves as $slave) { if (!isset($slave[9])) { throw new RedisException('Can\' retrieve slave status'); } if (\strpos($slave[9], 's_dow...
php
public function createSlaveClients($name) { $slaves = $this->slaves($name); $workingSlaves = []; foreach ($slaves as $slave) { if (!isset($slave[9])) { throw new RedisException('Can\' retrieve slave status'); } if (\strpos($slave[9], 's_dow...
[ "public", "function", "createSlaveClients", "(", "$", "name", ")", "{", "$", "slaves", "=", "$", "this", "->", "slaves", "(", "$", "name", ")", ";", "$", "workingSlaves", "=", "[", "]", ";", "foreach", "(", "$", "slaves", "as", "$", "slave", ")", "...
Discover the slave nodes automatically and return an array of Credis_Client objects @param string $name @return RedisInterface[] @throws RedisException
[ "Discover", "the", "slave", "nodes", "automatically", "and", "return", "an", "array", "of", "Credis_Client", "objects" ]
d419e6c098d29ef9b62192b74050e51985b94f90
https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Redis/Sentinel.php#L169-L190
35,556
hail-framework/framework
src/Redis/Sentinel.php
Sentinel.getSlaveClients
public function getSlaveClients($name) { if (!isset($this->slaves[$name])) { $this->slaves[$name] = $this->createSlaveClients($name); } return $this->slaves[$name]; }
php
public function getSlaveClients($name) { if (!isset($this->slaves[$name])) { $this->slaves[$name] = $this->createSlaveClients($name); } return $this->slaves[$name]; }
[ "public", "function", "getSlaveClients", "(", "$", "name", ")", "{", "if", "(", "!", "isset", "(", "$", "this", "->", "slaves", "[", "$", "name", "]", ")", ")", "{", "$", "this", "->", "slaves", "[", "$", "name", "]", "=", "$", "this", "->", "c...
If an array of Credis_Client objects exist for a set of slaves, return them. Otherwise create and return them @param string $name @return Client[] @throws RedisException
[ "If", "an", "array", "of", "Credis_Client", "objects", "exist", "for", "a", "set", "of", "slaves", "return", "them", ".", "Otherwise", "create", "and", "return", "them" ]
d419e6c098d29ef9b62192b74050e51985b94f90
https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Redis/Sentinel.php#L200-L207
35,557
hail-framework/framework
src/Redis/Sentinel.php
Sentinel.info
public function info($section = null) { if ($section) { return $this->client->info($section); } return $this->client->info(); }
php
public function info($section = null) { if ($section) { return $this->client->info($section); } return $this->client->info(); }
[ "public", "function", "info", "(", "$", "section", "=", "null", ")", "{", "if", "(", "$", "section", ")", "{", "return", "$", "this", "->", "client", "->", "info", "(", "$", "section", ")", ";", "}", "return", "$", "this", "->", "client", "->", "...
get information block for the sentinel instance @param string|NUll $section @return array
[ "get", "information", "block", "for", "the", "sentinel", "instance" ]
d419e6c098d29ef9b62192b74050e51985b94f90
https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Redis/Sentinel.php#L232-L239
35,558
hail-framework/framework
src/Console/CommandTrait.php
CommandTrait.name
public function name(): string { static $name = null; if ($name === null) { // Extract command name from the class name. $class = substr(strrchr(static::class, '\\'), 1); $name = CommandLoader::inverseTranslate($class); } return $name; }
php
public function name(): string { static $name = null; if ($name === null) { // Extract command name from the class name. $class = substr(strrchr(static::class, '\\'), 1); $name = CommandLoader::inverseTranslate($class); } return $name; }
[ "public", "function", "name", "(", ")", ":", "string", "{", "static", "$", "name", "=", "null", ";", "if", "(", "$", "name", "===", "null", ")", "{", "// Extract command name from the class name.", "$", "class", "=", "substr", "(", "strrchr", "(", "static"...
Translate current class name to command name. @return string command name
[ "Translate", "current", "class", "name", "to", "command", "name", "." ]
d419e6c098d29ef9b62192b74050e51985b94f90
https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Console/CommandTrait.php#L132-L142
35,559
hail-framework/framework
src/Console/CommandTrait.php
CommandTrait.addCommandGroup
public function addCommandGroup($groupName, $commands = []) { $group = new CommandGroup($groupName); foreach ($commands as $val) { $cmd = $this->addCommand($val); $group->addCommand($cmd); } $this->commandGroups[] = $group; return $group; }
php
public function addCommandGroup($groupName, $commands = []) { $group = new CommandGroup($groupName); foreach ($commands as $val) { $cmd = $this->addCommand($val); $group->addCommand($cmd); } $this->commandGroups[] = $group; return $group; }
[ "public", "function", "addCommandGroup", "(", "$", "groupName", ",", "$", "commands", "=", "[", "]", ")", "{", "$", "group", "=", "new", "CommandGroup", "(", "$", "groupName", ")", ";", "foreach", "(", "$", "commands", "as", "$", "val", ")", "{", "$"...
Add a command group and register the commands automatically @param string $groupName The group name @param array $commands Command array combines indexed command names or command class assoc array. @return CommandGroup
[ "Add", "a", "command", "group", "and", "register", "the", "commands", "automatically" ]
d419e6c098d29ef9b62192b74050e51985b94f90
https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Console/CommandTrait.php#L161-L171
35,560
hail-framework/framework
src/Console/CommandTrait.php
CommandTrait.getApplication
public function getApplication(): ?Application { if ($this instanceof Application) { return $this; } if ($p = $this->parent) { return $p->getApplication(); } return null; }
php
public function getApplication(): ?Application { if ($this instanceof Application) { return $this; } if ($p = $this->parent) { return $p->getApplication(); } return null; }
[ "public", "function", "getApplication", "(", ")", ":", "?", "Application", "{", "if", "(", "$", "this", "instanceof", "Application", ")", "{", "return", "$", "this", ";", "}", "if", "(", "$", "p", "=", "$", "this", "->", "parent", ")", "{", "return",...
Get the main application object from parents or the object itself. @return Application|null
[ "Get", "the", "main", "application", "object", "from", "parents", "or", "the", "object", "itself", "." ]
d419e6c098d29ef9b62192b74050e51985b94f90
https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Console/CommandTrait.php#L188-L199
35,561
hail-framework/framework
src/Console/CommandTrait.php
CommandTrait.connectCommand
public function connectCommand(Command $cmd) { $name = $cmd->name(); $this->commands[$name] = $cmd; // regsiter command aliases to the alias table. $aliases = $cmd->aliases(); if (is_string($aliases)) { $aliases = preg_split('/\s+/', $aliases); } ...
php
public function connectCommand(Command $cmd) { $name = $cmd->name(); $this->commands[$name] = $cmd; // regsiter command aliases to the alias table. $aliases = $cmd->aliases(); if (is_string($aliases)) { $aliases = preg_split('/\s+/', $aliases); } ...
[ "public", "function", "connectCommand", "(", "Command", "$", "cmd", ")", "{", "$", "name", "=", "$", "cmd", "->", "name", "(", ")", ";", "$", "this", "->", "commands", "[", "$", "name", "]", "=", "$", "cmd", ";", "// regsiter command aliases to the alias...
connectCommand connects a command name with a command object. @param Command $cmd
[ "connectCommand", "connects", "a", "command", "name", "with", "a", "command", "object", "." ]
d419e6c098d29ef9b62192b74050e51985b94f90
https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Console/CommandTrait.php#L320-L338
35,562
hail-framework/framework
src/Console/CommandTrait.php
CommandTrait.aggregate
public function aggregate() { $commands = []; foreach ($this->getVisibleCommands() as $name => $cmd) { $commands[$name] = $cmd; } foreach ($this->commandGroups as $g) { if ($g->isHidden) { continue; } foreach ($g->getCo...
php
public function aggregate() { $commands = []; foreach ($this->getVisibleCommands() as $name => $cmd) { $commands[$name] = $cmd; } foreach ($this->commandGroups as $g) { if ($g->isHidden) { continue; } foreach ($g->getCo...
[ "public", "function", "aggregate", "(", ")", "{", "$", "commands", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "getVisibleCommands", "(", ")", "as", "$", "name", "=>", "$", "cmd", ")", "{", "$", "commands", "[", "$", "name", "]", "=", ...
Aggregate command info
[ "Aggregate", "command", "info" ]
d419e6c098d29ef9b62192b74050e51985b94f90
https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Console/CommandTrait.php#L344-L372
35,563
hail-framework/framework
src/Console/CommandTrait.php
CommandTrait.getVisibleCommands
public function getVisibleCommands(): array { $commands = []; foreach ($this->commands as $name => $command) { if ($name[0] === '_') { continue; } $commands[$name] = $command; } return $commands; }
php
public function getVisibleCommands(): array { $commands = []; foreach ($this->commands as $name => $command) { if ($name[0] === '_') { continue; } $commands[$name] = $command; } return $commands; }
[ "public", "function", "getVisibleCommands", "(", ")", ":", "array", "{", "$", "commands", "=", "[", "]", ";", "foreach", "(", "$", "this", "->", "commands", "as", "$", "name", "=>", "$", "command", ")", "{", "if", "(", "$", "name", "[", "0", "]", ...
Some commands are not visible. when user runs 'help', we should just show them these visible commands @return string[] CommandBase command map
[ "Some", "commands", "are", "not", "visible", ".", "when", "user", "runs", "help", "we", "should", "just", "show", "them", "these", "visible", "commands" ]
d419e6c098d29ef9b62192b74050e51985b94f90
https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Console/CommandTrait.php#L414-L426
35,564
hail-framework/framework
src/Console/CommandTrait.php
CommandTrait.getCommandNameTraceArray
public function getCommandNameTraceArray() { $cmdStacks = [$this->name()]; $p = $this->parent; while ($p) { if (!$p instanceof Application) { $cmdStacks[] = $p->name(); } $p = $p->parent; } return array_reverse($cmdStacks);...
php
public function getCommandNameTraceArray() { $cmdStacks = [$this->name()]; $p = $this->parent; while ($p) { if (!$p instanceof Application) { $cmdStacks[] = $p->name(); } $p = $p->parent; } return array_reverse($cmdStacks);...
[ "public", "function", "getCommandNameTraceArray", "(", ")", "{", "$", "cmdStacks", "=", "[", "$", "this", "->", "name", "(", ")", "]", ";", "$", "p", "=", "$", "this", "->", "parent", ";", "while", "(", "$", "p", ")", "{", "if", "(", "!", "$", ...
Return the command name stack @return string[]
[ "Return", "the", "command", "name", "stack" ]
d419e6c098d29ef9b62192b74050e51985b94f90
https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Console/CommandTrait.php#L446-L458
35,565
hail-framework/framework
src/Console/CommandTrait.php
CommandTrait.getCommand
public function getCommand($command): Command { if (isset($this->aliases[$command])) { return $this->aliases[$command]; } if (isset($this->commands[$command])) { return $this->commands[$command]; } throw new CommandNotFoundException($this, $command);...
php
public function getCommand($command): Command { if (isset($this->aliases[$command])) { return $this->aliases[$command]; } if (isset($this->commands[$command])) { return $this->commands[$command]; } throw new CommandNotFoundException($this, $command);...
[ "public", "function", "getCommand", "(", "$", "command", ")", ":", "Command", "{", "if", "(", "isset", "(", "$", "this", "->", "aliases", "[", "$", "command", "]", ")", ")", "{", "return", "$", "this", "->", "aliases", "[", "$", "command", "]", ";"...
Get subcommand object from current command by command name. @param string $command @return Command initialized command object. @throws CommandNotFoundException
[ "Get", "subcommand", "object", "from", "current", "command", "by", "command", "name", "." ]
d419e6c098d29ef9b62192b74050e51985b94f90
https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Console/CommandTrait.php#L485-L496
35,566
hail-framework/framework
src/Console/CommandTrait.php
CommandTrait.getArguments
public function getArguments(): array { // if user not define any arguments, get argument info from method parameters if ($this->arguments === null) { $this->arguments = []; $ro = new \ReflectionObject($this); if (!$ro->hasMethod('execute')) { thr...
php
public function getArguments(): array { // if user not define any arguments, get argument info from method parameters if ($this->arguments === null) { $this->arguments = []; $ro = new \ReflectionObject($this); if (!$ro->hasMethod('execute')) { thr...
[ "public", "function", "getArguments", "(", ")", ":", "array", "{", "// if user not define any arguments, get argument info from method parameters", "if", "(", "$", "this", "->", "arguments", "===", "null", ")", "{", "$", "this", "->", "arguments", "=", "[", "]", "...
Return the defined argument info objects. @return Argument[] @throws ExecuteMethodNotDefinedException
[ "Return", "the", "defined", "argument", "info", "objects", "." ]
d419e6c098d29ef9b62192b74050e51985b94f90
https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Console/CommandTrait.php#L659-L686
35,567
hail-framework/framework
src/Console/CommandTrait.php
CommandTrait.executeWrapper
public function executeWrapper(array $args) { if (!method_exists($this, 'execute')) { $cmd = $this->createCommand(Help::class); $cmd->executeWrapper([$this->name()]); return; } // Validating arguments foreach ($this->getArguments() as $k => $arg...
php
public function executeWrapper(array $args) { if (!method_exists($this, 'execute')) { $cmd = $this->createCommand(Help::class); $cmd->executeWrapper([$this->name()]); return; } // Validating arguments foreach ($this->getArguments() as $k => $arg...
[ "public", "function", "executeWrapper", "(", "array", "$", "args", ")", "{", "if", "(", "!", "method_exists", "(", "$", "this", ",", "'execute'", ")", ")", "{", "$", "cmd", "=", "$", "this", "->", "createCommand", "(", "Help", "::", "class", ")", ";"...
Execute command object, this is a wrapper method for execution. In this method, we check the command arguments by the Reflection feature provided by PHP. @param array $args command argument list (not associative array). @throws CommandArgumentNotEnoughException @throws RequireValueException @throws \ReflectionExcep...
[ "Execute", "command", "object", "this", "is", "a", "wrapper", "method", "for", "execution", "." ]
d419e6c098d29ef9b62192b74050e51985b94f90
https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Console/CommandTrait.php#L700-L742
35,568
hail-framework/framework
src/Http/Middleware/Payload.php
Payload.csvParser
protected static function csvParser(StreamInterface $stream): array { if ($stream->isSeekable()) { $stream->rewind(); } $handle = $stream->detach(); $data = []; while (($row = \fgetcsv($handle)) !== false) { $data[] = $row; } \fclose($handle); return ['body' => $data]; }
php
protected static function csvParser(StreamInterface $stream): array { if ($stream->isSeekable()) { $stream->rewind(); } $handle = $stream->detach(); $data = []; while (($row = \fgetcsv($handle)) !== false) { $data[] = $row; } \fclose($handle); return ['body' => $data]; }
[ "protected", "static", "function", "csvParser", "(", "StreamInterface", "$", "stream", ")", ":", "array", "{", "if", "(", "$", "stream", "->", "isSeekable", "(", ")", ")", "{", "$", "stream", "->", "rewind", "(", ")", ";", "}", "$", "handle", "=", "$...
Parses csv strings. @param StreamInterface $stream @return array @throws \RuntimeException
[ "Parses", "csv", "strings", "." ]
d419e6c098d29ef9b62192b74050e51985b94f90
https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Http/Middleware/Payload.php#L177-L191
35,569
hail-framework/framework
src/Console/Component/Table/Table.php
Table.getNumberOfColumns
private function getNumberOfColumns() { if (null !== $this->numberOfColumns) { return $this->numberOfColumns; } $columns = [\count($this->headers)]; foreach ($this->rows as $row) { $columns[] = \count($row); } return $this->numberOfColumns = ...
php
private function getNumberOfColumns() { if (null !== $this->numberOfColumns) { return $this->numberOfColumns; } $columns = [\count($this->headers)]; foreach ($this->rows as $row) { $columns[] = \count($row); } return $this->numberOfColumns = ...
[ "private", "function", "getNumberOfColumns", "(", ")", "{", "if", "(", "null", "!==", "$", "this", "->", "numberOfColumns", ")", "{", "return", "$", "this", "->", "numberOfColumns", ";", "}", "$", "columns", "=", "[", "\\", "count", "(", "$", "this", "...
Gets number of columns for this table. @return int
[ "Gets", "number", "of", "columns", "for", "this", "table", "." ]
d419e6c098d29ef9b62192b74050e51985b94f90
https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Console/Component/Table/Table.php#L112-L124
35,570
hiqdev/hipanel-module-dns
src/controllers/RecordController.php
RecordController.actionCreate
public function actionCreate() { $collection = (new Collection([ 'model' => $this->newModel(['scenario' => 'create']), ]))->load(); if ($collection->count() && $collection->save()) { Yii::$app->session->addFlash('success', Yii::t('hipanel:dns', '{0, plural, one{DNS r...
php
public function actionCreate() { $collection = (new Collection([ 'model' => $this->newModel(['scenario' => 'create']), ]))->load(); if ($collection->count() && $collection->save()) { Yii::$app->session->addFlash('success', Yii::t('hipanel:dns', '{0, plural, one{DNS r...
[ "public", "function", "actionCreate", "(", ")", "{", "$", "collection", "=", "(", "new", "Collection", "(", "[", "'model'", "=>", "$", "this", "->", "newModel", "(", "[", "'scenario'", "=>", "'create'", "]", ")", ",", "]", ")", ")", "->", "load", "("...
Created the DNS record. @throws BadRequestHttpException @throws NotFoundHttpException @return string|\yii\web\Response
[ "Created", "the", "DNS", "record", "." ]
7e9199c95d91a979b7bd4fd07fe801dbe9e69183
https://github.com/hiqdev/hipanel-module-dns/blob/7e9199c95d91a979b7bd4fd07fe801dbe9e69183/src/controllers/RecordController.php#L62-L77
35,571
hiqdev/hipanel-module-dns
src/controllers/RecordController.php
RecordController.actionUpdate
public function actionUpdate($id = null, $hdomain_id = null) { if ($id && $hdomain_id && $model = $this->newModel()->findOne(compact('id', 'hdomain_id'))) { $model->scenario = 'update'; return $this->renderAjax('update', ['model' => $model]); } $collection = (new Co...
php
public function actionUpdate($id = null, $hdomain_id = null) { if ($id && $hdomain_id && $model = $this->newModel()->findOne(compact('id', 'hdomain_id'))) { $model->scenario = 'update'; return $this->renderAjax('update', ['model' => $model]); } $collection = (new Co...
[ "public", "function", "actionUpdate", "(", "$", "id", "=", "null", ",", "$", "hdomain_id", "=", "null", ")", "{", "if", "(", "$", "id", "&&", "$", "hdomain_id", "&&", "$", "model", "=", "$", "this", "->", "newModel", "(", ")", "->", "findOne", "(",...
Updates the DNS record. @param integer $id @param integer $hdomain_id @throws BadRequestHttpException @throws NotFoundHttpException @return string
[ "Updates", "the", "DNS", "record", "." ]
7e9199c95d91a979b7bd4fd07fe801dbe9e69183
https://github.com/hiqdev/hipanel-module-dns/blob/7e9199c95d91a979b7bd4fd07fe801dbe9e69183/src/controllers/RecordController.php#L88-L106
35,572
jormin/aliyun
sdk/aliyun-mq-http-php-sdk/MQClient.php
MQClient.getProducer
public function getProducer($instanceId, $topicName) { if ($topicName == NULL || $topicName == "") { throw new InvalidArgumentException(400, "TopicName is null or empty"); } return new MQProducer($this->client, $instanceId, $topicName); }
php
public function getProducer($instanceId, $topicName) { if ($topicName == NULL || $topicName == "") { throw new InvalidArgumentException(400, "TopicName is null or empty"); } return new MQProducer($this->client, $instanceId, $topicName); }
[ "public", "function", "getProducer", "(", "$", "instanceId", ",", "$", "topicName", ")", "{", "if", "(", "$", "topicName", "==", "NULL", "||", "$", "topicName", "==", "\"\"", ")", "{", "throw", "new", "InvalidArgumentException", "(", "400", ",", "\"TopicNa...
Returns a Producer reference for publish message to topic @param string $instanceId: instance id @param string $topicName: the topic name @return MQProducer $topic: the Producer instance
[ "Returns", "a", "Producer", "reference", "for", "publish", "message", "to", "topic" ]
c0eb19f5c265dba1f463af1db7347acdcfddb240
https://github.com/jormin/aliyun/blob/c0eb19f5c265dba1f463af1db7347acdcfddb240/sdk/aliyun-mq-http-php-sdk/MQClient.php#L46-L52
35,573
jormin/aliyun
sdk/aliyun-mq-http-php-sdk/MQClient.php
MQClient.getConsumer
public function getConsumer($instanceId, $topicName, $consumer, $messageTag = NULL) { if ($topicName == NULL || $topicName == "") { throw new InvalidArgumentException(400, "TopicName is null or empty"); } if ($consumer == NULL || $consumer == "" ) { throw new InvalidA...
php
public function getConsumer($instanceId, $topicName, $consumer, $messageTag = NULL) { if ($topicName == NULL || $topicName == "") { throw new InvalidArgumentException(400, "TopicName is null or empty"); } if ($consumer == NULL || $consumer == "" ) { throw new InvalidA...
[ "public", "function", "getConsumer", "(", "$", "instanceId", ",", "$", "topicName", ",", "$", "consumer", ",", "$", "messageTag", "=", "NULL", ")", "{", "if", "(", "$", "topicName", "==", "NULL", "||", "$", "topicName", "==", "\"\"", ")", "{", "throw",...
Returns a Consumer reference for consume and ack message to topic @param string $instanceId: instance id @param string $topicName: the topic name @param string $consumer: the consumer name / ons cid @param string $messageTag: filter tag for consumer. If not empty, only consume the message which's messageTag is equal ...
[ "Returns", "a", "Consumer", "reference", "for", "consume", "and", "ack", "message", "to", "topic" ]
c0eb19f5c265dba1f463af1db7347acdcfddb240
https://github.com/jormin/aliyun/blob/c0eb19f5c265dba1f463af1db7347acdcfddb240/sdk/aliyun-mq-http-php-sdk/MQClient.php#L64-L73
35,574
hail-framework/framework
src/I18n/Gettext/Utils/HeadersExtractorTrait.php
HeadersExtractorTrait.extractHeaders
private static function extractHeaders($headers, Translations $translations) { $headers = explode("\n", $headers); $currentHeader = null; foreach ($headers as $line) { $line = self::convertString($line); if ($line === '') { continue; } ...
php
private static function extractHeaders($headers, Translations $translations) { $headers = explode("\n", $headers); $currentHeader = null; foreach ($headers as $line) { $line = self::convertString($line); if ($line === '') { continue; } ...
[ "private", "static", "function", "extractHeaders", "(", "$", "headers", ",", "Translations", "$", "translations", ")", "{", "$", "headers", "=", "explode", "(", "\"\\n\"", ",", "$", "headers", ")", ";", "$", "currentHeader", "=", "null", ";", "foreach", "(...
Add the headers found to the translations instance. @param string $headers @param Translations $translations
[ "Add", "the", "headers", "found", "to", "the", "translations", "instance", "." ]
d419e6c098d29ef9b62192b74050e51985b94f90
https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/I18n/Gettext/Utils/HeadersExtractorTrait.php#L18-L39
35,575
mcrumm/pecan
src/Console/Output/ConsoleOutput.php
ConsoleOutput.once
public function once($event, callable $listener) { parent::once($event, $listener); $this->stderr->once($event, $listener); }
php
public function once($event, callable $listener) { parent::once($event, $listener); $this->stderr->once($event, $listener); }
[ "public", "function", "once", "(", "$", "event", ",", "callable", "$", "listener", ")", "{", "parent", "::", "once", "(", "$", "event", ",", "$", "listener", ")", ";", "$", "this", "->", "stderr", "->", "once", "(", "$", "event", ",", "$", "listene...
Helper method to proxy event listeners to the wrapped stream. @param $event @param callable $listener
[ "Helper", "method", "to", "proxy", "event", "listeners", "to", "the", "wrapped", "stream", "." ]
f35f01249587a4df45c7d3ab78f3e51919471177
https://github.com/mcrumm/pecan/blob/f35f01249587a4df45c7d3ab78f3e51919471177/src/Console/Output/ConsoleOutput.php#L62-L66
35,576
jormin/aliyun
sdk/aliyun-mns-php-sdk/AliyunMNS/Client.php
Client.getAccountAttributes
public function getAccountAttributes() { $request = new GetAccountAttributesRequest(); $response = new GetAccountAttributesResponse(); return $this->client->sendRequest($request, $response); }
php
public function getAccountAttributes() { $request = new GetAccountAttributesRequest(); $response = new GetAccountAttributesResponse(); return $this->client->sendRequest($request, $response); }
[ "public", "function", "getAccountAttributes", "(", ")", "{", "$", "request", "=", "new", "GetAccountAttributesRequest", "(", ")", ";", "$", "response", "=", "new", "GetAccountAttributesResponse", "(", ")", ";", "return", "$", "this", "->", "client", "->", "sen...
Query the AccountAttributes @return GetAccountAttributesResponse: the response containing topicNames @throws MnsException if any exception happends
[ "Query", "the", "AccountAttributes" ]
c0eb19f5c265dba1f463af1db7347acdcfddb240
https://github.com/jormin/aliyun/blob/c0eb19f5c265dba1f463af1db7347acdcfddb240/sdk/aliyun-mns-php-sdk/AliyunMNS/Client.php#L210-L215
35,577
jormin/aliyun
sdk/aliyun-mns-php-sdk/AliyunMNS/Client.php
Client.setAccountAttributes
public function setAccountAttributes(AccountAttributes $attributes) { $request = new SetAccountAttributesRequest($attributes); $response = new SetAccountAttributesResponse(); return $this->client->sendRequest($request, $response); }
php
public function setAccountAttributes(AccountAttributes $attributes) { $request = new SetAccountAttributesRequest($attributes); $response = new SetAccountAttributesResponse(); return $this->client->sendRequest($request, $response); }
[ "public", "function", "setAccountAttributes", "(", "AccountAttributes", "$", "attributes", ")", "{", "$", "request", "=", "new", "SetAccountAttributesRequest", "(", "$", "attributes", ")", ";", "$", "response", "=", "new", "SetAccountAttributesResponse", "(", ")", ...
Set the AccountAttributes @param AccountAttributes $attributes: the AccountAttributes to set @return SetAccountAttributesResponse: the response @throws MnsException if any exception happends
[ "Set", "the", "AccountAttributes" ]
c0eb19f5c265dba1f463af1db7347acdcfddb240
https://github.com/jormin/aliyun/blob/c0eb19f5c265dba1f463af1db7347acdcfddb240/sdk/aliyun-mns-php-sdk/AliyunMNS/Client.php#L233-L238
35,578
hail-framework/framework
src/I18n/Gettext/Translation.php
Translation.getPluralTranslations
public function getPluralTranslations($size = null) { if ($size === null) { return $this->pluralTranslation; } $current = \count($this->pluralTranslation); if ($size > $current) { return $this->pluralTranslation + \array_fill(0, $size, ''); } ...
php
public function getPluralTranslations($size = null) { if ($size === null) { return $this->pluralTranslation; } $current = \count($this->pluralTranslation); if ($size > $current) { return $this->pluralTranslation + \array_fill(0, $size, ''); } ...
[ "public", "function", "getPluralTranslations", "(", "$", "size", "=", "null", ")", "{", "if", "(", "$", "size", "===", "null", ")", "{", "return", "$", "this", "->", "pluralTranslation", ";", "}", "$", "current", "=", "\\", "count", "(", "$", "this", ...
Gets all plural translations. @param int $size @return array
[ "Gets", "all", "plural", "translations", "." ]
d419e6c098d29ef9b62192b74050e51985b94f90
https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/I18n/Gettext/Translation.php#L228-L245
35,579
hail-framework/framework
src/I18n/Gettext/Translation.php
Translation.hasPluralTranslations
public function hasPluralTranslations($checkContent = false) { if ($checkContent) { return \implode('', $this->pluralTranslation) !== ''; } return !empty($this->pluralTranslation); }
php
public function hasPluralTranslations($checkContent = false) { if ($checkContent) { return \implode('', $this->pluralTranslation) !== ''; } return !empty($this->pluralTranslation); }
[ "public", "function", "hasPluralTranslations", "(", "$", "checkContent", "=", "false", ")", "{", "if", "(", "$", "checkContent", ")", "{", "return", "\\", "implode", "(", "''", ",", "$", "this", "->", "pluralTranslation", ")", "!==", "''", ";", "}", "ret...
Checks if there are any plural translation. @param bool $checkContent @return bool
[ "Checks", "if", "there", "are", "any", "plural", "translation", "." ]
d419e6c098d29ef9b62192b74050e51985b94f90
https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/I18n/Gettext/Translation.php#L254-L261
35,580
hail-framework/framework
src/I18n/Gettext/Translation.php
Translation.addExtractedComment
public function addExtractedComment($comment) { if (!\in_array($comment, $this->extractedComments, true)) { $this->extractedComments[] = $comment; } return $this; }
php
public function addExtractedComment($comment) { if (!\in_array($comment, $this->extractedComments, true)) { $this->extractedComments[] = $comment; } return $this; }
[ "public", "function", "addExtractedComment", "(", "$", "comment", ")", "{", "if", "(", "!", "\\", "in_array", "(", "$", "comment", ",", "$", "this", "->", "extractedComments", ",", "true", ")", ")", "{", "$", "this", "->", "extractedComments", "[", "]", ...
Adds a new extracted comment for this translation. @param string $comment @return self
[ "Adds", "a", "new", "extracted", "comment", "for", "this", "translation", "." ]
d419e6c098d29ef9b62192b74050e51985b94f90
https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/I18n/Gettext/Translation.php#L398-L405
35,581
htmlburger/wpemerge-cli
src/Helpers/Boolean.php
Boolean.fromString
public static function fromString( $string ) { $values = [ '1' => true, 'y' => true, 'yes' => true, 'true' => true, '0' => false, 'n' => false, 'no' => false, 'false' => false, ]; foreach ( $values as $value => $boolean ) { if ( strtolower( $value ) === strtolowe...
php
public static function fromString( $string ) { $values = [ '1' => true, 'y' => true, 'yes' => true, 'true' => true, '0' => false, 'n' => false, 'no' => false, 'false' => false, ]; foreach ( $values as $value => $boolean ) { if ( strtolower( $value ) === strtolowe...
[ "public", "static", "function", "fromString", "(", "$", "string", ")", "{", "$", "values", "=", "[", "'1'", "=>", "true", ",", "'y'", "=>", "true", ",", "'yes'", "=>", "true", ",", "'true'", "=>", "true", ",", "'0'", "=>", "false", ",", "'n'", "=>"...
Convert a string to boolean @param string $string @return boolean
[ "Convert", "a", "string", "to", "boolean" ]
075f1982b7dd87039a4e7bbc05caf676a10fe862
https://github.com/htmlburger/wpemerge-cli/blob/075f1982b7dd87039a4e7bbc05caf676a10fe862/src/Helpers/Boolean.php#L12-L33
35,582
cfxmarkets/php-public-models
src/Brokerage/OrderIntent.php
OrderIntent.serializeAttribute
public function serializeAttribute($name) { if ($name === 'createdOn') { $val = $this->getCreatedOn(); if ($val instanceof \DateTimeInterface) { $val = $val->format("Y-m-d H:i:s"); } return (string)$val; } return parent...
php
public function serializeAttribute($name) { if ($name === 'createdOn') { $val = $this->getCreatedOn(); if ($val instanceof \DateTimeInterface) { $val = $val->format("Y-m-d H:i:s"); } return (string)$val; } return parent...
[ "public", "function", "serializeAttribute", "(", "$", "name", ")", "{", "if", "(", "$", "name", "===", "'createdOn'", ")", "{", "$", "val", "=", "$", "this", "->", "getCreatedOn", "(", ")", ";", "if", "(", "$", "val", "instanceof", "\\", "DateTimeInter...
Serialize createdOn field to a value that SQL understands We have to do this here because when order intents are serialized that already have a createdOn date set, they end up sending malformed data to the API. This is because \DateTime actually does implement jsonSerialize, but in a way that breaks our implementation...
[ "Serialize", "createdOn", "field", "to", "a", "value", "that", "SQL", "understands" ]
b91a58f7d9519b98b29c58f0911e976e361a5f65
https://github.com/cfxmarkets/php-public-models/blob/b91a58f7d9519b98b29c58f0911e976e361a5f65/src/Brokerage/OrderIntent.php#L448-L458
35,583
hail-framework/framework
src/Util/Crypto.php
Crypto.encrypt
public static function encrypt( string $plaintext, string $key, string $ad = '', string $format = null, bool $password = false ): string { if (\mb_strlen($key, '8bit') !== self::KEY_BYTE_SIZE) { throw new CryptoException('Bad key length.'); } ...
php
public static function encrypt( string $plaintext, string $key, string $ad = '', string $format = null, bool $password = false ): string { if (\mb_strlen($key, '8bit') !== self::KEY_BYTE_SIZE) { throw new CryptoException('Bad key length.'); } ...
[ "public", "static", "function", "encrypt", "(", "string", "$", "plaintext", ",", "string", "$", "key", ",", "string", "$", "ad", "=", "''", ",", "string", "$", "format", "=", "null", ",", "bool", "$", "password", "=", "false", ")", ":", "string", "{"...
Encrypts a string with a Key. @param string $plaintext @param string $key @param string $ad @param string $format @param bool $password @throws CryptoException @return string @throws \Exception
[ "Encrypts", "a", "string", "with", "a", "Key", "." ]
d419e6c098d29ef9b62192b74050e51985b94f90
https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Util/Crypto.php#L204-L245
35,584
hail-framework/framework
src/Util/Crypto.php
Crypto.encryptWithPassword
public static function encryptWithPassword( string $plaintext, string $password, string $ad = '', string $format = null ): string { return self::encrypt($plaintext, $password, $ad, $format, true); }
php
public static function encryptWithPassword( string $plaintext, string $password, string $ad = '', string $format = null ): string { return self::encrypt($plaintext, $password, $ad, $format, true); }
[ "public", "static", "function", "encryptWithPassword", "(", "string", "$", "plaintext", ",", "string", "$", "password", ",", "string", "$", "ad", "=", "''", ",", "string", "$", "format", "=", "null", ")", ":", "string", "{", "return", "self", "::", "encr...
Encrypts a string with a password, using a slow key derivation function to make password cracking more expensive. @param string $plaintext @param string $password @param string $ad @param string $format @throws \Exception @return string
[ "Encrypts", "a", "string", "with", "a", "password", "using", "a", "slow", "key", "derivation", "function", "to", "make", "password", "cracking", "more", "expensive", "." ]
d419e6c098d29ef9b62192b74050e51985b94f90
https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Util/Crypto.php#L260-L267
35,585
hail-framework/framework
src/Util/Crypto.php
Crypto.decryptWithPassword
public static function decryptWithPassword( string $cipherText, string $password, string $ad = '', string $format = null ): string { return self::decrypt($cipherText, $password, $ad, $format, true); }
php
public static function decryptWithPassword( string $cipherText, string $password, string $ad = '', string $format = null ): string { return self::decrypt($cipherText, $password, $ad, $format, true); }
[ "public", "static", "function", "decryptWithPassword", "(", "string", "$", "cipherText", ",", "string", "$", "password", ",", "string", "$", "ad", "=", "''", ",", "string", "$", "format", "=", "null", ")", ":", "string", "{", "return", "self", "::", "dec...
Decrypts a ciphertext to a string with a password, using a slow key derivation function to make password cracking more expensive. @param string $cipherText @param string $password @param string $ad @param string $format @throws CryptoException @return string
[ "Decrypts", "a", "ciphertext", "to", "a", "string", "with", "a", "password", "using", "a", "slow", "key", "derivation", "function", "to", "make", "password", "cracking", "more", "expensive", "." ]
d419e6c098d29ef9b62192b74050e51985b94f90
https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Util/Crypto.php#L396-L403
35,586
hail-framework/framework
src/Util/Crypto.php
Crypto.deriveKeys
private static function deriveKeys(string $key, string $salt, bool $password = false) { if ($password) { $preHash = \hash(self::HASH_TYPE, $key, true); $key = self::pbkdf2( self::HASH_TYPE, $preHash, $salt, self::PBKDF2_...
php
private static function deriveKeys(string $key, string $salt, bool $password = false) { if ($password) { $preHash = \hash(self::HASH_TYPE, $key, true); $key = self::pbkdf2( self::HASH_TYPE, $preHash, $salt, self::PBKDF2_...
[ "private", "static", "function", "deriveKeys", "(", "string", "$", "key", ",", "string", "$", "salt", ",", "bool", "$", "password", "=", "false", ")", "{", "if", "(", "$", "password", ")", "{", "$", "preHash", "=", "\\", "hash", "(", "self", "::", ...
Derives authentication and encryption keys from the secret, using a slow key derivation function if the secret is a password. @param string $key @param string $salt @param bool $password @throws CryptoException @return array
[ "Derives", "authentication", "and", "encryption", "keys", "from", "the", "secret", "using", "a", "slow", "key", "derivation", "function", "if", "the", "secret", "is", "a", "password", "." ]
d419e6c098d29ef9b62192b74050e51985b94f90
https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Util/Crypto.php#L425-L456
35,587
hail-framework/framework
src/Util/Crypto.php
Crypto.pbkdf2
public static function pbkdf2( string $algorithm, string $password, string $salt, int $count, int $length, bool $raw = false ) { $algorithm = \strtolower($algorithm); // Whitelist, or we could end up with people using CRC32. if (!isset(self::$h...
php
public static function pbkdf2( string $algorithm, string $password, string $salt, int $count, int $length, bool $raw = false ) { $algorithm = \strtolower($algorithm); // Whitelist, or we could end up with people using CRC32. if (!isset(self::$h...
[ "public", "static", "function", "pbkdf2", "(", "string", "$", "algorithm", ",", "string", "$", "password", ",", "string", "$", "salt", ",", "int", "$", "count", ",", "int", "$", "length", ",", "bool", "$", "raw", "=", "false", ")", "{", "$", "algorit...
Computes the PBKDF2 password-based key derivation function. The PBKDF2 function is defined in RFC 2898. Test vectors can be found in RFC 6070. This implementation of PBKDF2 was originally created by Taylor Hornby, with improvements from http://www.variations-of-shadow.com/. @param string $algorithm The hash algorithm...
[ "Computes", "the", "PBKDF2", "password", "-", "based", "key", "derivation", "function", "." ]
d419e6c098d29ef9b62192b74050e51985b94f90
https://github.com/hail-framework/framework/blob/d419e6c098d29ef9b62192b74050e51985b94f90/src/Util/Crypto.php#L581-L605
35,588
hiqdev/hipanel-module-server
src/models/Consumption.php
Consumption.getTypeLabel
public function getTypeLabel(): string { $provider = Yii::createObject(BillTypesProvider::class); $types = ArrayHelper::index($provider->getTypes(), 'name'); if (!isset($types[$this->type])) { return '--'; } return $types[$this->type]->label; }
php
public function getTypeLabel(): string { $provider = Yii::createObject(BillTypesProvider::class); $types = ArrayHelper::index($provider->getTypes(), 'name'); if (!isset($types[$this->type])) { return '--'; } return $types[$this->type]->label; }
[ "public", "function", "getTypeLabel", "(", ")", ":", "string", "{", "$", "provider", "=", "Yii", "::", "createObject", "(", "BillTypesProvider", "::", "class", ")", ";", "$", "types", "=", "ArrayHelper", "::", "index", "(", "$", "provider", "->", "getTypes...
Get type label. @throws \yii\base\InvalidConfigException @return string
[ "Get", "type", "label", "." ]
e40c3601952cf1fd420ebb97093ee17a33ff3207
https://github.com/hiqdev/hipanel-module-server/blob/e40c3601952cf1fd420ebb97093ee17a33ff3207/src/models/Consumption.php#L51-L60
35,589
byjg/webrequest
src/WebRequest.php
WebRequest.setCredentials
public function setCredentials($username, $password) { $this->setCurlOption(CURLOPT_HTTPAUTH, CURLAUTH_BASIC); $this->setCurlOption(CURLOPT_USERPWD, $username . ":" . $password); }
php
public function setCredentials($username, $password) { $this->setCurlOption(CURLOPT_HTTPAUTH, CURLAUTH_BASIC); $this->setCurlOption(CURLOPT_USERPWD, $username . ":" . $password); }
[ "public", "function", "setCredentials", "(", "$", "username", ",", "$", "password", ")", "{", "$", "this", "->", "setCurlOption", "(", "CURLOPT_HTTPAUTH", ",", "CURLAUTH_BASIC", ")", ";", "$", "this", "->", "setCurlOption", "(", "CURLOPT_USERPWD", ",", "$", ...
Defines Basic credentials for access the service. @param string $username @param string $password
[ "Defines", "Basic", "credentials", "for", "access", "the", "service", "." ]
779045160a8ca88044ab41a00d30c4dc6201b619
https://github.com/byjg/webrequest/blob/779045160a8ca88044ab41a00d30c4dc6201b619/src/WebRequest.php#L53-L57
35,590
byjg/webrequest
src/WebRequest.php
WebRequest.setProxy
public function setProxy($url, $username = null, $password = "") { $this->setCurlOption(CURLOPT_PROXY, $url); if (!is_null($username)) { $this->setCurlOption(CURLOPT_PROXYUSERPWD, "$username:$password"); } }
php
public function setProxy($url, $username = null, $password = "") { $this->setCurlOption(CURLOPT_PROXY, $url); if (!is_null($username)) { $this->setCurlOption(CURLOPT_PROXYUSERPWD, "$username:$password"); } }
[ "public", "function", "setProxy", "(", "$", "url", ",", "$", "username", "=", "null", ",", "$", "password", "=", "\"\"", ")", "{", "$", "this", "->", "setCurlOption", "(", "CURLOPT_PROXY", ",", "$", "url", ")", ";", "if", "(", "!", "is_null", "(", ...
Setting the Proxy The full representation of the proxy is scheme://url:port, but the only required is the URL; Some examples: my.proxy.com my.proxy.com:1080 https://my.proxy.com:1080 socks4://my.proxysocks.com socks5://my.proxysocks.com @param string $url The Proxy URL in the format scheme://url:port @param string $...
[ "Setting", "the", "Proxy" ]
779045160a8ca88044ab41a00d30c4dc6201b619
https://github.com/byjg/webrequest/blob/779045160a8ca88044ab41a00d30c4dc6201b619/src/WebRequest.php#L193-L199
35,591
byjg/webrequest
src/WebRequest.php
WebRequest.soapCall
public function soapCall($method, $params = null, $soapOptions = null) { $soapParams = null; if (is_array($params)) { $soapParams = array(); foreach ($params as $key => $value) { $soapParams[] = new SoapParam($value, $key); } } ...
php
public function soapCall($method, $params = null, $soapOptions = null) { $soapParams = null; if (is_array($params)) { $soapParams = array(); foreach ($params as $key => $value) { $soapParams[] = new SoapParam($value, $key); } } ...
[ "public", "function", "soapCall", "(", "$", "method", ",", "$", "params", "=", "null", ",", "$", "soapOptions", "=", "null", ")", "{", "$", "soapParams", "=", "null", ";", "if", "(", "is_array", "(", "$", "params", ")", ")", "{", "$", "soapParams", ...
Call a Soap client. For example: $webreq = new WebRequest("http://www.byjg.com.br/webservice.php/ws/cep"); $result = $webreq->soapCall("obterCep", new array("cep", "11111233")); @param string $method @param array $params @param array $soapOptions @return string
[ "Call", "a", "Soap", "client", "." ]
779045160a8ca88044ab41a00d30c4dc6201b619
https://github.com/byjg/webrequest/blob/779045160a8ca88044ab41a00d30c4dc6201b619/src/WebRequest.php#L244-L270
35,592
byjg/webrequest
src/WebRequest.php
WebRequest.defaultCurlOptions
protected function defaultCurlOptions() { $this->curlOptions[CURLOPT_CONNECTTIMEOUT] = 30; $this->curlOptions[CURLOPT_TIMEOUT] = 30; $this->curlOptions[CURLOPT_HEADER] = true; $this->curlOptions[CURLOPT_RETURNTRANSFER] = true; $this->curlOptions[CURLOPT_USERAGENT] = "Mozilla/...
php
protected function defaultCurlOptions() { $this->curlOptions[CURLOPT_CONNECTTIMEOUT] = 30; $this->curlOptions[CURLOPT_TIMEOUT] = 30; $this->curlOptions[CURLOPT_HEADER] = true; $this->curlOptions[CURLOPT_RETURNTRANSFER] = true; $this->curlOptions[CURLOPT_USERAGENT] = "Mozilla/...
[ "protected", "function", "defaultCurlOptions", "(", ")", "{", "$", "this", "->", "curlOptions", "[", "CURLOPT_CONNECTTIMEOUT", "]", "=", "30", ";", "$", "this", "->", "curlOptions", "[", "CURLOPT_TIMEOUT", "]", "=", "30", ";", "$", "this", "->", "curlOptions...
Set the default curl options. You can override this method to setup your own default options. You can pass the options to the constructor also;
[ "Set", "the", "default", "curl", "options", ".", "You", "can", "override", "this", "method", "to", "setup", "your", "own", "default", "options", ".", "You", "can", "pass", "the", "options", "to", "the", "constructor", "also", ";" ]
779045160a8ca88044ab41a00d30c4dc6201b619
https://github.com/byjg/webrequest/blob/779045160a8ca88044ab41a00d30c4dc6201b619/src/WebRequest.php#L277-L287
35,593
byjg/webrequest
src/WebRequest.php
WebRequest.setCurlOption
public function setCurlOption($key, $value) { if (!is_int($key)) { throw new InvalidArgumentException('It is not a CURL_OPT argument'); } if ($key == CURLOPT_HEADER || $key == CURLOPT_RETURNTRANSFER) { throw new InvalidArgumentException('You cannot change CURLOPT_HEAD...
php
public function setCurlOption($key, $value) { if (!is_int($key)) { throw new InvalidArgumentException('It is not a CURL_OPT argument'); } if ($key == CURLOPT_HEADER || $key == CURLOPT_RETURNTRANSFER) { throw new InvalidArgumentException('You cannot change CURLOPT_HEAD...
[ "public", "function", "setCurlOption", "(", "$", "key", ",", "$", "value", ")", "{", "if", "(", "!", "is_int", "(", "$", "key", ")", ")", "{", "throw", "new", "InvalidArgumentException", "(", "'It is not a CURL_OPT argument'", ")", ";", "}", "if", "(", "...
Set a custom CURL option @param int $key @param mixed $value @throws InvalidArgumentException
[ "Set", "a", "custom", "CURL", "option" ]
779045160a8ca88044ab41a00d30c4dc6201b619
https://github.com/byjg/webrequest/blob/779045160a8ca88044ab41a00d30c4dc6201b619/src/WebRequest.php#L296-L310
35,594
byjg/webrequest
src/WebRequest.php
WebRequest.getCurlOption
public function getCurlOption($key) { return (isset($this->curlOptions[$key]) ? $this->curlOptions[$key] : null); }
php
public function getCurlOption($key) { return (isset($this->curlOptions[$key]) ? $this->curlOptions[$key] : null); }
[ "public", "function", "getCurlOption", "(", "$", "key", ")", "{", "return", "(", "isset", "(", "$", "this", "->", "curlOptions", "[", "$", "key", "]", ")", "?", "$", "this", "->", "curlOptions", "[", "$", "key", "]", ":", "null", ")", ";", "}" ]
Get the current Curl option @param int $key @return mixed
[ "Get", "the", "current", "Curl", "option" ]
779045160a8ca88044ab41a00d30c4dc6201b619
https://github.com/byjg/webrequest/blob/779045160a8ca88044ab41a00d30c4dc6201b619/src/WebRequest.php#L318-L321
35,595
byjg/webrequest
src/WebRequest.php
WebRequest.curlInit
protected function curlInit() { $curlHandle = curl_init(); curl_setopt($curlHandle, CURLOPT_URL, $this->requestUrl); $this->requestUrl = $this->url; // Reset request URL // Set Curl Options foreach ($this->curlOptions as $key => $value) { curl_setopt($curlHandle,...
php
protected function curlInit() { $curlHandle = curl_init(); curl_setopt($curlHandle, CURLOPT_URL, $this->requestUrl); $this->requestUrl = $this->url; // Reset request URL // Set Curl Options foreach ($this->curlOptions as $key => $value) { curl_setopt($curlHandle,...
[ "protected", "function", "curlInit", "(", ")", "{", "$", "curlHandle", "=", "curl_init", "(", ")", ";", "curl_setopt", "(", "$", "curlHandle", ",", "CURLOPT_URL", ",", "$", "this", "->", "requestUrl", ")", ";", "$", "this", "->", "requestUrl", "=", "$", ...
Request the method using the CURLOPT defined previously; @return resource
[ "Request", "the", "method", "using", "the", "CURLOPT", "defined", "previously", ";" ]
779045160a8ca88044ab41a00d30c4dc6201b619
https://github.com/byjg/webrequest/blob/779045160a8ca88044ab41a00d30c4dc6201b619/src/WebRequest.php#L372-L398
35,596
byjg/webrequest
src/WebRequest.php
WebRequest.get
public function get($params = null) { $curlHandle = $this->prepareGet($params); return $this->curlGetResponse($curlHandle); }
php
public function get($params = null) { $curlHandle = $this->prepareGet($params); return $this->curlGetResponse($curlHandle); }
[ "public", "function", "get", "(", "$", "params", "=", "null", ")", "{", "$", "curlHandle", "=", "$", "this", "->", "prepareGet", "(", "$", "params", ")", ";", "return", "$", "this", "->", "curlGetResponse", "(", "$", "curlHandle", ")", ";", "}" ]
Make a REST Get method call @param array|null $params @return string @throws \ByJG\Util\CurlException
[ "Make", "a", "REST", "Get", "method", "call" ]
779045160a8ca88044ab41a00d30c4dc6201b619
https://github.com/byjg/webrequest/blob/779045160a8ca88044ab41a00d30c4dc6201b619/src/WebRequest.php#L488-L492
35,597
byjg/webrequest
src/WebRequest.php
WebRequest.put
public function put($params = null) { $handle = $this->preparePut($params); return $this->curlGetResponse($handle); }
php
public function put($params = null) { $handle = $this->preparePut($params); return $this->curlGetResponse($handle); }
[ "public", "function", "put", "(", "$", "params", "=", "null", ")", "{", "$", "handle", "=", "$", "this", "->", "preparePut", "(", "$", "params", ")", ";", "return", "$", "this", "->", "curlGetResponse", "(", "$", "handle", ")", ";", "}" ]
Make a REST PUT method call with parameters @param array|string $params @return string @throws \ByJG\Util\CurlException
[ "Make", "a", "REST", "PUT", "method", "call", "with", "parameters" ]
779045160a8ca88044ab41a00d30c4dc6201b619
https://github.com/byjg/webrequest/blob/779045160a8ca88044ab41a00d30c4dc6201b619/src/WebRequest.php#L614-L618
35,598
byjg/webrequest
src/WebRequest.php
WebRequest.delete
public function delete($params = null) { $handle = $this->prepareDelete($params); return $this->curlGetResponse($handle); }
php
public function delete($params = null) { $handle = $this->prepareDelete($params); return $this->curlGetResponse($handle); }
[ "public", "function", "delete", "(", "$", "params", "=", "null", ")", "{", "$", "handle", "=", "$", "this", "->", "prepareDelete", "(", "$", "params", ")", ";", "return", "$", "this", "->", "curlGetResponse", "(", "$", "handle", ")", ";", "}" ]
Make a REST DELETE method call with parameters @param array|string $params @return string @throws \ByJG\Util\CurlException
[ "Make", "a", "REST", "DELETE", "method", "call", "with", "parameters" ]
779045160a8ca88044ab41a00d30c4dc6201b619
https://github.com/byjg/webrequest/blob/779045160a8ca88044ab41a00d30c4dc6201b619/src/WebRequest.php#L652-L656
35,599
byjg/webrequest
src/WebRequest.php
WebRequest.deletePayload
public function deletePayload($data = null, $contentType = "text/plain") { $this->addRequestHeader("Content-Type", $contentType); return $this->delete($data); }
php
public function deletePayload($data = null, $contentType = "text/plain") { $this->addRequestHeader("Content-Type", $contentType); return $this->delete($data); }
[ "public", "function", "deletePayload", "(", "$", "data", "=", "null", ",", "$", "contentType", "=", "\"text/plain\"", ")", "{", "$", "this", "->", "addRequestHeader", "(", "\"Content-Type\"", ",", "$", "contentType", ")", ";", "return", "$", "this", "->", ...
Make a REST DELETE method call sending a payload @param string $data @param string $contentType @return string @throws \ByJG\Util\CurlException
[ "Make", "a", "REST", "DELETE", "method", "call", "sending", "a", "payload" ]
779045160a8ca88044ab41a00d30c4dc6201b619
https://github.com/byjg/webrequest/blob/779045160a8ca88044ab41a00d30c4dc6201b619/src/WebRequest.php#L666-L670