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 |
|---|---|---|---|---|---|---|---|---|---|---|
yoanm/php-jsonrpc-http-server-openapi-doc-sdk | src/App/Normalizer/Component/TypeDocNormalizer.php | TypeDocNormalizer.appendNumberMinMax | protected function appendNumberMinMax(NumberDoc $doc, array $paramDocMinMax) : array
{
$paramDocMinMax = $this->appendIfValueNotNull('minimum', $doc->getMin(), $paramDocMinMax);
$paramDocMinMax = $this->appendIf(
($doc->getMin() && false === $doc->isInclusiveMin()),
'exclusiv... | php | protected function appendNumberMinMax(NumberDoc $doc, array $paramDocMinMax) : array
{
$paramDocMinMax = $this->appendIfValueNotNull('minimum', $doc->getMin(), $paramDocMinMax);
$paramDocMinMax = $this->appendIf(
($doc->getMin() && false === $doc->isInclusiveMin()),
'exclusiv... | [
"protected",
"function",
"appendNumberMinMax",
"(",
"NumberDoc",
"$",
"doc",
",",
"array",
"$",
"paramDocMinMax",
")",
":",
"array",
"{",
"$",
"paramDocMinMax",
"=",
"$",
"this",
"->",
"appendIfValueNotNull",
"(",
"'minimum'",
",",
"$",
"doc",
"->",
"getMin",
... | @param NumberDoc $doc
@param array $paramDocMinMax
@return array | [
"@param",
"NumberDoc",
"$doc",
"@param",
"array",
"$paramDocMinMax"
] | train | https://github.com/yoanm/php-jsonrpc-http-server-openapi-doc-sdk/blob/52d6bb5d0671e0363bbf482c3c75fef97d7d1d5e/src/App/Normalizer/Component/TypeDocNormalizer.php#L191-L209 |
withfatpanda/illuminate-wordpress | src/Support/Concerns/BuildsErrorResponses.php | BuildsErrorResponses.buildErrorResponse | public function buildErrorResponse(\Exception $e)
{
$response = [
'type' => get_class($e),
'code' => $e->getCode(),
'message' => $e->getMessage(),
'data' => [
'status' => 500
]
];
if ($e instanceof ModelNotFoundException) {
$response['data']['s... | php | public function buildErrorResponse(\Exception $e)
{
$response = [
'type' => get_class($e),
'code' => $e->getCode(),
'message' => $e->getMessage(),
'data' => [
'status' => 500
]
];
if ($e instanceof ModelNotFoundException) {
$response['data']['s... | [
"public",
"function",
"buildErrorResponse",
"(",
"\\",
"Exception",
"$",
"e",
")",
"{",
"$",
"response",
"=",
"[",
"'type'",
"=>",
"get_class",
"(",
"$",
"e",
")",
",",
"'code'",
"=>",
"$",
"e",
"->",
"getCode",
"(",
")",
",",
"'message'",
"=>",
"$",... | Given an Exception, build a data package suitable for reporting
the error to the client.
@param Exception The exception
@return array | [
"Given",
"an",
"Exception",
"build",
"a",
"data",
"package",
"suitable",
"for",
"reporting",
"the",
"error",
"to",
"the",
"client",
"."
] | train | https://github.com/withfatpanda/illuminate-wordpress/blob/b426ca81a55367459430c974932ee5a941d759d8/src/Support/Concerns/BuildsErrorResponses.php#L16-L46 |
piqus/bfp4f-rcon | src/T4G/BFP4F/Rcon/Stats.php | Stats.retrieveCoreStats | public function retrieveCoreStats ()
{
$data = file_get_contents("http://battlefield.play4free.com/en/profile/stats/" .$this->_profileID. "/" .$this->_soldierID. "?g=[%22CoreStats%22]");
$coreStats = json_decode($data);
return $coreStats;
} | php | public function retrieveCoreStats ()
{
$data = file_get_contents("http://battlefield.play4free.com/en/profile/stats/" .$this->_profileID. "/" .$this->_soldierID. "?g=[%22CoreStats%22]");
$coreStats = json_decode($data);
return $coreStats;
} | [
"public",
"function",
"retrieveCoreStats",
"(",
")",
"{",
"$",
"data",
"=",
"file_get_contents",
"(",
"\"http://battlefield.play4free.com/en/profile/stats/\"",
".",
"$",
"this",
"->",
"_profileID",
".",
"\"/\"",
".",
"$",
"this",
"->",
"_soldierID",
".",
"\"?g=[%22C... | Retrieve Core Stats
@access public
@return object JSON | [
"Retrieve",
"Core",
"Stats"
] | train | https://github.com/piqus/bfp4f-rcon/blob/8e94587bc93c686e5a025a54645aed7c701811e6/src/T4G/BFP4F/Rcon/Stats.php#L81-L86 |
piqus/bfp4f-rcon | src/T4G/BFP4F/Rcon/Stats.php | Stats.retrieveBadPlayerStats | public function retrieveBadPlayerStats ()
{
$data = file_get_contents("http://battlefield.play4free.com/en/profile/stats/" .$this->_profileID. "/" .$this->_soldierID. "?g=[%22BadPlayerStats%22]");
$badPlayerStats = json_decode($data);
return $badPlayerStats;
} | php | public function retrieveBadPlayerStats ()
{
$data = file_get_contents("http://battlefield.play4free.com/en/profile/stats/" .$this->_profileID. "/" .$this->_soldierID. "?g=[%22BadPlayerStats%22]");
$badPlayerStats = json_decode($data);
return $badPlayerStats;
} | [
"public",
"function",
"retrieveBadPlayerStats",
"(",
")",
"{",
"$",
"data",
"=",
"file_get_contents",
"(",
"\"http://battlefield.play4free.com/en/profile/stats/\"",
".",
"$",
"this",
"->",
"_profileID",
".",
"\"/\"",
".",
"$",
"this",
"->",
"_soldierID",
".",
"\"?g=... | Retrieve Bad Player Stats
@access public
@return object JSON | [
"Retrieve",
"Bad",
"Player",
"Stats"
] | train | https://github.com/piqus/bfp4f-rcon/blob/8e94587bc93c686e5a025a54645aed7c701811e6/src/T4G/BFP4F/Rcon/Stats.php#L94-L99 |
piqus/bfp4f-rcon | src/T4G/BFP4F/Rcon/Stats.php | Stats.retrieveVehicleStats | public function retrieveVehicleStats ()
{
$data = file_get_contents("http://battlefield.play4free.com/en/profile/stats/" .$this->_profileID. "/" .$this->_soldierID. "?g=[%22VehicleStats%22]");
$vehicleStats = json_decode($data);
return $vehicleStats;
} | php | public function retrieveVehicleStats ()
{
$data = file_get_contents("http://battlefield.play4free.com/en/profile/stats/" .$this->_profileID. "/" .$this->_soldierID. "?g=[%22VehicleStats%22]");
$vehicleStats = json_decode($data);
return $vehicleStats;
} | [
"public",
"function",
"retrieveVehicleStats",
"(",
")",
"{",
"$",
"data",
"=",
"file_get_contents",
"(",
"\"http://battlefield.play4free.com/en/profile/stats/\"",
".",
"$",
"this",
"->",
"_profileID",
".",
"\"/\"",
".",
"$",
"this",
"->",
"_soldierID",
".",
"\"?g=[%... | Retrieve Vehicle Stats
@access public
@return object JSON | [
"Retrieve",
"Vehicle",
"Stats"
] | train | https://github.com/piqus/bfp4f-rcon/blob/8e94587bc93c686e5a025a54645aed7c701811e6/src/T4G/BFP4F/Rcon/Stats.php#L107-L112 |
piqus/bfp4f-rcon | src/T4G/BFP4F/Rcon/Stats.php | Stats.retrieveMapStats | public function retrieveMapStats ()
{
$data = file_get_contents("http://battlefield.play4free.com/en/profile/stats/" .$this->_profileID. "/" .$this->_soldierID. "?g=[%22MapStats%22]");
$mapStats = json_decode($data);
return $mapStats;
} | php | public function retrieveMapStats ()
{
$data = file_get_contents("http://battlefield.play4free.com/en/profile/stats/" .$this->_profileID. "/" .$this->_soldierID. "?g=[%22MapStats%22]");
$mapStats = json_decode($data);
return $mapStats;
} | [
"public",
"function",
"retrieveMapStats",
"(",
")",
"{",
"$",
"data",
"=",
"file_get_contents",
"(",
"\"http://battlefield.play4free.com/en/profile/stats/\"",
".",
"$",
"this",
"->",
"_profileID",
".",
"\"/\"",
".",
"$",
"this",
"->",
"_soldierID",
".",
"\"?g=[%22Ma... | Retrieve Map Stats
@access public
@return object JSON | [
"Retrieve",
"Map",
"Stats"
] | train | https://github.com/piqus/bfp4f-rcon/blob/8e94587bc93c686e5a025a54645aed7c701811e6/src/T4G/BFP4F/Rcon/Stats.php#L120-L125 |
piqus/bfp4f-rcon | src/T4G/BFP4F/Rcon/Stats.php | Stats.retrieveGameModeMapStats | public function retrieveGameModeMapStats ()
{
$data = file_get_contents("http://battlefield.play4free.com/en/profile/stats/" .$this->_profileID. "/" .$this->_soldierID. "?g=[%22GameModeMapStats%22]");
$gameModeMapStats = json_decode($data);
return $gameModeMapStats;
} | php | public function retrieveGameModeMapStats ()
{
$data = file_get_contents("http://battlefield.play4free.com/en/profile/stats/" .$this->_profileID. "/" .$this->_soldierID. "?g=[%22GameModeMapStats%22]");
$gameModeMapStats = json_decode($data);
return $gameModeMapStats;
} | [
"public",
"function",
"retrieveGameModeMapStats",
"(",
")",
"{",
"$",
"data",
"=",
"file_get_contents",
"(",
"\"http://battlefield.play4free.com/en/profile/stats/\"",
".",
"$",
"this",
"->",
"_profileID",
".",
"\"/\"",
".",
"$",
"this",
"->",
"_soldierID",
".",
"\"?... | Retrieve Game Mode Map Stats
@access public
@return object JSON | [
"Retrieve",
"Game",
"Mode",
"Map",
"Stats"
] | train | https://github.com/piqus/bfp4f-rcon/blob/8e94587bc93c686e5a025a54645aed7c701811e6/src/T4G/BFP4F/Rcon/Stats.php#L133-L138 |
piqus/bfp4f-rcon | src/T4G/BFP4F/Rcon/Stats.php | Stats.retrieveWeaponStats | public function retrieveWeaponStats ()
{
$data = file_get_contents("http://battlefield.play4free.com/en/profile/stats/" .$this->_profileID. "/" .$this->_soldierID. "?g=[%22WeaponStats%22]");
$weapons = json_decode($data);
return $weapons;
} | php | public function retrieveWeaponStats ()
{
$data = file_get_contents("http://battlefield.play4free.com/en/profile/stats/" .$this->_profileID. "/" .$this->_soldierID. "?g=[%22WeaponStats%22]");
$weapons = json_decode($data);
return $weapons;
} | [
"public",
"function",
"retrieveWeaponStats",
"(",
")",
"{",
"$",
"data",
"=",
"file_get_contents",
"(",
"\"http://battlefield.play4free.com/en/profile/stats/\"",
".",
"$",
"this",
"->",
"_profileID",
".",
"\"/\"",
".",
"$",
"this",
"->",
"_soldierID",
".",
"\"?g=[%2... | Retrieve Weapon Stats
@access public
@return object JSON | [
"Retrieve",
"Weapon",
"Stats"
] | train | https://github.com/piqus/bfp4f-rcon/blob/8e94587bc93c686e5a025a54645aed7c701811e6/src/T4G/BFP4F/Rcon/Stats.php#L146-L151 |
piqus/bfp4f-rcon | src/T4G/BFP4F/Rcon/Stats.php | Stats.retrieveGameModeStats | public function retrieveGameModeStats ()
{
$data = file_get_contents("http://battlefield.play4free.com/en/profile/stats/" .$this->_profileID. "/" .$this->_soldierID. "?g=[%22GameModeStats%22]");
$gameModeStats = json_decode($data);
return $gameModeStats;
} | php | public function retrieveGameModeStats ()
{
$data = file_get_contents("http://battlefield.play4free.com/en/profile/stats/" .$this->_profileID. "/" .$this->_soldierID. "?g=[%22GameModeStats%22]");
$gameModeStats = json_decode($data);
return $gameModeStats;
} | [
"public",
"function",
"retrieveGameModeStats",
"(",
")",
"{",
"$",
"data",
"=",
"file_get_contents",
"(",
"\"http://battlefield.play4free.com/en/profile/stats/\"",
".",
"$",
"this",
"->",
"_profileID",
".",
"\"/\"",
".",
"$",
"this",
"->",
"_soldierID",
".",
"\"?g=[... | Retrieve Game Mode Stats
@access public
@return object JSON | [
"Retrieve",
"Game",
"Mode",
"Stats"
] | train | https://github.com/piqus/bfp4f-rcon/blob/8e94587bc93c686e5a025a54645aed7c701811e6/src/T4G/BFP4F/Rcon/Stats.php#L159-L164 |
piqus/bfp4f-rcon | src/T4G/BFP4F/Rcon/Stats.php | Stats.retrieveRushMapStats | public function retrieveRushMapStats ()
{
$data = file_get_contents("http://battlefield.play4free.com/en/profile/stats/" .$this->_profileID. "/" .$this->_soldierID. "?g=[%22RushMapStats%22]&_?=1351945928776");
$rushMapStats = json_decode($data);
return $rushMapStats;
} | php | public function retrieveRushMapStats ()
{
$data = file_get_contents("http://battlefield.play4free.com/en/profile/stats/" .$this->_profileID. "/" .$this->_soldierID. "?g=[%22RushMapStats%22]&_?=1351945928776");
$rushMapStats = json_decode($data);
return $rushMapStats;
} | [
"public",
"function",
"retrieveRushMapStats",
"(",
")",
"{",
"$",
"data",
"=",
"file_get_contents",
"(",
"\"http://battlefield.play4free.com/en/profile/stats/\"",
".",
"$",
"this",
"->",
"_profileID",
".",
"\"/\"",
".",
"$",
"this",
"->",
"_soldierID",
".",
"\"?g=[%... | Retrieve Rush Map Stats
@access public
@return object JSON | [
"Retrieve",
"Rush",
"Map",
"Stats"
] | train | https://github.com/piqus/bfp4f-rcon/blob/8e94587bc93c686e5a025a54645aed7c701811e6/src/T4G/BFP4F/Rcon/Stats.php#L172-L177 |
piqus/bfp4f-rcon | src/T4G/BFP4F/Rcon/Stats.php | Stats.retrieveGameEventStats | public function retrieveGameEventStats ()
{
$data = file_get_contents("http://battlefield.play4free.com/en/profile/stats/" .$this->_profileID. "/" .$this->_soldierID. "?g=[%22GameEventStats%22]");
$gameEventStats = json_decode($data);
return $gameEventStats;
} | php | public function retrieveGameEventStats ()
{
$data = file_get_contents("http://battlefield.play4free.com/en/profile/stats/" .$this->_profileID. "/" .$this->_soldierID. "?g=[%22GameEventStats%22]");
$gameEventStats = json_decode($data);
return $gameEventStats;
} | [
"public",
"function",
"retrieveGameEventStats",
"(",
")",
"{",
"$",
"data",
"=",
"file_get_contents",
"(",
"\"http://battlefield.play4free.com/en/profile/stats/\"",
".",
"$",
"this",
"->",
"_profileID",
".",
"\"/\"",
".",
"$",
"this",
"->",
"_soldierID",
".",
"\"?g=... | Retrieve Game Event Stats
@access public
@return object JSON | [
"Retrieve",
"Game",
"Event",
"Stats"
] | train | https://github.com/piqus/bfp4f-rcon/blob/8e94587bc93c686e5a025a54645aed7c701811e6/src/T4G/BFP4F/Rcon/Stats.php#L185-L190 |
piqus/bfp4f-rcon | src/T4G/BFP4F/Rcon/Stats.php | Stats.retrieveLoadout | public function retrieveLoadout ()
{
$data = file_get_contents('http://battlefield.play4free.com/pl/profile/loadout/' .$this->_profileID. '/' .$this->_soldierID);
$loadout = json_decode($data, true);
return $loadout;
} | php | public function retrieveLoadout ()
{
$data = file_get_contents('http://battlefield.play4free.com/pl/profile/loadout/' .$this->_profileID. '/' .$this->_soldierID);
$loadout = json_decode($data, true);
return $loadout;
} | [
"public",
"function",
"retrieveLoadout",
"(",
")",
"{",
"$",
"data",
"=",
"file_get_contents",
"(",
"'http://battlefield.play4free.com/pl/profile/loadout/'",
".",
"$",
"this",
"->",
"_profileID",
".",
"'/'",
".",
"$",
"this",
"->",
"_soldierID",
")",
";",
"$",
"... | Retrieve Loadout
@access public
@return object JSON | [
"Retrieve",
"Loadout"
] | train | https://github.com/piqus/bfp4f-rcon/blob/8e94587bc93c686e5a025a54645aed7c701811e6/src/T4G/BFP4F/Rcon/Stats.php#L198-L203 |
dragosprotung/stc-core | src/Date/DateInterval.php | DateInterval.totalSeconds | public function totalSeconds() : int
{
return $this->days * 86400 + $this->h * 3600 + $this->i * 60 + $this->s;
} | php | public function totalSeconds() : int
{
return $this->days * 86400 + $this->h * 3600 + $this->i * 60 + $this->s;
} | [
"public",
"function",
"totalSeconds",
"(",
")",
":",
"int",
"{",
"return",
"$",
"this",
"->",
"days",
"*",
"86400",
"+",
"$",
"this",
"->",
"h",
"*",
"3600",
"+",
"$",
"this",
"->",
"i",
"*",
"60",
"+",
"$",
"this",
"->",
"s",
";",
"}"
] | Get the total number of seconds from the DateInterval.
@return integer | [
"Get",
"the",
"total",
"number",
"of",
"seconds",
"from",
"the",
"DateInterval",
"."
] | train | https://github.com/dragosprotung/stc-core/blob/9783e3414294f4ee555a1d538d2807269deeb9e7/src/Date/DateInterval.php#L17-L20 |
stubbles/stubbles-webapp-core | src/main/php/auth/ProtectedResource.php | ProtectedResource.negotiateMimeType | public function negotiateMimeType(Request $request, Response $response): bool
{
return $this->actualResource->negotiateMimeType($request, $response);
} | php | public function negotiateMimeType(Request $request, Response $response): bool
{
return $this->actualResource->negotiateMimeType($request, $response);
} | [
"public",
"function",
"negotiateMimeType",
"(",
"Request",
"$",
"request",
",",
"Response",
"$",
"response",
")",
":",
"bool",
"{",
"return",
"$",
"this",
"->",
"actualResource",
"->",
"negotiateMimeType",
"(",
"$",
"request",
",",
"$",
"response",
")",
";",... | negotiates proper mime type for given request
@param \stubbles\webapp\Request $request
@param \stubbles\webapp\Response $response response to send
@return bool
@since 6.0.0 | [
"negotiates",
"proper",
"mime",
"type",
"for",
"given",
"request"
] | train | https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/auth/ProtectedResource.php#L99-L102 |
stubbles/stubbles-webapp-core | src/main/php/auth/ProtectedResource.php | ProtectedResource.applyPreInterceptors | public function applyPreInterceptors(Request $request, Response $response): bool
{
if ($this->isAuthorized($request, $response)) {
return $this->actualResource->applyPreInterceptors($request, $response);
}
return true;
} | php | public function applyPreInterceptors(Request $request, Response $response): bool
{
if ($this->isAuthorized($request, $response)) {
return $this->actualResource->applyPreInterceptors($request, $response);
}
return true;
} | [
"public",
"function",
"applyPreInterceptors",
"(",
"Request",
"$",
"request",
",",
"Response",
"$",
"response",
")",
":",
"bool",
"{",
"if",
"(",
"$",
"this",
"->",
"isAuthorized",
"(",
"$",
"request",
",",
"$",
"response",
")",
")",
"{",
"return",
"$",
... | apply pre interceptors
Pre interceptors for actual resource are only applied when request is
authorized.
@param \stubbles\webapp\Request $request current request
@param \stubbles\webapp\Response $response response to send
@return bool | [
"apply",
"pre",
"interceptors"
] | train | https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/auth/ProtectedResource.php#L124-L131 |
stubbles/stubbles-webapp-core | src/main/php/auth/ProtectedResource.php | ProtectedResource.isAuthorized | private function isAuthorized(Request $request, Response $response): bool
{
$this->authorized = false;
$user = $this->authenticate($request, $response);
if (null !== $user && $this->authConstraint->requiresRoles()) {
$roles = $this->roles($response, $user);
if (null !... | php | private function isAuthorized(Request $request, Response $response): bool
{
$this->authorized = false;
$user = $this->authenticate($request, $response);
if (null !== $user && $this->authConstraint->requiresRoles()) {
$roles = $this->roles($response, $user);
if (null !... | [
"private",
"function",
"isAuthorized",
"(",
"Request",
"$",
"request",
",",
"Response",
"$",
"response",
")",
":",
"bool",
"{",
"$",
"this",
"->",
"authorized",
"=",
"false",
";",
"$",
"user",
"=",
"$",
"this",
"->",
"authenticate",
"(",
"$",
"request",
... | checks if request is authorized
@param \stubbles\webapp\Request $request current request
@param \stubbles\webapp\Response $response response to send
@return bool | [
"checks",
"if",
"request",
"is",
"authorized"
] | train | https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/auth/ProtectedResource.php#L140-L158 |
stubbles/stubbles-webapp-core | src/main/php/auth/ProtectedResource.php | ProtectedResource.authenticate | private function authenticate(Request $request, Response $response)
{
$authenticationProvider = $this->injector->getInstance(AuthenticationProvider::class);
try {
$user = $authenticationProvider->authenticate($request);
if (null == $user && $this->authConstraint->loginAllowed... | php | private function authenticate(Request $request, Response $response)
{
$authenticationProvider = $this->injector->getInstance(AuthenticationProvider::class);
try {
$user = $authenticationProvider->authenticate($request);
if (null == $user && $this->authConstraint->loginAllowed... | [
"private",
"function",
"authenticate",
"(",
"Request",
"$",
"request",
",",
"Response",
"$",
"response",
")",
"{",
"$",
"authenticationProvider",
"=",
"$",
"this",
"->",
"injector",
"->",
"getInstance",
"(",
"AuthenticationProvider",
"::",
"class",
")",
";",
"... | checks whether request is authenticated
@param \stubbles\webapp\Request $request current request
@param \stubbles\webapp\Response $response response to send
@return \stubbles\webapp\auth\User|null | [
"checks",
"whether",
"request",
"is",
"authenticated"
] | train | https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/auth/ProtectedResource.php#L167-L186 |
stubbles/stubbles-webapp-core | src/main/php/auth/ProtectedResource.php | ProtectedResource.roles | private function roles(Response $response, User $user)
{
try {
return $this->injector->getInstance(AuthorizationProvider::class)
->roles($user);
} catch (AuthProviderException $ahe) {
$this->handleAuthProviderException($ahe, $response);
return ... | php | private function roles(Response $response, User $user)
{
try {
return $this->injector->getInstance(AuthorizationProvider::class)
->roles($user);
} catch (AuthProviderException $ahe) {
$this->handleAuthProviderException($ahe, $response);
return ... | [
"private",
"function",
"roles",
"(",
"Response",
"$",
"response",
",",
"User",
"$",
"user",
")",
"{",
"try",
"{",
"return",
"$",
"this",
"->",
"injector",
"->",
"getInstance",
"(",
"AuthorizationProvider",
"::",
"class",
")",
"->",
"roles",
"(",
"$",
"us... | checks whether expected role is given
@param \stubbles\webapp\Response $response response to send
@param \stubbles\webapp\auth\User $user
@return \stubbles\webapp\auth\Roles|null | [
"checks",
"whether",
"expected",
"role",
"is",
"given"
] | train | https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/auth/ProtectedResource.php#L195-L204 |
stubbles/stubbles-webapp-core | src/main/php/auth/ProtectedResource.php | ProtectedResource.handleAuthProviderException | private function handleAuthProviderException(AuthProviderException $ahe, Response $response)
{
if ($ahe->isInternal()) {
$this->error = $response->internalServerError($ahe);
} else {
$response->setStatusCode($ahe->getCode());
$this->error = new Error($ahe->getMess... | php | private function handleAuthProviderException(AuthProviderException $ahe, Response $response)
{
if ($ahe->isInternal()) {
$this->error = $response->internalServerError($ahe);
} else {
$response->setStatusCode($ahe->getCode());
$this->error = new Error($ahe->getMess... | [
"private",
"function",
"handleAuthProviderException",
"(",
"AuthProviderException",
"$",
"ahe",
",",
"Response",
"$",
"response",
")",
"{",
"if",
"(",
"$",
"ahe",
"->",
"isInternal",
"(",
")",
")",
"{",
"$",
"this",
"->",
"error",
"=",
"$",
"response",
"->... | sets proper response status code depending on exception
@param \stubbles\webapp\auth\AuthProviderException $ahe
@param \stubbles\webapp\Response $response | [
"sets",
"proper",
"response",
"status",
"code",
"depending",
"on",
"exception"
] | train | https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/auth/ProtectedResource.php#L212-L220 |
stubbles/stubbles-webapp-core | src/main/php/auth/ProtectedResource.php | ProtectedResource.resolve | public function resolve(Request $request, Response $response)
{
if ($this->authorized) {
return $this->actualResource->resolve($request, $response);
}
return $this->error;
} | php | public function resolve(Request $request, Response $response)
{
if ($this->authorized) {
return $this->actualResource->resolve($request, $response);
}
return $this->error;
} | [
"public",
"function",
"resolve",
"(",
"Request",
"$",
"request",
",",
"Response",
"$",
"response",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"authorized",
")",
"{",
"return",
"$",
"this",
"->",
"actualResource",
"->",
"resolve",
"(",
"$",
"request",
",",
... | creates processor instance
Resolving of actual resource is only done when request is authorized.
@param \stubbles\webapp\Request $request current request
@param \stubbles\webapp\Response $response response to send
@return mixed | [
"creates",
"processor",
"instance"
] | train | https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/auth/ProtectedResource.php#L231-L238 |
stubbles/stubbles-webapp-core | src/main/php/auth/ProtectedResource.php | ProtectedResource.applyPostInterceptors | public function applyPostInterceptors(Request $request, Response $response): bool
{
return $this->actualResource->applyPostInterceptors($request, $response);
} | php | public function applyPostInterceptors(Request $request, Response $response): bool
{
return $this->actualResource->applyPostInterceptors($request, $response);
} | [
"public",
"function",
"applyPostInterceptors",
"(",
"Request",
"$",
"request",
",",
"Response",
"$",
"response",
")",
":",
"bool",
"{",
"return",
"$",
"this",
"->",
"actualResource",
"->",
"applyPostInterceptors",
"(",
"$",
"request",
",",
"$",
"response",
")"... | apply post interceptors
Post interceptors of actual resource are applied independent of whether
request was authorized or not.
@param \stubbles\webapp\Request $request current request
@param \stubbles\webapp\Response $response response to send
@return bool | [
"apply",
"post",
"interceptors"
] | train | https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/auth/ProtectedResource.php#L250-L253 |
delboy1978uk/form | src/Field/FieldAbstract.php | FieldAbstract.isValid | public function isValid()
{
$this->errorMessages = [];
$this->validatorCollection->rewind();
while ($this->validatorCollection->valid()) {
$this->checkForErrors($this->validatorCollection->current());
$this->validatorCollection->next();
}
$coun... | php | public function isValid()
{
$this->errorMessages = [];
$this->validatorCollection->rewind();
while ($this->validatorCollection->valid()) {
$this->checkForErrors($this->validatorCollection->current());
$this->validatorCollection->next();
}
$coun... | [
"public",
"function",
"isValid",
"(",
")",
"{",
"$",
"this",
"->",
"errorMessages",
"=",
"[",
"]",
";",
"$",
"this",
"->",
"validatorCollection",
"->",
"rewind",
"(",
")",
";",
"while",
"(",
"$",
"this",
"->",
"validatorCollection",
"->",
"valid",
"(",
... | Runs the checkForErrors method for each field, which adds to errorMessages if invalid
@return bool
@throws Exception If validation of $value is impossible | [
"Runs",
"the",
"checkForErrors",
"method",
"for",
"each",
"field",
"which",
"adds",
"to",
"errorMessages",
"if",
"invalid"
] | train | https://github.com/delboy1978uk/form/blob/fbbb042d95deef4603a19edf08c0497f720398a6/src/Field/FieldAbstract.php#L184-L194 |
ekyna/GlsUniBox | Api/Client.php | Client.send | public function send(Request $request)
{
$request->configure($this->config);
$httpClient = new \GuzzleHttp\Client();
$r = $httpClient->request('POST', $this->getUrl(), [
'body' => \GuzzleHttp\Psr7\stream_for((string) $request),
]);
return Response::create($r->g... | php | public function send(Request $request)
{
$request->configure($this->config);
$httpClient = new \GuzzleHttp\Client();
$r = $httpClient->request('POST', $this->getUrl(), [
'body' => \GuzzleHttp\Psr7\stream_for((string) $request),
]);
return Response::create($r->g... | [
"public",
"function",
"send",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"request",
"->",
"configure",
"(",
"$",
"this",
"->",
"config",
")",
";",
"$",
"httpClient",
"=",
"new",
"\\",
"GuzzleHttp",
"\\",
"Client",
"(",
")",
";",
"$",
"r",
"=",
... | Sends the request.
@param Request $request
@return Response | [
"Sends",
"the",
"request",
"."
] | train | https://github.com/ekyna/GlsUniBox/blob/b474271ba355c3917074422306dc64abf09584d0/Api/Client.php#L67-L78 |
ekyna/GlsUniBox | Api/Client.php | Client.getUrl | private function getUrl()
{
if ($this->mode === static::MODE_PROD) {
$url = static::URL_PROD;
} elseif ($this->mode === static::MODE_CONSIGNMENT) {
$url = static::URL_CONSIGNMENT;
} else {
$url = static::URL_TEST;
}
return 'http' . ($this-... | php | private function getUrl()
{
if ($this->mode === static::MODE_PROD) {
$url = static::URL_PROD;
} elseif ($this->mode === static::MODE_CONSIGNMENT) {
$url = static::URL_CONSIGNMENT;
} else {
$url = static::URL_TEST;
}
return 'http' . ($this-... | [
"private",
"function",
"getUrl",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"mode",
"===",
"static",
"::",
"MODE_PROD",
")",
"{",
"$",
"url",
"=",
"static",
"::",
"URL_PROD",
";",
"}",
"elseif",
"(",
"$",
"this",
"->",
"mode",
"===",
"static",
":... | Returns the endpoint url.
@return string | [
"Returns",
"the",
"endpoint",
"url",
"."
] | train | https://github.com/ekyna/GlsUniBox/blob/b474271ba355c3917074422306dc64abf09584d0/Api/Client.php#L85-L96 |
movoin/one-swoole | src/Support/Collection.php | Collection.replace | public function replace(array $items = [])
{
$this->items = [];
foreach ($items as $key => $item) {
$this->set($key, $item);
}
} | php | public function replace(array $items = [])
{
$this->items = [];
foreach ($items as $key => $item) {
$this->set($key, $item);
}
} | [
"public",
"function",
"replace",
"(",
"array",
"$",
"items",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"items",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"items",
"as",
"$",
"key",
"=>",
"$",
"item",
")",
"{",
"$",
"this",
"->",
"set",
"(",
... | 替换所有数据
@param array $items | [
"替换所有数据"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Support/Collection.php#L71-L78 |
movoin/one-swoole | src/Support/Collection.php | Collection.update | public function update(array $items = [])
{
foreach ($items as $key => $item) {
$this->set($key, $item);
}
} | php | public function update(array $items = [])
{
foreach ($items as $key => $item) {
$this->set($key, $item);
}
} | [
"public",
"function",
"update",
"(",
"array",
"$",
"items",
"=",
"[",
"]",
")",
"{",
"foreach",
"(",
"$",
"items",
"as",
"$",
"key",
"=>",
"$",
"item",
")",
"{",
"$",
"this",
"->",
"set",
"(",
"$",
"key",
",",
"$",
"item",
")",
";",
"}",
"}"
... | 更新数据
@param array $items | [
"更新数据"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Support/Collection.php#L85-L90 |
movoin/one-swoole | src/Support/Collection.php | Collection.get | public function get(string $key, $default = null)
{
return ($value = $this->offsetGet($key)) === null ? $default : $value;
} | php | public function get(string $key, $default = null)
{
return ($value = $this->offsetGet($key)) === null ? $default : $value;
} | [
"public",
"function",
"get",
"(",
"string",
"$",
"key",
",",
"$",
"default",
"=",
"null",
")",
"{",
"return",
"(",
"$",
"value",
"=",
"$",
"this",
"->",
"offsetGet",
"(",
"$",
"key",
")",
")",
"===",
"null",
"?",
"$",
"default",
":",
"$",
"value"... | 返回指定数据项
@param string $key
@param mixed $default
@return mixed | [
"返回指定数据项"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Support/Collection.php#L161-L164 |
movoin/one-swoole | src/Support/Collection.php | Collection.getByValue | public function getByValue(string $key, $value)
{
return array_filter($this->items, function ($val) use ($key, $value) {
return $val[$this->normalizeKey($key)] === $value;
});
} | php | public function getByValue(string $key, $value)
{
return array_filter($this->items, function ($val) use ($key, $value) {
return $val[$this->normalizeKey($key)] === $value;
});
} | [
"public",
"function",
"getByValue",
"(",
"string",
"$",
"key",
",",
"$",
"value",
")",
"{",
"return",
"array_filter",
"(",
"$",
"this",
"->",
"items",
",",
"function",
"(",
"$",
"val",
")",
"use",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"retu... | 返回与指定键名的值相符的数据
@param string $key
@param mixed $value
@return mixed | [
"返回与指定键名的值相符的数据"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Support/Collection.php#L174-L179 |
movoin/one-swoole | src/Support/Collection.php | Collection.normalizeValue | public function normalizeValue($item)
{
if (is_array($item)) {
$normalized = [];
foreach ($item as $key => $value) {
$key = $this->recursive ? $this->normalizeKey($key) : $key;
if (is_array($value)) {
$normalized[$key] = $this->no... | php | public function normalizeValue($item)
{
if (is_array($item)) {
$normalized = [];
foreach ($item as $key => $value) {
$key = $this->recursive ? $this->normalizeKey($key) : $key;
if (is_array($value)) {
$normalized[$key] = $this->no... | [
"public",
"function",
"normalizeValue",
"(",
"$",
"item",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"item",
")",
")",
"{",
"$",
"normalized",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"item",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
... | 标准化键值
@param mixed $item
@return mixed | [
"标准化键值"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Support/Collection.php#L263-L290 |
movoin/one-swoole | src/Support/Collection.php | Collection.offsetSet | public function offsetSet($offset, $value)
{
if (is_null($offset)) {
$this->items[] = $this->normalizeValue($value);
} else {
$this->items[$this->normalizeKey($offset)] = $this->normalizeValue($value);
}
} | php | public function offsetSet($offset, $value)
{
if (is_null($offset)) {
$this->items[] = $this->normalizeValue($value);
} else {
$this->items[$this->normalizeKey($offset)] = $this->normalizeValue($value);
}
} | [
"public",
"function",
"offsetSet",
"(",
"$",
"offset",
",",
"$",
"value",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"offset",
")",
")",
"{",
"$",
"this",
"->",
"items",
"[",
"]",
"=",
"$",
"this",
"->",
"normalizeValue",
"(",
"$",
"value",
")",
"... | 设置数据项
@param mixed $offset
@param mixed $value | [
"设置数据项"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Support/Collection.php#L298-L305 |
tjbp/laravel-verify-emails | src/Auth/Console/MakeVerifyEmailsCommand.php | MakeVerifyEmailsCommand.fire | public function fire()
{
$this->createDirectories();
$this->exportViews();
$this->info('Installed EmailController.');
copy(__DIR__.'/stubs/make/controllers/EmailController.stub', app_path('Http/Controllers/Auth/EmailController.php'));
$this->info('Updated routes file.');
... | php | public function fire()
{
$this->createDirectories();
$this->exportViews();
$this->info('Installed EmailController.');
copy(__DIR__.'/stubs/make/controllers/EmailController.stub', app_path('Http/Controllers/Auth/EmailController.php'));
$this->info('Updated routes file.');
... | [
"public",
"function",
"fire",
"(",
")",
"{",
"$",
"this",
"->",
"createDirectories",
"(",
")",
";",
"$",
"this",
"->",
"exportViews",
"(",
")",
";",
"$",
"this",
"->",
"info",
"(",
"'Installed EmailController.'",
")",
";",
"copy",
"(",
"__DIR__",
".",
... | Execute the console command.
@return void | [
"Execute",
"the",
"console",
"command",
"."
] | train | https://github.com/tjbp/laravel-verify-emails/blob/1e2ac10a696c10f2fdf0d7de6c3388d549bc07c6/src/Auth/Console/MakeVerifyEmailsCommand.php#L38-L61 |
tjbp/laravel-verify-emails | src/Auth/Console/MakeVerifyEmailsCommand.php | MakeVerifyEmailsCommand.createDirectories | protected function createDirectories()
{
if (! is_dir(base_path('resources/views/auth/verify-emails'))) {
mkdir(base_path('resources/views/auth/verify-emails'), 0755, true);
}
if (! is_dir(base_path('resources/views/auth/emails'))) {
mkdir(base_path('resources/views/... | php | protected function createDirectories()
{
if (! is_dir(base_path('resources/views/auth/verify-emails'))) {
mkdir(base_path('resources/views/auth/verify-emails'), 0755, true);
}
if (! is_dir(base_path('resources/views/auth/emails'))) {
mkdir(base_path('resources/views/... | [
"protected",
"function",
"createDirectories",
"(",
")",
"{",
"if",
"(",
"!",
"is_dir",
"(",
"base_path",
"(",
"'resources/views/auth/verify-emails'",
")",
")",
")",
"{",
"mkdir",
"(",
"base_path",
"(",
"'resources/views/auth/verify-emails'",
")",
",",
"0755",
",",... | Create the directories for the files.
@return void | [
"Create",
"the",
"directories",
"for",
"the",
"files",
"."
] | train | https://github.com/tjbp/laravel-verify-emails/blob/1e2ac10a696c10f2fdf0d7de6c3388d549bc07c6/src/Auth/Console/MakeVerifyEmailsCommand.php#L68-L77 |
tjbp/laravel-verify-emails | src/Auth/Console/MakeVerifyEmailsCommand.php | MakeVerifyEmailsCommand.exportViews | protected function exportViews()
{
foreach ($this->views as $key => $value) {
$path = base_path('resources/views/'.$value);
$this->line('<info>Created View:</info> '.$path);
copy(__DIR__.'/stubs/make/views/'.$key, $path);
}
} | php | protected function exportViews()
{
foreach ($this->views as $key => $value) {
$path = base_path('resources/views/'.$value);
$this->line('<info>Created View:</info> '.$path);
copy(__DIR__.'/stubs/make/views/'.$key, $path);
}
} | [
"protected",
"function",
"exportViews",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"views",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"path",
"=",
"base_path",
"(",
"'resources/views/'",
".",
"$",
"value",
")",
";",
"$",
"this",
"->... | Export the authentication views.
@return void | [
"Export",
"the",
"authentication",
"views",
"."
] | train | https://github.com/tjbp/laravel-verify-emails/blob/1e2ac10a696c10f2fdf0d7de6c3388d549bc07c6/src/Auth/Console/MakeVerifyEmailsCommand.php#L84-L93 |
marmelab/phpcr-api | src/PHPCRAPI/PHPCR/AbstractCollection.php | AbstractCollection.remove | public function remove($name)
{
if (!array_key_exists($name, $this->items)) {
throw new CollectionUnknownKeyException(sprintf('Item name=%s does not exist in collection',$name));
}
unset($this->items[$name]);
return true;
} | php | public function remove($name)
{
if (!array_key_exists($name, $this->items)) {
throw new CollectionUnknownKeyException(sprintf('Item name=%s does not exist in collection',$name));
}
unset($this->items[$name]);
return true;
} | [
"public",
"function",
"remove",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"items",
")",
")",
"{",
"throw",
"new",
"CollectionUnknownKeyException",
"(",
"sprintf",
"(",
"'Item name=%s does not ex... | Remove an item from the collection
@param string $name The name of the item
@return boolean Returns true in case of success
@throws CollectionUnknownKeyException if the item does not exist in the collection
@api | [
"Remove",
"an",
"item",
"from",
"the",
"collection"
] | train | https://github.com/marmelab/phpcr-api/blob/372149e27d45babe142d0546894362fce987729b/src/PHPCRAPI/PHPCR/AbstractCollection.php#L57-L66 |
marmelab/phpcr-api | src/PHPCRAPI/PHPCR/AbstractCollection.php | AbstractCollection.get | public function get($name)
{
if (!array_key_exists($name, $this->items)) {
throw new CollectionUnknownKeyException(sprintf('Item name=%s does not exist in collection',$name));
}
return $this->items[$name];
} | php | public function get($name)
{
if (!array_key_exists($name, $this->items)) {
throw new CollectionUnknownKeyException(sprintf('Item name=%s does not exist in collection',$name));
}
return $this->items[$name];
} | [
"public",
"function",
"get",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"items",
")",
")",
"{",
"throw",
"new",
"CollectionUnknownKeyException",
"(",
"sprintf",
"(",
"'Item name=%s does not exist... | Get an item from the collection
@param string $name The name of the item
@return Repository The found item
@throws CollectionUnknownKeyException if the item does not exist in the collection
@api | [
"Get",
"an",
"item",
"from",
"the",
"collection"
] | train | https://github.com/marmelab/phpcr-api/blob/372149e27d45babe142d0546894362fce987729b/src/PHPCRAPI/PHPCR/AbstractCollection.php#L79-L86 |
movoin/one-swoole | src/Protocol/Message/Cookies.php | Cookies.toArray | public function toArray(): array
{
$cookies = [];
foreach ($this->responseCookies as $key => $cookie) {
$cookie['expires'] = is_string($cookie['expires']) ?
strtotime($cookie['expires']) :
(int) $cookie['expires'];
$cookies[] ... | php | public function toArray(): array
{
$cookies = [];
foreach ($this->responseCookies as $key => $cookie) {
$cookie['expires'] = is_string($cookie['expires']) ?
strtotime($cookie['expires']) :
(int) $cookie['expires'];
$cookies[] ... | [
"public",
"function",
"toArray",
"(",
")",
":",
"array",
"{",
"$",
"cookies",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"responseCookies",
"as",
"$",
"key",
"=>",
"$",
"cookie",
")",
"{",
"$",
"cookie",
"[",
"'expires'",
"]",
"=",
"is_... | 获得 Cookies 数组
@return array | [
"获得",
"Cookies",
"数组"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Protocol/Message/Cookies.php#L98-L111 |
Srokap/code_review | classes/CodeReview/Analyzer.php | Analyzer.processFile | public function processFile($filePath, $functions) {
$result = array(
'problems' => array(),
'fixes' => array(),
);
$phpTokens = new PhpFileParser($filePath);
$changes = 0;
foreach ($phpTokens as $key => $row) {
// get non trivial tokens
if (is_array($row)) {
list($token, $functionName, $lineN... | php | public function processFile($filePath, $functions) {
$result = array(
'problems' => array(),
'fixes' => array(),
);
$phpTokens = new PhpFileParser($filePath);
$changes = 0;
foreach ($phpTokens as $key => $row) {
// get non trivial tokens
if (is_array($row)) {
list($token, $functionName, $lineN... | [
"public",
"function",
"processFile",
"(",
"$",
"filePath",
",",
"$",
"functions",
")",
"{",
"$",
"result",
"=",
"array",
"(",
"'problems'",
"=>",
"array",
"(",
")",
",",
"'fixes'",
"=>",
"array",
"(",
")",
",",
")",
";",
"$",
"phpTokens",
"=",
"new",... | Find function calls and extract
@param string $filePath
@param array $functions
@return array | [
"Find",
"function",
"calls",
"and",
"extract"
] | train | https://github.com/Srokap/code_review/blob/c79c619f99279cf15713b118ae19b0ef017db362/classes/CodeReview/Analyzer.php#L224-L278 |
vardius/list-bundle | View/Renderer.php | Renderer.renderView | public function renderView(string $view, array $params = []):string
{
$template = null;
if ($this->templating->exists($this->getTemplateName())) {
$template = $this->getTemplateName();
}
$viewPath = $view;
if ($template === null && $viewPath) {
$templ... | php | public function renderView(string $view, array $params = []):string
{
$template = null;
if ($this->templating->exists($this->getTemplateName())) {
$template = $this->getTemplateName();
}
$viewPath = $view;
if ($template === null && $viewPath) {
$templ... | [
"public",
"function",
"renderView",
"(",
"string",
"$",
"view",
",",
"array",
"$",
"params",
"=",
"[",
"]",
")",
":",
"string",
"{",
"$",
"template",
"=",
"null",
";",
"if",
"(",
"$",
"this",
"->",
"templating",
"->",
"exists",
"(",
"$",
"this",
"-... | {@inheritdoc} | [
"{"
] | train | https://github.com/vardius/list-bundle/blob/70d3079ce22eed7dad7c467fee532aa2f18c68c9/View/Renderer.php#L41-L68 |
faustbrian/Laravel-Countries | src/Console/Commands/SeedTimezones.php | SeedTimezones.handle | public function handle()
{
foreach ($this->getModel()->all() as $country) {
$timezones = DateTimeZone::listIdentifiers(DateTimeZone::PER_COUNTRY, $country->cca2);
foreach ($timezones as $timezone) {
$country->timezones()->create([
'name' ... | php | public function handle()
{
foreach ($this->getModel()->all() as $country) {
$timezones = DateTimeZone::listIdentifiers(DateTimeZone::PER_COUNTRY, $country->cca2);
foreach ($timezones as $timezone) {
$country->timezones()->create([
'name' ... | [
"public",
"function",
"handle",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"getModel",
"(",
")",
"->",
"all",
"(",
")",
"as",
"$",
"country",
")",
"{",
"$",
"timezones",
"=",
"DateTimeZone",
"::",
"listIdentifiers",
"(",
"DateTimeZone",
"::",
"P... | Execute the console command.
@return mixed | [
"Execute",
"the",
"console",
"command",
"."
] | train | https://github.com/faustbrian/Laravel-Countries/blob/3d72301acd37e7f351d9b991dba41807ab68362b/src/Console/Commands/SeedTimezones.php#L42-L58 |
faustbrian/Laravel-Countries | src/Console/Commands/SeedTimezones.php | SeedTimezones.offsetGmt | private function offsetGmt(string $timezone): string
{
$offset = $this->offsetSeconds($timezone);
$offset = gmdate('H:i', (int) $offset);
return 'GMT'.($offset < 0 ? $offset : '+'.$offset);
} | php | private function offsetGmt(string $timezone): string
{
$offset = $this->offsetSeconds($timezone);
$offset = gmdate('H:i', (int) $offset);
return 'GMT'.($offset < 0 ? $offset : '+'.$offset);
} | [
"private",
"function",
"offsetGmt",
"(",
"string",
"$",
"timezone",
")",
":",
"string",
"{",
"$",
"offset",
"=",
"$",
"this",
"->",
"offsetSeconds",
"(",
"$",
"timezone",
")",
";",
"$",
"offset",
"=",
"gmdate",
"(",
"'H:i'",
",",
"(",
"int",
")",
"$"... | [offsetGmt description].
@param string $timezone
@return string | [
"[",
"offsetGmt",
"description",
"]",
"."
] | train | https://github.com/faustbrian/Laravel-Countries/blob/3d72301acd37e7f351d9b991dba41807ab68362b/src/Console/Commands/SeedTimezones.php#L67-L73 |
faustbrian/Laravel-Countries | src/Console/Commands/SeedTimezones.php | SeedTimezones.offsetSeconds | private function offsetSeconds(string $timezone): float
{
$dtz = new DateTimeZone($timezone);
return $dtz->getOffset(new DateTime('now', $dtz));
} | php | private function offsetSeconds(string $timezone): float
{
$dtz = new DateTimeZone($timezone);
return $dtz->getOffset(new DateTime('now', $dtz));
} | [
"private",
"function",
"offsetSeconds",
"(",
"string",
"$",
"timezone",
")",
":",
"float",
"{",
"$",
"dtz",
"=",
"new",
"DateTimeZone",
"(",
"$",
"timezone",
")",
";",
"return",
"$",
"dtz",
"->",
"getOffset",
"(",
"new",
"DateTime",
"(",
"'now'",
",",
... | [offsetSeconds description].
@param string $timezone
@return int | [
"[",
"offsetSeconds",
"description",
"]",
"."
] | train | https://github.com/faustbrian/Laravel-Countries/blob/3d72301acd37e7f351d9b991dba41807ab68362b/src/Console/Commands/SeedTimezones.php#L94-L99 |
pageon/SlackWebhookMonolog | src/Slack/Channel.php | Channel.setName | private function setName($name)
{
// names should be lowercase so we just enforce this without further validation
$name = trim(mb_strtolower($name, 'UTF8'));
if (!preg_match('_^[#@][\w-]{1,21}$_', $name)) {
throw new InvalidChannelException(
'Channel names must b... | php | private function setName($name)
{
// names should be lowercase so we just enforce this without further validation
$name = trim(mb_strtolower($name, 'UTF8'));
if (!preg_match('_^[#@][\w-]{1,21}$_', $name)) {
throw new InvalidChannelException(
'Channel names must b... | [
"private",
"function",
"setName",
"(",
"$",
"name",
")",
"{",
"// names should be lowercase so we just enforce this without further validation",
"$",
"name",
"=",
"trim",
"(",
"mb_strtolower",
"(",
"$",
"name",
",",
"'UTF8'",
")",
")",
";",
"if",
"(",
"!",
"preg_m... | @param string $name
@return self | [
"@param",
"string",
"$name"
] | train | https://github.com/pageon/SlackWebhookMonolog/blob/6755060ddd6429620fd4c7decbb95f05463fc36b/src/Slack/Channel.php#L33-L48 |
FrenchFrogs/framework | src/Form/Renderer/Inline.php | Inline.hidden | public function hidden(Form\Element\Hidden $element)
{
$html = html('input', $element->getAttributes());
return $html;
} | php | public function hidden(Form\Element\Hidden $element)
{
$html = html('input', $element->getAttributes());
return $html;
} | [
"public",
"function",
"hidden",
"(",
"Form",
"\\",
"Element",
"\\",
"Hidden",
"$",
"element",
")",
"{",
"$",
"html",
"=",
"html",
"(",
"'input'",
",",
"$",
"element",
"->",
"getAttributes",
"(",
")",
")",
";",
"return",
"$",
"html",
";",
"}"
] | render hidden input
@param \FrenchFrogs\Form\Element\Hidden $element
@return string | [
"render",
"hidden",
"input"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Form/Renderer/Inline.php#L314-L318 |
FrenchFrogs/framework | src/Form/Renderer/Inline.php | Inline.label | public function label(Form\Element\Label $element)
{
$html = '<label class="col-md-3 control-label">' . $element->getLabel() . '</label>';
$html .= '<div class="col-md-9"><p class="form-control-static">' . $element->getValue() . '</p></div>';
$class = Style::FORM_GROUP_CLASS . ' row';
... | php | public function label(Form\Element\Label $element)
{
$html = '<label class="col-md-3 control-label">' . $element->getLabel() . '</label>';
$html .= '<div class="col-md-9"><p class="form-control-static">' . $element->getValue() . '</p></div>';
$class = Style::FORM_GROUP_CLASS . ' row';
... | [
"public",
"function",
"label",
"(",
"Form",
"\\",
"Element",
"\\",
"Label",
"$",
"element",
")",
"{",
"$",
"html",
"=",
"'<label class=\"col-md-3 control-label\">'",
".",
"$",
"element",
"->",
"getLabel",
"(",
")",
".",
"'</label>'",
";",
"$",
"html",
".=",
... | Render Label iunput
@param \FrenchFrogs\Form\Element\Label $element
@return string | [
"Render",
"Label",
"iunput"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Form/Renderer/Inline.php#L327-L334 |
FrenchFrogs/framework | src/Form/Renderer/Inline.php | Inline.label_date | public function label_date(Form\Element\LabelDate $element)
{
$html = '<label class="col-md-3 control-label">' . $element->getLabel() . '</label>';
$html .= '<div class="col-md-9"><p class="form-control-static">' . $element->getDisplayValue() . '</p></div>';
$class = Style::FORM_GROUP_CLAS... | php | public function label_date(Form\Element\LabelDate $element)
{
$html = '<label class="col-md-3 control-label">' . $element->getLabel() . '</label>';
$html .= '<div class="col-md-9"><p class="form-control-static">' . $element->getDisplayValue() . '</p></div>';
$class = Style::FORM_GROUP_CLAS... | [
"public",
"function",
"label_date",
"(",
"Form",
"\\",
"Element",
"\\",
"LabelDate",
"$",
"element",
")",
"{",
"$",
"html",
"=",
"'<label class=\"col-md-3 control-label\">'",
".",
"$",
"element",
"->",
"getLabel",
"(",
")",
".",
"'</label>'",
";",
"$",
"html",... | Render Label Date
@param \FrenchFrogs\Form\Element\LabelDate $element
@return string | [
"Render",
"Label",
"Date"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Form/Renderer/Inline.php#L342-L349 |
FrenchFrogs/framework | src/Form/Renderer/Inline.php | Inline.pre | public function pre(Form\Element\Pre $element)
{
$html = '<label class="col-md-3 control-label">' . $element->getLabel() . '</label>';
$html .= '<div class="col-md-9"><pre>' . $element->getValue() . '</pre></div>';
$class = Style::FORM_GROUP_CLASS . ' row';
return html('div', compa... | php | public function pre(Form\Element\Pre $element)
{
$html = '<label class="col-md-3 control-label">' . $element->getLabel() . '</label>';
$html .= '<div class="col-md-9"><pre>' . $element->getValue() . '</pre></div>';
$class = Style::FORM_GROUP_CLASS . ' row';
return html('div', compa... | [
"public",
"function",
"pre",
"(",
"Form",
"\\",
"Element",
"\\",
"Pre",
"$",
"element",
")",
"{",
"$",
"html",
"=",
"'<label class=\"col-md-3 control-label\">'",
".",
"$",
"element",
"->",
"getLabel",
"(",
")",
".",
"'</label>'",
";",
"$",
"html",
".=",
"'... | Render Label iunput
@param \FrenchFrogs\Form\Element\Label $element
@return string | [
"Render",
"Label",
"iunput"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Form/Renderer/Inline.php#L358-L365 |
FrenchFrogs/framework | src/Form/Renderer/Inline.php | Inline.image | public function image(Form\Element\Image $element)
{
$element->addStyle('object-fit', 'cover !important;');
$element->addAttribute('src', $element->getValue());
$html = '<label class="col-md-3 control-label">' . $element->getLabel() . '</label>';
$html .= '<div class="col-md-9"><p ... | php | public function image(Form\Element\Image $element)
{
$element->addStyle('object-fit', 'cover !important;');
$element->addAttribute('src', $element->getValue());
$html = '<label class="col-md-3 control-label">' . $element->getLabel() . '</label>';
$html .= '<div class="col-md-9"><p ... | [
"public",
"function",
"image",
"(",
"Form",
"\\",
"Element",
"\\",
"Image",
"$",
"element",
")",
"{",
"$",
"element",
"->",
"addStyle",
"(",
"'object-fit'",
",",
"'cover !important;'",
")",
";",
"$",
"element",
"->",
"addAttribute",
"(",
"'src'",
",",
"$",... | Render Image input
@param \FrenchFrogs\Form\Element\Label $element
@return string | [
"Render",
"Image",
"input"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Form/Renderer/Inline.php#L374-L385 |
FrenchFrogs/framework | src/Form/Renderer/Inline.php | Inline.button | public function button(Form\Element\Button $element)
{
//@todo prendre en compte les option et les size
$element->addClass('btn btn-default');
$element->addAttribute('id', $element->getName());
$html = '<div class="form-group">';
$html .= '<label class="col-md-3 control-lab... | php | public function button(Form\Element\Button $element)
{
//@todo prendre en compte les option et les size
$element->addClass('btn btn-default');
$element->addAttribute('id', $element->getName());
$html = '<div class="form-group">';
$html .= '<label class="col-md-3 control-lab... | [
"public",
"function",
"button",
"(",
"Form",
"\\",
"Element",
"\\",
"Button",
"$",
"element",
")",
"{",
"//@todo prendre en compte les option et les size",
"$",
"element",
"->",
"addClass",
"(",
"'btn btn-default'",
")",
";",
"$",
"element",
"->",
"addAttribute",
... | rende a button element
@param \FrenchFrogs\Form\Element\Button $element
@return string | [
"rende",
"a",
"button",
"element"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Form/Renderer/Inline.php#L410-L421 |
FrenchFrogs/framework | src/Form/Renderer/Inline.php | Inline.content | public function content(Form\Element\Content $element)
{
if ($element->isFullWith()) {
$html = '<div class="col-md-12">' . $element->getValue() . '</div>';
} else {
$html = '<label class="col-md-3 control-label">' . $element->getLabel() . '</label>';
$html .= '<d... | php | public function content(Form\Element\Content $element)
{
if ($element->isFullWith()) {
$html = '<div class="col-md-12">' . $element->getValue() . '</div>';
} else {
$html = '<label class="col-md-3 control-label">' . $element->getLabel() . '</label>';
$html .= '<d... | [
"public",
"function",
"content",
"(",
"Form",
"\\",
"Element",
"\\",
"Content",
"$",
"element",
")",
"{",
"if",
"(",
"$",
"element",
"->",
"isFullWith",
"(",
")",
")",
"{",
"$",
"html",
"=",
"'<div class=\"col-md-12\">'",
".",
"$",
"element",
"->",
"getV... | Render content
@param \FrenchFrogs\Form\Element\Content $element
@return string | [
"Render",
"content"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Form/Renderer/Inline.php#L446-L458 |
FrenchFrogs/framework | src/Form/Renderer/Inline.php | Inline.date_range | public function date_range(Form\Element\DateRange $element)
{
// CLASS
$class = Style::FORM_GROUP_CLASS;
// ERROR
if($hasError = !$element->getValidator()->isValid()){
if(empty($element->getAttribute('data-placement'))){$element->addAttribute('data-placement','bottom... | php | public function date_range(Form\Element\DateRange $element)
{
// CLASS
$class = Style::FORM_GROUP_CLASS;
// ERROR
if($hasError = !$element->getValidator()->isValid()){
if(empty($element->getAttribute('data-placement'))){$element->addAttribute('data-placement','bottom... | [
"public",
"function",
"date_range",
"(",
"Form",
"\\",
"Element",
"\\",
"DateRange",
"$",
"element",
")",
"{",
"// CLASS",
"$",
"class",
"=",
"Style",
"::",
"FORM_GROUP_CLASS",
";",
"// ERROR",
"if",
"(",
"$",
"hasError",
"=",
"!",
"$",
"element",
"->",
... | Render a date range element
@param Form\Element\DateRange $element | [
"Render",
"a",
"date",
"range",
"element"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Form/Renderer/Inline.php#L704-L746 |
WellCommerce/OrderBundle | DependencyInjection/Compiler/RegisterOrderVisitorPass.php | RegisterOrderVisitorPass.process | public function process(ContainerBuilder $container)
{
$tag = 'order.visitor';
$interface = OrderVisitorInterface::class;
$definition = $container->getDefinition('order.visitor.collection');
$visitors = [];
$hierarchies = $container->getParameter('order_visitor_... | php | public function process(ContainerBuilder $container)
{
$tag = 'order.visitor';
$interface = OrderVisitorInterface::class;
$definition = $container->getDefinition('order.visitor.collection');
$visitors = [];
$hierarchies = $container->getParameter('order_visitor_... | [
"public",
"function",
"process",
"(",
"ContainerBuilder",
"$",
"container",
")",
"{",
"$",
"tag",
"=",
"'order.visitor'",
";",
"$",
"interface",
"=",
"OrderVisitorInterface",
"::",
"class",
";",
"$",
"definition",
"=",
"$",
"container",
"->",
"getDefinition",
... | Processes the container
@param ContainerBuilder $container | [
"Processes",
"the",
"container"
] | train | https://github.com/WellCommerce/OrderBundle/blob/d72cfb51eab7a1f66f186900d1e2d533a822c424/DependencyInjection/Compiler/RegisterOrderVisitorPass.php#L32-L62 |
crossjoin/Css | src/Crossjoin/Css/Format/Rule/AtPage/PageRule.php | PageRule.addDeclaration | public function addDeclaration(DeclarationAbstract $declaration)
{
if ($declaration instanceof PageDeclaration) {
$this->declarations[] = $declaration;
} else {
throw new \InvalidArgumentException(
"Invalid declaration instance. Instance of 'PageDeclaration' e... | php | public function addDeclaration(DeclarationAbstract $declaration)
{
if ($declaration instanceof PageDeclaration) {
$this->declarations[] = $declaration;
} else {
throw new \InvalidArgumentException(
"Invalid declaration instance. Instance of 'PageDeclaration' e... | [
"public",
"function",
"addDeclaration",
"(",
"DeclarationAbstract",
"$",
"declaration",
")",
"{",
"if",
"(",
"$",
"declaration",
"instanceof",
"PageDeclaration",
")",
"{",
"$",
"this",
"->",
"declarations",
"[",
"]",
"=",
"$",
"declaration",
";",
"}",
"else",
... | Adds a declaration to the rule.
@param PageDeclaration $declaration
@return $this | [
"Adds",
"a",
"declaration",
"to",
"the",
"rule",
"."
] | train | https://github.com/crossjoin/Css/blob/7b50ca94c4bdad60d01cfa327f00b7a600d6f9f3/src/Crossjoin/Css/Format/Rule/AtPage/PageRule.php#L58-L69 |
crossjoin/Css | src/Crossjoin/Css/Format/Rule/AtPage/PageRule.php | PageRule.parseRuleString | protected function parseRuleString($ruleString)
{
// Remove at-rule name and unnecessary white-spaces
$ruleString = preg_replace('/^[ \r\n\t\f]*@page[ \r\n\t\f]*/i', '', $ruleString);
$ruleString = trim($ruleString, " \r\n\t\f");
// Extract query list and create a rule from it
... | php | protected function parseRuleString($ruleString)
{
// Remove at-rule name and unnecessary white-spaces
$ruleString = preg_replace('/^[ \r\n\t\f]*@page[ \r\n\t\f]*/i', '', $ruleString);
$ruleString = trim($ruleString, " \r\n\t\f");
// Extract query list and create a rule from it
... | [
"protected",
"function",
"parseRuleString",
"(",
"$",
"ruleString",
")",
"{",
"// Remove at-rule name and unnecessary white-spaces",
"$",
"ruleString",
"=",
"preg_replace",
"(",
"'/^[ \\r\\n\\t\\f]*@page[ \\r\\n\\t\\f]*/i'",
",",
"''",
",",
"$",
"ruleString",
")",
";",
"$... | Parses the page rule.
@param string $ruleString | [
"Parses",
"the",
"page",
"rule",
"."
] | train | https://github.com/crossjoin/Css/blob/7b50ca94c4bdad60d01cfa327f00b7a600d6f9f3/src/Crossjoin/Css/Format/Rule/AtPage/PageRule.php#L76-L85 |
JoffreyPoreeCoding/MongoDB-ODM | src/Factory/DocumentManagerFactory.php | DocumentManagerFactory.createDocumentManager | public function createDocumentManager($mongouri, $dbName, $debug = false, $managerId = "", $newConnection = false, $options = [])
{
if (!isset($this->connexions[$mongouri])) {
$client = new Client($mongouri);
}
if (!isset($this->managers[$managerId])) {
$database = ... | php | public function createDocumentManager($mongouri, $dbName, $debug = false, $managerId = "", $newConnection = false, $options = [])
{
if (!isset($this->connexions[$mongouri])) {
$client = new Client($mongouri);
}
if (!isset($this->managers[$managerId])) {
$database = ... | [
"public",
"function",
"createDocumentManager",
"(",
"$",
"mongouri",
",",
"$",
"dbName",
",",
"$",
"debug",
"=",
"false",
",",
"$",
"managerId",
"=",
"\"\"",
",",
"$",
"newConnection",
"=",
"false",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"if",
... | Create new DocumentManager from mongouri and DB name
@param string $mongouri mongodb uri (mongodb://user:pass@example.org/auth_db)
@param string $dbName name of the DB where to work
@param boolean $debug Enable debug mode or not
@param mi... | [
"Create",
"new",
"DocumentManager",
"from",
"mongouri",
"and",
"DB",
"name"
] | train | https://github.com/JoffreyPoreeCoding/MongoDB-ODM/blob/56fd7ab28c22f276573a89d56bb93c8d74ad7f74/src/Factory/DocumentManagerFactory.php#L62-L87 |
czim/laravel-pxlcms | src/Generator/Writer/Model/Steps/StubReplaceAttributeData.php | StubReplaceAttributeData.getFillableReplace | protected function getFillableReplace()
{
$attributes = array_merge(
$this->data['normal_fillable'],
$this->data['translated_fillable']
);
if ( ! count($attributes)) return '';
return $this->getAttributePropertySection('fillable', $attributes);
} | php | protected function getFillableReplace()
{
$attributes = array_merge(
$this->data['normal_fillable'],
$this->data['translated_fillable']
);
if ( ! count($attributes)) return '';
return $this->getAttributePropertySection('fillable', $attributes);
} | [
"protected",
"function",
"getFillableReplace",
"(",
")",
"{",
"$",
"attributes",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"data",
"[",
"'normal_fillable'",
"]",
",",
"$",
"this",
"->",
"data",
"[",
"'translated_fillable'",
"]",
")",
";",
"if",
"(",
"!",... | Returns the replacement for the fillable placeholder
@return string | [
"Returns",
"the",
"replacement",
"for",
"the",
"fillable",
"placeholder"
] | train | https://github.com/czim/laravel-pxlcms/blob/910297d2a3f2db86dde51b0e10fe5aad45f1aa1a/src/Generator/Writer/Model/Steps/StubReplaceAttributeData.php#L23-L33 |
czim/laravel-pxlcms | src/Generator/Writer/Model/Steps/StubReplaceAttributeData.php | StubReplaceAttributeData.getCastsReplace | protected function getCastsReplace()
{
$attributes = $this->data['casts'] ?: [];
if ( ! count($attributes)) return '';
// align assignment signs by longest attribute
$longestLength = 0;
foreach ($attributes as $attribute => $type) {
if (strlen($attribute) > $l... | php | protected function getCastsReplace()
{
$attributes = $this->data['casts'] ?: [];
if ( ! count($attributes)) return '';
// align assignment signs by longest attribute
$longestLength = 0;
foreach ($attributes as $attribute => $type) {
if (strlen($attribute) > $l... | [
"protected",
"function",
"getCastsReplace",
"(",
")",
"{",
"$",
"attributes",
"=",
"$",
"this",
"->",
"data",
"[",
"'casts'",
"]",
"?",
":",
"[",
"]",
";",
"if",
"(",
"!",
"count",
"(",
"$",
"attributes",
")",
")",
"return",
"''",
";",
"// align assi... | Returns the replacement for the casts placeholder
@return string | [
"Returns",
"the",
"replacement",
"for",
"the",
"casts",
"placeholder"
] | train | https://github.com/czim/laravel-pxlcms/blob/910297d2a3f2db86dde51b0e10fe5aad45f1aa1a/src/Generator/Writer/Model/Steps/StubReplaceAttributeData.php#L68-L96 |
czim/laravel-pxlcms | src/Generator/Writer/Model/Steps/StubReplaceAttributeData.php | StubReplaceAttributeData.getDefaultsReplace | protected function getDefaultsReplace()
{
if ( ! config('pxlcms.generator.models.include_defaults')) return '';
$attributes = $this->data['defaults'] ?: [];
if ( ! count($attributes)) return '';
// align assignment signs by longest attribute
$longestLength = 0;
fo... | php | protected function getDefaultsReplace()
{
if ( ! config('pxlcms.generator.models.include_defaults')) return '';
$attributes = $this->data['defaults'] ?: [];
if ( ! count($attributes)) return '';
// align assignment signs by longest attribute
$longestLength = 0;
fo... | [
"protected",
"function",
"getDefaultsReplace",
"(",
")",
"{",
"if",
"(",
"!",
"config",
"(",
"'pxlcms.generator.models.include_defaults'",
")",
")",
"return",
"''",
";",
"$",
"attributes",
"=",
"$",
"this",
"->",
"data",
"[",
"'defaults'",
"]",
"?",
":",
"["... | Returns the replacement for the default attributes placeholder
@return string | [
"Returns",
"the",
"replacement",
"for",
"the",
"default",
"attributes",
"placeholder"
] | train | https://github.com/czim/laravel-pxlcms/blob/910297d2a3f2db86dde51b0e10fe5aad45f1aa1a/src/Generator/Writer/Model/Steps/StubReplaceAttributeData.php#L117-L147 |
vardius/list-bundle | Paginator/Paginator.php | Paginator.render | public function render():string
{
return $this->templating->render($this->getTemplatePath() . 'paginator.html.twig', [
'currentPage' => $this->getCurrentPage(),
'previousPage' => $this->getPreviousPage(),
'lastPage' => $this->getLastPage(),
'nextPage' => $this... | php | public function render():string
{
return $this->templating->render($this->getTemplatePath() . 'paginator.html.twig', [
'currentPage' => $this->getCurrentPage(),
'previousPage' => $this->getPreviousPage(),
'lastPage' => $this->getLastPage(),
'nextPage' => $this... | [
"public",
"function",
"render",
"(",
")",
":",
"string",
"{",
"return",
"$",
"this",
"->",
"templating",
"->",
"render",
"(",
"$",
"this",
"->",
"getTemplatePath",
"(",
")",
".",
"'paginator.html.twig'",
",",
"[",
"'currentPage'",
"=>",
"$",
"this",
"->",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/vardius/list-bundle/blob/70d3079ce22eed7dad7c467fee532aa2f18c68c9/Paginator/Paginator.php#L36-L44 |
vardius/list-bundle | Paginator/Paginator.php | Paginator.getNextPage | public function getNextPage():float
{
return ($this->page < $this->getLastPage() ? $this->page + 1 : $this->page);
} | php | public function getNextPage():float
{
return ($this->page < $this->getLastPage() ? $this->page + 1 : $this->page);
} | [
"public",
"function",
"getNextPage",
"(",
")",
":",
"float",
"{",
"return",
"(",
"$",
"this",
"->",
"page",
"<",
"$",
"this",
"->",
"getLastPage",
"(",
")",
"?",
"$",
"this",
"->",
"page",
"+",
"1",
":",
"$",
"this",
"->",
"page",
")",
";",
"}"
] | {@inheritdoc} | [
"{"
] | train | https://github.com/vardius/list-bundle/blob/70d3079ce22eed7dad7c467fee532aa2f18c68c9/Paginator/Paginator.php#L73-L76 |
prooph/link-app-core | src/Service/RiotTagCollectionResolver.php | RiotTagCollectionResolver.resolve | public function resolve($name)
{
if (!isset($this->collections[$name])) {
return null;
}
if (!is_array($this->collections[$name])) {
throw new \RuntimeException(
"Collection with name $name is not an array."
);
}
$collecti... | php | public function resolve($name)
{
if (!isset($this->collections[$name])) {
return null;
}
if (!is_array($this->collections[$name])) {
throw new \RuntimeException(
"Collection with name $name is not an array."
);
}
$collecti... | [
"public",
"function",
"resolve",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"collections",
"[",
"$",
"name",
"]",
")",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"!",
"is_array",
"(",
"$",
"this",
"->",
"... | {@inheritDoc} | [
"{"
] | train | https://github.com/prooph/link-app-core/blob/835a5945dfa7be7b2cebfa6e84e757ecfd783357/src/Service/RiotTagCollectionResolver.php#L34-L76 |
okvpn/fixture-bundle | src/Entity/Repository/DataFixtureRepository.php | DataFixtureRepository.isDataFixtureExists | public function isDataFixtureExists($where, array $parameters = [])
{
$entityId = $this->createQueryBuilder('m')
->select('m.id')
->where($where)
->setMaxResults(1)
->getQuery()
->execute($parameters);
return $entityId ? true : false;
... | php | public function isDataFixtureExists($where, array $parameters = [])
{
$entityId = $this->createQueryBuilder('m')
->select('m.id')
->where($where)
->setMaxResults(1)
->getQuery()
->execute($parameters);
return $entityId ? true : false;
... | [
"public",
"function",
"isDataFixtureExists",
"(",
"$",
"where",
",",
"array",
"$",
"parameters",
"=",
"[",
"]",
")",
"{",
"$",
"entityId",
"=",
"$",
"this",
"->",
"createQueryBuilder",
"(",
"'m'",
")",
"->",
"select",
"(",
"'m.id'",
")",
"->",
"where",
... | @param string $where
@param array $parameters
@return bool | [
"@param",
"string",
"$where",
"@param",
"array",
"$parameters"
] | train | https://github.com/okvpn/fixture-bundle/blob/243b5e4dff9773e97fa447280e929c936a5d66ae/src/Entity/Repository/DataFixtureRepository.php#L26-L36 |
okvpn/fixture-bundle | src/Entity/Repository/DataFixtureRepository.php | DataFixtureRepository.updateDataFixutreHistory | public function updateDataFixutreHistory(array $updateFields, $where, array $parameters = [])
{
$qb = $this->_em
->createQueryBuilder()
->update('OkvpnFixtureBundle:DataFixture', 'm')
->where($where);
foreach ($updateFields as $fieldName => $fieldValue) {
... | php | public function updateDataFixutreHistory(array $updateFields, $where, array $parameters = [])
{
$qb = $this->_em
->createQueryBuilder()
->update('OkvpnFixtureBundle:DataFixture', 'm')
->where($where);
foreach ($updateFields as $fieldName => $fieldValue) {
... | [
"public",
"function",
"updateDataFixutreHistory",
"(",
"array",
"$",
"updateFields",
",",
"$",
"where",
",",
"array",
"$",
"parameters",
"=",
"[",
"]",
")",
"{",
"$",
"qb",
"=",
"$",
"this",
"->",
"_em",
"->",
"createQueryBuilder",
"(",
")",
"->",
"updat... | Update data fixture history
@param array $updateFields assoc array with field names and values that should be updated
@param string $where condition
@param array $parameters optional parameters for where condition | [
"Update",
"data",
"fixture",
"history"
] | train | https://github.com/okvpn/fixture-bundle/blob/243b5e4dff9773e97fa447280e929c936a5d66ae/src/Entity/Repository/DataFixtureRepository.php#L45-L56 |
Wonail/wocenter | behaviors/ModifyTimestampBehavior.php | ModifyTimestampBehavior.createRules | public function createRules(array $modelRules)
{
// 删除规则里有关时间日期字段的所有规则,由系统判断是否需要添加相应的规则。如需对时间日期字段添加其他规则,
// 可合并需要的规则到该方法调用后返回的数据结果里
foreach ($modelRules as $key => &$rule) {
if (is_array($rule[0])) {
foreach ($rule[0] as $k => $v) {
if (in_arra... | php | public function createRules(array $modelRules)
{
// 删除规则里有关时间日期字段的所有规则,由系统判断是否需要添加相应的规则。如需对时间日期字段添加其他规则,
// 可合并需要的规则到该方法调用后返回的数据结果里
foreach ($modelRules as $key => &$rule) {
if (is_array($rule[0])) {
foreach ($rule[0] as $k => $v) {
if (in_arra... | [
"public",
"function",
"createRules",
"(",
"array",
"$",
"modelRules",
")",
"{",
"// 删除规则里有关时间日期字段的所有规则,由系统判断是否需要添加相应的规则。如需对时间日期字段添加其他规则,",
"// 可合并需要的规则到该方法调用后返回的数据结果里",
"foreach",
"(",
"$",
"modelRules",
"as",
"$",
"key",
"=>",
"&",
"$",
"rule",
")",
"{",
"if",
"(",... | 创建验证规则
根据配置自动添加$this->createdAtAttribute和$this->updatedAtAttribute属性的验证规则,同时滤掉该行为的其他规则
@param array $modelRules 模型验证规则
@return array 验证规则 | [
"创建验证规则",
"根据配置自动添加$this",
"-",
">",
"createdAtAttribute和$this",
"-",
">",
"updatedAtAttribute属性的验证规则,同时滤掉该行为的其他规则"
] | train | https://github.com/Wonail/wocenter/blob/186c15aad008d32fbf5ad75256cf01581dccf9e6/behaviors/ModifyTimestampBehavior.php#L175-L220 |
Wonail/wocenter | behaviors/ModifyTimestampBehavior.php | ModifyTimestampBehavior.addRules | protected function addRules(&$rules, $attribute)
{
$displayData = $this->getDisplayFormat($attribute, true);
$saveData = $this->getSaveFormat($attribute, true);
// 添加`required`规则
$rules[] = [$attribute, 'required'];
switch ($this->dateTimeWidget) {
case '\wocenter... | php | protected function addRules(&$rules, $attribute)
{
$displayData = $this->getDisplayFormat($attribute, true);
$saveData = $this->getSaveFormat($attribute, true);
// 添加`required`规则
$rules[] = [$attribute, 'required'];
switch ($this->dateTimeWidget) {
case '\wocenter... | [
"protected",
"function",
"addRules",
"(",
"&",
"$",
"rules",
",",
"$",
"attribute",
")",
"{",
"$",
"displayData",
"=",
"$",
"this",
"->",
"getDisplayFormat",
"(",
"$",
"attribute",
",",
"true",
")",
";",
"$",
"saveData",
"=",
"$",
"this",
"->",
"getSav... | 添加规则
@param array $rules 规则数据
@param string $attribute 规则字段 | [
"添加规则"
] | train | https://github.com/Wonail/wocenter/blob/186c15aad008d32fbf5ad75256cf01581dccf9e6/behaviors/ModifyTimestampBehavior.php#L228-L271 |
Wonail/wocenter | behaviors/ModifyTimestampBehavior.php | ModifyTimestampBehavior.createScenarios | public function createScenarios(array $modelScenarios)
{
switch ($this->owner->getScenario()) {
case 'default':
// 默认场景下,只有允许自定义的时间日期字段才会被添加进场景数据里
foreach ([$this->createdAtAttribute, $this->updatedAtAttribute] as $attribute) {
if (
... | php | public function createScenarios(array $modelScenarios)
{
switch ($this->owner->getScenario()) {
case 'default':
// 默认场景下,只有允许自定义的时间日期字段才会被添加进场景数据里
foreach ([$this->createdAtAttribute, $this->updatedAtAttribute] as $attribute) {
if (
... | [
"public",
"function",
"createScenarios",
"(",
"array",
"$",
"modelScenarios",
")",
"{",
"switch",
"(",
"$",
"this",
"->",
"owner",
"->",
"getScenario",
"(",
")",
")",
"{",
"case",
"'default'",
":",
"// 默认场景下,只有允许自定义的时间日期字段才会被添加进场景数据里",
"foreach",
"(",
"[",
"$"... | 创建场景
根据配置自动添加$this->createdAtAttribute和$this->updatedAtAttribute属性字段,
场景里出现的字段会被验证和保存进数据库里
@param array $modelScenarios 模型场景
@return array | [
"创建场景",
"根据配置自动添加$this",
"-",
">",
"createdAtAttribute和$this",
"-",
">",
"updatedAtAttribute属性字段,",
"场景里出现的字段会被验证和保存进数据库里"
] | train | https://github.com/Wonail/wocenter/blob/186c15aad008d32fbf5ad75256cf01581dccf9e6/behaviors/ModifyTimestampBehavior.php#L282-L303 |
Wonail/wocenter | behaviors/ModifyTimestampBehavior.php | ModifyTimestampBehavior.getDisplayFormat | public function getDisplayFormat($attribute, $returnArray = false)
{
switch ($attribute) {
case $this->createdAtAttribute:
$type = $this->createdAtDisplayType;
$format = $this->createdAtDisplayFormat;
break;
case $this->updatedAtAttribu... | php | public function getDisplayFormat($attribute, $returnArray = false)
{
switch ($attribute) {
case $this->createdAtAttribute:
$type = $this->createdAtDisplayType;
$format = $this->createdAtDisplayFormat;
break;
case $this->updatedAtAttribu... | [
"public",
"function",
"getDisplayFormat",
"(",
"$",
"attribute",
",",
"$",
"returnArray",
"=",
"false",
")",
"{",
"switch",
"(",
"$",
"attribute",
")",
"{",
"case",
"$",
"this",
"->",
"createdAtAttribute",
":",
"$",
"type",
"=",
"$",
"this",
"->",
"creat... | 获取指定时间日期属性的显示格式,行为会按照以下序列获取相关值
- 1、如果`createdAtDisplayFormat`或`updatedAtDisplayFormat`属性已设置,该值被优先读取
- 2、如果`Yii::$app->params`已经配置了键名为`dateControlDisplay`的数据,该值被读取
- 3、以上均未设置,则根据[[$createdAtDisplayType]]或[[$updatedAtDisplayType]]属性从[[$_displayFormats]]数组里获取数据
@param string $attribute 时间日期属性
@param boolean $returnArray... | [
"获取指定时间日期属性的显示格式,行为会按照以下序列获取相关值"
] | train | https://github.com/Wonail/wocenter/blob/186c15aad008d32fbf5ad75256cf01581dccf9e6/behaviors/ModifyTimestampBehavior.php#L318-L349 |
Wonail/wocenter | behaviors/ModifyTimestampBehavior.php | ModifyTimestampBehavior.getSaveFormat | public function getSaveFormat($attribute, $returnArray = false)
{
switch ($attribute) {
case $this->createdAtAttribute:
$type = $this->createdAtDisplayType;
$format = $this->createdAtSaveFormat;
break;
case $this->updatedAtAttribute:
... | php | public function getSaveFormat($attribute, $returnArray = false)
{
switch ($attribute) {
case $this->createdAtAttribute:
$type = $this->createdAtDisplayType;
$format = $this->createdAtSaveFormat;
break;
case $this->updatedAtAttribute:
... | [
"public",
"function",
"getSaveFormat",
"(",
"$",
"attribute",
",",
"$",
"returnArray",
"=",
"false",
")",
"{",
"switch",
"(",
"$",
"attribute",
")",
"{",
"case",
"$",
"this",
"->",
"createdAtAttribute",
":",
"$",
"type",
"=",
"$",
"this",
"->",
"createdA... | 获取指定时间日期属性的保存格式,行为会按照以下序列获取相关值
- 1、如果`createdAtSaveFormat`或`updatedAtSaveFormat`属性已设置,该值被优先读取
- 2、如果`Yii::$app->params`已经配置了键名为`dateControlSave`的数据,该值被读取
- 3、以上均未设置,则根据[[$createdAtDisplayType]]或[[$updatedAtDisplayType]]属性从[[$_saveFormats]]数组里获取数据
@param string $attribute 时间日期属性
@param boolean $returnArray 是否返回数组格式的数据... | [
"获取指定时间日期属性的保存格式,行为会按照以下序列获取相关值"
] | train | https://github.com/Wonail/wocenter/blob/186c15aad008d32fbf5ad75256cf01581dccf9e6/behaviors/ModifyTimestampBehavior.php#L364-L396 |
Wonail/wocenter | behaviors/ModifyTimestampBehavior.php | ModifyTimestampBehavior.getDisplayTimeZone | public function getDisplayTimeZone()
{
if (empty($this->_displayTimeZone)) {
if (!empty(Yii::$app->params['dateControlDisplayTimezone'])) {
$this->_displayTimeZone = Yii::$app->params['dateControlDisplayTimezone'];
} else {
$this->_displayTimeZone = Yi... | php | public function getDisplayTimeZone()
{
if (empty($this->_displayTimeZone)) {
if (!empty(Yii::$app->params['dateControlDisplayTimezone'])) {
$this->_displayTimeZone = Yii::$app->params['dateControlDisplayTimezone'];
} else {
$this->_displayTimeZone = Yi... | [
"public",
"function",
"getDisplayTimeZone",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"_displayTimeZone",
")",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"Yii",
"::",
"$",
"app",
"->",
"params",
"[",
"'dateControlDisplayTimezone'",
"]",
")"... | DateControl 小部件会按此时区格式化显示时间日期
@return string | [
"DateControl",
"小部件会按此时区格式化显示时间日期"
] | train | https://github.com/Wonail/wocenter/blob/186c15aad008d32fbf5ad75256cf01581dccf9e6/behaviors/ModifyTimestampBehavior.php#L408-L419 |
Wonail/wocenter | behaviors/ModifyTimestampBehavior.php | ModifyTimestampBehavior.getSaveTimeZone | public function getSaveTimeZone()
{
if (empty($this->_saveTimeZone)) {
if (!empty(Yii::$app->params['dateControlSaveTimezone'])) {
$this->_saveTimeZone = Yii::$app->params['dateControlSaveTimezone'];
} else {
$this->_saveTimeZone = Yii::$app->getTimeZo... | php | public function getSaveTimeZone()
{
if (empty($this->_saveTimeZone)) {
if (!empty(Yii::$app->params['dateControlSaveTimezone'])) {
$this->_saveTimeZone = Yii::$app->params['dateControlSaveTimezone'];
} else {
$this->_saveTimeZone = Yii::$app->getTimeZo... | [
"public",
"function",
"getSaveTimeZone",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"_saveTimeZone",
")",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"Yii",
"::",
"$",
"app",
"->",
"params",
"[",
"'dateControlSaveTimezone'",
"]",
")",
")",
... | DateControl 小部件会按此时区保存时间日期
@return string | [
"DateControl",
"小部件会按此时区保存时间日期"
] | train | https://github.com/Wonail/wocenter/blob/186c15aad008d32fbf5ad75256cf01581dccf9e6/behaviors/ModifyTimestampBehavior.php#L439-L450 |
movoin/one-swoole | src/Swoole/Components/Timer/Scheduler.php | Scheduler.tick | public function tick(int $interval, Closure $callback, $parameters = null): int
{
return $this->getSwoole()->tick($interval, $callback, $parameters);
} | php | public function tick(int $interval, Closure $callback, $parameters = null): int
{
return $this->getSwoole()->tick($interval, $callback, $parameters);
} | [
"public",
"function",
"tick",
"(",
"int",
"$",
"interval",
",",
"Closure",
"$",
"callback",
",",
"$",
"parameters",
"=",
"null",
")",
":",
"int",
"{",
"return",
"$",
"this",
"->",
"getSwoole",
"(",
")",
"->",
"tick",
"(",
"$",
"interval",
",",
"$",
... | 添加定时执行器
@param int $interval
@param \Closure $callback
@param mixed $parameters
@return int | [
"添加定时执行器"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Swoole/Components/Timer/Scheduler.php#L29-L32 |
axelitus/php-base | src/DotArr.php | DotArr.is | public static function is(array $arr)
{
$isdot = true;
foreach ($arr as $key => $value) {
if (!($isdot = ($isdot && !Str::contains($key, '.')))) {
break;
}
if (is_array($value)) {
$isdot = ($isdot && static::is($value));
... | php | public static function is(array $arr)
{
$isdot = true;
foreach ($arr as $key => $value) {
if (!($isdot = ($isdot && !Str::contains($key, '.')))) {
break;
}
if (is_array($value)) {
$isdot = ($isdot && static::is($value));
... | [
"public",
"static",
"function",
"is",
"(",
"array",
"$",
"arr",
")",
"{",
"$",
"isdot",
"=",
"true",
";",
"foreach",
"(",
"$",
"arr",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"(",
"$",
"isdot",
"=",
"(",
"$",
"isdot",
"... | Tests if the given value is a dot-notated accessible array.
This function tests if none of the keys contains a dot.
@param array $arr The array to test.
@return bool Returns true if the array is dot-notated accessible, false otherwise.
@SuppressWarnings(PHPMD.ShortMethodName) | [
"Tests",
"if",
"the",
"given",
"value",
"is",
"a",
"dot",
"-",
"notated",
"accessible",
"array",
"."
] | train | https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/DotArr.php#L37-L50 |
axelitus/php-base | src/DotArr.php | DotArr.get | public static function get(array $arr, $key, $default = null)
{
if (is_array($key)) {
return static::getMultiple($arr, $key, $default);
}
if (!Int::is($key) && !Str::is($key)) {
throw new \InvalidArgumentException("The \$key parameter must be int or string (or an arr... | php | public static function get(array $arr, $key, $default = null)
{
if (is_array($key)) {
return static::getMultiple($arr, $key, $default);
}
if (!Int::is($key) && !Str::is($key)) {
throw new \InvalidArgumentException("The \$key parameter must be int or string (or an arr... | [
"public",
"static",
"function",
"get",
"(",
"array",
"$",
"arr",
",",
"$",
"key",
",",
"$",
"default",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"key",
")",
")",
"{",
"return",
"static",
"::",
"getMultiple",
"(",
"$",
"arr",
",",
"$... | Gets a value from a dot-notated array.
@param array $arr The array to get the value from.
@param int|string|array $key The key of the item's value to get or an array of keys.
@param mixed $default A default value to return if the item is not found.
@return mixed The value of the item if ... | [
"Gets",
"a",
"value",
"from",
"a",
"dot",
"-",
"notated",
"array",
"."
] | train | https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/DotArr.php#L66-L77 |
axelitus/php-base | src/DotArr.php | DotArr._get | protected static function _get(array $arr, $key, $default)
{
foreach (explode('.', $key) as $keySeg) {
if (!is_array($arr) || !array_key_exists($keySeg, $arr)) {
return $default;
}
$arr = $arr[$keySeg];
}
return $arr;
} | php | protected static function _get(array $arr, $key, $default)
{
foreach (explode('.', $key) as $keySeg) {
if (!is_array($arr) || !array_key_exists($keySeg, $arr)) {
return $default;
}
$arr = $arr[$keySeg];
}
return $arr;
} | [
"protected",
"static",
"function",
"_get",
"(",
"array",
"$",
"arr",
",",
"$",
"key",
",",
"$",
"default",
")",
"{",
"foreach",
"(",
"explode",
"(",
"'.'",
",",
"$",
"key",
")",
"as",
"$",
"keySeg",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",... | Gets a value from a dot-notated array.
@internal
@param array $arr The array to get the value from.
@param int|string|array $key The key of the item's value to get or an array of keys.
@param mixed $default A default value to return if the item is not found.
@return mixed The value of t... | [
"Gets",
"a",
"value",
"from",
"a",
"dot",
"-",
"notated",
"array",
"."
] | train | https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/DotArr.php#L90-L101 |
axelitus/php-base | src/DotArr.php | DotArr.getMultiple | protected static function getMultiple(array $arr, array $keys, $default = null)
{
$return = [];
foreach ($keys as $key) {
$return[$key] = static::get($arr, $key, $default);
}
return $return;
} | php | protected static function getMultiple(array $arr, array $keys, $default = null)
{
$return = [];
foreach ($keys as $key) {
$return[$key] = static::get($arr, $key, $default);
}
return $return;
} | [
"protected",
"static",
"function",
"getMultiple",
"(",
"array",
"$",
"arr",
",",
"array",
"$",
"keys",
",",
"$",
"default",
"=",
"null",
")",
"{",
"$",
"return",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"keys",
"as",
"$",
"key",
")",
"{",
"$",
"r... | Gets multiple values from a dot-notated array.
@internal
@param array $arr The array to get the values from.
@param array $keys The keys to the items to get the values from.
@param mixed $default A default value to return if the item is not found.
@return array The values of the found items or the default val... | [
"Gets",
"multiple",
"values",
"from",
"a",
"dot",
"-",
"notated",
"array",
"."
] | train | https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/DotArr.php#L114-L122 |
axelitus/php-base | src/DotArr.php | DotArr.set | public static function set(array &$arr, $key, $value = null)
{
if (is_array($key)) {
static::setMultiple($arr, $key);
return;
}
if (!Int::is($key) && !Str::is($key)) {
throw new \InvalidArgumentException("The \$key parameter must be int or string (or an ... | php | public static function set(array &$arr, $key, $value = null)
{
if (is_array($key)) {
static::setMultiple($arr, $key);
return;
}
if (!Int::is($key) && !Str::is($key)) {
throw new \InvalidArgumentException("The \$key parameter must be int or string (or an ... | [
"public",
"static",
"function",
"set",
"(",
"array",
"&",
"$",
"arr",
",",
"$",
"key",
",",
"$",
"value",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"key",
")",
")",
"{",
"static",
"::",
"setMultiple",
"(",
"$",
"arr",
",",
"$",
"k... | Sets a value into a dot-notated array.
@param array $arr The array to set the value to.
@param int|string|array $key The key of the item to be set or an array of key=>value pairs.
@param mixed $value The value to be set to the item.
@throws \InvalidArgumentException | [
"Sets",
"a",
"value",
"into",
"a",
"dot",
"-",
"notated",
"array",
"."
] | train | https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/DotArr.php#L133-L146 |
axelitus/php-base | src/DotArr.php | DotArr._set | protected static function _set(array &$arr, $key, $value = null)
{
$keys = explode('.', $key);
while (count($keys) > 1) {
$key = array_shift($keys);
if (!isset($arr[$key]) || !is_array($arr[$key])) {
$arr[$key] = [];
}
$arr =& $arr[$ke... | php | protected static function _set(array &$arr, $key, $value = null)
{
$keys = explode('.', $key);
while (count($keys) > 1) {
$key = array_shift($keys);
if (!isset($arr[$key]) || !is_array($arr[$key])) {
$arr[$key] = [];
}
$arr =& $arr[$ke... | [
"protected",
"static",
"function",
"_set",
"(",
"array",
"&",
"$",
"arr",
",",
"$",
"key",
",",
"$",
"value",
"=",
"null",
")",
"{",
"$",
"keys",
"=",
"explode",
"(",
"'.'",
",",
"$",
"key",
")",
";",
"while",
"(",
"count",
"(",
"$",
"keys",
")... | Sets a value into a dot-notated array.
@internal
@param array $arr The array to set the value to.
@param int|string|array $key The key of the item to be set or an array of key=>value pairs.
@param mixed $value The value to be set to the item. | [
"Sets",
"a",
"value",
"into",
"a",
"dot",
"-",
"notated",
"array",
"."
] | train | https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/DotArr.php#L157-L170 |
axelitus/php-base | src/DotArr.php | DotArr.setMultiple | protected static function setMultiple(array &$arr, array $keyvals)
{
foreach ($keyvals as $key => $value) {
static::set($arr, $key, $value);
}
} | php | protected static function setMultiple(array &$arr, array $keyvals)
{
foreach ($keyvals as $key => $value) {
static::set($arr, $key, $value);
}
} | [
"protected",
"static",
"function",
"setMultiple",
"(",
"array",
"&",
"$",
"arr",
",",
"array",
"$",
"keyvals",
")",
"{",
"foreach",
"(",
"$",
"keyvals",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"static",
"::",
"set",
"(",
"$",
"arr",
",",
"$... | Sets multiple values to a dot-notated array.
@internal
@param array $arr The array to set the values to.
@param array $keyvals The key=>value associative array to set the item values. | [
"Sets",
"multiple",
"values",
"to",
"a",
"dot",
"-",
"notated",
"array",
"."
] | train | https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/DotArr.php#L180-L185 |
axelitus/php-base | src/DotArr.php | DotArr.delete | public static function delete(array &$arr, $key)
{
if (is_array($key)) {
return static::deleteMultiple($arr, $key);
}
if (!Int::is($key) && !Str::is($key)) {
throw new \InvalidArgumentException("The \$key parameter must be int or string (or an array of them).");
... | php | public static function delete(array &$arr, $key)
{
if (is_array($key)) {
return static::deleteMultiple($arr, $key);
}
if (!Int::is($key) && !Str::is($key)) {
throw new \InvalidArgumentException("The \$key parameter must be int or string (or an array of them).");
... | [
"public",
"static",
"function",
"delete",
"(",
"array",
"&",
"$",
"arr",
",",
"$",
"key",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"key",
")",
")",
"{",
"return",
"static",
"::",
"deleteMultiple",
"(",
"$",
"arr",
",",
"$",
"key",
")",
";",
"}"... | Deletes an item from a dot-notated array.
@param array $arr The dot-notated array.
@param int|string|array $key The key of the item to delete or array of keys.
@return bool|array Returns true if the item was found and deleted, false otherwise (or an array of results).
@throws \InvalidArgumentException | [
"Deletes",
"an",
"item",
"from",
"a",
"dot",
"-",
"notated",
"array",
"."
] | train | https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/DotArr.php#L196-L207 |
axelitus/php-base | src/DotArr.php | DotArr._delete | protected static function _delete(array &$arr, $key)
{
// TODO: optimize this chunk of code if possible
$tmp =& $arr;
$keys = explode('.', $key);
while (count($keys) > 1) {
$key = array_shift($keys);
if (!is_array($tmp[$key])) {
return false;
... | php | protected static function _delete(array &$arr, $key)
{
// TODO: optimize this chunk of code if possible
$tmp =& $arr;
$keys = explode('.', $key);
while (count($keys) > 1) {
$key = array_shift($keys);
if (!is_array($tmp[$key])) {
return false;
... | [
"protected",
"static",
"function",
"_delete",
"(",
"array",
"&",
"$",
"arr",
",",
"$",
"key",
")",
"{",
"// TODO: optimize this chunk of code if possible",
"$",
"tmp",
"=",
"&",
"$",
"arr",
";",
"$",
"keys",
"=",
"explode",
"(",
"'.'",
",",
"$",
"key",
"... | Deletes an item from a dot-notated array.
@internal
@param array $arr The dot-notated array.
@param int|string|array $key The key of the item to delete or array of keys.
@return bool|array Returns true if the item was found and deleted, false otherwise (or an array of results). | [
"Deletes",
"an",
"item",
"from",
"a",
"dot",
"-",
"notated",
"array",
"."
] | train | https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/DotArr.php#L219-L242 |
axelitus/php-base | src/DotArr.php | DotArr.deleteMultiple | protected static function deleteMultiple(array &$arr, array $keys)
{
$return = [];
foreach ($keys as $key) {
$return[$key] = static::delete($arr, $key);
}
return $return;
} | php | protected static function deleteMultiple(array &$arr, array $keys)
{
$return = [];
foreach ($keys as $key) {
$return[$key] = static::delete($arr, $key);
}
return $return;
} | [
"protected",
"static",
"function",
"deleteMultiple",
"(",
"array",
"&",
"$",
"arr",
",",
"array",
"$",
"keys",
")",
"{",
"$",
"return",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"keys",
"as",
"$",
"key",
")",
"{",
"$",
"return",
"[",
"$",
"key",
"... | Deletes multiple items from a dot-notated array.
@internal
@param array $arr The array to delete the items from.
@param array $keys The keys of the items to delete.
@return array Returns an array of results. | [
"Deletes",
"multiple",
"items",
"from",
"a",
"dot",
"-",
"notated",
"array",
"."
] | train | https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/DotArr.php#L254-L262 |
axelitus/php-base | src/DotArr.php | DotArr.keyExists | public static function keyExists(array $arr, $key)
{
if (is_array($key)) {
return static::keyExistsMultiple($arr, $key);
}
if (!Int::is($key) && !Str::is($key)) {
throw new \InvalidArgumentException("The \$key parameter must be int or string (or an array of them).");... | php | public static function keyExists(array $arr, $key)
{
if (is_array($key)) {
return static::keyExistsMultiple($arr, $key);
}
if (!Int::is($key) && !Str::is($key)) {
throw new \InvalidArgumentException("The \$key parameter must be int or string (or an array of them).");... | [
"public",
"static",
"function",
"keyExists",
"(",
"array",
"$",
"arr",
",",
"$",
"key",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"key",
")",
")",
"{",
"return",
"static",
"::",
"keyExistsMultiple",
"(",
"$",
"arr",
",",
"$",
"key",
")",
";",
"}",... | Verifies if an item with the given key exists in a dot-notated array or not.
@param array $arr The dot-notated array.
@param int|string|array $key The key of the item to check for or an array of keys.
@return bool|array Returns true if the item exists, false otherwise (or an array of results).
@throws \Inv... | [
"Verifies",
"if",
"an",
"item",
"with",
"the",
"given",
"key",
"exists",
"in",
"a",
"dot",
"-",
"notated",
"array",
"or",
"not",
"."
] | train | https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/DotArr.php#L277-L288 |
axelitus/php-base | src/DotArr.php | DotArr._keyExists | protected static function _keyExists(array $arr, $key)
{
if (array_key_exists($key, $arr)) {
return true;
}
foreach (explode('.', $key) as $keySeg) {
if (!is_array($arr) || !array_key_exists($keySeg, $arr)) {
return false;
}
$... | php | protected static function _keyExists(array $arr, $key)
{
if (array_key_exists($key, $arr)) {
return true;
}
foreach (explode('.', $key) as $keySeg) {
if (!is_array($arr) || !array_key_exists($keySeg, $arr)) {
return false;
}
$... | [
"protected",
"static",
"function",
"_keyExists",
"(",
"array",
"$",
"arr",
",",
"$",
"key",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"arr",
")",
")",
"{",
"return",
"true",
";",
"}",
"foreach",
"(",
"explode",
"(",
"'.'",
... | Verifies if an item with the given key exists in a dot-notated array or not.
@internal
@param array $arr The dot-notated array.
@param int|string|array $key The key of the item to check for or an array of keys.
@return bool|array Returns true if the item exists, false otherwise (or an array of results). | [
"Verifies",
"if",
"an",
"item",
"with",
"the",
"given",
"key",
"exists",
"in",
"a",
"dot",
"-",
"notated",
"array",
"or",
"not",
"."
] | train | https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/DotArr.php#L300-L315 |
axelitus/php-base | src/DotArr.php | DotArr.keyExistsMultiple | protected static function keyExistsMultiple(array $arr, array $keys)
{
$return = [];
foreach ($keys as $key) {
$return[$key] = static::keyExists($arr, $key);
}
return $return;
} | php | protected static function keyExistsMultiple(array $arr, array $keys)
{
$return = [];
foreach ($keys as $key) {
$return[$key] = static::keyExists($arr, $key);
}
return $return;
} | [
"protected",
"static",
"function",
"keyExistsMultiple",
"(",
"array",
"$",
"arr",
",",
"array",
"$",
"keys",
")",
"{",
"$",
"return",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"keys",
"as",
"$",
"key",
")",
"{",
"$",
"return",
"[",
"$",
"key",
"]",
... | Verifies if multiple keys exists in a dot-notated array or not.
@param array $arr The dot-notated array.
@param array $keys The keys to verify.
@return array The array of results. | [
"Verifies",
"if",
"multiple",
"keys",
"exists",
"in",
"a",
"dot",
"-",
"notated",
"array",
"or",
"not",
"."
] | train | https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/DotArr.php#L325-L333 |
axelitus/php-base | src/DotArr.php | DotArr.keyMatches | public static function keyMatches(array $arr, $key)
{
if (is_array($key)) {
return static::keyMatchesMultiple($arr, $key);
}
if (!Int::is($key) && !Str::is($key)) {
throw new \InvalidArgumentException("The \$key parameter must be int or string (or an array of them)."... | php | public static function keyMatches(array $arr, $key)
{
if (is_array($key)) {
return static::keyMatchesMultiple($arr, $key);
}
if (!Int::is($key) && !Str::is($key)) {
throw new \InvalidArgumentException("The \$key parameter must be int or string (or an array of them)."... | [
"public",
"static",
"function",
"keyMatches",
"(",
"array",
"$",
"arr",
",",
"$",
"key",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"key",
")",
")",
"{",
"return",
"static",
"::",
"keyMatchesMultiple",
"(",
"$",
"arr",
",",
"$",
"key",
")",
";",
"}... | Gets full and partial matches to the given key.
The function matches each key sub level to a partial match.
@param array $arr The array to match the key to.
@param int|string|array $key The key to be matched or an array of keys.
@return array The array of full and partial matches.
@throws \InvalidArgument... | [
"Gets",
"full",
"and",
"partial",
"matches",
"to",
"the",
"given",
"key",
"."
] | train | https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/DotArr.php#L346-L357 |
axelitus/php-base | src/DotArr.php | DotArr._keyMatches | public static function _keyMatches(array $arr, $key)
{
$match = '';
$return = [];
foreach (explode('.', $key) as $k) {
if (!is_array($arr) || !array_key_exists($k, $arr)) {
return $return;
}
$match .= (($match != '') ? '.' : '') . $k;
... | php | public static function _keyMatches(array $arr, $key)
{
$match = '';
$return = [];
foreach (explode('.', $key) as $k) {
if (!is_array($arr) || !array_key_exists($k, $arr)) {
return $return;
}
$match .= (($match != '') ? '.' : '') . $k;
... | [
"public",
"static",
"function",
"_keyMatches",
"(",
"array",
"$",
"arr",
",",
"$",
"key",
")",
"{",
"$",
"match",
"=",
"''",
";",
"$",
"return",
"=",
"[",
"]",
";",
"foreach",
"(",
"explode",
"(",
"'.'",
",",
"$",
"key",
")",
"as",
"$",
"k",
")... | Gets full and partial matches to the given key.
The function matches each key sub level to a partial match.
@internal
@param array $arr The array to match the key to.
@param int|string|array $key The key to be matched or an array of keys.
@return array The array of full and partial matches. | [
"Gets",
"full",
"and",
"partial",
"matches",
"to",
"the",
"given",
"key",
"."
] | train | https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/DotArr.php#L371-L386 |
axelitus/php-base | src/DotArr.php | DotArr.keyMatchesMultiple | protected static function keyMatchesMultiple(array $arr, array $keys)
{
$return = [];
foreach ($keys as $key) {
$return[$key] = static::keyMatches($arr, $key);
}
return $return;
} | php | protected static function keyMatchesMultiple(array $arr, array $keys)
{
$return = [];
foreach ($keys as $key) {
$return[$key] = static::keyMatches($arr, $key);
}
return $return;
} | [
"protected",
"static",
"function",
"keyMatchesMultiple",
"(",
"array",
"$",
"arr",
",",
"array",
"$",
"keys",
")",
"{",
"$",
"return",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"keys",
"as",
"$",
"key",
")",
"{",
"$",
"return",
"[",
"$",
"key",
"]",... | Gets full and partial matches to multiple keys.
@param array $arr The array to match the keys to.
@param array $keys The keys to be matched.
@return array The array of ful and partial matches of the given keys. | [
"Gets",
"full",
"and",
"partial",
"matches",
"to",
"multiple",
"keys",
"."
] | train | https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/DotArr.php#L396-L404 |
axelitus/php-base | src/DotArr.php | DotArr.convert | public static function convert(array $arr)
{
$converted = [];
foreach ($arr as $key => $value) {
$keys = explode('.', $key);
$tmp =& $converted;
foreach ($keys as $k) {
if (!array_key_exists($k, $tmp) || !is_array($tmp[$k])) {
$... | php | public static function convert(array $arr)
{
$converted = [];
foreach ($arr as $key => $value) {
$keys = explode('.', $key);
$tmp =& $converted;
foreach ($keys as $k) {
if (!array_key_exists($k, $tmp) || !is_array($tmp[$k])) {
$... | [
"public",
"static",
"function",
"convert",
"(",
"array",
"$",
"arr",
")",
"{",
"$",
"converted",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"arr",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"keys",
"=",
"explode",
"(",
"'.'",
",",
"$",
... | Converts an array to a dot-notated array.
Be aware that some values may be lost in this conversion if a partial key match is found
twice or more. The last found element of a partial key match is the one that takes precedence.
@param array $arr The array to convert.
@return array The converted array. | [
"Converts",
"an",
"array",
"to",
"a",
"dot",
"-",
"notated",
"array",
"."
] | train | https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/DotArr.php#L420-L438 |
phramework/validate | src/ArrayValidator.php | ArrayValidator.validate | public function validate($value)
{
$return = new ValidateResult($value, false);
if (!is_array($value)) {
$return->errorObject = 'properties validation';
//error
$return->errorObject = new IncorrectParametersException([
[
'type'... | php | public function validate($value)
{
$return = new ValidateResult($value, false);
if (!is_array($value)) {
$return->errorObject = 'properties validation';
//error
$return->errorObject = new IncorrectParametersException([
[
'type'... | [
"public",
"function",
"validate",
"(",
"$",
"value",
")",
"{",
"$",
"return",
"=",
"new",
"ValidateResult",
"(",
"$",
"value",
",",
"false",
")",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
"value",
")",
")",
"{",
"$",
"return",
"->",
"errorObject",
... | Validate value
@see \Phramework\Validate\ValidateResult for ValidateResult object
@param mixed $value Value to validate
@return ValidateResult
@todo incomplete | [
"Validate",
"value"
] | train | https://github.com/phramework/validate/blob/22dd3c4e5f7a77a1a75d92f98444f3e4b7ce5cfc/src/ArrayValidator.php#L108-L196 |
acasademont/wurfl | WURFL/UserAgentHandlerChainFactory.php | WURFL_UserAgentHandlerChainFactory.createFrom | public static function createFrom(WURFL_Context $context)
{
$cached_data = $context->cacheProvider->load('UserAgentHandlerChain');
if ($cached_data !== null) {
self::$_userAgentHandlerChain = $cached_data;
foreach (self::$_userAgentHandlerChain->getHandlers() as $handler) {
... | php | public static function createFrom(WURFL_Context $context)
{
$cached_data = $context->cacheProvider->load('UserAgentHandlerChain');
if ($cached_data !== null) {
self::$_userAgentHandlerChain = $cached_data;
foreach (self::$_userAgentHandlerChain->getHandlers() as $handler) {
... | [
"public",
"static",
"function",
"createFrom",
"(",
"WURFL_Context",
"$",
"context",
")",
"{",
"$",
"cached_data",
"=",
"$",
"context",
"->",
"cacheProvider",
"->",
"load",
"(",
"'UserAgentHandlerChain'",
")",
";",
"if",
"(",
"$",
"cached_data",
"!==",
"null",
... | Create a WURFL_UserAgentHandlerChain from the given $context
@param WURFL_Context $context
@return WURFL_UserAgentHandlerChain | [
"Create",
"a",
"WURFL_UserAgentHandlerChain",
"from",
"the",
"given",
"$context"
] | train | https://github.com/acasademont/wurfl/blob/0f4fb6e06b452ba95ad1d15e7d8226d0974b60c2/WURFL/UserAgentHandlerChainFactory.php#L35-L49 |
acasademont/wurfl | WURFL/UserAgentHandlerChainFactory.php | WURFL_UserAgentHandlerChainFactory.createGenericNormalizers | public static function createGenericNormalizers()
{
return new WURFL_Request_UserAgentNormalizer(array(
new WURFL_Request_UserAgentNormalizer_Generic_UCWEB(),
new WURFL_Request_UserAgentNormalizer_Generic_UPLink(),
new WURFL_Request_UserAgentNormalizer_Generic_SerialNumbe... | php | public static function createGenericNormalizers()
{
return new WURFL_Request_UserAgentNormalizer(array(
new WURFL_Request_UserAgentNormalizer_Generic_UCWEB(),
new WURFL_Request_UserAgentNormalizer_Generic_UPLink(),
new WURFL_Request_UserAgentNormalizer_Generic_SerialNumbe... | [
"public",
"static",
"function",
"createGenericNormalizers",
"(",
")",
"{",
"return",
"new",
"WURFL_Request_UserAgentNormalizer",
"(",
"array",
"(",
"new",
"WURFL_Request_UserAgentNormalizer_Generic_UCWEB",
"(",
")",
",",
"new",
"WURFL_Request_UserAgentNormalizer_Generic_UPLink"... | Returns a User Agent Normalizer chain containing all generic normalizers
@return WURFL_Request_UserAgentNormalizer | [
"Returns",
"a",
"User",
"Agent",
"Normalizer",
"chain",
"containing",
"all",
"generic",
"normalizers"
] | train | https://github.com/acasademont/wurfl/blob/0f4fb6e06b452ba95ad1d15e7d8226d0974b60c2/WURFL/UserAgentHandlerChainFactory.php#L189-L204 |
activecollab/databasestructure | src/Builder/Builder.php | Builder.registerEventHandler | public function registerEventHandler($event, callable $handler)
{
if (empty($event)) {
throw new InvalidArgumentException('Event name is required');
}
if (is_callable($handler)) {
if (empty($this->event_handlers[$event])) {
$this->event_handlers[$even... | php | public function registerEventHandler($event, callable $handler)
{
if (empty($event)) {
throw new InvalidArgumentException('Event name is required');
}
if (is_callable($handler)) {
if (empty($this->event_handlers[$event])) {
$this->event_handlers[$even... | [
"public",
"function",
"registerEventHandler",
"(",
"$",
"event",
",",
"callable",
"$",
"handler",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"event",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'Event name is required'",
")",
";",
"}",
"if"... | Register an internal event handler.
@param string $event
@param callable $handler | [
"Register",
"an",
"internal",
"event",
"handler",
"."
] | train | https://github.com/activecollab/databasestructure/blob/4b2353c4422186bcfce63b3212da3e70e63eb5df/src/Builder/Builder.php#L80-L95 |
esperecyan/dictionary-php | src/serializer/GenericDictionarySerializer.php | GenericDictionarySerializer.getColumnPosition | protected function getColumnPosition(string $fieldName): int
{
$position = array_search($fieldName, self::COLUMN_POSITIONS, true);
return is_int($position) ? $position : PHP_INT_MAX;
} | php | protected function getColumnPosition(string $fieldName): int
{
$position = array_search($fieldName, self::COLUMN_POSITIONS, true);
return is_int($position) ? $position : PHP_INT_MAX;
} | [
"protected",
"function",
"getColumnPosition",
"(",
"string",
"$",
"fieldName",
")",
":",
"int",
"{",
"$",
"position",
"=",
"array_search",
"(",
"$",
"fieldName",
",",
"self",
"::",
"COLUMN_POSITIONS",
",",
"true",
")",
";",
"return",
"is_int",
"(",
"$",
"p... | 列の位置の比較に使うインデックスを返します。
@param string $fieldName
@return int | [
"列の位置の比較に使うインデックスを返します。"
] | train | https://github.com/esperecyan/dictionary-php/blob/14fad08fb43006995c763094e8e7ed0dc0e26676/src/serializer/GenericDictionarySerializer.php#L34-L38 |
esperecyan/dictionary-php | src/serializer/GenericDictionarySerializer.php | GenericDictionarySerializer.getFieldNames | protected function getFieldNames(Dictionary $dictionary): array
{
// 各フィールド名について、全レコード中の最大数をそれぞれ取得
foreach ($dictionary->getWords() as $word) {
foreach ($word as $fieldName => $fields) {
$fieldLengths[$fieldName] = max(count($fields), $fieldLengths[$fieldName] ?? 0);
... | php | protected function getFieldNames(Dictionary $dictionary): array
{
// 各フィールド名について、全レコード中の最大数をそれぞれ取得
foreach ($dictionary->getWords() as $word) {
foreach ($word as $fieldName => $fields) {
$fieldLengths[$fieldName] = max(count($fields), $fieldLengths[$fieldName] ?? 0);
... | [
"protected",
"function",
"getFieldNames",
"(",
"Dictionary",
"$",
"dictionary",
")",
":",
"array",
"{",
"// 各フィールド名について、全レコード中の最大数をそれぞれ取得",
"foreach",
"(",
"$",
"dictionary",
"->",
"getWords",
"(",
")",
"as",
"$",
"word",
")",
"{",
"foreach",
"(",
"$",
"word",... | ヘッダ行に用いるフィールド名の一覧を生成します。
@param Dictionary $dictionary
@return string[] | [
"ヘッダ行に用いるフィールド名の一覧を生成します。"
] | train | https://github.com/esperecyan/dictionary-php/blob/14fad08fb43006995c763094e8e7ed0dc0e26676/src/serializer/GenericDictionarySerializer.php#L45-L64 |
esperecyan/dictionary-php | src/serializer/GenericDictionarySerializer.php | GenericDictionarySerializer.putCSVRecord | protected function putCSVRecord(\SplFileObject $file, array $fields)
{
$file->fputcsv(array_map(function (string $field): string {
return preg_replace(
'/[\\x00-\\x09\\x11\\x7F]+/u',
'',
strtr($field, ["\r\n" => "\r\n", "\r" => "\r\n", "\n" => "\r\... | php | protected function putCSVRecord(\SplFileObject $file, array $fields)
{
$file->fputcsv(array_map(function (string $field): string {
return preg_replace(
'/[\\x00-\\x09\\x11\\x7F]+/u',
'',
strtr($field, ["\r\n" => "\r\n", "\r" => "\r\n", "\n" => "\r\... | [
"protected",
"function",
"putCSVRecord",
"(",
"\\",
"SplFileObject",
"$",
"file",
",",
"array",
"$",
"fields",
")",
"{",
"$",
"file",
"->",
"fputcsv",
"(",
"array_map",
"(",
"function",
"(",
"string",
"$",
"field",
")",
":",
"string",
"{",
"return",
"pre... | フィールドの配列をCSVの行として書き出します。
@param \SplFileObject $file
@param string[] $fields | [
"フィールドの配列をCSVの行として書き出します。"
] | train | https://github.com/esperecyan/dictionary-php/blob/14fad08fb43006995c763094e8e7ed0dc0e26676/src/serializer/GenericDictionarySerializer.php#L71-L82 |
esperecyan/dictionary-php | src/serializer/GenericDictionarySerializer.php | GenericDictionarySerializer.convertWordToRecord | protected function convertWordToRecord(array $word, array $fieldNames, array $metadata, array $filenames): array
{
$numberValidator = new NumberValidator();
$output = [];
foreach ($fieldNames as $fieldName) {
$field = isset($word[$fieldName][0])
? array_shift($wor... | php | protected function convertWordToRecord(array $word, array $fieldNames, array $metadata, array $filenames): array
{
$numberValidator = new NumberValidator();
$output = [];
foreach ($fieldNames as $fieldName) {
$field = isset($word[$fieldName][0])
? array_shift($wor... | [
"protected",
"function",
"convertWordToRecord",
"(",
"array",
"$",
"word",
",",
"array",
"$",
"fieldNames",
",",
"array",
"$",
"metadata",
",",
"array",
"$",
"filenames",
")",
":",
"array",
"{",
"$",
"numberValidator",
"=",
"new",
"NumberValidator",
"(",
")"... | 一つのお題を表す配列を、CSVのレコードに変換します。
@param (string|string[]|float)[][] $word
@param string[] $fieldNames
@param (string|string[])[] $metadata
@param string[] $filenames
@return string[] | [
"一つのお題を表す配列を、CSVのレコードに変換します。"
] | train | https://github.com/esperecyan/dictionary-php/blob/14fad08fb43006995c763094e8e7ed0dc0e26676/src/serializer/GenericDictionarySerializer.php#L92-L129 |
esperecyan/dictionary-php | src/serializer/GenericDictionarySerializer.php | GenericDictionarySerializer.getAsCSVFile | protected function getAsCSVFile(Dictionary $dictionary): \SplTempFileObject
{
$fieldNames = $this->getFieldNames($dictionary);
$csv = new \SplTempFileObject();
$this->putCSVRecord($csv, $fieldNames);
foreach ($dictionary->getWords() as $i => $word) {
$this->putCSVRecord($... | php | protected function getAsCSVFile(Dictionary $dictionary): \SplTempFileObject
{
$fieldNames = $this->getFieldNames($dictionary);
$csv = new \SplTempFileObject();
$this->putCSVRecord($csv, $fieldNames);
foreach ($dictionary->getWords() as $i => $word) {
$this->putCSVRecord($... | [
"protected",
"function",
"getAsCSVFile",
"(",
"Dictionary",
"$",
"dictionary",
")",
":",
"\\",
"SplTempFileObject",
"{",
"$",
"fieldNames",
"=",
"$",
"this",
"->",
"getFieldNames",
"(",
"$",
"dictionary",
")",
";",
"$",
"csv",
"=",
"new",
"\\",
"SplTempFileO... | 辞書をCSVファイルとして取得します。
@param Dictionary $dictionary
@return \SplTempFileObject | [
"辞書をCSVファイルとして取得します。"
] | train | https://github.com/esperecyan/dictionary-php/blob/14fad08fb43006995c763094e8e7ed0dc0e26676/src/serializer/GenericDictionarySerializer.php#L136-L151 |
jamband/ripple | src/Utility.php | Utility.domain | private static function domain(string $url): ?string
{
$domain = parse_url($url, PHP_URL_HOST);
if (null !== $domain) {
return implode('.', array_slice(explode('.', $domain), -2));
}
return null;
} | php | private static function domain(string $url): ?string
{
$domain = parse_url($url, PHP_URL_HOST);
if (null !== $domain) {
return implode('.', array_slice(explode('.', $domain), -2));
}
return null;
} | [
"private",
"static",
"function",
"domain",
"(",
"string",
"$",
"url",
")",
":",
"?",
"string",
"{",
"$",
"domain",
"=",
"parse_url",
"(",
"$",
"url",
",",
"PHP_URL_HOST",
")",
";",
"if",
"(",
"null",
"!==",
"$",
"domain",
")",
"{",
"return",
"implode... | Returns the domain name from URL.
@param string $url
@return null|string | [
"Returns",
"the",
"domain",
"name",
"from",
"URL",
"."
] | train | https://github.com/jamband/ripple/blob/91443f8016af76cacf749e05633abc1bdaf4675f/src/Utility.php#L28-L37 |
movoin/one-swoole | src/Middleware/Manager.php | Manager.matchRequest | public function matchRequest(Request $request)
{
$this->reset();
$groups = Arr::get($this->config, 'group', []);
$matchs = Arr::get($this->config, 'match', []);
// 全局中间件
if (isset($matchs['*'])) {
$wildcards = is_string($matchs['*']) ? (array) $matchs['*'] : $ma... | php | public function matchRequest(Request $request)
{
$this->reset();
$groups = Arr::get($this->config, 'group', []);
$matchs = Arr::get($this->config, 'match', []);
// 全局中间件
if (isset($matchs['*'])) {
$wildcards = is_string($matchs['*']) ? (array) $matchs['*'] : $ma... | [
"public",
"function",
"matchRequest",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"this",
"->",
"reset",
"(",
")",
";",
"$",
"groups",
"=",
"Arr",
"::",
"get",
"(",
"$",
"this",
"->",
"config",
",",
"'group'",
",",
"[",
"]",
")",
";",
"$",
"ma... | 获得指定请求对象的中间件管理对象
@param \One\Protocol\Contracts\Request $request
@throws \One\Middleware\Exceptions\MiddlewareException | [
"获得指定请求对象的中间件管理对象"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Middleware/Manager.php#L67-L106 |
movoin/one-swoole | src/Middleware/Manager.php | Manager.executeFilters | public function executeFilters(Request $request, Response $response)
{
$middlewares = $this->filterMiddleware(Filter::class);
foreach ($middlewares as $middleware) {
if (($returnResponse = $middleware->doFilter($request, $response)) !== null) {
return $returnResponse;
... | php | public function executeFilters(Request $request, Response $response)
{
$middlewares = $this->filterMiddleware(Filter::class);
foreach ($middlewares as $middleware) {
if (($returnResponse = $middleware->doFilter($request, $response)) !== null) {
return $returnResponse;
... | [
"public",
"function",
"executeFilters",
"(",
"Request",
"$",
"request",
",",
"Response",
"$",
"response",
")",
"{",
"$",
"middlewares",
"=",
"$",
"this",
"->",
"filterMiddleware",
"(",
"Filter",
"::",
"class",
")",
";",
"foreach",
"(",
"$",
"middlewares",
... | 执行匹配的过滤器
@param \One\Protocol\Contracts\Request $request
@param \One\Protocol\Contracts\Response $response
@return \One\Protocol\Contracts\Response|null | [
"执行匹配的过滤器"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Middleware/Manager.php#L116-L128 |
movoin/one-swoole | src/Middleware/Manager.php | Manager.executeInterceptors | public function executeInterceptors(Request $request, Response $response)
{
$middlewares = $this->filterMiddleware(Interceptor::class);
foreach ($middlewares as $middleware) {
list(
$request,
$response
) = $middleware->doIntercept($request, $r... | php | public function executeInterceptors(Request $request, Response $response)
{
$middlewares = $this->filterMiddleware(Interceptor::class);
foreach ($middlewares as $middleware) {
list(
$request,
$response
) = $middleware->doIntercept($request, $r... | [
"public",
"function",
"executeInterceptors",
"(",
"Request",
"$",
"request",
",",
"Response",
"$",
"response",
")",
"{",
"$",
"middlewares",
"=",
"$",
"this",
"->",
"filterMiddleware",
"(",
"Interceptor",
"::",
"class",
")",
";",
"foreach",
"(",
"$",
"middle... | 执行匹配的拦截器
@param \One\Protocol\Contracts\Request $request
@param \One\Protocol\Contracts\Response $response
@return [\One\Protocol\Contracts\Request, \One\Protocol\Contracts\Response] | [
"执行匹配的拦截器"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Middleware/Manager.php#L138-L152 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.