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 |
|---|---|---|---|---|---|---|---|---|---|---|
fuzz-productions/laravel-api-data | src/Eloquent/Model.php | Model.accessibleRelationsToArray | public function accessibleRelationsToArray()
{
$filtered = [];
$relations = $this->getArrayableRelations();
/**
* @var $related \Illuminate\Database\Eloquent\Collection|\Illuminate\Database\Eloquent\Relations\Pivot
*/
foreach ($relations as $key => $related_collection) {
if (! $this->access_authoriz... | php | public function accessibleRelationsToArray()
{
$filtered = [];
$relations = $this->getArrayableRelations();
/**
* @var $related \Illuminate\Database\Eloquent\Collection|\Illuminate\Database\Eloquent\Relations\Pivot
*/
foreach ($relations as $key => $related_collection) {
if (! $this->access_authoriz... | [
"public",
"function",
"accessibleRelationsToArray",
"(",
")",
"{",
"$",
"filtered",
"=",
"[",
"]",
";",
"$",
"relations",
"=",
"$",
"this",
"->",
"getArrayableRelations",
"(",
")",
";",
"/**\n\t\t * @var $related \\Illuminate\\Database\\Eloquent\\Collection|\\Illuminate\\... | Filter relations which can and can't be accessed by the user
@return array | [
"Filter",
"relations",
"which",
"can",
"and",
"can",
"t",
"be",
"accessed",
"by",
"the",
"user"
] | train | https://github.com/fuzz-productions/laravel-api-data/blob/25e181860d2f269b3b212195944c2bca95b411bb/src/Eloquent/Model.php#L145-L176 |
fuzz-productions/laravel-api-data | src/Eloquent/Model.php | Model.addAppends | public function addAppends($appends)
{
if (is_string($appends)) {
$appends = func_get_args();
}
$this->appends = array_merge($this->appends, $appends);
return $this;
} | php | public function addAppends($appends)
{
if (is_string($appends)) {
$appends = func_get_args();
}
$this->appends = array_merge($this->appends, $appends);
return $this;
} | [
"public",
"function",
"addAppends",
"(",
"$",
"appends",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"appends",
")",
")",
"{",
"$",
"appends",
"=",
"func_get_args",
"(",
")",
";",
"}",
"$",
"this",
"->",
"appends",
"=",
"array_merge",
"(",
"$",
"this... | Add additional appended properties to the model via a public interface.
@param string|array $appends
@return static | [
"Add",
"additional",
"appended",
"properties",
"to",
"the",
"model",
"via",
"a",
"public",
"interface",
"."
] | train | https://github.com/fuzz-productions/laravel-api-data/blob/25e181860d2f269b3b212195944c2bca95b411bb/src/Eloquent/Model.php#L184-L193 |
fuzz-productions/laravel-api-data | src/Eloquent/Model.php | Model.removeAppends | public function removeAppends($appends)
{
if (is_string($appends)) {
$appends = func_get_args();
}
$this->appends = array_diff($this->appends, $appends);
return $this;
} | php | public function removeAppends($appends)
{
if (is_string($appends)) {
$appends = func_get_args();
}
$this->appends = array_diff($this->appends, $appends);
return $this;
} | [
"public",
"function",
"removeAppends",
"(",
"$",
"appends",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"appends",
")",
")",
"{",
"$",
"appends",
"=",
"func_get_args",
"(",
")",
";",
"}",
"$",
"this",
"->",
"appends",
"=",
"array_diff",
"(",
"$",
"th... | Remove appended properties to the model via a public interface.
@param string|array $appends
@return static | [
"Remove",
"appended",
"properties",
"to",
"the",
"model",
"via",
"a",
"public",
"interface",
"."
] | train | https://github.com/fuzz-productions/laravel-api-data/blob/25e181860d2f269b3b212195944c2bca95b411bb/src/Eloquent/Model.php#L201-L210 |
fuzz-productions/laravel-api-data | src/Eloquent/Model.php | Model.removeHidden | public function removeHidden($hidden)
{
if (is_string($hidden)) {
$hidden = func_get_args();
}
$this->hidden = array_diff($this->hidden, $hidden);
return $this;
} | php | public function removeHidden($hidden)
{
if (is_string($hidden)) {
$hidden = func_get_args();
}
$this->hidden = array_diff($this->hidden, $hidden);
return $this;
} | [
"public",
"function",
"removeHidden",
"(",
"$",
"hidden",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"hidden",
")",
")",
"{",
"$",
"hidden",
"=",
"func_get_args",
"(",
")",
";",
"}",
"$",
"this",
"->",
"hidden",
"=",
"array_diff",
"(",
"$",
"this",
... | Unhide hidden properties from the model via a public interface.
@param string|array $hidden
@return static | [
"Unhide",
"hidden",
"properties",
"from",
"the",
"model",
"via",
"a",
"public",
"interface",
"."
] | train | https://github.com/fuzz-productions/laravel-api-data/blob/25e181860d2f269b3b212195944c2bca95b411bb/src/Eloquent/Model.php#L218-L227 |
fuzz-productions/laravel-api-data | src/Eloquent/Model.php | Model.scopeSafeWith | public function scopeSafeWith(Builder $builder, $relations)
{
if (is_string($relations)) {
$relations = func_get_args();
array_shift($relations);
}
// Loop through all relations to check for valid relationship signatures
foreach ($relations as $name => $constraints) {
// Constraints may be passed in ... | php | public function scopeSafeWith(Builder $builder, $relations)
{
if (is_string($relations)) {
$relations = func_get_args();
array_shift($relations);
}
// Loop through all relations to check for valid relationship signatures
foreach ($relations as $name => $constraints) {
// Constraints may be passed in ... | [
"public",
"function",
"scopeSafeWith",
"(",
"Builder",
"$",
"builder",
",",
"$",
"relations",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"relations",
")",
")",
"{",
"$",
"relations",
"=",
"func_get_args",
"(",
")",
";",
"array_shift",
"(",
"$",
"relatio... | "Safe" version of with eager-loading.
Checks if relations exist before loading them.
@param \Illuminate\Database\Eloquent\Builder $builder
@param string|array $relations | [
"Safe",
"version",
"of",
"with",
"eager",
"-",
"loading",
"."
] | train | https://github.com/fuzz-productions/laravel-api-data/blob/25e181860d2f269b3b212195944c2bca95b411bb/src/Eloquent/Model.php#L237-L279 |
fuzz-productions/laravel-api-data | src/Eloquent/Model.php | Model.mutateDateTimeAttribute | final protected function mutateDateTimeAttribute($date, $attribute)
{
if (is_numeric($date)) {
return $this->attributes[$attribute] = Carbon::createFromTimestamp($date);
}
return $this->attributes[$attribute] = Carbon::parse($date)->toDateTimeString();
} | php | final protected function mutateDateTimeAttribute($date, $attribute)
{
if (is_numeric($date)) {
return $this->attributes[$attribute] = Carbon::createFromTimestamp($date);
}
return $this->attributes[$attribute] = Carbon::parse($date)->toDateTimeString();
} | [
"final",
"protected",
"function",
"mutateDateTimeAttribute",
"(",
"$",
"date",
",",
"$",
"attribute",
")",
"{",
"if",
"(",
"is_numeric",
"(",
"$",
"date",
")",
")",
"{",
"return",
"$",
"this",
"->",
"attributes",
"[",
"$",
"attribute",
"]",
"=",
"Carbon"... | Mutator for datetime attributes.
@param string /int $date
A parsable datetime string or timestamp
@param string $attribute
The name of the attribute we're setting
@return \Carbon\Carbon | [
"Mutator",
"for",
"datetime",
"attributes",
"."
] | train | https://github.com/fuzz-productions/laravel-api-data/blob/25e181860d2f269b3b212195944c2bca95b411bb/src/Eloquent/Model.php#L290-L297 |
jan-dolata/crude-crud | src/Engine/CrudeSetupTrait/Trans.php | Trans.setTrans | public function setTrans($attr, $trans = null)
{
$transList = is_array($attr)
? $attr
: [$attr => $trans];
foreach ($transList as $key => $value)
$this->trans[$key] = $value;
return $this;
} | php | public function setTrans($attr, $trans = null)
{
$transList = is_array($attr)
? $attr
: [$attr => $trans];
foreach ($transList as $key => $value)
$this->trans[$key] = $value;
return $this;
} | [
"public",
"function",
"setTrans",
"(",
"$",
"attr",
",",
"$",
"trans",
"=",
"null",
")",
"{",
"$",
"transList",
"=",
"is_array",
"(",
"$",
"attr",
")",
"?",
"$",
"attr",
":",
"[",
"$",
"attr",
"=>",
"$",
"trans",
"]",
";",
"foreach",
"(",
"$",
... | Sets the Model trans.
@param string|array $attr
@param array $trans = null
@return self | [
"Sets",
"the",
"Model",
"trans",
"."
] | train | https://github.com/jan-dolata/crude-crud/blob/9129ea08278835cf5cecfd46a90369226ae6bdd7/src/Engine/CrudeSetupTrait/Trans.php#L32-L42 |
piqus/bfp4f-rcon | src/T4G/BFP4F/Rcon/Chat.php | Chat.fetch | public function fetch($limit=null)
{
$data = Base::query('bf2cc serverchatbuffer');
$spl = explode("\r\r", $data);
$result = array();
$i = 0;
foreach ($spl as $chat) {
$ex = explode("\t", $chat);
... | php | public function fetch($limit=null)
{
$data = Base::query('bf2cc serverchatbuffer');
$spl = explode("\r\r", $data);
$result = array();
$i = 0;
foreach ($spl as $chat) {
$ex = explode("\t", $chat);
... | [
"public",
"function",
"fetch",
"(",
"$",
"limit",
"=",
"null",
")",
"{",
"$",
"data",
"=",
"Base",
"::",
"query",
"(",
"'bf2cc serverchatbuffer'",
")",
";",
"$",
"spl",
"=",
"explode",
"(",
"\"\\r\\r\"",
",",
"$",
"data",
")",
";",
"$",
"result",
"="... | Fetches current Chat-Buffer
@param int $limit = null
@return array | [
"Fetches",
"current",
"Chat",
"-",
"Buffer"
] | train | https://github.com/piqus/bfp4f-rcon/blob/8e94587bc93c686e5a025a54645aed7c701811e6/src/T4G/BFP4F/Rcon/Chat.php#L29-L60 |
stubbles/stubbles-webapp-core | src/main/php/routing/Routes.php | Routes.match | public function match(CalledUri $calledUri): MatchingRoutes
{
$allowedMethods = [];
$matching = [];
foreach ($this->routes as $route) {
/* @var $route \stubbles\webapp\routing\Route */
if ($route->matches($calledUri)) {
return new MatchingRoutes(... | php | public function match(CalledUri $calledUri): MatchingRoutes
{
$allowedMethods = [];
$matching = [];
foreach ($this->routes as $route) {
/* @var $route \stubbles\webapp\routing\Route */
if ($route->matches($calledUri)) {
return new MatchingRoutes(... | [
"public",
"function",
"match",
"(",
"CalledUri",
"$",
"calledUri",
")",
":",
"MatchingRoutes",
"{",
"$",
"allowedMethods",
"=",
"[",
"]",
";",
"$",
"matching",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"routes",
"as",
"$",
"route",
")",
... | finds route based on called uri
@param \stubbles\webapp\routing\CalledUri $calledUri
@return \stubbles\webapp\routing\MatchingRoutes | [
"finds",
"route",
"based",
"on",
"called",
"uri"
] | train | https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/routing/Routes.php#L44-L65 |
stubbles/stubbles-webapp-core | src/main/php/routing/Routes.php | Routes.getIterator | public function getIterator(): \Traversable
{
$routes = $this->routes;
usort(
$routes,
function(Route $a, Route $b)
{
return strnatcmp($a->configuredPath(), $b->configuredPath());
}
);
return new \Arr... | php | public function getIterator(): \Traversable
{
$routes = $this->routes;
usort(
$routes,
function(Route $a, Route $b)
{
return strnatcmp($a->configuredPath(), $b->configuredPath());
}
);
return new \Arr... | [
"public",
"function",
"getIterator",
"(",
")",
":",
"\\",
"Traversable",
"{",
"$",
"routes",
"=",
"$",
"this",
"->",
"routes",
";",
"usort",
"(",
"$",
"routes",
",",
"function",
"(",
"Route",
"$",
"a",
",",
"Route",
"$",
"b",
")",
"{",
"return",
"s... | allows iteration over all configured routes
@return \Traversable
@since 6.1.0 | [
"allows",
"iteration",
"over",
"all",
"configured",
"routes"
] | train | https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/routing/Routes.php#L73-L84 |
keiosweb/moneyright | src/CurrencyPair.php | CurrencyPair.convert | public function convert(Money $money, $roundingMode = Money::ROUND_HALF_UP)
{
if (!$money->getCurrency()->equals($this->baseCurrency)) {
throw new InvalidArgumentException(
sprintf('Currencies must match: Money to convert has currency %s, while CurrencyPair has base currency %s.'... | php | public function convert(Money $money, $roundingMode = Money::ROUND_HALF_UP)
{
if (!$money->getCurrency()->equals($this->baseCurrency)) {
throw new InvalidArgumentException(
sprintf('Currencies must match: Money to convert has currency %s, while CurrencyPair has base currency %s.'... | [
"public",
"function",
"convert",
"(",
"Money",
"$",
"money",
",",
"$",
"roundingMode",
"=",
"Money",
"::",
"ROUND_HALF_UP",
")",
"{",
"if",
"(",
"!",
"$",
"money",
"->",
"getCurrency",
"(",
")",
"->",
"equals",
"(",
"$",
"this",
"->",
"baseCurrency",
"... | @param \Keios\MoneyRight\Money $money
@param mixed $roundingMode
@throws \Keios\MoneyRight\Exceptions\InvalidArgumentException
@return \Keios\MoneyRight\Money | [
"@param",
"\\",
"Keios",
"\\",
"MoneyRight",
"\\",
"Money",
"$money",
"@param",
"mixed",
"$roundingMode"
] | train | https://github.com/keiosweb/moneyright/blob/6c6d8ce34e37e42aa1eebbf45a949bbae6b44780/src/CurrencyPair.php#L90-L109 |
keiosweb/moneyright | src/CurrencyPair.php | CurrencyPair.getRatio | public function getRatio($usePrecision = false)
{
return $usePrecision ? bcadd($this->ratio, '0', Money::GAAP_PRECISION) : (float) $this->ratio;
} | php | public function getRatio($usePrecision = false)
{
return $usePrecision ? bcadd($this->ratio, '0', Money::GAAP_PRECISION) : (float) $this->ratio;
} | [
"public",
"function",
"getRatio",
"(",
"$",
"usePrecision",
"=",
"false",
")",
"{",
"return",
"$",
"usePrecision",
"?",
"bcadd",
"(",
"$",
"this",
"->",
"ratio",
",",
"'0'",
",",
"Money",
"::",
"GAAP_PRECISION",
")",
":",
"(",
"float",
")",
"$",
"this"... | @param bool $usePrecision
@return float | [
"@param",
"bool",
"$usePrecision"
] | train | https://github.com/keiosweb/moneyright/blob/6c6d8ce34e37e42aa1eebbf45a949bbae6b44780/src/CurrencyPair.php#L132-L135 |
darkwebdesign/doctrine-unit-testing | src/Mocks/HydratorMockStatement.php | HydratorMockStatement.fetchColumn | public function fetchColumn($columnNumber = 0)
{
$row = current($this->_resultSet);
if ( ! is_array($row)) return false;
$val = array_shift($row);
return $val !== null ? $val : false;
} | php | public function fetchColumn($columnNumber = 0)
{
$row = current($this->_resultSet);
if ( ! is_array($row)) return false;
$val = array_shift($row);
return $val !== null ? $val : false;
} | [
"public",
"function",
"fetchColumn",
"(",
"$",
"columnNumber",
"=",
"0",
")",
"{",
"$",
"row",
"=",
"current",
"(",
"$",
"this",
"->",
"_resultSet",
")",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
"row",
")",
")",
"return",
"false",
";",
"$",
"val"... | {@inheritdoc} | [
"{"
] | train | https://github.com/darkwebdesign/doctrine-unit-testing/blob/0daf50359563bc0679925e573a7105d6cd57168a/src/Mocks/HydratorMockStatement.php#L46-L52 |
darkwebdesign/doctrine-unit-testing | src/Mocks/HydratorMockStatement.php | HydratorMockStatement.fetch | public function fetch($fetchStyle = null, $cursorOrientation = \PDO::FETCH_ORI_NEXT, $cursorOffset = 0)
{
$current = current($this->_resultSet);
next($this->_resultSet);
return $current;
} | php | public function fetch($fetchStyle = null, $cursorOrientation = \PDO::FETCH_ORI_NEXT, $cursorOffset = 0)
{
$current = current($this->_resultSet);
next($this->_resultSet);
return $current;
} | [
"public",
"function",
"fetch",
"(",
"$",
"fetchStyle",
"=",
"null",
",",
"$",
"cursorOrientation",
"=",
"\\",
"PDO",
"::",
"FETCH_ORI_NEXT",
",",
"$",
"cursorOffset",
"=",
"0",
")",
"{",
"$",
"current",
"=",
"current",
"(",
"$",
"this",
"->",
"_resultSet... | {@inheritdoc} | [
"{"
] | train | https://github.com/darkwebdesign/doctrine-unit-testing/blob/0daf50359563bc0679925e573a7105d6cd57168a/src/Mocks/HydratorMockStatement.php#L57-L62 |
jasny/router | src/Router/ControllerFactory.php | ControllerFactory.assertClass | protected function assertClass($class)
{
if (!preg_match('/^([a-zA-Z_]\w*\\\\)*[a-zA-Z_]\w*$/', $class)) {
throw new \UnexpectedValueException("Can't route to controller '$class': invalid classname");
}
if (!class_exists($class)) {
throw new \UnexpectedValueE... | php | protected function assertClass($class)
{
if (!preg_match('/^([a-zA-Z_]\w*\\\\)*[a-zA-Z_]\w*$/', $class)) {
throw new \UnexpectedValueException("Can't route to controller '$class': invalid classname");
}
if (!class_exists($class)) {
throw new \UnexpectedValueE... | [
"protected",
"function",
"assertClass",
"(",
"$",
"class",
")",
"{",
"if",
"(",
"!",
"preg_match",
"(",
"'/^([a-zA-Z_]\\w*\\\\\\\\)*[a-zA-Z_]\\w*$/'",
",",
"$",
"class",
")",
")",
"{",
"throw",
"new",
"\\",
"UnexpectedValueException",
"(",
"\"Can't route to controll... | Assert that a class exists and will provide a callable object
@throws FactoryException | [
"Assert",
"that",
"a",
"class",
"exists",
"and",
"will",
"provide",
"a",
"callable",
"object"
] | train | https://github.com/jasny/router/blob/4c776665ba343150b442c21893946e3d54190896/src/Router/ControllerFactory.php#L38-L54 |
jasny/router | src/Router/ControllerFactory.php | ControllerFactory.studlyCase | protected function studlyCase($string)
{
return preg_replace_callback('/(?:^|(\w)-)(\w)/', function($match) {
return $match[1] . strtoupper($match[2]);
}, strtolower(addcslashes($string, '\\')));
} | php | protected function studlyCase($string)
{
return preg_replace_callback('/(?:^|(\w)-)(\w)/', function($match) {
return $match[1] . strtoupper($match[2]);
}, strtolower(addcslashes($string, '\\')));
} | [
"protected",
"function",
"studlyCase",
"(",
"$",
"string",
")",
"{",
"return",
"preg_replace_callback",
"(",
"'/(?:^|(\\w)-)(\\w)/'",
",",
"function",
"(",
"$",
"match",
")",
"{",
"return",
"$",
"match",
"[",
"1",
"]",
".",
"strtoupper",
"(",
"$",
"match",
... | Turn kabab-case into StudlyCase.
@internal Jasny\studlycase isn't used because it's to tolerent, which might lead to security issues.
@param string $string
@return string | [
"Turn",
"kabab",
"-",
"case",
"into",
"StudlyCase",
"."
] | train | https://github.com/jasny/router/blob/4c776665ba343150b442c21893946e3d54190896/src/Router/ControllerFactory.php#L64-L69 |
axelitus/php-base | src/BoolNot.php | BoolNot.val | public static function val($value1, $_ = null)
{
$ret = [];
$args = func_get_args();
foreach ($args as $arg) {
if (!static::is($arg)) {
throw new \InvalidArgumentException("All parameters must be of type bool.");
}
$ret[] = !$arg;
... | php | public static function val($value1, $_ = null)
{
$ret = [];
$args = func_get_args();
foreach ($args as $arg) {
if (!static::is($arg)) {
throw new \InvalidArgumentException("All parameters must be of type bool.");
}
$ret[] = !$arg;
... | [
"public",
"static",
"function",
"val",
"(",
"$",
"value1",
",",
"$",
"_",
"=",
"null",
")",
"{",
"$",
"ret",
"=",
"[",
"]",
";",
"$",
"args",
"=",
"func_get_args",
"(",
")",
";",
"foreach",
"(",
"$",
"args",
"as",
"$",
"arg",
")",
"{",
"if",
... | Applies the NOT operation to the given value(s).
@param bool $value1 The value to apply the operation to.
@param bool $_ More values to apply the operation to.
@return bool|array The result of applying the operation to the value(s).
@throws \InvalidArgumentException
@SuppressWarnings(PHPMD.CamelCaseParameterName... | [
"Applies",
"the",
"NOT",
"operation",
"to",
"the",
"given",
"value",
"(",
"s",
")",
"."
] | train | https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/BoolNot.php#L39-L52 |
stubbles/stubbles-webapp-core | src/main/php/auth/session/CachingAuthenticationProvider.php | CachingAuthenticationProvider.authenticate | public function authenticate(Request $request)
{
if ($this->session->hasValue(User::SESSION_KEY)) {
return $this->session->value(User::SESSION_KEY);
}
$user = $this->authenticationProvider->authenticate($request);
if (null === $user) {
return null;
}
... | php | public function authenticate(Request $request)
{
if ($this->session->hasValue(User::SESSION_KEY)) {
return $this->session->value(User::SESSION_KEY);
}
$user = $this->authenticationProvider->authenticate($request);
if (null === $user) {
return null;
}
... | [
"public",
"function",
"authenticate",
"(",
"Request",
"$",
"request",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"session",
"->",
"hasValue",
"(",
"User",
"::",
"SESSION_KEY",
")",
")",
"{",
"return",
"$",
"this",
"->",
"session",
"->",
"value",
"(",
"Use... | authenticates that the given request is valid
@param \stubbles\webapp\Request $request
@return \stubbles\webapp\auth\User|null | [
"authenticates",
"that",
"the",
"given",
"request",
"is",
"valid"
] | train | https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/auth/session/CachingAuthenticationProvider.php#L55-L68 |
comelyio/comely | src/Comely/IO/Yaml/Parser.php | Parser.setYamlPath | private function setYamlPath(string $yamlPath): void
{
$chars = preg_quote(':._-\/\\\\', '#');
$pattern = '#^[\w' . $chars . ']+\.(yaml|yml)$#';
if (!preg_match($pattern, $yamlPath)) {
throw new ParserException('Given path to YAML file is invalid');
}
// Get abso... | php | private function setYamlPath(string $yamlPath): void
{
$chars = preg_quote(':._-\/\\\\', '#');
$pattern = '#^[\w' . $chars . ']+\.(yaml|yml)$#';
if (!preg_match($pattern, $yamlPath)) {
throw new ParserException('Given path to YAML file is invalid');
}
// Get abso... | [
"private",
"function",
"setYamlPath",
"(",
"string",
"$",
"yamlPath",
")",
":",
"void",
"{",
"$",
"chars",
"=",
"preg_quote",
"(",
"':._-\\/\\\\\\\\'",
",",
"'#'",
")",
";",
"$",
"pattern",
"=",
"'#^[\\w'",
".",
"$",
"chars",
".",
"']+\\.(yaml|yml)$#'",
";... | Validates path, checks if starting Yaml file exists
@param string $yamlPath
@throws ParserException | [
"Validates",
"path",
"checks",
"if",
"starting",
"Yaml",
"file",
"exists"
] | train | https://github.com/comelyio/comely/blob/561ea7aef36fea347a1a79d3ee5597d4057ddf82/src/Comely/IO/Yaml/Parser.php#L54-L73 |
comelyio/comely | src/Comely/IO/Yaml/Parser.php | Parser.setEOL | public function setEOL(string $eol = PHP_EOL): self
{
if (!in_array($eol, ["\n", "\r\n"])) {
throw new ParserException('Invalid EOL character');
}
$this->eolChar = $eol;
return $this;
} | php | public function setEOL(string $eol = PHP_EOL): self
{
if (!in_array($eol, ["\n", "\r\n"])) {
throw new ParserException('Invalid EOL character');
}
$this->eolChar = $eol;
return $this;
} | [
"public",
"function",
"setEOL",
"(",
"string",
"$",
"eol",
"=",
"PHP_EOL",
")",
":",
"self",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"eol",
",",
"[",
"\"\\n\"",
",",
"\"\\r\\n\"",
"]",
")",
")",
"{",
"throw",
"new",
"ParserException",
"(",
"'Inval... | Set EOL character
@param string $eol
@return Parser | [
"Set",
"EOL",
"character"
] | train | https://github.com/comelyio/comely/blob/561ea7aef36fea347a1a79d3ee5597d4057ddf82/src/Comely/IO/Yaml/Parser.php#L95-L103 |
acasademont/wurfl | WURFL/Request/UserAgentNormalizer.php | WURFL_Request_UserAgentNormalizer.addUserAgentNormalizer | public function addUserAgentNormalizer(WURFL_Request_UserAgentNormalizer_Interface $normalizer)
{
$userAgentNormalizers = $this->_userAgentNormalizers;
$userAgentNormalizers[] = $normalizer;
return new WURFL_Request_UserAgentNormalizer($userAgentNormalizers);
} | php | public function addUserAgentNormalizer(WURFL_Request_UserAgentNormalizer_Interface $normalizer)
{
$userAgentNormalizers = $this->_userAgentNormalizers;
$userAgentNormalizers[] = $normalizer;
return new WURFL_Request_UserAgentNormalizer($userAgentNormalizers);
} | [
"public",
"function",
"addUserAgentNormalizer",
"(",
"WURFL_Request_UserAgentNormalizer_Interface",
"$",
"normalizer",
")",
"{",
"$",
"userAgentNormalizers",
"=",
"$",
"this",
"->",
"_userAgentNormalizers",
";",
"$",
"userAgentNormalizers",
"[",
"]",
"=",
"$",
"normaliz... | Adds a new UserAgent Normalizer to the chain
@param WURFL_Request_UserAgentNormalizer_Interface $normalizer
@return WURFL_Request_UserAgentNormalizer | [
"Adds",
"a",
"new",
"UserAgent",
"Normalizer",
"to",
"the",
"chain"
] | train | https://github.com/acasademont/wurfl/blob/0f4fb6e06b452ba95ad1d15e7d8226d0974b60c2/WURFL/Request/UserAgentNormalizer.php#L47-L52 |
acasademont/wurfl | WURFL/Request/UserAgentNormalizer.php | WURFL_Request_UserAgentNormalizer.normalize | public function normalize($userAgent)
{
// Don't normalize generic user agents
if (substr($userAgent, 0, 12) == 'DO_NOT_MATCH') {
return $userAgent;
}
$normalizedUserAgent = $userAgent;
foreach ($this->_userAgentNormalizers as $normalizer) {
$normalize... | php | public function normalize($userAgent)
{
// Don't normalize generic user agents
if (substr($userAgent, 0, 12) == 'DO_NOT_MATCH') {
return $userAgent;
}
$normalizedUserAgent = $userAgent;
foreach ($this->_userAgentNormalizers as $normalizer) {
$normalize... | [
"public",
"function",
"normalize",
"(",
"$",
"userAgent",
")",
"{",
"// Don't normalize generic user agents",
"if",
"(",
"substr",
"(",
"$",
"userAgent",
",",
"0",
",",
"12",
")",
"==",
"'DO_NOT_MATCH'",
")",
"{",
"return",
"$",
"userAgent",
";",
"}",
"$",
... | Normalize the given $userAgent by passing down the chain
of normalizers
@param string $userAgent
@return string Normalized user agent | [
"Normalize",
"the",
"given",
"$userAgent",
"by",
"passing",
"down",
"the",
"chain",
"of",
"normalizers"
] | train | https://github.com/acasademont/wurfl/blob/0f4fb6e06b452ba95ad1d15e7d8226d0974b60c2/WURFL/Request/UserAgentNormalizer.php#L70-L81 |
drpdigital/json-api-parser | src/Collection.php | Collection.get | public function get($key)
{
$items = Arr::get($this->items, $key);
return $this->firstOrAll($items);
} | php | public function get($key)
{
$items = Arr::get($this->items, $key);
return $this->firstOrAll($items);
} | [
"public",
"function",
"get",
"(",
"$",
"key",
")",
"{",
"$",
"items",
"=",
"Arr",
"::",
"get",
"(",
"$",
"this",
"->",
"items",
",",
"$",
"key",
")",
";",
"return",
"$",
"this",
"->",
"firstOrAll",
"(",
"$",
"items",
")",
";",
"}"
] | Get the resolved resource by key.
This will return an array of that resource if multiple resources are contained with the key.
If only 1 item in the array then that 1 item will be returned instead.
@param string $key
@return mixed|array | [
"Get",
"the",
"resolved",
"resource",
"by",
"key",
"."
] | train | https://github.com/drpdigital/json-api-parser/blob/b1ceefc0c19ec326129126253114c121e97ca943/src/Collection.php#L27-L32 |
nilportugues/php-jsend | src/JSendTransformer.php | JSendTransformer.serialization | protected function serialization($value)
{
$value = parent::serialization($value);
$data = [];
if (!empty($value[self::META_KEY])) {
$data[self::META_KEY] = $value[self::META_KEY];
unset($value[self::META_KEY]);
}
if (!empty($value[self::LINKS])) {
... | php | protected function serialization($value)
{
$value = parent::serialization($value);
$data = [];
if (!empty($value[self::META_KEY])) {
$data[self::META_KEY] = $value[self::META_KEY];
unset($value[self::META_KEY]);
}
if (!empty($value[self::LINKS])) {
... | [
"protected",
"function",
"serialization",
"(",
"$",
"value",
")",
"{",
"$",
"value",
"=",
"parent",
"::",
"serialization",
"(",
"$",
"value",
")",
";",
"$",
"data",
"=",
"[",
"]",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"value",
"[",
"self",
"::",
... | @param $value
@return mixed | [
"@param",
"$value"
] | train | https://github.com/nilportugues/php-jsend/blob/e446f493cbe34fc3646e8cef356447b92708735d/src/JSendTransformer.php#L25-L43 |
alexpts/psr15-middlewares | src/Cors.php | Cors.process | public function process(ServerRequestInterface $request, RequestHandlerInterface $next): ResponseInterface
{
$response = $next->handle($request);
if (\count($this->originHosts)) {
$response = $response->withHeader(self::ORIGIN, implode(' ', $this->originHosts));
}
if (\... | php | public function process(ServerRequestInterface $request, RequestHandlerInterface $next): ResponseInterface
{
$response = $next->handle($request);
if (\count($this->originHosts)) {
$response = $response->withHeader(self::ORIGIN, implode(' ', $this->originHosts));
}
if (\... | [
"public",
"function",
"process",
"(",
"ServerRequestInterface",
"$",
"request",
",",
"RequestHandlerInterface",
"$",
"next",
")",
":",
"ResponseInterface",
"{",
"$",
"response",
"=",
"$",
"next",
"->",
"handle",
"(",
"$",
"request",
")",
";",
"if",
"(",
"\\"... | @param ServerRequestInterface $request
@param RequestHandlerInterface $next
@return ResponseInterface
@throws \InvalidArgumentException | [
"@param",
"ServerRequestInterface",
"$request",
"@param",
"RequestHandlerInterface",
"$next"
] | train | https://github.com/alexpts/psr15-middlewares/blob/bff2887d5af01c54d9288fd19c20f0f593b69358/src/Cors.php#L45-L62 |
verschoof/bunq-api | src/Middleware/RequestSignatureMiddleware.php | RequestSignatureMiddleware.createSignature | private function createSignature(RequestInterface $request)
{
$headers = $request->getHeaders();
ksort($headers);
$signatureData = $request->getMethod() . ' ' . $request->getRequestTarget();
$signatureData .= $this->createSignatureDataFromHeaders($headers);
$signatureData .=... | php | private function createSignature(RequestInterface $request)
{
$headers = $request->getHeaders();
ksort($headers);
$signatureData = $request->getMethod() . ' ' . $request->getRequestTarget();
$signatureData .= $this->createSignatureDataFromHeaders($headers);
$signatureData .=... | [
"private",
"function",
"createSignature",
"(",
"RequestInterface",
"$",
"request",
")",
"{",
"$",
"headers",
"=",
"$",
"request",
"->",
"getHeaders",
"(",
")",
";",
"ksort",
"(",
"$",
"headers",
")",
";",
"$",
"signatureData",
"=",
"$",
"request",
"->",
... | @param RequestInterface $request
@return string | [
"@param",
"RequestInterface",
"$request"
] | train | https://github.com/verschoof/bunq-api/blob/df9aa19f384275f4f0deb26de0cb5e5f8b45ffcd/src/Middleware/RequestSignatureMiddleware.php#L57-L72 |
verschoof/bunq-api | src/Middleware/RequestSignatureMiddleware.php | RequestSignatureMiddleware.createSignatureDataFromHeaders | private function createSignatureDataFromHeaders(array $headers)
{
$signatureData = '';
foreach ($headers as $header => $values) {
foreach ($values as $value) {
if ($header === 'User-Agent'
|| $header === 'Cache-Control'
|| substr($... | php | private function createSignatureDataFromHeaders(array $headers)
{
$signatureData = '';
foreach ($headers as $header => $values) {
foreach ($values as $value) {
if ($header === 'User-Agent'
|| $header === 'Cache-Control'
|| substr($... | [
"private",
"function",
"createSignatureDataFromHeaders",
"(",
"array",
"$",
"headers",
")",
"{",
"$",
"signatureData",
"=",
"''",
";",
"foreach",
"(",
"$",
"headers",
"as",
"$",
"header",
"=>",
"$",
"values",
")",
"{",
"foreach",
"(",
"$",
"values",
"as",
... | @param array $headers
@return string | [
"@param",
"array",
"$headers"
] | train | https://github.com/verschoof/bunq-api/blob/df9aa19f384275f4f0deb26de0cb5e5f8b45ffcd/src/Middleware/RequestSignatureMiddleware.php#L79-L95 |
verschoof/bunq-api | src/Middleware/RequestSignatureMiddleware.php | RequestSignatureMiddleware.sign | private function sign($data)
{
if (openssl_sign((string)$data, $signature, $this->privateKey->toString(), static::SIGNATURE_ALGORITHM) !== true) {
throw new \Exception("Could not sign request: " . openssl_error_string());
}
return $signature;
} | php | private function sign($data)
{
if (openssl_sign((string)$data, $signature, $this->privateKey->toString(), static::SIGNATURE_ALGORITHM) !== true) {
throw new \Exception("Could not sign request: " . openssl_error_string());
}
return $signature;
} | [
"private",
"function",
"sign",
"(",
"$",
"data",
")",
"{",
"if",
"(",
"openssl_sign",
"(",
"(",
"string",
")",
"$",
"data",
",",
"$",
"signature",
",",
"$",
"this",
"->",
"privateKey",
"->",
"toString",
"(",
")",
",",
"static",
"::",
"SIGNATURE_ALGORIT... | @param string $data
@return string
@throws \Exception | [
"@param",
"string",
"$data"
] | train | https://github.com/verschoof/bunq-api/blob/df9aa19f384275f4f0deb26de0cb5e5f8b45ffcd/src/Middleware/RequestSignatureMiddleware.php#L103-L110 |
o2system/html | src/Document.php | Document.& | public function &__get($tagName)
{
$getDocument[ $tagName ] = null;
if (in_array($tagName, ['html', 'head', 'body', 'title'])) {
$getDocument[ $tagName ] = $this->getElementsByTagName($tagName)->item(0);
}
return $getDocument[ $tagName ];
} | php | public function &__get($tagName)
{
$getDocument[ $tagName ] = null;
if (in_array($tagName, ['html', 'head', 'body', 'title'])) {
$getDocument[ $tagName ] = $this->getElementsByTagName($tagName)->item(0);
}
return $getDocument[ $tagName ];
} | [
"public",
"function",
"&",
"__get",
"(",
"$",
"tagName",
")",
"{",
"$",
"getDocument",
"[",
"$",
"tagName",
"]",
"=",
"null",
";",
"if",
"(",
"in_array",
"(",
"$",
"tagName",
",",
"[",
"'html'",
",",
"'head'",
",",
"'body'",
",",
"'title'",
"]",
")... | Document::__get
@param string $tagName The document tag element.
@return mixed The value at the specified index or false. | [
"Document",
"::",
"__get"
] | train | https://github.com/o2system/html/blob/b7336fb45d42603ce1064b25572a05d495887670/src/Document.php#L150-L159 |
o2system/html | src/Document.php | Document.saveHTMLFile | public function saveHTMLFile($filePath)
{
if ( ! is_string($filePath)) {
throw new \InvalidArgumentException('The filename argument must be of type string');
}
if ( ! is_writable($filePath)) {
return false;
}
$result = $this->saveHTML();
... | php | public function saveHTMLFile($filePath)
{
if ( ! is_string($filePath)) {
throw new \InvalidArgumentException('The filename argument must be of type string');
}
if ( ! is_writable($filePath)) {
return false;
}
$result = $this->saveHTML();
... | [
"public",
"function",
"saveHTMLFile",
"(",
"$",
"filePath",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"filePath",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'The filename argument must be of type string'",
")",
";",
"}",
"if",
... | Document::saveHTMLFile
Dumps the internal document into a file using HTML formatting
@see http://php.net/manual/domdocument.savehtmlfile.php
@param string $filePath <p>
The path to the saved HTML document.
</p>
@return int the number of bytes written or false if an error occurred.
@since 5.0 | [
"Document",
"::",
"saveHTMLFile"
] | train | https://github.com/o2system/html/blob/b7336fb45d42603ce1064b25572a05d495887670/src/Document.php#L177-L196 |
o2system/html | src/Document.php | Document.saveHTML | public function saveHTML(\DOMNode $node = null)
{
$headElement = $this->getElementsByTagName('head')->item(0);
$styleContent = trim($this->styleContent->__toString());
if ( ! empty($styleContent)) {
$styleElement = $this->createElement('style', $styleContent);
... | php | public function saveHTML(\DOMNode $node = null)
{
$headElement = $this->getElementsByTagName('head')->item(0);
$styleContent = trim($this->styleContent->__toString());
if ( ! empty($styleContent)) {
$styleElement = $this->createElement('style', $styleContent);
... | [
"public",
"function",
"saveHTML",
"(",
"\\",
"DOMNode",
"$",
"node",
"=",
"null",
")",
"{",
"$",
"headElement",
"=",
"$",
"this",
"->",
"getElementsByTagName",
"(",
"'head'",
")",
"->",
"item",
"(",
"0",
")",
";",
"$",
"styleContent",
"=",
"trim",
"(",... | Document::saveHTML
Dumps the internal document into a string using HTML formatting.
@see http://php.net/manual/domdocument.savehtml.php
@param \DOMNode $node [optional] parameter to output a subset of the document.
@return string the HTML, or false if an error occurred.
@since 5.0 | [
"Document",
"::",
"saveHTML"
] | train | https://github.com/o2system/html/blob/b7336fb45d42603ce1064b25572a05d495887670/src/Document.php#L212-L282 |
o2system/html | src/Document.php | Document.find | public function find($expression)
{
$xpath = new Dom\XPath($this);
$xpath->registerNamespace("php", "http://php.net/xpath");
$xpath->registerPhpFunctions();
return $xpath->query($expression);
} | php | public function find($expression)
{
$xpath = new Dom\XPath($this);
$xpath->registerNamespace("php", "http://php.net/xpath");
$xpath->registerPhpFunctions();
return $xpath->query($expression);
} | [
"public",
"function",
"find",
"(",
"$",
"expression",
")",
"{",
"$",
"xpath",
"=",
"new",
"Dom",
"\\",
"XPath",
"(",
"$",
"this",
")",
";",
"$",
"xpath",
"->",
"registerNamespace",
"(",
"\"php\"",
",",
"\"http://php.net/xpath\"",
")",
";",
"$",
"xpath",
... | Document::find
JQuery style document expression finder.
@param string $expression String of document expression.
@return Dom\Lists\Nodes | [
"Document",
"::",
"find"
] | train | https://github.com/o2system/html/blob/b7336fb45d42603ce1064b25572a05d495887670/src/Document.php#L295-L303 |
o2system/html | src/Document.php | Document.importSourceNode | public function importSourceNode($source)
{
$DOMDocument = new self();
$DOMDocument->loadHTML($source);
$this->metaNodes->import($DOMDocument->metaNodes);
$this->headScriptNodes->import($DOMDocument->headScriptNodes);
$this->bodyScriptNodes->import($DOMDocument->bodyS... | php | public function importSourceNode($source)
{
$DOMDocument = new self();
$DOMDocument->loadHTML($source);
$this->metaNodes->import($DOMDocument->metaNodes);
$this->headScriptNodes->import($DOMDocument->headScriptNodes);
$this->bodyScriptNodes->import($DOMDocument->bodyS... | [
"public",
"function",
"importSourceNode",
"(",
"$",
"source",
")",
"{",
"$",
"DOMDocument",
"=",
"new",
"self",
"(",
")",
";",
"$",
"DOMDocument",
"->",
"loadHTML",
"(",
"$",
"source",
")",
";",
"$",
"this",
"->",
"metaNodes",
"->",
"import",
"(",
"$",... | Document::importSourceNode
Import HTML source code into document.
@param string $source HTML Source Code.
@return \DOMNode|\O2System\Html\Dom\Element | [
"Document",
"::",
"importSourceNode"
] | train | https://github.com/o2system/html/blob/b7336fb45d42603ce1064b25572a05d495887670/src/Document.php#L316-L343 |
o2system/html | src/Document.php | Document.loadHTML | public function loadHTML($source, $options = 0)
{
// Enables libxml errors handling
$internalErrorsOptionValue = libxml_use_internal_errors();
if ($internalErrorsOptionValue === false) {
libxml_use_internal_errors(true);
}
$source = $this->parseHTML($so... | php | public function loadHTML($source, $options = 0)
{
// Enables libxml errors handling
$internalErrorsOptionValue = libxml_use_internal_errors();
if ($internalErrorsOptionValue === false) {
libxml_use_internal_errors(true);
}
$source = $this->parseHTML($so... | [
"public",
"function",
"loadHTML",
"(",
"$",
"source",
",",
"$",
"options",
"=",
"0",
")",
"{",
"// Enables libxml errors handling\r",
"$",
"internalErrorsOptionValue",
"=",
"libxml_use_internal_errors",
"(",
")",
";",
"if",
"(",
"$",
"internalErrorsOptionValue",
"==... | Document::loadHTML
Load HTML from a string.
@see http://php.net/manual/domdocument.loadhtml.php
@param string $source <p>
The HTML string.
</p>
@param int|string $options [optional] <p>
Since PHP 5.4.0 and Libxml 2.6.0, you may also
use the options parameter to specify additional Libxml parameters.
</p>
@ret... | [
"Document",
"::",
"loadHTML"
] | train | https://github.com/o2system/html/blob/b7336fb45d42603ce1064b25572a05d495887670/src/Document.php#L367-L427 |
o2system/html | src/Document.php | Document.parseHTML | private function parseHTML($source)
{
$DOMDocument = new \DOMDocument();
// Has inline script element
if (preg_match_all('/<script((?:(?!src=).)*?)>(.*?)<\/script>/smix', $source, $matches)) {
if (isset($matches[ 2 ])) {
foreach ($matches[ 2 ] as $match) {... | php | private function parseHTML($source)
{
$DOMDocument = new \DOMDocument();
// Has inline script element
if (preg_match_all('/<script((?:(?!src=).)*?)>(.*?)<\/script>/smix', $source, $matches)) {
if (isset($matches[ 2 ])) {
foreach ($matches[ 2 ] as $match) {... | [
"private",
"function",
"parseHTML",
"(",
"$",
"source",
")",
"{",
"$",
"DOMDocument",
"=",
"new",
"\\",
"DOMDocument",
"(",
")",
";",
"// Has inline script element\r",
"if",
"(",
"preg_match_all",
"(",
"'/<script((?:(?!src=).)*?)>(.*?)<\\/script>/smix'",
",",
"$",
"... | Document::parseHTML
Parse HTML Source Code.
@param string $source HTML Source Code.
@return mixed | [
"Document",
"::",
"parseHTML"
] | train | https://github.com/o2system/html/blob/b7336fb45d42603ce1064b25572a05d495887670/src/Document.php#L440-L530 |
o2system/html | src/Document.php | Document.load | public function load($filePath, $options = null)
{
if (file_exists($filePath)) {
return $this->loadHTMLFile($filePath, $options);
} elseif (is_string($filePath)) {
return $this->loadHTML($filePath, $options);
} elseif ( ! empty($filePath)) {
return ... | php | public function load($filePath, $options = null)
{
if (file_exists($filePath)) {
return $this->loadHTMLFile($filePath, $options);
} elseif (is_string($filePath)) {
return $this->loadHTML($filePath, $options);
} elseif ( ! empty($filePath)) {
return ... | [
"public",
"function",
"load",
"(",
"$",
"filePath",
",",
"$",
"options",
"=",
"null",
")",
"{",
"if",
"(",
"file_exists",
"(",
"$",
"filePath",
")",
")",
"{",
"return",
"$",
"this",
"->",
"loadHTMLFile",
"(",
"$",
"filePath",
",",
"$",
"options",
")"... | Document::load
Load HTML from a file.
@link http://php.net/manual/domdocument.load.php
@param string $filePath <p>
The path to the HTML document.
</p>
@param int|string $options [optional] <p>
Bitwise OR
of the libxml option constants.
</p>
@return mixed true on success or false on failure. If called statical... | [
"Document",
"::",
"load"
] | train | https://github.com/o2system/html/blob/b7336fb45d42603ce1064b25572a05d495887670/src/Document.php#L554-L563 |
comelyio/comely | src/Comely/Kernel/Toolkit/Number.php | Number.Range | public static function Range(int $num, int $from, int $to): bool
{
return ($num >= $from && $num <= $to) ? true : false;
} | php | public static function Range(int $num, int $from, int $to): bool
{
return ($num >= $from && $num <= $to) ? true : false;
} | [
"public",
"static",
"function",
"Range",
"(",
"int",
"$",
"num",
",",
"int",
"$",
"from",
",",
"int",
"$",
"to",
")",
":",
"bool",
"{",
"return",
"(",
"$",
"num",
">=",
"$",
"from",
"&&",
"$",
"num",
"<=",
"$",
"to",
")",
"?",
"true",
":",
"f... | Check if specified number is with in specified range
@param int $num
@param int $from
@param int $to
@return bool | [
"Check",
"if",
"specified",
"number",
"is",
"with",
"in",
"specified",
"range"
] | train | https://github.com/comelyio/comely/blob/561ea7aef36fea347a1a79d3ee5597d4057ddf82/src/Comely/Kernel/Toolkit/Number.php#L31-L34 |
comelyio/comely | src/Comely/Kernel/Toolkit/Number.php | Number.BcRange | public static function BcRange(string $num, string $from, string $to, int $scale = 0): bool
{
if (!preg_match('/^[0-9]+(\.[0-9]+)?$/', $num)) {
return false;
}
if (bccomp($num, $from, $scale) !== -1) {
if (bccomp($num, $to, $scale) !== 1) {
return tru... | php | public static function BcRange(string $num, string $from, string $to, int $scale = 0): bool
{
if (!preg_match('/^[0-9]+(\.[0-9]+)?$/', $num)) {
return false;
}
if (bccomp($num, $from, $scale) !== -1) {
if (bccomp($num, $to, $scale) !== 1) {
return tru... | [
"public",
"static",
"function",
"BcRange",
"(",
"string",
"$",
"num",
",",
"string",
"$",
"from",
",",
"string",
"$",
"to",
",",
"int",
"$",
"scale",
"=",
"0",
")",
":",
"bool",
"{",
"if",
"(",
"!",
"preg_match",
"(",
"'/^[0-9]+(\\.[0-9]+)?$/'",
",",
... | Check if specified number is with in specified range (using BCMath)
@param string $num
@param string $from
@param string $to
@param int $scale
@return bool | [
"Check",
"if",
"specified",
"number",
"is",
"with",
"in",
"specified",
"range",
"(",
"using",
"BCMath",
")"
] | train | https://github.com/comelyio/comely/blob/561ea7aef36fea347a1a79d3ee5597d4057ddf82/src/Comely/Kernel/Toolkit/Number.php#L45-L58 |
stubbles/stubbles-webapp-core | src/main/php/routing/ResourceOptions.php | ResourceOptions.resolve | public function resolve(Request $request, Response $response)
{
$allowedMethods = $this->matchingRoutes->allowedMethods();
if (!in_array(Http::OPTIONS, $allowedMethods)) {
$allowedMethods[] = Http::OPTIONS;
}
$response->addHeader('Allow', join(', ', $allowedMethods))
... | php | public function resolve(Request $request, Response $response)
{
$allowedMethods = $this->matchingRoutes->allowedMethods();
if (!in_array(Http::OPTIONS, $allowedMethods)) {
$allowedMethods[] = Http::OPTIONS;
}
$response->addHeader('Allow', join(', ', $allowedMethods))
... | [
"public",
"function",
"resolve",
"(",
"Request",
"$",
"request",
",",
"Response",
"$",
"response",
")",
"{",
"$",
"allowedMethods",
"=",
"$",
"this",
"->",
"matchingRoutes",
"->",
"allowedMethods",
"(",
")",
";",
"if",
"(",
"!",
"in_array",
"(",
"Http",
... | creates processor instance
@param \stubbles\webapp\Request $request current request
@param \stubbles\webapp\Response $response response to send
@return void | [
"creates",
"processor",
"instance"
] | train | https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/routing/ResourceOptions.php#L68-L80 |
delboy1978uk/form | src/Renderer/HorizontalFormRenderer.php | HorizontalFormRenderer.surroundInDiv | private function surroundInDiv(DOMNode $element, $class)
{
$div = $this->createElement('div');
$div->setAttribute('class', $class);
$div->appendChild($element);
return $div;
} | php | private function surroundInDiv(DOMNode $element, $class)
{
$div = $this->createElement('div');
$div->setAttribute('class', $class);
$div->appendChild($element);
return $div;
} | [
"private",
"function",
"surroundInDiv",
"(",
"DOMNode",
"$",
"element",
",",
"$",
"class",
")",
"{",
"$",
"div",
"=",
"$",
"this",
"->",
"createElement",
"(",
"'div'",
")",
";",
"$",
"div",
"->",
"setAttribute",
"(",
"'class'",
",",
"$",
"class",
")",
... | Surround an element in a div with a given class
@param DOMNode $element
@param $class
@return DOMElement | [
"Surround",
"an",
"element",
"in",
"a",
"div",
"with",
"a",
"given",
"class"
] | train | https://github.com/delboy1978uk/form/blob/fbbb042d95deef4603a19edf08c0497f720398a6/src/Renderer/HorizontalFormRenderer.php#L93-L99 |
puli/discovery | src/Api/Type/BindingNotAcceptedException.php | BindingNotAcceptedException.forBindingClass | public static function forBindingClass($typeName, $bindingClass, Exception $cause = null)
{
return new static(sprintf(
'The type "%s" does accept bindings of class "%s".',
$typeName,
$bindingClass
), 0, $cause);
} | php | public static function forBindingClass($typeName, $bindingClass, Exception $cause = null)
{
return new static(sprintf(
'The type "%s" does accept bindings of class "%s".',
$typeName,
$bindingClass
), 0, $cause);
} | [
"public",
"static",
"function",
"forBindingClass",
"(",
"$",
"typeName",
",",
"$",
"bindingClass",
",",
"Exception",
"$",
"cause",
"=",
"null",
")",
"{",
"return",
"new",
"static",
"(",
"sprintf",
"(",
"'The type \"%s\" does accept bindings of class \"%s\".'",
",",
... | Creates a new exception.
@param string $typeName The name of the binding type.
@param string $bindingClass The class name of the binding.
@param Exception|null $cause The exception that caused this
exception.
@return static The created exception. | [
"Creates",
"a",
"new",
"exception",
"."
] | train | https://github.com/puli/discovery/blob/975f5e099563f1096bfabc17fbe4d1816408ad98/src/Api/Type/BindingNotAcceptedException.php#L36-L43 |
blast-project/CoreBundle | src/Admin/Traits/CollectionsManager.php | CollectionsManager.addManagedCollections | public function addManagedCollections($collections)
{
if (!is_array($collections)) {
$collections = array($collections);
}
$this->managedCollections = array_merge($this->managedCollections, $collections);
return $this;
} | php | public function addManagedCollections($collections)
{
if (!is_array($collections)) {
$collections = array($collections);
}
$this->managedCollections = array_merge($this->managedCollections, $collections);
return $this;
} | [
"public",
"function",
"addManagedCollections",
"(",
"$",
"collections",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"collections",
")",
")",
"{",
"$",
"collections",
"=",
"array",
"(",
"$",
"collections",
")",
";",
"}",
"$",
"this",
"->",
"managedCol... | function addManagedCollections.
@param $collections array or string, describing the collections to manage
@return CoreAdmin $this | [
"function",
"addManagedCollections",
"."
] | train | https://github.com/blast-project/CoreBundle/blob/7a0832758ca14e5bc5d65515532c1220df3930ae/src/Admin/Traits/CollectionsManager.php#L38-L46 |
gregorybesson/PlaygroundCore | src/Service/Locale.php | Locale.getLocaleMapper | public function getLocaleMapper()
{
if (null === $this->localeMapper) {
$this->localeMapper = $this->serviceLocator->get('playgroundcore_locale_mapper');
}
return $this->localeMapper;
} | php | public function getLocaleMapper()
{
if (null === $this->localeMapper) {
$this->localeMapper = $this->serviceLocator->get('playgroundcore_locale_mapper');
}
return $this->localeMapper;
} | [
"public",
"function",
"getLocaleMapper",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"localeMapper",
")",
"{",
"$",
"this",
"->",
"localeMapper",
"=",
"$",
"this",
"->",
"serviceLocator",
"->",
"get",
"(",
"'playgroundcore_locale_mapper'",
")... | getLocaleMapper
@return LocaleMapper | [
"getLocaleMapper"
] | train | https://github.com/gregorybesson/PlaygroundCore/blob/f8dfa4c7660b54354933b3c28c0cf35304a649df/src/Service/Locale.php#L40-L47 |
gregorybesson/PlaygroundCore | src/Service/ShortenUrl.php | ShortenUrl.shortenUrl | public function shortenUrl($url)
{
if ($this->getOptions()->getBitlyApiKey() && $this->getOptions()->getBitlyUsername()) {
$client = new \Zend\Http\Client($this->getOptions()->getBitlyUrl());
$client->setParameterGet(array(
'format' => 'json',
'longUr... | php | public function shortenUrl($url)
{
if ($this->getOptions()->getBitlyApiKey() && $this->getOptions()->getBitlyUsername()) {
$client = new \Zend\Http\Client($this->getOptions()->getBitlyUrl());
$client->setParameterGet(array(
'format' => 'json',
'longUr... | [
"public",
"function",
"shortenUrl",
"(",
"$",
"url",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getOptions",
"(",
")",
"->",
"getBitlyApiKey",
"(",
")",
"&&",
"$",
"this",
"->",
"getOptions",
"(",
")",
"->",
"getBitlyUsername",
"(",
")",
")",
"{",
"$",... | This method call Bit.ly to shorten a given URL.
@param unknown_type $url
@return unknown | [
"This",
"method",
"call",
"Bit",
".",
"ly",
"to",
"shorten",
"a",
"given",
"URL",
"."
] | train | https://github.com/gregorybesson/PlaygroundCore/blob/f8dfa4c7660b54354933b3c28c0cf35304a649df/src/Service/ShortenUrl.php#L36-L57 |
yosmanyga/resource | src/Yosmanyga/Resource/Reader/Iterator/YamlFileReader.php | YamlFileReader.open | public function open(Resource $resource)
{
$file = $resource->getMetadata('file');
if (!is_file($file)) {
throw new \InvalidArgumentException(sprintf('File "%s" not found.', $file));
}
try {
$data = (array) Yaml::parse($file);
} catch (\Exception $e)... | php | public function open(Resource $resource)
{
$file = $resource->getMetadata('file');
if (!is_file($file)) {
throw new \InvalidArgumentException(sprintf('File "%s" not found.', $file));
}
try {
$data = (array) Yaml::parse($file);
} catch (\Exception $e)... | [
"public",
"function",
"open",
"(",
"Resource",
"$",
"resource",
")",
"{",
"$",
"file",
"=",
"$",
"resource",
"->",
"getMetadata",
"(",
"'file'",
")",
";",
"if",
"(",
"!",
"is_file",
"(",
"$",
"file",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgum... | {@inheritdoc} | [
"{"
] | train | https://github.com/yosmanyga/resource/blob/a8b505c355920a908917a0484f764ddfa63205fa/src/Yosmanyga/Resource/Reader/Iterator/YamlFileReader.php#L38-L54 |
jan-dolata/crude-crud | src/Engine/Traits/WithValidationTrait.php | WithValidationTrait.getValidationRules | public function getValidationRules($attrList = [], $values = [])
{
$allRules = isset($this->validationRules)
? $this->validationRules
: [];
foreach ($allRules as &$item) {
$keys = $this->getRuleAttr($item);
foreach ($keys as $key) {
$... | php | public function getValidationRules($attrList = [], $values = [])
{
$allRules = isset($this->validationRules)
? $this->validationRules
: [];
foreach ($allRules as &$item) {
$keys = $this->getRuleAttr($item);
foreach ($keys as $key) {
$... | [
"public",
"function",
"getValidationRules",
"(",
"$",
"attrList",
"=",
"[",
"]",
",",
"$",
"values",
"=",
"[",
"]",
")",
"{",
"$",
"allRules",
"=",
"isset",
"(",
"$",
"this",
"->",
"validationRules",
")",
"?",
"$",
"this",
"->",
"validationRules",
":",... | Return validation rules as an array
Function returns the list of rules for attributes listed in $attrList
@param array $attrList = []
@param array $values = null
@return array | [
"Return",
"validation",
"rules",
"as",
"an",
"array",
"Function",
"returns",
"the",
"list",
"of",
"rules",
"for",
"attributes",
"listed",
"in",
"$attrList"
] | train | https://github.com/jan-dolata/crude-crud/blob/9129ea08278835cf5cecfd46a90369226ae6bdd7/src/Engine/Traits/WithValidationTrait.php#L20-L43 |
jan-dolata/crude-crud | src/Engine/Traits/WithValidationTrait.php | WithValidationTrait.setValidationRules | public function setValidationRules($attr, $validationRules = null)
{
$rules = is_array($attr)
? $attr
: [$attr => $validationRules];
$this->validationRules = array_merge($this->validationRules, $rules);
return $this;
} | php | public function setValidationRules($attr, $validationRules = null)
{
$rules = is_array($attr)
? $attr
: [$attr => $validationRules];
$this->validationRules = array_merge($this->validationRules, $rules);
return $this;
} | [
"public",
"function",
"setValidationRules",
"(",
"$",
"attr",
",",
"$",
"validationRules",
"=",
"null",
")",
"{",
"$",
"rules",
"=",
"is_array",
"(",
"$",
"attr",
")",
"?",
"$",
"attr",
":",
"[",
"$",
"attr",
"=>",
"$",
"validationRules",
"]",
";",
"... | Set validation rules array
@param string|array $attr
@param string $validationRules = null
@return self | [
"Set",
"validation",
"rules",
"array"
] | train | https://github.com/jan-dolata/crude-crud/blob/9129ea08278835cf5cecfd46a90369226ae6bdd7/src/Engine/Traits/WithValidationTrait.php#L64-L73 |
sauls/helpers | src/Operation/TypeOperation/Collection/ConverterCollection.php | ConverterCollection.get | public function get(string $type): array
{
try {
return $this->converters[$this->resolveType($type)];
} catch (\Throwable $t) {
throw new InvalidTypeConverterException(
sprintf('Invalid converter type `%s`.', $type)
);
}
} | php | public function get(string $type): array
{
try {
return $this->converters[$this->resolveType($type)];
} catch (\Throwable $t) {
throw new InvalidTypeConverterException(
sprintf('Invalid converter type `%s`.', $type)
);
}
} | [
"public",
"function",
"get",
"(",
"string",
"$",
"type",
")",
":",
"array",
"{",
"try",
"{",
"return",
"$",
"this",
"->",
"converters",
"[",
"$",
"this",
"->",
"resolveType",
"(",
"$",
"type",
")",
"]",
";",
"}",
"catch",
"(",
"\\",
"Throwable",
"$... | @return array|ConverterInterface[]
@throws \Sauls\Component\Helper\Exception\InvalidTypeConverterException | [
"@return",
"array|ConverterInterface",
"[]"
] | train | https://github.com/sauls/helpers/blob/de7dd250eb70ff10bada18acab8c7d8f27fad385/src/Operation/TypeOperation/Collection/ConverterCollection.php#L83-L92 |
darkwebdesign/doctrine-unit-testing | src/Mocks/EntityManagerMock.php | EntityManagerMock.create | public static function create($conn, Configuration $config = null, EventManager $eventManager = null)
{
if (null === $config) {
$config = new Configuration();
$config->setProxyDir(__DIR__ . '/../Proxies');
$config->setProxyNamespace('Doctrine\Tests\Proxies');
... | php | public static function create($conn, Configuration $config = null, EventManager $eventManager = null)
{
if (null === $config) {
$config = new Configuration();
$config->setProxyDir(__DIR__ . '/../Proxies');
$config->setProxyNamespace('Doctrine\Tests\Proxies');
... | [
"public",
"static",
"function",
"create",
"(",
"$",
"conn",
",",
"Configuration",
"$",
"config",
"=",
"null",
",",
"EventManager",
"$",
"eventManager",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"config",
")",
"{",
"$",
"config",
"=",
"new",... | Mock factory method to create an EntityManager.
{@inheritdoc} | [
"Mock",
"factory",
"method",
"to",
"create",
"an",
"EntityManager",
"."
] | train | https://github.com/darkwebdesign/doctrine-unit-testing/blob/0daf50359563bc0679925e573a7105d6cd57168a/src/Mocks/EntityManagerMock.php#L69-L82 |
heyday/heystack | src/DependencyInjection/SilverStripe/HeystackSilverStripeContainerBuilder.php | HeystackSilverStripeContainerBuilder.has | public function has($id)
{
if ($this->isSilverStripeServiceRequest($id)) {
return (bool) $this->getSilverStripeService($id);
} else {
return parent::has($id);
}
} | php | public function has($id)
{
if ($this->isSilverStripeServiceRequest($id)) {
return (bool) $this->getSilverStripeService($id);
} else {
return parent::has($id);
}
} | [
"public",
"function",
"has",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isSilverStripeServiceRequest",
"(",
"$",
"id",
")",
")",
"{",
"return",
"(",
"bool",
")",
"$",
"this",
"->",
"getSilverStripeService",
"(",
"$",
"id",
")",
";",
"}"... | Return true if the service requested is a SilverStripe service and it exists in the SS container
@param string $id
@return bool | [
"Return",
"true",
"if",
"the",
"service",
"requested",
"is",
"a",
"SilverStripe",
"service",
"and",
"it",
"exists",
"in",
"the",
"SS",
"container"
] | train | https://github.com/heyday/heystack/blob/2c051933f8c532d0a9a23be6ee1ff5c619e47dfe/src/DependencyInjection/SilverStripe/HeystackSilverStripeContainerBuilder.php#L28-L35 |
movoin/one-swoole | src/Routing/Commands/ListCommand.php | ListCommand.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
$docs = new Parser(APP_PATH);
$docs->parse();
// {{
$this->title('所有路由规则');
// }}
foreach ($docs as $class => $doc) {
foreach ((array) $doc['methods'] as $method) {
... | php | protected function execute(InputInterface $input, OutputInterface $output)
{
$docs = new Parser(APP_PATH);
$docs->parse();
// {{
$this->title('所有路由规则');
// }}
foreach ($docs as $class => $doc) {
foreach ((array) $doc['methods'] as $method) {
... | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"docs",
"=",
"new",
"Parser",
"(",
"APP_PATH",
")",
";",
"$",
"docs",
"->",
"parse",
"(",
")",
";",
"// {{",
"$",
"this",
"->... | 执行命令
@param \Symfony\Component\Console\Input\InputInterface $input
@param \Symfony\Component\Console\Output\OutputInterface $output | [
"执行命令"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Routing/Commands/ListCommand.php#L40-L65 |
dragosprotung/stc-core | src/Workout/Loader/TCX.php | TCX.load | public function load(string $filePath): Workout
{
$simpleXML = new \SimpleXMLElement($filePath);
$tracks = [];
foreach ($simpleXML->Activities[0] as $simpleXMLActivity) {
// Sport.
$attributes = $simpleXMLActivity->attributes();
$sport = SportMapperInterf... | php | public function load(string $filePath): Workout
{
$simpleXML = new \SimpleXMLElement($filePath);
$tracks = [];
foreach ($simpleXML->Activities[0] as $simpleXMLActivity) {
// Sport.
$attributes = $simpleXMLActivity->attributes();
$sport = SportMapperInterf... | [
"public",
"function",
"load",
"(",
"string",
"$",
"filePath",
")",
":",
"Workout",
"{",
"$",
"simpleXML",
"=",
"new",
"\\",
"SimpleXMLElement",
"(",
"$",
"filePath",
")",
";",
"$",
"tracks",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"simpleXML",
"->",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/dragosprotung/stc-core/blob/9783e3414294f4ee555a1d538d2807269deeb9e7/src/Workout/Loader/TCX.php#L23-L61 |
dragosprotung/stc-core | src/Workout/Loader/TCX.php | TCX.parseExtensions | protected function parseExtensions(\SimpleXMLElement $trackPoint): array
{
$return = array();
if ($trackPoint->HeartRateBpm) {
$return[] = HR::fromValue((string)$trackPoint->HeartRateBpm->Value);
}
return $return;
} | php | protected function parseExtensions(\SimpleXMLElement $trackPoint): array
{
$return = array();
if ($trackPoint->HeartRateBpm) {
$return[] = HR::fromValue((string)$trackPoint->HeartRateBpm->Value);
}
return $return;
} | [
"protected",
"function",
"parseExtensions",
"(",
"\\",
"SimpleXMLElement",
"$",
"trackPoint",
")",
":",
"array",
"{",
"$",
"return",
"=",
"array",
"(",
")",
";",
"if",
"(",
"$",
"trackPoint",
"->",
"HeartRateBpm",
")",
"{",
"$",
"return",
"[",
"]",
"=",
... | Parse and return an array of extensions from the XML.
@param \SimpleXMLElement $trackPoint The track point from the TCX to parse.
@return ExtensionInterface[] | [
"Parse",
"and",
"return",
"an",
"array",
"of",
"extensions",
"from",
"the",
"XML",
"."
] | train | https://github.com/dragosprotung/stc-core/blob/9783e3414294f4ee555a1d538d2807269deeb9e7/src/Workout/Loader/TCX.php#L69-L78 |
Atlantic18/CoralCoreBundle | Utility/JsonParser.php | JsonParser.importString | public function importString($content, $isMandatory = true)
{
if(empty($content) && $isMandatory)
{
throw new JsonException("Json content mandatory but none found.");
}
$this->params = array();
if (!empty($content))
{
$this->params = @json_dec... | php | public function importString($content, $isMandatory = true)
{
if(empty($content) && $isMandatory)
{
throw new JsonException("Json content mandatory but none found.");
}
$this->params = array();
if (!empty($content))
{
$this->params = @json_dec... | [
"public",
"function",
"importString",
"(",
"$",
"content",
",",
"$",
"isMandatory",
"=",
"true",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"content",
")",
"&&",
"$",
"isMandatory",
")",
"{",
"throw",
"new",
"JsonException",
"(",
"\"Json content mandatory but n... | Import string json and parse
@param string $content string json
@param boolean $isMandatory content is mandatory or can be empty - false
@return array parsed json string | [
"Import",
"string",
"json",
"and",
"parse"
] | train | https://github.com/Atlantic18/CoralCoreBundle/blob/7d74ffaf51046ad13cbfc2b0b69d656a499f38ab/Utility/JsonParser.php#L23-L47 |
Atlantic18/CoralCoreBundle | Utility/JsonParser.php | JsonParser.translatePathElement | private function translatePathElement($path, &$paramsRef)
{
$dotPos = strpos($path, '.');
$currPath = $path;
if($dotPos !== false)
{
$currPath = substr($path, 0, $dotPos);
}
if($currPath == '*')
{
//Hell begins
if($dotPos... | php | private function translatePathElement($path, &$paramsRef)
{
$dotPos = strpos($path, '.');
$currPath = $path;
if($dotPos !== false)
{
$currPath = substr($path, 0, $dotPos);
}
if($currPath == '*')
{
//Hell begins
if($dotPos... | [
"private",
"function",
"translatePathElement",
"(",
"$",
"path",
",",
"&",
"$",
"paramsRef",
")",
"{",
"$",
"dotPos",
"=",
"strpos",
"(",
"$",
"path",
",",
"'.'",
")",
";",
"$",
"currPath",
"=",
"$",
"path",
";",
"if",
"(",
"$",
"dotPos",
"!==",
"f... | Traverse through params according to path. This is a recursive function.
@param string $path path to traverse
@param array $paramsRef reference to the traversed array
@return mixed found value/s | [
"Traverse",
"through",
"params",
"according",
"to",
"path",
".",
"This",
"is",
"a",
"recursive",
"function",
"."
] | train | https://github.com/Atlantic18/CoralCoreBundle/blob/7d74ffaf51046ad13cbfc2b0b69d656a499f38ab/Utility/JsonParser.php#L86-L164 |
Atlantic18/CoralCoreBundle | Utility/JsonParser.php | JsonParser.getMandatoryParam | public function getMandatoryParam($path)
{
$this->validatePath($path);
$value = $this->translatePathElement($path, $this->params);
if(null === $value)
{
throw new JsonException("Json mandatory param '$path' not found found.");
}
return $value;
} | php | public function getMandatoryParam($path)
{
$this->validatePath($path);
$value = $this->translatePathElement($path, $this->params);
if(null === $value)
{
throw new JsonException("Json mandatory param '$path' not found found.");
}
return $value;
} | [
"public",
"function",
"getMandatoryParam",
"(",
"$",
"path",
")",
"{",
"$",
"this",
"->",
"validatePath",
"(",
"$",
"path",
")",
";",
"$",
"value",
"=",
"$",
"this",
"->",
"translatePathElement",
"(",
"$",
"path",
",",
"$",
"this",
"->",
"params",
")",... | Returns json key value or throws exception if key doesn't exist
@throws JsonException If key doesn't exist
@param string $path key
@return mixed value | [
"Returns",
"json",
"key",
"value",
"or",
"throws",
"exception",
"if",
"key",
"doesn",
"t",
"exist"
] | train | https://github.com/Atlantic18/CoralCoreBundle/blob/7d74ffaf51046ad13cbfc2b0b69d656a499f38ab/Utility/JsonParser.php#L173-L184 |
Atlantic18/CoralCoreBundle | Utility/JsonParser.php | JsonParser.hasParam | public function hasParam($path)
{
$this->validatePath($path);
$value = $this->translatePathElement($path, $this->params);
return (null === $value) ? false : true;
} | php | public function hasParam($path)
{
$this->validatePath($path);
$value = $this->translatePathElement($path, $this->params);
return (null === $value) ? false : true;
} | [
"public",
"function",
"hasParam",
"(",
"$",
"path",
")",
"{",
"$",
"this",
"->",
"validatePath",
"(",
"$",
"path",
")",
";",
"$",
"value",
"=",
"$",
"this",
"->",
"translatePathElement",
"(",
"$",
"path",
",",
"$",
"this",
"->",
"params",
")",
";",
... | Returns json true if path exists
@param string $path json path
@return boolean true if path exists | [
"Returns",
"json",
"true",
"if",
"path",
"exists"
] | train | https://github.com/Atlantic18/CoralCoreBundle/blob/7d74ffaf51046ad13cbfc2b0b69d656a499f38ab/Utility/JsonParser.php#L192-L199 |
Atlantic18/CoralCoreBundle | Utility/JsonParser.php | JsonParser.getOptionalParam | public function getOptionalParam($path, $default = false)
{
$this->validatePath($path);
$value = $this->translatePathElement($path, $this->params);
if(null === $value)
{
return (null === $default) ? null : $default;
}
return $value;
} | php | public function getOptionalParam($path, $default = false)
{
$this->validatePath($path);
$value = $this->translatePathElement($path, $this->params);
if(null === $value)
{
return (null === $default) ? null : $default;
}
return $value;
} | [
"public",
"function",
"getOptionalParam",
"(",
"$",
"path",
",",
"$",
"default",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"validatePath",
"(",
"$",
"path",
")",
";",
"$",
"value",
"=",
"$",
"this",
"->",
"translatePathElement",
"(",
"$",
"path",
",",... | Returns json key value or false if key doesn't exist
@param string $path json key
@param string $default default value to be returned
@return mixed value | [
"Returns",
"json",
"key",
"value",
"or",
"false",
"if",
"key",
"doesn",
"t",
"exist"
] | train | https://github.com/Atlantic18/CoralCoreBundle/blob/7d74ffaf51046ad13cbfc2b0b69d656a499f38ab/Utility/JsonParser.php#L208-L220 |
ray-di/Ray.WebFormModule | docs/demo/1.csrf/ContactForm.php | ContactForm.init | public function init()
{
$this->setField('name', 'text')
->setAttribs([
'id' => 'name',
'size' => 20,
'maxlength' => 20,
'class' => 'form-control',
'placeholder' => 'Your Name'
]);
$this->s... | php | public function init()
{
$this->setField('name', 'text')
->setAttribs([
'id' => 'name',
'size' => 20,
'maxlength' => 20,
'class' => 'form-control',
'placeholder' => 'Your Name'
]);
$this->s... | [
"public",
"function",
"init",
"(",
")",
"{",
"$",
"this",
"->",
"setField",
"(",
"'name'",
",",
"'text'",
")",
"->",
"setAttribs",
"(",
"[",
"'id'",
"=>",
"'name'",
",",
"'size'",
"=>",
"20",
",",
"'maxlength'",
"=>",
"20",
",",
"'class'",
"=>",
"'fo... | {@inheritdoc} | [
"{"
] | train | https://github.com/ray-di/Ray.WebFormModule/blob/4b6d33adb4a5c285278a068f3e7a5afdc4e680d9/docs/demo/1.csrf/ContactForm.php#L47-L87 |
larakit/lk-staticfiles | src/StaticFiles/Js.php | Js.addInline | function addInline($js, $id = null) {
if($id) {
$this->js_inline[$id] = $js;
} else {
$this->js_inline[] = $js;
}
return $this;
} | php | function addInline($js, $id = null) {
if($id) {
$this->js_inline[$id] = $js;
} else {
$this->js_inline[] = $js;
}
return $this;
} | [
"function",
"addInline",
"(",
"$",
"js",
",",
"$",
"id",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"id",
")",
"{",
"$",
"this",
"->",
"js_inline",
"[",
"$",
"id",
"]",
"=",
"$",
"js",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"js_inline",
"[",
... | Добавление куска инлайн джаваскрипта
@param <type> $js
@param mixed $id - уникальный флаг куска кода, чтобы можно
было добавлять в цикле и не бояться дублей | [
"Добавление",
"куска",
"инлайн",
"джаваскрипта"
] | train | https://github.com/larakit/lk-staticfiles/blob/1ee718b1f3a00c29c46b06c2f501413599b0335a/src/StaticFiles/Js.php#L85-L93 |
larakit/lk-staticfiles | src/StaticFiles/Js.php | Js.addOnload | function addOnload($js, $id = null) {
if($id) {
$this->js_onload[$id] = $js;
} else {
$this->js_onload[] = $js;
}
return $this;
} | php | function addOnload($js, $id = null) {
if($id) {
$this->js_onload[$id] = $js;
} else {
$this->js_onload[] = $js;
}
return $this;
} | [
"function",
"addOnload",
"(",
"$",
"js",
",",
"$",
"id",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"id",
")",
"{",
"$",
"this",
"->",
"js_onload",
"[",
"$",
"id",
"]",
"=",
"$",
"js",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"js_onload",
"[",
... | Добавление кода, который должен выполниться при загрузке страницы
@param string $js
@param mixed $id - уникальный флаг куска кода, чтобы можно
было добавлять в цикле и не бояться дублей | [
"Добавление",
"кода",
"который",
"должен",
"выполниться",
"при",
"загрузке",
"страницы"
] | train | https://github.com/larakit/lk-staticfiles/blob/1ee718b1f3a00c29c46b06c2f501413599b0335a/src/StaticFiles/Js.php#L102-L110 |
larakit/lk-staticfiles | src/StaticFiles/Js.php | Js.addNoscript | function addNoscript($code, $id = null) {
if($id) {
$this->noscript[$id] = $code;
} else {
$this->noscript[] = $code;
}
return $this;
} | php | function addNoscript($code, $id = null) {
if($id) {
$this->noscript[$id] = $code;
} else {
$this->noscript[] = $code;
}
return $this;
} | [
"function",
"addNoscript",
"(",
"$",
"code",
",",
"$",
"id",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"id",
")",
"{",
"$",
"this",
"->",
"noscript",
"[",
"$",
"id",
"]",
"=",
"$",
"code",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"noscript",
"[... | Добавление HTML-кода, который должен быть вставлен в случае отключенного JS
@param $code
@param mixed $id - уникальный флаг куска кода, чтобы можно
было добавлять в цикле и не бояться дублей
@return $this | [
"Добавление",
"HTML",
"-",
"кода",
"который",
"должен",
"быть",
"вставлен",
"в",
"случае",
"отключенного",
"JS"
] | train | https://github.com/larakit/lk-staticfiles/blob/1ee718b1f3a00c29c46b06c2f501413599b0335a/src/StaticFiles/Js.php#L121-L129 |
larakit/lk-staticfiles | src/StaticFiles/Js.php | Js.getExternal | function getExternal($as_html = true) {
if(!$as_html) {
return $this->js_external;
}
if(!count($this->js_external)) {
return '';
}
//если не надо собирать все в один билд-файл
if(!(bool) env('LARAKIT_STATIC_JS_EXTERNAL_BUILD', false)) {
... | php | function getExternal($as_html = true) {
if(!$as_html) {
return $this->js_external;
}
if(!count($this->js_external)) {
return '';
}
//если не надо собирать все в один билд-файл
if(!(bool) env('LARAKIT_STATIC_JS_EXTERNAL_BUILD', false)) {
... | [
"function",
"getExternal",
"(",
"$",
"as_html",
"=",
"true",
")",
"{",
"if",
"(",
"!",
"$",
"as_html",
")",
"{",
"return",
"$",
"this",
"->",
"js_external",
";",
"}",
"if",
"(",
"!",
"count",
"(",
"$",
"this",
"->",
"js_external",
")",
")",
"{",
... | Только внешние скрипты
@return string | [
"Только",
"внешние",
"скрипты"
] | train | https://github.com/larakit/lk-staticfiles/blob/1ee718b1f3a00c29c46b06c2f501413599b0335a/src/StaticFiles/Js.php#L172-L269 |
larakit/lk-staticfiles | src/StaticFiles/Js.php | Js.getInline | function getInline($as_html = true) {
if(!$as_html) {
return $this->js_inline;
}
if(!count($this->js_inline)) {
return '';
}
$js_code = '';
foreach($this->js_inline as $js) {
$js_code .= $this->prepare($js, config('larakit.lk-s... | php | function getInline($as_html = true) {
if(!$as_html) {
return $this->js_inline;
}
if(!count($this->js_inline)) {
return '';
}
$js_code = '';
foreach($this->js_inline as $js) {
$js_code .= $this->prepare($js, config('larakit.lk-s... | [
"function",
"getInline",
"(",
"$",
"as_html",
"=",
"true",
")",
"{",
"if",
"(",
"!",
"$",
"as_html",
")",
"{",
"return",
"$",
"this",
"->",
"js_inline",
";",
"}",
"if",
"(",
"!",
"count",
"(",
"$",
"this",
"->",
"js_inline",
")",
")",
"{",
"retur... | Только инлайн
@return <type> | [
"Только",
"инлайн"
] | train | https://github.com/larakit/lk-staticfiles/blob/1ee718b1f3a00c29c46b06c2f501413599b0335a/src/StaticFiles/Js.php#L294-L317 |
larakit/lk-staticfiles | src/StaticFiles/Js.php | Js.getOnload | function getOnload($as_html = true) {
if(!$as_html) {
return $this->js_onload;
}
if(!count($this->js_onload)) {
return '';
}
$js = '';
foreach($this->js_onload as $k => $_js) {
$js .= trim($_js) . PHP_EOL;
}
$... | php | function getOnload($as_html = true) {
if(!$as_html) {
return $this->js_onload;
}
if(!count($this->js_onload)) {
return '';
}
$js = '';
foreach($this->js_onload as $k => $_js) {
$js .= trim($_js) . PHP_EOL;
}
$... | [
"function",
"getOnload",
"(",
"$",
"as_html",
"=",
"true",
")",
"{",
"if",
"(",
"!",
"$",
"as_html",
")",
"{",
"return",
"$",
"this",
"->",
"js_onload",
";",
"}",
"if",
"(",
"!",
"count",
"(",
"$",
"this",
"->",
"js_onload",
")",
")",
"{",
"retur... | Only onload
@return <type> | [
"Only",
"onload"
] | train | https://github.com/larakit/lk-staticfiles/blob/1ee718b1f3a00c29c46b06c2f501413599b0335a/src/StaticFiles/Js.php#L324-L348 |
matthiasbayer/datadog-client | src/Bayer/DataDogClient/Client.php | Client.sendSeries | public function sendSeries(Series $series) {
$metrics = $series->getMetrics();
if (empty($metrics)) {
throw new EmptySeriesException('The series must contain metric data to send');
}
$this->send(
self::ENDPOINT_SERIES . $this->getApiKey(),
$series->to... | php | public function sendSeries(Series $series) {
$metrics = $series->getMetrics();
if (empty($metrics)) {
throw new EmptySeriesException('The series must contain metric data to send');
}
$this->send(
self::ENDPOINT_SERIES . $this->getApiKey(),
$series->to... | [
"public",
"function",
"sendSeries",
"(",
"Series",
"$",
"series",
")",
"{",
"$",
"metrics",
"=",
"$",
"series",
"->",
"getMetrics",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"metrics",
")",
")",
"{",
"throw",
"new",
"EmptySeriesException",
"(",
"'Th... | Send a Series object to datadog
@param Series $series
@throws Client\EmptySeriesException
@return Client | [
"Send",
"a",
"Series",
"object",
"to",
"datadog"
] | train | https://github.com/matthiasbayer/datadog-client/blob/e625132c34bf36f783077c9ee4ed3214633cd272/src/Bayer/DataDogClient/Client.php#L97-L109 |
matthiasbayer/datadog-client | src/Bayer/DataDogClient/Client.php | Client.sendMetric | public function sendMetric(Metric $metric) {
$points = $metric->getPoints();
if (empty($points)) {
throw new EmptyMetricException('The metric must contain points to send');
}
$this->sendSeries(new Series($metric));
return $this;
} | php | public function sendMetric(Metric $metric) {
$points = $metric->getPoints();
if (empty($points)) {
throw new EmptyMetricException('The metric must contain points to send');
}
$this->sendSeries(new Series($metric));
return $this;
} | [
"public",
"function",
"sendMetric",
"(",
"Metric",
"$",
"metric",
")",
"{",
"$",
"points",
"=",
"$",
"metric",
"->",
"getPoints",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"points",
")",
")",
"{",
"throw",
"new",
"EmptyMetricException",
"(",
"'The m... | Send a Metric object to datadog
The metric object will be encapsulated into a
dummy series, as the datadog API requires.
@param Metric $metric
@throws EmptyMetricException
@return Client | [
"Send",
"a",
"Metric",
"object",
"to",
"datadog"
] | train | https://github.com/matthiasbayer/datadog-client/blob/e625132c34bf36f783077c9ee4ed3214633cd272/src/Bayer/DataDogClient/Client.php#L122-L131 |
matthiasbayer/datadog-client | src/Bayer/DataDogClient/Client.php | Client.metric | public function metric($name, array $points, array $options = array()) {
return $this->sendMetric(
Factory::buildMetric($name, $points, $options)
);
} | php | public function metric($name, array $points, array $options = array()) {
return $this->sendMetric(
Factory::buildMetric($name, $points, $options)
);
} | [
"public",
"function",
"metric",
"(",
"$",
"name",
",",
"array",
"$",
"points",
",",
"array",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"sendMetric",
"(",
"Factory",
"::",
"buildMetric",
"(",
"$",
"name",
",",
"$",... | Send metric data to datadog
The given values will be used to create a new Metric
object, encapsulated it into a Series and sent.
@param string $name
@param array $points
@param array $options
@return Client | [
"Send",
"metric",
"data",
"to",
"datadog"
] | train | https://github.com/matthiasbayer/datadog-client/blob/e625132c34bf36f783077c9ee4ed3214633cd272/src/Bayer/DataDogClient/Client.php#L145-L149 |
matthiasbayer/datadog-client | src/Bayer/DataDogClient/Client.php | Client.event | public function event($text, $title = '', array $options = array()) {
return $this->sendEvent(
Factory::buildEvent($text, $title, $options)
);
} | php | public function event($text, $title = '', array $options = array()) {
return $this->sendEvent(
Factory::buildEvent($text, $title, $options)
);
} | [
"public",
"function",
"event",
"(",
"$",
"text",
",",
"$",
"title",
"=",
"''",
",",
"array",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"sendEvent",
"(",
"Factory",
"::",
"buildEvent",
"(",
"$",
"text",
",",
"$",... | Send an event to datadog
The given values will be used to create a new Event
object which will be sent.
@param string $text
@param string $title
@param array $options
@return Client | [
"Send",
"an",
"event",
"to",
"datadog"
] | train | https://github.com/matthiasbayer/datadog-client/blob/e625132c34bf36f783077c9ee4ed3214633cd272/src/Bayer/DataDogClient/Client.php#L163-L167 |
matthiasbayer/datadog-client | src/Bayer/DataDogClient/Client.php | Client.sendEvent | public function sendEvent(Event $event) {
$this->send(
self::ENDPOINT_EVENT . $this->getApiKey(),
$event->toArray()
);
return $this;
} | php | public function sendEvent(Event $event) {
$this->send(
self::ENDPOINT_EVENT . $this->getApiKey(),
$event->toArray()
);
return $this;
} | [
"public",
"function",
"sendEvent",
"(",
"Event",
"$",
"event",
")",
"{",
"$",
"this",
"->",
"send",
"(",
"self",
"::",
"ENDPOINT_EVENT",
".",
"$",
"this",
"->",
"getApiKey",
"(",
")",
",",
"$",
"event",
"->",
"toArray",
"(",
")",
")",
";",
"return",
... | Send an Event object to datadog
@param Event $event
@return Client | [
"Send",
"an",
"Event",
"object",
"to",
"datadog"
] | train | https://github.com/matthiasbayer/datadog-client/blob/e625132c34bf36f783077c9ee4ed3214633cd272/src/Bayer/DataDogClient/Client.php#L176-L183 |
sulu/SuluSalesShippingBundle | src/Sulu/Bundle/Sales/CoreBundle/Manager/OrderAddressManager.php | OrderAddressManager.getContactData | public function getContactData($addressData, Contact $contact = null)
{
$result = array();
// if account is set, take account's name
if ($addressData && isset($addressData['firstName']) && isset($addressData['lastName'])) {
$result['firstName'] = $addressData['firstName'];
... | php | public function getContactData($addressData, Contact $contact = null)
{
$result = array();
// if account is set, take account's name
if ($addressData && isset($addressData['firstName']) && isset($addressData['lastName'])) {
$result['firstName'] = $addressData['firstName'];
... | [
"public",
"function",
"getContactData",
"(",
"$",
"addressData",
",",
"Contact",
"$",
"contact",
"=",
"null",
")",
"{",
"$",
"result",
"=",
"array",
"(",
")",
";",
"// if account is set, take account's name",
"if",
"(",
"$",
"addressData",
"&&",
"isset",
"(",
... | Returns contact data as an array. either by provided address or contact
@param array $addressData
@param Contact $contact
@throws MissingAttributeException
@return array | [
"Returns",
"contact",
"data",
"as",
"an",
"array",
".",
"either",
"by",
"provided",
"address",
"or",
"contact"
] | train | https://github.com/sulu/SuluSalesShippingBundle/blob/0d39de262d58579e5679db99a77dbf717d600b5e/src/Sulu/Bundle/Sales/CoreBundle/Manager/OrderAddressManager.php#L226-L253 |
dengyongbin/loopeer-lib | src/Services/Baidu-Push-Server-SDK-Php-3.0.1/lib/PushSimpleLog.php | PushSimpleLog.innerWrite | protected function innerWrite($log, $level = 1, $prefix = null) {
$level = intval($level);
if(intval($level) < $this->log_level || $this -> out === null){
return;
}
$timestamp = time();
$prefix = $prefix === null ? $this->prefix : $prefix;
... | php | protected function innerWrite($log, $level = 1, $prefix = null) {
$level = intval($level);
if(intval($level) < $this->log_level || $this -> out === null){
return;
}
$timestamp = time();
$prefix = $prefix === null ? $this->prefix : $prefix;
... | [
"protected",
"function",
"innerWrite",
"(",
"$",
"log",
",",
"$",
"level",
"=",
"1",
",",
"$",
"prefix",
"=",
"null",
")",
"{",
"$",
"level",
"=",
"intval",
"(",
"$",
"level",
")",
";",
"if",
"(",
"intval",
"(",
"$",
"level",
")",
"<",
"$",
"th... | 实际log输出方法
@param mixed $log
@param number $level
@param string $prefix
@return void | [
"实际log输出方法"
] | train | https://github.com/dengyongbin/loopeer-lib/blob/4609338f6a48666ca96ee380509a5b5cb066808f/src/Services/Baidu-Push-Server-SDK-Php-3.0.1/lib/PushSimpleLog.php#L37-L58 |
shawnsandy/ui-pages | src/Classes/Breadcrumbs.php | Breadcrumbs.breadcrumbs | public function breadcrumbs()
{
$links = [];
$breadcrumbs = $this->crumbs($this->request->segments());
foreach ($breadcrumbs as $name => $url):
$links[] = '<a href="' . $url . '" class="breadcrumb">' . ucwords($name) . '</a>';
endforeach ;
return $links;
} | php | public function breadcrumbs()
{
$links = [];
$breadcrumbs = $this->crumbs($this->request->segments());
foreach ($breadcrumbs as $name => $url):
$links[] = '<a href="' . $url . '" class="breadcrumb">' . ucwords($name) . '</a>';
endforeach ;
return $links;
} | [
"public",
"function",
"breadcrumbs",
"(",
")",
"{",
"$",
"links",
"=",
"[",
"]",
";",
"$",
"breadcrumbs",
"=",
"$",
"this",
"->",
"crumbs",
"(",
"$",
"this",
"->",
"request",
"->",
"segments",
"(",
")",
")",
";",
"foreach",
"(",
"$",
"breadcrumbs",
... | Breadcrumbs
@return array | [
"Breadcrumbs"
] | train | https://github.com/shawnsandy/ui-pages/blob/11584c12fa3e2b9a5c513f4ec9e2eaf78c206ca8/src/Classes/Breadcrumbs.php#L31-L39 |
shawnsandy/ui-pages | src/Classes/Breadcrumbs.php | Breadcrumbs.crumbs | public function crumbs($segments)
{
$item = '';
$crumbs = [];
foreach ($segments as $segment):
$item = $item . "/" . $segment;
$crumbs["{$segment}"] = $item;
endforeach;
return $crumbs;
} | php | public function crumbs($segments)
{
$item = '';
$crumbs = [];
foreach ($segments as $segment):
$item = $item . "/" . $segment;
$crumbs["{$segment}"] = $item;
endforeach;
return $crumbs;
} | [
"public",
"function",
"crumbs",
"(",
"$",
"segments",
")",
"{",
"$",
"item",
"=",
"''",
";",
"$",
"crumbs",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"segments",
"as",
"$",
"segment",
")",
":",
"$",
"item",
"=",
"$",
"item",
".",
"\"/\"",
".",
"... | Crumbs
@param array $segments dedd
@return array | [
"Crumbs"
] | train | https://github.com/shawnsandy/ui-pages/blob/11584c12fa3e2b9a5c513f4ec9e2eaf78c206ca8/src/Classes/Breadcrumbs.php#L48-L58 |
FrenchFrogs/framework | src/Table/Table/Datatable.php | Datatable.addDatatableButtonExport | public function addDatatableButtonExport($text = 'Export CSV')
{
$this->hasToken() ?: $this->generateToken();
$this->addDatatableButtonLink($text, route('datatable-export', ['token' => $this->getToken()]));
return $this;
} | php | public function addDatatableButtonExport($text = 'Export CSV')
{
$this->hasToken() ?: $this->generateToken();
$this->addDatatableButtonLink($text, route('datatable-export', ['token' => $this->getToken()]));
return $this;
} | [
"public",
"function",
"addDatatableButtonExport",
"(",
"$",
"text",
"=",
"'Export CSV'",
")",
"{",
"$",
"this",
"->",
"hasToken",
"(",
")",
"?",
":",
"$",
"this",
"->",
"generateToken",
"(",
")",
";",
"$",
"this",
"->",
"addDatatableButtonLink",
"(",
"$",
... | Ajoute un Bouton d'export
@param $text
@param $url
@return $this | [
"Ajoute",
"un",
"Bouton",
"d",
"export"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Table/Table/Datatable.php#L99-L104 |
FrenchFrogs/framework | src/Table/Table/Datatable.php | Datatable.setSearch | public function setSearch($function)
{
if (is_string($function)) {
$field = $function;
$function = function (Table $table, $query) use ($field) {
// verify that source is a query
if (!$this->isSourceQueryBuilder()) {
throw new \Ex... | php | public function setSearch($function)
{
if (is_string($function)) {
$field = $function;
$function = function (Table $table, $query) use ($field) {
// verify that source is a query
if (!$this->isSourceQueryBuilder()) {
throw new \Ex... | [
"public",
"function",
"setSearch",
"(",
"$",
"function",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"function",
")",
")",
"{",
"$",
"field",
"=",
"$",
"function",
";",
"$",
"function",
"=",
"function",
"(",
"Table",
"$",
"table",
",",
"$",
"query",
... | Setter for $search callable function
@param $function
@return $this | [
"Setter",
"for",
"$search",
"callable",
"function"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Table/Table/Datatable.php#L158-L180 |
FrenchFrogs/framework | src/Table/Table/Datatable.php | Datatable.search | public function search($query)
{
if ($this->hasSearch()) {
$search = $this->search;
// If it's a anonymous function
if (!is_string($search) && is_callable($search)) {
call_user_func($search, $this, $query);
}
}
return $this;
... | php | public function search($query)
{
if ($this->hasSearch()) {
$search = $this->search;
// If it's a anonymous function
if (!is_string($search) && is_callable($search)) {
call_user_func($search, $this, $query);
}
}
return $this;
... | [
"public",
"function",
"search",
"(",
"$",
"query",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasSearch",
"(",
")",
")",
"{",
"$",
"search",
"=",
"$",
"this",
"->",
"search",
";",
"// If it's a anonymous function",
"if",
"(",
"!",
"is_string",
"(",
"$",
... | Search
@param null $query | [
"Search"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Table/Table/Datatable.php#L198-L211 |
FrenchFrogs/framework | src/Table/Table/Datatable.php | Datatable.setConstructor | public function setConstructor($constructor, $method = null, $params = null)
{
if (!is_null($method)){
$constructor .= '::' . $method;
}
if (!is_null($params)) {
$constructor .= ':' . $params;
}
$this->constructor = $constructor;
return $thi... | php | public function setConstructor($constructor, $method = null, $params = null)
{
if (!is_null($method)){
$constructor .= '::' . $method;
}
if (!is_null($params)) {
$constructor .= ':' . $params;
}
$this->constructor = $constructor;
return $thi... | [
"public",
"function",
"setConstructor",
"(",
"$",
"constructor",
",",
"$",
"method",
"=",
"null",
",",
"$",
"params",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"method",
")",
")",
"{",
"$",
"constructor",
".=",
"'::'",
".",
"$",
"... | Setter for $constructor attribute
@param $constructor
@param null $method
@param null $params
@return $this | [
"Setter",
"for",
"$constructor",
"attribute"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Table/Table/Datatable.php#L370-L383 |
FrenchFrogs/framework | src/Table/Table/Datatable.php | Datatable.save | public function save() {
if(!$this->hasToken()) {
if (static::hasSingleToken()) {
$this->setToken(static::getSingleToken());
} else {
$this->generateToken();
}
}
if (!$this->hasConstructor()) {
$this->setConstructo... | php | public function save() {
if(!$this->hasToken()) {
if (static::hasSingleToken()) {
$this->setToken(static::getSingleToken());
} else {
$this->generateToken();
}
}
if (!$this->hasConstructor()) {
$this->setConstructo... | [
"public",
"function",
"save",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasToken",
"(",
")",
")",
"{",
"if",
"(",
"static",
"::",
"hasSingleToken",
"(",
")",
")",
"{",
"$",
"this",
"->",
"setToken",
"(",
"static",
"::",
"getSingleToken",
"... | Save the Table configuration in Session | [
"Save",
"the",
"Table",
"configuration",
"in",
"Session"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Table/Table/Datatable.php#L411-L427 |
FrenchFrogs/framework | src/Table/Table/Datatable.php | Datatable.load | static public function load($token = null)
{
// if single token is set, we keep it
if (is_null($token) && static::hasSingleToken()) {
$token = static::getSingleToken();
}
// if no session are set, we set a new one only is class has a singleToken
if (!Session::has... | php | static public function load($token = null)
{
// if single token is set, we keep it
if (is_null($token) && static::hasSingleToken()) {
$token = static::getSingleToken();
}
// if no session are set, we set a new one only is class has a singleToken
if (!Session::has... | [
"static",
"public",
"function",
"load",
"(",
"$",
"token",
"=",
"null",
")",
"{",
"// if single token is set, we keep it",
"if",
"(",
"is_null",
"(",
"$",
"token",
")",
"&&",
"static",
"::",
"hasSingleToken",
"(",
")",
")",
"{",
"$",
"token",
"=",
"static"... | Load a datable from a token
@param $token
@return Table | [
"Load",
"a",
"datable",
"from",
"a",
"token"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Table/Table/Datatable.php#L436-L480 |
pinguo/php-exception | src/BusinessException.php | BusinessException.getErrorInfo | public function getErrorInfo($type = 0)
{
$err = [
'code' => $this->getCode(),
'msg' => $this->getMessage(),
'file' => $this->getFile(),
'line' => $this->getLine()
];
if ($type == 1) {
return json_encode($err);
}
re... | php | public function getErrorInfo($type = 0)
{
$err = [
'code' => $this->getCode(),
'msg' => $this->getMessage(),
'file' => $this->getFile(),
'line' => $this->getLine()
];
if ($type == 1) {
return json_encode($err);
}
re... | [
"public",
"function",
"getErrorInfo",
"(",
"$",
"type",
"=",
"0",
")",
"{",
"$",
"err",
"=",
"[",
"'code'",
"=>",
"$",
"this",
"->",
"getCode",
"(",
")",
",",
"'msg'",
"=>",
"$",
"this",
"->",
"getMessage",
"(",
")",
",",
"'file'",
"=>",
"$",
"th... | @param integer $type 返回值格式(1json格式, 0数组格式).
@return array|string | [
"@param",
"integer",
"$type",
"返回值格式",
"(",
"1json格式",
"0数组格式",
")",
"."
] | train | https://github.com/pinguo/php-exception/blob/aa8ab46695ae09ced74b7ca3d4f2ae0be4d97760/src/BusinessException.php#L34-L46 |
blast-project/CoreBundle | src/Translator/LibrinfoLabelTranslatorStrategy.php | LibrinfoLabelTranslatorStrategy.getLabel | public function getLabel($label, $context = '', $type = ''): string
{
$label = str_replace('.', '_', $label);
$label = $this->cleanStr($label); /* if there is still some \ */
$label = sprintf('%s', strtolower(preg_replace('~(?<=\\w)([A-Z])~', '_$1', $label)));
//$resLabel = $this->n... | php | public function getLabel($label, $context = '', $type = ''): string
{
$label = str_replace('.', '_', $label);
$label = $this->cleanStr($label); /* if there is still some \ */
$label = sprintf('%s', strtolower(preg_replace('~(?<=\\w)([A-Z])~', '_$1', $label)));
//$resLabel = $this->n... | [
"public",
"function",
"getLabel",
"(",
"$",
"label",
",",
"$",
"context",
"=",
"''",
",",
"$",
"type",
"=",
"''",
")",
":",
"string",
"{",
"$",
"label",
"=",
"str_replace",
"(",
"'.'",
",",
"'_'",
",",
"$",
"label",
")",
";",
"$",
"label",
"=",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/blast-project/CoreBundle/blob/7a0832758ca14e5bc5d65515532c1220df3930ae/src/Translator/LibrinfoLabelTranslatorStrategy.php#L80-L93 |
VDMi/Guzzle-oAuth | src/GuzzleOauth/BaseConsumerOauth1.php | BaseConsumerOauth1.getRequestToken | public function getRequestToken($callback_uri = NULL) {
// set callback_uri
$this->getOauthPlugin()->setCallbackUri($callback_uri);
//Get request token
$response = $this->get($this->getConfig('request_token_path'))->send();
$request_token = array();
parse_str($response->getBody(), $request_tok... | php | public function getRequestToken($callback_uri = NULL) {
// set callback_uri
$this->getOauthPlugin()->setCallbackUri($callback_uri);
//Get request token
$response = $this->get($this->getConfig('request_token_path'))->send();
$request_token = array();
parse_str($response->getBody(), $request_tok... | [
"public",
"function",
"getRequestToken",
"(",
"$",
"callback_uri",
"=",
"NULL",
")",
"{",
"// set callback_uri",
"$",
"this",
"->",
"getOauthPlugin",
"(",
")",
"->",
"setCallbackUri",
"(",
"$",
"callback_uri",
")",
";",
"//Get request token",
"$",
"response",
"=... | Get a Request Token. | [
"Get",
"a",
"Request",
"Token",
"."
] | train | https://github.com/VDMi/Guzzle-oAuth/blob/e2b2561e4e402e13ba605082bf768b29942f90cb/src/GuzzleOauth/BaseConsumerOauth1.php#L59-L76 |
VDMi/Guzzle-oAuth | src/GuzzleOauth/BaseConsumerOauth1.php | BaseConsumerOauth1.getAuthorizeUrl | public function getAuthorizeUrl($request_token, $callback_uri = NULL, $state = NULL) {
$request_token = array(
'oauth_token' => is_array($request_token) ? $request_token['oauth_token'] : $request_token,
);
// authorize
$url = Url::factory($this->getConfig('base_url'));
$url->addPath($this->get... | php | public function getAuthorizeUrl($request_token, $callback_uri = NULL, $state = NULL) {
$request_token = array(
'oauth_token' => is_array($request_token) ? $request_token['oauth_token'] : $request_token,
);
// authorize
$url = Url::factory($this->getConfig('base_url'));
$url->addPath($this->get... | [
"public",
"function",
"getAuthorizeUrl",
"(",
"$",
"request_token",
",",
"$",
"callback_uri",
"=",
"NULL",
",",
"$",
"state",
"=",
"NULL",
")",
"{",
"$",
"request_token",
"=",
"array",
"(",
"'oauth_token'",
"=>",
"is_array",
"(",
"$",
"request_token",
")",
... | Return a authorize url. | [
"Return",
"a",
"authorize",
"url",
"."
] | train | https://github.com/VDMi/Guzzle-oAuth/blob/e2b2561e4e402e13ba605082bf768b29942f90cb/src/GuzzleOauth/BaseConsumerOauth1.php#L81-L90 |
VDMi/Guzzle-oAuth | src/GuzzleOauth/BaseConsumerOauth1.php | BaseConsumerOauth1.getAccessToken | public function getAccessToken($query_data, $request_token) {
$this->setToken($query_data['oauth_token']);
$post = array(
'oauth_verifier' => $query_data['oauth_verifier'],
);
//Get request token
$response = $this->post($this->getConfig('access_token_path'), NULL, $post)->send();
$access_... | php | public function getAccessToken($query_data, $request_token) {
$this->setToken($query_data['oauth_token']);
$post = array(
'oauth_verifier' => $query_data['oauth_verifier'],
);
//Get request token
$response = $this->post($this->getConfig('access_token_path'), NULL, $post)->send();
$access_... | [
"public",
"function",
"getAccessToken",
"(",
"$",
"query_data",
",",
"$",
"request_token",
")",
"{",
"$",
"this",
"->",
"setToken",
"(",
"$",
"query_data",
"[",
"'oauth_token'",
"]",
")",
";",
"$",
"post",
"=",
"array",
"(",
"'oauth_verifier'",
"=>",
"$",
... | Get a Access Token. | [
"Get",
"a",
"Access",
"Token",
"."
] | train | https://github.com/VDMi/Guzzle-oAuth/blob/e2b2561e4e402e13ba605082bf768b29942f90cb/src/GuzzleOauth/BaseConsumerOauth1.php#L95-L113 |
codeburnerframework/router | src/Group.php | Group.set | public function set($route)
{
if ($route instanceof Group) {
foreach ($route->all() as $r)
$this->routes[] = $r;
} else $this->routes[] = $route;
return $this;
} | php | public function set($route)
{
if ($route instanceof Group) {
foreach ($route->all() as $r)
$this->routes[] = $r;
} else $this->routes[] = $route;
return $this;
} | [
"public",
"function",
"set",
"(",
"$",
"route",
")",
"{",
"if",
"(",
"$",
"route",
"instanceof",
"Group",
")",
"{",
"foreach",
"(",
"$",
"route",
"->",
"all",
"(",
")",
"as",
"$",
"r",
")",
"$",
"this",
"->",
"routes",
"[",
"]",
"=",
"$",
"r",
... | Set a new Route or merge an existing group of routes.
@param Group|Route $route
@return self | [
"Set",
"a",
"new",
"Route",
"or",
"merge",
"an",
"existing",
"group",
"of",
"routes",
"."
] | train | https://github.com/codeburnerframework/router/blob/2b0e8030303dd08d3fadfc4c57aa37b184a408cd/src/Group.php#L37-L44 |
codeburnerframework/router | src/Group.php | Group.setMethod | public function setMethod($method)
{
foreach ($this->routes as $route)
$route->setMethod($method);
return $this;
} | php | public function setMethod($method)
{
foreach ($this->routes as $route)
$route->setMethod($method);
return $this;
} | [
"public",
"function",
"setMethod",
"(",
"$",
"method",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"routes",
"as",
"$",
"route",
")",
"$",
"route",
"->",
"setMethod",
"(",
"$",
"method",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Set one HTTP method to all grouped routes.
@param string $method The HTTP Method
@return self | [
"Set",
"one",
"HTTP",
"method",
"to",
"all",
"grouped",
"routes",
"."
] | train | https://github.com/codeburnerframework/router/blob/2b0e8030303dd08d3fadfc4c57aa37b184a408cd/src/Group.php#L105-L110 |
codeburnerframework/router | src/Group.php | Group.setAction | public function setAction($action)
{
foreach ($this->routes as $route)
$route->setAction($action);
return $this;
} | php | public function setAction($action)
{
foreach ($this->routes as $route)
$route->setAction($action);
return $this;
} | [
"public",
"function",
"setAction",
"(",
"$",
"action",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"routes",
"as",
"$",
"route",
")",
"$",
"route",
"->",
"setAction",
"(",
"$",
"action",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Set one action to all grouped routes.
@param string $action
@return self | [
"Set",
"one",
"action",
"to",
"all",
"grouped",
"routes",
"."
] | train | https://github.com/codeburnerframework/router/blob/2b0e8030303dd08d3fadfc4c57aa37b184a408cd/src/Group.php#L119-L124 |
codeburnerframework/router | src/Group.php | Group.setPrefix | public function setPrefix($prefix)
{
$prefix = "/" . ltrim($prefix, "/");
$routes = [];
foreach ($this->routes as $route)
$routes[] = $route->setPattern(rtrim($prefix . $route->getPattern(), "/"));
$this->routes = $routes;
return $this;
} | php | public function setPrefix($prefix)
{
$prefix = "/" . ltrim($prefix, "/");
$routes = [];
foreach ($this->routes as $route)
$routes[] = $route->setPattern(rtrim($prefix . $route->getPattern(), "/"));
$this->routes = $routes;
return $this;
} | [
"public",
"function",
"setPrefix",
"(",
"$",
"prefix",
")",
"{",
"$",
"prefix",
"=",
"\"/\"",
".",
"ltrim",
"(",
"$",
"prefix",
",",
"\"/\"",
")",
";",
"$",
"routes",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"routes",
"as",
"$",
"ro... | Add a prefix to all grouped routes pattern.
@param string $prefix
@return self | [
"Add",
"a",
"prefix",
"to",
"all",
"grouped",
"routes",
"pattern",
"."
] | train | https://github.com/codeburnerframework/router/blob/2b0e8030303dd08d3fadfc4c57aa37b184a408cd/src/Group.php#L147-L155 |
codeburnerframework/router | src/Group.php | Group.setMetadata | public function setMetadata($key, $value)
{
foreach ($this->routes as $route)
$route->setMetadata($key, $value);
return $this;
} | php | public function setMetadata($key, $value)
{
foreach ($this->routes as $route)
$route->setMetadata($key, $value);
return $this;
} | [
"public",
"function",
"setMetadata",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"routes",
"as",
"$",
"route",
")",
"$",
"route",
"->",
"setMetadata",
"(",
"$",
"key",
",",
"$",
"value",
")",
";",
"return",
"$",... | Set metadata to all grouped routes.
@param string $key
@param string $value
@return $this | [
"Set",
"metadata",
"to",
"all",
"grouped",
"routes",
"."
] | train | https://github.com/codeburnerframework/router/blob/2b0e8030303dd08d3fadfc4c57aa37b184a408cd/src/Group.php#L166-L171 |
codeburnerframework/router | src/Group.php | Group.setMetadataArray | public function setMetadataArray(array $metadata)
{
foreach ($this->routes as $route)
$route->setMetadataArray($metadata);
return $this;
} | php | public function setMetadataArray(array $metadata)
{
foreach ($this->routes as $route)
$route->setMetadataArray($metadata);
return $this;
} | [
"public",
"function",
"setMetadataArray",
"(",
"array",
"$",
"metadata",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"routes",
"as",
"$",
"route",
")",
"$",
"route",
"->",
"setMetadataArray",
"(",
"$",
"metadata",
")",
";",
"return",
"$",
"this",
";",
... | Set a bunch of metadata to all grouped routes.
@param mixed[] $metadata
@return $this | [
"Set",
"a",
"bunch",
"of",
"metadata",
"to",
"all",
"grouped",
"routes",
"."
] | train | https://github.com/codeburnerframework/router/blob/2b0e8030303dd08d3fadfc4c57aa37b184a408cd/src/Group.php#L180-L185 |
codeburnerframework/router | src/Group.php | Group.setDefaults | public function setDefaults(array $defaults)
{
foreach ($this->routes as $route)
$route->setDefaults($defaults);
return $this;
} | php | public function setDefaults(array $defaults)
{
foreach ($this->routes as $route)
$route->setDefaults($defaults);
return $this;
} | [
"public",
"function",
"setDefaults",
"(",
"array",
"$",
"defaults",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"routes",
"as",
"$",
"route",
")",
"$",
"route",
"->",
"setDefaults",
"(",
"$",
"defaults",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Set default parameters to all grouped routes.
@param mixed[] $defaults
@return $this | [
"Set",
"default",
"parameters",
"to",
"all",
"grouped",
"routes",
"."
] | train | https://github.com/codeburnerframework/router/blob/2b0e8030303dd08d3fadfc4c57aa37b184a408cd/src/Group.php#L194-L199 |
codeburnerframework/router | src/Group.php | Group.setDefault | public function setDefault($key, $value)
{
foreach ($this->routes as $route)
$route->setDefault($key, $value);
return $this;
} | php | public function setDefault($key, $value)
{
foreach ($this->routes as $route)
$route->setDefault($key, $value);
return $this;
} | [
"public",
"function",
"setDefault",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"routes",
"as",
"$",
"route",
")",
"$",
"route",
"->",
"setDefault",
"(",
"$",
"key",
",",
"$",
"value",
")",
";",
"return",
"$",
... | Set a default parameter to all grouped routes.
@param string $key
@param mixed $value
@return $this | [
"Set",
"a",
"default",
"parameter",
"to",
"all",
"grouped",
"routes",
"."
] | train | https://github.com/codeburnerframework/router/blob/2b0e8030303dd08d3fadfc4c57aa37b184a408cd/src/Group.php#L210-L215 |
codeburnerframework/router | src/Group.php | Group.setStrategy | public function setStrategy($strategy)
{
foreach ($this->routes as $route)
$route->setStrategy($strategy);
return $this;
} | php | public function setStrategy($strategy)
{
foreach ($this->routes as $route)
$route->setStrategy($strategy);
return $this;
} | [
"public",
"function",
"setStrategy",
"(",
"$",
"strategy",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"routes",
"as",
"$",
"route",
")",
"$",
"route",
"->",
"setStrategy",
"(",
"$",
"strategy",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Set one dispatch strategy to all grouped routes.
@param string|Strategies\StrategyInterface $strategy
@return self | [
"Set",
"one",
"dispatch",
"strategy",
"to",
"all",
"grouped",
"routes",
"."
] | train | https://github.com/codeburnerframework/router/blob/2b0e8030303dd08d3fadfc4c57aa37b184a408cd/src/Group.php#L224-L229 |
codeburnerframework/router | src/Group.php | Group.setConstraint | public function setConstraint($name, $regex)
{
foreach ($this->routes as $route)
$route->setConstraint($name, $regex);
return $this;
} | php | public function setConstraint($name, $regex)
{
foreach ($this->routes as $route)
$route->setConstraint($name, $regex);
return $this;
} | [
"public",
"function",
"setConstraint",
"(",
"$",
"name",
",",
"$",
"regex",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"routes",
"as",
"$",
"route",
")",
"$",
"route",
"->",
"setConstraint",
"(",
"$",
"name",
",",
"$",
"regex",
")",
";",
"return",
... | Replace or define a constraint for all dynamic segments named by $name.
@param string $name
@param string $regex
@return self | [
"Replace",
"or",
"define",
"a",
"constraint",
"for",
"all",
"dynamic",
"segments",
"named",
"by",
"$name",
"."
] | train | https://github.com/codeburnerframework/router/blob/2b0e8030303dd08d3fadfc4c57aa37b184a408cd/src/Group.php#L240-L245 |
codeburnerframework/router | src/Group.php | Group.setName | public function setName($name)
{
if (count($this->routes) > 1) {
throw new \LogicException("You cannot set the same name to several routes.");
}
$this->routes[0]->setName($name);
return $this;
} | php | public function setName($name)
{
if (count($this->routes) > 1) {
throw new \LogicException("You cannot set the same name to several routes.");
}
$this->routes[0]->setName($name);
return $this;
} | [
"public",
"function",
"setName",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"routes",
")",
">",
"1",
")",
"{",
"throw",
"new",
"\\",
"LogicException",
"(",
"\"You cannot set the same name to several routes.\"",
")",
";",
"}",
"... | Set a name to a Route.
@param string $name
@return self | [
"Set",
"a",
"name",
"to",
"a",
"Route",
"."
] | train | https://github.com/codeburnerframework/router/blob/2b0e8030303dd08d3fadfc4c57aa37b184a408cd/src/Group.php#L254-L262 |
vincentchalamon/VinceCmsSonataAdminBundle | Form/Transformer/MetaTransformer.php | MetaTransformer.transform | public function transform($value)
{
// Fix for Symfony 2.4
if (null === $value) {
return;
}
/** @var \Traversable $values */
if (!is_array($value) && !$value instanceof \Traversable) {
throw new \InvalidArgumentException(sprintf('Meta form type only a... | php | public function transform($value)
{
// Fix for Symfony 2.4
if (null === $value) {
return;
}
/** @var \Traversable $values */
if (!is_array($value) && !$value instanceof \Traversable) {
throw new \InvalidArgumentException(sprintf('Meta form type only a... | [
"public",
"function",
"transform",
"(",
"$",
"value",
")",
"{",
"// Fix for Symfony 2.4",
"if",
"(",
"null",
"===",
"$",
"value",
")",
"{",
"return",
";",
"}",
"/** @var \\Traversable $values */",
"if",
"(",
"!",
"is_array",
"(",
"$",
"value",
")",
"&&",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/vincentchalamon/VinceCmsSonataAdminBundle/blob/edc768061734a92ba116488dd7b61ad40af21ceb/Form/Transformer/MetaTransformer.php#L60-L87 |
vincentchalamon/VinceCmsSonataAdminBundle | Form/Transformer/MetaTransformer.php | MetaTransformer.reverseTransform | public function reverseTransform($value)
{
if (!is_array($value)) {
return array();
}
$results = array();
foreach ($value as $group => $metas) {
foreach ($metas as $name => $contents) {
/** @var Meta $meta */
$meta = $this->rep... | php | public function reverseTransform($value)
{
if (!is_array($value)) {
return array();
}
$results = array();
foreach ($value as $group => $metas) {
foreach ($metas as $name => $contents) {
/** @var Meta $meta */
$meta = $this->rep... | [
"public",
"function",
"reverseTransform",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"value",
")",
")",
"{",
"return",
"array",
"(",
")",
";",
"}",
"$",
"results",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"value",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/vincentchalamon/VinceCmsSonataAdminBundle/blob/edc768061734a92ba116488dd7b61ad40af21ceb/Form/Transformer/MetaTransformer.php#L92-L122 |
blast-project/CoreBundle | src/DataSource/Iterator.php | Iterator.current | public function current()
{
$data = [];
$propertyPaths = $this->propertyPaths;
// then complete it for "fields" representing a collection of sub-entities
foreach ($this->propertyPaths as $i => $propertyPath) {
try {
if (($property = $this->propertyAccesso... | php | public function current()
{
$data = [];
$propertyPaths = $this->propertyPaths;
// then complete it for "fields" representing a collection of sub-entities
foreach ($this->propertyPaths as $i => $propertyPath) {
try {
if (($property = $this->propertyAccesso... | [
"public",
"function",
"current",
"(",
")",
"{",
"$",
"data",
"=",
"[",
"]",
";",
"$",
"propertyPaths",
"=",
"$",
"this",
"->",
"propertyPaths",
";",
"// then complete it for \"fields\" representing a collection of sub-entities",
"foreach",
"(",
"$",
"this",
"->",
... | {@inheritdoc}
Allows to get back embedded arrays, in 2 dimensions max.
e.g.: fields positions.name & positions.organism.name will be returned as :
[
'name' => 'myEntity',
'positions' => [
['name' => 'XXX', 'organism.name' => 'YYY'],
['name' => 'AAA', 'organism.name' => 'BBB'],
]
];. | [
"{"
] | train | https://github.com/blast-project/CoreBundle/blob/7a0832758ca14e5bc5d65515532c1220df3930ae/src/DataSource/Iterator.php#L33-L76 |
czim/laravel-pxlcms | src/Generator/Writer/Model/Steps/StubReplaceSimple.php | StubReplaceSimple.determineIfModelIsSluggable | protected function determineIfModelIsSluggable()
{
$this->context->modelIsSluggable = false;
$this->context->modelIsParentOfSluggableTranslation = false;
// if the model is sluggable and not translated, or this is the actual translation
if ($this->data['sluggable'... | php | protected function determineIfModelIsSluggable()
{
$this->context->modelIsSluggable = false;
$this->context->modelIsParentOfSluggableTranslation = false;
// if the model is sluggable and not translated, or this is the actual translation
if ($this->data['sluggable'... | [
"protected",
"function",
"determineIfModelIsSluggable",
"(",
")",
"{",
"$",
"this",
"->",
"context",
"->",
"modelIsSluggable",
"=",
"false",
";",
"$",
"this",
"->",
"context",
"->",
"modelIsParentOfSluggableTranslation",
"=",
"false",
";",
"// if the model is sluggabl... | Determines and stores whether model itself is sluggable
If so, it will have both the trait and implement the interface | [
"Determines",
"and",
"stores",
"whether",
"model",
"itself",
"is",
"sluggable",
"If",
"so",
"it",
"will",
"have",
"both",
"the",
"trait",
"and",
"implement",
"the",
"interface"
] | train | https://github.com/czim/laravel-pxlcms/blob/910297d2a3f2db86dde51b0e10fe5aad45f1aa1a/src/Generator/Writer/Model/Steps/StubReplaceSimple.php#L74-L95 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.