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 |
|---|---|---|---|---|---|---|---|---|---|---|
lukebro/flash | src/lukebro/Flash/FlashFactory.php | FlashFactory.again | public function again()
{
$this->next = $this->current->map(function ($item) {
return $item->toArray();
})->merge($this->next)->toArray();
$this->session->keep([$this->key]);
} | php | public function again()
{
$this->next = $this->current->map(function ($item) {
return $item->toArray();
})->merge($this->next)->toArray();
$this->session->keep([$this->key]);
} | [
"public",
"function",
"again",
"(",
")",
"{",
"$",
"this",
"->",
"next",
"=",
"$",
"this",
"->",
"current",
"->",
"map",
"(",
"function",
"(",
"$",
"item",
")",
"{",
"return",
"$",
"item",
"->",
"toArray",
"(",
")",
";",
"}",
")",
"->",
"merge",
... | Reflash message to next session.
@return void | [
"Reflash",
"message",
"to",
"next",
"session",
"."
] | train | https://github.com/lukebro/flash/blob/5cecd16e6fe399cd8a222084f4f50fc813110ef9/src/lukebro/Flash/FlashFactory.php#L92-L99 |
lukebro/flash | src/lukebro/Flash/FlashFactory.php | FlashFactory.get | public function get($level = null)
{
if (isset($level)) {
return $this->getMessage();
}
return $this->current->where('level', $level);
} | php | public function get($level = null)
{
if (isset($level)) {
return $this->getMessage();
}
return $this->current->where('level', $level);
} | [
"public",
"function",
"get",
"(",
"$",
"level",
"=",
"null",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"level",
")",
")",
"{",
"return",
"$",
"this",
"->",
"getMessage",
"(",
")",
";",
"}",
"return",
"$",
"this",
"->",
"current",
"->",
"where",
"("... | Get the current flash message.
@return string | [
"Get",
"the",
"current",
"flash",
"message",
"."
] | train | https://github.com/lukebro/flash/blob/5cecd16e6fe399cd8a222084f4f50fc813110ef9/src/lukebro/Flash/FlashFactory.php#L126-L133 |
lukebro/flash | src/lukebro/Flash/FlashFactory.php | FlashFactory.getFromSession | private function getFromSession()
{
if ($this->exists()) {
$flashes = $this->session->get($this->key);
foreach ($flashes as $flash) {
$this->current->push(new Flash($flash['level'], $flash['message']));
}
}
} | php | private function getFromSession()
{
if ($this->exists()) {
$flashes = $this->session->get($this->key);
foreach ($flashes as $flash) {
$this->current->push(new Flash($flash['level'], $flash['message']));
}
}
} | [
"private",
"function",
"getFromSession",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"exists",
"(",
")",
")",
"{",
"$",
"flashes",
"=",
"$",
"this",
"->",
"session",
"->",
"get",
"(",
"$",
"this",
"->",
"key",
")",
";",
"foreach",
"(",
"$",
"fla... | Get current flash message from session.
@return void | [
"Get",
"current",
"flash",
"message",
"from",
"session",
"."
] | train | https://github.com/lukebro/flash/blob/5cecd16e6fe399cd8a222084f4f50fc813110ef9/src/lukebro/Flash/FlashFactory.php#L189-L198 |
PandaPlatform/framework | src/Panda/Routing/Router.php | Router.all | public function all($uri, $action = null)
{
$verbs = ['GET', 'HEAD', 'POST', 'PUT', 'PATCH', 'DELETE'];
return $this->addRoute($verbs, $uri, $action);
} | php | public function all($uri, $action = null)
{
$verbs = ['GET', 'HEAD', 'POST', 'PUT', 'PATCH', 'DELETE'];
return $this->addRoute($verbs, $uri, $action);
} | [
"public",
"function",
"all",
"(",
"$",
"uri",
",",
"$",
"action",
"=",
"null",
")",
"{",
"$",
"verbs",
"=",
"[",
"'GET'",
",",
"'HEAD'",
",",
"'POST'",
",",
"'PUT'",
",",
"'PATCH'",
",",
"'DELETE'",
"]",
";",
"return",
"$",
"this",
"->",
"addRoute"... | Register a new route responding to all verbs.
@param string $uri
@param Closure|array|string|null $action
@return Route | [
"Register",
"a",
"new",
"route",
"responding",
"to",
"all",
"verbs",
"."
] | train | https://github.com/PandaPlatform/framework/blob/a78cf051b379896b5a4d5df620988e37a0e632f5/src/Panda/Routing/Router.php#L151-L156 |
PandaPlatform/framework | src/Panda/Routing/Router.php | Router.any | public function any($methods, $uri, $action = null)
{
return $this->addRoute(array_map('strtoupper', (array)$methods), $uri, $action);
} | php | public function any($methods, $uri, $action = null)
{
return $this->addRoute(array_map('strtoupper', (array)$methods), $uri, $action);
} | [
"public",
"function",
"any",
"(",
"$",
"methods",
",",
"$",
"uri",
",",
"$",
"action",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"addRoute",
"(",
"array_map",
"(",
"'strtoupper'",
",",
"(",
"array",
")",
"$",
"methods",
")",
",",
"$",
"ur... | Register a new route with the given verbs.
@param array $methods
@param string $uri
@param Closure|array|string|null $action
@return Route | [
"Register",
"a",
"new",
"route",
"with",
"the",
"given",
"verbs",
"."
] | train | https://github.com/PandaPlatform/framework/blob/a78cf051b379896b5a4d5df620988e37a0e632f5/src/Panda/Routing/Router.php#L167-L170 |
PandaPlatform/framework | src/Panda/Routing/Router.php | Router.createRoute | protected function createRoute($methods, $uri, $action)
{
// Transform an action controller to a Closure action
if ($this->isActionController($action)) {
$action = $this->convertToControllerAction($action);
}
// Create new route
$route = $this->newRoute(
... | php | protected function createRoute($methods, $uri, $action)
{
// Transform an action controller to a Closure action
if ($this->isActionController($action)) {
$action = $this->convertToControllerAction($action);
}
// Create new route
$route = $this->newRoute(
... | [
"protected",
"function",
"createRoute",
"(",
"$",
"methods",
",",
"$",
"uri",
",",
"$",
"action",
")",
"{",
"// Transform an action controller to a Closure action",
"if",
"(",
"$",
"this",
"->",
"isActionController",
"(",
"$",
"action",
")",
")",
"{",
"$",
"ac... | Create a new route instance.
@param array|string $methods
@param string $uri
@param mixed $action
@return Route | [
"Create",
"a",
"new",
"route",
"instance",
"."
] | train | https://github.com/PandaPlatform/framework/blob/a78cf051b379896b5a4d5df620988e37a0e632f5/src/Panda/Routing/Router.php#L195-L208 |
PandaPlatform/framework | src/Panda/Routing/Router.php | Router.isActionController | protected function isActionController($action)
{
if ($action instanceof Closure) {
return false;
}
return is_string($action) || is_string(isset($action['uses']) ? $action['uses'] : null);
} | php | protected function isActionController($action)
{
if ($action instanceof Closure) {
return false;
}
return is_string($action) || is_string(isset($action['uses']) ? $action['uses'] : null);
} | [
"protected",
"function",
"isActionController",
"(",
"$",
"action",
")",
"{",
"if",
"(",
"$",
"action",
"instanceof",
"Closure",
")",
"{",
"return",
"false",
";",
"}",
"return",
"is_string",
"(",
"$",
"action",
")",
"||",
"is_string",
"(",
"isset",
"(",
"... | Determine if the action is routing to a controller.
@param array $action
@return bool | [
"Determine",
"if",
"the",
"action",
"is",
"routing",
"to",
"a",
"controller",
"."
] | train | https://github.com/PandaPlatform/framework/blob/a78cf051b379896b5a4d5df620988e37a0e632f5/src/Panda/Routing/Router.php#L217-L224 |
PandaPlatform/framework | src/Panda/Routing/Router.php | Router.dispatchToRoute | public function dispatchToRoute(Request $request)
{
// Find the route that matches the given request
$route = $this->getMatchingRoute($request);
// Get response from the routeΙ
$response = $this->runRoute($route, $request);
return $this->prepareResponse($request, $response)... | php | public function dispatchToRoute(Request $request)
{
// Find the route that matches the given request
$route = $this->getMatchingRoute($request);
// Get response from the routeΙ
$response = $this->runRoute($route, $request);
return $this->prepareResponse($request, $response)... | [
"public",
"function",
"dispatchToRoute",
"(",
"Request",
"$",
"request",
")",
"{",
"// Find the route that matches the given request",
"$",
"route",
"=",
"$",
"this",
"->",
"getMatchingRoute",
"(",
"$",
"request",
")",
";",
"// Get response from the routeΙ",
"$",
"res... | Dispatch the request to a route and return the response.
@param Request $request
@return mixed
@throws \DI\DependencyException
@throws \DI\NotFoundException
@throws \InvalidArgumentException
@throws \LogicException
@throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
@throws \UnexpectedValueException | [
"Dispatch",
"the",
"request",
"to",
"a",
"route",
"and",
"return",
"the",
"response",
"."
] | train | https://github.com/PandaPlatform/framework/blob/a78cf051b379896b5a4d5df620988e37a0e632f5/src/Panda/Routing/Router.php#L294-L303 |
PandaPlatform/framework | src/Panda/Routing/Router.php | Router.getMatchingRoute | public function getMatchingRoute($request)
{
// Get matching route
$this->currentRoute = $route = $this->routes->match($request);
return $route;
} | php | public function getMatchingRoute($request)
{
// Get matching route
$this->currentRoute = $route = $this->routes->match($request);
return $route;
} | [
"public",
"function",
"getMatchingRoute",
"(",
"$",
"request",
")",
"{",
"// Get matching route",
"$",
"this",
"->",
"currentRoute",
"=",
"$",
"route",
"=",
"$",
"this",
"->",
"routes",
"->",
"match",
"(",
"$",
"request",
")",
";",
"return",
"$",
"route",
... | Find the route matching a given request.
@param Request $request
@return Route
@throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
@throws \UnexpectedValueException
@throws \LogicException | [
"Find",
"the",
"route",
"matching",
"a",
"given",
"request",
"."
] | train | https://github.com/PandaPlatform/framework/blob/a78cf051b379896b5a4d5df620988e37a0e632f5/src/Panda/Routing/Router.php#L350-L356 |
PandaPlatform/framework | src/Panda/Routing/Router.php | Router.gatherRoutes | protected function gatherRoutes()
{
// Get the base route path
$basePath = $this->container->get('app.base_path');
$routesPath = $this->container->get('app.routes_path');
// Include the route file
include $basePath . DIRECTORY_SEPARATOR . $routesPath;
} | php | protected function gatherRoutes()
{
// Get the base route path
$basePath = $this->container->get('app.base_path');
$routesPath = $this->container->get('app.routes_path');
// Include the route file
include $basePath . DIRECTORY_SEPARATOR . $routesPath;
} | [
"protected",
"function",
"gatherRoutes",
"(",
")",
"{",
"// Get the base route path",
"$",
"basePath",
"=",
"$",
"this",
"->",
"container",
"->",
"get",
"(",
"'app.base_path'",
")",
";",
"$",
"routesPath",
"=",
"$",
"this",
"->",
"container",
"->",
"get",
"(... | Get all the routes that match to the given request.
@throws \DI\DependencyException
@throws \DI\NotFoundException
@throws \InvalidArgumentException | [
"Get",
"all",
"the",
"routes",
"that",
"match",
"to",
"the",
"given",
"request",
"."
] | train | https://github.com/PandaPlatform/framework/blob/a78cf051b379896b5a4d5df620988e37a0e632f5/src/Panda/Routing/Router.php#L402-L410 |
markwatkinson/luminous | src/Luminous/Formatters/HtmlFormatter.php | HtmlFormatter.template | private static function template($t, $vars = array())
{
$t = preg_replace_callback('/\s+|<[^>]++>/', array('self', 'templateCb'), $t);
array_unshift($vars, $t);
$code = call_user_func_array('sprintf', $vars);
return $code;
} | php | private static function template($t, $vars = array())
{
$t = preg_replace_callback('/\s+|<[^>]++>/', array('self', 'templateCb'), $t);
array_unshift($vars, $t);
$code = call_user_func_array('sprintf', $vars);
return $code;
} | [
"private",
"static",
"function",
"template",
"(",
"$",
"t",
",",
"$",
"vars",
"=",
"array",
"(",
")",
")",
"{",
"$",
"t",
"=",
"preg_replace_callback",
"(",
"'/\\s+|<[^>]++>/'",
",",
"array",
"(",
"'self'",
",",
"'templateCb'",
")",
",",
"$",
"t",
")",... | strips out unnecessary whitespace from a template | [
"strips",
"out",
"unnecessary",
"whitespace",
"from",
"a",
"template"
] | train | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Formatters/HtmlFormatter.php#L41-L47 |
markwatkinson/luminous | src/Luminous/Formatters/HtmlFormatter.php | HtmlFormatter.linkifyCb | protected function linkifyCb($matches)
{
$uri = (isset($matches[1]) && strlen(trim($matches[1]))) ? $matches[0] : "http://" . $matches[0];
// we dont want to link if it would cause malformed HTML
$openTags = array();
$closeTags = array();
preg_match_all("/<(?!\/)([^\s>]*).*?... | php | protected function linkifyCb($matches)
{
$uri = (isset($matches[1]) && strlen(trim($matches[1]))) ? $matches[0] : "http://" . $matches[0];
// we dont want to link if it would cause malformed HTML
$openTags = array();
$closeTags = array();
preg_match_all("/<(?!\/)([^\s>]*).*?... | [
"protected",
"function",
"linkifyCb",
"(",
"$",
"matches",
")",
"{",
"$",
"uri",
"=",
"(",
"isset",
"(",
"$",
"matches",
"[",
"1",
"]",
")",
"&&",
"strlen",
"(",
"trim",
"(",
"$",
"matches",
"[",
"1",
"]",
")",
")",
")",
"?",
"$",
"matches",
"[... | Detects and links URLs - callback | [
"Detects",
"and",
"links",
"URLs",
"-",
"callback"
] | train | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Formatters/HtmlFormatter.php#L114-L135 |
markwatkinson/luminous | src/Luminous/Formatters/HtmlFormatter.php | HtmlFormatter.linkify | protected function linkify($src)
{
if (stripos($src, "http") === false && stripos($src, "www") === false) {
return $src;
}
$chars = "0-9a-zA-Z\$\-_\.+!\*,%";
$src_ = $src;
// everyone stand back, I know regular expressions
$src = preg_replace_callback(
... | php | protected function linkify($src)
{
if (stripos($src, "http") === false && stripos($src, "www") === false) {
return $src;
}
$chars = "0-9a-zA-Z\$\-_\.+!\*,%";
$src_ = $src;
// everyone stand back, I know regular expressions
$src = preg_replace_callback(
... | [
"protected",
"function",
"linkify",
"(",
"$",
"src",
")",
"{",
"if",
"(",
"stripos",
"(",
"$",
"src",
",",
"\"http\"",
")",
"===",
"false",
"&&",
"stripos",
"(",
"$",
"src",
",",
"\"www\"",
")",
"===",
"false",
")",
"{",
"return",
"$",
"src",
";",
... | Detects and links URLs | [
"Detects",
"and",
"links",
"URLs"
] | train | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Formatters/HtmlFormatter.php#L140-L169 |
wpup/digster | src/token-parsers/class-trans.php | Trans.parse | public function parse(Twig_Token $token)
{
$lineno = $token->getLine();
$stream = $this->parser->getStream();
$count = null;
$plural = null;
$notes = null;
if (!$stream->test(Twig_Token::BLOCK_END_TYPE)) {
$body = $this->parser->getExpressionParser()->par... | php | public function parse(Twig_Token $token)
{
$lineno = $token->getLine();
$stream = $this->parser->getStream();
$count = null;
$plural = null;
$notes = null;
if (!$stream->test(Twig_Token::BLOCK_END_TYPE)) {
$body = $this->parser->getExpressionParser()->par... | [
"public",
"function",
"parse",
"(",
"Twig_Token",
"$",
"token",
")",
"{",
"$",
"lineno",
"=",
"$",
"token",
"->",
"getLine",
"(",
")",
";",
"$",
"stream",
"=",
"$",
"this",
"->",
"parser",
"->",
"getStream",
"(",
")",
";",
"$",
"count",
"=",
"null"... | Parses a token and returns a node.
@param Twig_Token $token A Twig_Token instance
@return Twig_Node A Twig_Node instance | [
"Parses",
"a",
"token",
"and",
"returns",
"a",
"node",
"."
] | train | https://github.com/wpup/digster/blob/9ef9626ce82673af698bc0976d6c38a532e4a6d9/src/token-parsers/class-trans.php#L42-L77 |
granulephp/util | lib/Map/MutableArrayMap.php | MutableArrayMap.forEachApply | public function forEachApply(callable $callback): void {
foreach ($this->elements as $key => $value) {
$callback($value, $key);
}
} | php | public function forEachApply(callable $callback): void {
foreach ($this->elements as $key => $value) {
$callback($value, $key);
}
} | [
"public",
"function",
"forEachApply",
"(",
"callable",
"$",
"callback",
")",
":",
"void",
"{",
"foreach",
"(",
"$",
"this",
"->",
"elements",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"callback",
"(",
"$",
"value",
",",
"$",
"key",
")",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/granulephp/util/blob/8dcac627fbf9cf5e4219b6dec8ba8ad7c0a3186e/lib/Map/MutableArrayMap.php#L37-L41 |
granulephp/util | lib/Map/MutableArrayMap.php | MutableArrayMap.put | public function put($key, $value) {
TypeHelper::validateKey($key, $this);
TypeHelper::validateValue($value, $this);
$oldValue = null;
if ($this->containsKey($key)) {
$oldValue = $this->get($key);
}
$this->elements[$key] = $value;
return $oldValue;
... | php | public function put($key, $value) {
TypeHelper::validateKey($key, $this);
TypeHelper::validateValue($value, $this);
$oldValue = null;
if ($this->containsKey($key)) {
$oldValue = $this->get($key);
}
$this->elements[$key] = $value;
return $oldValue;
... | [
"public",
"function",
"put",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"TypeHelper",
"::",
"validateKey",
"(",
"$",
"key",
",",
"$",
"this",
")",
";",
"TypeHelper",
"::",
"validateValue",
"(",
"$",
"value",
",",
"$",
"this",
")",
";",
"$",
"old... | {@inheritdoc} | [
"{"
] | train | https://github.com/granulephp/util/blob/8dcac627fbf9cf5e4219b6dec8ba8ad7c0a3186e/lib/Map/MutableArrayMap.php#L44-L54 |
granulephp/util | lib/Map/MutableArrayMap.php | MutableArrayMap.putAll | public function putAll(Map $map): void {
foreach ($map as $key => $value) {
$this->put($key, $value);
}
} | php | public function putAll(Map $map): void {
foreach ($map as $key => $value) {
$this->put($key, $value);
}
} | [
"public",
"function",
"putAll",
"(",
"Map",
"$",
"map",
")",
":",
"void",
"{",
"foreach",
"(",
"$",
"map",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"put",
"(",
"$",
"key",
",",
"$",
"value",
")",
";",
"}",
"}"
] | {@inheritdoc} | [
"{"
] | train | https://github.com/granulephp/util/blob/8dcac627fbf9cf5e4219b6dec8ba8ad7c0a3186e/lib/Map/MutableArrayMap.php#L57-L61 |
granulephp/util | lib/Map/MutableArrayMap.php | MutableArrayMap.putIfAbsent | public function putIfAbsent($key, $value): void {
if (!$this->containsKey($key)) {
$this->put($key, $value);
}
} | php | public function putIfAbsent($key, $value): void {
if (!$this->containsKey($key)) {
$this->put($key, $value);
}
} | [
"public",
"function",
"putIfAbsent",
"(",
"$",
"key",
",",
"$",
"value",
")",
":",
"void",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"containsKey",
"(",
"$",
"key",
")",
")",
"{",
"$",
"this",
"->",
"put",
"(",
"$",
"key",
",",
"$",
"value",
")",... | {@inheritdoc} | [
"{"
] | train | https://github.com/granulephp/util/blob/8dcac627fbf9cf5e4219b6dec8ba8ad7c0a3186e/lib/Map/MutableArrayMap.php#L64-L68 |
granulephp/util | lib/Map/MutableArrayMap.php | MutableArrayMap.remove | public function remove($key) {
$value = $this->get($key);
if ($value !== null) {
unset($this->elements[$key]);
}
return $value;
} | php | public function remove($key) {
$value = $this->get($key);
if ($value !== null) {
unset($this->elements[$key]);
}
return $value;
} | [
"public",
"function",
"remove",
"(",
"$",
"key",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"get",
"(",
"$",
"key",
")",
";",
"if",
"(",
"$",
"value",
"!==",
"null",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"elements",
"[",
"$",
"key",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/granulephp/util/blob/8dcac627fbf9cf5e4219b6dec8ba8ad7c0a3186e/lib/Map/MutableArrayMap.php#L71-L78 |
granulephp/util | lib/Map/MutableArrayMap.php | MutableArrayMap.removeIfEqual | public function removeIfEqual($key, $value): bool {
$actualValue = $this->get($key);
if ($actualValue === $value) {
unset($this->elements[$key]);
return true;
}
return false;
} | php | public function removeIfEqual($key, $value): bool {
$actualValue = $this->get($key);
if ($actualValue === $value) {
unset($this->elements[$key]);
return true;
}
return false;
} | [
"public",
"function",
"removeIfEqual",
"(",
"$",
"key",
",",
"$",
"value",
")",
":",
"bool",
"{",
"$",
"actualValue",
"=",
"$",
"this",
"->",
"get",
"(",
"$",
"key",
")",
";",
"if",
"(",
"$",
"actualValue",
"===",
"$",
"value",
")",
"{",
"unset",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/granulephp/util/blob/8dcac627fbf9cf5e4219b6dec8ba8ad7c0a3186e/lib/Map/MutableArrayMap.php#L81-L90 |
granulephp/util | lib/Map/MutableArrayMap.php | MutableArrayMap.replace | public function replace($key, $value) {
if ($this->containsKey($key)) {
return $this->put($key, $value);
} else {
return null;
}
} | php | public function replace($key, $value) {
if ($this->containsKey($key)) {
return $this->put($key, $value);
} else {
return null;
}
} | [
"public",
"function",
"replace",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"containsKey",
"(",
"$",
"key",
")",
")",
"{",
"return",
"$",
"this",
"->",
"put",
"(",
"$",
"key",
",",
"$",
"value",
")",
";",
"}",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/granulephp/util/blob/8dcac627fbf9cf5e4219b6dec8ba8ad7c0a3186e/lib/Map/MutableArrayMap.php#L93-L99 |
granulephp/util | lib/Map/MutableArrayMap.php | MutableArrayMap.replaceIfEqual | public function replaceIfEqual($key, $oldValue, $newValue): bool {
$value = $this->get($key);
if ($oldValue === $value) {
$this->put($key, $newValue);
return true;
} else {
return false;
}
} | php | public function replaceIfEqual($key, $oldValue, $newValue): bool {
$value = $this->get($key);
if ($oldValue === $value) {
$this->put($key, $newValue);
return true;
} else {
return false;
}
} | [
"public",
"function",
"replaceIfEqual",
"(",
"$",
"key",
",",
"$",
"oldValue",
",",
"$",
"newValue",
")",
":",
"bool",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"get",
"(",
"$",
"key",
")",
";",
"if",
"(",
"$",
"oldValue",
"===",
"$",
"value",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/granulephp/util/blob/8dcac627fbf9cf5e4219b6dec8ba8ad7c0a3186e/lib/Map/MutableArrayMap.php#L102-L111 |
granulephp/util | lib/Map/MutableArrayMap.php | MutableArrayMap.replaceAll | public function replaceAll(callable $replacer): void {
foreach ($this as $key => $value) {
$this->put($key, $replacer($value, $key));
}
} | php | public function replaceAll(callable $replacer): void {
foreach ($this as $key => $value) {
$this->put($key, $replacer($value, $key));
}
} | [
"public",
"function",
"replaceAll",
"(",
"callable",
"$",
"replacer",
")",
":",
"void",
"{",
"foreach",
"(",
"$",
"this",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"put",
"(",
"$",
"key",
",",
"$",
"replacer",
"(",
"$",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/granulephp/util/blob/8dcac627fbf9cf5e4219b6dec8ba8ad7c0a3186e/lib/Map/MutableArrayMap.php#L114-L118 |
guillaumemonet/Rad | src/Rad/Config/Config.php | Config.get | public static function get(string $section, $row = null) {
if ($row === null) {
return isset(self::$config[$section]) ? self::$config[$section] : null;
} else {
return isset(self::$config[$section][$row]) ? self::$config[$section][$row] : null;
}
} | php | public static function get(string $section, $row = null) {
if ($row === null) {
return isset(self::$config[$section]) ? self::$config[$section] : null;
} else {
return isset(self::$config[$section][$row]) ? self::$config[$section][$row] : null;
}
} | [
"public",
"static",
"function",
"get",
"(",
"string",
"$",
"section",
",",
"$",
"row",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"row",
"===",
"null",
")",
"{",
"return",
"isset",
"(",
"self",
"::",
"$",
"config",
"[",
"$",
"section",
"]",
")",
"?",... | Return current config
@param string $section
@param string $row
@return string | [
"Return",
"current",
"config"
] | train | https://github.com/guillaumemonet/Rad/blob/cb9932f570cf3c2a7197f81e1d959c2729989e59/src/Rad/Config/Config.php#L88-L94 |
ipunkt/social-auth | src/Ipunkt/SocialAuth/EventListeners/UpdateProfileEventListener.php | UpdateProfileEventListener.register | public function register(UserInterface $user, RegisterInfoInterface $registerInfo) {
$database_profile = $this->socialProfileRepository->findByUserAndProvider($user, 'UserProfile');
if($database_profile === null) {
$profile = $registerInfo->getProfile();
$this->copyProfileToDatabase($user, $profile);
... | php | public function register(UserInterface $user, RegisterInfoInterface $registerInfo) {
$database_profile = $this->socialProfileRepository->findByUserAndProvider($user, 'UserProfile');
if($database_profile === null) {
$profile = $registerInfo->getProfile();
$this->copyProfileToDatabase($user, $profile);
... | [
"public",
"function",
"register",
"(",
"UserInterface",
"$",
"user",
",",
"RegisterInfoInterface",
"$",
"registerInfo",
")",
"{",
"$",
"database_profile",
"=",
"$",
"this",
"->",
"socialProfileRepository",
"->",
"findByUserAndProvider",
"(",
"$",
"user",
",",
"'Us... | Listens for:
User has just registered a new account through a social-auth provider.
Does:
Create the 'UserProfile' DatabaseProfile for the new account using the Profile of the provider just registered with
@param $parameters | [
"Listens",
"for",
":",
"User",
"has",
"just",
"registered",
"a",
"new",
"account",
"through",
"a",
"social",
"-",
"auth",
"provider",
".",
"Does",
":",
"Create",
"the",
"UserProfile",
"DatabaseProfile",
"for",
"the",
"new",
"account",
"using",
"the",
"Profil... | train | https://github.com/ipunkt/social-auth/blob/28723a8e449612789a2cd7d21137996c48b62229/src/Ipunkt/SocialAuth/EventListeners/UpdateProfileEventListener.php#L38-L47 |
ipunkt/social-auth | src/Ipunkt/SocialAuth/EventListeners/UpdateProfileEventListener.php | UpdateProfileEventListener.attach | public function attach($user, $providerName, $profile) {
$database_profile = $this->socialProfileRepository->findByUserAndProvider($user, 'UserProfile');
if($database_profile === null) {
$this->copyProfileToDatabase($user, $profile);
}
} | php | public function attach($user, $providerName, $profile) {
$database_profile = $this->socialProfileRepository->findByUserAndProvider($user, 'UserProfile');
if($database_profile === null) {
$this->copyProfileToDatabase($user, $profile);
}
} | [
"public",
"function",
"attach",
"(",
"$",
"user",
",",
"$",
"providerName",
",",
"$",
"profile",
")",
"{",
"$",
"database_profile",
"=",
"$",
"this",
"->",
"socialProfileRepository",
"->",
"findByUserAndProvider",
"(",
"$",
"user",
",",
"'UserProfile'",
")",
... | Listens for:
User has just attached a new social-auth provider to his existing account.
Does:
Checks if this is the first provider to get attached to the user. If so, create or fill the DatabaseProfile using
the info from this provider.
@param $parameters | [
"Listens",
"for",
":",
"User",
"has",
"just",
"attached",
"a",
"new",
"social",
"-",
"auth",
"provider",
"to",
"his",
"existing",
"account",
".",
"Does",
":",
"Checks",
"if",
"this",
"is",
"the",
"first",
"provider",
"to",
"get",
"attached",
"to",
"the",... | train | https://github.com/ipunkt/social-auth/blob/28723a8e449612789a2cd7d21137996c48b62229/src/Ipunkt/SocialAuth/EventListeners/UpdateProfileEventListener.php#L58-L63 |
ipunkt/social-auth | src/Ipunkt/SocialAuth/EventListeners/UpdateProfileEventListener.php | UpdateProfileEventListener.copyProfileToDatabase | protected function copyProfileToDatabase($user, ProfileGetInterface $profile) {
$database_profile = $this->socialProfileRepository->create();
$database_profile->copy($profile);
$database_profile->setProvider('UserProfile');
$database_profile->setUser($user->getAuthIdentifier());
$database_profile->setIdentifi... | php | protected function copyProfileToDatabase($user, ProfileGetInterface $profile) {
$database_profile = $this->socialProfileRepository->create();
$database_profile->copy($profile);
$database_profile->setProvider('UserProfile');
$database_profile->setUser($user->getAuthIdentifier());
$database_profile->setIdentifi... | [
"protected",
"function",
"copyProfileToDatabase",
"(",
"$",
"user",
",",
"ProfileGetInterface",
"$",
"profile",
")",
"{",
"$",
"database_profile",
"=",
"$",
"this",
"->",
"socialProfileRepository",
"->",
"create",
"(",
")",
";",
"$",
"database_profile",
"->",
"c... | Make a new DatabaseProfile as copy of $profile
@param ProfileGetInterface $profile
@return bool | [
"Make",
"a",
"new",
"DatabaseProfile",
"as",
"copy",
"of",
"$profile"
] | train | https://github.com/ipunkt/social-auth/blob/28723a8e449612789a2cd7d21137996c48b62229/src/Ipunkt/SocialAuth/EventListeners/UpdateProfileEventListener.php#L71-L78 |
nyeholt/silverstripe-simplewiki | thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/UnitConverter.php | HTMLPurifier_UnitConverter.add | private function add($s1, $s2, $scale) {
if ($this->bcmath) return bcadd($s1, $s2, $scale);
else return $this->scale($s1 + $s2, $scale);
} | php | private function add($s1, $s2, $scale) {
if ($this->bcmath) return bcadd($s1, $s2, $scale);
else return $this->scale($s1 + $s2, $scale);
} | [
"private",
"function",
"add",
"(",
"$",
"s1",
",",
"$",
"s2",
",",
"$",
"scale",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"bcmath",
")",
"return",
"bcadd",
"(",
"$",
"s1",
",",
"$",
"s2",
",",
"$",
"scale",
")",
";",
"else",
"return",
"$",
"th... | Adds two numbers, using arbitrary precision when available. | [
"Adds",
"two",
"numbers",
"using",
"arbitrary",
"precision",
"when",
"available",
"."
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/UnitConverter.php#L188-L191 |
nyeholt/silverstripe-simplewiki | thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/UnitConverter.php | HTMLPurifier_UnitConverter.mul | private function mul($s1, $s2, $scale) {
if ($this->bcmath) return bcmul($s1, $s2, $scale);
else return $this->scale($s1 * $s2, $scale);
} | php | private function mul($s1, $s2, $scale) {
if ($this->bcmath) return bcmul($s1, $s2, $scale);
else return $this->scale($s1 * $s2, $scale);
} | [
"private",
"function",
"mul",
"(",
"$",
"s1",
",",
"$",
"s2",
",",
"$",
"scale",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"bcmath",
")",
"return",
"bcmul",
"(",
"$",
"s1",
",",
"$",
"s2",
",",
"$",
"scale",
")",
";",
"else",
"return",
"$",
"th... | Multiples two numbers, using arbitrary precision when available. | [
"Multiples",
"two",
"numbers",
"using",
"arbitrary",
"precision",
"when",
"available",
"."
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/UnitConverter.php#L196-L199 |
PendoNL/pro6pp-php-wrapper | src/Pro6pp.php | Pro6pp.autocomplete | public function autocomplete($postalcode, $number = '', $extension = '')
{
$postalcode = $this->determinePostalType($postalcode);
$this->data = array_merge($postalcode, ['streetnumber' => $number, 'extension' => $extension]);
return $this->call('autocomplete', $this->prepareData($this->dat... | php | public function autocomplete($postalcode, $number = '', $extension = '')
{
$postalcode = $this->determinePostalType($postalcode);
$this->data = array_merge($postalcode, ['streetnumber' => $number, 'extension' => $extension]);
return $this->call('autocomplete', $this->prepareData($this->dat... | [
"public",
"function",
"autocomplete",
"(",
"$",
"postalcode",
",",
"$",
"number",
"=",
"''",
",",
"$",
"extension",
"=",
"''",
")",
"{",
"$",
"postalcode",
"=",
"$",
"this",
"->",
"determinePostalType",
"(",
"$",
"postalcode",
")",
";",
"$",
"this",
"-... | Get a full address after providing a postalcode and number, the results also
include the coordinates from the address.
@param $postalcode
@param $number
@return mixed | [
"Get",
"a",
"full",
"address",
"after",
"providing",
"a",
"postalcode",
"and",
"number",
"the",
"results",
"also",
"include",
"the",
"coordinates",
"from",
"the",
"address",
"."
] | train | https://github.com/PendoNL/pro6pp-php-wrapper/blob/d3ad95ebb89a55b037a3a12689cd15431912f32f/src/Pro6pp.php#L48-L55 |
PendoNL/pro6pp-php-wrapper | src/Pro6pp.php | Pro6pp.reverse | public function reverse($lat, $lng)
{
$this->data = ['lat' => $lat, 'lng' => $lng];
return $this->call('reverse', $this->prepareData($this->data));
} | php | public function reverse($lat, $lng)
{
$this->data = ['lat' => $lat, 'lng' => $lng];
return $this->call('reverse', $this->prepareData($this->data));
} | [
"public",
"function",
"reverse",
"(",
"$",
"lat",
",",
"$",
"lng",
")",
"{",
"$",
"this",
"->",
"data",
"=",
"[",
"'lat'",
"=>",
"$",
"lat",
",",
"'lng'",
"=>",
"$",
"lng",
"]",
";",
"return",
"$",
"this",
"->",
"call",
"(",
"'reverse'",
",",
"... | Find an address by their coordinates, returns a full address if found.
@param $lat
@param $lng
@return mixed | [
"Find",
"an",
"address",
"by",
"their",
"coordinates",
"returns",
"a",
"full",
"address",
"if",
"found",
"."
] | train | https://github.com/PendoNL/pro6pp-php-wrapper/blob/d3ad95ebb89a55b037a3a12689cd15431912f32f/src/Pro6pp.php#L65-L70 |
PendoNL/pro6pp-php-wrapper | src/Pro6pp.php | Pro6pp.locator | public function locator($target_nl_fourpps, $optional = [])
{
$this->data['target_nl_fourpps'] = implode(',', $target_nl_fourpps);
$this->data = array_merge($this->data, $optional);
return $this->call('locator', $this->prepareData($this->data));
} | php | public function locator($target_nl_fourpps, $optional = [])
{
$this->data['target_nl_fourpps'] = implode(',', $target_nl_fourpps);
$this->data = array_merge($this->data, $optional);
return $this->call('locator', $this->prepareData($this->data));
} | [
"public",
"function",
"locator",
"(",
"$",
"target_nl_fourpps",
",",
"$",
"optional",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"data",
"[",
"'target_nl_fourpps'",
"]",
"=",
"implode",
"(",
"','",
",",
"$",
"target_nl_fourpps",
")",
";",
"$",
"this",
... | Returns a list of postalcodes sorted from nearest to farest. Either include a lat/lng
combination or a nl_fourpp in the optional array.
@param $target_nl_fourpps
@param array $optional
@return mixed | [
"Returns",
"a",
"list",
"of",
"postalcodes",
"sorted",
"from",
"nearest",
"to",
"farest",
".",
"Either",
"include",
"a",
"lat",
"/",
"lng",
"combination",
"or",
"a",
"nl_fourpp",
"in",
"the",
"optional",
"array",
"."
] | train | https://github.com/PendoNL/pro6pp-php-wrapper/blob/d3ad95ebb89a55b037a3a12689cd15431912f32f/src/Pro6pp.php#L81-L88 |
PendoNL/pro6pp-php-wrapper | src/Pro6pp.php | Pro6pp.range | public function range($nl_fourpp, $range = 5000, $per_page = 10, $page = 1)
{
$this->data = ['nl_fourpp' => $nl_fourpp, 'range' => $range, 'per_page' => $per_page, 'page' => $page];
return $this->call('range', $this->prepareData($this->data));
} | php | public function range($nl_fourpp, $range = 5000, $per_page = 10, $page = 1)
{
$this->data = ['nl_fourpp' => $nl_fourpp, 'range' => $range, 'per_page' => $per_page, 'page' => $page];
return $this->call('range', $this->prepareData($this->data));
} | [
"public",
"function",
"range",
"(",
"$",
"nl_fourpp",
",",
"$",
"range",
"=",
"5000",
",",
"$",
"per_page",
"=",
"10",
",",
"$",
"page",
"=",
"1",
")",
"{",
"$",
"this",
"->",
"data",
"=",
"[",
"'nl_fourpp'",
"=>",
"$",
"nl_fourpp",
",",
"'range'",... | Returns a list of postalcodes within a given range.
@param $nl_fourpp
@param int $range
@param int $per_page
@param int $page
@return mixed | [
"Returns",
"a",
"list",
"of",
"postalcodes",
"within",
"a",
"given",
"range",
"."
] | train | https://github.com/PendoNL/pro6pp-php-wrapper/blob/d3ad95ebb89a55b037a3a12689cd15431912f32f/src/Pro6pp.php#L100-L105 |
PendoNL/pro6pp-php-wrapper | src/Pro6pp.php | Pro6pp.suggest | public function suggest($nl_city, $per_page = 10)
{
$this->data = ['nl_city' => $nl_city, 'per_page' => $per_page];
return $this->call('suggest', $this->prepareData($this->data));
} | php | public function suggest($nl_city, $per_page = 10)
{
$this->data = ['nl_city' => $nl_city, 'per_page' => $per_page];
return $this->call('suggest', $this->prepareData($this->data));
} | [
"public",
"function",
"suggest",
"(",
"$",
"nl_city",
",",
"$",
"per_page",
"=",
"10",
")",
"{",
"$",
"this",
"->",
"data",
"=",
"[",
"'nl_city'",
"=>",
"$",
"nl_city",
",",
"'per_page'",
"=>",
"$",
"per_page",
"]",
";",
"return",
"$",
"this",
"->",
... | Autocompletes a city name.
@param $nl_city
@param int $per_page
@return mixed | [
"Autocompletes",
"a",
"city",
"name",
"."
] | train | https://github.com/PendoNL/pro6pp-php-wrapper/blob/d3ad95ebb89a55b037a3a12689cd15431912f32f/src/Pro6pp.php#L115-L120 |
PendoNL/pro6pp-php-wrapper | src/Pro6pp.php | Pro6pp.distance | public function distance($from_nl_fourpp, $to_nl_fourpp, $algorithm = 'road')
{
$this->data = ['from_nl_fourpp' => $from_nl_fourpp, 'to_nl_fourpp' => $to_nl_fourpp, 'algorithm' => $algorithm];
return $this->call('distance', $this->prepareData($this->data));
} | php | public function distance($from_nl_fourpp, $to_nl_fourpp, $algorithm = 'road')
{
$this->data = ['from_nl_fourpp' => $from_nl_fourpp, 'to_nl_fourpp' => $to_nl_fourpp, 'algorithm' => $algorithm];
return $this->call('distance', $this->prepareData($this->data));
} | [
"public",
"function",
"distance",
"(",
"$",
"from_nl_fourpp",
",",
"$",
"to_nl_fourpp",
",",
"$",
"algorithm",
"=",
"'road'",
")",
"{",
"$",
"this",
"->",
"data",
"=",
"[",
"'from_nl_fourpp'",
"=>",
"$",
"from_nl_fourpp",
",",
"'to_nl_fourpp'",
"=>",
"$",
... | Calculates the distance between two nl_fourpp postalcodes. Optional you can choose between
road or straight distance.
@param $from_nl_fourpp
@param $to_nl_fourpp
@param $algorithm
@return mixed | [
"Calculates",
"the",
"distance",
"between",
"two",
"nl_fourpp",
"postalcodes",
".",
"Optional",
"you",
"can",
"choose",
"between",
"road",
"or",
"straight",
"distance",
"."
] | train | https://github.com/PendoNL/pro6pp-php-wrapper/blob/d3ad95ebb89a55b037a3a12689cd15431912f32f/src/Pro6pp.php#L132-L137 |
PendoNL/pro6pp-php-wrapper | src/Pro6pp.php | Pro6pp.coordinatesDistance | public function coordinatesDistance($lat1, $lng1, $lat2, $lng2, $miles = false)
{
$pi80 = M_PI / 180;
$lat1 *= $pi80;
$lng1 *= $pi80;
$lat2 *= $pi80;
$lng2 *= $pi80;
$r = 6372.797;
$dlat = $lat2 - $lat1;
$dlng = $lng2 - $lng1;
$a = sin($dlat ... | php | public function coordinatesDistance($lat1, $lng1, $lat2, $lng2, $miles = false)
{
$pi80 = M_PI / 180;
$lat1 *= $pi80;
$lng1 *= $pi80;
$lat2 *= $pi80;
$lng2 *= $pi80;
$r = 6372.797;
$dlat = $lat2 - $lat1;
$dlng = $lng2 - $lng1;
$a = sin($dlat ... | [
"public",
"function",
"coordinatesDistance",
"(",
"$",
"lat1",
",",
"$",
"lng1",
",",
"$",
"lat2",
",",
"$",
"lng2",
",",
"$",
"miles",
"=",
"false",
")",
"{",
"$",
"pi80",
"=",
"M_PI",
"/",
"180",
";",
"$",
"lat1",
"*=",
"$",
"pi80",
";",
"$",
... | Helper method to calculate the distance between two coordinates.
@param $lat1
@param $lng1
@param $lat2
@param $lng2
@param bool $miles
@return float | [
"Helper",
"method",
"to",
"calculate",
"the",
"distance",
"between",
"two",
"coordinates",
"."
] | train | https://github.com/PendoNL/pro6pp-php-wrapper/blob/d3ad95ebb89a55b037a3a12689cd15431912f32f/src/Pro6pp.php#L150-L167 |
PendoNL/pro6pp-php-wrapper | src/Pro6pp.php | Pro6pp.determinePostalType | public function determinePostalType($postalcode)
{
$postalcode = str_replace(' ', '', $postalcode);
if (strlen($postalcode) == 6) {
return ['nl_sixpp' => $postalcode];
}
if (strlen($postalcode) == 4) {
return ['nl_fourpp' => $postalcode];
}
... | php | public function determinePostalType($postalcode)
{
$postalcode = str_replace(' ', '', $postalcode);
if (strlen($postalcode) == 6) {
return ['nl_sixpp' => $postalcode];
}
if (strlen($postalcode) == 4) {
return ['nl_fourpp' => $postalcode];
}
... | [
"public",
"function",
"determinePostalType",
"(",
"$",
"postalcode",
")",
"{",
"$",
"postalcode",
"=",
"str_replace",
"(",
"' '",
",",
"''",
",",
"$",
"postalcode",
")",
";",
"if",
"(",
"strlen",
"(",
"$",
"postalcode",
")",
"==",
"6",
")",
"{",
"retur... | Checks if one of two valid postal types was sent along.
@param $postalcode
@throws \Exception
@return array | [
"Checks",
"if",
"one",
"of",
"two",
"valid",
"postal",
"types",
"was",
"sent",
"along",
"."
] | train | https://github.com/PendoNL/pro6pp-php-wrapper/blob/d3ad95ebb89a55b037a3a12689cd15431912f32f/src/Pro6pp.php#L178-L191 |
PendoNL/pro6pp-php-wrapper | src/Pro6pp.php | Pro6pp.prepareData | protected function prepareData($data)
{
$data['auth_key'] = $this->api_key;
$data['format'] = $this->api_format;
$data['pretty'] = $this->api_pretty;
return $data;
} | php | protected function prepareData($data)
{
$data['auth_key'] = $this->api_key;
$data['format'] = $this->api_format;
$data['pretty'] = $this->api_pretty;
return $data;
} | [
"protected",
"function",
"prepareData",
"(",
"$",
"data",
")",
"{",
"$",
"data",
"[",
"'auth_key'",
"]",
"=",
"$",
"this",
"->",
"api_key",
";",
"$",
"data",
"[",
"'format'",
"]",
"=",
"$",
"this",
"->",
"api_format",
";",
"$",
"data",
"[",
"'pretty'... | Make sure the data contains the api_key and desired format.
@param $data
@return mixed | [
"Make",
"sure",
"the",
"data",
"contains",
"the",
"api_key",
"and",
"desired",
"format",
"."
] | train | https://github.com/PendoNL/pro6pp-php-wrapper/blob/d3ad95ebb89a55b037a3a12689cd15431912f32f/src/Pro6pp.php#L200-L207 |
PendoNL/pro6pp-php-wrapper | src/Pro6pp.php | Pro6pp.call | protected function call($path, $data)
{
$url = $this->api_host.$path.'?'.http_build_query($data);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
$return = curl_exec($ch);
curl_close($ch);
retur... | php | protected function call($path, $data)
{
$url = $this->api_host.$path.'?'.http_build_query($data);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
$return = curl_exec($ch);
curl_close($ch);
retur... | [
"protected",
"function",
"call",
"(",
"$",
"path",
",",
"$",
"data",
")",
"{",
"$",
"url",
"=",
"$",
"this",
"->",
"api_host",
".",
"$",
"path",
".",
"'?'",
".",
"http_build_query",
"(",
"$",
"data",
")",
";",
"$",
"ch",
"=",
"curl_init",
"(",
"$... | Method to do the actual call to Pro6PP's API and return the data
in the given format.
@param $path
@param $data
@return mixed | [
"Method",
"to",
"do",
"the",
"actual",
"call",
"to",
"Pro6PP",
"s",
"API",
"and",
"return",
"the",
"data",
"in",
"the",
"given",
"format",
"."
] | train | https://github.com/PendoNL/pro6pp-php-wrapper/blob/d3ad95ebb89a55b037a3a12689cd15431912f32f/src/Pro6pp.php#L218-L232 |
cornernote/yii-return-url | return-url/components/EReturnUrl.php | EReturnUrl.getFormValue | public function getFormValue($currentPage = false, $encode = false)
{
if ($currentPage)
$url = $encode ? $this->urlEncode(Yii::app()->getRequest()->getUrl()) : Yii::app()->getRequest()->getUrl();
else
$url = $this->getUrlFromSubmitFields();
return $url;
} | php | public function getFormValue($currentPage = false, $encode = false)
{
if ($currentPage)
$url = $encode ? $this->urlEncode(Yii::app()->getRequest()->getUrl()) : Yii::app()->getRequest()->getUrl();
else
$url = $this->getUrlFromSubmitFields();
return $url;
} | [
"public",
"function",
"getFormValue",
"(",
"$",
"currentPage",
"=",
"false",
",",
"$",
"encode",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"currentPage",
")",
"$",
"url",
"=",
"$",
"encode",
"?",
"$",
"this",
"->",
"urlEncode",
"(",
"Yii",
"::",
"app",... | Get url from submitted data or the current page url
for usage in a hidden form element
@usage
in views/your_page.php
<pre>
CHtml::hiddenField('returnUrl', Yii::app()->returnUrl->getFormValue());
</pre>
@param bool $currentPage
@param bool $encode
@return null|string | [
"Get",
"url",
"from",
"submitted",
"data",
"or",
"the",
"current",
"page",
"url",
"for",
"usage",
"in",
"a",
"hidden",
"form",
"element"
] | train | https://github.com/cornernote/yii-return-url/blob/9dc2dac5a3957ab193a1e8c80224c9f77479d3f0/return-url/components/EReturnUrl.php#L36-L43 |
cornernote/yii-return-url | return-url/components/EReturnUrl.php | EReturnUrl.getLinkValue | public function getLinkValue($currentPage = false)
{
return $this->encodeLinkValue($currentPage ? Yii::app()->request->getUrl() : $this->getUrlFromSubmitFields());
} | php | public function getLinkValue($currentPage = false)
{
return $this->encodeLinkValue($currentPage ? Yii::app()->request->getUrl() : $this->getUrlFromSubmitFields());
} | [
"public",
"function",
"getLinkValue",
"(",
"$",
"currentPage",
"=",
"false",
")",
"{",
"return",
"$",
"this",
"->",
"encodeLinkValue",
"(",
"$",
"currentPage",
"?",
"Yii",
"::",
"app",
"(",
")",
"->",
"request",
"->",
"getUrl",
"(",
")",
":",
"$",
"thi... | Get url from submitted data or the current page url
for usage in a link
@usage
in views/your_page.php
<pre>
CHtml::link('my link', array('test/form', 'returnUrl' => Yii::app()->returnUrl->getLinkValue(true)));
</pre>
@param bool $currentPage
@return string | [
"Get",
"url",
"from",
"submitted",
"data",
"or",
"the",
"current",
"page",
"url",
"for",
"usage",
"in",
"a",
"link"
] | train | https://github.com/cornernote/yii-return-url/blob/9dc2dac5a3957ab193a1e8c80224c9f77479d3f0/return-url/components/EReturnUrl.php#L58-L61 |
cornernote/yii-return-url | return-url/components/EReturnUrl.php | EReturnUrl.getUrl | public function getUrl($altUrl = false)
{
$url = $this->getUrlFromSubmitFields();
// alt url or current page
if (!$url && $altUrl)
$url = $altUrl;
return $url ? $url : Yii::app()->homeUrl;
} | php | public function getUrl($altUrl = false)
{
$url = $this->getUrlFromSubmitFields();
// alt url or current page
if (!$url && $altUrl)
$url = $altUrl;
return $url ? $url : Yii::app()->homeUrl;
} | [
"public",
"function",
"getUrl",
"(",
"$",
"altUrl",
"=",
"false",
")",
"{",
"$",
"url",
"=",
"$",
"this",
"->",
"getUrlFromSubmitFields",
"(",
")",
";",
"// alt url or current page",
"if",
"(",
"!",
"$",
"url",
"&&",
"$",
"altUrl",
")",
"$",
"url",
"="... | Get url from submitted data or session
@usage
in YourController::actionYourAction()
<pre>
$this->redirect(Yii::app()->returnUrl->getUrl());
</pre>
@param bool|mixed $altUrl
@return mixed|null | [
"Get",
"url",
"from",
"submitted",
"data",
"or",
"session"
] | train | https://github.com/cornernote/yii-return-url/blob/9dc2dac5a3957ab193a1e8c80224c9f77479d3f0/return-url/components/EReturnUrl.php#L93-L100 |
cornernote/yii-return-url | return-url/components/EReturnUrl.php | EReturnUrl.getUrlFromSubmitFields | private function getUrlFromSubmitFields()
{
$requestKey = $this->requestKey;
$url = isset($_GET[$requestKey]) && is_scalar($_GET[$requestKey]) ? $_GET[$requestKey] : (isset($_POST[$requestKey]) && is_scalar($_POST[$requestKey]) ? $_POST[$requestKey] : false);
$url = str_replace(chr(0), '', $... | php | private function getUrlFromSubmitFields()
{
$requestKey = $this->requestKey;
$url = isset($_GET[$requestKey]) && is_scalar($_GET[$requestKey]) ? $_GET[$requestKey] : (isset($_POST[$requestKey]) && is_scalar($_POST[$requestKey]) ? $_POST[$requestKey] : false);
$url = str_replace(chr(0), '', $... | [
"private",
"function",
"getUrlFromSubmitFields",
"(",
")",
"{",
"$",
"requestKey",
"=",
"$",
"this",
"->",
"requestKey",
";",
"$",
"url",
"=",
"isset",
"(",
"$",
"_GET",
"[",
"$",
"requestKey",
"]",
")",
"&&",
"is_scalar",
"(",
"$",
"_GET",
"[",
"$",
... | Get the url from the request, decodes if needed
@return null|string | [
"Get",
"the",
"url",
"from",
"the",
"request",
"decodes",
"if",
"needed"
] | train | https://github.com/cornernote/yii-return-url/blob/9dc2dac5a3957ab193a1e8c80224c9f77479d3f0/return-url/components/EReturnUrl.php#L107-L114 |
dengyongbin/loopeer-lib | src/Services/pingpp_sdk/Pingpp/Util.php | Pingpp_Util.convertToPingppObject | public static function convertToPingppObject($resp, $apiKey)
{
$types = array(
'charge' => 'Pingpp_Charge',
'list' => 'Pingpp_List',
'refund' => 'Pingpp_Refund'
);
if (self::isList($resp)) {
$mapped = array();
foreach ($resp as $i)
... | php | public static function convertToPingppObject($resp, $apiKey)
{
$types = array(
'charge' => 'Pingpp_Charge',
'list' => 'Pingpp_List',
'refund' => 'Pingpp_Refund'
);
if (self::isList($resp)) {
$mapped = array();
foreach ($resp as $i)
... | [
"public",
"static",
"function",
"convertToPingppObject",
"(",
"$",
"resp",
",",
"$",
"apiKey",
")",
"{",
"$",
"types",
"=",
"array",
"(",
"'charge'",
"=>",
"'Pingpp_Charge'",
",",
"'list'",
"=>",
"'Pingpp_List'",
",",
"'refund'",
"=>",
"'Pingpp_Refund'",
")",
... | Converts a response from the Pingpp API to the corresponding PHP object.
@param stdObject $resp The response from the Pingpp API.
@param string $apiKey
@return Pingpp_Object|array | [
"Converts",
"a",
"response",
"from",
"the",
"Pingpp",
"API",
"to",
"the",
"corresponding",
"PHP",
"object",
"."
] | train | https://github.com/dengyongbin/loopeer-lib/blob/4609338f6a48666ca96ee380509a5b5cb066808f/src/Services/pingpp_sdk/Pingpp/Util.php#L82-L106 |
vincentchalamon/VinceCmsSonataAdminBundle | Form/Transformer/ContentsTransformer.php | ContentsTransformer.transform | public function transform($value)
{
// Fix for Symfony 2.4
if (null === $value) {
return;
}
/** @var \Traversable $values */
if (!is_array($value) && !$value instanceof \Traversable) {
throw new \InvalidArgumentException(sprintf('Meta form type only a... | php | public function transform($value)
{
// Fix for Symfony 2.4
if (null === $value) {
return;
}
/** @var \Traversable $values */
if (!is_array($value) && !$value instanceof \Traversable) {
throw new \InvalidArgumentException(sprintf('Meta form type only a... | [
"public",
"function",
"transform",
"(",
"$",
"value",
")",
"{",
"// Fix for Symfony 2.4",
"if",
"(",
"null",
"===",
"$",
"value",
")",
"{",
"return",
";",
"}",
"/** @var \\Traversable $values */",
"if",
"(",
"!",
"is_array",
"(",
"$",
"value",
")",
"&&",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/vincentchalamon/VinceCmsSonataAdminBundle/blob/edc768061734a92ba116488dd7b61ad40af21ceb/Form/Transformer/ContentsTransformer.php#L59-L85 |
vincentchalamon/VinceCmsSonataAdminBundle | Form/Transformer/ContentsTransformer.php | ContentsTransformer.reverseTransform | public function reverseTransform($value)
{
if (!is_array($value)) {
return array();
}
$results = array();
foreach ($value as $template => $contents) {
/** @var Template $template */
$template = $this->repository->createQueryBuilder('t')
... | php | public function reverseTransform($value)
{
if (!is_array($value)) {
return array();
}
$results = array();
foreach ($value as $template => $contents) {
/** @var Template $template */
$template = $this->repository->createQueryBuilder('t')
... | [
"public",
"function",
"reverseTransform",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"value",
")",
")",
"{",
"return",
"array",
"(",
")",
";",
"}",
"$",
"results",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"value",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/vincentchalamon/VinceCmsSonataAdminBundle/blob/edc768061734a92ba116488dd7b61ad40af21ceb/Form/Transformer/ContentsTransformer.php#L90-L125 |
comelyio/comely | src/Comely/IO/FileSystem/Disk/AbstractPath.php | AbstractPath.permissions | final public function permissions(bool $recheck = false): Privileges
{
if (!$this->privileges || $recheck) {
$this->privileges = new Privileges($this->path);
}
return $this->privileges;
} | php | final public function permissions(bool $recheck = false): Privileges
{
if (!$this->privileges || $recheck) {
$this->privileges = new Privileges($this->path);
}
return $this->privileges;
} | [
"final",
"public",
"function",
"permissions",
"(",
"bool",
"$",
"recheck",
"=",
"false",
")",
":",
"Privileges",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"privileges",
"||",
"$",
"recheck",
")",
"{",
"$",
"this",
"->",
"privileges",
"=",
"new",
"Privile... | To save system resources, privileges will only be checked (once) if this method is called
@param bool $recheck
@return Privileges | [
"To",
"save",
"system",
"resources",
"privileges",
"will",
"only",
"be",
"checked",
"(",
"once",
")",
"if",
"this",
"method",
"is",
"called"
] | train | https://github.com/comelyio/comely/blob/561ea7aef36fea347a1a79d3ee5597d4057ddf82/src/Comely/IO/FileSystem/Disk/AbstractPath.php#L76-L83 |
aindong/pluggables | src/Aindong/Pluggables/Console/PluggableDisableCommand.php | PluggableDisableCommand.fire | public function fire()
{
$pluggable = $this->argument('pluggable');
if ($this->laravel['pluggables']->isEnabled($this->argument('pluggable'))) {
$this->laravel['pluggables']->disable($pluggable);
$this->info("Pluggable [{$pluggable}] was disabled successfully.");
} ... | php | public function fire()
{
$pluggable = $this->argument('pluggable');
if ($this->laravel['pluggables']->isEnabled($this->argument('pluggable'))) {
$this->laravel['pluggables']->disable($pluggable);
$this->info("Pluggable [{$pluggable}] was disabled successfully.");
} ... | [
"public",
"function",
"fire",
"(",
")",
"{",
"$",
"pluggable",
"=",
"$",
"this",
"->",
"argument",
"(",
"'pluggable'",
")",
";",
"if",
"(",
"$",
"this",
"->",
"laravel",
"[",
"'pluggables'",
"]",
"->",
"isEnabled",
"(",
"$",
"this",
"->",
"argument",
... | Execute the console command.
@return mixed | [
"Execute",
"the",
"console",
"command",
"."
] | train | https://github.com/aindong/pluggables/blob/bf8bab46fb65268043fb4b98db21f8e0338b5e96/src/Aindong/Pluggables/Console/PluggableDisableCommand.php#L33-L44 |
baleen/cli | src/Config/ConfigStorage.php | ConfigStorage.load | public function load($configFileName = null)
{
$configs = [];
// load all local configs (config files that are not user-facing)
$localConfig = [];
foreach ($this->localConfigStack as $file) {
$config = include $file;
$localConfig = array_merge_recursive($loca... | php | public function load($configFileName = null)
{
$configs = [];
// load all local configs (config files that are not user-facing)
$localConfig = [];
foreach ($this->localConfigStack as $file) {
$config = include $file;
$localConfig = array_merge_recursive($loca... | [
"public",
"function",
"load",
"(",
"$",
"configFileName",
"=",
"null",
")",
"{",
"$",
"configs",
"=",
"[",
"]",
";",
"// load all local configs (config files that are not user-facing)",
"$",
"localConfig",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
... | @param string $configFileName The path to the consumer's config file (eg .baleen.yml) relative to the project
filesystem
@return Config | [
"@param",
"string",
"$configFileName",
"The",
"path",
"to",
"the",
"consumer",
"s",
"config",
"file",
"(",
"eg",
".",
"baleen",
".",
"yml",
")",
"relative",
"to",
"the",
"project",
"filesystem"
] | train | https://github.com/baleen/cli/blob/2ecbc7179c5800c9075fd93204ef25da375536ed/src/Config/ConfigStorage.php#L108-L137 |
baleen/cli | src/Config/ConfigStorage.php | ConfigStorage.write | public function write(ConfigInterface $config)
{
$fileName = $config->getFileName() ?: Config::CONFIG_FILE_NAME;
$array = $config->getCleanArray();
$contents = Yaml::dump($array);
return $this->projectFileSystem->write($fileName, $contents);
} | php | public function write(ConfigInterface $config)
{
$fileName = $config->getFileName() ?: Config::CONFIG_FILE_NAME;
$array = $config->getCleanArray();
$contents = Yaml::dump($array);
return $this->projectFileSystem->write($fileName, $contents);
} | [
"public",
"function",
"write",
"(",
"ConfigInterface",
"$",
"config",
")",
"{",
"$",
"fileName",
"=",
"$",
"config",
"->",
"getFileName",
"(",
")",
"?",
":",
"Config",
"::",
"CONFIG_FILE_NAME",
";",
"$",
"array",
"=",
"$",
"config",
"->",
"getCleanArray",
... | @param ConfigInterface $config
@return bool | [
"@param",
"ConfigInterface",
"$config"
] | train | https://github.com/baleen/cli/blob/2ecbc7179c5800c9075fd93204ef25da375536ed/src/Config/ConfigStorage.php#L144-L151 |
bocharsky-bw/FileNamingResolver | src/NamingStrategy/AggregateNamingStrategy.php | AggregateNamingStrategy.provideName | public function provideName(FileInfo $srcFileInfo)
{
$dstFileInfo = $srcFileInfo;
$strategies = $this->isReverseMode()
? array_reverse($this->strategies, true)
: $this->strategies
;
foreach ($strategies as $strategy) {
$filename = (string)$strateg... | php | public function provideName(FileInfo $srcFileInfo)
{
$dstFileInfo = $srcFileInfo;
$strategies = $this->isReverseMode()
? array_reverse($this->strategies, true)
: $this->strategies
;
foreach ($strategies as $strategy) {
$filename = (string)$strateg... | [
"public",
"function",
"provideName",
"(",
"FileInfo",
"$",
"srcFileInfo",
")",
"{",
"$",
"dstFileInfo",
"=",
"$",
"srcFileInfo",
";",
"$",
"strategies",
"=",
"$",
"this",
"->",
"isReverseMode",
"(",
")",
"?",
"array_reverse",
"(",
"$",
"this",
"->",
"strat... | {@inheritdoc} | [
"{"
] | train | https://github.com/bocharsky-bw/FileNamingResolver/blob/0a0fe86fee0e7acf1ab43a84c1abd51954ce2fbe/src/NamingStrategy/AggregateNamingStrategy.php#L49-L63 |
blast-project/CoreBundle | src/Controller/BaseController.php | BaseController.render | public function render($view, array $parameters = array(), Response $response = null)
{
$blocks = array(
'top' => array(),
'left' => array(),
'center' => array(),
'right' => array(),
'bottom' => array(),
);
foreach ($this->co... | php | public function render($view, array $parameters = array(), Response $response = null)
{
$blocks = array(
'top' => array(),
'left' => array(),
'center' => array(),
'right' => array(),
'bottom' => array(),
);
foreach ($this->co... | [
"public",
"function",
"render",
"(",
"$",
"view",
",",
"array",
"$",
"parameters",
"=",
"array",
"(",
")",
",",
"Response",
"$",
"response",
"=",
"null",
")",
"{",
"$",
"blocks",
"=",
"array",
"(",
"'top'",
"=>",
"array",
"(",
")",
",",
"'left'",
"... | render.
** Overrided to add default sonata's twig parameters
@param string $view
@param array $parameters
@param Response|null $response
@return Response | [
"render",
"."
] | train | https://github.com/blast-project/CoreBundle/blob/7a0832758ca14e5bc5d65515532c1220df3930ae/src/Controller/BaseController.php#L37-L58 |
muxtor/yii2-pkk5-module | src/models/Pkk5kadastrSearch.php | Pkk5kadastrSearch.search | public function search($params)
{
$query = Pkk5kadastr::find();
// add conditions that should always apply here
$dataProvider = new ActiveDataProvider([
'query' => $query,
]);
$this->load($params);
if (!$this->validate()) {
// uncomment the... | php | public function search($params)
{
$query = Pkk5kadastr::find();
// add conditions that should always apply here
$dataProvider = new ActiveDataProvider([
'query' => $query,
]);
$this->load($params);
if (!$this->validate()) {
// uncomment the... | [
"public",
"function",
"search",
"(",
"$",
"params",
")",
"{",
"$",
"query",
"=",
"Pkk5kadastr",
"::",
"find",
"(",
")",
";",
"// add conditions that should always apply here",
"$",
"dataProvider",
"=",
"new",
"ActiveDataProvider",
"(",
"[",
"'query'",
"=>",
"$",... | Creates data provider instance with search query applied
@param array $params
@return ActiveDataProvider | [
"Creates",
"data",
"provider",
"instance",
"with",
"search",
"query",
"applied"
] | train | https://github.com/muxtor/yii2-pkk5-module/blob/09be77ddd171c66df53ec89d229d0cc5c0a9ad94/src/models/Pkk5kadastrSearch.php#L42-L71 |
stubbles/stubbles-webapp-core | src/main/php/htmlpassthrough/SessionBasedHtmlFilePassThrough.php | SessionBasedHtmlFilePassThrough.modifyContent | protected function modifyContent(
Request $request,
Response $response,
string $content,
string $routeName
): string {
if ($request->hasSessionAttached()) {
$request->attachedSession()->putValue('stubbles.webapp.lastPage', $routeName);
}
... | php | protected function modifyContent(
Request $request,
Response $response,
string $content,
string $routeName
): string {
if ($request->hasSessionAttached()) {
$request->attachedSession()->putValue('stubbles.webapp.lastPage', $routeName);
}
... | [
"protected",
"function",
"modifyContent",
"(",
"Request",
"$",
"request",
",",
"Response",
"$",
"response",
",",
"string",
"$",
"content",
",",
"string",
"$",
"routeName",
")",
":",
"string",
"{",
"if",
"(",
"$",
"request",
"->",
"hasSessionAttached",
"(",
... | hook to modify the content before passing it to the response
@param \stubbles\webapp\Request $request current request
@param \stubbles\webapp\Response $response response to send
@param string $content actual content for response
@param string $routeName name of the... | [
"hook",
"to",
"modify",
"the",
"content",
"before",
"passing",
"it",
"to",
"the",
"response"
] | train | https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/htmlpassthrough/SessionBasedHtmlFilePassThrough.php#L30-L46 |
acasademont/wurfl | WURFL/UserAgentHandlerChain.php | WURFL_UserAgentHandlerChain.addUserAgentHandler | public function addUserAgentHandler(WURFL_Handlers_Handler $handler)
{
$size = count($this->_userAgentHandlers);
if ($size > 0) {
$this->_userAgentHandlers[$size-1]->setNextHandler($handler);
}
$this->_userAgentHandlers[] = $handler;
return $this;
} | php | public function addUserAgentHandler(WURFL_Handlers_Handler $handler)
{
$size = count($this->_userAgentHandlers);
if ($size > 0) {
$this->_userAgentHandlers[$size-1]->setNextHandler($handler);
}
$this->_userAgentHandlers[] = $handler;
return $this;
} | [
"public",
"function",
"addUserAgentHandler",
"(",
"WURFL_Handlers_Handler",
"$",
"handler",
")",
"{",
"$",
"size",
"=",
"count",
"(",
"$",
"this",
"->",
"_userAgentHandlers",
")",
";",
"if",
"(",
"$",
"size",
">",
"0",
")",
"{",
"$",
"this",
"->",
"_user... | Adds a WURFL_Handlers_Handler to the chain
@param WURFL_Handlers_Handler $handler
@return WURFL_UserAgentHandlerChain $this | [
"Adds",
"a",
"WURFL_Handlers_Handler",
"to",
"the",
"chain"
] | train | https://github.com/acasademont/wurfl/blob/0f4fb6e06b452ba95ad1d15e7d8226d0974b60c2/WURFL/UserAgentHandlerChain.php#L37-L45 |
acasademont/wurfl | WURFL/UserAgentHandlerChain.php | WURFL_UserAgentHandlerChain.filter | public function filter($userAgent, $deviceID)
{
WURFL_Handlers_Utils::reset();
$generic_normalizer = WURFL_UserAgentHandlerChainFactory::createGenericNormalizers();
$userAgent = $generic_normalizer->normalize($userAgent);
$this->_userAgentHandlers[0]->filter($userAgent, $deviceID);
... | php | public function filter($userAgent, $deviceID)
{
WURFL_Handlers_Utils::reset();
$generic_normalizer = WURFL_UserAgentHandlerChainFactory::createGenericNormalizers();
$userAgent = $generic_normalizer->normalize($userAgent);
$this->_userAgentHandlers[0]->filter($userAgent, $deviceID);
... | [
"public",
"function",
"filter",
"(",
"$",
"userAgent",
",",
"$",
"deviceID",
")",
"{",
"WURFL_Handlers_Utils",
"::",
"reset",
"(",
")",
";",
"$",
"generic_normalizer",
"=",
"WURFL_UserAgentHandlerChainFactory",
"::",
"createGenericNormalizers",
"(",
")",
";",
"$",... | Adds the pair $userAgent, $deviceID to the clusters they belong to.
@param String $userAgent
@param String $deviceID
@see WURFL_Handlers_Handler::filter() | [
"Adds",
"the",
"pair",
"$userAgent",
"$deviceID",
"to",
"the",
"clusters",
"they",
"belong",
"to",
"."
] | train | https://github.com/acasademont/wurfl/blob/0f4fb6e06b452ba95ad1d15e7d8226d0974b60c2/WURFL/UserAgentHandlerChain.php#L62-L68 |
huasituo/hstcms | src/Libraries/HstcmsDb.php | HstcmsDb.table | public function table($table, Closure $callback)
{
if(!$this->hasTable($table)) {
return hst_message('is has table');
}
\Schema::connection($this->databaseName)->table($table, $callback);
} | php | public function table($table, Closure $callback)
{
if(!$this->hasTable($table)) {
return hst_message('is has table');
}
\Schema::connection($this->databaseName)->table($table, $callback);
} | [
"public",
"function",
"table",
"(",
"$",
"table",
",",
"Closure",
"$",
"callback",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasTable",
"(",
"$",
"table",
")",
")",
"{",
"return",
"hst_message",
"(",
"'is has table'",
")",
";",
"}",
"\\",
"Schema... | Create a new table on the schema.
@param string $table
@param \Closure $callback
@return void | [
"Create",
"a",
"new",
"table",
"on",
"the",
"schema",
"."
] | train | https://github.com/huasituo/hstcms/blob/12819979289e58ce38e3e92540aeeb16e205e525/src/Libraries/HstcmsDb.php#L33-L39 |
huasituo/hstcms | src/Libraries/HstcmsDb.php | HstcmsDb.createTable | public function createTable($table, Closure $callback)
{
if($this->hasTable($table)) {
return hst_message('is has table');
}
\Schema::connection($this->databaseName)->create($table, $callback);
return true;
} | php | public function createTable($table, Closure $callback)
{
if($this->hasTable($table)) {
return hst_message('is has table');
}
\Schema::connection($this->databaseName)->create($table, $callback);
return true;
} | [
"public",
"function",
"createTable",
"(",
"$",
"table",
",",
"Closure",
"$",
"callback",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasTable",
"(",
"$",
"table",
")",
")",
"{",
"return",
"hst_message",
"(",
"'is has table'",
")",
";",
"}",
"\\",
"Schema"... | Create a new table on the schema.
@param string $table
@param \Closure $callback
@return void | [
"Create",
"a",
"new",
"table",
"on",
"the",
"schema",
"."
] | train | https://github.com/huasituo/hstcms/blob/12819979289e58ce38e3e92540aeeb16e205e525/src/Libraries/HstcmsDb.php#L48-L55 |
huasituo/hstcms | src/Libraries/HstcmsDb.php | HstcmsDb.dropTable | public function dropTable($table)
{
if(!$this->hasTable($table)) {
return hst_message('is has table');
}
\Schema::connection($this->databaseName)->drop($table);
return true;
} | php | public function dropTable($table)
{
if(!$this->hasTable($table)) {
return hst_message('is has table');
}
\Schema::connection($this->databaseName)->drop($table);
return true;
} | [
"public",
"function",
"dropTable",
"(",
"$",
"table",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasTable",
"(",
"$",
"table",
")",
")",
"{",
"return",
"hst_message",
"(",
"'is has table'",
")",
";",
"}",
"\\",
"Schema",
"::",
"connection",
"(",
"... | Create a new table on the schema.
@param string $table
@param \Closure $callback
@return void | [
"Create",
"a",
"new",
"table",
"on",
"the",
"schema",
"."
] | train | https://github.com/huasituo/hstcms/blob/12819979289e58ce38e3e92540aeeb16e205e525/src/Libraries/HstcmsDb.php#L64-L71 |
huasituo/hstcms | src/Libraries/HstcmsDb.php | HstcmsDb.renameTable | public function renameTable($from, $to)
{
if(!$this->hasTable($from)) {
return hst_message('is no has table');
}
if($this->hasTable($to)) {
return hst_message('is has table '.$to);
}
\Schema::connection($this->databaseName)->rename($from, $to);
return true;
} | php | public function renameTable($from, $to)
{
if(!$this->hasTable($from)) {
return hst_message('is no has table');
}
if($this->hasTable($to)) {
return hst_message('is has table '.$to);
}
\Schema::connection($this->databaseName)->rename($from, $to);
return true;
} | [
"public",
"function",
"renameTable",
"(",
"$",
"from",
",",
"$",
"to",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasTable",
"(",
"$",
"from",
")",
")",
"{",
"return",
"hst_message",
"(",
"'is no has table'",
")",
";",
"}",
"if",
"(",
"$",
"this... | Rename a table on the schema.
@param string $from
@param string $to
@return void | [
"Rename",
"a",
"table",
"on",
"the",
"schema",
"."
] | train | https://github.com/huasituo/hstcms/blob/12819979289e58ce38e3e92540aeeb16e205e525/src/Libraries/HstcmsDb.php#L80-L90 |
huasituo/hstcms | src/Libraries/HstcmsDb.php | HstcmsDb.getColumnListing | public function getColumnListing($table, $filed = '')
{
$columns = \Schema::connection($this->databaseName)->getColumnListing($table);
if($filed) {
return in_array(
strtolower($filed), array_map('strtolower', $columns)
);
}
return $columns;
} | php | public function getColumnListing($table, $filed = '')
{
$columns = \Schema::connection($this->databaseName)->getColumnListing($table);
if($filed) {
return in_array(
strtolower($filed), array_map('strtolower', $columns)
);
}
return $columns;
} | [
"public",
"function",
"getColumnListing",
"(",
"$",
"table",
",",
"$",
"filed",
"=",
"''",
")",
"{",
"$",
"columns",
"=",
"\\",
"Schema",
"::",
"connection",
"(",
"$",
"this",
"->",
"databaseName",
")",
"->",
"getColumnListing",
"(",
"$",
"table",
")",
... | Get the column listing for a given table.
@param string $table
@return array | [
"Get",
"the",
"column",
"listing",
"for",
"a",
"given",
"table",
"."
] | train | https://github.com/huasituo/hstcms/blob/12819979289e58ce38e3e92540aeeb16e205e525/src/Libraries/HstcmsDb.php#L108-L117 |
huasituo/hstcms | src/Libraries/HstcmsDb.php | HstcmsDb.hasColumn | public function hasColumn($table, $column = '')
{
if(is_array($column)) {
return \Schema::connection($this->databaseName)->hasColumns($table, $column);
}
return \Schema::connection($this->databaseName)->hasColumn($table, $column);
} | php | public function hasColumn($table, $column = '')
{
if(is_array($column)) {
return \Schema::connection($this->databaseName)->hasColumns($table, $column);
}
return \Schema::connection($this->databaseName)->hasColumn($table, $column);
} | [
"public",
"function",
"hasColumn",
"(",
"$",
"table",
",",
"$",
"column",
"=",
"''",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"column",
")",
")",
"{",
"return",
"\\",
"Schema",
"::",
"connection",
"(",
"$",
"this",
"->",
"databaseName",
")",
"->",
... | Determine if the given table has a given column.
@param string $table
@param string $column
@return bool | [
"Determine",
"if",
"the",
"given",
"table",
"has",
"a",
"given",
"column",
"."
] | train | https://github.com/huasituo/hstcms/blob/12819979289e58ce38e3e92540aeeb16e205e525/src/Libraries/HstcmsDb.php#L126-L132 |
huasituo/hstcms | src/Libraries/HstcmsDb.php | HstcmsDb.addColumn | public function addColumn($table, $column, $columnAttribute = [])
{
if(!$this->hasTable($table)) {
return hst_message('is has table');
}
if($this->hasColumn($table, $column)) {
return hst_message('is has column');
}
if (count($column) !== count($column, 1)) {
return $this... | php | public function addColumn($table, $column, $columnAttribute = [])
{
if(!$this->hasTable($table)) {
return hst_message('is has table');
}
if($this->hasColumn($table, $column)) {
return hst_message('is has column');
}
if (count($column) !== count($column, 1)) {
return $this... | [
"public",
"function",
"addColumn",
"(",
"$",
"table",
",",
"$",
"column",
",",
"$",
"columnAttribute",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasTable",
"(",
"$",
"table",
")",
")",
"{",
"return",
"hst_message",
"(",
"'is has ta... | 新曾列 | [
"新曾列"
] | train | https://github.com/huasituo/hstcms/blob/12819979289e58ce38e3e92540aeeb16e205e525/src/Libraries/HstcmsDb.php#L135-L215 |
huasituo/hstcms | src/Libraries/HstcmsDb.php | HstcmsDb.renameColumn | public function renameColumn($table, $from, $to)
{
if(!$this->hasTable($table)) {
return hst_message('is has table');
}
if(!$this->hasColumn($table, $from)) {
return hst_message('is no has column');
}
if($this->hasColumn($table, $to)) {
return hst_message('is has column '... | php | public function renameColumn($table, $from, $to)
{
if(!$this->hasTable($table)) {
return hst_message('is has table');
}
if(!$this->hasColumn($table, $from)) {
return hst_message('is no has column');
}
if($this->hasColumn($table, $to)) {
return hst_message('is has column '... | [
"public",
"function",
"renameColumn",
"(",
"$",
"table",
",",
"$",
"from",
",",
"$",
"to",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasTable",
"(",
"$",
"table",
")",
")",
"{",
"return",
"hst_message",
"(",
"'is has table'",
")",
";",
"}",
"if... | 重命名列 | [
"重命名列"
] | train | https://github.com/huasituo/hstcms/blob/12819979289e58ce38e3e92540aeeb16e205e525/src/Libraries/HstcmsDb.php#L233-L248 |
huasituo/hstcms | src/Libraries/HstcmsDb.php | HstcmsDb.dropColumn | public function dropColumn($table, $column)
{
if(!$this->hasTable($table)) {
return hst_message('is has table');
}
if(!$this->hasColumn($table, $column)) {
return hst_message('is has column');
}
$this->table($table, function (Blueprint $table) use($column) {
$table->dropColu... | php | public function dropColumn($table, $column)
{
if(!$this->hasTable($table)) {
return hst_message('is has table');
}
if(!$this->hasColumn($table, $column)) {
return hst_message('is has column');
}
$this->table($table, function (Blueprint $table) use($column) {
$table->dropColu... | [
"public",
"function",
"dropColumn",
"(",
"$",
"table",
",",
"$",
"column",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasTable",
"(",
"$",
"table",
")",
")",
"{",
"return",
"hst_message",
"(",
"'is has table'",
")",
";",
"}",
"if",
"(",
"!",
"$"... | 删除列 | [
"删除列"
] | train | https://github.com/huasituo/hstcms/blob/12819979289e58ce38e3e92540aeeb16e205e525/src/Libraries/HstcmsDb.php#L251-L263 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Map/LogTableMap.php | LogTableMap.addSelectColumns | public static function addSelectColumns(Criteria $criteria, $alias = null)
{
if (null === $alias) {
$criteria->addSelectColumn(LogTableMap::COL_ID);
$criteria->addSelectColumn(LogTableMap::COL_TYPE);
$criteria->addSelectColumn(LogTableMap::COL_DATE_TIME);
$cri... | php | public static function addSelectColumns(Criteria $criteria, $alias = null)
{
if (null === $alias) {
$criteria->addSelectColumn(LogTableMap::COL_ID);
$criteria->addSelectColumn(LogTableMap::COL_TYPE);
$criteria->addSelectColumn(LogTableMap::COL_DATE_TIME);
$cri... | [
"public",
"static",
"function",
"addSelectColumns",
"(",
"Criteria",
"$",
"criteria",
",",
"$",
"alias",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"alias",
")",
"{",
"$",
"criteria",
"->",
"addSelectColumn",
"(",
"LogTableMap",
"::",
"COL_ID",
... | Add all the columns needed to create a new object.
Note: any columns that were marked with lazyLoad="true" in the
XML schema will not be added to the select list and only loaded
on demand.
@param Criteria $criteria object containing the columns to add.
@param string $alias optional table alias
@throws PropelExce... | [
"Add",
"all",
"the",
"columns",
"needed",
"to",
"create",
"a",
"new",
"object",
"."
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Map/LogTableMap.php#L338-L365 |
phpalchemy/cerberus | src/Alchemy/Component/Cerberus/Model/Map/LogTableMap.php | LogTableMap.buildTableMap | public static function buildTableMap()
{
$dbMap = Propel::getServiceContainer()->getDatabaseMap(LogTableMap::DATABASE_NAME);
if (!$dbMap->hasTable(LogTableMap::TABLE_NAME)) {
$dbMap->addTableObject(new LogTableMap());
}
} | php | public static function buildTableMap()
{
$dbMap = Propel::getServiceContainer()->getDatabaseMap(LogTableMap::DATABASE_NAME);
if (!$dbMap->hasTable(LogTableMap::TABLE_NAME)) {
$dbMap->addTableObject(new LogTableMap());
}
} | [
"public",
"static",
"function",
"buildTableMap",
"(",
")",
"{",
"$",
"dbMap",
"=",
"Propel",
"::",
"getServiceContainer",
"(",
")",
"->",
"getDatabaseMap",
"(",
"LogTableMap",
"::",
"DATABASE_NAME",
")",
";",
"if",
"(",
"!",
"$",
"dbMap",
"->",
"hasTable",
... | Add a TableMap instance to the database for this tableMap class. | [
"Add",
"a",
"TableMap",
"instance",
"to",
"the",
"database",
"for",
"this",
"tableMap",
"class",
"."
] | train | https://github.com/phpalchemy/cerberus/blob/3424a360c9bded71eb5b570bc114a7759cb23ec6/src/Alchemy/Component/Cerberus/Model/Map/LogTableMap.php#L382-L388 |
codezero-be/cookie | src/VanillaCookieCore.php | VanillaCookieCore.delete | public function delete($name)
{
if ( ! $this->exists($name)) {
return true;
}
unset($this->cookies[$name]);
return $this->set($name, null, -1);
} | php | public function delete($name)
{
if ( ! $this->exists($name)) {
return true;
}
unset($this->cookies[$name]);
return $this->set($name, null, -1);
} | [
"public",
"function",
"delete",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"exists",
"(",
"$",
"name",
")",
")",
"{",
"return",
"true",
";",
"}",
"unset",
"(",
"$",
"this",
"->",
"cookies",
"[",
"$",
"name",
"]",
")",
";",
... | Delete a cookie
@param string $name
@return bool | [
"Delete",
"a",
"cookie"
] | train | https://github.com/codezero-be/cookie/blob/5300089c9dc7bd48c9865d53c3aed8bd513da6d2/src/VanillaCookieCore.php#L67-L76 |
axelitus/php-base | src/Arr.php | Arr.set | public function set($key, $value = null)
{
DotArr::set($this->data, $key, $value);
} | php | public function set($key, $value = null)
{
DotArr::set($this->data, $key, $value);
} | [
"public",
"function",
"set",
"(",
"$",
"key",
",",
"$",
"value",
"=",
"null",
")",
"{",
"DotArr",
"::",
"set",
"(",
"$",
"this",
"->",
"data",
",",
"$",
"key",
",",
"$",
"value",
")",
";",
"}"
] | Sets a value to the dot-notated internal array.
@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.
@see DotArr::set | [
"Sets",
"a",
"value",
"to",
"the",
"dot",
"-",
"notated",
"internal",
"array",
"."
] | train | https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/Arr.php#L75-L78 |
axelitus/php-base | src/Arr.php | Arr.count | public function count($key = null)
{
if (is_null($key)) {
return count($this->data);
}
if (is_array($key)) {
$return = -1;
foreach ($key as $k) {
if ($this->has($k)) {
$return = max(0, $return);
$ret... | php | public function count($key = null)
{
if (is_null($key)) {
return count($this->data);
}
if (is_array($key)) {
$return = -1;
foreach ($key as $k) {
if ($this->has($k)) {
$return = max(0, $return);
$ret... | [
"public",
"function",
"count",
"(",
"$",
"key",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"key",
")",
")",
"{",
"return",
"count",
"(",
"$",
"this",
"->",
"data",
")",
";",
"}",
"if",
"(",
"is_array",
"(",
"$",
"key",
")",
")",
"... | (PHP 5 >= 5.1.0)<br/>
Count elements of an object
@link http://php.net/manual/en/countable.count.php
@param null|int|string|array $key The key to get the count from.
@throws \InvalidArgumentException
@return int The custom count as an integer.
</p>
<p>
The return value is cast to an integer.
If an array is given t... | [
"(",
"PHP",
"5",
">",
";",
"=",
"5",
".",
"1",
".",
"0",
")",
"<br",
"/",
">",
"Count",
"elements",
"of",
"an",
"object",
"@link",
"http",
":",
"//",
"php",
".",
"net",
"/",
"manual",
"/",
"en",
"/",
"countable",
".",
"count",
".",
"php"
] | train | https://github.com/axelitus/php-base/blob/c2da680c1f0c3ee93ae6a8be5adaacd0caf7d075/src/Arr.php#L220-L247 |
czim/laravel-pxlcms | src/Generator/Writer/Model/Steps/StubReplaceImportsAndTraits.php | StubReplaceImportsAndTraits.getImportsReplace | protected function getImportsReplace()
{
$importLines = $this->collectImportLines();
// set them in the right order
if (config('pxlcms.generator.aesthetics.sort_imports_by_string_length')) {
// sort from shortest to longest
usort($importLines, function ($a, $b) {
... | php | protected function getImportsReplace()
{
$importLines = $this->collectImportLines();
// set them in the right order
if (config('pxlcms.generator.aesthetics.sort_imports_by_string_length')) {
// sort from shortest to longest
usort($importLines, function ($a, $b) {
... | [
"protected",
"function",
"getImportsReplace",
"(",
")",
"{",
"$",
"importLines",
"=",
"$",
"this",
"->",
"collectImportLines",
"(",
")",
";",
"// set them in the right order",
"if",
"(",
"config",
"(",
"'pxlcms.generator.aesthetics.sort_imports_by_string_length'",
")",
... | Returns the replacement for the use use-imports placeholder
@return string | [
"Returns",
"the",
"replacement",
"for",
"the",
"use",
"use",
"-",
"imports",
"placeholder"
] | train | https://github.com/czim/laravel-pxlcms/blob/910297d2a3f2db86dde51b0e10fe5aad45f1aa1a/src/Generator/Writer/Model/Steps/StubReplaceImportsAndTraits.php#L191-L217 |
czim/laravel-pxlcms | src/Generator/Writer/Model/Steps/StubReplaceImportsAndTraits.php | StubReplaceImportsAndTraits.useScopeActive | protected function useScopeActive()
{
if (is_null($this->data['scope_active'])) {
return config('pxlcms.generator.models.scopes.only_active') === CmsModelWriter::SCOPE_GLOBAL;
}
return (bool) $this->data['scope_active'];
} | php | protected function useScopeActive()
{
if (is_null($this->data['scope_active'])) {
return config('pxlcms.generator.models.scopes.only_active') === CmsModelWriter::SCOPE_GLOBAL;
}
return (bool) $this->data['scope_active'];
} | [
"protected",
"function",
"useScopeActive",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"data",
"[",
"'scope_active'",
"]",
")",
")",
"{",
"return",
"config",
"(",
"'pxlcms.generator.models.scopes.only_active'",
")",
"===",
"CmsModelWriter",
"::"... | Returns whether we're using a global scope for active
@return bool | [
"Returns",
"whether",
"we",
"re",
"using",
"a",
"global",
"scope",
"for",
"active"
] | train | https://github.com/czim/laravel-pxlcms/blob/910297d2a3f2db86dde51b0e10fe5aad45f1aa1a/src/Generator/Writer/Model/Steps/StubReplaceImportsAndTraits.php#L364-L371 |
czim/laravel-pxlcms | src/Generator/Writer/Model/Steps/StubReplaceImportsAndTraits.php | StubReplaceImportsAndTraits.useScopePosition | protected function useScopePosition()
{
if (is_null($this->data['scope_position'])) {
return config('pxlcms.generator.models.scopes.position_order') === CmsModelWriter::SCOPE_GLOBAL;
}
return (bool) $this->data['scope_position'];
} | php | protected function useScopePosition()
{
if (is_null($this->data['scope_position'])) {
return config('pxlcms.generator.models.scopes.position_order') === CmsModelWriter::SCOPE_GLOBAL;
}
return (bool) $this->data['scope_position'];
} | [
"protected",
"function",
"useScopePosition",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"data",
"[",
"'scope_position'",
"]",
")",
")",
"{",
"return",
"config",
"(",
"'pxlcms.generator.models.scopes.position_order'",
")",
"===",
"CmsModelWriter",... | Returns whether we're using a global scope for position
@return bool | [
"Returns",
"whether",
"we",
"re",
"using",
"a",
"global",
"scope",
"for",
"position"
] | train | https://github.com/czim/laravel-pxlcms/blob/910297d2a3f2db86dde51b0e10fe5aad45f1aa1a/src/Generator/Writer/Model/Steps/StubReplaceImportsAndTraits.php#L378-L385 |
activecollab/databasestructure | src/Field/Composite/PositionField.php | PositionField.getBaseClassMethods | public function getBaseClassMethods($indent, array &$result)
{
$methods = [];
$methods[] = '/**';
$methods[] = ' * Return position mode.';
$methods[] = ' *';
$methods[] = ' * There are two modes:';
$methods[] = ' *';
$methods[] = ' * * head for new records to... | php | public function getBaseClassMethods($indent, array &$result)
{
$methods = [];
$methods[] = '/**';
$methods[] = ' * Return position mode.';
$methods[] = ' *';
$methods[] = ' * There are two modes:';
$methods[] = ' *';
$methods[] = ' * * head for new records to... | [
"public",
"function",
"getBaseClassMethods",
"(",
"$",
"indent",
",",
"array",
"&",
"$",
"result",
")",
"{",
"$",
"methods",
"=",
"[",
"]",
";",
"$",
"methods",
"[",
"]",
"=",
"'/**'",
";",
"$",
"methods",
"[",
"]",
"=",
"' * Return position mode.'",
"... | Return methods that this field needs to inject in base class.
@param string $indent
@param array $result | [
"Return",
"methods",
"that",
"this",
"field",
"needs",
"to",
"inject",
"in",
"base",
"class",
"."
] | train | https://github.com/activecollab/databasestructure/blob/4b2353c4422186bcfce63b3212da3e70e63eb5df/src/Field/Composite/PositionField.php#L155-L193 |
activecollab/databasestructure | src/Field/Composite/PositionField.php | PositionField.onAddedToType | public function onAddedToType(TypeInterface &$type)
{
parent::onAddedToType($type);
if ($this->getAddIndex()) {
$type->addIndex(new Index($this->name));
}
$type->addTrait(PositionInterface::class, PositionInterfaceImplementation::class);
} | php | public function onAddedToType(TypeInterface &$type)
{
parent::onAddedToType($type);
if ($this->getAddIndex()) {
$type->addIndex(new Index($this->name));
}
$type->addTrait(PositionInterface::class, PositionInterfaceImplementation::class);
} | [
"public",
"function",
"onAddedToType",
"(",
"TypeInterface",
"&",
"$",
"type",
")",
"{",
"parent",
"::",
"onAddedToType",
"(",
"$",
"type",
")",
";",
"if",
"(",
"$",
"this",
"->",
"getAddIndex",
"(",
")",
")",
"{",
"$",
"type",
"->",
"addIndex",
"(",
... | Method that is called when field is added to a type.
@param TypeInterface $type | [
"Method",
"that",
"is",
"called",
"when",
"field",
"is",
"added",
"to",
"a",
"type",
"."
] | train | https://github.com/activecollab/databasestructure/blob/4b2353c4422186bcfce63b3212da3e70e63eb5df/src/Field/Composite/PositionField.php#L200-L209 |
jan-dolata/crude-crud | src/Engine/Traits/FromModelWithOrderTrait.php | FromModelWithOrderTrait.resetOrder | public function resetOrder()
{
$param = $this->crudeSetup->getOrderParameters();
$idAttr = $param['idAttr'];
$orderAttr = $param['orderAttr'];
$all = $this->model
->orderBy($orderAttr)
->select($idAttr, $orderAttr)
->get();
$all = $all->m... | php | public function resetOrder()
{
$param = $this->crudeSetup->getOrderParameters();
$idAttr = $param['idAttr'];
$orderAttr = $param['orderAttr'];
$all = $this->model
->orderBy($orderAttr)
->select($idAttr, $orderAttr)
->get();
$all = $all->m... | [
"public",
"function",
"resetOrder",
"(",
")",
"{",
"$",
"param",
"=",
"$",
"this",
"->",
"crudeSetup",
"->",
"getOrderParameters",
"(",
")",
";",
"$",
"idAttr",
"=",
"$",
"param",
"[",
"'idAttr'",
"]",
";",
"$",
"orderAttr",
"=",
"$",
"param",
"[",
"... | Reset order | [
"Reset",
"order"
] | train | https://github.com/jan-dolata/crude-crud/blob/9129ea08278835cf5cecfd46a90369226ae6bdd7/src/Engine/Traits/FromModelWithOrderTrait.php#L26-L45 |
nicolasmure/NmureEncryptor | src/Formatter/Base64Formatter.php | Base64Formatter.parse | public function parse($input, $ivLength)
{
$parts = explode(':', $input);
if (2 !== sizeof($parts)) {
throw new ParsingException(sprintf('Unable to parse the given data with the "%s" formatter', get_class($this)));
}
return array(
self::KEY_IV => base64_deco... | php | public function parse($input, $ivLength)
{
$parts = explode(':', $input);
if (2 !== sizeof($parts)) {
throw new ParsingException(sprintf('Unable to parse the given data with the "%s" formatter', get_class($this)));
}
return array(
self::KEY_IV => base64_deco... | [
"public",
"function",
"parse",
"(",
"$",
"input",
",",
"$",
"ivLength",
")",
"{",
"$",
"parts",
"=",
"explode",
"(",
"':'",
",",
"$",
"input",
")",
";",
"if",
"(",
"2",
"!==",
"sizeof",
"(",
"$",
"parts",
")",
")",
"{",
"throw",
"new",
"ParsingEx... | {@inheritdoc} | [
"{"
] | train | https://github.com/nicolasmure/NmureEncryptor/blob/571b5311e7230f5a1241706edacbb2346624634d/src/Formatter/Base64Formatter.php#L20-L32 |
FrenchFrogs/framework | src/Modal/Renderer/Bootstrap.php | Bootstrap.modal | public function modal(Modal\Modal $modal)
{
$html = '';
// header
if ($modal->hasCloseButton()) {
$html .= html('button', ['type' => 'button', 'class' => 'close', 'data-dismiss' => 'modal', 'aria-label' => $modal->getCloseButtonLabel()], '<span aria-hidden="true">×</span>... | php | public function modal(Modal\Modal $modal)
{
$html = '';
// header
if ($modal->hasCloseButton()) {
$html .= html('button', ['type' => 'button', 'class' => 'close', 'data-dismiss' => 'modal', 'aria-label' => $modal->getCloseButtonLabel()], '<span aria-hidden="true">×</span>... | [
"public",
"function",
"modal",
"(",
"Modal",
"\\",
"Modal",
"$",
"modal",
")",
"{",
"$",
"html",
"=",
"''",
";",
"// header",
"if",
"(",
"$",
"modal",
"->",
"hasCloseButton",
"(",
")",
")",
"{",
"$",
"html",
".=",
"html",
"(",
"'button'",
",",
"[",... | Render a modal
@param \FrenchFrogs\Modal\Modal\Modal $modal
@return string | [
"Render",
"a",
"modal"
] | train | https://github.com/FrenchFrogs/framework/blob/a4838c698a5600437e87dac6d35ba8ebe32c4395/src/Modal/Renderer/Bootstrap.php#L33-L78 |
czim/laravel-pxlcms | src/Generator/Writer/Model/Steps/StubReplaceRelationData.php | StubReplaceRelationData.normalizeRelationsData | protected function normalizeRelationsData()
{
if (is_null($this->data['relationships'])) {
$this->data['relationships'] = [];
}
foreach ([ 'normal', 'reverse', 'image', 'file', 'checkbox', 'category' ] as $key) {
if ( ! array_key_exists($key, $this->data['relatio... | php | protected function normalizeRelationsData()
{
if (is_null($this->data['relationships'])) {
$this->data['relationships'] = [];
}
foreach ([ 'normal', 'reverse', 'image', 'file', 'checkbox', 'category' ] as $key) {
if ( ! array_key_exists($key, $this->data['relatio... | [
"protected",
"function",
"normalizeRelationsData",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"data",
"[",
"'relationships'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"data",
"[",
"'relationships'",
"]",
"=",
"[",
"]",
";",
"}",
"foreac... | Makes sure that expected relations data is traversable
@return $this | [
"Makes",
"sure",
"that",
"expected",
"relations",
"data",
"is",
"traversable"
] | train | https://github.com/czim/laravel-pxlcms/blob/910297d2a3f2db86dde51b0e10fe5aad45f1aa1a/src/Generator/Writer/Model/Steps/StubReplaceRelationData.php#L34-L50 |
czim/laravel-pxlcms | src/Generator/Writer/Model/Steps/StubReplaceRelationData.php | StubReplaceRelationData.prepareForCategoryRelation | protected function prepareForCategoryRelation()
{
// also handle category relation name, if necessary
if ($this->data['has_categories']) {
$this->determineCategoryRelationName();
// store the category name in the data
if ( ! empty($this->categoryRelationName)) {... | php | protected function prepareForCategoryRelation()
{
// also handle category relation name, if necessary
if ($this->data['has_categories']) {
$this->determineCategoryRelationName();
// store the category name in the data
if ( ! empty($this->categoryRelationName)) {... | [
"protected",
"function",
"prepareForCategoryRelation",
"(",
")",
"{",
"// also handle category relation name, if necessary",
"if",
"(",
"$",
"this",
"->",
"data",
"[",
"'has_categories'",
"]",
")",
"{",
"$",
"this",
"->",
"determineCategoryRelationName",
"(",
")",
";"... | Prepares data & name for category relation (if required)
@return $this | [
"Prepares",
"data",
"&",
"name",
"for",
"category",
"relation",
"(",
"if",
"required",
")"
] | train | https://github.com/czim/laravel-pxlcms/blob/910297d2a3f2db86dde51b0e10fe5aad45f1aa1a/src/Generator/Writer/Model/Steps/StubReplaceRelationData.php#L57-L74 |
czim/laravel-pxlcms | src/Generator/Writer/Model/Steps/StubReplaceRelationData.php | StubReplaceRelationData.getRelationsConfigReplace | protected function getRelationsConfigReplace()
{
$relationships = $this->collectRelationshipDataForConfig();
if ( ! count($relationships)) return '';
$replace = $this->tab() . "protected \$relationsConfig = [\n";
foreach ($relationships as $name => $relationship) {
$... | php | protected function getRelationsConfigReplace()
{
$relationships = $this->collectRelationshipDataForConfig();
if ( ! count($relationships)) return '';
$replace = $this->tab() . "protected \$relationsConfig = [\n";
foreach ($relationships as $name => $relationship) {
$... | [
"protected",
"function",
"getRelationsConfigReplace",
"(",
")",
"{",
"$",
"relationships",
"=",
"$",
"this",
"->",
"collectRelationshipDataForConfig",
"(",
")",
";",
"if",
"(",
"!",
"count",
"(",
"$",
"relationships",
")",
")",
"return",
"''",
";",
"$",
"rep... | Returns the replacement for the relations config placeholder
@return string | [
"Returns",
"the",
"replacement",
"for",
"the",
"relations",
"config",
"placeholder"
] | train | https://github.com/czim/laravel-pxlcms/blob/910297d2a3f2db86dde51b0e10fe5aad45f1aa1a/src/Generator/Writer/Model/Steps/StubReplaceRelationData.php#L82-L127 |
czim/laravel-pxlcms | src/Generator/Writer/Model/Steps/StubReplaceRelationData.php | StubReplaceRelationData.getRelationshipsReplace | protected function getRelationshipsReplace()
{
$totalCount = $this->getTotalRelevantRelationshipCount();
if ( ! $totalCount) return '';
$replace = "\n" . $this->getRelationshipsIntro();
$replace .= $this->getReplaceForNormalRelationships()
. $this->getReplaceFor... | php | protected function getRelationshipsReplace()
{
$totalCount = $this->getTotalRelevantRelationshipCount();
if ( ! $totalCount) return '';
$replace = "\n" . $this->getRelationshipsIntro();
$replace .= $this->getReplaceForNormalRelationships()
. $this->getReplaceFor... | [
"protected",
"function",
"getRelationshipsReplace",
"(",
")",
"{",
"$",
"totalCount",
"=",
"$",
"this",
"->",
"getTotalRelevantRelationshipCount",
"(",
")",
";",
"if",
"(",
"!",
"$",
"totalCount",
")",
"return",
"''",
";",
"$",
"replace",
"=",
"\"\\n\"",
"."... | Returns the replacement for the relationships placeholder
@return string | [
"Returns",
"the",
"replacement",
"for",
"the",
"relationships",
"placeholder"
] | train | https://github.com/czim/laravel-pxlcms/blob/910297d2a3f2db86dde51b0e10fe5aad45f1aa1a/src/Generator/Writer/Model/Steps/StubReplaceRelationData.php#L183-L196 |
czim/laravel-pxlcms | src/Generator/Writer/Model/Steps/StubReplaceRelationData.php | StubReplaceRelationData.getTotalRelevantRelationshipCount | protected function getTotalRelevantRelationshipCount()
{
return count($this->getCombinedRelationships())
+ count( $this->data['relationships']['image'] )
+ count( $this->data['relationships']['file'] )
+ count( $this->data['relationships']['checkbox'] )
+ ... | php | protected function getTotalRelevantRelationshipCount()
{
return count($this->getCombinedRelationships())
+ count( $this->data['relationships']['image'] )
+ count( $this->data['relationships']['file'] )
+ count( $this->data['relationships']['checkbox'] )
+ ... | [
"protected",
"function",
"getTotalRelevantRelationshipCount",
"(",
")",
"{",
"return",
"count",
"(",
"$",
"this",
"->",
"getCombinedRelationships",
"(",
")",
")",
"+",
"count",
"(",
"$",
"this",
"->",
"data",
"[",
"'relationships'",
"]",
"[",
"'image'",
"]",
... | Returns the number of relationships to be considered
for building up the stub replacement.
@return mixed | [
"Returns",
"the",
"number",
"of",
"relationships",
"to",
"be",
"considered",
"for",
"building",
"up",
"the",
"stub",
"replacement",
"."
] | train | https://github.com/czim/laravel-pxlcms/blob/910297d2a3f2db86dde51b0e10fe5aad45f1aa1a/src/Generator/Writer/Model/Steps/StubReplaceRelationData.php#L215-L222 |
czim/laravel-pxlcms | src/Generator/Writer/Model/Steps/StubReplaceRelationData.php | StubReplaceRelationData.determineCategoryRelationName | protected function determineCategoryRelationName()
{
// pick a name and see if it conflicts with anything
$tryNames = config('pxlcms.generator.standard_models.category_relation_names', []);
$this->categoryRelationName = null;
foreach ($tryNames as $tryName) {
$tryName ... | php | protected function determineCategoryRelationName()
{
// pick a name and see if it conflicts with anything
$tryNames = config('pxlcms.generator.standard_models.category_relation_names', []);
$this->categoryRelationName = null;
foreach ($tryNames as $tryName) {
$tryName ... | [
"protected",
"function",
"determineCategoryRelationName",
"(",
")",
"{",
"// pick a name and see if it conflicts with anything",
"$",
"tryNames",
"=",
"config",
"(",
"'pxlcms.generator.standard_models.category_relation_names'",
",",
"[",
"]",
")",
";",
"$",
"this",
"->",
"c... | Attempts to determine a non-conflicting name for the relationship to the Category model
@return string|false | [
"Attempts",
"to",
"determine",
"a",
"non",
"-",
"conflicting",
"name",
"for",
"the",
"relationship",
"to",
"the",
"Category",
"model"
] | train | https://github.com/czim/laravel-pxlcms/blob/910297d2a3f2db86dde51b0e10fe5aad45f1aa1a/src/Generator/Writer/Model/Steps/StubReplaceRelationData.php#L351-L378 |
czim/laravel-pxlcms | src/Generator/Writer/Model/Steps/StubReplaceRelationData.php | StubReplaceRelationData.doesRelationNameConflict | protected function doesRelationNameConflict($name)
{
// relationships
$relationships = array_merge(
$this->data['relationships']['normal'],
$this->data['relationships']['reverse'],
$this->data['relationships']['image'],
$this->data['relationships']['fi... | php | protected function doesRelationNameConflict($name)
{
// relationships
$relationships = array_merge(
$this->data['relationships']['normal'],
$this->data['relationships']['reverse'],
$this->data['relationships']['image'],
$this->data['relationships']['fi... | [
"protected",
"function",
"doesRelationNameConflict",
"(",
"$",
"name",
")",
"{",
"// relationships",
"$",
"relationships",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"data",
"[",
"'relationships'",
"]",
"[",
"'normal'",
"]",
",",
"$",
"this",
"->",
"data",
... | Returns whether a given name is already in use by anything that it would conflict with
for this model
@param string $name
@return bool | [
"Returns",
"whether",
"a",
"given",
"name",
"is",
"already",
"in",
"use",
"by",
"anything",
"that",
"it",
"would",
"conflict",
"with",
"for",
"this",
"model"
] | train | https://github.com/czim/laravel-pxlcms/blob/910297d2a3f2db86dde51b0e10fe5aad45f1aa1a/src/Generator/Writer/Model/Steps/StubReplaceRelationData.php#L387-L409 |
czim/laravel-pxlcms | src/Generator/Writer/Model/Steps/StubReplaceRelationData.php | StubReplaceRelationData.getRelationMethodSection | protected function getRelationMethodSection(array $relationships, $type = CmsModel::RELATION_TYPE_MODEL)
{
$replace = '';
$relatedClassName = $this->context->getModelNamespaceForSpecialModel($type);
foreach ($relationships as $name => $relationship) {
$relationParameters ... | php | protected function getRelationMethodSection(array $relationships, $type = CmsModel::RELATION_TYPE_MODEL)
{
$replace = '';
$relatedClassName = $this->context->getModelNamespaceForSpecialModel($type);
foreach ($relationships as $name => $relationship) {
$relationParameters ... | [
"protected",
"function",
"getRelationMethodSection",
"(",
"array",
"$",
"relationships",
",",
"$",
"type",
"=",
"CmsModel",
"::",
"RELATION_TYPE_MODEL",
")",
"{",
"$",
"replace",
"=",
"''",
";",
"$",
"relatedClassName",
"=",
"$",
"this",
"->",
"context",
"->",... | Returns stub section for relation method
@param array $relationships
@param int|null $type CmsModel::RELATION_TYPE_...
@return string | [
"Returns",
"stub",
"section",
"for",
"relation",
"method"
] | train | https://github.com/czim/laravel-pxlcms/blob/910297d2a3f2db86dde51b0e10fe5aad45f1aa1a/src/Generator/Writer/Model/Steps/StubReplaceRelationData.php#L418-L467 |
Teamsisu/contao-mm-frontendInput | src/Teamsisu/MetaModelsFrontendInput/DataContainer/Field/MMAttributeField.php | MMAttributeField.setDefaultValue | public function setDefaultValue($value)
{
$value = $this->mmAttribute->valueToWidget($value);
$this->set('value', $value);
} | php | public function setDefaultValue($value)
{
$value = $this->mmAttribute->valueToWidget($value);
$this->set('value', $value);
} | [
"public",
"function",
"setDefaultValue",
"(",
"$",
"value",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"mmAttribute",
"->",
"valueToWidget",
"(",
"$",
"value",
")",
";",
"$",
"this",
"->",
"set",
"(",
"'value'",
",",
"$",
"value",
")",
";",
"}"
... | Set the default value of the Attribute
@param mixed $value | [
"Set",
"the",
"default",
"value",
"of",
"the",
"Attribute"
] | train | https://github.com/Teamsisu/contao-mm-frontendInput/blob/ab92e61c24644f1e61265304b6a35e505007d021/src/Teamsisu/MetaModelsFrontendInput/DataContainer/Field/MMAttributeField.php#L153-L159 |
huasituo/hstcms | src/Libraries/HstcmsError.php | HstcmsError.addError | public function addError($error, $var = array(), $data = array()) {
if (!$error) return false;
$tmp = new HstcmsErrorTmp();
$tmp->msg = $var ? array($error, $var) : $error;
$tmp->data = $data;
$this->error[] = $tmp;
return true;
} | php | public function addError($error, $var = array(), $data = array()) {
if (!$error) return false;
$tmp = new HstcmsErrorTmp();
$tmp->msg = $var ? array($error, $var) : $error;
$tmp->data = $data;
$this->error[] = $tmp;
return true;
} | [
"public",
"function",
"addError",
"(",
"$",
"error",
",",
"$",
"var",
"=",
"array",
"(",
")",
",",
"$",
"data",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"$",
"error",
")",
"return",
"false",
";",
"$",
"tmp",
"=",
"new",
"HstcmsErrorTmp",... | 添加错误信息
@param string $error 错误信息
@param array $var 错误信息中包含的错误输出变量,格式如{key}=>'value',在message中存在{key}
<pre>
比如message中存在一条:
login.error.pwd="帐号或密码错误,您还可以尝试{num}次"
在返回该条错误的时候
$error = new Pw('USER:login.error.pwd', array('{num}' => 5));
</pre>
@param array $data 错误数据
@return boolean | [
"添加错误信息"
] | train | https://github.com/huasituo/hstcms/blob/12819979289e58ce38e3e92540aeeb16e205e525/src/Libraries/HstcmsError.php#L47-L54 |
huasituo/hstcms | src/Libraries/HstcmsError.php | HstcmsError.getError | public function getError($isAll = false) {
if ($isAll !== false) {
return $this->error;
} else {
$tmp = end($this->error);
return $tmp ? $tmp->msg : '';
}
} | php | public function getError($isAll = false) {
if ($isAll !== false) {
return $this->error;
} else {
$tmp = end($this->error);
return $tmp ? $tmp->msg : '';
}
} | [
"public",
"function",
"getError",
"(",
"$",
"isAll",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"isAll",
"!==",
"false",
")",
"{",
"return",
"$",
"this",
"->",
"error",
";",
"}",
"else",
"{",
"$",
"tmp",
"=",
"end",
"(",
"$",
"this",
"->",
"error",
... | 获取错误信息
@param boolean $isAll 是否返回所有的错误信息
@return string | [
"获取错误信息"
] | train | https://github.com/huasituo/hstcms/blob/12819979289e58ce38e3e92540aeeb16e205e525/src/Libraries/HstcmsError.php#L62-L69 |
phramework/validate | src/ObjectValidator.php | ObjectValidator.validate | public function validate($value)
{
$return = new ValidateResult($value, false);
$failure = null;
if (!is_object($value)) {
$failure = 'type';
//error
goto err;
}
$valueProperties = get_object_vars($value);
$valuePropertiesCount =... | php | public function validate($value)
{
$return = new ValidateResult($value, false);
$failure = null;
if (!is_object($value)) {
$failure = 'type';
//error
goto err;
}
$valueProperties = get_object_vars($value);
$valuePropertiesCount =... | [
"public",
"function",
"validate",
"(",
"$",
"value",
")",
"{",
"$",
"return",
"=",
"new",
"ValidateResult",
"(",
"$",
"value",
",",
"false",
")",
";",
"$",
"failure",
"=",
"null",
";",
"if",
"(",
"!",
"is_object",
"(",
"$",
"value",
")",
")",
"{",
... | Validate value
@see \Phramework\Validate\ValidateResult for ValidateResult object
@param object $value Value to validate
@return ValidateResult
@todo clean up failure of recursive objects | [
"Validate",
"value"
] | train | https://github.com/phramework/validate/blob/22dd3c4e5f7a77a1a75d92f98444f3e4b7ce5cfc/src/ObjectValidator.php#L142-L468 |
phramework/validate | src/ObjectValidator.php | ObjectValidator.parse | public function parse($value)
{
if (is_array($value)) {
$value = (object) $value;
}
return parent::parse($value);
} | php | public function parse($value)
{
if (is_array($value)) {
$value = (object) $value;
}
return parent::parse($value);
} | [
"public",
"function",
"parse",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"value",
")",
")",
"{",
"$",
"value",
"=",
"(",
"object",
")",
"$",
"value",
";",
"}",
"return",
"parent",
"::",
"parse",
"(",
"$",
"value",
")",
";",
... | This method use this validator to parse data from $value argument
and return a clean object
@param array|object $value Input value to validate
@throws \Phramework\Exceptions\MissingParametersException
@throws \Phramework\Exceptions\IncorrectParametersException
@return object
@todo find out if MissingParameters
@todo a... | [
"This",
"method",
"use",
"this",
"validator",
"to",
"parse",
"data",
"from",
"$value",
"argument",
"and",
"return",
"a",
"clean",
"object"
] | train | https://github.com/phramework/validate/blob/22dd3c4e5f7a77a1a75d92f98444f3e4b7ce5cfc/src/ObjectValidator.php#L481-L488 |
phramework/validate | src/ObjectValidator.php | ObjectValidator.addProperties | public function addProperties($properties)
{
if (empty($properties) || !count((array)$properties)) {
throw new \Exception('Empty properties given');
}
if (!is_array($properties) && !is_object($properties)) {
throw new \Exception('Expected array or object');
}... | php | public function addProperties($properties)
{
if (empty($properties) || !count((array)$properties)) {
throw new \Exception('Empty properties given');
}
if (!is_array($properties) && !is_object($properties)) {
throw new \Exception('Expected array or object');
}... | [
"public",
"function",
"addProperties",
"(",
"$",
"properties",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"properties",
")",
"||",
"!",
"count",
"(",
"(",
"array",
")",
"$",
"properties",
")",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"'Empty prop... | Add properties to this object validator
@param array||object $properties [description]
@throws \Exception If properties is not an array | [
"Add",
"properties",
"to",
"this",
"object",
"validator"
] | train | https://github.com/phramework/validate/blob/22dd3c4e5f7a77a1a75d92f98444f3e4b7ce5cfc/src/ObjectValidator.php#L495-L510 |
phramework/validate | src/ObjectValidator.php | ObjectValidator.addProperty | public function addProperty($key, BaseValidator $property)
{
if (property_exists($this->properties, $key)) {
throw new \Exception('Property key exists');
}
//Add this key, value to
$this->properties->{$key} = $property;
return $this;
} | php | public function addProperty($key, BaseValidator $property)
{
if (property_exists($this->properties, $key)) {
throw new \Exception('Property key exists');
}
//Add this key, value to
$this->properties->{$key} = $property;
return $this;
} | [
"public",
"function",
"addProperty",
"(",
"$",
"key",
",",
"BaseValidator",
"$",
"property",
")",
"{",
"if",
"(",
"property_exists",
"(",
"$",
"this",
"->",
"properties",
",",
"$",
"key",
")",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"'Property ... | Add a property to this object validator
@param BaseValidator $property
@throws \Exception If property key exists | [
"Add",
"a",
"property",
"to",
"this",
"object",
"validator"
] | train | https://github.com/phramework/validate/blob/22dd3c4e5f7a77a1a75d92f98444f3e4b7ce5cfc/src/ObjectValidator.php#L517-L527 |
movoin/one-swoole | src/Logging/Logger.php | Logger.getLogger | public function getLogger(): MonoLogger
{
if ($this->logger === null) {
$this->logger = new MonoLogger($this->name);
$this->logger->pushHandler(new StreamHandler($this->logfile));
}
return $this->logger;
} | php | public function getLogger(): MonoLogger
{
if ($this->logger === null) {
$this->logger = new MonoLogger($this->name);
$this->logger->pushHandler(new StreamHandler($this->logfile));
}
return $this->logger;
} | [
"public",
"function",
"getLogger",
"(",
")",
":",
"MonoLogger",
"{",
"if",
"(",
"$",
"this",
"->",
"logger",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"logger",
"=",
"new",
"MonoLogger",
"(",
"$",
"this",
"->",
"name",
")",
";",
"$",
"this",
"->"... | 获得日志操作句柄
@return \Monolog\Logger | [
"获得日志操作句柄"
] | train | https://github.com/movoin/one-swoole/blob/b9b175963ead91416cc50902a04e05ff3ef571de/src/Logging/Logger.php#L69-L77 |
stubbles/stubbles-webapp-core | src/main/php/routing/CalledUri.php | CalledUri.castFrom | public static function castFrom($requestUri, string $requestMethod = null)
{
if ($requestUri instanceof self) {
return $requestUri;
}
return new self($requestUri, (string) $requestMethod);
} | php | public static function castFrom($requestUri, string $requestMethod = null)
{
if ($requestUri instanceof self) {
return $requestUri;
}
return new self($requestUri, (string) $requestMethod);
} | [
"public",
"static",
"function",
"castFrom",
"(",
"$",
"requestUri",
",",
"string",
"$",
"requestMethod",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"requestUri",
"instanceof",
"self",
")",
"{",
"return",
"$",
"requestUri",
";",
"}",
"return",
"new",
"self",
... | casts given values to an instance of UriRequest
@param string|\stubbles\webapp\routing\CalledUri $requestUri
@param string $requestMethod
@return \stubbles\webapp\routing\CalledUri
@since 4.0.0 | [
"casts",
"given",
"values",
"to",
"an",
"instance",
"of",
"UriRequest"
] | train | https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/routing/CalledUri.php#L59-L66 |
stubbles/stubbles-webapp-core | src/main/php/routing/CalledUri.php | CalledUri.methodEquals | public function methodEquals(string $method = null): bool
{
if (empty($method)) {
return true;
}
return $this->method === $method;
} | php | public function methodEquals(string $method = null): bool
{
if (empty($method)) {
return true;
}
return $this->method === $method;
} | [
"public",
"function",
"methodEquals",
"(",
"string",
"$",
"method",
"=",
"null",
")",
":",
"bool",
"{",
"if",
"(",
"empty",
"(",
"$",
"method",
")",
")",
"{",
"return",
"true",
";",
"}",
"return",
"$",
"this",
"->",
"method",
"===",
"$",
"method",
... | checks if request method equals given method
@param string $method
@return bool | [
"checks",
"if",
"request",
"method",
"equals",
"given",
"method"
] | train | https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/routing/CalledUri.php#L85-L92 |
stubbles/stubbles-webapp-core | src/main/php/routing/CalledUri.php | CalledUri.satisfiesPath | public function satisfiesPath(string $expectedPath = null): bool
{
if (empty($expectedPath)) {
return true;
}
if (preg_match('/^' . UriPath::pattern($expectedPath) . '/', $this->uri->path()) >= 1) {
return true;
}
return false;
} | php | public function satisfiesPath(string $expectedPath = null): bool
{
if (empty($expectedPath)) {
return true;
}
if (preg_match('/^' . UriPath::pattern($expectedPath) . '/', $this->uri->path()) >= 1) {
return true;
}
return false;
} | [
"public",
"function",
"satisfiesPath",
"(",
"string",
"$",
"expectedPath",
"=",
"null",
")",
":",
"bool",
"{",
"if",
"(",
"empty",
"(",
"$",
"expectedPath",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"preg_match",
"(",
"'/^'",
".",
"UriPath"... | checks if given path is satisfied by request path
@param string $expectedPath
@return bool | [
"checks",
"if",
"given",
"path",
"is",
"satisfied",
"by",
"request",
"path"
] | train | https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/routing/CalledUri.php#L100-L111 |
stubbles/stubbles-webapp-core | src/main/php/routing/CalledUri.php | CalledUri.satisfies | public function satisfies(string $method = null, string $expectedPath = null): bool
{
return $this->methodEquals($method) && $this->satisfiesPath($expectedPath);
} | php | public function satisfies(string $method = null, string $expectedPath = null): bool
{
return $this->methodEquals($method) && $this->satisfiesPath($expectedPath);
} | [
"public",
"function",
"satisfies",
"(",
"string",
"$",
"method",
"=",
"null",
",",
"string",
"$",
"expectedPath",
"=",
"null",
")",
":",
"bool",
"{",
"return",
"$",
"this",
"->",
"methodEquals",
"(",
"$",
"method",
")",
"&&",
"$",
"this",
"->",
"satisf... | checks if given method and path is satisfied by request
@param string $method
@param string $expectedPath
@return bool
@since 3.4.0 | [
"checks",
"if",
"given",
"method",
"and",
"path",
"is",
"satisfied",
"by",
"request"
] | train | https://github.com/stubbles/stubbles-webapp-core/blob/7705f129011a81d5cc3c76b4b150fab3dadac6a3/src/main/php/routing/CalledUri.php#L121-L124 |
gdbots/pbjx-bundle-php | src/ContainerAwareServiceLocator.php | ContainerAwareServiceLocator.getHandler | protected function getHandler(SchemaCurie $curie)
{
$key = $curie->toString();
if (isset($this->handlers[$key])) {
return $this->handlers[$key];
}
if (isset($this->registeredHandlers[$key])) {
$this->handlers[$key] = $this->registeredHandlers[$key]();
... | php | protected function getHandler(SchemaCurie $curie)
{
$key = $curie->toString();
if (isset($this->handlers[$key])) {
return $this->handlers[$key];
}
if (isset($this->registeredHandlers[$key])) {
$this->handlers[$key] = $this->registeredHandlers[$key]();
... | [
"protected",
"function",
"getHandler",
"(",
"SchemaCurie",
"$",
"curie",
")",
"{",
"$",
"key",
"=",
"$",
"curie",
"->",
"toString",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"handlers",
"[",
"$",
"key",
"]",
")",
")",
"{",
"return"... | @param SchemaCurie $curie
@return CommandHandler|RequestHandler
@throws HandlerNotFound | [
"@param",
"SchemaCurie",
"$curie"
] | train | https://github.com/gdbots/pbjx-bundle-php/blob/f3c0088583879fc92f13247a0752634bd8696eac/src/ContainerAwareServiceLocator.php#L170-L185 |
gdbots/pbjx-bundle-php | src/ContainerAwareServiceLocator.php | ContainerAwareServiceLocator.getTransportForBus | protected function getTransportForBus(string $name): Transport
{
if ($this->forceTransportsToInMemory) {
return $this->container->get('gdbots_pbjx.transport.in_memory');
}
$transport = $this->container->getParameter('gdbots_pbjx.' . $name . '_bus.transport');
if (empty($... | php | protected function getTransportForBus(string $name): Transport
{
if ($this->forceTransportsToInMemory) {
return $this->container->get('gdbots_pbjx.transport.in_memory');
}
$transport = $this->container->getParameter('gdbots_pbjx.' . $name . '_bus.transport');
if (empty($... | [
"protected",
"function",
"getTransportForBus",
"(",
"string",
"$",
"name",
")",
":",
"Transport",
"{",
"if",
"(",
"$",
"this",
"->",
"forceTransportsToInMemory",
")",
"{",
"return",
"$",
"this",
"->",
"container",
"->",
"get",
"(",
"'gdbots_pbjx.transport.in_mem... | @param string $name name of the bus, one of command, event or request
@return Transport
@throws \Throwable | [
"@param",
"string",
"$name",
"name",
"of",
"the",
"bus",
"one",
"of",
"command",
"event",
"or",
"request"
] | train | https://github.com/gdbots/pbjx-bundle-php/blob/f3c0088583879fc92f13247a0752634bd8696eac/src/ContainerAwareServiceLocator.php#L207-L219 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.