repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
baleen/cli
src/BaseCommand.php
BaseCommand.execute
protected function execute(InputInterface $input, OutputInterface $output) { /** @var MessageInterface $message */ $message = $this->getContainer()->get($this->serviceAlias); if (get_class($message) !== $this->serviceClass) { throw new InvalidArgumentException(sprintf( ...
php
protected function execute(InputInterface $input, OutputInterface $output) { /** @var MessageInterface $message */ $message = $this->getContainer()->get($this->serviceAlias); if (get_class($message) !== $this->serviceClass) { throw new InvalidArgumentException(sprintf( ...
[ "protected", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "/** @var MessageInterface $message */", "$", "message", "=", "$", "this", "->", "getContainer", "(", ")", "->", "get", "(", "$", "this", ...
Executes the current command by retrieving its associated Message from the Container, setting the Input and Output according to what was received as parameters, and finally passing that Message to the CommandBus for handling. @param InputInterface $input An InputInterface instance @param OutputInterface $output An Out...
[ "Executes", "the", "current", "command", "by", "retrieving", "its", "associated", "Message", "from", "the", "Container", "setting", "the", "Input", "and", "Output", "according", "to", "what", "was", "received", "as", "parameters", "and", "finally", "passing", "t...
train
https://github.com/baleen/cli/blob/2ecbc7179c5800c9075fd93204ef25da375536ed/src/BaseCommand.php#L124-L141
Wonail/wocenter
helpers/ArrayHelper.php
ArrayHelper.inArrayCase
public static function inArrayCase($key, $data, $validate_string = false, $inverse = false): bool { if (!is_array($data)) { $data = explode(',', $data); } foreach ($data as $k) { if (strcasecmp($key, $k) === 0) { return true; } ...
php
public static function inArrayCase($key, $data, $validate_string = false, $inverse = false): bool { if (!is_array($data)) { $data = explode(',', $data); } foreach ($data as $k) { if (strcasecmp($key, $k) === 0) { return true; } ...
[ "public", "static", "function", "inArrayCase", "(", "$", "key", ",", "$", "data", ",", "$", "validate_string", "=", "false", ",", "$", "inverse", "=", "false", ")", ":", "bool", "{", "if", "(", "!", "is_array", "(", "$", "data", ")", ")", "{", "$",...
不区分大小写的in_array实现 @param string $key 待查询的key @param mixed $data 被查询的数据 @param boolean $validate_string 是否验证包含字符串,默认不验证 @param boolean $inverse 参数反转,仅在$validate_string为true时生效。 当$inverse参数为true时,即在$key里查询$array里的值。 例如:ArrayHelper::inArrayCase('administrators', ['admin', 'guest], true, true)结果为true @return boolean
[ "不区分大小写的in_array实现" ]
train
https://github.com/Wonail/wocenter/blob/186c15aad008d32fbf5ad75256cf01581dccf9e6/helpers/ArrayHelper.php#L40-L56
Wonail/wocenter
helpers/ArrayHelper.php
ArrayHelper.dump
public static function dump($var, $echo = true, $label = null, $strict = true) { $label = ($label === null) ? '' : rtrim($label) . ' '; if (!$strict) { if (ini_get('html_errors')) { $output = print_r($var, true); $output = '<pre>' . $label . htmlspecialcha...
php
public static function dump($var, $echo = true, $label = null, $strict = true) { $label = ($label === null) ? '' : rtrim($label) . ' '; if (!$strict) { if (ini_get('html_errors')) { $output = print_r($var, true); $output = '<pre>' . $label . htmlspecialcha...
[ "public", "static", "function", "dump", "(", "$", "var", ",", "$", "echo", "=", "true", ",", "$", "label", "=", "null", ",", "$", "strict", "=", "true", ")", "{", "$", "label", "=", "(", "$", "label", "===", "null", ")", "?", "''", ":", "rtrim"...
浏览器友好的变量输出 @param mixed $var 变量 @param boolean $echo 是否输出,默认为`true`。如果为`false`,则返回输出字符串 @param string $label 标签,默认为空 @param boolean $strict 是否严谨,默认为`true` @return string|null
[ "浏览器友好的变量输出" ]
train
https://github.com/Wonail/wocenter/blob/186c15aad008d32fbf5ad75256cf01581dccf9e6/helpers/ArrayHelper.php#L68-L94
Wonail/wocenter
helpers/ArrayHelper.php
ArrayHelper.listToTree
public static function listToTree($list, $pk = 'id', $pid = 'parent_id', $child = '_child', $root = 0): array { // 创建Tree $tree = []; if (is_array($list)) { // 创建基于主键的数组引用 $refer = []; foreach ($list as $key => $data) { $refer[$data[$pk]] =...
php
public static function listToTree($list, $pk = 'id', $pid = 'parent_id', $child = '_child', $root = 0): array { // 创建Tree $tree = []; if (is_array($list)) { // 创建基于主键的数组引用 $refer = []; foreach ($list as $key => $data) { $refer[$data[$pk]] =...
[ "public", "static", "function", "listToTree", "(", "$", "list", ",", "$", "pk", "=", "'id'", ",", "$", "pid", "=", "'parent_id'", ",", "$", "child", "=", "'_child'", ",", "$", "root", "=", "0", ")", ":", "array", "{", "// 创建Tree", "$", "tree", "=",...
把返回的数据集转换成Tree @param array $list 要转换的数据集 @param string $pk 供pid索引的id字段 @param string $pid parent标记字段 @param string $child 子类标记字段 @param integer $root 顶级菜单数值,默认为`0`,表示显示到最顶级菜单 @return array
[ "把返回的数据集转换成Tree" ]
train
https://github.com/Wonail/wocenter/blob/186c15aad008d32fbf5ad75256cf01581dccf9e6/helpers/ArrayHelper.php#L107-L132
Wonail/wocenter
helpers/ArrayHelper.php
ArrayHelper.treeToList
public static function treeToList($tree, $child = '_child', $order = null, &$list = []): array { if (is_array($tree)) { foreach ($tree as $key => $value) { $refer = $value; if (isset($refer[$child])) { unset($refer[$child]); ...
php
public static function treeToList($tree, $child = '_child', $order = null, &$list = []): array { if (is_array($tree)) { foreach ($tree as $key => $value) { $refer = $value; if (isset($refer[$child])) { unset($refer[$child]); ...
[ "public", "static", "function", "treeToList", "(", "$", "tree", ",", "$", "child", "=", "'_child'", ",", "$", "order", "=", "null", ",", "&", "$", "list", "=", "[", "]", ")", ":", "array", "{", "if", "(", "is_array", "(", "$", "tree", ")", ")", ...
将listToTree的树还原成列表 @param array $tree 原来的树 @param string $child 孩子节点的键 @param string|null $order 排序显示的键,一般是主键 升序排列,默认为`null`,表示不排序 @param array $list 过渡用的中间数组, @return array 返回排过序的列表数组
[ "将listToTree的树还原成列表" ]
train
https://github.com/Wonail/wocenter/blob/186c15aad008d32fbf5ad75256cf01581dccf9e6/helpers/ArrayHelper.php#L144-L161
Wonail/wocenter
helpers/ArrayHelper.php
ArrayHelper.listSearch
public static function listSearch($list = [], $condition = '', $isUrl = false) { if (empty($list)) { return false; } if (is_string($condition)) { parse_str($condition, $condition); } // 返回的结果集合 $resultSet = []; foreach ($list a...
php
public static function listSearch($list = [], $condition = '', $isUrl = false) { if (empty($list)) { return false; } if (is_string($condition)) { parse_str($condition, $condition); } // 返回的结果集合 $resultSet = []; foreach ($list a...
[ "public", "static", "function", "listSearch", "(", "$", "list", "=", "[", "]", ",", "$", "condition", "=", "''", ",", "$", "isUrl", "=", "false", ")", "{", "if", "(", "empty", "(", "$", "list", ")", ")", "{", "return", "false", ";", "}", "if", ...
在数据列表中搜索 @param array $list 数据列表 @param mixed $condition 查询条件,支持数组、操作符 ['neq', 'eq', 'not in', 'in']、正则、字符串 1: ['name'=>$value] 2: 'name = value' 3: '/w+/'正则 4: ['name' => ['not in' => ['value1', 'value2']]] @param boolean $isUrl 是否是url地址,默认否。URL格式是'/account'时使用 @return array|boolean
[ "在数据列表中搜索" ]
train
https://github.com/Wonail/wocenter/blob/186c15aad008d32fbf5ad75256cf01581dccf9e6/helpers/ArrayHelper.php#L176-L236
Wonail/wocenter
helpers/ArrayHelper.php
ArrayHelper.listSortBy
public static function listSortBy($list, $field, $sortBy = 'asc'): array { if (is_array($list)) { $refer = $resultSet = []; foreach ($list as $i => $data) { $refer[$i] = &$data[$field]; } switch ($sortBy) { ...
php
public static function listSortBy($list, $field, $sortBy = 'asc'): array { if (is_array($list)) { $refer = $resultSet = []; foreach ($list as $i => $data) { $refer[$i] = &$data[$field]; } switch ($sortBy) { ...
[ "public", "static", "function", "listSortBy", "(", "$", "list", ",", "$", "field", ",", "$", "sortBy", "=", "'asc'", ")", ":", "array", "{", "if", "(", "is_array", "(", "$", "list", ")", ")", "{", "$", "refer", "=", "$", "resultSet", "=", "[", "]...
对查询结果集进行排序 @param array $list 查询结果 @param string $field 排序的字段名 @param string $sortBy 排序类型 asc正向排序 desc逆向排序 nat自然排序 @return array
[ "对查询结果集进行排序" ]
train
https://github.com/Wonail/wocenter/blob/186c15aad008d32fbf5ad75256cf01581dccf9e6/helpers/ArrayHelper.php#L248-L279
TypistTech/wp-option-store
src/OptionStore.php
OptionStore.get
public function get(string $optionName) { foreach ($this->strategies as $strategy) { $value = $strategy->get($optionName); if (null !== $value) { return $value; } } return null; }
php
public function get(string $optionName) { foreach ($this->strategies as $strategy) { $value = $strategy->get($optionName); if (null !== $value) { return $value; } } return null; }
[ "public", "function", "get", "(", "string", "$", "optionName", ")", "{", "foreach", "(", "$", "this", "->", "strategies", "as", "$", "strategy", ")", "{", "$", "value", "=", "$", "strategy", "->", "get", "(", "$", "optionName", ")", ";", "if", "(", ...
Get an option value. @param string $optionName Name of option to retrieve. @return mixed|null
[ "Get", "an", "option", "value", "." ]
train
https://github.com/TypistTech/wp-option-store/blob/115ff7cb4b5f566c89c1294fe2b68c82d62cccc2/src/OptionStore.php#L47-L58
TypistTech/wp-option-store
src/OptionStore.php
OptionStore.getBoolean
public function getBoolean(string $optionName): bool { return in_array( $this->get($optionName), self::TRUE_VALUES, true ); }
php
public function getBoolean(string $optionName): bool { return in_array( $this->get($optionName), self::TRUE_VALUES, true ); }
[ "public", "function", "getBoolean", "(", "string", "$", "optionName", ")", ":", "bool", "{", "return", "in_array", "(", "$", "this", "->", "get", "(", "$", "optionName", ")", ",", "self", "::", "TRUE_VALUES", ",", "true", ")", ";", "}" ]
Cast an option value into boolean. @param string $optionName Name of option to retrieve. @return bool
[ "Cast", "an", "option", "value", "into", "boolean", "." ]
train
https://github.com/TypistTech/wp-option-store/blob/115ff7cb4b5f566c89c1294fe2b68c82d62cccc2/src/OptionStore.php#L67-L74
gregorybesson/PlaygroundCore
src/Entity/Formgen.php
Formgen.populate
public function populate($data = array()) { if (isset($data['title']) && $data['title'] !== null) { $this->title = $data['title']; } if (isset($data['description']) && $data['description'] !== null) { $this->description = $data['description']; } if (is...
php
public function populate($data = array()) { if (isset($data['title']) && $data['title'] !== null) { $this->title = $data['title']; } if (isset($data['description']) && $data['description'] !== null) { $this->description = $data['description']; } if (is...
[ "public", "function", "populate", "(", "$", "data", "=", "array", "(", ")", ")", "{", "if", "(", "isset", "(", "$", "data", "[", "'title'", "]", ")", "&&", "$", "data", "[", "'title'", "]", "!==", "null", ")", "{", "$", "this", "->", "title", "...
Populate from an array. @param array $data
[ "Populate", "from", "an", "array", "." ]
train
https://github.com/gregorybesson/PlaygroundCore/blob/f8dfa4c7660b54354933b3c28c0cf35304a649df/src/Entity/Formgen.php#L255-L272
yoanm/php-jsonrpc-http-server-openapi-doc-sdk
src/App/Helper/ArrayAppendHelperTrait.php
ArrayAppendHelperTrait.appendIfValueHaveSiblings
protected function appendIfValueHaveSiblings(string $key, array $value, array $doc = []) : array { return $this->appendIf((count($value) > 0), $key, $value, $doc); }
php
protected function appendIfValueHaveSiblings(string $key, array $value, array $doc = []) : array { return $this->appendIf((count($value) > 0), $key, $value, $doc); }
[ "protected", "function", "appendIfValueHaveSiblings", "(", "string", "$", "key", ",", "array", "$", "value", ",", "array", "$", "doc", "=", "[", "]", ")", ":", "array", "{", "return", "$", "this", "->", "appendIf", "(", "(", "count", "(", "$", "value",...
@param string $key @param mixed $value @param array $doc @return array
[ "@param", "string", "$key", "@param", "mixed", "$value", "@param", "array", "$doc" ]
train
https://github.com/yoanm/php-jsonrpc-http-server-openapi-doc-sdk/blob/52d6bb5d0671e0363bbf482c3c75fef97d7d1d5e/src/App/Helper/ArrayAppendHelperTrait.php#L16-L19
yoanm/php-jsonrpc-http-server-openapi-doc-sdk
src/App/Helper/ArrayAppendHelperTrait.php
ArrayAppendHelperTrait.appendIfValueNotNull
protected function appendIfValueNotNull(string $key, $value, array $doc = []) : array { return $this->appendIf((null !== $value), $key, $value, $doc); }
php
protected function appendIfValueNotNull(string $key, $value, array $doc = []) : array { return $this->appendIf((null !== $value), $key, $value, $doc); }
[ "protected", "function", "appendIfValueNotNull", "(", "string", "$", "key", ",", "$", "value", ",", "array", "$", "doc", "=", "[", "]", ")", ":", "array", "{", "return", "$", "this", "->", "appendIf", "(", "(", "null", "!==", "$", "value", ")", ",", ...
@param string $key @param mixed $value @param array $doc @return array
[ "@param", "string", "$key", "@param", "mixed", "$value", "@param", "array", "$doc" ]
train
https://github.com/yoanm/php-jsonrpc-http-server-openapi-doc-sdk/blob/52d6bb5d0671e0363bbf482c3c75fef97d7d1d5e/src/App/Helper/ArrayAppendHelperTrait.php#L28-L31
yoanm/php-jsonrpc-http-server-openapi-doc-sdk
src/App/Helper/ArrayAppendHelperTrait.php
ArrayAppendHelperTrait.appendIf
protected function appendIf(bool $doAppend, string $key, $value, array $doc = []) : array { if (true === $doAppend) { $doc[$key] = $value; } return $doc; }
php
protected function appendIf(bool $doAppend, string $key, $value, array $doc = []) : array { if (true === $doAppend) { $doc[$key] = $value; } return $doc; }
[ "protected", "function", "appendIf", "(", "bool", "$", "doAppend", ",", "string", "$", "key", ",", "$", "value", ",", "array", "$", "doc", "=", "[", "]", ")", ":", "array", "{", "if", "(", "true", "===", "$", "doAppend", ")", "{", "$", "doc", "["...
@param bool $doAppend @param string $key @param mixed $value @param array $doc @return array
[ "@param", "bool", "$doAppend", "@param", "string", "$key", "@param", "mixed", "$value", "@param", "array", "$doc" ]
train
https://github.com/yoanm/php-jsonrpc-http-server-openapi-doc-sdk/blob/52d6bb5d0671e0363bbf482c3c75fef97d7d1d5e/src/App/Helper/ArrayAppendHelperTrait.php#L41-L48
chippyash/Math-Type-Calculator
src/Chippyash/Math/Type/Calculator.php
Calculator.add
public function add($a, $b) { $a = $this->convert($a); $b = $this->convert($b); switch ($this->arbitrate($a, $b)) { case 'int': return $this->calcEngine->intAdd($a, $b); case 'float': return $this->calcEngine->floatAdd($a, $b); ...
php
public function add($a, $b) { $a = $this->convert($a); $b = $this->convert($b); switch ($this->arbitrate($a, $b)) { case 'int': return $this->calcEngine->intAdd($a, $b); case 'float': return $this->calcEngine->floatAdd($a, $b); ...
[ "public", "function", "add", "(", "$", "a", ",", "$", "b", ")", "{", "$", "a", "=", "$", "this", "->", "convert", "(", "$", "a", ")", ";", "$", "b", "=", "$", "this", "->", "convert", "(", "$", "b", ")", ";", "switch", "(", "$", "this", "...
Return addition of two types: a + b @param int|float|NumericTypeInterface $a first operand @param int|float|NumericTypeInterface $b second operand @return NumericTypeInterface @noinspection PhpInconsistentReturnPointsInspection
[ "Return", "addition", "of", "two", "types", ":", "a", "+", "b" ]
train
https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Calculator.php#L83-L106
chippyash/Math-Type-Calculator
src/Chippyash/Math/Type/Calculator.php
Calculator.sub
public function sub($a, $b) { $a = $this->convert($a); $b = $this->convert($b); switch ($this->arbitrate($a, $b)) { case 'int': return $this->calcEngine->intSub($a, $b); case 'float': return $this->calcEngine->floatSub($a, $b); ...
php
public function sub($a, $b) { $a = $this->convert($a); $b = $this->convert($b); switch ($this->arbitrate($a, $b)) { case 'int': return $this->calcEngine->intSub($a, $b); case 'float': return $this->calcEngine->floatSub($a, $b); ...
[ "public", "function", "sub", "(", "$", "a", ",", "$", "b", ")", "{", "$", "a", "=", "$", "this", "->", "convert", "(", "$", "a", ")", ";", "$", "b", "=", "$", "this", "->", "convert", "(", "$", "b", ")", ";", "switch", "(", "$", "this", "...
Return subtraction of two types: a - b @param int|float|NumericTypeInterface $a first operand @param int|float|NumericTypeInterface $b second operand @return NumericTypeInterface @noinspection PhpInconsistentReturnPointsInspection
[ "Return", "subtraction", "of", "two", "types", ":", "a", "-", "b" ]
train
https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Calculator.php#L118-L140
chippyash/Math-Type-Calculator
src/Chippyash/Math/Type/Calculator.php
Calculator.mul
public function mul($a, $b) { $a = $this->convert($a); $b = $this->convert($b); switch ($this->arbitrate($a, $b)) { case 'int': return $this->calcEngine->intMul($a, $b); case 'float': return $this->calcEngine->floatMul($a, $b); ...
php
public function mul($a, $b) { $a = $this->convert($a); $b = $this->convert($b); switch ($this->arbitrate($a, $b)) { case 'int': return $this->calcEngine->intMul($a, $b); case 'float': return $this->calcEngine->floatMul($a, $b); ...
[ "public", "function", "mul", "(", "$", "a", ",", "$", "b", ")", "{", "$", "a", "=", "$", "this", "->", "convert", "(", "$", "a", ")", ";", "$", "b", "=", "$", "this", "->", "convert", "(", "$", "b", ")", ";", "switch", "(", "$", "this", "...
Return multiplication of two types: a * b @param int|float|NumericTypeInterface $a first operand @param int|float|NumericTypeInterface $b second operand @return NumericTypeInterface @noinspection PhpInconsistentReturnPointsInspection
[ "Return", "multiplication", "of", "two", "types", ":", "a", "*", "b" ]
train
https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Calculator.php#L152-L174
chippyash/Math-Type-Calculator
src/Chippyash/Math/Type/Calculator.php
Calculator.div
public function div($a, $b) { $a = $this->convert($a); $b = $this->convert($b); switch ($this->arbitrate($a, $b)) { case 'int': case 'whole': case 'natural': return $this->calcEngine->intDiv($a, $b); case 'rational': ...
php
public function div($a, $b) { $a = $this->convert($a); $b = $this->convert($b); switch ($this->arbitrate($a, $b)) { case 'int': case 'whole': case 'natural': return $this->calcEngine->intDiv($a, $b); case 'rational': ...
[ "public", "function", "div", "(", "$", "a", ",", "$", "b", ")", "{", "$", "a", "=", "$", "this", "->", "convert", "(", "$", "a", ")", ";", "$", "b", "=", "$", "this", "->", "convert", "(", "$", "b", ")", ";", "switch", "(", "$", "this", "...
Return division of two types: a / b @param int|float|NumericTypeInterface $a first operand @param int|float|NumericTypeInterface $b second operand @return NumericTypeInterface
[ "Return", "division", "of", "two", "types", ":", "a", "/", "b" ]
train
https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Calculator.php#L184-L204
chippyash/Math-Type-Calculator
src/Chippyash/Math/Type/Calculator.php
Calculator.reciprocal
public function reciprocal($a) { $a = $this->convert($a); switch ($this->arbitrate($a, $a)) { case 'rational': return $this->calcEngine->rationalReciprocal($a); case 'complex': return $this->calcEngine->complexReciprocal($a); defaul...
php
public function reciprocal($a) { $a = $this->convert($a); switch ($this->arbitrate($a, $a)) { case 'rational': return $this->calcEngine->rationalReciprocal($a); case 'complex': return $this->calcEngine->complexReciprocal($a); defaul...
[ "public", "function", "reciprocal", "(", "$", "a", ")", "{", "$", "a", "=", "$", "this", "->", "convert", "(", "$", "a", ")", ";", "switch", "(", "$", "this", "->", "arbitrate", "(", "$", "a", ",", "$", "a", ")", ")", "{", "case", "'rational'",...
Return reciprocal of the type: 1/a @param int|float|NumericTypeInterface $a @return NumericTypeInterface
[ "Return", "reciprocal", "of", "the", "type", ":", "1", "/", "a" ]
train
https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Calculator.php#L212-L223
chippyash/Math-Type-Calculator
src/Chippyash/Math/Type/Calculator.php
Calculator.convert
protected function convert($num) { if ($num instanceof NumericTypeInterface) { return $num; } if (is_numeric($num)) { return $this->calcEngine->convertNumeric($num); } $type = (is_object($num) ? get_class($num) : gettype($num)); throw new \Bad...
php
protected function convert($num) { if ($num instanceof NumericTypeInterface) { return $num; } if (is_numeric($num)) { return $this->calcEngine->convertNumeric($num); } $type = (is_object($num) ? get_class($num) : gettype($num)); throw new \Bad...
[ "protected", "function", "convert", "(", "$", "num", ")", "{", "if", "(", "$", "num", "instanceof", "NumericTypeInterface", ")", "{", "return", "$", "num", ";", "}", "if", "(", "is_numeric", "(", "$", "num", ")", ")", "{", "return", "$", "this", "->"...
Convert into Strong Numeric Type @param int|float|NumericTypeInterface $num operand @return \Chippyash\Type\Number\IntType
[ "Convert", "into", "Strong", "Numeric", "Type" ]
train
https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Calculator.php#L277-L288
verschoof/bunq-api
src/Resource/CardResource.php
CardResource.getCard
public function getCard($userId, $cardId) { $card = $this->client->get($this->getResourceEndpoint($userId) . '/' . (int)$cardId); return $card['Response'][0]; }
php
public function getCard($userId, $cardId) { $card = $this->client->get($this->getResourceEndpoint($userId) . '/' . (int)$cardId); return $card['Response'][0]; }
[ "public", "function", "getCard", "(", "$", "userId", ",", "$", "cardId", ")", "{", "$", "card", "=", "$", "this", "->", "client", "->", "get", "(", "$", "this", "->", "getResourceEndpoint", "(", "$", "userId", ")", ".", "'/'", ".", "(", "int", ")",...
Gets a user its card information. @param integer $userId @param integer $cardId @return array
[ "Gets", "a", "user", "its", "card", "information", "." ]
train
https://github.com/verschoof/bunq-api/blob/df9aa19f384275f4f0deb26de0cb5e5f8b45ffcd/src/Resource/CardResource.php#L42-L47
movoin/one-swoole
src/Validation/Validators/LengthValidator.php
LengthValidator.validate
protected function validate(array $attributes, string $name, array $parameters): bool { if (! isset($parameters['is']) && ! isset($parameters['min']) && ! isset($parameters['max']) ) { throw new ValidationException('长度限制条件必须填写'); } $len = mb_strle...
php
protected function validate(array $attributes, string $name, array $parameters): bool { if (! isset($parameters['is']) && ! isset($parameters['min']) && ! isset($parameters['max']) ) { throw new ValidationException('长度限制条件必须填写'); } $len = mb_strle...
[ "protected", "function", "validate", "(", "array", "$", "attributes", ",", "string", "$", "name", ",", "array", "$", "parameters", ")", ":", "bool", "{", "if", "(", "!", "isset", "(", "$", "parameters", "[", "'is'", "]", ")", "&&", "!", "isset", "(",...
校验规则 @param array $attributes @param string $name @param array $parameters @return bool @throws \One\Validation\Exceptions\ValidationException
[ "校验规则" ]
train
https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Validation/Validators/LengthValidator.php#L29-L63
blast-project/CoreBundle
src/Doctrine/ORM/CascadingRelationChecker.php
CascadingRelationChecker.beforeEntityDelete
public function beforeEntityDelete($entity, &$idx) { $this->undeleteReasons = []; $entityMetadata = $this->em->getClassMetadata(get_class($entity)); $associations = $entityMetadata->getAssociationMappings(); foreach ($associations as $association) { if (in_array('remov...
php
public function beforeEntityDelete($entity, &$idx) { $this->undeleteReasons = []; $entityMetadata = $this->em->getClassMetadata(get_class($entity)); $associations = $entityMetadata->getAssociationMappings(); foreach ($associations as $association) { if (in_array('remov...
[ "public", "function", "beforeEntityDelete", "(", "$", "entity", ",", "&", "$", "idx", ")", "{", "$", "this", "->", "undeleteReasons", "=", "[", "]", ";", "$", "entityMetadata", "=", "$", "this", "->", "em", "->", "getClassMetadata", "(", "get_class", "("...
Hande entity relations before trying to remove it. @param mixed $entity a Doctrine entity object @param array $idx list of entity ids to be removed @return
[ "Hande", "entity", "relations", "before", "trying", "to", "remove", "it", "." ]
train
https://github.com/blast-project/CoreBundle/blob/7a0832758ca14e5bc5d65515532c1220df3930ae/src/Doctrine/ORM/CascadingRelationChecker.php#L40-L70
vespolina/VespolinaCommerceBundle
Provider/OrderProvider.php
OrderProvider.getOpenOrder
public function getOpenOrder($orderId = null, PartnerInterface $owner = null, $orderType = 'default') { $order = null; // check for a valid open order by id if ($orderId) { $order = $this->orderManager->findOrderById($orderId); if ($this->orderManager->isValidOpenOrde...
php
public function getOpenOrder($orderId = null, PartnerInterface $owner = null, $orderType = 'default') { $order = null; // check for a valid open order by id if ($orderId) { $order = $this->orderManager->findOrderById($orderId); if ($this->orderManager->isValidOpenOrde...
[ "public", "function", "getOpenOrder", "(", "$", "orderId", "=", "null", ",", "PartnerInterface", "$", "owner", "=", "null", ",", "$", "orderType", "=", "'default'", ")", "{", "$", "order", "=", "null", ";", "// check for a valid open order by id", "if", "(", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/vespolina/VespolinaCommerceBundle/blob/0644dd2c0fb39637a0a6c2838b02e17bc480bdbc/Provider/OrderProvider.php#L36-L78
datasift/datasift-php
examples/push/env.php
Env.displaySubscriptionDetails
public function displaySubscriptionDetails($sub) { echo 'ID: '.$sub->getId().PHP_EOL; echo 'Name: '.$sub->getName().PHP_EOL; echo 'Status: '.$sub->getStatus().PHP_EOL; echo 'Created at: '.(is_null($sub->getCreatedAt()) ? 'null' : date('r', $sub->getCreatedAt())).PHP_EOL; echo 'L...
php
public function displaySubscriptionDetails($sub) { echo 'ID: '.$sub->getId().PHP_EOL; echo 'Name: '.$sub->getName().PHP_EOL; echo 'Status: '.$sub->getStatus().PHP_EOL; echo 'Created at: '.(is_null($sub->getCreatedAt()) ? 'null' : date('r', $sub->getCreatedAt())).PHP_EOL; echo 'L...
[ "public", "function", "displaySubscriptionDetails", "(", "$", "sub", ")", "{", "echo", "'ID: '", ".", "$", "sub", "->", "getId", "(", ")", ".", "PHP_EOL", ";", "echo", "'Name: '", ".", "$", "sub", "->", "getName", "(", ")", ".", "PHP_EO...
Displays details of a Historics query. @param DataSift_Push_Subscription $sub A DataSift Push Subscription object
[ "Displays", "details", "of", "a", "Historics", "query", "." ]
train
https://github.com/datasift/datasift-php/blob/35282461ad3e54880e5940bb5afce26c75dc4bb9/examples/push/env.php#L74-L88
jenky/laravel-api-helper
src/Handler.php
Handler.getSupportedParams
protected function getSupportedParams($method) { $columns = []; if ($this->isEloquentBuilder()) { $model = $this->getHandler()->getModel(); $columns = in_array(ApiHelper::class, class_uses($model)) ? $model->$method() : $model->getFillable(); ...
php
protected function getSupportedParams($method) { $columns = []; if ($this->isEloquentBuilder()) { $model = $this->getHandler()->getModel(); $columns = in_array(ApiHelper::class, class_uses($model)) ? $model->$method() : $model->getFillable(); ...
[ "protected", "function", "getSupportedParams", "(", "$", "method", ")", "{", "$", "columns", "=", "[", "]", ";", "if", "(", "$", "this", "->", "isEloquentBuilder", "(", ")", ")", "{", "$", "model", "=", "$", "this", "->", "getHandler", "(", ")", "->"...
Get supported params. @param string $method @return array
[ "Get", "supported", "params", "." ]
train
https://github.com/jenky/laravel-api-helper/blob/9af8f4d99d96ed3ea1bee7eabcdb0472f1bfa367/src/Handler.php#L126-L138
jenky/laravel-api-helper
src/Handler.php
Handler.parse
protected function parse() { $this->parseParam('sort'); $this->parseParam('fields'); $this->parseParam('limit'); if ($this->isEloquentBuilder()) { $this->parseParam('with'); } $this->parseFilter(); }
php
protected function parse() { $this->parseParam('sort'); $this->parseParam('fields'); $this->parseParam('limit'); if ($this->isEloquentBuilder()) { $this->parseParam('with'); } $this->parseFilter(); }
[ "protected", "function", "parse", "(", ")", "{", "$", "this", "->", "parseParam", "(", "'sort'", ")", ";", "$", "this", "->", "parseParam", "(", "'fields'", ")", ";", "$", "this", "->", "parseParam", "(", "'limit'", ")", ";", "if", "(", "$", "this", ...
Parse the data from the request. @return void
[ "Parse", "the", "data", "from", "the", "request", "." ]
train
https://github.com/jenky/laravel-api-helper/blob/9af8f4d99d96ed3ea1bee7eabcdb0472f1bfa367/src/Handler.php#L175-L184
jenky/laravel-api-helper
src/Handler.php
Handler.parseParam
protected function parseParam($param) { $method = 'parse'.ucfirst($param); if (method_exists($this, $method)) { if ($params = $this->input($param)) { return $this->$method($params); } } }
php
protected function parseParam($param) { $method = 'parse'.ucfirst($param); if (method_exists($this, $method)) { if ($params = $this->input($param)) { return $this->$method($params); } } }
[ "protected", "function", "parseParam", "(", "$", "param", ")", "{", "$", "method", "=", "'parse'", ".", "ucfirst", "(", "$", "param", ")", ";", "if", "(", "method_exists", "(", "$", "this", ",", "$", "method", ")", ")", "{", "if", "(", "$", "params...
Parse the special param. @param string $param @return void
[ "Parse", "the", "special", "param", "." ]
train
https://github.com/jenky/laravel-api-helper/blob/9af8f4d99d96ed3ea1bee7eabcdb0472f1bfa367/src/Handler.php#L192-L201
jenky/laravel-api-helper
src/Handler.php
Handler.parseSort
protected function parseSort($params) { foreach (explode(',', $params) as $sort) { // Check if ascending or descending(-) sort if (preg_match('/^-.+/', $sort)) { $direction = 'desc'; } else { $direction = 'asc'; } $...
php
protected function parseSort($params) { foreach (explode(',', $params) as $sort) { // Check if ascending or descending(-) sort if (preg_match('/^-.+/', $sort)) { $direction = 'desc'; } else { $direction = 'asc'; } $...
[ "protected", "function", "parseSort", "(", "$", "params", ")", "{", "foreach", "(", "explode", "(", "','", ",", "$", "params", ")", "as", "$", "sort", ")", "{", "// Check if ascending or descending(-) sort", "if", "(", "preg_match", "(", "'/^-.+/'", ",", "$"...
Parse the sort parameter. @param string $params @return void
[ "Parse", "the", "sort", "parameter", "." ]
train
https://github.com/jenky/laravel-api-helper/blob/9af8f4d99d96ed3ea1bee7eabcdb0472f1bfa367/src/Handler.php#L209-L231
jenky/laravel-api-helper
src/Handler.php
Handler.parseFields
protected function parseFields($params) { foreach (explode(',', $params) as $field) { // Only add the fields that are on the base resource if (! Str::contains($field, '.')) { $this->fields[] = trim($field); } else { $this->additionalFields[...
php
protected function parseFields($params) { foreach (explode(',', $params) as $field) { // Only add the fields that are on the base resource if (! Str::contains($field, '.')) { $this->fields[] = trim($field); } else { $this->additionalFields[...
[ "protected", "function", "parseFields", "(", "$", "params", ")", "{", "foreach", "(", "explode", "(", "','", ",", "$", "params", ")", "as", "$", "field", ")", "{", "// Only add the fields that are on the base resource", "if", "(", "!", "Str", "::", "contains",...
Parse the fields parameter. @param string $params @return void
[ "Parse", "the", "fields", "parameter", "." ]
train
https://github.com/jenky/laravel-api-helper/blob/9af8f4d99d96ed3ea1bee7eabcdb0472f1bfa367/src/Handler.php#L239-L249
jenky/laravel-api-helper
src/Handler.php
Handler.parseWith
protected function parseWith($params) { $with = explode(',', $params); $withable = $this->getSupportedParams('getApiWithable'); $with = in_array('*', $withable) ? $with : array_only($with, $withable); foreach ($this->additionalSorts as $sort => $direction) { $parts = ex...
php
protected function parseWith($params) { $with = explode(',', $params); $withable = $this->getSupportedParams('getApiWithable'); $with = in_array('*', $withable) ? $with : array_only($with, $withable); foreach ($this->additionalSorts as $sort => $direction) { $parts = ex...
[ "protected", "function", "parseWith", "(", "$", "params", ")", "{", "$", "with", "=", "explode", "(", "','", ",", "$", "params", ")", ";", "$", "withable", "=", "$", "this", "->", "getSupportedParams", "(", "'getApiWithable'", ")", ";", "$", "with", "=...
Parse the with parameter. @param string $params @return void
[ "Parse", "the", "with", "parameter", "." ]
train
https://github.com/jenky/laravel-api-helper/blob/9af8f4d99d96ed3ea1bee7eabcdb0472f1bfa367/src/Handler.php#L268-L296
jenky/laravel-api-helper
src/Handler.php
Handler.parseFilter
protected function parseFilter() { if (! $params = $this->getParams()) { return; } foreach ($params as $key => $value) { if ($this->isEloquentBuilder() && Str::contains($key, '~')) { $this->filterRelation($key, $value); } else { ...
php
protected function parseFilter() { if (! $params = $this->getParams()) { return; } foreach ($params as $key => $value) { if ($this->isEloquentBuilder() && Str::contains($key, '~')) { $this->filterRelation($key, $value); } else { ...
[ "protected", "function", "parseFilter", "(", ")", "{", "if", "(", "!", "$", "params", "=", "$", "this", "->", "getParams", "(", ")", ")", "{", "return", ";", "}", "foreach", "(", "$", "params", "as", "$", "key", "=>", "$", "value", ")", "{", "if"...
Parse all the paramenters for query builder. @return void
[ "Parse", "all", "the", "paramenters", "for", "query", "builder", "." ]
train
https://github.com/jenky/laravel-api-helper/blob/9af8f4d99d96ed3ea1bee7eabcdb0472f1bfa367/src/Handler.php#L303-L316
jenky/laravel-api-helper
src/Handler.php
Handler.formatParam
protected function formatParam($key, $value) { $supportedFixes = [ 'lt' => '<', 'gt' => '>', 'lte' => '<=', 'gte' => '>=', 'lk' => 'LIKE', 'not-lk' => 'NOT LIKE', 'in' => 'IN', 'not-in' => '...
php
protected function formatParam($key, $value) { $supportedFixes = [ 'lt' => '<', 'gt' => '>', 'lte' => '<=', 'gte' => '>=', 'lk' => 'LIKE', 'not-lk' => 'NOT LIKE', 'in' => 'IN', 'not-in' => '...
[ "protected", "function", "formatParam", "(", "$", "key", ",", "$", "value", ")", "{", "$", "supportedFixes", "=", "[", "'lt'", "=>", "'<'", ",", "'gt'", "=>", "'>'", ",", "'lte'", "=>", "'<='", ",", "'gte'", "=>", "'>='", ",", "'lk'", "=>", "'LIKE'",...
Format the paramenter for query builder. @param string $key @param string $value @return array
[ "Format", "the", "paramenter", "for", "query", "builder", "." ]
train
https://github.com/jenky/laravel-api-helper/blob/9af8f4d99d96ed3ea1bee7eabcdb0472f1bfa367/src/Handler.php#L325-L367
jenky/laravel-api-helper
src/Handler.php
Handler.filter
protected function filter($key, $value) { extract($this->formatParam($key, $value)); if (! $this->canFilter($column)) { return; } if ($comparator == 'IN') { $values = explode(',', $value); $this->getHandler()->whereIn($column, $values); }...
php
protected function filter($key, $value) { extract($this->formatParam($key, $value)); if (! $this->canFilter($column)) { return; } if ($comparator == 'IN') { $values = explode(',', $value); $this->getHandler()->whereIn($column, $values); }...
[ "protected", "function", "filter", "(", "$", "key", ",", "$", "value", ")", "{", "extract", "(", "$", "this", "->", "formatParam", "(", "$", "key", ",", "$", "value", ")", ")", ";", "if", "(", "!", "$", "this", "->", "canFilter", "(", "$", "colum...
Apply the filter to query builder. @param string $key @param string $value @return void
[ "Apply", "the", "filter", "to", "query", "builder", "." ]
train
https://github.com/jenky/laravel-api-helper/blob/9af8f4d99d96ed3ea1bee7eabcdb0472f1bfa367/src/Handler.php#L376-L418
jenky/laravel-api-helper
src/Handler.php
Handler.filterRelation
protected function filterRelation($key, $value) { $key = str_replace('~', '.', $key); $parts = explode('.', $key); $realKey = array_pop($parts); $relation = implode('.', $parts); if (! in_array($relation, array_keys($this->with))) { return; } ex...
php
protected function filterRelation($key, $value) { $key = str_replace('~', '.', $key); $parts = explode('.', $key); $realKey = array_pop($parts); $relation = implode('.', $parts); if (! in_array($relation, array_keys($this->with))) { return; } ex...
[ "protected", "function", "filterRelation", "(", "$", "key", ",", "$", "value", ")", "{", "$", "key", "=", "str_replace", "(", "'~'", ",", "'.'", ",", "$", "key", ")", ";", "$", "parts", "=", "explode", "(", "'.'", ",", "$", "key", ")", ";", "$", ...
Apply the filter to relationship query builder. @param string $key @param string $value @return void
[ "Apply", "the", "filter", "to", "relationship", "query", "builder", "." ]
train
https://github.com/jenky/laravel-api-helper/blob/9af8f4d99d96ed3ea1bee7eabcdb0472f1bfa367/src/Handler.php#L427-L481
jenky/laravel-api-helper
src/Handler.php
Handler.getParams
protected function getParams() { $reserved = [ $this->config('prefix', '').'sort', $this->config('prefix', '').'fields', $this->config('prefix', '').'limit', $this->config('prefix', '').'with', $this->config('prefix', '').'page', ]; ...
php
protected function getParams() { $reserved = [ $this->config('prefix', '').'sort', $this->config('prefix', '').'fields', $this->config('prefix', '').'limit', $this->config('prefix', '').'with', $this->config('prefix', '').'page', ]; ...
[ "protected", "function", "getParams", "(", ")", "{", "$", "reserved", "=", "[", "$", "this", "->", "config", "(", "'prefix'", ",", "''", ")", ".", "'sort'", ",", "$", "this", "->", "config", "(", "'prefix'", ",", "''", ")", ".", "'fields'", ",", "$...
Get the params from the request. @return array
[ "Get", "the", "params", "from", "the", "request", "." ]
train
https://github.com/jenky/laravel-api-helper/blob/9af8f4d99d96ed3ea1bee7eabcdb0472f1bfa367/src/Handler.php#L530-L541
jenky/laravel-api-helper
src/Handler.php
Handler.find
public function find($id, $columns = ['*']) { $this->parse(); return $this->getHandler()->find($id, $this->getColumns($columns)); }
php
public function find($id, $columns = ['*']) { $this->parse(); return $this->getHandler()->find($id, $this->getColumns($columns)); }
[ "public", "function", "find", "(", "$", "id", ",", "$", "columns", "=", "[", "'*'", "]", ")", "{", "$", "this", "->", "parse", "(", ")", ";", "return", "$", "this", "->", "getHandler", "(", ")", "->", "find", "(", "$", "id", ",", "$", "this", ...
Find a model by its primary key. @param int $id @param array $column @return mixed
[ "Find", "a", "model", "by", "its", "primary", "key", "." ]
train
https://github.com/jenky/laravel-api-helper/blob/9af8f4d99d96ed3ea1bee7eabcdb0472f1bfa367/src/Handler.php#L561-L566
jenky/laravel-api-helper
src/Handler.php
Handler.findOrFail
public function findOrFail($id, $columns = ['*']) { $this->parse(); return $this->getHandler()->findOrFail($id, $this->getColumns($columns)); }
php
public function findOrFail($id, $columns = ['*']) { $this->parse(); return $this->getHandler()->findOrFail($id, $this->getColumns($columns)); }
[ "public", "function", "findOrFail", "(", "$", "id", ",", "$", "columns", "=", "[", "'*'", "]", ")", "{", "$", "this", "->", "parse", "(", ")", ";", "return", "$", "this", "->", "getHandler", "(", ")", "->", "findOrFail", "(", "$", "id", ",", "$",...
Find a model by its primary key or throw an exception. @param int $id @param array $column @throws \Illuminate\Database\Eloquent\ModelNotFoundException @return mixed
[ "Find", "a", "model", "by", "its", "primary", "key", "or", "throw", "an", "exception", "." ]
train
https://github.com/jenky/laravel-api-helper/blob/9af8f4d99d96ed3ea1bee7eabcdb0472f1bfa367/src/Handler.php#L576-L581
jenky/laravel-api-helper
src/Handler.php
Handler.first
public function first($columns = ['*']) { $this->parse(); return $this->getHandler()->first($this->getColumns($columns)); }
php
public function first($columns = ['*']) { $this->parse(); return $this->getHandler()->first($this->getColumns($columns)); }
[ "public", "function", "first", "(", "$", "columns", "=", "[", "'*'", "]", ")", "{", "$", "this", "->", "parse", "(", ")", ";", "return", "$", "this", "->", "getHandler", "(", ")", "->", "first", "(", "$", "this", "->", "getColumns", "(", "$", "co...
Execute the query and get the first result. @param array $columns @return mixed
[ "Execute", "the", "query", "and", "get", "the", "first", "result", "." ]
train
https://github.com/jenky/laravel-api-helper/blob/9af8f4d99d96ed3ea1bee7eabcdb0472f1bfa367/src/Handler.php#L589-L594
jenky/laravel-api-helper
src/Handler.php
Handler.firstOrFail
public function firstOrFail($columns = ['*']) { $this->parse(); return $this->getHandler()->firstOrFail($this->getColumns($columns)); }
php
public function firstOrFail($columns = ['*']) { $this->parse(); return $this->getHandler()->firstOrFail($this->getColumns($columns)); }
[ "public", "function", "firstOrFail", "(", "$", "columns", "=", "[", "'*'", "]", ")", "{", "$", "this", "->", "parse", "(", ")", ";", "return", "$", "this", "->", "getHandler", "(", ")", "->", "firstOrFail", "(", "$", "this", "->", "getColumns", "(", ...
Execute the query and get the first result or throw an exception. @param array $columns @throws \Illuminate\Database\Eloquent\ModelNotFoundException @return mixed
[ "Execute", "the", "query", "and", "get", "the", "first", "result", "or", "throw", "an", "exception", "." ]
train
https://github.com/jenky/laravel-api-helper/blob/9af8f4d99d96ed3ea1bee7eabcdb0472f1bfa367/src/Handler.php#L603-L608
jenky/laravel-api-helper
src/Handler.php
Handler.paginate
public function paginate($perPage = null, $columns = ['*'], $pageName = 'page', $page = null) { $this->parse(); return $this->getHandler()->paginate($this->input('limit', $perPage), $this->getColumns($columns), $this->config('prefix', '').$pageName, $page); }
php
public function paginate($perPage = null, $columns = ['*'], $pageName = 'page', $page = null) { $this->parse(); return $this->getHandler()->paginate($this->input('limit', $perPage), $this->getColumns($columns), $this->config('prefix', '').$pageName, $page); }
[ "public", "function", "paginate", "(", "$", "perPage", "=", "null", ",", "$", "columns", "=", "[", "'*'", "]", ",", "$", "pageName", "=", "'page'", ",", "$", "page", "=", "null", ")", "{", "$", "this", "->", "parse", "(", ")", ";", "return", "$",...
Paginate the given query. @param int $perPage @param array $columns @param string $pageName @param int|null $page @return \Illuminate\Contracts\Pagination\LengthAwarePaginator
[ "Paginate", "the", "given", "query", "." ]
train
https://github.com/jenky/laravel-api-helper/blob/9af8f4d99d96ed3ea1bee7eabcdb0472f1bfa367/src/Handler.php#L652-L657
jenky/laravel-api-helper
src/Handler.php
Handler.getHandler
protected function getHandler() { if ($this->builder) { return $this->builder; } if ($this->query) { return $this->query; } throw new InvalidArgumentException('Missing query builder'); }
php
protected function getHandler() { if ($this->builder) { return $this->builder; } if ($this->query) { return $this->query; } throw new InvalidArgumentException('Missing query builder'); }
[ "protected", "function", "getHandler", "(", ")", "{", "if", "(", "$", "this", "->", "builder", ")", "{", "return", "$", "this", "->", "builder", ";", "}", "if", "(", "$", "this", "->", "query", ")", "{", "return", "$", "this", "->", "query", ";", ...
Get the handler. @throws \InvalidArgumentException @return \Illuminate\Database\Query\Builder | \Illuminate\Database\Eloquent\Builder
[ "Get", "the", "handler", "." ]
train
https://github.com/jenky/laravel-api-helper/blob/9af8f4d99d96ed3ea1bee7eabcdb0472f1bfa367/src/Handler.php#L665-L676
yoanm/php-jsonrpc-http-server-openapi-doc-sdk
src/Infra/Normalizer/DocNormalizer.php
DocNormalizer.normalize
public function normalize(HttpServerDoc $doc) { return [ 'openapi' => '3.0.0', ] + $this->infoArray($doc) + $this->serverArray($doc) + $this->tagsArray($doc) + $this->pathsArray($doc) + $this->externalSchemaListArray($do...
php
public function normalize(HttpServerDoc $doc) { return [ 'openapi' => '3.0.0', ] + $this->infoArray($doc) + $this->serverArray($doc) + $this->tagsArray($doc) + $this->pathsArray($doc) + $this->externalSchemaListArray($do...
[ "public", "function", "normalize", "(", "HttpServerDoc", "$", "doc", ")", "{", "return", "[", "'openapi'", "=>", "'3.0.0'", ",", "]", "+", "$", "this", "->", "infoArray", "(", "$", "doc", ")", "+", "$", "this", "->", "serverArray", "(", "$", "doc", "...
@param HttpServerDoc $doc @return array @throws \ReflectionException
[ "@param", "HttpServerDoc", "$doc" ]
train
https://github.com/yoanm/php-jsonrpc-http-server-openapi-doc-sdk/blob/52d6bb5d0671e0363bbf482c3c75fef97d7d1d5e/src/Infra/Normalizer/DocNormalizer.php#L41-L51
yoanm/php-jsonrpc-http-server-openapi-doc-sdk
src/Infra/Normalizer/DocNormalizer.php
DocNormalizer.serverArray
protected function serverArray(HttpServerDoc $doc) { $serverList = []; if (null !== $doc->getHost()) { $host = $doc->getHost(); if (null !== $doc->getBasePath()) { $host .= $doc->getBasePath(); } $schemeList = $doc->getSchemeList(); ...
php
protected function serverArray(HttpServerDoc $doc) { $serverList = []; if (null !== $doc->getHost()) { $host = $doc->getHost(); if (null !== $doc->getBasePath()) { $host .= $doc->getBasePath(); } $schemeList = $doc->getSchemeList(); ...
[ "protected", "function", "serverArray", "(", "HttpServerDoc", "$", "doc", ")", "{", "$", "serverList", "=", "[", "]", ";", "if", "(", "null", "!==", "$", "doc", "->", "getHost", "(", ")", ")", "{", "$", "host", "=", "$", "doc", "->", "getHost", "("...
{@inheritdoc}
[ "{" ]
train
https://github.com/yoanm/php-jsonrpc-http-server-openapi-doc-sdk/blob/52d6bb5d0671e0363bbf482c3c75fef97d7d1d5e/src/Infra/Normalizer/DocNormalizer.php#L68-L86
yoanm/php-jsonrpc-http-server-openapi-doc-sdk
src/Infra/Normalizer/DocNormalizer.php
DocNormalizer.convertToTagDoc
private function convertToTagDoc(TagDoc $tag) { $tagDoc = [ 'name' => $tag->getName(), ]; if (null !== $tag->getDescription()) { $tagDoc['description'] = $tag->getDescription(); } return $tagDoc; }
php
private function convertToTagDoc(TagDoc $tag) { $tagDoc = [ 'name' => $tag->getName(), ]; if (null !== $tag->getDescription()) { $tagDoc['description'] = $tag->getDescription(); } return $tagDoc; }
[ "private", "function", "convertToTagDoc", "(", "TagDoc", "$", "tag", ")", "{", "$", "tagDoc", "=", "[", "'name'", "=>", "$", "tag", "->", "getName", "(", ")", ",", "]", ";", "if", "(", "null", "!==", "$", "tag", "->", "getDescription", "(", ")", ")...
@param TagDoc $tag @return array
[ "@param", "TagDoc", "$tag" ]
train
https://github.com/yoanm/php-jsonrpc-http-server-openapi-doc-sdk/blob/52d6bb5d0671e0363bbf482c3c75fef97d7d1d5e/src/Infra/Normalizer/DocNormalizer.php#L151-L161
eloquent/liberator
src/LiberatorClass.php
LiberatorClass.liberatorPropertyReflector
protected function liberatorPropertyReflector($property) { $classReflector = $this->liberatorReflector(); while ($classReflector) { if ($classReflector->hasProperty($property)) { $propertyReflector = $classReflector->getProperty($property); $propertyRefle...
php
protected function liberatorPropertyReflector($property) { $classReflector = $this->liberatorReflector(); while ($classReflector) { if ($classReflector->hasProperty($property)) { $propertyReflector = $classReflector->getProperty($property); $propertyRefle...
[ "protected", "function", "liberatorPropertyReflector", "(", "$", "property", ")", "{", "$", "classReflector", "=", "$", "this", "->", "liberatorReflector", "(", ")", ";", "while", "(", "$", "classReflector", ")", "{", "if", "(", "$", "classReflector", "->", ...
Get a property reflector. @param string $property The property name. @return ReflectionProperty|null The property reflector, or null if no such property exists.
[ "Get", "a", "property", "reflector", "." ]
train
https://github.com/eloquent/liberator/blob/d90c159e0067f7f3e376c8e4b1b72d502f7aa0aa/src/LiberatorClass.php#L198-L214
huasituo/hstcms
src/Console/Commands/HstcmsCacheCommand.php
HstcmsCacheCommand.handle
public function handle() { CommonRoleModel::setCache('manage', false); $this->info('Common Role Success'); CommonRoleUriModel::setCache('manage', false); $this->info('Common Role Uri Success'); ManageMenuModel::setCache('manage', false); $this->info('Manage Menu Succe...
php
public function handle() { CommonRoleModel::setCache('manage', false); $this->info('Common Role Success'); CommonRoleUriModel::setCache('manage', false); $this->info('Common Role Uri Success'); ManageMenuModel::setCache('manage', false); $this->info('Manage Menu Succe...
[ "public", "function", "handle", "(", ")", "{", "CommonRoleModel", "::", "setCache", "(", "'manage'", ",", "false", ")", ";", "$", "this", "->", "info", "(", "'Common Role Success'", ")", ";", "CommonRoleUriModel", "::", "setCache", "(", "'manage'", ",", "fal...
Execute the console command. @return mixed
[ "Execute", "the", "console", "command", "." ]
train
https://github.com/huasituo/hstcms/blob/12819979289e58ce38e3e92540aeeb16e205e525/src/Console/Commands/HstcmsCacheCommand.php#L60-L81
o2system/filesystem
src/Files/ZipFile.php
ZipFile.readFile
public function readFile($filePath = null, array $options = []) { $filePath = empty($filePath) ? $this->filePath : $filePath; $result = []; if (extension_loaded('zip')) { if ($zipHandle = zip_open($filePath)) { while ($zipCont...
php
public function readFile($filePath = null, array $options = []) { $filePath = empty($filePath) ? $this->filePath : $filePath; $result = []; if (extension_loaded('zip')) { if ($zipHandle = zip_open($filePath)) { while ($zipCont...
[ "public", "function", "readFile", "(", "$", "filePath", "=", "null", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "filePath", "=", "empty", "(", "$", "filePath", ")", "?", "$", "this", "->", "filePath", ":", "$", "filePath", ";", "$"...
XmlFile::readFile @param string $filePath Path to the file. @param array $options Read file options. @return mixed
[ "XmlFile", "::", "readFile" ]
train
https://github.com/o2system/filesystem/blob/58f6515f56bcc92408dc155add570c99a0abb6e8/src/Files/ZipFile.php#L35-L55
o2system/filesystem
src/Files/ZipFile.php
ZipFile.writeFile
public function writeFile($filePath = null, array $options = []) { $filePath = empty($filePath) ? $this->filePath : $filePath; if ($this->count()) { $zip = new \ZipArchive(); if ($zip->open($filePath, \ZipArchive::CREATE)) { ...
php
public function writeFile($filePath = null, array $options = []) { $filePath = empty($filePath) ? $this->filePath : $filePath; if ($this->count()) { $zip = new \ZipArchive(); if ($zip->open($filePath, \ZipArchive::CREATE)) { ...
[ "public", "function", "writeFile", "(", "$", "filePath", "=", "null", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "filePath", "=", "empty", "(", "$", "filePath", ")", "?", "$", "this", "->", "filePath", ":", "$", "filePath", ";", "i...
ZipFile::writeFile @param string $filePath Path to the file. @param array $options Write file options. @return bool Returns TRUE on success or FALSE on failure.
[ "ZipFile", "::", "writeFile" ]
train
https://github.com/o2system/filesystem/blob/58f6515f56bcc92408dc155add570c99a0abb6e8/src/Files/ZipFile.php#L67-L95
o2system/filesystem
src/Files/ZipFile.php
ZipFile.compress
public function compress($sourcePath, $filePath = null) { $filePath = empty($filePath) ? $this->filePath : $filePath; $zip = new \ZipArchive(); $zip->open($filePath, \ZipArchive::CREATE); $zip->addEmptyDir(pathinfo($sourcePath, PATHINFO_BASENAME)); ...
php
public function compress($sourcePath, $filePath = null) { $filePath = empty($filePath) ? $this->filePath : $filePath; $zip = new \ZipArchive(); $zip->open($filePath, \ZipArchive::CREATE); $zip->addEmptyDir(pathinfo($sourcePath, PATHINFO_BASENAME)); ...
[ "public", "function", "compress", "(", "$", "sourcePath", ",", "$", "filePath", "=", "null", ")", "{", "$", "filePath", "=", "empty", "(", "$", "filePath", ")", "?", "$", "this", "->", "filePath", ":", "$", "filePath", ";", "$", "zip", "=", "new", ...
ZipFile::compress Zipped a folder (include itself). @param string $sourcePath Path of directory to be zip. @param string|null $filePath Path to the zip file.
[ "ZipFile", "::", "compress" ]
train
https://github.com/o2system/filesystem/blob/58f6515f56bcc92408dc155add570c99a0abb6e8/src/Files/ZipFile.php#L107-L118
o2system/filesystem
src/Files/ZipFile.php
ZipFile.recursiveCompress
private function recursiveCompress($directory, $exclusiveLength, &$zipArchive) { $handle = opendir($directory); while (false !== ($file = readdir($handle))) { if ($file != '.' && $file != '..') { $filePath = "$directory/$file"; // Remove prefix fro...
php
private function recursiveCompress($directory, $exclusiveLength, &$zipArchive) { $handle = opendir($directory); while (false !== ($file = readdir($handle))) { if ($file != '.' && $file != '..') { $filePath = "$directory/$file"; // Remove prefix fro...
[ "private", "function", "recursiveCompress", "(", "$", "directory", ",", "$", "exclusiveLength", ",", "&", "$", "zipArchive", ")", "{", "$", "handle", "=", "opendir", "(", "$", "directory", ")", ";", "while", "(", "false", "!==", "(", "$", "file", "=", ...
ZipFile::recursiveCompress Add files and sub-directories in a folder to zip file. @param string $directory Path of directory to be zip. @param int $exclusiveLength Number of text to be exclusive from the file path. @param \ZipArchive $zipArchive Zip Archive instance.
[ "ZipFile", "::", "recursiveCompress" ]
train
https://github.com/o2system/filesystem/blob/58f6515f56bcc92408dc155add570c99a0abb6e8/src/Files/ZipFile.php#L131-L150
o2system/filesystem
src/Files/ZipFile.php
ZipFile.extract
public function extract($destinationPath) { if (extension_loaded('zip')) { if (is_file($this->filePath)) { $zip = new \ZipArchive; $contents = $zip->open($this->filePath); if ($contents === true) { if (is_dir($destinati...
php
public function extract($destinationPath) { if (extension_loaded('zip')) { if (is_file($this->filePath)) { $zip = new \ZipArchive; $contents = $zip->open($this->filePath); if ($contents === true) { if (is_dir($destinati...
[ "public", "function", "extract", "(", "$", "destinationPath", ")", "{", "if", "(", "extension_loaded", "(", "'zip'", ")", ")", "{", "if", "(", "is_file", "(", "$", "this", "->", "filePath", ")", ")", "{", "$", "zip", "=", "new", "\\", "ZipArchive", "...
ZipFile::extract Extract a zip file. @param string $destinationPath Path of unzip directory. @return bool Returns TRUE on success or FALSE on failure.
[ "ZipFile", "::", "extract" ]
train
https://github.com/o2system/filesystem/blob/58f6515f56bcc92408dc155add570c99a0abb6e8/src/Files/ZipFile.php#L163-L182
ejsmont-artur/phpProxyBuilder
src/PhpProxyBuilder/Aop/Advice/ExceptionLoggingAdvice.php
ExceptionLoggingAdvice.interceptMethodCall
public function interceptMethodCall(ProceedingJoinPointInterface $jointPoint) { try { return $jointPoint->proceed(); } catch (Exception $e) { $methodName = $jointPoint->getMethodName(); $partialTrace = array(); $trace = $e->getTrace(); $depth =...
php
public function interceptMethodCall(ProceedingJoinPointInterface $jointPoint) { try { return $jointPoint->proceed(); } catch (Exception $e) { $methodName = $jointPoint->getMethodName(); $partialTrace = array(); $trace = $e->getTrace(); $depth =...
[ "public", "function", "interceptMethodCall", "(", "ProceedingJoinPointInterface", "$", "jointPoint", ")", "{", "try", "{", "return", "$", "jointPoint", "->", "proceed", "(", ")", ";", "}", "catch", "(", "Exception", "$", "e", ")", "{", "$", "methodName", "="...
In this implementation we log each exception and rethrow. @param ProceedingJoinPointInterface $jointPoint @throws \Exception @return mixed
[ "In", "this", "implementation", "we", "log", "each", "exception", "and", "rethrow", "." ]
train
https://github.com/ejsmont-artur/phpProxyBuilder/blob/ef7ec14e5d18eeba7a93e3617a0fdb5b146d6480/src/PhpProxyBuilder/Aop/Advice/ExceptionLoggingAdvice.php#L54-L79
nicoSWD/put.io-api-v2
src/PutIO/Engines/JSON/JSON.php
Services_JSON.Services_JSON
function Services_JSON($use = 0) { $this->use = $use; $this->_mb_strlen = function_exists('mb_strlen'); $this->_mb_convert_encoding = function_exists('mb_convert_encoding'); $this->_mb_substr = function_exists('mb_substr'); }
php
function Services_JSON($use = 0) { $this->use = $use; $this->_mb_strlen = function_exists('mb_strlen'); $this->_mb_convert_encoding = function_exists('mb_convert_encoding'); $this->_mb_substr = function_exists('mb_substr'); }
[ "function", "Services_JSON", "(", "$", "use", "=", "0", ")", "{", "$", "this", "->", "use", "=", "$", "use", ";", "$", "this", "->", "_mb_strlen", "=", "function_exists", "(", "'mb_strlen'", ")", ";", "$", "this", "->", "_mb_convert_encoding", "=", "fu...
constructs a new JSON instance @param int $use object behavior flags; combine with boolean-OR possible values: - SERVICES_JSON_LOOSE_TYPE: loose typing. "{...}" syntax creates associative arrays instead of objects in decode(). - SERVICES_JSON_SUPPRESS_ERRORS: error suppression. Values which can't be encod...
[ "constructs", "a", "new", "JSON", "instance" ]
train
https://github.com/nicoSWD/put.io-api-v2/blob/d91bedd91ea75793512a921bfd9aa83e86a6f0a7/src/PutIO/Engines/JSON/JSON.php#L144-L150
nicoSWD/put.io-api-v2
src/PutIO/Engines/JSON/JSON.php
Services_JSON.encodeUnsafe
function encodeUnsafe($var) { // see bug #16908 - regarding numeric locale printing $lc = setlocale(LC_NUMERIC, 0); setlocale(LC_NUMERIC, 'C'); $ret = $this->_encode($var); setlocale(LC_NUMERIC, $lc); return $ret; }
php
function encodeUnsafe($var) { // see bug #16908 - regarding numeric locale printing $lc = setlocale(LC_NUMERIC, 0); setlocale(LC_NUMERIC, 'C'); $ret = $this->_encode($var); setlocale(LC_NUMERIC, $lc); return $ret; }
[ "function", "encodeUnsafe", "(", "$", "var", ")", "{", "// see bug #16908 - regarding numeric locale printing", "$", "lc", "=", "setlocale", "(", "LC_NUMERIC", ",", "0", ")", ";", "setlocale", "(", "LC_NUMERIC", ",", "'C'", ")", ";", "$", "ret", "=", "$", "t...
encodes an arbitrary variable into JSON format without JSON Header - warning - may allow XSS!!!!) @param mixed $var any number, boolean, string, array, or object to be encoded. see argument 1 to Services_JSON() above for array-parsing behavior. if var is a strng, note that encode() always expects it to be in A...
[ "encodes", "an", "arbitrary", "variable", "into", "JSON", "format", "without", "JSON", "Header", "-", "warning", "-", "may", "allow", "XSS!!!!", ")" ]
train
https://github.com/nicoSWD/put.io-api-v2/blob/d91bedd91ea75793512a921bfd9aa83e86a6f0a7/src/PutIO/Engines/JSON/JSON.php#L271-L280
nicoSWD/put.io-api-v2
src/PutIO/Engines/JSON/JSON.php
Services_JSON._encode
function _encode($var) { switch (gettype($var)) { case 'boolean': return $var ? 'true' : 'false'; case 'NULL': return 'null'; case 'integer': return (int) $var; case 'double': case 'floa...
php
function _encode($var) { switch (gettype($var)) { case 'boolean': return $var ? 'true' : 'false'; case 'NULL': return 'null'; case 'integer': return (int) $var; case 'double': case 'floa...
[ "function", "_encode", "(", "$", "var", ")", "{", "switch", "(", "gettype", "(", "$", "var", ")", ")", "{", "case", "'boolean'", ":", "return", "$", "var", "?", "'true'", ":", "'false'", ";", "case", "'NULL'", ":", "return", "'null'", ";", "case", ...
PRIVATE CODE that does the work of encodes an arbitrary variable into JSON format @param mixed $var any number, boolean, string, array, or object to be encoded. see argument 1 to Services_JSON() above for array-parsing behavior. if var is a strng, note that encode() always expects it to be in ASCII or UTF-8 fo...
[ "PRIVATE", "CODE", "that", "does", "the", "work", "of", "encodes", "an", "arbitrary", "variable", "into", "JSON", "format" ]
train
https://github.com/nicoSWD/put.io-api-v2/blob/d91bedd91ea75793512a921bfd9aa83e86a6f0a7/src/PutIO/Engines/JSON/JSON.php#L292-L523
nicoSWD/put.io-api-v2
src/PutIO/Engines/JSON/JSON.php
Services_JSON.name_value
function name_value($name, $value) { $encoded_value = $this->_encode($value); if(Services_JSON::isError($encoded_value)) { return $encoded_value; } return $this->_encode(strval($name)) . ':' . $encoded_value; }
php
function name_value($name, $value) { $encoded_value = $this->_encode($value); if(Services_JSON::isError($encoded_value)) { return $encoded_value; } return $this->_encode(strval($name)) . ':' . $encoded_value; }
[ "function", "name_value", "(", "$", "name", ",", "$", "value", ")", "{", "$", "encoded_value", "=", "$", "this", "->", "_encode", "(", "$", "value", ")", ";", "if", "(", "Services_JSON", "::", "isError", "(", "$", "encoded_value", ")", ")", "{", "ret...
array-walking function for use in generating JSON-formatted name-value pairs @param string $name name of key to use @param mixed $value reference to an array element to be encoded @return string JSON-formatted name-value pair, like '"name":value' @access private
[ "array", "-", "walking", "function", "for", "use", "in", "generating", "JSON", "-", "formatted", "name", "-", "value", "pairs" ]
train
https://github.com/nicoSWD/put.io-api-v2/blob/d91bedd91ea75793512a921bfd9aa83e86a6f0a7/src/PutIO/Engines/JSON/JSON.php#L534-L543
crossjoin/Css
src/Crossjoin/Css/Format/Rule/AtKeyframes/KeyframesRuleSet.php
KeyframesRuleSet.setKeyframes
public function setKeyframes($keyframes) { $this->keyframes = []; if (!is_array($keyframes)) { $keyframes = [$keyframes]; } foreach ($keyframes as $keyframe) { $this->addKeyframe($keyframe); } return $this; }
php
public function setKeyframes($keyframes) { $this->keyframes = []; if (!is_array($keyframes)) { $keyframes = [$keyframes]; } foreach ($keyframes as $keyframe) { $this->addKeyframe($keyframe); } return $this; }
[ "public", "function", "setKeyframes", "(", "$", "keyframes", ")", "{", "$", "this", "->", "keyframes", "=", "[", "]", ";", "if", "(", "!", "is_array", "(", "$", "keyframes", ")", ")", "{", "$", "keyframes", "=", "[", "$", "keyframes", "]", ";", "}"...
Sets the keyframes. @param KeyframesKeyframe[]|KeyframesKeyframe $keyframes @return $this
[ "Sets", "the", "keyframes", "." ]
train
https://github.com/crossjoin/Css/blob/7b50ca94c4bdad60d01cfa327f00b7a600d6f9f3/src/Crossjoin/Css/Format/Rule/AtKeyframes/KeyframesRuleSet.php#L41-L52
crossjoin/Css
src/Crossjoin/Css/Format/Rule/AtKeyframes/KeyframesRuleSet.php
KeyframesRuleSet.addDeclaration
public function addDeclaration(DeclarationAbstract $declaration) { // TODO Selectors (or keyframes in this case) do NOT cascade! // The last one overwrites previous ones // @see: https://developer.mozilla.org/en-US/docs/Web/CSS/@keyframes#When_a_keyframe_is_defined_multiple_times if...
php
public function addDeclaration(DeclarationAbstract $declaration) { // TODO Selectors (or keyframes in this case) do NOT cascade! // The last one overwrites previous ones // @see: https://developer.mozilla.org/en-US/docs/Web/CSS/@keyframes#When_a_keyframe_is_defined_multiple_times if...
[ "public", "function", "addDeclaration", "(", "DeclarationAbstract", "$", "declaration", ")", "{", "// TODO Selectors (or keyframes in this case) do NOT cascade!", "// The last one overwrites previous ones", "// @see: https://developer.mozilla.org/en-US/docs/Web/CSS/@keyframes#When_a_keyframe_i...
Adds a keyframes declaration. @param KeyframesDeclaration $declaration @return $this
[ "Adds", "a", "keyframes", "declaration", "." ]
train
https://github.com/crossjoin/Css/blob/7b50ca94c4bdad60d01cfa327f00b7a600d6f9f3/src/Crossjoin/Css/Format/Rule/AtKeyframes/KeyframesRuleSet.php#L83-L98
crossjoin/Css
src/Crossjoin/Css/Format/Rule/AtKeyframes/KeyframesRuleSet.php
KeyframesRuleSet.parseKeyframeList
protected function parseKeyframeList($keyframeList) { foreach (explode(",", $keyframeList) as $keyframe) { $keyframe = trim($keyframe, " \r\n\t\f"); $this->addKeyframe(new KeyframesKeyframe($keyframe, $this->getStyleSheet())); } }
php
protected function parseKeyframeList($keyframeList) { foreach (explode(",", $keyframeList) as $keyframe) { $keyframe = trim($keyframe, " \r\n\t\f"); $this->addKeyframe(new KeyframesKeyframe($keyframe, $this->getStyleSheet())); } }
[ "protected", "function", "parseKeyframeList", "(", "$", "keyframeList", ")", "{", "foreach", "(", "explode", "(", "\",\"", ",", "$", "keyframeList", ")", "as", "$", "keyframe", ")", "{", "$", "keyframe", "=", "trim", "(", "$", "keyframe", ",", "\" \\r\\n\\...
Parses a string of keyframes. @param string $keyframeList
[ "Parses", "a", "string", "of", "keyframes", "." ]
train
https://github.com/crossjoin/Css/blob/7b50ca94c4bdad60d01cfa327f00b7a600d6f9f3/src/Crossjoin/Css/Format/Rule/AtKeyframes/KeyframesRuleSet.php#L105-L111
php-ddd/command
src/Bus/SequentialCommandBus.php
SequentialCommandBus.dispatch
public function dispatch(CommandInterface $command) { $this->commandStack[] = $command; if ($this->executing) { return array(); } $first = true; $aggregateRoots = array(); while ($command = array_shift($this->commandStack)) { $aggre...
php
public function dispatch(CommandInterface $command) { $this->commandStack[] = $command; if ($this->executing) { return array(); } $first = true; $aggregateRoots = array(); while ($command = array_shift($this->commandStack)) { $aggre...
[ "public", "function", "dispatch", "(", "CommandInterface", "$", "command", ")", "{", "$", "this", "->", "commandStack", "[", "]", "=", "$", "command", ";", "if", "(", "$", "this", "->", "executing", ")", "{", "return", "array", "(", ")", ";", "}", "$...
Sequentially execute commands If an exception occurs in any command it will be put on a stack of exceptions that is thrown only when all the commands are processed. [@inheritdoc}
[ "Sequentially", "execute", "commands" ]
train
https://github.com/php-ddd/command/blob/dbad1d35c8d740c29c3a28d34f4a787c2b14688a/src/Bus/SequentialCommandBus.php#L48-L65
php-ddd/command
src/Bus/SequentialCommandBus.php
SequentialCommandBus.invokeHandler
protected function invokeHandler(CommandInterface $command, $first) { $aggregateRoot = null; try { $this->executing = true; $commandHandler = $this->locator->getCommandHandlerForCommand($command); $aggregateRoot = $commandHandler->handle($command); } cat...
php
protected function invokeHandler(CommandInterface $command, $first) { $aggregateRoot = null; try { $this->executing = true; $commandHandler = $this->locator->getCommandHandlerForCommand($command); $aggregateRoot = $commandHandler->handle($command); } cat...
[ "protected", "function", "invokeHandler", "(", "CommandInterface", "$", "command", ",", "$", "first", ")", "{", "$", "aggregateRoot", "=", "null", ";", "try", "{", "$", "this", "->", "executing", "=", "true", ";", "$", "commandHandler", "=", "$", "this", ...
@param CommandInterface $command @param bool $first @throws Exception @return AbstractAggregateRoot|null
[ "@param", "CommandInterface", "$command", "@param", "bool", "$first" ]
train
https://github.com/php-ddd/command/blob/dbad1d35c8d740c29c3a28d34f4a787c2b14688a/src/Bus/SequentialCommandBus.php#L82-L99
slogsdon/staticwp
includes/staticwp-admin.class.php
Admin.activate
public function activate() { $muPluginDir = WP_CONTENT_DIR . '/mu-plugins'; if (!is_dir($muPluginDir)) { wp_mkdir_p($muPluginDir); } if (!is_dir($this->destination)) { wp_mkdir_p($this->destination); } $data = "<?php\n" . "/*\n...
php
public function activate() { $muPluginDir = WP_CONTENT_DIR . '/mu-plugins'; if (!is_dir($muPluginDir)) { wp_mkdir_p($muPluginDir); } if (!is_dir($this->destination)) { wp_mkdir_p($this->destination); } $data = "<?php\n" . "/*\n...
[ "public", "function", "activate", "(", ")", "{", "$", "muPluginDir", "=", "WP_CONTENT_DIR", ".", "'/mu-plugins'", ";", "if", "(", "!", "is_dir", "(", "$", "muPluginDir", ")", ")", "{", "wp_mkdir_p", "(", "$", "muPluginDir", ")", ";", "}", "if", "(", "!...
Upon initial activation, the plugin creates a MU version of itself to mu-plugins to take advantage of the muplugins_loaded hook. It leaves support files in their original location (plugins folder). @since 1.0.0 @return void
[ "Upon", "initial", "activation", "the", "plugin", "creates", "a", "MU", "version", "of", "itself", "to", "mu", "-", "plugins", "to", "take", "advantage", "of", "the", "muplugins_loaded", "hook", ".", "It", "leaves", "support", "files", "in", "their", "origin...
train
https://github.com/slogsdon/staticwp/blob/e96811e57c521b0dc28fc600647b89828cdba8c0/includes/staticwp-admin.class.php#L50-L81
slogsdon/staticwp
includes/staticwp-admin.class.php
Admin.addMenu
public function addMenu() { add_submenu_page( 'tools.php', __('StaticWP', $this->plugin), __('StaticWP', $this->plugin), 'manage_options', $this->plugin, array($this, 'viewPage') ); }
php
public function addMenu() { add_submenu_page( 'tools.php', __('StaticWP', $this->plugin), __('StaticWP', $this->plugin), 'manage_options', $this->plugin, array($this, 'viewPage') ); }
[ "public", "function", "addMenu", "(", ")", "{", "add_submenu_page", "(", "'tools.php'", ",", "__", "(", "'StaticWP'", ",", "$", "this", "->", "plugin", ")", ",", "__", "(", "'StaticWP'", ",", "$", "this", "->", "plugin", ")", ",", "'manage_options'", ","...
Creates menu for StaticWP admin pages. @since 1.3.0 @return void
[ "Creates", "menu", "for", "StaticWP", "admin", "pages", "." ]
train
https://github.com/slogsdon/staticwp/blob/e96811e57c521b0dc28fc600647b89828cdba8c0/includes/staticwp-admin.class.php#L90-L100
slogsdon/staticwp
includes/staticwp-admin.class.php
Admin.deactivate
public function deactivate() { $muPluginFile = WP_CONTENT_DIR . '/mu-plugins/' . $this->plugin . '-mu.php'; if (is_file($muPluginFile)) { unlink($muPluginFile); } if (is_dir($this->destination)) { $this->rrmdir(dirname($this->destination)); } ...
php
public function deactivate() { $muPluginFile = WP_CONTENT_DIR . '/mu-plugins/' . $this->plugin . '-mu.php'; if (is_file($muPluginFile)) { unlink($muPluginFile); } if (is_dir($this->destination)) { $this->rrmdir(dirname($this->destination)); } ...
[ "public", "function", "deactivate", "(", ")", "{", "$", "muPluginFile", "=", "WP_CONTENT_DIR", ".", "'/mu-plugins/'", ".", "$", "this", "->", "plugin", ".", "'-mu.php'", ";", "if", "(", "is_file", "(", "$", "muPluginFile", ")", ")", "{", "unlink", "(", "...
Cleans up after itself on deactivation. @since 1.1.0 @return void
[ "Cleans", "up", "after", "itself", "on", "deactivation", "." ]
train
https://github.com/slogsdon/staticwp/blob/e96811e57c521b0dc28fc600647b89828cdba8c0/includes/staticwp-admin.class.php#L109-L123
slogsdon/staticwp
includes/staticwp-admin.class.php
Admin.displayNotices
public static function displayNotices() { if ($notices = get_option('staticwp_deferred_admin_notices')) { foreach ($notices as $notice) { $message = $notice; $type = 'updated'; if (is_array($notice)) { $message = isset($notice[...
php
public static function displayNotices() { if ($notices = get_option('staticwp_deferred_admin_notices')) { foreach ($notices as $notice) { $message = $notice; $type = 'updated'; if (is_array($notice)) { $message = isset($notice[...
[ "public", "static", "function", "displayNotices", "(", ")", "{", "if", "(", "$", "notices", "=", "get_option", "(", "'staticwp_deferred_admin_notices'", ")", ")", "{", "foreach", "(", "$", "notices", "as", "$", "notice", ")", "{", "$", "message", "=", "$",...
Displays admin notices. @since 1.3.0 @return void
[ "Displays", "admin", "notices", "." ]
train
https://github.com/slogsdon/staticwp/blob/e96811e57c521b0dc28fc600647b89828cdba8c0/includes/staticwp-admin.class.php#L132-L148
slogsdon/staticwp
includes/staticwp-admin.class.php
Admin.errorToException
public static function errorToException($num, $mes, $file = null, $line = null, $context = null) { throw new Exception($mes, $num); }
php
public static function errorToException($num, $mes, $file = null, $line = null, $context = null) { throw new Exception($mes, $num); }
[ "public", "static", "function", "errorToException", "(", "$", "num", ",", "$", "mes", ",", "$", "file", "=", "null", ",", "$", "line", "=", "null", ",", "$", "context", "=", "null", ")", "{", "throw", "new", "Exception", "(", "$", "mes", ",", "$", ...
Error handler to convert errors to exceptions to make it easier to catch them. @param int $num @param string $mes @param string $file @param int $line @param array $context @return bool
[ "Error", "handler", "to", "convert", "errors", "to", "exceptions", "to", "make", "it", "easier", "to", "catch", "them", "." ]
train
https://github.com/slogsdon/staticwp/blob/e96811e57c521b0dc28fc600647b89828cdba8c0/includes/staticwp-admin.class.php#L162-L165
slogsdon/staticwp
includes/staticwp-admin.class.php
Admin.handlePost
public function handlePost() { if (!isset($_POST['staticwp-action'])) { return; } if (!check_admin_referer('staticwp')) { return; } switch ($_POST['staticwp-action']) { case 'preload': set_error_handler(array(__CLASS__, 'er...
php
public function handlePost() { if (!isset($_POST['staticwp-action'])) { return; } if (!check_admin_referer('staticwp')) { return; } switch ($_POST['staticwp-action']) { case 'preload': set_error_handler(array(__CLASS__, 'er...
[ "public", "function", "handlePost", "(", ")", "{", "if", "(", "!", "isset", "(", "$", "_POST", "[", "'staticwp-action'", "]", ")", ")", "{", "return", ";", "}", "if", "(", "!", "check_admin_referer", "(", "'staticwp'", ")", ")", "{", "return", ";", "...
Handles form submission on StaticWP admin pages. @return void
[ "Handles", "form", "submission", "on", "StaticWP", "admin", "pages", "." ]
train
https://github.com/slogsdon/staticwp/blob/e96811e57c521b0dc28fc600647b89828cdba8c0/includes/staticwp-admin.class.php#L172-L202
slogsdon/staticwp
includes/staticwp-admin.class.php
Admin.initHooks
public function initHooks() { register_activation_hook($this->file, array($this , 'activate')); register_deactivation_hook($this->file, array($this, 'deactivate')); add_action('save_post', array($this, 'updateHtml'), 10, 2); add_action('admin_init', array($this, 'handlePost')); ...
php
public function initHooks() { register_activation_hook($this->file, array($this , 'activate')); register_deactivation_hook($this->file, array($this, 'deactivate')); add_action('save_post', array($this, 'updateHtml'), 10, 2); add_action('admin_init', array($this, 'handlePost')); ...
[ "public", "function", "initHooks", "(", ")", "{", "register_activation_hook", "(", "$", "this", "->", "file", ",", "array", "(", "$", "this", ",", "'activate'", ")", ")", ";", "register_deactivation_hook", "(", "$", "this", "->", "file", ",", "array", "(",...
Hooks on to necessary actions/filters for the administration end of the plugin. @since 1.0.0 @return void
[ "Hooks", "on", "to", "necessary", "actions", "/", "filters", "for", "the", "administration", "end", "of", "the", "plugin", "." ]
train
https://github.com/slogsdon/staticwp/blob/e96811e57c521b0dc28fc600647b89828cdba8c0/includes/staticwp-admin.class.php#L212-L222
slogsdon/staticwp
includes/staticwp-admin.class.php
Admin.update
public function update() { $version = get_option($this->plugin . 'version'); if ($version != STATICWP_VERSION) { update_option($this->plugin . 'version', STATICWP_VERSION); } }
php
public function update() { $version = get_option($this->plugin . 'version'); if ($version != STATICWP_VERSION) { update_option($this->plugin . 'version', STATICWP_VERSION); } }
[ "public", "function", "update", "(", ")", "{", "$", "version", "=", "get_option", "(", "$", "this", "->", "plugin", ".", "'version'", ")", ";", "if", "(", "$", "version", "!=", "STATICWP_VERSION", ")", "{", "update_option", "(", "$", "this", "->", "plu...
Handles plugin updates. @since 1.3.0 @return void
[ "Handles", "plugin", "updates", "." ]
train
https://github.com/slogsdon/staticwp/blob/e96811e57c521b0dc28fc600647b89828cdba8c0/includes/staticwp-admin.class.php#L231-L237
slogsdon/staticwp
includes/staticwp-admin.class.php
Admin.viewPage
public function viewPage() { $page = isset($_GET['sub']) ? (string)$_GET['sub'] : self::DEFAULT_SUB_PAGE; View::page('admin/' . $page); }
php
public function viewPage() { $page = isset($_GET['sub']) ? (string)$_GET['sub'] : self::DEFAULT_SUB_PAGE; View::page('admin/' . $page); }
[ "public", "function", "viewPage", "(", ")", "{", "$", "page", "=", "isset", "(", "$", "_GET", "[", "'sub'", "]", ")", "?", "(", "string", ")", "$", "_GET", "[", "'sub'", "]", ":", "self", "::", "DEFAULT_SUB_PAGE", ";", "View", "::", "page", "(", ...
Displays a page. @since 1.4.2 @return void
[ "Displays", "a", "page", "." ]
train
https://github.com/slogsdon/staticwp/blob/e96811e57c521b0dc28fc600647b89828cdba8c0/includes/staticwp-admin.class.php#L261-L265
slogsdon/staticwp
includes/staticwp-admin.class.php
Admin.preload
protected function preload($post_type = 'post') { $args = array( 'fields' => 'ids', 'orderby' => 'post_date', 'order' => 'DESC', 'post_status' => 'publish', 'post_type' => $post_type, 'showposts...
php
protected function preload($post_type = 'post') { $args = array( 'fields' => 'ids', 'orderby' => 'post_date', 'order' => 'DESC', 'post_status' => 'publish', 'post_type' => $post_type, 'showposts...
[ "protected", "function", "preload", "(", "$", "post_type", "=", "'post'", ")", "{", "$", "args", "=", "array", "(", "'fields'", "=>", "'ids'", ",", "'orderby'", "=>", "'post_date'", ",", "'order'", "=>", "'DESC'", ",", "'post_status'", "=>", "'publish'", "...
Loops through posts to compile static HTML for each. @since 1.3.0 @return void
[ "Loops", "through", "posts", "to", "compile", "static", "HTML", "for", "each", "." ]
train
https://github.com/slogsdon/staticwp/blob/e96811e57c521b0dc28fc600647b89828cdba8c0/includes/staticwp-admin.class.php#L288-L307
huasituo/hstcms
src/Http/Middleware/RequestLog.php
RequestLog.handle
public function handle($request, Closure $next) { if(hst_config('safe', 'manage.request')) { $RequestLogDir = base_path('storage/hstcms/requestlog/'. hst_time2str(hst_time(), 'Ym') . '/'); $file = $RequestLogDir . hst_time2str(hst_time(), 'd') . '.log'; $files = new Files...
php
public function handle($request, Closure $next) { if(hst_config('safe', 'manage.request')) { $RequestLogDir = base_path('storage/hstcms/requestlog/'. hst_time2str(hst_time(), 'Ym') . '/'); $file = $RequestLogDir . hst_time2str(hst_time(), 'd') . '.log'; $files = new Files...
[ "public", "function", "handle", "(", "$", "request", ",", "Closure", "$", "next", ")", "{", "if", "(", "hst_config", "(", "'safe'", ",", "'manage.request'", ")", ")", "{", "$", "RequestLogDir", "=", "base_path", "(", "'storage/hstcms/requestlog/'", ".", "hst...
Handle an incoming request. @param \Illuminate\Http\Request $request @param \Closure $next @return mixed
[ "Handle", "an", "incoming", "request", "." ]
train
https://github.com/huasituo/hstcms/blob/12819979289e58ce38e3e92540aeeb16e205e525/src/Http/Middleware/RequestLog.php#L21-L60
jan-dolata/crude-crud
src/Engine/Helpers/CrudeFiles.php
CrudeFiles.upload
public function upload($model, $folderName, $files, $fileAttrName = 'files', $width = null) { $updatedFiles = $model->$fileAttrName; foreach ($files as $file) { $log = (new FileLog)->create([ 'model_id' => $model->id, 'model_name' => $folderName, ...
php
public function upload($model, $folderName, $files, $fileAttrName = 'files', $width = null) { $updatedFiles = $model->$fileAttrName; foreach ($files as $file) { $log = (new FileLog)->create([ 'model_id' => $model->id, 'model_name' => $folderName, ...
[ "public", "function", "upload", "(", "$", "model", ",", "$", "folderName", ",", "$", "files", ",", "$", "fileAttrName", "=", "'files'", ",", "$", "width", "=", "null", ")", "{", "$", "updatedFiles", "=", "$", "model", "->", "$", "fileAttrName", ";", ...
Upload files for model, without save model @param Model $model - with 'files' attribute @param string $folderName @param Files $files @return Model
[ "Upload", "files", "for", "model", "without", "save", "model" ]
train
https://github.com/jan-dolata/crude-crud/blob/9129ea08278835cf5cecfd46a90369226ae6bdd7/src/Engine/Helpers/CrudeFiles.php#L21-L59
jan-dolata/crude-crud
src/Engine/Helpers/CrudeFiles.php
CrudeFiles.delete
public function delete($model, $log, $fileAttrName = 'files', $fileLogId = 0) { $updatedFiles = []; if ($log) $fileLogId = $log->id; $fileToDelete = []; foreach ($model->files as $file) { if ($file['file_log_id'] == $fileLogId) $fileToDelete =...
php
public function delete($model, $log, $fileAttrName = 'files', $fileLogId = 0) { $updatedFiles = []; if ($log) $fileLogId = $log->id; $fileToDelete = []; foreach ($model->files as $file) { if ($file['file_log_id'] == $fileLogId) $fileToDelete =...
[ "public", "function", "delete", "(", "$", "model", ",", "$", "log", ",", "$", "fileAttrName", "=", "'files'", ",", "$", "fileLogId", "=", "0", ")", "{", "$", "updatedFiles", "=", "[", "]", ";", "if", "(", "$", "log", ")", "$", "fileLogId", "=", "...
Delete file for model, without save model @param Model $model @param FileLog $log @param String $fileAttrName = 'files' @param String $fileLogId = 0 - used when log is missing @return Model
[ "Delete", "file", "for", "model", "without", "save", "model" ]
train
https://github.com/jan-dolata/crude-crud/blob/9129ea08278835cf5cecfd46a90369226ae6bdd7/src/Engine/Helpers/CrudeFiles.php#L82-L106
activecollab/databasestructure
src/Field/Scalar/Traits/SizeInterface/Implementation.php
Implementation.getSupportedSizes
protected function getSupportedSizes() { return [FieldInterface::SIZE_TINY, FieldInterface::SIZE_SMALL, FieldInterface::SIZE_MEDIUM, FieldInterface::SIZE_NORMAL, FieldInterface::SIZE_BIG]; }
php
protected function getSupportedSizes() { return [FieldInterface::SIZE_TINY, FieldInterface::SIZE_SMALL, FieldInterface::SIZE_MEDIUM, FieldInterface::SIZE_NORMAL, FieldInterface::SIZE_BIG]; }
[ "protected", "function", "getSupportedSizes", "(", ")", "{", "return", "[", "FieldInterface", "::", "SIZE_TINY", ",", "FieldInterface", "::", "SIZE_SMALL", ",", "FieldInterface", "::", "SIZE_MEDIUM", ",", "FieldInterface", "::", "SIZE_NORMAL", ",", "FieldInterface", ...
Return an array of supported sizes. @return array
[ "Return", "an", "array", "of", "supported", "sizes", "." ]
train
https://github.com/activecollab/databasestructure/blob/4b2353c4422186bcfce63b3212da3e70e63eb5df/src/Field/Scalar/Traits/SizeInterface/Implementation.php#L54-L57
huasituo/hstcms
src/Database/Migrations/2016_11_25_093145_create_manage_menu_table.php
CreateManageMenuTable.up
public function up() { // Schema::create('manage_menu', function (Blueprint $table) { $table->increments('id')->comment('ID'); $table->string('name', 30)->default('')->comment(hst_lang('hstcms::public.name')); $table->string('ename', 30)->default('')->comm...
php
public function up() { // Schema::create('manage_menu', function (Blueprint $table) { $table->increments('id')->comment('ID'); $table->string('name', 30)->default('')->comment(hst_lang('hstcms::public.name')); $table->string('ename', 30)->default('')->comm...
[ "public", "function", "up", "(", ")", "{", "//", "Schema", "::", "create", "(", "'manage_menu'", ",", "function", "(", "Blueprint", "$", "table", ")", "{", "$", "table", "->", "increments", "(", "'id'", ")", "->", "comment", "(", "'ID'", ")", ";", "$...
Run the migrations. @return void
[ "Run", "the", "migrations", "." ]
train
https://github.com/huasituo/hstcms/blob/12819979289e58ce38e3e92540aeeb16e205e525/src/Database/Migrations/2016_11_25_093145_create_manage_menu_table.php#L18-L34
okvpn/fixture-bundle
src/Command/LoadDataFixturesCommand.php
LoadDataFixturesCommand.configure
protected function configure() { $this->setName(static::COMMAND_NAME) ->setAliases(['okvpn:fixture:data:load']) ->setDescription('Load data fixtures.') ->addOption( 'fixtures-type', null, InputOption::VALUE_OPTIONAL, ...
php
protected function configure() { $this->setName(static::COMMAND_NAME) ->setAliases(['okvpn:fixture:data:load']) ->setDescription('Load data fixtures.') ->addOption( 'fixtures-type', null, InputOption::VALUE_OPTIONAL, ...
[ "protected", "function", "configure", "(", ")", "{", "$", "this", "->", "setName", "(", "static", "::", "COMMAND_NAME", ")", "->", "setAliases", "(", "[", "'okvpn:fixture:data:load'", "]", ")", "->", "setDescription", "(", "'Load data fixtures.'", ")", "->", "...
{@inheritdoc}
[ "{" ]
train
https://github.com/okvpn/fixture-bundle/blob/243b5e4dff9773e97fa447280e929c936a5d66ae/src/Command/LoadDataFixturesCommand.php#L30-L60
okvpn/fixture-bundle
src/Command/LoadDataFixturesCommand.php
LoadDataFixturesCommand.initialize
protected function initialize(InputInterface $input, OutputInterface $output) { $this->connection = $this->getContainer()->get('doctrine')->getConnection(); }
php
protected function initialize(InputInterface $input, OutputInterface $output) { $this->connection = $this->getContainer()->get('doctrine')->getConnection(); }
[ "protected", "function", "initialize", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "$", "this", "->", "connection", "=", "$", "this", "->", "getContainer", "(", ")", "->", "get", "(", "'doctrine'", ")", "->", "getC...
{@inheritdoc}
[ "{" ]
train
https://github.com/okvpn/fixture-bundle/blob/243b5e4dff9773e97fa447280e929c936a5d66ae/src/Command/LoadDataFixturesCommand.php#L65-L68
okvpn/fixture-bundle
src/Command/LoadDataFixturesCommand.php
LoadDataFixturesCommand.execute
protected function execute(InputInterface $input, OutputInterface $output) { $fixtures = null; $this->ensureTableExist(); try { $fixtures = $this->getFixtures($input, $output); } catch (\RuntimeException $ex) { $output->writeln(''); $output->writel...
php
protected function execute(InputInterface $input, OutputInterface $output) { $fixtures = null; $this->ensureTableExist(); try { $fixtures = $this->getFixtures($input, $output); } catch (\RuntimeException $ex) { $output->writeln(''); $output->writel...
[ "protected", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "$", "fixtures", "=", "null", ";", "$", "this", "->", "ensureTableExist", "(", ")", ";", "try", "{", "$", "fixtures", "=", "$", "thi...
{@inheritdoc}
[ "{" ]
train
https://github.com/okvpn/fixture-bundle/blob/243b5e4dff9773e97fa447280e929c936a5d66ae/src/Command/LoadDataFixturesCommand.php#L73-L94
okvpn/fixture-bundle
src/Command/LoadDataFixturesCommand.php
LoadDataFixturesCommand.outputFixtures
protected function outputFixtures(InputInterface $input, OutputInterface $output, $fixtures) { $output->writeln( sprintf( 'List of "%s" data fixtures ...', $this->getTypeOfFixtures($input) ) ); foreach ($fixtures as $fixture) { ...
php
protected function outputFixtures(InputInterface $input, OutputInterface $output, $fixtures) { $output->writeln( sprintf( 'List of "%s" data fixtures ...', $this->getTypeOfFixtures($input) ) ); foreach ($fixtures as $fixture) { ...
[ "protected", "function", "outputFixtures", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ",", "$", "fixtures", ")", "{", "$", "output", "->", "writeln", "(", "sprintf", "(", "'List of \"%s\" data fixtures ...'", ",", "$", "this", "-...
Output list of fixtures @param InputInterface $input @param OutputInterface $output @param array $fixtures
[ "Output", "list", "of", "fixtures" ]
train
https://github.com/okvpn/fixture-bundle/blob/243b5e4dff9773e97fa447280e929c936a5d66ae/src/Command/LoadDataFixturesCommand.php#L133-L144
okvpn/fixture-bundle
src/Command/LoadDataFixturesCommand.php
LoadDataFixturesCommand.processFixtures
protected function processFixtures(InputInterface $input, OutputInterface $output, $fixtures) { $output->writeln( sprintf( 'Loading "%s" data fixtures ...', $this->getTypeOfFixtures($input) ) ); $executor = $this->getContainer()->get('...
php
protected function processFixtures(InputInterface $input, OutputInterface $output, $fixtures) { $output->writeln( sprintf( 'Loading "%s" data fixtures ...', $this->getTypeOfFixtures($input) ) ); $executor = $this->getContainer()->get('...
[ "protected", "function", "processFixtures", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ",", "$", "fixtures", ")", "{", "$", "output", "->", "writeln", "(", "sprintf", "(", "'Loading \"%s\" data fixtures ...'", ",", "$", "this", "...
Process fixtures @param InputInterface $input @param OutputInterface $output @param array $fixtures
[ "Process", "fixtures" ]
train
https://github.com/okvpn/fixture-bundle/blob/243b5e4dff9773e97fa447280e929c936a5d66ae/src/Command/LoadDataFixturesCommand.php#L153-L169
movoin/one-swoole
example/app/Commands/ShowActionsCommand.php
ShowActionsCommand.execute
protected function execute(InputInterface $input, OutputInterface $output) { $actions = new Finder(APP_PATH, 'One\\Context\\Contracts\\Action', 'php'); foreach ($actions as $action) { $this->output('Action', 'info', $action->getBasename('.php'), ''); } }
php
protected function execute(InputInterface $input, OutputInterface $output) { $actions = new Finder(APP_PATH, 'One\\Context\\Contracts\\Action', 'php'); foreach ($actions as $action) { $this->output('Action', 'info', $action->getBasename('.php'), ''); } }
[ "protected", "function", "execute", "(", "InputInterface", "$", "input", ",", "OutputInterface", "$", "output", ")", "{", "$", "actions", "=", "new", "Finder", "(", "APP_PATH", ",", "'One\\\\Context\\\\Contracts\\\\Action'", ",", "'php'", ")", ";", "foreach", "(...
执行命令 @param \Symfony\Component\Console\Input\InputInterface $input @param \Symfony\Component\Console\Output\OutputInterface $output
[ "执行命令" ]
train
https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/example/app/Commands/ShowActionsCommand.php#L39-L46
goblindegook/Syllables
src/Template/Loader/Single.php
Single._prepare_filter
protected function _prepare_filter() { $post = \get_queried_object(); if ( ! empty( $post->post_name ) ) { $this->slug = $post->post_name; } if ( ! empty( $post->post_type ) ) { $post_type = \get_post_type_object( $post->post_type ); $this->post_type = $post_type->name; } }
php
protected function _prepare_filter() { $post = \get_queried_object(); if ( ! empty( $post->post_name ) ) { $this->slug = $post->post_name; } if ( ! empty( $post->post_type ) ) { $post_type = \get_post_type_object( $post->post_type ); $this->post_type = $post_type->name; } }
[ "protected", "function", "_prepare_filter", "(", ")", "{", "$", "post", "=", "\\", "get_queried_object", "(", ")", ";", "if", "(", "!", "empty", "(", "$", "post", "->", "post_name", ")", ")", "{", "$", "this", "->", "slug", "=", "$", "post", "->", ...
Prepares the object when the filter is applied. @uses \get_queried_object() @uses \get_post_type_object() @codeCoverageIgnore
[ "Prepares", "the", "object", "when", "the", "filter", "is", "applied", "." ]
train
https://github.com/goblindegook/Syllables/blob/1a98cd15e37595a85b242242f88fee38c4e36acc/src/Template/Loader/Single.php#L54-L65
comelyio/comely
src/Comely/IO/Events/EventsHandler.php
EventsHandler.on
public function on(string $tag): Event { // Look for existing Event $event = $this->events[$tag] ?? null; if ($event) { // Found? return $event; // Return existing Event } // Register and return instance of new Event return $this->events[$tag] = new Event...
php
public function on(string $tag): Event { // Look for existing Event $event = $this->events[$tag] ?? null; if ($event) { // Found? return $event; // Return existing Event } // Register and return instance of new Event return $this->events[$tag] = new Event...
[ "public", "function", "on", "(", "string", "$", "tag", ")", ":", "Event", "{", "// Look for existing Event", "$", "event", "=", "$", "this", "->", "events", "[", "$", "tag", "]", "??", "null", ";", "if", "(", "$", "event", ")", "{", "// Found?", "ret...
Returns a registered Event if exists, otherwise creates a new Event @param string $tag @return Event
[ "Returns", "a", "registered", "Event", "if", "exists", "otherwise", "creates", "a", "new", "Event" ]
train
https://github.com/comelyio/comely/blob/561ea7aef36fea347a1a79d3ee5597d4057ddf82/src/Comely/IO/Events/EventsHandler.php#L43-L53
movoin/one-swoole
src/Swoole/Server.php
Server.setRunUser
protected function setRunUser() { if (($username = $this->getConfig('swoole.user')) !== null) { $user = posix_getpwnam($username); if ($user) { posix_setuid($user['uid']); posix_setgid($user['gid']); } unset($user, $username);...
php
protected function setRunUser() { if (($username = $this->getConfig('swoole.user')) !== null) { $user = posix_getpwnam($username); if ($user) { posix_setuid($user['uid']); posix_setgid($user['gid']); } unset($user, $username);...
[ "protected", "function", "setRunUser", "(", ")", "{", "if", "(", "(", "$", "username", "=", "$", "this", "->", "getConfig", "(", "'swoole.user'", ")", ")", "!==", "null", ")", "{", "$", "user", "=", "posix_getpwnam", "(", "$", "username", ")", ";", "...
设置运行用户
[ "设置运行用户" ]
train
https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Swoole/Server.php#L120-L132
movoin/one-swoole
src/Swoole/Server.php
Server.getPid
protected function getPid(): int { $pid = 0; if (is_readable($this->getConfig('swoole.pid_file'))) { $pid = file_get_contents($this->getConfig('swoole.pid_file')); } return $pid; }
php
protected function getPid(): int { $pid = 0; if (is_readable($this->getConfig('swoole.pid_file'))) { $pid = file_get_contents($this->getConfig('swoole.pid_file')); } return $pid; }
[ "protected", "function", "getPid", "(", ")", ":", "int", "{", "$", "pid", "=", "0", ";", "if", "(", "is_readable", "(", "$", "this", "->", "getConfig", "(", "'swoole.pid_file'", ")", ")", ")", "{", "$", "pid", "=", "file_get_contents", "(", "$", "thi...
获得主进程 PID @return int
[ "获得主进程", "PID" ]
train
https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Swoole/Server.php#L139-L148
kderyabin/logger
src/Utils/Stringer.php
Stringer.stringify
public static function stringify($value) { if (is_string($value)) { return $value; } if ($value === null || is_bool($value)) { return var_export($value, true); } if (is_array($value) || (is_object($value) && !method_exists($value, '__toString'))) { ...
php
public static function stringify($value) { if (is_string($value)) { return $value; } if ($value === null || is_bool($value)) { return var_export($value, true); } if (is_array($value) || (is_object($value) && !method_exists($value, '__toString'))) { ...
[ "public", "static", "function", "stringify", "(", "$", "value", ")", "{", "if", "(", "is_string", "(", "$", "value", ")", ")", "{", "return", "$", "value", ";", "}", "if", "(", "$", "value", "===", "null", "||", "is_bool", "(", "$", "value", ")", ...
Converts a value into a string. @param mixed $value @return string
[ "Converts", "a", "value", "into", "a", "string", "." ]
train
https://github.com/kderyabin/logger/blob/683890192b37fe9d36611972e12c2994669f5b85/src/Utils/Stringer.php#L19-L32
movoin/one-swoole
src/Support/Helpers/DateTime.php
DateTime.factory
public static function factory($time = null, string $timezone = null): \DateTime { if (! $timezone instanceof \DateTimeZone) { $timezone = $timezone ?: date_default_timezone_get(); $timezone = new \DateTimeZone($timezone); } if ($time instanceof \DateTime) { ...
php
public static function factory($time = null, string $timezone = null): \DateTime { if (! $timezone instanceof \DateTimeZone) { $timezone = $timezone ?: date_default_timezone_get(); $timezone = new \DateTimeZone($timezone); } if ($time instanceof \DateTime) { ...
[ "public", "static", "function", "factory", "(", "$", "time", "=", "null", ",", "string", "$", "timezone", "=", "null", ")", ":", "\\", "DateTime", "{", "if", "(", "!", "$", "timezone", "instanceof", "\\", "DateTimeZone", ")", "{", "$", "timezone", "=",...
构造工厂 @param \DateTime|string|int $time @param string $timezone @return \DateTime
[ "构造工厂" ]
train
https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Support/Helpers/DateTime.php#L33-L46
movoin/one-swoole
src/Support/Helpers/DateTime.php
DateTime.timestamp
public static function timestamp($time = null): int { if ($time instanceof \DateTime) { return $time->format('U'); } $time = time(); if ($time !== null) { $time = is_numeric($time) ? (int) $time : strtotime($time); } return $time; }
php
public static function timestamp($time = null): int { if ($time instanceof \DateTime) { return $time->format('U'); } $time = time(); if ($time !== null) { $time = is_numeric($time) ? (int) $time : strtotime($time); } return $time; }
[ "public", "static", "function", "timestamp", "(", "$", "time", "=", "null", ")", ":", "int", "{", "if", "(", "$", "time", "instanceof", "\\", "DateTime", ")", "{", "return", "$", "time", "->", "format", "(", "'U'", ")", ";", "}", "$", "time", "=", ...
转换时间戳 @param \DateTime|string|int $time @return int
[ "转换时间戳" ]
train
https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Support/Helpers/DateTime.php#L55-L68
movoin/one-swoole
src/Support/Helpers/DateTime.php
DateTime.now
public static function now(string $format = 'Y-m-d H:i:s', string $timezone = null): string { return self::factory(null, $timezone)->format($format); }
php
public static function now(string $format = 'Y-m-d H:i:s', string $timezone = null): string { return self::factory(null, $timezone)->format($format); }
[ "public", "static", "function", "now", "(", "string", "$", "format", "=", "'Y-m-d H:i:s'", ",", "string", "$", "timezone", "=", "null", ")", ":", "string", "{", "return", "self", "::", "factory", "(", "null", ",", "$", "timezone", ")", "->", "format", ...
获得当前日期 @param string $format @param string $timezone @return string
[ "获得当前日期" ]
train
https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Support/Helpers/DateTime.php#L78-L81
chippyash/Math-Type-Calculator
src/Chippyash/Math/Type/Calculator/Native.php
Native.intAdd
public function intAdd(NI $a, NI $b) { list($a, $b) = $this->checkIntTypes($a, $b); return new IntType($a() + $b()); }
php
public function intAdd(NI $a, NI $b) { list($a, $b) = $this->checkIntTypes($a, $b); return new IntType($a() + $b()); }
[ "public", "function", "intAdd", "(", "NI", "$", "a", ",", "NI", "$", "b", ")", "{", "list", "(", "$", "a", ",", "$", "b", ")", "=", "$", "this", "->", "checkIntTypes", "(", "$", "a", ",", "$", "b", ")", ";", "return", "new", "IntType", "(", ...
Integer type addition @param NI $a first operand @param NI $b second operand @return IntType
[ "Integer", "type", "addition" ]
train
https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Calculator/Native.php#L54-L59
chippyash/Math-Type-Calculator
src/Chippyash/Math/Type/Calculator/Native.php
Native.intSub
public function intSub(NI $a, NI $b) { list($a, $b) = $this->checkIntTypes($a, $b); return new IntType($a() - $b()); }
php
public function intSub(NI $a, NI $b) { list($a, $b) = $this->checkIntTypes($a, $b); return new IntType($a() - $b()); }
[ "public", "function", "intSub", "(", "NI", "$", "a", ",", "NI", "$", "b", ")", "{", "list", "(", "$", "a", ",", "$", "b", ")", "=", "$", "this", "->", "checkIntTypes", "(", "$", "a", ",", "$", "b", ")", ";", "return", "new", "IntType", "(", ...
Integer type subtraction @param NI $a first operand @param NI $b second operand @return IntType
[ "Integer", "type", "subtraction" ]
train
https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Calculator/Native.php#L69-L74
chippyash/Math-Type-Calculator
src/Chippyash/Math/Type/Calculator/Native.php
Native.intMul
public function intMul(NI $a, NI $b) { list($a, $b) = $this->checkIntTypes($a, $b); return new IntType($a() * $b()); }
php
public function intMul(NI $a, NI $b) { list($a, $b) = $this->checkIntTypes($a, $b); return new IntType($a() * $b()); }
[ "public", "function", "intMul", "(", "NI", "$", "a", ",", "NI", "$", "b", ")", "{", "list", "(", "$", "a", ",", "$", "b", ")", "=", "$", "this", "->", "checkIntTypes", "(", "$", "a", ",", "$", "b", ")", ";", "return", "new", "IntType", "(", ...
Integer type multiplication @param NI $a first operand @param NI $b second operand @return IntType
[ "Integer", "type", "multiplication" ]
train
https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Calculator/Native.php#L84-L89
chippyash/Math-Type-Calculator
src/Chippyash/Math/Type/Calculator/Native.php
Native.intDiv
public function intDiv(NI $a, NI $b) { $ra = RationalTypeFactory::create($a); $rb = RationalTypeFactory::create($b); return $this->rationalDiv($ra, $rb); }
php
public function intDiv(NI $a, NI $b) { $ra = RationalTypeFactory::create($a); $rb = RationalTypeFactory::create($b); return $this->rationalDiv($ra, $rb); }
[ "public", "function", "intDiv", "(", "NI", "$", "a", ",", "NI", "$", "b", ")", "{", "$", "ra", "=", "RationalTypeFactory", "::", "create", "(", "$", "a", ")", ";", "$", "rb", "=", "RationalTypeFactory", "::", "create", "(", "$", "b", ")", ";", "r...
Integer division @param NI $a first operand @param NI $b second operand @return RationalType
[ "Integer", "division" ]
train
https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Calculator/Native.php#L99-L104
chippyash/Math-Type-Calculator
src/Chippyash/Math/Type/Calculator/Native.php
Native.intPow
public function intPow(IntType $a, NI $exp) { if ($exp instanceof RationalType) { $b = new RationalType(clone $a, new IntType(1)); return $this->rationalPow($b, $exp); } if ($exp instanceof ComplexType) { return $this->intComplexPow($a(), $exp); }...
php
public function intPow(IntType $a, NI $exp) { if ($exp instanceof RationalType) { $b = new RationalType(clone $a, new IntType(1)); return $this->rationalPow($b, $exp); } if ($exp instanceof ComplexType) { return $this->intComplexPow($a(), $exp); }...
[ "public", "function", "intPow", "(", "IntType", "$", "a", ",", "NI", "$", "exp", ")", "{", "if", "(", "$", "exp", "instanceof", "RationalType", ")", "{", "$", "b", "=", "new", "RationalType", "(", "clone", "$", "a", ",", "new", "IntType", "(", "1",...
Integer Pow - raise number to the exponent Will return an IntType, RationalType or ComplexType @param IntType $a operand @param NI $exp Exponent @return NI
[ "Integer", "Pow", "-", "raise", "number", "to", "the", "exponent", "Will", "return", "an", "IntType", "RationalType", "or", "ComplexType" ]
train
https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Calculator/Native.php#L115-L133
chippyash/Math-Type-Calculator
src/Chippyash/Math/Type/Calculator/Native.php
Native.intSqrt
public function intSqrt(IntType $a) { $res = $this->rationalSqrt(new RationalType($a, new IntType(1))); if ($res->isInteger()) { return $res->numerator(); } return $res; }
php
public function intSqrt(IntType $a) { $res = $this->rationalSqrt(new RationalType($a, new IntType(1))); if ($res->isInteger()) { return $res->numerator(); } return $res; }
[ "public", "function", "intSqrt", "(", "IntType", "$", "a", ")", "{", "$", "res", "=", "$", "this", "->", "rationalSqrt", "(", "new", "RationalType", "(", "$", "a", ",", "new", "IntType", "(", "1", ")", ")", ")", ";", "if", "(", "$", "res", "->", ...
Integer sqrt Return IntType for perfect squares, else RationalType @param IntType $a operand @return IntType|RationalType result
[ "Integer", "sqrt", "Return", "IntType", "for", "perfect", "squares", "else", "RationalType" ]
train
https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Calculator/Native.php#L143-L151
chippyash/Math-Type-Calculator
src/Chippyash/Math/Type/Calculator/Native.php
Native.floatAdd
public function floatAdd(NI $a, NI $b) { list($a, $b) = $this->checkFloatTypes($a, $b); return new FloatType($a() + $b()); }
php
public function floatAdd(NI $a, NI $b) { list($a, $b) = $this->checkFloatTypes($a, $b); return new FloatType($a() + $b()); }
[ "public", "function", "floatAdd", "(", "NI", "$", "a", ",", "NI", "$", "b", ")", "{", "list", "(", "$", "a", ",", "$", "b", ")", "=", "$", "this", "->", "checkFloatTypes", "(", "$", "a", ",", "$", "b", ")", ";", "return", "new", "FloatType", ...
Float addition @param NI $a first operand @param NI $b second operand @return FloatType
[ "Float", "addition" ]
train
https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Calculator/Native.php#L161-L165
chippyash/Math-Type-Calculator
src/Chippyash/Math/Type/Calculator/Native.php
Native.floatSub
public function floatSub(NI $a, NI $b) { list($a, $b) = $this->checkFloatTypes($a, $b); return new FloatType($a() - $b()); }
php
public function floatSub(NI $a, NI $b) { list($a, $b) = $this->checkFloatTypes($a, $b); return new FloatType($a() - $b()); }
[ "public", "function", "floatSub", "(", "NI", "$", "a", ",", "NI", "$", "b", ")", "{", "list", "(", "$", "a", ",", "$", "b", ")", "=", "$", "this", "->", "checkFloatTypes", "(", "$", "a", ",", "$", "b", ")", ";", "return", "new", "FloatType", ...
Float subtraction @param NI $a first operand @param NI $b second operand @return FloatType
[ "Float", "subtraction" ]
train
https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Calculator/Native.php#L175-L179
chippyash/Math-Type-Calculator
src/Chippyash/Math/Type/Calculator/Native.php
Native.floatMul
public function floatMul(NI $a, NI $b) { list($a, $b) = $this->checkFloatTypes($a, $b); return new FloatType($a() * $b()); }
php
public function floatMul(NI $a, NI $b) { list($a, $b) = $this->checkFloatTypes($a, $b); return new FloatType($a() * $b()); }
[ "public", "function", "floatMul", "(", "NI", "$", "a", ",", "NI", "$", "b", ")", "{", "list", "(", "$", "a", ",", "$", "b", ")", "=", "$", "this", "->", "checkFloatTypes", "(", "$", "a", ",", "$", "b", ")", ";", "return", "new", "FloatType", ...
Float multiplication @param NI $a first operand @param NI $b second operand @return FloatType
[ "Float", "multiplication" ]
train
https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Calculator/Native.php#L189-L193
chippyash/Math-Type-Calculator
src/Chippyash/Math/Type/Calculator/Native.php
Native.floatDiv
public function floatDiv(NI $a, NI $b) { list($a, $b) = $this->checkFloatTypes($a, $b); return new FloatType($a() / $b()); }
php
public function floatDiv(NI $a, NI $b) { list($a, $b) = $this->checkFloatTypes($a, $b); return new FloatType($a() / $b()); }
[ "public", "function", "floatDiv", "(", "NI", "$", "a", ",", "NI", "$", "b", ")", "{", "list", "(", "$", "a", ",", "$", "b", ")", "=", "$", "this", "->", "checkFloatTypes", "(", "$", "a", ",", "$", "b", ")", ";", "return", "new", "FloatType", ...
Float division @param NI $a first operand @param NI $b second operand @return FloatType
[ "Float", "division" ]
train
https://github.com/chippyash/Math-Type-Calculator/blob/2a2fae0ab4d052772d3dd45745efd5a91f88b9e3/src/Chippyash/Math/Type/Calculator/Native.php#L203-L207