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
huasituo/hstcms
src/Hook/HstcmsConfigHook.php
HstcmsConfigHook.getManageMenu
public function getManageMenu($data) { $data['content'] = [ 'name' => hst_lang('hstcms::public.content'), 'ename' => 'content', 'icon' => '', 'url' => '', 'parent' => 'system', 'parents' => '', 'level' => 2, 'mod...
php
public function getManageMenu($data) { $data['content'] = [ 'name' => hst_lang('hstcms::public.content'), 'ename' => 'content', 'icon' => '', 'url' => '', 'parent' => 'system', 'parents' => '', 'level' => 2, 'mod...
[ "public", "function", "getManageMenu", "(", "$", "data", ")", "{", "$", "data", "[", "'content'", "]", "=", "[", "'name'", "=>", "hst_lang", "(", "'hstcms::public.content'", ")", ",", "'ename'", "=>", "'content'", ",", "'icon'", "=>", "''", ",", "'url'", ...
后台菜单钩子 @param array $data 菜单数组 @return array
[ "后台菜单钩子" ]
train
https://github.com/huasituo/hstcms/blob/12819979289e58ce38e3e92540aeeb16e205e525/src/Hook/HstcmsConfigHook.php#L20-L144
huasituo/hstcms
src/Hook/HstcmsConfigHook.php
HstcmsConfigHook.getCommonRoleUri
public function getCommonRoleUri($data) { $data['manageHookIndex'] = [ 'name' => hst_lang('hstcms::public.manage'), 'remark' => 'HOOK', 'ename' => 'manageHookIndex', 'uri' => 'hook', 'parent' => 'manageHookIndex', 'module' => 'manage' ...
php
public function getCommonRoleUri($data) { $data['manageHookIndex'] = [ 'name' => hst_lang('hstcms::public.manage'), 'remark' => 'HOOK', 'ename' => 'manageHookIndex', 'uri' => 'hook', 'parent' => 'manageHookIndex', 'module' => 'manage' ...
[ "public", "function", "getCommonRoleUri", "(", "$", "data", ")", "{", "$", "data", "[", "'manageHookIndex'", "]", "=", "[", "'name'", "=>", "hst_lang", "(", "'hstcms::public.manage'", ")", ",", "'remark'", "=>", "'HOOK'", ",", "'ename'", "=>", "'manageHookInde...
后台权限点 @param array $data 数组 @return array
[ "后台权限点" ]
train
https://github.com/huasituo/hstcms/blob/12819979289e58ce38e3e92540aeeb16e205e525/src/Hook/HstcmsConfigHook.php#L152-L699
sanpii/assetic
src/Assetic/Filter/StylusFilter.php
StylusFilter.filterLoad
public function filterLoad(AssetInterface $asset) { static $format = <<<'EOF' var stylus = require('stylus'); var sys = require(process.binding('natives').util ? 'util' : 'sys'); stylus(%s, %s)%s.render(function(e, css){ if (e) { throw e; } sys.print(css); process.exit(0); }); ...
php
public function filterLoad(AssetInterface $asset) { static $format = <<<'EOF' var stylus = require('stylus'); var sys = require(process.binding('natives').util ? 'util' : 'sys'); stylus(%s, %s)%s.render(function(e, css){ if (e) { throw e; } sys.print(css); process.exit(0); }); ...
[ "public", "function", "filterLoad", "(", "AssetInterface", "$", "asset", ")", "{", "static", "$", "format", "=", " <<<'EOF'\nvar stylus = require('stylus');\nvar sys = require(process.binding('natives').util ? 'util' : 'sys');\n\nstylus(%s, %s)%s.render(function(e, css){\n if (e) {\n...
{@inheritdoc}
[ "{" ]
train
https://github.com/sanpii/assetic/blob/5c446eee54cc396cbbd6e252108f430e6e617c95/src/Assetic/Filter/StylusFilter.php#L67-L113
keiosweb/moneyright
src/Money.php
Money.unserialize
public function unserialize($serialized) { $unserialized = unserialize($serialized); $this->amount = $unserialized['amount']; $this->currency = unserialize($unserialized['currency']); }
php
public function unserialize($serialized) { $unserialized = unserialize($serialized); $this->amount = $unserialized['amount']; $this->currency = unserialize($unserialized['currency']); }
[ "public", "function", "unserialize", "(", "$", "serialized", ")", "{", "$", "unserialized", "=", "unserialize", "(", "$", "serialized", ")", ";", "$", "this", "->", "amount", "=", "$", "unserialized", "[", "'amount'", "]", ";", "$", "this", "->", "curren...
Unserializing Money value object @param string $serialized
[ "Unserializing", "Money", "value", "object" ]
train
https://github.com/keiosweb/moneyright/blob/6c6d8ce34e37e42aa1eebbf45a949bbae6b44780/src/Money.php#L126-L132
keiosweb/moneyright
src/Money.php
Money.getAmountBasic
public function getAmountBasic($roundingMode = self::ROUND_HALF_UP) { return Math::bcround($this->amount, self::BASIC_PRECISION, $roundingMode); }
php
public function getAmountBasic($roundingMode = self::ROUND_HALF_UP) { return Math::bcround($this->amount, self::BASIC_PRECISION, $roundingMode); }
[ "public", "function", "getAmountBasic", "(", "$", "roundingMode", "=", "self", "::", "ROUND_HALF_UP", ")", "{", "return", "Math", "::", "bcround", "(", "$", "this", "->", "amount", ",", "self", "::", "BASIC_PRECISION", ",", "$", "roundingMode", ")", ";", "...
Useful for payment systems that don't use high precision @param int $roundingMode @return string
[ "Useful", "for", "payment", "systems", "that", "don", "t", "use", "high", "precision" ]
train
https://github.com/keiosweb/moneyright/blob/6c6d8ce34e37e42aa1eebbf45a949bbae6b44780/src/Money.php#L174-L177
keiosweb/moneyright
src/Money.php
Money.compare
public function compare(Money $other) { $this->assertSameCurrency($other); return bccomp($this->amount, $other->getAmountString(), self::GAAP_PRECISION); }
php
public function compare(Money $other) { $this->assertSameCurrency($other); return bccomp($this->amount, $other->getAmountString(), self::GAAP_PRECISION); }
[ "public", "function", "compare", "(", "Money", "$", "other", ")", "{", "$", "this", "->", "assertSameCurrency", "(", "$", "other", ")", ";", "return", "bccomp", "(", "$", "this", "->", "amount", ",", "$", "other", "->", "getAmountString", "(", ")", ","...
@param \Keios\MoneyRight\Money $other @return int @throws \Keios\MoneyRight\Exceptions\InvalidArgumentException
[ "@param", "\\", "Keios", "\\", "MoneyRight", "\\", "Money", "$other" ]
train
https://github.com/keiosweb/moneyright/blob/6c6d8ce34e37e42aa1eebbf45a949bbae6b44780/src/Money.php#L266-L271
keiosweb/moneyright
src/Money.php
Money.add
public function add(Money $addend) { $this->assertSameCurrency($addend); return new Money(bcadd($this->amount, $addend->getAmountString(), self::GAAP_PRECISION), $this->currency); }
php
public function add(Money $addend) { $this->assertSameCurrency($addend); return new Money(bcadd($this->amount, $addend->getAmountString(), self::GAAP_PRECISION), $this->currency); }
[ "public", "function", "add", "(", "Money", "$", "addend", ")", "{", "$", "this", "->", "assertSameCurrency", "(", "$", "addend", ")", ";", "return", "new", "Money", "(", "bcadd", "(", "$", "this", "->", "amount", ",", "$", "addend", "->", "getAmountStr...
@param \Keios\MoneyRight\Money $addend @return \Keios\MoneyRight\Money @throws \Keios\MoneyRight\Exceptions\InvalidArgumentException
[ "@param", "\\", "Keios", "\\", "MoneyRight", "\\", "Money", "$addend" ]
train
https://github.com/keiosweb/moneyright/blob/6c6d8ce34e37e42aa1eebbf45a949bbae6b44780/src/Money.php#L279-L284
keiosweb/moneyright
src/Money.php
Money.subtract
public function subtract(Money $subtrahend) { $this->assertSameCurrency($subtrahend); return new Money(bcsub($this->amount, $subtrahend->getAmountString(), self::GAAP_PRECISION), $this->currency); }
php
public function subtract(Money $subtrahend) { $this->assertSameCurrency($subtrahend); return new Money(bcsub($this->amount, $subtrahend->getAmountString(), self::GAAP_PRECISION), $this->currency); }
[ "public", "function", "subtract", "(", "Money", "$", "subtrahend", ")", "{", "$", "this", "->", "assertSameCurrency", "(", "$", "subtrahend", ")", ";", "return", "new", "Money", "(", "bcsub", "(", "$", "this", "->", "amount", ",", "$", "subtrahend", "->"...
@param \Keios\MoneyRight\Money $subtrahend @return \Keios\MoneyRight\Money @throws \Keios\MoneyRight\Exceptions\InvalidArgumentException
[ "@param", "\\", "Keios", "\\", "MoneyRight", "\\", "Money", "$subtrahend" ]
train
https://github.com/keiosweb/moneyright/blob/6c6d8ce34e37e42aa1eebbf45a949bbae6b44780/src/Money.php#L292-L297
keiosweb/moneyright
src/Money.php
Money.multiply
public function multiply($operand, $roundingMode = self::ROUND_HALF_UP, $useGaapPrecision = false) { $this->assertOperand($operand); $validatedOperand = $this->normalizeOperand($operand); if ($useGaapPrecision) { $amount = Math::bcround( bcmul($this->amount, $va...
php
public function multiply($operand, $roundingMode = self::ROUND_HALF_UP, $useGaapPrecision = false) { $this->assertOperand($operand); $validatedOperand = $this->normalizeOperand($operand); if ($useGaapPrecision) { $amount = Math::bcround( bcmul($this->amount, $va...
[ "public", "function", "multiply", "(", "$", "operand", ",", "$", "roundingMode", "=", "self", "::", "ROUND_HALF_UP", ",", "$", "useGaapPrecision", "=", "false", ")", "{", "$", "this", "->", "assertOperand", "(", "$", "operand", ")", ";", "$", "validatedOpe...
Multiplying compatible with Verraes' Money To use GAAP precision rounding, pass true as third argument @param $operand @param int $roundingMode @param bool $useGaapPrecision @return \Keios\MoneyRight\Money @throws \Keios\MoneyRight\Exceptions\InvalidArgumentException
[ "Multiplying", "compatible", "with", "Verraes", "Money", "To", "use", "GAAP", "precision", "rounding", "pass", "true", "as", "third", "argument" ]
train
https://github.com/keiosweb/moneyright/blob/6c6d8ce34e37e42aa1eebbf45a949bbae6b44780/src/Money.php#L310-L331
keiosweb/moneyright
src/Money.php
Money.divide
public function divide($operand, $roundingMode = self::ROUND_HALF_UP, $useGaapPrecision = false) { $this->assertOperand($operand, true); $validatedOperand = $this->normalizeOperand($operand); if ($useGaapPrecision) { $amount = Math::bcround( bcdiv($this->amount,...
php
public function divide($operand, $roundingMode = self::ROUND_HALF_UP, $useGaapPrecision = false) { $this->assertOperand($operand, true); $validatedOperand = $this->normalizeOperand($operand); if ($useGaapPrecision) { $amount = Math::bcround( bcdiv($this->amount,...
[ "public", "function", "divide", "(", "$", "operand", ",", "$", "roundingMode", "=", "self", "::", "ROUND_HALF_UP", ",", "$", "useGaapPrecision", "=", "false", ")", "{", "$", "this", "->", "assertOperand", "(", "$", "operand", ",", "true", ")", ";", "$", ...
Division compatible with Verraes' Money To use GAAP precision rounding, pass true as third argument @param $operand @param int $roundingMode @param bool $useGaapPrecision @return \Keios\MoneyRight\Money @throws \Keios\MoneyRight\Exceptions\InvalidArgumentException
[ "Division", "compatible", "with", "Verraes", "Money", "To", "use", "GAAP", "precision", "rounding", "pass", "true", "as", "third", "argument" ]
train
https://github.com/keiosweb/moneyright/blob/6c6d8ce34e37e42aa1eebbf45a949bbae6b44780/src/Money.php#L344-L365
keiosweb/moneyright
src/Money.php
Money.allocate
public function allocate(array $ratios, $useGaapPrecision = false) { $useGaapPrecision ? $precision = self::GAAP_PRECISION : $precision = self::BASIC_PRECISION; $remainder = $this->amount; $results = []; $total = array_sum($ratios); foreach ($ratios as $ratio) { ...
php
public function allocate(array $ratios, $useGaapPrecision = false) { $useGaapPrecision ? $precision = self::GAAP_PRECISION : $precision = self::BASIC_PRECISION; $remainder = $this->amount; $results = []; $total = array_sum($ratios); foreach ($ratios as $ratio) { ...
[ "public", "function", "allocate", "(", "array", "$", "ratios", ",", "$", "useGaapPrecision", "=", "false", ")", "{", "$", "useGaapPrecision", "?", "$", "precision", "=", "self", "::", "GAAP_PRECISION", ":", "$", "precision", "=", "self", "::", "BASIC_PRECISI...
Allocate the money according to a list of ratio's Allocation is compatible with Verraes' Money To use GAAP precision rounding, pass true as second argument @param array $ratios List of ratio's @param bool $useGaapPrecision @return array
[ "Allocate", "the", "money", "according", "to", "a", "list", "of", "ratio", "s", "Allocation", "is", "compatible", "with", "Verraes", "Money", "To", "use", "GAAP", "precision", "rounding", "pass", "true", "as", "second", "argument" ]
train
https://github.com/keiosweb/moneyright/blob/6c6d8ce34e37e42aa1eebbf45a949bbae6b44780/src/Money.php#L377-L414
keiosweb/moneyright
src/Money.php
Money.bootWith
private function bootWith($stringAmount) { $this->assertValidAmountString($stringAmount); $this->amount = $this->normalizeAmountFromString($stringAmount); }
php
private function bootWith($stringAmount) { $this->assertValidAmountString($stringAmount); $this->amount = $this->normalizeAmountFromString($stringAmount); }
[ "private", "function", "bootWith", "(", "$", "stringAmount", ")", "{", "$", "this", "->", "assertValidAmountString", "(", "$", "stringAmount", ")", ";", "$", "this", "->", "amount", "=", "$", "this", "->", "normalizeAmountFromString", "(", "$", "stringAmount",...
@param $stringAmount @throws \Keios\MoneyRight\Exceptions\InvalidArgumentException
[ "@param", "$stringAmount" ]
train
https://github.com/keiosweb/moneyright/blob/6c6d8ce34e37e42aa1eebbf45a949bbae6b44780/src/Money.php#L467-L471
keiosweb/moneyright
src/Money.php
Money.normalizeAmountFromString
private function normalizeAmountFromString($stringAmount) { $normalizedAmount = $this->normalizeString($stringAmount); return Math::bcround($normalizedAmount, self::GAAP_PRECISION); }
php
private function normalizeAmountFromString($stringAmount) { $normalizedAmount = $this->normalizeString($stringAmount); return Math::bcround($normalizedAmount, self::GAAP_PRECISION); }
[ "private", "function", "normalizeAmountFromString", "(", "$", "stringAmount", ")", "{", "$", "normalizedAmount", "=", "$", "this", "->", "normalizeString", "(", "$", "stringAmount", ")", ";", "return", "Math", "::", "bcround", "(", "$", "normalizedAmount", ",", ...
@param $stringAmount @return string
[ "@param", "$stringAmount" ]
train
https://github.com/keiosweb/moneyright/blob/6c6d8ce34e37e42aa1eebbf45a949bbae6b44780/src/Money.php#L498-L503
keiosweb/moneyright
src/Money.php
Money.isSameAmount
private function isSameAmount(Money $other) { return bccomp($this->getAmountString(), $other->getAmountString(), self::GAAP_PRECISION) === 0; }
php
private function isSameAmount(Money $other) { return bccomp($this->getAmountString(), $other->getAmountString(), self::GAAP_PRECISION) === 0; }
[ "private", "function", "isSameAmount", "(", "Money", "$", "other", ")", "{", "return", "bccomp", "(", "$", "this", "->", "getAmountString", "(", ")", ",", "$", "other", "->", "getAmountString", "(", ")", ",", "self", "::", "GAAP_PRECISION", ")", "===", "...
@param \Keios\MoneyRight\Money $other @return bool
[ "@param", "\\", "Keios", "\\", "MoneyRight", "\\", "Money", "$other" ]
train
https://github.com/keiosweb/moneyright/blob/6c6d8ce34e37e42aa1eebbf45a949bbae6b44780/src/Money.php#L510-L513
keiosweb/moneyright
src/Money.php
Money.assertSameCurrency
private function assertSameCurrency(Money $other) { if (!$this->isSameCurrency($other)) { throw new InvalidArgumentException( sprintf( 'Cannot add Money with different currency. Have: %s, given: %s.', $this->currency->getIsoCode(), ...
php
private function assertSameCurrency(Money $other) { if (!$this->isSameCurrency($other)) { throw new InvalidArgumentException( sprintf( 'Cannot add Money with different currency. Have: %s, given: %s.', $this->currency->getIsoCode(), ...
[ "private", "function", "assertSameCurrency", "(", "Money", "$", "other", ")", "{", "if", "(", "!", "$", "this", "->", "isSameCurrency", "(", "$", "other", ")", ")", "{", "throw", "new", "InvalidArgumentException", "(", "sprintf", "(", "'Cannot add Money with d...
@param \Keios\MoneyRight\Money $other @throws \Keios\MoneyRight\Exceptions\InvalidArgumentException
[ "@param", "\\", "Keios", "\\", "MoneyRight", "\\", "Money", "$other" ]
train
https://github.com/keiosweb/moneyright/blob/6c6d8ce34e37e42aa1eebbf45a949bbae6b44780/src/Money.php#L546-L557
keiosweb/moneyright
src/Money.php
Money.assertOperand
private function assertOperand($operand, $isDivision = false) { if (!is_int($operand) && !is_float($operand) && !is_string($operand)) { throw new InvalidArgumentException( sprintf( 'Operand should be a string, integer or a float, %s of value %s given.', ...
php
private function assertOperand($operand, $isDivision = false) { if (!is_int($operand) && !is_float($operand) && !is_string($operand)) { throw new InvalidArgumentException( sprintf( 'Operand should be a string, integer or a float, %s of value %s given.', ...
[ "private", "function", "assertOperand", "(", "$", "operand", ",", "$", "isDivision", "=", "false", ")", "{", "if", "(", "!", "is_int", "(", "$", "operand", ")", "&&", "!", "is_float", "(", "$", "operand", ")", "&&", "!", "is_string", "(", "$", "opera...
@param int|float $operand @param bool $isDivision @throws \Keios\MoneyRight\Exceptions\InvalidArgumentException
[ "@param", "int|float", "$operand", "@param", "bool", "$isDivision" ]
train
https://github.com/keiosweb/moneyright/blob/6c6d8ce34e37e42aa1eebbf45a949bbae6b44780/src/Money.php#L565-L582
keiosweb/moneyright
src/Money.php
Money.stringToUnits
public static function stringToUnits($string) { new Money($string, new Currency('USD')); // TODO optimize? return (int)bcmul($string, '100', self::GAAP_PRECISION); }
php
public static function stringToUnits($string) { new Money($string, new Currency('USD')); // TODO optimize? return (int)bcmul($string, '100', self::GAAP_PRECISION); }
[ "public", "static", "function", "stringToUnits", "(", "$", "string", ")", "{", "new", "Money", "(", "$", "string", ",", "new", "Currency", "(", "'USD'", ")", ")", ";", "// TODO optimize?", "return", "(", "int", ")", "bcmul", "(", "$", "string", ",", "'...
@param $string @throws \Keios\MoneyRight\Exceptions\InvalidArgumentException @return int
[ "@param", "$string" ]
train
https://github.com/keiosweb/moneyright/blob/6c6d8ce34e37e42aa1eebbf45a949bbae6b44780/src/Money.php#L605-L610
syhol/mrcolor
src/SyHolloway/MrColor/Color.php
Color.bulkUpdate
public function bulkUpdate($values) { foreach ($values as $property => $value) { $this->update($property, $value); } return $this; }
php
public function bulkUpdate($values) { foreach ($values as $property => $value) { $this->update($property, $value); } return $this; }
[ "public", "function", "bulkUpdate", "(", "$", "values", ")", "{", "foreach", "(", "$", "values", "as", "$", "property", "=>", "$", "value", ")", "{", "$", "this", "->", "update", "(", "$", "property", ",", "$", "value", ")", ";", "}", "return", "$"...
Updates the object with multiple values Key value pairs in an array of properties and values, i.e. array( 'red' => 22, 'green => 44 ) @param array $values @return object self
[ "Updates", "the", "object", "with", "multiple", "values" ]
train
https://github.com/syhol/mrcolor/blob/b0cfef8fa3dc52940ff6cb78d19a4fac9e02ef4d/src/SyHolloway/MrColor/Color.php#L111-L118
syhol/mrcolor
src/SyHolloway/MrColor/Color.php
Color.update
public function update($using = 'hex', $value = false) { if ('hex' == $using || 'alpha' == $using) { $this->$using = $value; } $this->hex = $this->formats->update($using, $value, $this->hex); return $this; }
php
public function update($using = 'hex', $value = false) { if ('hex' == $using || 'alpha' == $using) { $this->$using = $value; } $this->hex = $this->formats->update($using, $value, $this->hex); return $this; }
[ "public", "function", "update", "(", "$", "using", "=", "'hex'", ",", "$", "value", "=", "false", ")", "{", "if", "(", "'hex'", "==", "$", "using", "||", "'alpha'", "==", "$", "using", ")", "{", "$", "this", "->", "$", "using", "=", "$", "value",...
Updates the object with a value The property to update is set with the $using var the new value of the property specified is set with the $value var this method syncs all color properties based on the values passed @param string $using @param string $value @return object self
[ "Updates", "the", "object", "with", "a", "value" ]
train
https://github.com/syhol/mrcolor/blob/b0cfef8fa3dc52940ff6cb78d19a4fac9e02ef4d/src/SyHolloway/MrColor/Color.php#L132-L141
movoin/one-swoole
src/Console/OutputStyle.php
OutputStyle.title
public function title(string $message) { $this->style->newLine(); $this->output->writeln(sprintf( '<highlight>>></> <title>%s</>', OutputFormatter::escapeTrailingBackslash(strtoupper($message)) )); $this->style->newLine(); }
php
public function title(string $message) { $this->style->newLine(); $this->output->writeln(sprintf( '<highlight>>></> <title>%s</>', OutputFormatter::escapeTrailingBackslash(strtoupper($message)) )); $this->style->newLine(); }
[ "public", "function", "title", "(", "string", "$", "message", ")", "{", "$", "this", "->", "style", "->", "newLine", "(", ")", ";", "$", "this", "->", "output", "->", "writeln", "(", "sprintf", "(", "'<highlight>>></> <title>%s</>'", ",", "OutputFormatter", ...
输出标题 @param string $message
[ "输出标题" ]
train
https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Console/OutputStyle.php#L53-L61
movoin/one-swoole
src/Console/OutputStyle.php
OutputStyle.section
public function section(string $message) { $this->style->newLine(); $this->output->writeln(sprintf( '<info>>></> <title>%s</>', OutputFormatter::escapeTrailingBackslash($message) )); $this->style->newLine(); }
php
public function section(string $message) { $this->style->newLine(); $this->output->writeln(sprintf( '<info>>></> <title>%s</>', OutputFormatter::escapeTrailingBackslash($message) )); $this->style->newLine(); }
[ "public", "function", "section", "(", "string", "$", "message", ")", "{", "$", "this", "->", "style", "->", "newLine", "(", ")", ";", "$", "this", "->", "output", "->", "writeln", "(", "sprintf", "(", "'<info>>></> <title>%s</>'", ",", "OutputFormatter", "...
输出段落 @param string $message
[ "输出段落" ]
train
https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Console/OutputStyle.php#L68-L76
movoin/one-swoole
src/Console/OutputStyle.php
OutputStyle.result
public function result(string $message, bool $isOk) { if ($isOk) { $this->ok($message); } else { $this->fail($message); } }
php
public function result(string $message, bool $isOk) { if ($isOk) { $this->ok($message); } else { $this->fail($message); } }
[ "public", "function", "result", "(", "string", "$", "message", ",", "bool", "$", "isOk", ")", "{", "if", "(", "$", "isOk", ")", "{", "$", "this", "->", "ok", "(", "$", "message", ")", ";", "}", "else", "{", "$", "this", "->", "fail", "(", "$", ...
输出结果 @param string $message @param bool $isOk
[ "输出结果" ]
train
https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Console/OutputStyle.php#L84-L91
movoin/one-swoole
src/Console/OutputStyle.php
OutputStyle.output
public function output(string $type, string $style, string $message, $status = true) { $text = '....'; if ($status === true) { $text .= '<success>OK</>'; } elseif ($status === false) { $text = ''; } else { $text .= "<info>{$status}</>"; } ...
php
public function output(string $type, string $style, string $message, $status = true) { $text = '....'; if ($status === true) { $text .= '<success>OK</>'; } elseif ($status === false) { $text = ''; } else { $text .= "<info>{$status}</>"; } ...
[ "public", "function", "output", "(", "string", "$", "type", ",", "string", "$", "style", ",", "string", "$", "message", ",", "$", "status", "=", "true", ")", "{", "$", "text", "=", "'....'", ";", "if", "(", "$", "status", "===", "true", ")", "{", ...
输出格式文字 @param string $type @param string $style @param string $message @param mixed $status
[ "输出格式文字" ]
train
https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Console/OutputStyle.php#L123-L145
movoin/one-swoole
src/Console/OutputStyle.php
OutputStyle.formatLine
public function formatLine(string $format, array $item, array $style = []) { foreach ($item as $key => $value) { $value = (isset($style[$key]) && ! empty($style[$key])) ? "<{$style[$key]}>{$value}</>" : $value; $format = str_replace("<{$key}>",...
php
public function formatLine(string $format, array $item, array $style = []) { foreach ($item as $key => $value) { $value = (isset($style[$key]) && ! empty($style[$key])) ? "<{$style[$key]}>{$value}</>" : $value; $format = str_replace("<{$key}>",...
[ "public", "function", "formatLine", "(", "string", "$", "format", ",", "array", "$", "item", ",", "array", "$", "style", "=", "[", "]", ")", "{", "foreach", "(", "$", "item", "as", "$", "key", "=>", "$", "value", ")", "{", "$", "value", "=", "(",...
输出格式行 formatLine( '<foo> > <bar>', [ 'foo' => 'value', 'bar' => 'value' ], [ 'foo' => 'info', 'bar' => 'highlight' ] ); @param string $format @param array $item @param array $style
[ "输出格式行" ]
train
https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Console/OutputStyle.php#L166-L176
bigpaulie/yii2-fancybox
src/FancyBox.php
FancyBox.run
public function run() { if ($this->type == "image") { /** * Add the fancybox image type css class */ if (isset($this->htmlOptions['linkOptions']['class'])) { $class = $this->htmlOptions['linkOptions']['class']; $this->htmlOptions[...
php
public function run() { if ($this->type == "image") { /** * Add the fancybox image type css class */ if (isset($this->htmlOptions['linkOptions']['class'])) { $class = $this->htmlOptions['linkOptions']['class']; $this->htmlOptions[...
[ "public", "function", "run", "(", ")", "{", "if", "(", "$", "this", "->", "type", "==", "\"image\"", ")", "{", "/**\n * Add the fancybox image type css class\n */", "if", "(", "isset", "(", "$", "this", "->", "htmlOptions", "[", "'linkOptio...
Run the widget
[ "Run", "the", "widget" ]
train
https://github.com/bigpaulie/yii2-fancybox/blob/a961789a9ab94b0ebb129f3c6c57489d1298525b/src/FancyBox.php#L37-L104
piqus/bfp4f-rcon
src/T4G/BFP4F/Rcon/Server.php
Server.fetch
public function fetch() { $data = Base::query('bf2cc si'); $spl = explode("\t", $data); $result = array ( 'name' => $spl[7], 'map' => $spl[5], 'playersCurrent' => $spl[3], 'playersMax' => $spl[2], ...
php
public function fetch() { $data = Base::query('bf2cc si'); $spl = explode("\t", $data); $result = array ( 'name' => $spl[7], 'map' => $spl[5], 'playersCurrent' => $spl[3], 'playersMax' => $spl[2], ...
[ "public", "function", "fetch", "(", ")", "{", "$", "data", "=", "Base", "::", "query", "(", "'bf2cc si'", ")", ";", "$", "spl", "=", "explode", "(", "\"\\t\"", ",", "$", "data", ")", ";", "$", "result", "=", "array", "(", "'name'", "=>", "$", "sp...
Fetches Server Info @return object
[ "Fetches", "Server", "Info" ]
train
https://github.com/piqus/bfp4f-rcon/blob/8e94587bc93c686e5a025a54645aed7c701811e6/src/T4G/BFP4F/Rcon/Server.php#L26-L46
avoo/SerializerTranslation
Configuration/Metadata/Driver/XmlDriver.php
XmlDriver.loadMetadataFromFile
protected function loadMetadataFromFile(\ReflectionClass $class, $file) { $previous = libxml_use_internal_errors(true); $root = simplexml_load_file($file); libxml_use_internal_errors($previous); if (false === $root) { throw new XmlErrorException(libxml_get_last_error...
php
protected function loadMetadataFromFile(\ReflectionClass $class, $file) { $previous = libxml_use_internal_errors(true); $root = simplexml_load_file($file); libxml_use_internal_errors($previous); if (false === $root) { throw new XmlErrorException(libxml_get_last_error...
[ "protected", "function", "loadMetadataFromFile", "(", "\\", "ReflectionClass", "$", "class", ",", "$", "file", ")", "{", "$", "previous", "=", "libxml_use_internal_errors", "(", "true", ")", ";", "$", "root", "=", "simplexml_load_file", "(", "$", "file", ")", ...
{@inheritdoc}
[ "{" ]
train
https://github.com/avoo/SerializerTranslation/blob/e66de5482adb944197a36874465ef144b293a157/Configuration/Metadata/Driver/XmlDriver.php#L44-L75
avoo/SerializerTranslation
Configuration/Metadata/Driver/XmlDriver.php
XmlDriver.createOptions
private function createOptions(\SimpleXMLElement $node) { $options = array(); if (isset($node->attributes()->domain)) { $options['domain'] = (string) $node->attributes()->domain; } if (isset($node->attributes()->locale)) { $options['locale'] = (string) $node...
php
private function createOptions(\SimpleXMLElement $node) { $options = array(); if (isset($node->attributes()->domain)) { $options['domain'] = (string) $node->attributes()->domain; } if (isset($node->attributes()->locale)) { $options['locale'] = (string) $node...
[ "private", "function", "createOptions", "(", "\\", "SimpleXMLElement", "$", "node", ")", "{", "$", "options", "=", "array", "(", ")", ";", "if", "(", "isset", "(", "$", "node", "->", "attributes", "(", ")", "->", "domain", ")", ")", "{", "$", "option...
Create options @param \SimpleXMLElement $node @return array
[ "Create", "options" ]
train
https://github.com/avoo/SerializerTranslation/blob/e66de5482adb944197a36874465ef144b293a157/Configuration/Metadata/Driver/XmlDriver.php#L92-L109
drpdigital/json-api-parser
src/JsonApiValidator.php
JsonApiValidator.validator
public function validator($type, $validator) { $this->validators[$type] = $validator; $this->resolver($type, function ($data, $resourceId) use ($type) { /** @var \Drp\JsonApiParser\Contracts\ValidatorExecutor[] $validators */ $validators = Arr::wrap($this->validators[$type])...
php
public function validator($type, $validator) { $this->validators[$type] = $validator; $this->resolver($type, function ($data, $resourceId) use ($type) { /** @var \Drp\JsonApiParser\Contracts\ValidatorExecutor[] $validators */ $validators = Arr::wrap($this->validators[$type])...
[ "public", "function", "validator", "(", "$", "type", ",", "$", "validator", ")", "{", "$", "this", "->", "validators", "[", "$", "type", "]", "=", "$", "validator", ";", "$", "this", "->", "resolver", "(", "$", "type", ",", "function", "(", "$", "d...
Add a validator to be ran when the type is found. @param string $type @param \Drp\JsonApiParser\Contracts\ValidatorExecutor|array $validator @return $this @throws \Drp\JsonApiParser\Exceptions\FailedValidationException
[ "Add", "a", "validator", "to", "be", "ran", "when", "the", "type", "is", "found", "." ]
train
https://github.com/drpdigital/json-api-parser/blob/b1ceefc0c19ec326129126253114c121e97ca943/src/JsonApiValidator.php#L61-L91
drpdigital/json-api-parser
src/JsonApiValidator.php
JsonApiValidator.removeValidator
public function removeValidator($validatorName) { $validators = Arr::wrap($validatorName); $this->resolver->remove($validators); foreach ($validators as $validator) { if (array_key_exists($validator, $this->validators)) { unset($this->validators[$validator]); ...
php
public function removeValidator($validatorName) { $validators = Arr::wrap($validatorName); $this->resolver->remove($validators); foreach ($validators as $validator) { if (array_key_exists($validator, $this->validators)) { unset($this->validators[$validator]); ...
[ "public", "function", "removeValidator", "(", "$", "validatorName", ")", "{", "$", "validators", "=", "Arr", "::", "wrap", "(", "$", "validatorName", ")", ";", "$", "this", "->", "resolver", "->", "remove", "(", "$", "validators", ")", ";", "foreach", "(...
Remove validator(s) @param string|array $validatorName
[ "Remove", "validator", "(", "s", ")" ]
train
https://github.com/drpdigital/json-api-parser/blob/b1ceefc0c19ec326129126253114c121e97ca943/src/JsonApiValidator.php#L98-L108
drpdigital/json-api-parser
src/JsonApiValidator.php
JsonApiValidator.validate
public function validate(array $input) { $result = $this->parse($input); if ($result === null) { throw new InvalidJsonException( 'Parser was unable to process the JSON due to there not being a data key.' ); } if (count($this->seenTypes) > 0) ...
php
public function validate(array $input) { $result = $this->parse($input); if ($result === null) { throw new InvalidJsonException( 'Parser was unable to process the JSON due to there not being a data key.' ); } if (count($this->seenTypes) > 0) ...
[ "public", "function", "validate", "(", "array", "$", "input", ")", "{", "$", "result", "=", "$", "this", "->", "parse", "(", "$", "input", ")", ";", "if", "(", "$", "result", "===", "null", ")", "{", "throw", "new", "InvalidJsonException", "(", "'Par...
Validate input. @param array $input @return bool @throws \Drp\JsonApiParser\Exceptions\FailedValidationException @throws \ReflectionException @throws \Drp\JsonApiParser\Exceptions\MissingResolverException @throws \Drp\JsonApiParser\Exceptions\InvalidJsonException
[ "Validate", "input", "." ]
train
https://github.com/drpdigital/json-api-parser/blob/b1ceefc0c19ec326129126253114c121e97ca943/src/JsonApiValidator.php#L120-L159
drpdigital/json-api-parser
src/JsonApiValidator.php
JsonApiValidator.processResourceData
protected function processResourceData(array $resourceData, array $parentModels, $type) { try { $this->seenTypes[$type] = $resourceData; return parent::processResourceData($resourceData, $parentModels, $type); } catch (MissingResolverException $exception) { } catch (\...
php
protected function processResourceData(array $resourceData, array $parentModels, $type) { try { $this->seenTypes[$type] = $resourceData; return parent::processResourceData($resourceData, $parentModels, $type); } catch (MissingResolverException $exception) { } catch (\...
[ "protected", "function", "processResourceData", "(", "array", "$", "resourceData", ",", "array", "$", "parentModels", ",", "$", "type", ")", "{", "try", "{", "$", "this", "->", "seenTypes", "[", "$", "type", "]", "=", "$", "resourceData", ";", "return", ...
Create model from data given. @param array $resourceData @param array $parentModels @param string $type @return mixed|null
[ "Create", "model", "from", "data", "given", "." ]
train
https://github.com/drpdigital/json-api-parser/blob/b1ceefc0c19ec326129126253114c121e97ca943/src/JsonApiValidator.php#L204-L214
dreamcommerce/common-bundle
src/DreamCommerce/Bundle/CommonBundle/DependencyInjection/DreamCommerceCommonExtension.php
DreamCommerceCommonExtension.load
public function load(array $config, ContainerBuilder $container) { $config = $this->processConfiguration($this->getConfiguration($config, $container), $config); $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); $loader->load('services.xml'); ...
php
public function load(array $config, ContainerBuilder $container) { $config = $this->processConfiguration($this->getConfiguration($config, $container), $config); $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); $loader->load('services.xml'); ...
[ "public", "function", "load", "(", "array", "$", "config", ",", "ContainerBuilder", "$", "container", ")", "{", "$", "config", "=", "$", "this", "->", "processConfiguration", "(", "$", "this", "->", "getConfiguration", "(", "$", "config", ",", "$", "contai...
{@inheritdoc}
[ "{" ]
train
https://github.com/dreamcommerce/common-bundle/blob/adb0850e90e63c3997f10d1ce110bf13a84b63ab/src/DreamCommerce/Bundle/CommonBundle/DependencyInjection/DreamCommerceCommonExtension.php#L27-L39
acasademont/wurfl
WURFL/Xml/DevicePatcher.php
WURFL_Xml_DevicePatcher.patch
public function patch($device, $patchingDevice) { if (!$this->haveSameId($device, $patchingDevice)) { return $patchingDevice; } $groupIdCapabilitiesMap = WURFL_WURFLUtils::array_merge_recursive_unique($device->getGroupIdCapabilitiesMap(), $patchingDevice->getGroupIdCapabilitiesMa...
php
public function patch($device, $patchingDevice) { if (!$this->haveSameId($device, $patchingDevice)) { return $patchingDevice; } $groupIdCapabilitiesMap = WURFL_WURFLUtils::array_merge_recursive_unique($device->getGroupIdCapabilitiesMap(), $patchingDevice->getGroupIdCapabilitiesMa...
[ "public", "function", "patch", "(", "$", "device", ",", "$", "patchingDevice", ")", "{", "if", "(", "!", "$", "this", "->", "haveSameId", "(", "$", "device", ",", "$", "patchingDevice", ")", ")", "{", "return", "$", "patchingDevice", ";", "}", "$", "...
Patch an existing $device with a $patchingDevice @param WURFL_Xml_ModelDevice $device @param WURFL_Xml_ModelDevice $patchingDevice @return WURFL_Xml_ModelDevice Patched device
[ "Patch", "an", "existing", "$device", "with", "a", "$patchingDevice" ]
train
https://github.com/acasademont/wurfl/blob/0f4fb6e06b452ba95ad1d15e7d8226d0974b60c2/WURFL/Xml/DevicePatcher.php#L31-L38
acasademont/wurfl
WURFL/Xml/DevicePatcher.php
WURFL_Xml_DevicePatcher.checkIfCanPatch
private function checkIfCanPatch($device, $patchingDevice) { if (strcmp($patchingDevice->userAgent, $device->userAgent) !== 0) { $message = "Patch Device : " . $patchingDevice->id . " can't override user agent " . $device->userAgent . " with " . $patchingDevice->userAgent; throw new ...
php
private function checkIfCanPatch($device, $patchingDevice) { if (strcmp($patchingDevice->userAgent, $device->userAgent) !== 0) { $message = "Patch Device : " . $patchingDevice->id . " can't override user agent " . $device->userAgent . " with " . $patchingDevice->userAgent; throw new ...
[ "private", "function", "checkIfCanPatch", "(", "$", "device", ",", "$", "patchingDevice", ")", "{", "if", "(", "strcmp", "(", "$", "patchingDevice", "->", "userAgent", ",", "$", "device", "->", "userAgent", ")", "!==", "0", ")", "{", "$", "message", "=",...
Returns true if a $patchingDevice can be used to patch $device @param WURFL_Xml_ModelDevice $device @param WURFL_Xml_ModelDevice $patchingDevice @throws WURFL_WURFLException @return bool @deprecated
[ "Returns", "true", "if", "a", "$patchingDevice", "can", "be", "used", "to", "patch", "$device" ]
train
https://github.com/acasademont/wurfl/blob/0f4fb6e06b452ba95ad1d15e7d8226d0974b60c2/WURFL/Xml/DevicePatcher.php#L59-L65
gbprod/domain-event-bundle
src/DomainEventBundle/Event/Dispatcher.php
Dispatcher.dispatch
public function dispatch(EventProvider $provider) { foreach ($provider->popEvents() as $event) { $this->dispatcher->dispatch( $this->resolveEventName($provider, $event), new Event($event) ); } }
php
public function dispatch(EventProvider $provider) { foreach ($provider->popEvents() as $event) { $this->dispatcher->dispatch( $this->resolveEventName($provider, $event), new Event($event) ); } }
[ "public", "function", "dispatch", "(", "EventProvider", "$", "provider", ")", "{", "foreach", "(", "$", "provider", "->", "popEvents", "(", ")", "as", "$", "event", ")", "{", "$", "this", "->", "dispatcher", "->", "dispatch", "(", "$", "this", "->", "r...
{@inheritdoc}
[ "{" ]
train
https://github.com/gbprod/domain-event-bundle/blob/b2295b46b90778e2023727f97249220a68e35637/src/DomainEventBundle/Event/Dispatcher.php#L33-L41
drunomics/service-utils
src/Core/Session/CurrentUserTrait.php
CurrentUserTrait.getCurrentUser
public function getCurrentUser() { if (empty($this->currentUser)) { $this->currentUser = \Drupal::service('current_user'); } return $this->currentUser; }
php
public function getCurrentUser() { if (empty($this->currentUser)) { $this->currentUser = \Drupal::service('current_user'); } return $this->currentUser; }
[ "public", "function", "getCurrentUser", "(", ")", "{", "if", "(", "empty", "(", "$", "this", "->", "currentUser", ")", ")", "{", "$", "this", "->", "currentUser", "=", "\\", "Drupal", "::", "service", "(", "'current_user'", ")", ";", "}", "return", "$"...
Gets the current user. @return \Drupal\Core\Session\AccountProxyInterface The current user.
[ "Gets", "the", "current", "user", "." ]
train
https://github.com/drunomics/service-utils/blob/56761750043132365ef4ae5d9e0cf4263459328f/src/Core/Session/CurrentUserTrait.php#L38-L43
o2system/filesystem
src/Files/JsonFile.php
JsonFile.readFile
public function readFile($filePath = null, array $options = []) { $filePath = empty($filePath) ? $this->filePath : $filePath; $result = new ArrayIterator(); if (false !== ($contents = json_decode(file_get_contents($filePath), true))) { if (json_...
php
public function readFile($filePath = null, array $options = []) { $filePath = empty($filePath) ? $this->filePath : $filePath; $result = new ArrayIterator(); if (false !== ($contents = json_decode(file_get_contents($filePath), true))) { if (json_...
[ "public", "function", "readFile", "(", "$", "filePath", "=", "null", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "filePath", "=", "empty", "(", "$", "filePath", ")", "?", "$", "this", "->", "filePath", ":", "$", "filePath", ";", "$"...
JsonFile::readFile @param string $filePath Path to the file. @param array $options Read file options. @return mixed
[ "JsonFile", "::", "readFile" ]
train
https://github.com/o2system/filesystem/blob/58f6515f56bcc92408dc155add570c99a0abb6e8/src/Files/JsonFile.php#L40-L57
o2system/filesystem
src/Files/JsonFile.php
JsonFile.writeFile
public function writeFile($filePath = null, array $options = []) { $filePath = empty($filePath) ? $this->filePath : $filePath; if ($this->count()) { return (new File())->write($filePath, json_encode($this->getArrayCopy(), JSON_PRETTY_PRINT)); } ...
php
public function writeFile($filePath = null, array $options = []) { $filePath = empty($filePath) ? $this->filePath : $filePath; if ($this->count()) { return (new File())->write($filePath, json_encode($this->getArrayCopy(), JSON_PRETTY_PRINT)); } ...
[ "public", "function", "writeFile", "(", "$", "filePath", "=", "null", ",", "array", "$", "options", "=", "[", "]", ")", "{", "$", "filePath", "=", "empty", "(", "$", "filePath", ")", "?", "$", "this", "->", "filePath", ":", "$", "filePath", ";", "i...
JsonFile::writeFile @param string $filePath Path to the file. @param array $options Write file options. @return bool Returns TRUE on success or FALSE on failure.
[ "JsonFile", "::", "writeFile" ]
train
https://github.com/o2system/filesystem/blob/58f6515f56bcc92408dc155add570c99a0abb6e8/src/Files/JsonFile.php#L69-L78
seeren/http
src/Response/Response.php
Response.withStatus
public final function withStatus( $code, $reasonPhrase = ""): ResponseInterface { try { $response = $this->with("statusCode", $code); $response->setStatus((int) $code, $reasonPhrase); } catch (InvalidArgumentException $e) { throw new InvalidArgumen...
php
public final function withStatus( $code, $reasonPhrase = ""): ResponseInterface { try { $response = $this->with("statusCode", $code); $response->setStatus((int) $code, $reasonPhrase); } catch (InvalidArgumentException $e) { throw new InvalidArgumen...
[ "public", "final", "function", "withStatus", "(", "$", "code", ",", "$", "reasonPhrase", "=", "\"\"", ")", ":", "ResponseInterface", "{", "try", "{", "$", "response", "=", "$", "this", "->", "with", "(", "\"statusCode\"", ",", "$", "code", ")", ";", "$...
{@inheritDoc} @see \Psr\Http\Message\ResponseInterface::withStatus()
[ "{" ]
train
https://github.com/seeren/http/blob/b5e692e085c41fe25714d17ee90ba78eaf1923c4/src/Response/Response.php#L84-L96
gregorybesson/PlaygroundCore
src/Service/Registry.php
Registry.register
public static function register( $code, $frequency, $callback, array $args = array() ) { if (!is_callable($callback)) { throw new \RuntimeException('The callback must be callable'); } /* * validation of $frequency (cron expression): ...
php
public static function register( $code, $frequency, $callback, array $args = array() ) { if (!is_callable($callback)) { throw new \RuntimeException('The callback must be callable'); } /* * validation of $frequency (cron expression): ...
[ "public", "static", "function", "register", "(", "$", "code", ",", "$", "frequency", ",", "$", "callback", ",", "array", "$", "args", "=", "array", "(", ")", ")", "{", "if", "(", "!", "is_callable", "(", "$", "callback", ")", ")", "{", "throw", "ne...
register a cron job @see Cron::trySchedule() for allowed cron expression syntax @param string $code the cron job code / identifier @param string $frequency cron expression @param callable $callback the actual cron job @param array $args args to the cron job @return self
[ "register", "a", "cron", "job" ]
train
https://github.com/gregorybesson/PlaygroundCore/blob/f8dfa4c7660b54354933b3c28c0cf35304a649df/src/Service/Registry.php#L67-L93
pdefreitas/Laravel-VanillaSSO
src/controllers/VanillaSSOController.php
VanillaSSOController.jsonResponse
public function jsonResponse() { $user = Auth::getUser(); //Change here whatever you need $ssoUser = new SSOUser(); $ssoUser->id = $user->id; $ssoUser->name = $user->username; $ssoUser->email = $user->email; $ssoUser->roles = $user->roles; $ssoUser->p...
php
public function jsonResponse() { $user = Auth::getUser(); //Change here whatever you need $ssoUser = new SSOUser(); $ssoUser->id = $user->id; $ssoUser->name = $user->username; $ssoUser->email = $user->email; $ssoUser->roles = $user->roles; $ssoUser->p...
[ "public", "function", "jsonResponse", "(", ")", "{", "$", "user", "=", "Auth", "::", "getUser", "(", ")", ";", "//Change here whatever you need", "$", "ssoUser", "=", "new", "SSOUser", "(", ")", ";", "$", "ssoUser", "->", "id", "=", "$", "user", "->", ...
Produces jsonResponse. @return Response
[ "Produces", "jsonResponse", "." ]
train
https://github.com/pdefreitas/Laravel-VanillaSSO/blob/f47a7c33eaf392fb6564a909f622b36ffd373759/src/controllers/VanillaSSOController.php#L16-L31
activecollab/databasestructure
src/Field/Composite/AdditionalPropertiesField.php
AdditionalPropertiesField.onAddedToType
public function onAddedToType(TypeInterface &$type) { parent::onAddedToType($type); $type->addTrait(AdditionalPropertiesInterface::class, AdditionalPropertiesInterfaceImplementation::class)->protectFields($this->getName()); }
php
public function onAddedToType(TypeInterface &$type) { parent::onAddedToType($type); $type->addTrait(AdditionalPropertiesInterface::class, AdditionalPropertiesInterfaceImplementation::class)->protectFields($this->getName()); }
[ "public", "function", "onAddedToType", "(", "TypeInterface", "&", "$", "type", ")", "{", "parent", "::", "onAddedToType", "(", "$", "type", ")", ";", "$", "type", "->", "addTrait", "(", "AdditionalPropertiesInterface", "::", "class", ",", "AdditionalPropertiesIn...
Method that is called when field is added to a type. @param TypeInterface $type
[ "Method", "that", "is", "called", "when", "field", "is", "added", "to", "a", "type", "." ]
train
https://github.com/activecollab/databasestructure/blob/4b2353c4422186bcfce63b3212da3e70e63eb5df/src/Field/Composite/AdditionalPropertiesField.php#L53-L58
blast-project/CoreBundle
src/CodeGenerator/CodeGeneratorFactory.php
CodeGeneratorFactory.create
public static function create($class, EntityManager $entityManager) { $rc = new \ReflectionClass($class); $interface = 'Blast\CoreBundle\CodeGenerator\CodeGeneratorInterface'; if (!$rc->implementsInterface($interface)) { throw new \RuntimeException("Class $class should implement ...
php
public static function create($class, EntityManager $entityManager) { $rc = new \ReflectionClass($class); $interface = 'Blast\CoreBundle\CodeGenerator\CodeGeneratorInterface'; if (!$rc->implementsInterface($interface)) { throw new \RuntimeException("Class $class should implement ...
[ "public", "static", "function", "create", "(", "$", "class", ",", "EntityManager", "$", "entityManager", ")", "{", "$", "rc", "=", "new", "\\", "ReflectionClass", "(", "$", "class", ")", ";", "$", "interface", "=", "'Blast\\CoreBundle\\CodeGenerator\\CodeGenerat...
Creates an entity code generator service. @param string $class @param EntityManager $entityManager @return CodeGeneratorInterface
[ "Creates", "an", "entity", "code", "generator", "service", "." ]
train
https://github.com/blast-project/CoreBundle/blob/7a0832758ca14e5bc5d65515532c1220df3930ae/src/CodeGenerator/CodeGeneratorFactory.php#L27-L38
esperecyan/dictionary-php
src/serializer/CatchmSerializer.php
CatchmSerializer.convertToFullwidth
protected function convertToFullwidth(string $str): string { return preg_replace_callback('/[!-~]/u', function (array $matches): string { return \IntlChar::chr(\IntlChar::ord($matches[0]) - (\IntlChar::ord('!') - \IntlChar::ord('!'))); }, $str); }
php
protected function convertToFullwidth(string $str): string { return preg_replace_callback('/[!-~]/u', function (array $matches): string { return \IntlChar::chr(\IntlChar::ord($matches[0]) - (\IntlChar::ord('!') - \IntlChar::ord('!'))); }, $str); }
[ "protected", "function", "convertToFullwidth", "(", "string", "$", "str", ")", ":", "string", "{", "return", "preg_replace_callback", "(", "'/[!-~]/u'", ",", "function", "(", "array", "$", "matches", ")", ":", "string", "{", "return", "\\", "IntlChar", "::", ...
スペースを除くASCII印字可能文字を、対応する全角形に置き換えます。 @param string $str @return string
[ "スペースを除くASCII印字可能文字を、対応する全角形に置き換えます。" ]
train
https://github.com/esperecyan/dictionary-php/blob/14fad08fb43006995c763094e8e7ed0dc0e26676/src/serializer/CatchmSerializer.php#L13-L18
esperecyan/dictionary-php
src/serializer/CatchmSerializer.php
CatchmSerializer.serializeWord
protected function serializeWord(array $word): string { if (!isset($word['type'][0]) || $word['type'][0] !== 'selection') { $answers = $this->getOrderedAnswers($word); if ($answers) { $output = implode(',', array_map((function (string $answer, int $key): string { ...
php
protected function serializeWord(array $word): string { if (!isset($word['type'][0]) || $word['type'][0] !== 'selection') { $answers = $this->getOrderedAnswers($word); if ($answers) { $output = implode(',', array_map((function (string $answer, int $key): string { ...
[ "protected", "function", "serializeWord", "(", "array", "$", "word", ")", ":", "string", "{", "if", "(", "!", "isset", "(", "$", "word", "[", "'type'", "]", "[", "0", "]", ")", "||", "$", "word", "[", "'type'", "]", "[", "0", "]", "!==", "'select...
一つのお題を表す配列を直列化します。 @param (string|string[]|float)[][] $word @return string 末尾に改行 (CRLF) を含みます。直列化できないお題だった場合は空文字列を返します。
[ "一つのお題を表す配列を直列化します。" ]
train
https://github.com/esperecyan/dictionary-php/blob/14fad08fb43006995c763094e8e7ed0dc0e26676/src/serializer/CatchmSerializer.php#L25-L66
discophp/framework
core/classes/Request.class.php
Request.pathPart
public function pathPart($i){ if(isset($this->pathParts[$i])){ return $this->pathParts[$i]; }//if return null; }
php
public function pathPart($i){ if(isset($this->pathParts[$i])){ return $this->pathParts[$i]; }//if return null; }
[ "public", "function", "pathPart", "(", "$", "i", ")", "{", "if", "(", "isset", "(", "$", "this", "->", "pathParts", "[", "$", "i", "]", ")", ")", "{", "return", "$", "this", "->", "pathParts", "[", "$", "i", "]", ";", "}", "//if", "return", "nu...
Get a part of the path by index. @param int $i The index of the path part. @return string
[ "Get", "a", "part", "of", "the", "path", "by", "index", "." ]
train
https://github.com/discophp/framework/blob/40ff3ea5225810534195494dc6c21083da4d1356/core/classes/Request.class.php#L178-L183
czim/laravel-pxlcms
src/Helpers/Paths.php
Paths.images
public static function images($file = null, $secure = false) { return asset(self::appendToPath(config('pxlcms.paths.images'), $file), $secure); }
php
public static function images($file = null, $secure = false) { return asset(self::appendToPath(config('pxlcms.paths.images'), $file), $secure); }
[ "public", "static", "function", "images", "(", "$", "file", "=", "null", ",", "$", "secure", "=", "false", ")", "{", "return", "asset", "(", "self", "::", "appendToPath", "(", "config", "(", "'pxlcms.paths.images'", ")", ",", "$", "file", ")", ",", "$"...
External path to CMS images @param string $file file to add to path @param bool $secure @return string
[ "External", "path", "to", "CMS", "images" ]
train
https://github.com/czim/laravel-pxlcms/blob/910297d2a3f2db86dde51b0e10fe5aad45f1aa1a/src/Helpers/Paths.php#L13-L16
czim/laravel-pxlcms
src/Helpers/Paths.php
Paths.imagesInternal
public static function imagesInternal($file = null) { return base_path( self::appendToPath( self::appendToPath(config('pxlcms.paths.base_internal'), config('pxlcms.paths.images')), $file ) ); }
php
public static function imagesInternal($file = null) { return base_path( self::appendToPath( self::appendToPath(config('pxlcms.paths.base_internal'), config('pxlcms.paths.images')), $file ) ); }
[ "public", "static", "function", "imagesInternal", "(", "$", "file", "=", "null", ")", "{", "return", "base_path", "(", "self", "::", "appendToPath", "(", "self", "::", "appendToPath", "(", "config", "(", "'pxlcms.paths.base_internal'", ")", ",", "config", "(",...
Internal path to CMS images @param string $file file to add to path @return string
[ "Internal", "path", "to", "CMS", "images" ]
train
https://github.com/czim/laravel-pxlcms/blob/910297d2a3f2db86dde51b0e10fe5aad45f1aa1a/src/Helpers/Paths.php#L24-L32
czim/laravel-pxlcms
src/Helpers/Paths.php
Paths.uploadsInternal
public static function uploadsInternal($file = null) { return base_path( self::appendToPath( self::appendToPath(config('pxlcms.paths.base_internal'), config('pxlcms.paths.files')), $file ) ); }
php
public static function uploadsInternal($file = null) { return base_path( self::appendToPath( self::appendToPath(config('pxlcms.paths.base_internal'), config('pxlcms.paths.files')), $file ) ); }
[ "public", "static", "function", "uploadsInternal", "(", "$", "file", "=", "null", ")", "{", "return", "base_path", "(", "self", "::", "appendToPath", "(", "self", "::", "appendToPath", "(", "config", "(", "'pxlcms.paths.base_internal'", ")", ",", "config", "("...
Internal path to CMS uploads / files @param string $file file to add to path @return string
[ "Internal", "path", "to", "CMS", "uploads", "/", "files" ]
train
https://github.com/czim/laravel-pxlcms/blob/910297d2a3f2db86dde51b0e10fe5aad45f1aa1a/src/Helpers/Paths.php#L52-L60
czim/laravel-pxlcms
src/Helpers/Paths.php
Paths.appendToPath
protected static function appendToPath($path, $file) { if (empty($file)) return $path; return rtrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $file; }
php
protected static function appendToPath($path, $file) { if (empty($file)) return $path; return rtrim($path, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . $file; }
[ "protected", "static", "function", "appendToPath", "(", "$", "path", ",", "$", "file", ")", "{", "if", "(", "empty", "(", "$", "file", ")", ")", "return", "$", "path", ";", "return", "rtrim", "(", "$", "path", ",", "DIRECTORY_SEPARATOR", ")", ".", "D...
Append a subpath or file to a path @param string $path @param string $file @return string
[ "Append", "a", "subpath", "or", "file", "to", "a", "path" ]
train
https://github.com/czim/laravel-pxlcms/blob/910297d2a3f2db86dde51b0e10fe5aad45f1aa1a/src/Helpers/Paths.php#L69-L74
kiwiz/ecl
src/Util.php
Util.get
public static function get($arr, $key, $default=null) { return self::exists($arr, $key) ? $arr[$key]:$default; }
php
public static function get($arr, $key, $default=null) { return self::exists($arr, $key) ? $arr[$key]:$default; }
[ "public", "static", "function", "get", "(", "$", "arr", ",", "$", "key", ",", "$", "default", "=", "null", ")", "{", "return", "self", "::", "exists", "(", "$", "arr", ",", "$", "key", ")", "?", "$", "arr", "[", "$", "key", "]", ":", "$", "de...
Return the value of a key or a default value. @param array|\ArrayAccess $arr The array. @param string|int $key The key. @param mixed $default The default value to return. @return mixed|null The value of that key.
[ "Return", "the", "value", "of", "a", "key", "or", "a", "default", "value", "." ]
train
https://github.com/kiwiz/ecl/blob/6536dd2a4c1905a08cf718bdbef56a22f0e9b488/src/Util.php#L18-L20
kiwiz/ecl
src/Util.php
Util.exists
public static function exists($arr, $key) { // If it's an object, index directly because array_key_exists doesn't // work with the ArrayAccess interface. Otherwise, check if it implements // ArrayAccess and fall back to array_key_exists. if(is_object($arr)) { return $arr->off...
php
public static function exists($arr, $key) { // If it's an object, index directly because array_key_exists doesn't // work with the ArrayAccess interface. Otherwise, check if it implements // ArrayAccess and fall back to array_key_exists. if(is_object($arr)) { return $arr->off...
[ "public", "static", "function", "exists", "(", "$", "arr", ",", "$", "key", ")", "{", "// If it's an object, index directly because array_key_exists doesn't", "// work with the ArrayAccess interface. Otherwise, check if it implements", "// ArrayAccess and fall back to array_key_exists.",...
Determines whether an array contains a certain key. @param array|\ArrayAccess $arr The array. @param string|int $key The key. @return bool true if the key exists and false otherwise.
[ "Determines", "whether", "an", "array", "contains", "a", "certain", "key", "." ]
train
https://github.com/kiwiz/ecl/blob/6536dd2a4c1905a08cf718bdbef56a22f0e9b488/src/Util.php#L28-L40
kiwiz/ecl
src/Util.php
Util.pluck
public static function pluck($arr, $path) { $ret = []; $path = (array) $path; foreach($arr as $v) { $node = &$v; $ok = true; foreach($path as $part) { if(!is_array($node) || !array_key_exists($part, $node)) { $ok = false; ...
php
public static function pluck($arr, $path) { $ret = []; $path = (array) $path; foreach($arr as $v) { $node = &$v; $ok = true; foreach($path as $part) { if(!is_array($node) || !array_key_exists($part, $node)) { $ok = false; ...
[ "public", "static", "function", "pluck", "(", "$", "arr", ",", "$", "path", ")", "{", "$", "ret", "=", "[", "]", ";", "$", "path", "=", "(", "array", ")", "$", "path", ";", "foreach", "(", "$", "arr", "as", "$", "v", ")", "{", "$", "node", ...
Extract values from an array with the given path. @param array $arr @param string|string[]|int $path @return array
[ "Extract", "values", "from", "an", "array", "with", "the", "given", "path", "." ]
train
https://github.com/kiwiz/ecl/blob/6536dd2a4c1905a08cf718bdbef56a22f0e9b488/src/Util.php#L48-L68
Graphiques-Digitale/silverstripe-seo-metadata
code/SEO_Metadata_SiteConfig_DataExtension.php
SEO_Metadata_SiteConfig_DataExtension.Charset
public function Charset() { return ($this->owner->config()->Charset) ? $this->owner->config()->Charset : self::$Charset; }
php
public function Charset() { return ($this->owner->config()->Charset) ? $this->owner->config()->Charset : self::$Charset; }
[ "public", "function", "Charset", "(", ")", "{", "return", "(", "$", "this", "->", "owner", "->", "config", "(", ")", "->", "Charset", ")", "?", "$", "this", "->", "owner", "->", "config", "(", ")", "->", "Charset", ":", "self", "::", "$", "Charset"...
Character set. Gets the character set from configuration, or uses the class-defined default. @return string
[ "Character", "set", "." ]
train
https://github.com/Graphiques-Digitale/silverstripe-seo-metadata/blob/f92128688a60b6c6b514b6efb1486ac60f4a8e03/code/SEO_Metadata_SiteConfig_DataExtension.php#L162-L165
Graphiques-Digitale/silverstripe-seo-metadata
code/SEO_Metadata_SiteConfig_DataExtension.php
SEO_Metadata_SiteConfig_DataExtension.getTitleFields
public function getTitleFields() { return array( // Information LabelField::create('FaviconDescription', 'A title tag is the main text that describes an online document. Title elements have long been considered one of the most important on-page SEO elements (the most important being over...
php
public function getTitleFields() { return array( // Information LabelField::create('FaviconDescription', 'A title tag is the main text that describes an online document. Title elements have long been considered one of the most important on-page SEO elements (the most important being over...
[ "public", "function", "getTitleFields", "(", ")", "{", "return", "array", "(", "// Information", "LabelField", "::", "create", "(", "'FaviconDescription'", ",", "'A title tag is the main text that describes an online document. Title elements have long been considered one of the most ...
Gets the title fields. This approach for getting fields for updateCMSFields is to be duplicated through all other modules to reduce complexity. @TODO i18n implementation @return array
[ "Gets", "the", "title", "fields", "." ]
train
https://github.com/Graphiques-Digitale/silverstripe-seo-metadata/blob/f92128688a60b6c6b514b6efb1486ac60f4a8e03/code/SEO_Metadata_SiteConfig_DataExtension.php#L215-L240
Graphiques-Digitale/silverstripe-seo-metadata
code/SEO_Metadata_SiteConfig_DataExtension.php
SEO_Metadata_SiteConfig_DataExtension.GenerateTitle
public function GenerateTitle($pageTitle = 'Title Error') { // if there is a site name if ($this->owner->Title) { // title parts, begin with name/title $titles = array($this->owner->Title); // tagline if ($this->owner->Tagline) { arra...
php
public function GenerateTitle($pageTitle = 'Title Error') { // if there is a site name if ($this->owner->Title) { // title parts, begin with name/title $titles = array($this->owner->Title); // tagline if ($this->owner->Tagline) { arra...
[ "public", "function", "GenerateTitle", "(", "$", "pageTitle", "=", "'Title Error'", ")", "{", "// if there is a site name", "if", "(", "$", "this", "->", "owner", "->", "Title", ")", "{", "// title parts, begin with name/title", "$", "titles", "=", "array", "(", ...
Generates HTML title based on configuration settings. @dev Override this function for any custom title functionality. @param string $pageTitle @return string
[ "Generates", "HTML", "title", "based", "on", "configuration", "settings", "." ]
train
https://github.com/Graphiques-Digitale/silverstripe-seo-metadata/blob/f92128688a60b6c6b514b6efb1486ac60f4a8e03/code/SEO_Metadata_SiteConfig_DataExtension.php#L279-L318
movoin/one-swoole
src/Validation/Validators/AbstractValidator.php
AbstractValidator.addError
protected function addError(string $name, array $parameters, string $message = '') { if (array_key_exists('message', $parameters) && Assert::stringNotEmpty($parameters['message']) ) { $message = trim($parameters['message']); } $this->validator->addError(sprin...
php
protected function addError(string $name, array $parameters, string $message = '') { if (array_key_exists('message', $parameters) && Assert::stringNotEmpty($parameters['message']) ) { $message = trim($parameters['message']); } $this->validator->addError(sprin...
[ "protected", "function", "addError", "(", "string", "$", "name", ",", "array", "$", "parameters", ",", "string", "$", "message", "=", "''", ")", "{", "if", "(", "array_key_exists", "(", "'message'", ",", "$", "parameters", ")", "&&", "Assert", "::", "str...
写入错误信息 @param string $name @param array $parameters @param string $message
[ "写入错误信息" ]
train
https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Validation/Validators/AbstractValidator.php#L70-L79
ARCANEDEV/SpamBlocker
src/SpamBlocker.php
SpamBlocker.load
public function load() { $this->checkSource(); $this->spammers = $this->cacheSpammers(function () { return SpammerCollection::load( file($this->source, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES) ); }); return $this; }
php
public function load() { $this->checkSource(); $this->spammers = $this->cacheSpammers(function () { return SpammerCollection::load( file($this->source, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES) ); }); return $this; }
[ "public", "function", "load", "(", ")", "{", "$", "this", "->", "checkSource", "(", ")", ";", "$", "this", "->", "spammers", "=", "$", "this", "->", "cacheSpammers", "(", "function", "(", ")", "{", "return", "SpammerCollection", "::", "load", "(", "fil...
Load spammers. @return self
[ "Load", "spammers", "." ]
train
https://github.com/ARCANEDEV/SpamBlocker/blob/708c9d5363616e0b257451256c4ca9fb9a9ff55f/src/SpamBlocker.php#L183-L194
ARCANEDEV/SpamBlocker
src/SpamBlocker.php
SpamBlocker.isBlocked
public function isBlocked($host) { $host = parse_url($host, PHP_URL_HOST); $host = utf8_encode(trim($host)); if (empty($host)) return false; $fullDomain = $this->getFullDomain($host); $rootDomain = $this->getRootDomain($fullDomain); return $this->spammers() ...
php
public function isBlocked($host) { $host = parse_url($host, PHP_URL_HOST); $host = utf8_encode(trim($host)); if (empty($host)) return false; $fullDomain = $this->getFullDomain($host); $rootDomain = $this->getRootDomain($fullDomain); return $this->spammers() ...
[ "public", "function", "isBlocked", "(", "$", "host", ")", "{", "$", "host", "=", "parse_url", "(", "$", "host", ",", "PHP_URL_HOST", ")", ";", "$", "host", "=", "utf8_encode", "(", "trim", "(", "$", "host", ")", ")", ";", "if", "(", "empty", "(", ...
Check if the given host is blocked. @param string $host @return bool
[ "Check", "if", "the", "given", "host", "is", "blocked", "." ]
train
https://github.com/ARCANEDEV/SpamBlocker/blob/708c9d5363616e0b257451256c4ca9fb9a9ff55f/src/SpamBlocker.php#L259-L273
ARCANEDEV/SpamBlocker
src/SpamBlocker.php
SpamBlocker.getRootDomain
private function getRootDomain($domain) { $domainParts = explode('.', $domain); $count = count($domainParts); return $count > 1 ? $domainParts[$count - 2].'.'.$domainParts[$count - 1] : $domainParts[0]; }
php
private function getRootDomain($domain) { $domainParts = explode('.', $domain); $count = count($domainParts); return $count > 1 ? $domainParts[$count - 2].'.'.$domainParts[$count - 1] : $domainParts[0]; }
[ "private", "function", "getRootDomain", "(", "$", "domain", ")", "{", "$", "domainParts", "=", "explode", "(", "'.'", ",", "$", "domain", ")", ";", "$", "count", "=", "count", "(", "$", "domainParts", ")", ";", "return", "$", "count", ">", "1", "?", ...
Get the root domain. @param string $domain @return string
[ "Get", "the", "root", "domain", "." ]
train
https://github.com/ARCANEDEV/SpamBlocker/blob/708c9d5363616e0b257451256c4ca9fb9a9ff55f/src/SpamBlocker.php#L326-L334
ARCANEDEV/SpamBlocker
src/SpamBlocker.php
SpamBlocker.cacheSpammers
private function cacheSpammers(Closure $callback) { return cache()->remember($this->cacheKey, $this->cacheExpires, $callback); }
php
private function cacheSpammers(Closure $callback) { return cache()->remember($this->cacheKey, $this->cacheExpires, $callback); }
[ "private", "function", "cacheSpammers", "(", "Closure", "$", "callback", ")", "{", "return", "cache", "(", ")", "->", "remember", "(", "$", "this", "->", "cacheKey", ",", "$", "this", "->", "cacheExpires", ",", "$", "callback", ")", ";", "}" ]
Cache the spammers. @param \Closure $callback @return \Arcanedev\SpamBlocker\Entities\SpammerCollection
[ "Cache", "the", "spammers", "." ]
train
https://github.com/ARCANEDEV/SpamBlocker/blob/708c9d5363616e0b257451256c4ca9fb9a9ff55f/src/SpamBlocker.php#L355-L358
stubbles/stubbles-webapp-core
src/main/php/auth/Token.php
Token.create
public static function create(User $user, string $salt): self { return new self(md5($salt . serialize([ $user->name(), $user->firstName(), $user->lastName(), $user->mailAddress(), self::createRandomContent() ]))); }
php
public static function create(User $user, string $salt): self { return new self(md5($salt . serialize([ $user->name(), $user->firstName(), $user->lastName(), $user->mailAddress(), self::createRandomContent() ]))); }
[ "public", "static", "function", "create", "(", "User", "$", "user", ",", "string", "$", "salt", ")", ":", "self", "{", "return", "new", "self", "(", "md5", "(", "$", "salt", ".", "serialize", "(", "[", "$", "user", "->", "name", "(", ")", ",", "$...
creates token for given user @param \stubbles\webapp\auth\User $user user to create token for @param string $salt salt to use for token creation @return \stubbles\webapp\auth\Token
[ "creates", "token", "for", "given", "user" ]
train
https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/auth/Token.php#L43-L52
phossa2/middleware
src/Middleware/Middleware/MiddlewareAbstract.php
MiddlewareAbstract.process
public function process( RequestInterface $request, ResponseInterface $response, DelegateInterface $next = null ) { // before $response = $this->before($request, $response); // next middleware if ($next) { $response = $next->next($request, $respon...
php
public function process( RequestInterface $request, ResponseInterface $response, DelegateInterface $next = null ) { // before $response = $this->before($request, $response); // next middleware if ($next) { $response = $next->next($request, $respon...
[ "public", "function", "process", "(", "RequestInterface", "$", "request", ",", "ResponseInterface", "$", "response", ",", "DelegateInterface", "$", "next", "=", "null", ")", "{", "// before", "$", "response", "=", "$", "this", "->", "before", "(", "$", "requ...
Make process logic clear ! {@inheritDoc}
[ "Make", "process", "logic", "clear", "!" ]
train
https://github.com/phossa2/middleware/blob/518e97ae48077f2c11adcd3c2393830ed7ab7ce7/src/Middleware/Middleware/MiddlewareAbstract.php#L40-L55
sanpii/assetic
src/Assetic/Filter/BaseProcessFilter.php
BaseProcessFilter.createProcessBuilder
protected function createProcessBuilder(array $arguments = array()) { $pb = new Process(implode(' ', $arguments)); if (null !== $this->timeout) { $pb->setTimeout($this->timeout); } return $pb; }
php
protected function createProcessBuilder(array $arguments = array()) { $pb = new Process(implode(' ', $arguments)); if (null !== $this->timeout) { $pb->setTimeout($this->timeout); } return $pb; }
[ "protected", "function", "createProcessBuilder", "(", "array", "$", "arguments", "=", "array", "(", ")", ")", "{", "$", "pb", "=", "new", "Process", "(", "implode", "(", "' '", ",", "$", "arguments", ")", ")", ";", "if", "(", "null", "!==", "$", "thi...
Creates a new process builder. @param array $arguments An optional array of arguments @return Process A new process builder
[ "Creates", "a", "new", "process", "builder", "." ]
train
https://github.com/sanpii/assetic/blob/5c446eee54cc396cbbd6e252108f430e6e617c95/src/Assetic/Filter/BaseProcessFilter.php#L40-L49
wizbii/pipeline
DependencyInjection/WizbiiPipelineExtension.php
WizbiiPipelineExtension.load
public function load(array $configs, ContainerBuilder $container) { $this->container = $container; $configuration = new Configuration(); $this->config = $this->processConfiguration($configuration, $configs); $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/....
php
public function load(array $configs, ContainerBuilder $container) { $this->container = $container; $configuration = new Configuration(); $this->config = $this->processConfiguration($configuration, $configs); $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/....
[ "public", "function", "load", "(", "array", "$", "configs", ",", "ContainerBuilder", "$", "container", ")", "{", "$", "this", "->", "container", "=", "$", "container", ";", "$", "configuration", "=", "new", "Configuration", "(", ")", ";", "$", "this", "-...
{@inheritDoc}
[ "{" ]
train
https://github.com/wizbii/pipeline/blob/8d22b976a53bb52abf0333b62b308ec7127cf414/DependencyInjection/WizbiiPipelineExtension.php#L28-L97
seeren/http
src/Upload/UploadedFile.php
UploadedFile.moveTo
public final function moveTo($targetPath) { $path = str_replace(["/", "\\"], DIRECTORY_SEPARATOR, $targetPath); $lastDirPos = strripos($path, DIRECTORY_SEPARATOR); $dir = $lastDirPos ? substr($path, 0, $lastDirPos + 1) : null; if (!$dir || !is_dir($dir)) { thro...
php
public final function moveTo($targetPath) { $path = str_replace(["/", "\\"], DIRECTORY_SEPARATOR, $targetPath); $lastDirPos = strripos($path, DIRECTORY_SEPARATOR); $dir = $lastDirPos ? substr($path, 0, $lastDirPos + 1) : null; if (!$dir || !is_dir($dir)) { thro...
[ "public", "final", "function", "moveTo", "(", "$", "targetPath", ")", "{", "$", "path", "=", "str_replace", "(", "[", "\"/\"", ",", "\"\\\\\"", "]", ",", "DIRECTORY_SEPARATOR", ",", "$", "targetPath", ")", ";", "$", "lastDirPos", "=", "strripos", "(", "$...
{@inheritDoc} @see \Psr\Http\Message\UploadedFileInterface::moveTo()
[ "{" ]
train
https://github.com/seeren/http/blob/b5e692e085c41fe25714d17ee90ba78eaf1923c4/src/Upload/UploadedFile.php#L106-L126
letyii/yii2-jstree
JsTreeInput.php
JsTreeInput.run
public function run() { $this->registerClientScript(); if ($this->hasModel()) { $input = Html::activeHiddenInput($this->model, $this->attribute, $this->options); } else { $input = Html::hiddenInput($this->name, $this->value, $this->options); } echo s...
php
public function run() { $this->registerClientScript(); if ($this->hasModel()) { $input = Html::activeHiddenInput($this->model, $this->attribute, $this->options); } else { $input = Html::hiddenInput($this->name, $this->value, $this->options); } echo s...
[ "public", "function", "run", "(", ")", "{", "$", "this", "->", "registerClientScript", "(", ")", ";", "if", "(", "$", "this", "->", "hasModel", "(", ")", ")", "{", "$", "input", "=", "Html", "::", "activeHiddenInput", "(", "$", "this", "->", "model",...
Renders the widget.
[ "Renders", "the", "widget", "." ]
train
https://github.com/letyii/yii2-jstree/blob/33bcce6e0109994a86c8ae236cbb9084ee360c45/JsTreeInput.php#L64-L78
letyii/yii2-jstree
JsTreeInput.php
JsTreeInput.registerClientScript
public function registerClientScript() { $inputId = $this->options['id']; $jsTreeId = $this->getJsTreeId(); $options = $this->getClientOptions(); $options = empty($options) ? '' : Json::encode($options); $onChanged = ''; if ($this->onChanged) $onChanged =...
php
public function registerClientScript() { $inputId = $this->options['id']; $jsTreeId = $this->getJsTreeId(); $options = $this->getClientOptions(); $options = empty($options) ? '' : Json::encode($options); $onChanged = ''; if ($this->onChanged) $onChanged =...
[ "public", "function", "registerClientScript", "(", ")", "{", "$", "inputId", "=", "$", "this", "->", "options", "[", "'id'", "]", ";", "$", "jsTreeId", "=", "$", "this", "->", "getJsTreeId", "(", ")", ";", "$", "options", "=", "$", "this", "->", "get...
Registers the needed JavaScript.
[ "Registers", "the", "needed", "JavaScript", "." ]
train
https://github.com/letyii/yii2-jstree/blob/33bcce6e0109994a86c8ae236cbb9084ee360c45/JsTreeInput.php#L83-L108
letyii/yii2-jstree
JsTreeInput.php
JsTreeInput.getClientOptions
protected function getClientOptions() { $options = $this->clientOptions; $options['core']['multiple'] = $this->multiple; if ($this->items !== null) $options['core']['data'] = $this->items; return $options; }
php
protected function getClientOptions() { $options = $this->clientOptions; $options['core']['multiple'] = $this->multiple; if ($this->items !== null) $options['core']['data'] = $this->items; return $options; }
[ "protected", "function", "getClientOptions", "(", ")", "{", "$", "options", "=", "$", "this", "->", "clientOptions", ";", "$", "options", "[", "'core'", "]", "[", "'multiple'", "]", "=", "$", "this", "->", "multiple", ";", "if", "(", "$", "this", "->",...
Returns the options for jstree @return array
[ "Returns", "the", "options", "for", "jstree" ]
train
https://github.com/letyii/yii2-jstree/blob/33bcce6e0109994a86c8ae236cbb9084ee360c45/JsTreeInput.php#L114-L123
crossjoin/Css
src/Crossjoin/Css/Format/Rule/AtNamespace/NamespaceRule.php
NamespaceRule.setPrefix
protected function setPrefix($prefix) { if (is_string($prefix)) { $this->prefix = $prefix; return $this; } else { throw new \InvalidArgumentException( "Invalid type '" . gettype($prefix). "' for argument 'prefix' given." ); } ...
php
protected function setPrefix($prefix) { if (is_string($prefix)) { $this->prefix = $prefix; return $this; } else { throw new \InvalidArgumentException( "Invalid type '" . gettype($prefix). "' for argument 'prefix' given." ); } ...
[ "protected", "function", "setPrefix", "(", "$", "prefix", ")", "{", "if", "(", "is_string", "(", "$", "prefix", ")", ")", "{", "$", "this", "->", "prefix", "=", "$", "prefix", ";", "return", "$", "this", ";", "}", "else", "{", "throw", "new", "\\",...
Sets the namespace prefix. @param string $prefix @return $this
[ "Sets", "the", "namespace", "prefix", "." ]
train
https://github.com/crossjoin/Css/blob/7b50ca94c4bdad60d01cfa327f00b7a600d6f9f3/src/Crossjoin/Css/Format/Rule/AtNamespace/NamespaceRule.php#L73-L84
crossjoin/Css
src/Crossjoin/Css/Format/Rule/AtNamespace/NamespaceRule.php
NamespaceRule.parseRuleString
protected function parseRuleString($ruleString) { if (is_string($ruleString)) { $charset = $this->getCharset(); // Remove at-rule and unnecessary white-spaces $ruleString = preg_replace('/^[ \r\n\t\f]*@namespace[ \r\n\t\f]+/i', '', $ruleString); $ruleString =...
php
protected function parseRuleString($ruleString) { if (is_string($ruleString)) { $charset = $this->getCharset(); // Remove at-rule and unnecessary white-spaces $ruleString = preg_replace('/^[ \r\n\t\f]*@namespace[ \r\n\t\f]+/i', '', $ruleString); $ruleString =...
[ "protected", "function", "parseRuleString", "(", "$", "ruleString", ")", "{", "if", "(", "is_string", "(", "$", "ruleString", ")", ")", "{", "$", "charset", "=", "$", "this", "->", "getCharset", "(", ")", ";", "// Remove at-rule and unnecessary white-spaces", ...
Parses the namespace rule. @param string $ruleString
[ "Parses", "the", "namespace", "rule", "." ]
train
https://github.com/crossjoin/Css/blob/7b50ca94c4bdad60d01cfa327f00b7a600d6f9f3/src/Crossjoin/Css/Format/Rule/AtNamespace/NamespaceRule.php#L101-L188
sibds/yii2-activerecord
ActiveRecord.php
ActiveRecord.duplicate
public function duplicate() { $this->isNewRecord = true; foreach ($this->primaryKey() as $key) { $this->$key = null; } if ($this->save()) { return $this; } return null; }
php
public function duplicate() { $this->isNewRecord = true; foreach ($this->primaryKey() as $key) { $this->$key = null; } if ($this->save()) { return $this; } return null; }
[ "public", "function", "duplicate", "(", ")", "{", "$", "this", "->", "isNewRecord", "=", "true", ";", "foreach", "(", "$", "this", "->", "primaryKey", "(", ")", "as", "$", "key", ")", "{", "$", "this", "->", "$", "key", "=", "null", ";", "}", "if...
Duplicate entries in the table. @return $this|null
[ "Duplicate", "entries", "in", "the", "table", "." ]
train
https://github.com/sibds/yii2-activerecord/blob/806b6b1e07e91e1bb526c61f0dbd17bd82d25f7f/ActiveRecord.php#L124-L135
jjpmann/real-magnet-sdk
src/RealMagnet.php
RealMagnet.addRecipient
public function addRecipient($user) { // AddRecipient $user = new Collection($user); $body = $user->map(function ($v, $k) { return [ucfirst($k) => $v]; })->collapse()->toArray(); // $body = [ // 'Email' => $user->email, // 'FirstName...
php
public function addRecipient($user) { // AddRecipient $user = new Collection($user); $body = $user->map(function ($v, $k) { return [ucfirst($k) => $v]; })->collapse()->toArray(); // $body = [ // 'Email' => $user->email, // 'FirstName...
[ "public", "function", "addRecipient", "(", "$", "user", ")", "{", "// AddRecipient", "$", "user", "=", "new", "Collection", "(", "$", "user", ")", ";", "$", "body", "=", "$", "user", "->", "map", "(", "function", "(", "$", "v", ",", "$", "k", ")", ...
------------------------------------------------------------------------
[ "------------------------------------------------------------------------" ]
train
https://github.com/jjpmann/real-magnet-sdk/blob/b7407a40c5a2ac1554c1c3bf4159186f46ce9ab8/src/RealMagnet.php#L115-L147
jjpmann/real-magnet-sdk
src/RealMagnet.php
RealMagnet.getRecipientGroups
public function getRecipientGroups($ids) { // GetRecipientGroups $body = [ 'RecipientIds' => $ids, ]; $data = $this->setBody($body)->call('GetRecipientGroups'); return $data; }
php
public function getRecipientGroups($ids) { // GetRecipientGroups $body = [ 'RecipientIds' => $ids, ]; $data = $this->setBody($body)->call('GetRecipientGroups'); return $data; }
[ "public", "function", "getRecipientGroups", "(", "$", "ids", ")", "{", "// GetRecipientGroups", "$", "body", "=", "[", "'RecipientIds'", "=>", "$", "ids", ",", "]", ";", "$", "data", "=", "$", "this", "->", "setBody", "(", "$", "body", ")", "->", "call...
/* Call this method to see which groups a recipient belongs to. return array of users if they have groups with ids of groups they belong to
[ "/", "*", "Call", "this", "method", "to", "see", "which", "groups", "a", "recipient", "belongs", "to", ".", "return", "array", "of", "users", "if", "they", "have", "groups", "with", "ids", "of", "groups", "they", "belong", "to" ]
train
https://github.com/jjpmann/real-magnet-sdk/blob/b7407a40c5a2ac1554c1c3bf4159186f46ce9ab8/src/RealMagnet.php#L199-L209
link0/profiler
src/Link0/Profiler/Profiler.php
Profiler.setDefaultPreferredProfileAdapters
private function setDefaultPreferredProfileAdapters($flags, $options) { $this->preferredProfilerAdapters = array( new ProfilerAdapter\UprofilerAdapter($flags, $options), new ProfilerAdapter\XhprofAdapter($flags, $options), new ProfilerAdapter\NullAdapter($flags, $options)...
php
private function setDefaultPreferredProfileAdapters($flags, $options) { $this->preferredProfilerAdapters = array( new ProfilerAdapter\UprofilerAdapter($flags, $options), new ProfilerAdapter\XhprofAdapter($flags, $options), new ProfilerAdapter\NullAdapter($flags, $options)...
[ "private", "function", "setDefaultPreferredProfileAdapters", "(", "$", "flags", ",", "$", "options", ")", "{", "$", "this", "->", "preferredProfilerAdapters", "=", "array", "(", "new", "ProfilerAdapter", "\\", "UprofilerAdapter", "(", "$", "flags", ",", "$", "op...
Sets default preferred profile adapters @param int $flags @param array $options
[ "Sets", "default", "preferred", "profile", "adapters" ]
train
https://github.com/link0/profiler/blob/0573073ff029743734de747619ab65ab2476052d/src/Link0/Profiler/Profiler.php#L69-L76
link0/profiler
src/Link0/Profiler/Profiler.php
Profiler.addInternalIgnoreFunctions
private function addInternalIgnoreFunctions($options) { if(isset($options['ignored_functions']) === false) { $options['ignored_functions'] = array(); } $options['ignored_functions'] = array_merge($options['ignored_functions'], array( 'xhprof_disable', 'Li...
php
private function addInternalIgnoreFunctions($options) { if(isset($options['ignored_functions']) === false) { $options['ignored_functions'] = array(); } $options['ignored_functions'] = array_merge($options['ignored_functions'], array( 'xhprof_disable', 'Li...
[ "private", "function", "addInternalIgnoreFunctions", "(", "$", "options", ")", "{", "if", "(", "isset", "(", "$", "options", "[", "'ignored_functions'", "]", ")", "===", "false", ")", "{", "$", "options", "[", "'ignored_functions'", "]", "=", "array", "(", ...
Adds internal methods for ignored_functions @param array $options @return array $options
[ "Adds", "internal", "methods", "for", "ignored_functions" ]
train
https://github.com/link0/profiler/blob/0573073ff029743734de747619ab65ab2476052d/src/Link0/Profiler/Profiler.php#L84-L105
link0/profiler
src/Link0/Profiler/Profiler.php
Profiler.stop
public function stop() { // Create a new profile based upon the data of the adapter $profile = $this->getProfileFactory()->create( $this->getProfilerAdapter()->stop(), $this->getApplicationData(), $_SERVER // TODO: Don't want to use this directly, do something sma...
php
public function stop() { // Create a new profile based upon the data of the adapter $profile = $this->getProfileFactory()->create( $this->getProfilerAdapter()->stop(), $this->getApplicationData(), $_SERVER // TODO: Don't want to use this directly, do something sma...
[ "public", "function", "stop", "(", ")", "{", "// Create a new profile based upon the data of the adapter", "$", "profile", "=", "$", "this", "->", "getProfileFactory", "(", ")", "->", "create", "(", "$", "this", "->", "getProfilerAdapter", "(", ")", "->", "stop", ...
Stops profiling and persists and returns the Profile object @return Profile
[ "Stops", "profiling", "and", "persists", "and", "returns", "the", "Profile", "object" ]
train
https://github.com/link0/profiler/blob/0573073ff029743734de747619ab65ab2476052d/src/Link0/Profiler/Profiler.php#L254-L268
yosmanyga/resource
src/Yosmanyga/Resource/Transformer/ComposerVendorFileTransformer.php
ComposerVendorFileTransformer.supports
public function supports(Resource $resource, Resource $parentResource) { if ($resource->hasMetadata('file') && 0 === strpos($resource->getMetadata('file'), '@')) { return true; } return false; }
php
public function supports(Resource $resource, Resource $parentResource) { if ($resource->hasMetadata('file') && 0 === strpos($resource->getMetadata('file'), '@')) { return true; } return false; }
[ "public", "function", "supports", "(", "Resource", "$", "resource", ",", "Resource", "$", "parentResource", ")", "{", "if", "(", "$", "resource", "->", "hasMetadata", "(", "'file'", ")", "&&", "0", "===", "strpos", "(", "$", "resource", "->", "getMetadata"...
{@inheritdoc}
[ "{" ]
train
https://github.com/yosmanyga/resource/blob/a8b505c355920a908917a0484f764ddfa63205fa/src/Yosmanyga/Resource/Transformer/ComposerVendorFileTransformer.php#L33-L40
yosmanyga/resource
src/Yosmanyga/Resource/Transformer/ComposerVendorFileTransformer.php
ComposerVendorFileTransformer.transform
public function transform(Resource $resource, Resource $parentResource) { list($vendor, $path) = $this->parseFile($resource->getMetadata('file')); $file = sprintf( '%s/%s/%s%s', dirname(dirname($this->file)), $vendor, $this->resolveSrc($vendor), ...
php
public function transform(Resource $resource, Resource $parentResource) { list($vendor, $path) = $this->parseFile($resource->getMetadata('file')); $file = sprintf( '%s/%s/%s%s', dirname(dirname($this->file)), $vendor, $this->resolveSrc($vendor), ...
[ "public", "function", "transform", "(", "Resource", "$", "resource", ",", "Resource", "$", "parentResource", ")", "{", "list", "(", "$", "vendor", ",", "$", "path", ")", "=", "$", "this", "->", "parseFile", "(", "$", "resource", "->", "getMetadata", "(",...
{@inheritdoc}
[ "{" ]
train
https://github.com/yosmanyga/resource/blob/a8b505c355920a908917a0484f764ddfa63205fa/src/Yosmanyga/Resource/Transformer/ComposerVendorFileTransformer.php#L45-L58
yosmanyga/resource
src/Yosmanyga/Resource/Transformer/ComposerVendorFileTransformer.php
ComposerVendorFileTransformer.parseFile
private function parseFile($file) { $data = sscanf($file, '@%[^:]:%[^?]'); if (empty($data[0])) { throw new \InvalidArgumentException(sprintf('File "%s" has invalid syntax', $file)); } return $data; }
php
private function parseFile($file) { $data = sscanf($file, '@%[^:]:%[^?]'); if (empty($data[0])) { throw new \InvalidArgumentException(sprintf('File "%s" has invalid syntax', $file)); } return $data; }
[ "private", "function", "parseFile", "(", "$", "file", ")", "{", "$", "data", "=", "sscanf", "(", "$", "file", ",", "'@%[^:]:%[^?]'", ")", ";", "if", "(", "empty", "(", "$", "data", "[", "0", "]", ")", ")", "{", "throw", "new", "\\", "InvalidArgumen...
@param string $file @throws \InvalidArgumentException if $file has invalid syntax @return array
[ "@param", "string", "$file" ]
train
https://github.com/yosmanyga/resource/blob/a8b505c355920a908917a0484f764ddfa63205fa/src/Yosmanyga/Resource/Transformer/ComposerVendorFileTransformer.php#L67-L76
yosmanyga/resource
src/Yosmanyga/Resource/Transformer/ComposerVendorFileTransformer.php
ComposerVendorFileTransformer.resolveSrc
private function resolveSrc($vendor) { $src = null; /** @var $packages \Composer\Package\CompletePackage[] */ $packages = $this->repository->getPackages(); foreach ($packages as $package) { if ($vendor == $package->getName()) { $autoload = $package->getAu...
php
private function resolveSrc($vendor) { $src = null; /** @var $packages \Composer\Package\CompletePackage[] */ $packages = $this->repository->getPackages(); foreach ($packages as $package) { if ($vendor == $package->getName()) { $autoload = $package->getAu...
[ "private", "function", "resolveSrc", "(", "$", "vendor", ")", "{", "$", "src", "=", "null", ";", "/** @var $packages \\Composer\\Package\\CompletePackage[] */", "$", "packages", "=", "$", "this", "->", "repository", "->", "getPackages", "(", ")", ";", "foreach", ...
@param string $vendor @throws \InvalidArgumentException if $vendor is not found @return string
[ "@param", "string", "$vendor" ]
train
https://github.com/yosmanyga/resource/blob/a8b505c355920a908917a0484f764ddfa63205fa/src/Yosmanyga/Resource/Transformer/ComposerVendorFileTransformer.php#L85-L105
Nayjest/Tree
src/Tree.php
Tree.build
public function build() { if ($this->updateRequired) { $this->updateRequired = false; foreach ($this->nodes as $node) { if ($node->parent()) { $node->unlock()->detach(); } } $this->root->addChildren($this->bu...
php
public function build() { if ($this->updateRequired) { $this->updateRequired = false; foreach ($this->nodes as $node) { if ($node->parent()) { $node->unlock()->detach(); } } $this->root->addChildren($this->bu...
[ "public", "function", "build", "(", ")", "{", "if", "(", "$", "this", "->", "updateRequired", ")", "{", "$", "this", "->", "updateRequired", "=", "false", ";", "foreach", "(", "$", "this", "->", "nodes", "as", "$", "node", ")", "{", "if", "(", "$",...
Builds tree based on its nodes registry and hierarchy configuration if structure update required.
[ "Builds", "tree", "based", "on", "its", "nodes", "registry", "and", "hierarchy", "configuration", "if", "structure", "update", "required", "." ]
train
https://github.com/Nayjest/Tree/blob/e73da75f939e207b1c25065e9466c28300e7113c/src/Tree.php#L129-L145
Nayjest/Tree
src/Tree.php
Tree.replace
public function replace($nodeName, ChildNodeInterface $node) { $this->removeNodeFromList($nodeName); $this->nodes->set($nodeName, $node); $this->updateRequired = true; return $this; }
php
public function replace($nodeName, ChildNodeInterface $node) { $this->removeNodeFromList($nodeName); $this->nodes->set($nodeName, $node); $this->updateRequired = true; return $this; }
[ "public", "function", "replace", "(", "$", "nodeName", ",", "ChildNodeInterface", "$", "node", ")", "{", "$", "this", "->", "removeNodeFromList", "(", "$", "nodeName", ")", ";", "$", "this", "->", "nodes", "->", "set", "(", "$", "nodeName", ",", "$", "...
Replaces named tree node to new one. @param string $nodeName @param ChildNodeInterface $node @return $this
[ "Replaces", "named", "tree", "node", "to", "new", "one", "." ]
train
https://github.com/Nayjest/Tree/blob/e73da75f939e207b1c25065e9466c28300e7113c/src/Tree.php#L177-L184
Nayjest/Tree
src/Tree.php
Tree.addMany
public function addMany($parentName, array $namedItems, $prepend = false) { foreach ($namedItems as $name => $item) { $this->add($parentName, $name, $item, $prepend); } return $this; }
php
public function addMany($parentName, array $namedItems, $prepend = false) { foreach ($namedItems as $name => $item) { $this->add($parentName, $name, $item, $prepend); } return $this; }
[ "public", "function", "addMany", "(", "$", "parentName", ",", "array", "$", "namedItems", ",", "$", "prepend", "=", "false", ")", "{", "foreach", "(", "$", "namedItems", "as", "$", "name", "=>", "$", "item", ")", "{", "$", "this", "->", "add", "(", ...
Adds multiple nodes to tree. @param string|null $parentName root node will be used if null @param array $namedItems array with nodes where keys are node names @param bool $prepend if true, nodes will be prepended, otherwise appended to parent @return $this
[ "Adds", "multiple", "nodes", "to", "tree", "." ]
train
https://github.com/Nayjest/Tree/blob/e73da75f939e207b1c25065e9466c28300e7113c/src/Tree.php#L194-L201
Nayjest/Tree
src/Tree.php
Tree.move
public function move($nodeName, $newParentName, $prepend = false) { if (!$this->nodes->hasKey($nodeName)) { throw new NodeNotFoundException(); } $node = $this->nodes->get($nodeName); $this->remove($nodeName); $this->add($newParentName, $nodeName, $node, $prepend);...
php
public function move($nodeName, $newParentName, $prepend = false) { if (!$this->nodes->hasKey($nodeName)) { throw new NodeNotFoundException(); } $node = $this->nodes->get($nodeName); $this->remove($nodeName); $this->add($newParentName, $nodeName, $node, $prepend);...
[ "public", "function", "move", "(", "$", "nodeName", ",", "$", "newParentName", ",", "$", "prepend", "=", "false", ")", "{", "if", "(", "!", "$", "this", "->", "nodes", "->", "hasKey", "(", "$", "nodeName", ")", ")", "{", "throw", "new", "NodeNotFound...
Moves node to another parent. @param string $nodeName target node name @param string|null $newParentName parent node name; root will be used if null @param bool $prepend @return $this
[ "Moves", "node", "to", "another", "parent", "." ]
train
https://github.com/Nayjest/Tree/blob/e73da75f939e207b1c25065e9466c28300e7113c/src/Tree.php#L233-L243
Nayjest/Tree
src/Tree.php
Tree.remove
public function remove($nodeName) { $children = self::removeTreeNode($this->hierarchy, $nodeName); // @todo remove all children $this->removeNodeFromList($nodeName); $this->updateRequired = true; return $this; }
php
public function remove($nodeName) { $children = self::removeTreeNode($this->hierarchy, $nodeName); // @todo remove all children $this->removeNodeFromList($nodeName); $this->updateRequired = true; return $this; }
[ "public", "function", "remove", "(", "$", "nodeName", ")", "{", "$", "children", "=", "self", "::", "removeTreeNode", "(", "$", "this", "->", "hierarchy", ",", "$", "nodeName", ")", ";", "// @todo remove all children", "$", "this", "->", "removeNodeFromList", ...
Removes node by its name. @param string $nodeName @return $this
[ "Removes", "node", "by", "its", "name", "." ]
train
https://github.com/Nayjest/Tree/blob/e73da75f939e207b1c25065e9466c28300e7113c/src/Tree.php#L252-L260
Nayjest/Tree
src/Tree.php
Tree.add
protected function add($parentName = null, $nodeName, ChildNodeInterface $node, $prepend = false) { if (!self::addTreeNode($this->hierarchy, $parentName, $nodeName, $prepend)) { throw new NodeNotFoundException( "Can't add '$nodeName' node to '$parentName': '$parentName' node not ...
php
protected function add($parentName = null, $nodeName, ChildNodeInterface $node, $prepend = false) { if (!self::addTreeNode($this->hierarchy, $parentName, $nodeName, $prepend)) { throw new NodeNotFoundException( "Can't add '$nodeName' node to '$parentName': '$parentName' node not ...
[ "protected", "function", "add", "(", "$", "parentName", "=", "null", ",", "$", "nodeName", ",", "ChildNodeInterface", "$", "node", ",", "$", "prepend", "=", "false", ")", "{", "if", "(", "!", "self", "::", "addTreeNode", "(", "$", "this", "->", "hierar...
Adds new tree node. If node exists, replaces it. @param string|null $parentName root if null @param string $nodeName new node name @param ChildNodeInterface $node @return $this
[ "Adds", "new", "tree", "node", ".", "If", "node", "exists", "replaces", "it", "." ]
train
https://github.com/Nayjest/Tree/blob/e73da75f939e207b1c25065e9466c28300e7113c/src/Tree.php#L271-L283
Nayjest/Tree
src/Tree.php
Tree.addTreeNode
private static function addTreeNode(array &$tree, $parent, $node, $prepend = false) { if ($parent === null) { if (array_key_exists($node, $tree)) { throw new \Exception('Node already exists'); } if ($prepend) { $tree = array_merge([$node =>...
php
private static function addTreeNode(array &$tree, $parent, $node, $prepend = false) { if ($parent === null) { if (array_key_exists($node, $tree)) { throw new \Exception('Node already exists'); } if ($prepend) { $tree = array_merge([$node =>...
[ "private", "static", "function", "addTreeNode", "(", "array", "&", "$", "tree", ",", "$", "parent", ",", "$", "node", ",", "$", "prepend", "=", "false", ")", "{", "if", "(", "$", "parent", "===", "null", ")", "{", "if", "(", "array_key_exists", "(", ...
@todo try array_walk_recursive @param array $tree @param string $parent node name or null for inserting into root node @param $node @throws \Exception @return bool false if no parent found
[ "@todo", "try", "array_walk_recursive" ]
train
https://github.com/Nayjest/Tree/blob/e73da75f939e207b1c25065e9466c28300e7113c/src/Tree.php#L296-L321
Nayjest/Tree
src/Tree.php
Tree.removeTreeNode
private static function removeTreeNode(array &$config, $node) { foreach ($config as $key => &$value) { if ($key === $node) { $children = $config[$node]; unset($config[$node]); return $children; } else { $result = self::...
php
private static function removeTreeNode(array &$config, $node) { foreach ($config as $key => &$value) { if ($key === $node) { $children = $config[$node]; unset($config[$node]); return $children; } else { $result = self::...
[ "private", "static", "function", "removeTreeNode", "(", "array", "&", "$", "config", ",", "$", "node", ")", "{", "foreach", "(", "$", "config", "as", "$", "key", "=>", "&", "$", "value", ")", "{", "if", "(", "$", "key", "===", "$", "node", ")", "...
@param array $config @param $node @return false|array children of deleted node
[ "@param", "array", "$config", "@param", "$node" ]
train
https://github.com/Nayjest/Tree/blob/e73da75f939e207b1c25065e9466c28300e7113c/src/Tree.php#L329-L346
axelitus/php-base
src/BigInt.php
BigInt.is
public static function is($value) { return (is_int($value) || (is_numeric($value) && !is_float($value) && !Str::contains($value, '.'))); }
php
public static function is($value) { return (is_int($value) || (is_numeric($value) && !is_float($value) && !Str::contains($value, '.'))); }
[ "public", "static", "function", "is", "(", "$", "value", ")", "{", "return", "(", "is_int", "(", "$", "value", ")", "||", "(", "is_numeric", "(", "$", "value", ")", "&&", "!", "is_float", "(", "$", "value", ")", "&&", "!", "Str", "::", "contains", ...
Tests if the given value is an int (even if it's big). @param mixed $value The value to test. @return bool Returns true if the value is an int (big), false otherwise. @SuppressWarnings(PHPMD.ShortMethodName)
[ "Tests", "if", "the", "given", "value", "is", "an", "int", "(", "even", "if", "it", "s", "big", ")", "." ]
train
https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/BigInt.php#L38-L41
axelitus/php-base
src/BigInt.php
BigInt.abs
public static function abs($int) { if (!static::is($int)) { throw new \InvalidArgumentException( "The \$int parameter must be of type int (or string representing a big int)." ); } if (Int::is($int)) { return Int::abs($int); } else ...
php
public static function abs($int) { if (!static::is($int)) { throw new \InvalidArgumentException( "The \$int parameter must be of type int (or string representing a big int)." ); } if (Int::is($int)) { return Int::abs($int); } else ...
[ "public", "static", "function", "abs", "(", "$", "int", ")", "{", "if", "(", "!", "static", "::", "is", "(", "$", "int", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "\"The \\$int parameter must be of type int (or string representing a big...
Gets the absolute value of the given integer. @param int|string $int The number to get the absolute value of. @return int|string Returns the absolute value of the given integer.
[ "Gets", "the", "absolute", "value", "of", "the", "given", "integer", "." ]
train
https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/BigInt.php#L233-L246
axelitus/php-base
src/BigInt.php
BigInt.add
public static function add($int1, $int2) { if (!static::is($int1) || !static::is($int2)) { throw new \InvalidArgumentException( "The \$int1 and \$int2 parameters must be of type int (or string representing a big int)." ); } if (is_int($int1) && is_int...
php
public static function add($int1, $int2) { if (!static::is($int1) || !static::is($int2)) { throw new \InvalidArgumentException( "The \$int1 and \$int2 parameters must be of type int (or string representing a big int)." ); } if (is_int($int1) && is_int...
[ "public", "static", "function", "add", "(", "$", "int1", ",", "$", "int2", ")", "{", "if", "(", "!", "static", "::", "is", "(", "$", "int1", ")", "||", "!", "static", "::", "is", "(", "$", "int2", ")", ")", "{", "throw", "new", "\\", "InvalidAr...
Adds a number to another number. @param int|string $int1 The left operand. @param int|string $int2 The right operand. @return int|string The result of the operation. @throws \InvalidArgumentException @throws \RuntimeException
[ "Adds", "a", "number", "to", "another", "number", "." ]
train
https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/BigInt.php#L258-L273
axelitus/php-base
src/BigInt.php
BigInt.sub
public static function sub($int1, $int2) { if (!static::is($int1) || !static::is($int2)) { throw new \InvalidArgumentException( "The \$int1 and \$int2 parameters must be of type int (or string representing a big int)." ); } if (is_int($int1) && is_int...
php
public static function sub($int1, $int2) { if (!static::is($int1) || !static::is($int2)) { throw new \InvalidArgumentException( "The \$int1 and \$int2 parameters must be of type int (or string representing a big int)." ); } if (is_int($int1) && is_int...
[ "public", "static", "function", "sub", "(", "$", "int1", ",", "$", "int2", ")", "{", "if", "(", "!", "static", "::", "is", "(", "$", "int1", ")", "||", "!", "static", "::", "is", "(", "$", "int2", ")", ")", "{", "throw", "new", "\\", "InvalidAr...
Subtracts a number from another number. @param int|string $int1 The left operand. @param int|string $int2 The right operand. @return int|string The result of the operation. @throws \InvalidArgumentException @throws \RuntimeException
[ "Subtracts", "a", "number", "from", "another", "number", "." ]
train
https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/BigInt.php#L285-L300
axelitus/php-base
src/BigInt.php
BigInt.mul
public static function mul($int1, $int2) { if (!static::is($int1) || !static::is($int2)) { throw new \InvalidArgumentException( "The \$int1 and \$int2 parameters must be of type int (or string representing a big int)." ); } if (is_int($int1) && is_int...
php
public static function mul($int1, $int2) { if (!static::is($int1) || !static::is($int2)) { throw new \InvalidArgumentException( "The \$int1 and \$int2 parameters must be of type int (or string representing a big int)." ); } if (is_int($int1) && is_int...
[ "public", "static", "function", "mul", "(", "$", "int1", ",", "$", "int2", ")", "{", "if", "(", "!", "static", "::", "is", "(", "$", "int1", ")", "||", "!", "static", "::", "is", "(", "$", "int2", ")", ")", "{", "throw", "new", "\\", "InvalidAr...
Multiplies a number by another number. @param int|string $int1 The left operand. @param int|string $int2 The right operand. @return int|string The result of the operation. @throws \InvalidArgumentException @throws \RuntimeException
[ "Multiplies", "a", "number", "by", "another", "number", "." ]
train
https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/BigInt.php#L312-L327
axelitus/php-base
src/BigInt.php
BigInt.div
public static function div($int1, $int2) { if (!static::is($int1) || !static::is($int2)) { throw new \InvalidArgumentException( "The \$int1 and \$int2 parameters must be of type int (or string representing a big int)." ); } if ($int2 == '0') { ...
php
public static function div($int1, $int2) { if (!static::is($int1) || !static::is($int2)) { throw new \InvalidArgumentException( "The \$int1 and \$int2 parameters must be of type int (or string representing a big int)." ); } if ($int2 == '0') { ...
[ "public", "static", "function", "div", "(", "$", "int1", ",", "$", "int2", ")", "{", "if", "(", "!", "static", "::", "is", "(", "$", "int1", ")", "||", "!", "static", "::", "is", "(", "$", "int2", ")", ")", "{", "throw", "new", "\\", "InvalidAr...
Divides a number by another number. @param int|string $int1 The left operand. @param int|string $int2 The right operand. @return int|float|string The result of the operation. @throws \InvalidArgumentException @throws \RuntimeException
[ "Divides", "a", "number", "by", "another", "number", "." ]
train
https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/BigInt.php#L339-L358
axelitus/php-base
src/BigInt.php
BigInt.pow
public static function pow($base, $exponent) { if (!static::is($base) || !static::is($exponent)) { throw new \InvalidArgumentException( "The \$base and \$exponent parameters must be of type int (or string representing a big int)." ); } if (is_int($bas...
php
public static function pow($base, $exponent) { if (!static::is($base) || !static::is($exponent)) { throw new \InvalidArgumentException( "The \$base and \$exponent parameters must be of type int (or string representing a big int)." ); } if (is_int($bas...
[ "public", "static", "function", "pow", "(", "$", "base", ",", "$", "exponent", ")", "{", "if", "(", "!", "static", "::", "is", "(", "$", "base", ")", "||", "!", "static", "::", "is", "(", "$", "exponent", ")", ")", "{", "throw", "new", "\\", "I...
Raises a number to the power of another number. @param int|string $base The base number. @param int|string $exponent The power exponent. @return int|string The result of the operation. @throws \InvalidArgumentException @throws \RuntimeException
[ "Raises", "a", "number", "to", "the", "power", "of", "another", "number", "." ]
train
https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/BigInt.php#L370-L385
axelitus/php-base
src/BigInt.php
BigInt.mod
public static function mod($base, $modulus) { if (!static::is($base) || !static::is($modulus)) { throw new \InvalidArgumentException( "The \$base and \$modulus parameters must be of type int (or string representing a big int)." ); } if ($modulus == '0...
php
public static function mod($base, $modulus) { if (!static::is($base) || !static::is($modulus)) { throw new \InvalidArgumentException( "The \$base and \$modulus parameters must be of type int (or string representing a big int)." ); } if ($modulus == '0...
[ "public", "static", "function", "mod", "(", "$", "base", ",", "$", "modulus", ")", "{", "if", "(", "!", "static", "::", "is", "(", "$", "base", ")", "||", "!", "static", "::", "is", "(", "$", "modulus", ")", ")", "{", "throw", "new", "\\", "Inv...
Gets the remainder of a number divided by another number. @param int|string $base The left operand. @param int|string $modulus The right operand. @return int|string The result of the operation. @throws \InvalidArgumentException @throws \RuntimeException
[ "Gets", "the", "remainder", "of", "a", "number", "divided", "by", "another", "number", "." ]
train
https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/BigInt.php#L397-L416
axelitus/php-base
src/BigInt.php
BigInt.sqrt
public static function sqrt($base) { if (!static::is($base)) { throw new \InvalidArgumentException( "The \$base parameters must be of type int (or string representing a big int)." ); } if (is_int($base)) { return sqrt($base); } els...
php
public static function sqrt($base) { if (!static::is($base)) { throw new \InvalidArgumentException( "The \$base parameters must be of type int (or string representing a big int)." ); } if (is_int($base)) { return sqrt($base); } els...
[ "public", "static", "function", "sqrt", "(", "$", "base", ")", "{", "if", "(", "!", "static", "::", "is", "(", "$", "base", ")", ")", "{", "throw", "new", "\\", "InvalidArgumentException", "(", "\"The \\$base parameters must be of type int (or string representing ...
Gets the square root of a number. @param int|string $base The base to use. @return float|string The result of the operation. @throws \InvalidArgumentException @throws \RuntimeException
[ "Gets", "the", "square", "root", "of", "a", "number", "." ]
train
https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/BigInt.php#L427-L442
Teamsisu/contao-mm-frontendInput
src/Teamsisu/MetaModelsFrontendInput/FrontendIntegration/Form/FormURLField.php
FormURLField.validator
protected function validator($varInput) { if (is_array($varInput)) { return parent::validator($varInput); } $varInput = \Idna::encodeUrl($varInput); return parent::validator(trim($varInput)); }
php
protected function validator($varInput) { if (is_array($varInput)) { return parent::validator($varInput); } $varInput = \Idna::encodeUrl($varInput); return parent::validator(trim($varInput)); }
[ "protected", "function", "validator", "(", "$", "varInput", ")", "{", "if", "(", "is_array", "(", "$", "varInput", ")", ")", "{", "return", "parent", "::", "validator", "(", "$", "varInput", ")", ";", "}", "$", "varInput", "=", "\\", "Idna", "::", "e...
Trim the values @param mixed $varInput The user input @return mixed The validated user input
[ "Trim", "the", "values" ]
train
https://github.com/Teamsisu/contao-mm-frontendInput/blob/ab92e61c24644f1e61265304b6a35e505007d021/src/Teamsisu/MetaModelsFrontendInput/FrontendIntegration/Form/FormURLField.php#L129-L140