id int32 0 241k | repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 |
|---|---|---|---|---|---|---|---|---|---|---|---|
194,300 | RudyMas/Emvc_Menu | src/Menu.php | Menu.setBootstrapBrandImage | public function setBootstrapBrandImage(string $link, int $size = 30): void
{
$this->bootstrapOptions['brand']['image']['link'] = $link;
$this->bootstrapOptions['brand']['image']['size'] = $size;
} | php | public function setBootstrapBrandImage(string $link, int $size = 30): void
{
$this->bootstrapOptions['brand']['image']['link'] = $link;
$this->bootstrapOptions['brand']['image']['size'] = $size;
} | [
"public",
"function",
"setBootstrapBrandImage",
"(",
"string",
"$",
"link",
",",
"int",
"$",
"size",
"=",
"30",
")",
":",
"void",
"{",
"$",
"this",
"->",
"bootstrapOptions",
"[",
"'brand'",
"]",
"[",
"'image'",
"]",
"[",
"'link'",
"]",
"=",
"$",
"link"... | Set Bootstrap brand image
@param string $link
@param int $size | [
"Set",
"Bootstrap",
"brand",
"image"
] | 5765ec7e7193866de19e7a039a347ac4ed3bf952 | https://github.com/RudyMas/Emvc_Menu/blob/5765ec7e7193866de19e7a039a347ac4ed3bf952/src/Menu.php#L174-L178 |
194,301 | zhaoxianfang/tools | src/Symfony/Component/DependencyInjection/ContainerBuilder.php | ContainerBuilder.getReflectionClass | public function getReflectionClass($class, $throw = true)
{
if (!$class = $this->getParameterBag()->resolveValue($class)) {
return;
}
if (isset(self::$internalTypes[$class])) {
return null;
}
$resource = null;
try {
if (isset($th... | php | public function getReflectionClass($class, $throw = true)
{
if (!$class = $this->getParameterBag()->resolveValue($class)) {
return;
}
if (isset(self::$internalTypes[$class])) {
return null;
}
$resource = null;
try {
if (isset($th... | [
"public",
"function",
"getReflectionClass",
"(",
"$",
"class",
",",
"$",
"throw",
"=",
"true",
")",
"{",
"if",
"(",
"!",
"$",
"class",
"=",
"$",
"this",
"->",
"getParameterBag",
"(",
")",
"->",
"resolveValue",
"(",
"$",
"class",
")",
")",
"{",
"retur... | Retrieves the requested reflection class and registers it for resource tracking.
@param string $class
@param bool $throw
@return \ReflectionClass|null
@throws \ReflectionException when a parent class/interface/trait is not found and $throw is true
@final | [
"Retrieves",
"the",
"requested",
"reflection",
"class",
"and",
"registers",
"it",
"for",
"resource",
"tracking",
"."
] | d8fc8a9ecd75b5ce4236f0a2e9fdc055108573e7 | https://github.com/zhaoxianfang/tools/blob/d8fc8a9ecd75b5ce4236f0a2e9fdc055108573e7/src/Symfony/Component/DependencyInjection/ContainerBuilder.php#L353-L395 |
194,302 | zhaoxianfang/tools | src/Symfony/Component/DependencyInjection/ContainerBuilder.php | ContainerBuilder.fileExists | public function fileExists($path, $trackContents = true)
{
$exists = file_exists($path);
if (!$this->trackResources || $this->inVendors($path)) {
return $exists;
}
if (!$exists) {
$this->addResource(new FileExistenceResource($path));
return $exi... | php | public function fileExists($path, $trackContents = true)
{
$exists = file_exists($path);
if (!$this->trackResources || $this->inVendors($path)) {
return $exists;
}
if (!$exists) {
$this->addResource(new FileExistenceResource($path));
return $exi... | [
"public",
"function",
"fileExists",
"(",
"$",
"path",
",",
"$",
"trackContents",
"=",
"true",
")",
"{",
"$",
"exists",
"=",
"file_exists",
"(",
"$",
"path",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"trackResources",
"||",
"$",
"this",
"->",
"inVe... | Checks whether the requested file or directory exists and registers the result for resource tracking.
@param string $path The file or directory path for which to check the existence
@param bool|string $trackContents Whether to track contents of the given resource. If a string is passed,
it will be used a... | [
"Checks",
"whether",
"the",
"requested",
"file",
"or",
"directory",
"exists",
"and",
"registers",
"the",
"result",
"for",
"resource",
"tracking",
"."
] | d8fc8a9ecd75b5ce4236f0a2e9fdc055108573e7 | https://github.com/zhaoxianfang/tools/blob/d8fc8a9ecd75b5ce4236f0a2e9fdc055108573e7/src/Symfony/Component/DependencyInjection/ContainerBuilder.php#L408-L433 |
194,303 | zhaoxianfang/tools | src/Symfony/Component/DependencyInjection/ContainerBuilder.php | ContainerBuilder.getServiceConditionals | public static function getServiceConditionals($value)
{
$services = array();
if (is_array($value)) {
foreach ($value as $v) {
$services = array_unique(array_merge($services, self::getServiceConditionals($v)));
}
} elseif ($value instanceof Reference &... | php | public static function getServiceConditionals($value)
{
$services = array();
if (is_array($value)) {
foreach ($value as $v) {
$services = array_unique(array_merge($services, self::getServiceConditionals($v)));
}
} elseif ($value instanceof Reference &... | [
"public",
"static",
"function",
"getServiceConditionals",
"(",
"$",
"value",
")",
"{",
"$",
"services",
"=",
"array",
"(",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"value",
")",
")",
"{",
"foreach",
"(",
"$",
"value",
"as",
"$",
"v",
")",
"{",
"$... | Returns the Service Conditionals.
@param mixed $value An array of conditionals to return
@return array An array of Service conditionals
@internal since version 3.4 | [
"Returns",
"the",
"Service",
"Conditionals",
"."
] | d8fc8a9ecd75b5ce4236f0a2e9fdc055108573e7 | https://github.com/zhaoxianfang/tools/blob/d8fc8a9ecd75b5ce4236f0a2e9fdc055108573e7/src/Symfony/Component/DependencyInjection/ContainerBuilder.php#L1506-L1519 |
194,304 | zhaoxianfang/tools | src/Symfony/Component/DependencyInjection/ContainerBuilder.php | ContainerBuilder.getInitializedConditionals | public static function getInitializedConditionals($value)
{
$services = array();
if (is_array($value)) {
foreach ($value as $v) {
$services = array_unique(array_merge($services, self::getInitializedConditionals($v)));
}
} elseif ($value instanceof Ref... | php | public static function getInitializedConditionals($value)
{
$services = array();
if (is_array($value)) {
foreach ($value as $v) {
$services = array_unique(array_merge($services, self::getInitializedConditionals($v)));
}
} elseif ($value instanceof Ref... | [
"public",
"static",
"function",
"getInitializedConditionals",
"(",
"$",
"value",
")",
"{",
"$",
"services",
"=",
"array",
"(",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"value",
")",
")",
"{",
"foreach",
"(",
"$",
"value",
"as",
"$",
"v",
")",
"{",
... | Returns the initialized conditionals.
@param mixed $value An array of conditionals to return
@return array An array of uninitialized conditionals
@internal | [
"Returns",
"the",
"initialized",
"conditionals",
"."
] | d8fc8a9ecd75b5ce4236f0a2e9fdc055108573e7 | https://github.com/zhaoxianfang/tools/blob/d8fc8a9ecd75b5ce4236f0a2e9fdc055108573e7/src/Symfony/Component/DependencyInjection/ContainerBuilder.php#L1530-L1543 |
194,305 | zhaoxianfang/tools | src/Symfony/Component/DependencyInjection/ContainerBuilder.php | ContainerBuilder.hash | public static function hash($value)
{
$hash = substr(base64_encode(hash('sha256', serialize($value), true)), 0, 7);
return str_replace(array('/', '+'), array('.', '_'), strtolower($hash));
} | php | public static function hash($value)
{
$hash = substr(base64_encode(hash('sha256', serialize($value), true)), 0, 7);
return str_replace(array('/', '+'), array('.', '_'), strtolower($hash));
} | [
"public",
"static",
"function",
"hash",
"(",
"$",
"value",
")",
"{",
"$",
"hash",
"=",
"substr",
"(",
"base64_encode",
"(",
"hash",
"(",
"'sha256'",
",",
"serialize",
"(",
"$",
"value",
")",
",",
"true",
")",
")",
",",
"0",
",",
"7",
")",
";",
"r... | Computes a reasonably unique hash of a value.
@param mixed $value A serializable value
@return string | [
"Computes",
"a",
"reasonably",
"unique",
"hash",
"of",
"a",
"value",
"."
] | d8fc8a9ecd75b5ce4236f0a2e9fdc055108573e7 | https://github.com/zhaoxianfang/tools/blob/d8fc8a9ecd75b5ce4236f0a2e9fdc055108573e7/src/Symfony/Component/DependencyInjection/ContainerBuilder.php#L1552-L1557 |
194,306 | facile-it/sentry-common | src/StackTrace/StackTrace.php | StackTrace.getExceptions | public function getExceptions(\Throwable $exception): array
{
$exc = $exception;
do {
$exc_data = [
'value' => $this->serializer->serialize($exc->getMessage()),
'type' => get_class($exc),
];
/**'exception'
* Exception:... | php | public function getExceptions(\Throwable $exception): array
{
$exc = $exception;
do {
$exc_data = [
'value' => $this->serializer->serialize($exc->getMessage()),
'type' => get_class($exc),
];
/**'exception'
* Exception:... | [
"public",
"function",
"getExceptions",
"(",
"\\",
"Throwable",
"$",
"exception",
")",
":",
"array",
"{",
"$",
"exc",
"=",
"$",
"exception",
";",
"do",
"{",
"$",
"exc_data",
"=",
"[",
"'value'",
"=>",
"$",
"this",
"->",
"serializer",
"->",
"serialize",
... | Generate exceptions data for Sentry
@param \Throwable $exception
@return array | [
"Generate",
"exceptions",
"data",
"for",
"Sentry"
] | 63ca40700e19363e6af94c69ef8f0f889ba031bd | https://github.com/facile-it/sentry-common/blob/63ca40700e19363e6af94c69ef8f0f889ba031bd/src/StackTrace/StackTrace.php#L66-L95 |
194,307 | facile-it/sentry-common | src/StackTrace/StackTrace.php | StackTrace.getStackTraceFrames | public function getStackTraceFrames(array $trace): array
{
return \Raven_Stacktrace::get_stack_info(
$trace,
$this->client->trace,
[],
$this->client->message_limit,
$this->client->getPrefixes(),
$this->client->getAppPath(),
... | php | public function getStackTraceFrames(array $trace): array
{
return \Raven_Stacktrace::get_stack_info(
$trace,
$this->client->trace,
[],
$this->client->message_limit,
$this->client->getPrefixes(),
$this->client->getAppPath(),
... | [
"public",
"function",
"getStackTraceFrames",
"(",
"array",
"$",
"trace",
")",
":",
"array",
"{",
"return",
"\\",
"Raven_Stacktrace",
"::",
"get_stack_info",
"(",
"$",
"trace",
",",
"$",
"this",
"->",
"client",
"->",
"trace",
",",
"[",
"]",
",",
"$",
"thi... | Generate StackTrace frames for Sentry
@param array $trace
@return array | [
"Generate",
"StackTrace",
"frames",
"for",
"Sentry"
] | 63ca40700e19363e6af94c69ef8f0f889ba031bd | https://github.com/facile-it/sentry-common/blob/63ca40700e19363e6af94c69ef8f0f889ba031bd/src/StackTrace/StackTrace.php#L103-L116 |
194,308 | facile-it/sentry-common | src/StackTrace/StackTrace.php | StackTrace.cleanBacktrace | public function cleanBacktrace(array $trace): array
{
// find first not removable index
$firstNotRemovable = 0;
foreach ($trace as $index => $item) {
if (! $this->shouldRemoveStack($item)) {
$firstNotRemovable = $index;
break;
}
... | php | public function cleanBacktrace(array $trace): array
{
// find first not removable index
$firstNotRemovable = 0;
foreach ($trace as $index => $item) {
if (! $this->shouldRemoveStack($item)) {
$firstNotRemovable = $index;
break;
}
... | [
"public",
"function",
"cleanBacktrace",
"(",
"array",
"$",
"trace",
")",
":",
"array",
"{",
"// find first not removable index",
"$",
"firstNotRemovable",
"=",
"0",
";",
"foreach",
"(",
"$",
"trace",
"as",
"$",
"index",
"=>",
"$",
"item",
")",
"{",
"if",
"... | Remove stacks until the stack is from outside the logging context based on namespaces to ignore.
@param array $trace
@return array | [
"Remove",
"stacks",
"until",
"the",
"stack",
"is",
"from",
"outside",
"the",
"logging",
"context",
"based",
"on",
"namespaces",
"to",
"ignore",
"."
] | 63ca40700e19363e6af94c69ef8f0f889ba031bd | https://github.com/facile-it/sentry-common/blob/63ca40700e19363e6af94c69ef8f0f889ba031bd/src/StackTrace/StackTrace.php#L124-L138 |
194,309 | facile-it/sentry-common | src/StackTrace/StackTrace.php | StackTrace.shouldRemoveStack | private function shouldRemoveStack(array $stack): bool
{
if (empty($stack['class'])) {
return false;
}
foreach ($this->ignoreBacktraceNamespaces as $namespace) {
if (0 === strpos($stack['class'], $namespace)) {
return true;
}
}
... | php | private function shouldRemoveStack(array $stack): bool
{
if (empty($stack['class'])) {
return false;
}
foreach ($this->ignoreBacktraceNamespaces as $namespace) {
if (0 === strpos($stack['class'], $namespace)) {
return true;
}
}
... | [
"private",
"function",
"shouldRemoveStack",
"(",
"array",
"$",
"stack",
")",
":",
"bool",
"{",
"if",
"(",
"empty",
"(",
"$",
"stack",
"[",
"'class'",
"]",
")",
")",
"{",
"return",
"false",
";",
"}",
"foreach",
"(",
"$",
"this",
"->",
"ignoreBacktraceNa... | Should the stack be removed?
@param array $stack
@return bool | [
"Should",
"the",
"stack",
"be",
"removed?"
] | 63ca40700e19363e6af94c69ef8f0f889ba031bd | https://github.com/facile-it/sentry-common/blob/63ca40700e19363e6af94c69ef8f0f889ba031bd/src/StackTrace/StackTrace.php#L146-L159 |
194,310 | ddvphp/weibo | src/Weibo/SaeTOAuthV2.php | SaeTOAuthV2.post | function post($url, $parameters = array(), $multi = false) {
$response = $this->oAuthRequest($url, 'POST', $parameters, $multi );
if ($this->format === 'json' && $this->decode_json) {
return json_decode($response, true);
}
return $response;
} | php | function post($url, $parameters = array(), $multi = false) {
$response = $this->oAuthRequest($url, 'POST', $parameters, $multi );
if ($this->format === 'json' && $this->decode_json) {
return json_decode($response, true);
}
return $response;
} | [
"function",
"post",
"(",
"$",
"url",
",",
"$",
"parameters",
"=",
"array",
"(",
")",
",",
"$",
"multi",
"=",
"false",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"oAuthRequest",
"(",
"$",
"url",
",",
"'POST'",
",",
"$",
"parameters",
",",
... | POST wreapper for oAuthRequest.
@return mixed | [
"POST",
"wreapper",
"for",
"oAuthRequest",
"."
] | 4940f27fbb88e0a1e419ee56399715ad1658f31c | https://github.com/ddvphp/weibo/blob/4940f27fbb88e0a1e419ee56399715ad1658f31c/src/Weibo/SaeTOAuthV2.php#L283-L289 |
194,311 | ddvphp/weibo | src/Weibo/SaeTOAuthV2.php | SaeTOAuthV2.delete | function delete($url, $parameters = array()) {
$response = $this->oAuthRequest($url, 'DELETE', $parameters);
if ($this->format === 'json' && $this->decode_json) {
return json_decode($response, true);
}
return $response;
} | php | function delete($url, $parameters = array()) {
$response = $this->oAuthRequest($url, 'DELETE', $parameters);
if ($this->format === 'json' && $this->decode_json) {
return json_decode($response, true);
}
return $response;
} | [
"function",
"delete",
"(",
"$",
"url",
",",
"$",
"parameters",
"=",
"array",
"(",
")",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"oAuthRequest",
"(",
"$",
"url",
",",
"'DELETE'",
",",
"$",
"parameters",
")",
";",
"if",
"(",
"$",
"this",
... | DELTE wrapper for oAuthReqeust.
@return mixed | [
"DELTE",
"wrapper",
"for",
"oAuthReqeust",
"."
] | 4940f27fbb88e0a1e419ee56399715ad1658f31c | https://github.com/ddvphp/weibo/blob/4940f27fbb88e0a1e419ee56399715ad1658f31c/src/Weibo/SaeTOAuthV2.php#L296-L302 |
194,312 | modulusphp/utility | Variable.php | Variable.has | public static function has(string $name, ?string $syntax = null)
{
if (isset($_SESSION['application']['with'][$name])) {
$_SESSION['application']['flash']['used'] = true;
$name = $_SESSION['application']['with'][$name];
return $syntax ? str_replace(':message', $name, $syntax) : true;
}
... | php | public static function has(string $name, ?string $syntax = null)
{
if (isset($_SESSION['application']['with'][$name])) {
$_SESSION['application']['flash']['used'] = true;
$name = $_SESSION['application']['with'][$name];
return $syntax ? str_replace(':message', $name, $syntax) : true;
}
... | [
"public",
"static",
"function",
"has",
"(",
"string",
"$",
"name",
",",
"?",
"string",
"$",
"syntax",
"=",
"null",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"_SESSION",
"[",
"'application'",
"]",
"[",
"'with'",
"]",
"[",
"$",
"name",
"]",
")",
")",
... | Check if variables exists
@param string $name
@param null|string $syntax
@return mixed | [
"Check",
"if",
"variables",
"exists"
] | c1e127539b13d3ec8381e41c64b881e0701807f5 | https://github.com/modulusphp/utility/blob/c1e127539b13d3ec8381e41c64b881e0701807f5/Variable.php#L25-L36 |
194,313 | Raphhh/puppy-application | src/Service/ServiceContainer.php | ServiceContainer.getService | public function getService($service)
{
if (!isset($this->services[$service])) {
throw new \InvalidArgumentException(sprintf('Service %s not found', $service));
}
return $this->services[$service];
} | php | public function getService($service)
{
if (!isset($this->services[$service])) {
throw new \InvalidArgumentException(sprintf('Service %s not found', $service));
}
return $this->services[$service];
} | [
"public",
"function",
"getService",
"(",
"$",
"service",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"services",
"[",
"$",
"service",
"]",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"sprintf",
"(",
"'Service %s n... | Getter of a service
@param string $service
@throws \InvalidArgumentException
@return mixed | [
"Getter",
"of",
"a",
"service"
] | 9291543cd28e19a2986abd7fb146898ca5f5f5da | https://github.com/Raphhh/puppy-application/blob/9291543cd28e19a2986abd7fb146898ca5f5f5da/src/Service/ServiceContainer.php#L44-L50 |
194,314 | RSQueue/RSQueue | src/RSQueue/Services/Consumer.php | Consumer.consume | public function consume($queueAlias, $timeout = 0)
{
$queues = is_array($queueAlias)
? $this
->queueAliasResolver
->getQueues($queueAlias)
: $this
->queueAliasResolver
->getQueue($queueAlias);
$payloadArray = $t... | php | public function consume($queueAlias, $timeout = 0)
{
$queues = is_array($queueAlias)
? $this
->queueAliasResolver
->getQueues($queueAlias)
: $this
->queueAliasResolver
->getQueue($queueAlias);
$payloadArray = $t... | [
"public",
"function",
"consume",
"(",
"$",
"queueAlias",
",",
"$",
"timeout",
"=",
"0",
")",
"{",
"$",
"queues",
"=",
"is_array",
"(",
"$",
"queueAlias",
")",
"?",
"$",
"this",
"->",
"queueAliasResolver",
"->",
"getQueues",
"(",
"$",
"queueAlias",
")",
... | Retrieve queue value, with a defined timeout.
This method accepts a single queue alias or an array with alias
Every new element will be popped from one of defined queue
Also, new Consumer event is triggered everytime a new element is popped
@param mixed $queueAlias Alias of queue to consume from ( Can be an array of... | [
"Retrieve",
"queue",
"value",
"with",
"a",
"defined",
"timeout",
"."
] | 1a8d72a2b025ed65684644febf9493d4f6ac9333 | https://github.com/RSQueue/RSQueue/blob/1a8d72a2b025ed65684644febf9493d4f6ac9333/src/RSQueue/Services/Consumer.php#L44-L86 |
194,315 | spartan/console | src/MultiChoice.php | MultiChoice.isSelected | protected function isSelected(): bool
{
$key = $this->choices[$this->line]['key'];
return array_key_exists($key, $this->selections);
} | php | protected function isSelected(): bool
{
$key = $this->choices[$this->line]['key'];
return array_key_exists($key, $this->selections);
} | [
"protected",
"function",
"isSelected",
"(",
")",
":",
"bool",
"{",
"$",
"key",
"=",
"$",
"this",
"->",
"choices",
"[",
"$",
"this",
"->",
"line",
"]",
"[",
"'key'",
"]",
";",
"return",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"s... | Check for current line
@return bool | [
"Check",
"for",
"current",
"line"
] | 66e3e595b9bf9e274ce35d2f50f7cdd5d9e5e838 | https://github.com/spartan/console/blob/66e3e595b9bf9e274ce35d2f50f7cdd5d9e5e838/src/MultiChoice.php#L140-L144 |
194,316 | spartan/console | src/MultiChoice.php | MultiChoice.checkMissingParentsDependencies | protected function checkMissingParentsDependencies(array $choice): array
{
$missing = [];
$depends = (array)$choice['depends'];
foreach ($depends as $dependency) {
if (!isset($this->selections[$dependency])) {
foreach ($this->choices as $choice) {
... | php | protected function checkMissingParentsDependencies(array $choice): array
{
$missing = [];
$depends = (array)$choice['depends'];
foreach ($depends as $dependency) {
if (!isset($this->selections[$dependency])) {
foreach ($this->choices as $choice) {
... | [
"protected",
"function",
"checkMissingParentsDependencies",
"(",
"array",
"$",
"choice",
")",
":",
"array",
"{",
"$",
"missing",
"=",
"[",
"]",
";",
"$",
"depends",
"=",
"(",
"array",
")",
"$",
"choice",
"[",
"'depends'",
"]",
";",
"foreach",
"(",
"$",
... | Make sure all dependencies are already selected
@param array $choice Checked choice
@return array | [
"Make",
"sure",
"all",
"dependencies",
"are",
"already",
"selected"
] | 66e3e595b9bf9e274ce35d2f50f7cdd5d9e5e838 | https://github.com/spartan/console/blob/66e3e595b9bf9e274ce35d2f50f7cdd5d9e5e838/src/MultiChoice.php#L251-L266 |
194,317 | Kris-Kuiper/sFire-Framework | autoload.php | Autoloader.addPsr4 | public static function addPsr4($prefix, $base_dir, $prepend = false) {
//Normalize namespace prefix
$prefix = trim($prefix, '\\') . '\\';
//Normalize the base directory with a trailing separator
$base_dir = rtrim($base_dir, DIRECTORY_SEPARATOR) . '/';
//Initialize the ... | php | public static function addPsr4($prefix, $base_dir, $prepend = false) {
//Normalize namespace prefix
$prefix = trim($prefix, '\\') . '\\';
//Normalize the base directory with a trailing separator
$base_dir = rtrim($base_dir, DIRECTORY_SEPARATOR) . '/';
//Initialize the ... | [
"public",
"static",
"function",
"addPsr4",
"(",
"$",
"prefix",
",",
"$",
"base_dir",
",",
"$",
"prepend",
"=",
"false",
")",
"{",
"//Normalize namespace prefix\r",
"$",
"prefix",
"=",
"trim",
"(",
"$",
"prefix",
",",
"'\\\\'",
")",
".",
"'\\\\'",
";",
"/... | Adds a base directory for a namespace prefix using the PSR-4 standard.
@param string $prefix
@param string $base_dir
@param bool $prepend | [
"Adds",
"a",
"base",
"directory",
"for",
"a",
"namespace",
"prefix",
"using",
"the",
"PSR",
"-",
"4",
"standard",
"."
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/autoload.php#L53-L72 |
194,318 | Kris-Kuiper/sFire-Framework | autoload.php | Autoloader.add | public static function add($prefix, $base_dir, $prepend = false) {
//Normalize namespace prefix
$prefix = trim($prefix, '\\') . '\\';
//Normalize the base directory with a trailing separator
$base_dir = rtrim($base_dir, DIRECTORY_SEPARATOR) . '/';
//Initialize the name... | php | public static function add($prefix, $base_dir, $prepend = false) {
//Normalize namespace prefix
$prefix = trim($prefix, '\\') . '\\';
//Normalize the base directory with a trailing separator
$base_dir = rtrim($base_dir, DIRECTORY_SEPARATOR) . '/';
//Initialize the name... | [
"public",
"static",
"function",
"add",
"(",
"$",
"prefix",
",",
"$",
"base_dir",
",",
"$",
"prepend",
"=",
"false",
")",
"{",
"//Normalize namespace prefix\r",
"$",
"prefix",
"=",
"trim",
"(",
"$",
"prefix",
",",
"'\\\\'",
")",
".",
"'\\\\'",
";",
"//Nor... | Adds a base directory for a namespace prefix using the PSR-0 standard.
@param string $prefix
@param string $base_dir
@param bool $prepend | [
"Adds",
"a",
"base",
"directory",
"for",
"a",
"namespace",
"prefix",
"using",
"the",
"PSR",
"-",
"0",
"standard",
"."
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/autoload.php#L81-L100 |
194,319 | ingro/Rest | src/Ingruz/Rest/Repositories/AbstractRestEloquentRepository.php | AbstractRestEloquentRepository.getFirstBy | public function getFirstBy($key, $value, array $with = array())
{
return $this->make($with)->where($key, '=', $value)->first();
} | php | public function getFirstBy($key, $value, array $with = array())
{
return $this->make($with)->where($key, '=', $value)->first();
} | [
"public",
"function",
"getFirstBy",
"(",
"$",
"key",
",",
"$",
"value",
",",
"array",
"$",
"with",
"=",
"array",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"make",
"(",
"$",
"with",
")",
"->",
"where",
"(",
"$",
"key",
",",
"'='",
",",
"$... | Find an item by a key value
@param string $key [description]
@param mixed $value [description]
@param array $with [description]
@return \Illuminate\Database\Eloquent\Model | [
"Find",
"an",
"item",
"by",
"a",
"key",
"value"
] | 922bed071b8ea41feb067d97a3e283f944a86cb8 | https://github.com/ingro/Rest/blob/922bed071b8ea41feb067d97a3e283f944a86cb8/src/Ingruz/Rest/Repositories/AbstractRestEloquentRepository.php#L140-L143 |
194,320 | ingro/Rest | src/Ingruz/Rest/Repositories/AbstractRestEloquentRepository.php | AbstractRestEloquentRepository.getManyBy | public function getManyBy($key, $value, array $with = array())
{
return $this->make($with)->where($key, '=', $value)->get();
} | php | public function getManyBy($key, $value, array $with = array())
{
return $this->make($with)->where($key, '=', $value)->get();
} | [
"public",
"function",
"getManyBy",
"(",
"$",
"key",
",",
"$",
"value",
",",
"array",
"$",
"with",
"=",
"array",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"make",
"(",
"$",
"with",
")",
"->",
"where",
"(",
"$",
"key",
",",
"'='",
",",
"$"... | Return many items by a key value
@param string $key
@param mixed $value
@param array $with
@return \Illuminate\Database\Eloquent\Collection | [
"Return",
"many",
"items",
"by",
"a",
"key",
"value"
] | 922bed071b8ea41feb067d97a3e283f944a86cb8 | https://github.com/ingro/Rest/blob/922bed071b8ea41feb067d97a3e283f944a86cb8/src/Ingruz/Rest/Repositories/AbstractRestEloquentRepository.php#L153-L156 |
194,321 | ingro/Rest | src/Ingruz/Rest/Repositories/AbstractRestEloquentRepository.php | AbstractRestEloquentRepository.has | public function has($relation, array $with = array())
{
$query = $this->make($with);
return $query->has($relation)->get();
} | php | public function has($relation, array $with = array())
{
$query = $this->make($with);
return $query->has($relation)->get();
} | [
"public",
"function",
"has",
"(",
"$",
"relation",
",",
"array",
"$",
"with",
"=",
"array",
"(",
")",
")",
"{",
"$",
"query",
"=",
"$",
"this",
"->",
"make",
"(",
"$",
"with",
")",
";",
"return",
"$",
"query",
"->",
"has",
"(",
"$",
"relation",
... | Return items that have a defined relation
@param string $relation
@param array $with
@return \Illuminate\Database\Eloquent\Collection | [
"Return",
"items",
"that",
"have",
"a",
"defined",
"relation"
] | 922bed071b8ea41feb067d97a3e283f944a86cb8 | https://github.com/ingro/Rest/blob/922bed071b8ea41feb067d97a3e283f944a86cb8/src/Ingruz/Rest/Repositories/AbstractRestEloquentRepository.php#L165-L170 |
194,322 | stubbles/stubbles-peer | src/main/php/http/HttpRequest.php | HttpRequest.get | public function get(
int $timeout = 30,
$version = HttpVersion::HTTP_1_1
): HttpResponse {
$socket = $this->httpUri->openSocket($timeout);
$this->processHeader($socket, Http::GET, $version);
return HttpResponse::create($socket);
} | php | public function get(
int $timeout = 30,
$version = HttpVersion::HTTP_1_1
): HttpResponse {
$socket = $this->httpUri->openSocket($timeout);
$this->processHeader($socket, Http::GET, $version);
return HttpResponse::create($socket);
} | [
"public",
"function",
"get",
"(",
"int",
"$",
"timeout",
"=",
"30",
",",
"$",
"version",
"=",
"HttpVersion",
"::",
"HTTP_1_1",
")",
":",
"HttpResponse",
"{",
"$",
"socket",
"=",
"$",
"this",
"->",
"httpUri",
"->",
"openSocket",
"(",
"$",
"timeout",
")"... | initializes a get request
@param int $timeout optional connection timeout, defaults to 30 seconds
@param string|\stubbles\peer\http\HttpVersion $version optional http version, defaults to HTTP/1.1
@return \stubbles\peer\http\HttpResponse | [
"initializes",
"a",
"get",
"request"
] | dc8b0a517dc4c84b615cc3c88f0d64a2b742f9cc | https://github.com/stubbles/stubbles-peer/blob/dc8b0a517dc4c84b615cc3c88f0d64a2b742f9cc/src/main/php/http/HttpRequest.php#L66-L73 |
194,323 | stubbles/stubbles-peer | src/main/php/http/HttpRequest.php | HttpRequest.head | public function head(
int $timeout = 30,
$version = HttpVersion::HTTP_1_1
): HttpResponse {
$socket = $this->httpUri->openSocket($timeout);
$this->headers->put('Connection', 'close');
$this->processHeader($socket, Http::HEAD, $version);
return HttpResponse::cr... | php | public function head(
int $timeout = 30,
$version = HttpVersion::HTTP_1_1
): HttpResponse {
$socket = $this->httpUri->openSocket($timeout);
$this->headers->put('Connection', 'close');
$this->processHeader($socket, Http::HEAD, $version);
return HttpResponse::cr... | [
"public",
"function",
"head",
"(",
"int",
"$",
"timeout",
"=",
"30",
",",
"$",
"version",
"=",
"HttpVersion",
"::",
"HTTP_1_1",
")",
":",
"HttpResponse",
"{",
"$",
"socket",
"=",
"$",
"this",
"->",
"httpUri",
"->",
"openSocket",
"(",
"$",
"timeout",
")... | initializes a head request
@param int $timeout optional connection timeout, defaults to 30 seconds
@param string|\stubbles\peer\http\HttpVersion $version optional http version, defaults to HTTP/1.1
@return \stubbles\peer\http\HttpResponse | [
"initializes",
"a",
"head",
"request"
] | dc8b0a517dc4c84b615cc3c88f0d64a2b742f9cc | https://github.com/stubbles/stubbles-peer/blob/dc8b0a517dc4c84b615cc3c88f0d64a2b742f9cc/src/main/php/http/HttpRequest.php#L82-L90 |
194,324 | stubbles/stubbles-peer | src/main/php/http/HttpRequest.php | HttpRequest.post | public function post(
$body,
int $timeout = 30,
$version = HttpVersion::HTTP_1_1
): HttpResponse {
if (is_array($body)) {
$body = $this->transformPostValues($body);
$this->headers->put('Content-Type', 'application/x-www-form-urlencoded');
}... | php | public function post(
$body,
int $timeout = 30,
$version = HttpVersion::HTTP_1_1
): HttpResponse {
if (is_array($body)) {
$body = $this->transformPostValues($body);
$this->headers->put('Content-Type', 'application/x-www-form-urlencoded');
}... | [
"public",
"function",
"post",
"(",
"$",
"body",
",",
"int",
"$",
"timeout",
"=",
"30",
",",
"$",
"version",
"=",
"HttpVersion",
"::",
"HTTP_1_1",
")",
":",
"HttpResponse",
"{",
"if",
"(",
"is_array",
"(",
"$",
"body",
")",
")",
"{",
"$",
"body",
"=... | initializes a post request
The body can either be given as string or as array, which is considered
to be a map of key-value pairs denoting post request parameters. If the
latter is the case an post form submit content type will be added to the
request.
@param string|array $body post r... | [
"initializes",
"a",
"post",
"request"
] | dc8b0a517dc4c84b615cc3c88f0d64a2b742f9cc | https://github.com/stubbles/stubbles-peer/blob/dc8b0a517dc4c84b615cc3c88f0d64a2b742f9cc/src/main/php/http/HttpRequest.php#L105-L120 |
194,325 | stubbles/stubbles-peer | src/main/php/http/HttpRequest.php | HttpRequest.transformPostValues | private function transformPostValues(array $postValues): string
{
$body = '';
foreach ($postValues as $key => $value) {
$body .= urlencode($key) . '=' . urlencode($value) . '&';
}
return $body;
} | php | private function transformPostValues(array $postValues): string
{
$body = '';
foreach ($postValues as $key => $value) {
$body .= urlencode($key) . '=' . urlencode($value) . '&';
}
return $body;
} | [
"private",
"function",
"transformPostValues",
"(",
"array",
"$",
"postValues",
")",
":",
"string",
"{",
"$",
"body",
"=",
"''",
";",
"foreach",
"(",
"$",
"postValues",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"body",
".=",
"urlencode",
"(",... | transforms post values to post body
@param array $postValues
@return string | [
"transforms",
"post",
"values",
"to",
"post",
"body"
] | dc8b0a517dc4c84b615cc3c88f0d64a2b742f9cc | https://github.com/stubbles/stubbles-peer/blob/dc8b0a517dc4c84b615cc3c88f0d64a2b742f9cc/src/main/php/http/HttpRequest.php#L166-L174 |
194,326 | stubbles/stubbles-peer | src/main/php/http/HttpRequest.php | HttpRequest.processHeader | private function processHeader(Stream $socket, string $method, $version)
{
$version = HttpVersion::castFrom($version);
if (!$version->equals(HttpVersion::HTTP_1_0) && !$version->equals(HttpVersion::HTTP_1_1)) {
throw new \InvalidArgumentException(
'Invalid HTTP versio... | php | private function processHeader(Stream $socket, string $method, $version)
{
$version = HttpVersion::castFrom($version);
if (!$version->equals(HttpVersion::HTTP_1_0) && !$version->equals(HttpVersion::HTTP_1_1)) {
throw new \InvalidArgumentException(
'Invalid HTTP versio... | [
"private",
"function",
"processHeader",
"(",
"Stream",
"$",
"socket",
",",
"string",
"$",
"method",
",",
"$",
"version",
")",
"{",
"$",
"version",
"=",
"HttpVersion",
"::",
"castFrom",
"(",
"$",
"version",
")",
";",
"if",
"(",
"!",
"$",
"version",
"->"... | helper method to send the headers
@param \stubbles\peer\Stream $socket output stream to write request to
@param string $method http method
@param string|\stubbles\peer\http\HttpVersion $version http version
@throws \InvalidArgumentException | [
"helper",
"method",
"to",
"send",
"the",
"headers"
] | dc8b0a517dc4c84b615cc3c88f0d64a2b742f9cc | https://github.com/stubbles/stubbles-peer/blob/dc8b0a517dc4c84b615cc3c88f0d64a2b742f9cc/src/main/php/http/HttpRequest.php#L184-L206 |
194,327 | stubbles/stubbles-peer | src/main/php/http/HttpRequest.php | HttpRequest.methodAllowsQueryString | private function methodAllowsQueryString(string $method): bool
{
return (Http::GET === $method || Http::HEAD === $method);
} | php | private function methodAllowsQueryString(string $method): bool
{
return (Http::GET === $method || Http::HEAD === $method);
} | [
"private",
"function",
"methodAllowsQueryString",
"(",
"string",
"$",
"method",
")",
":",
"bool",
"{",
"return",
"(",
"Http",
"::",
"GET",
"===",
"$",
"method",
"||",
"Http",
"::",
"HEAD",
"===",
"$",
"method",
")",
";",
"}"
] | checks if given method allows a query string
@param string $method
@return bool | [
"checks",
"if",
"given",
"method",
"allows",
"a",
"query",
"string"
] | dc8b0a517dc4c84b615cc3c88f0d64a2b742f9cc | https://github.com/stubbles/stubbles-peer/blob/dc8b0a517dc4c84b615cc3c88f0d64a2b742f9cc/src/main/php/http/HttpRequest.php#L214-L217 |
194,328 | madesst/MadesstSecurityExtraBundle | Common/RequestMatcher.php | RequestMatcher.matchPath | public function matchPath($regexp)
{
if (substr($regexp, 0, 1) == '@') {
$this->route_name = substr($regexp, 1);
} else {
parent::matchPath($regexp);
}
} | php | public function matchPath($regexp)
{
if (substr($regexp, 0, 1) == '@') {
$this->route_name = substr($regexp, 1);
} else {
parent::matchPath($regexp);
}
} | [
"public",
"function",
"matchPath",
"(",
"$",
"regexp",
")",
"{",
"if",
"(",
"substr",
"(",
"$",
"regexp",
",",
"0",
",",
"1",
")",
"==",
"'@'",
")",
"{",
"$",
"this",
"->",
"route_name",
"=",
"substr",
"(",
"$",
"regexp",
",",
"1",
")",
";",
"}... | Adds a check for the route name.
@param string $regexp A Regexp | [
"Adds",
"a",
"check",
"for",
"the",
"route",
"name",
"."
] | d856e5c2ade3c6cc9faf294d0ba95088133cf9bb | https://github.com/madesst/MadesstSecurityExtraBundle/blob/d856e5c2ade3c6cc9faf294d0ba95088133cf9bb/Common/RequestMatcher.php#L25-L32 |
194,329 | SlabPHP/router | src/Route.php | Route.initializeFromHardcodedObject | private function initializeFromHardcodedObject($object)
{
//Typecast arrays to objects
if (is_array($object)) $object = (object)$object;
if (!empty($object->path)) {
$this->path = $object->path;
}
if (!empty($object->name)) {
$this->name = $object->n... | php | private function initializeFromHardcodedObject($object)
{
//Typecast arrays to objects
if (is_array($object)) $object = (object)$object;
if (!empty($object->path)) {
$this->path = $object->path;
}
if (!empty($object->name)) {
$this->name = $object->n... | [
"private",
"function",
"initializeFromHardcodedObject",
"(",
"$",
"object",
")",
"{",
"//Typecast arrays to objects",
"if",
"(",
"is_array",
"(",
"$",
"object",
")",
")",
"$",
"object",
"=",
"(",
"object",
")",
"$",
"object",
";",
"if",
"(",
"!",
"empty",
... | Allow programmatic initialization of a route
@param \stdClass $object
@throws \Exception | [
"Allow",
"programmatic",
"initialization",
"of",
"a",
"route"
] | 3e95fa07f694c0e2288a9e9a0ca106117f501a6e | https://github.com/SlabPHP/router/blob/3e95fa07f694c0e2288a9e9a0ca106117f501a6e/src/Route.php#L106-L147 |
194,330 | SlabPHP/router | src/Route.php | Route.initializeFromSimpleXML | private function initializeFromSimpleXML($xmlObject)
{
$this->path = !empty($xmlObject->path) ? trim($xmlObject->path) : '/';
$this->name = !empty($xmlObject->name) ? trim($xmlObject->name) : '';
$this->class = !empty($xmlObject->class) ? trim($xmlObject->class) : '';
$this->priorit... | php | private function initializeFromSimpleXML($xmlObject)
{
$this->path = !empty($xmlObject->path) ? trim($xmlObject->path) : '/';
$this->name = !empty($xmlObject->name) ? trim($xmlObject->name) : '';
$this->class = !empty($xmlObject->class) ? trim($xmlObject->class) : '';
$this->priorit... | [
"private",
"function",
"initializeFromSimpleXML",
"(",
"$",
"xmlObject",
")",
"{",
"$",
"this",
"->",
"path",
"=",
"!",
"empty",
"(",
"$",
"xmlObject",
"->",
"path",
")",
"?",
"trim",
"(",
"$",
"xmlObject",
"->",
"path",
")",
":",
"'/'",
";",
"$",
"t... | Initialize from a simple XML object
@param \SimpleXMLElement $xmlObject
@throws \Exception | [
"Initialize",
"from",
"a",
"simple",
"XML",
"object"
] | 3e95fa07f694c0e2288a9e9a0ca106117f501a6e | https://github.com/SlabPHP/router/blob/3e95fa07f694c0e2288a9e9a0ca106117f501a6e/src/Route.php#L156-L194 |
194,331 | SlabPHP/router | src/Route.php | Route.validateRoute | private function validateRoute($logReference)
{
$valid = true;
if (empty($this->name)) {
if ($logReference) $logReference->error('Route does not specify a name. Path(' . $this->path . ') Class(' . $this->class . ')');
$valid = false;
}
if (empty($this->path)... | php | private function validateRoute($logReference)
{
$valid = true;
if (empty($this->name)) {
if ($logReference) $logReference->error('Route does not specify a name. Path(' . $this->path . ') Class(' . $this->class . ')');
$valid = false;
}
if (empty($this->path)... | [
"private",
"function",
"validateRoute",
"(",
"$",
"logReference",
")",
"{",
"$",
"valid",
"=",
"true",
";",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"name",
")",
")",
"{",
"if",
"(",
"$",
"logReference",
")",
"$",
"logReference",
"->",
"error",
"(... | Validates the route
@param \Psr\Log\LoggerInterface $logReference | [
"Validates",
"the",
"route"
] | 3e95fa07f694c0e2288a9e9a0ca106117f501a6e | https://github.com/SlabPHP/router/blob/3e95fa07f694c0e2288a9e9a0ca106117f501a6e/src/Route.php#L200-L229 |
194,332 | SlabPHP/router | src/Route.php | Route.getRoutingPath | public function getRoutingPath()
{
$tempPath = substr($this->path, 1);
if (strpos($tempPath, '/') !== false) {
$pathPieces = explode('/', $tempPath);
return $pathPieces;
} else if ($tempPath) {
return array($tempPath);
} else {
return ... | php | public function getRoutingPath()
{
$tempPath = substr($this->path, 1);
if (strpos($tempPath, '/') !== false) {
$pathPieces = explode('/', $tempPath);
return $pathPieces;
} else if ($tempPath) {
return array($tempPath);
} else {
return ... | [
"public",
"function",
"getRoutingPath",
"(",
")",
"{",
"$",
"tempPath",
"=",
"substr",
"(",
"$",
"this",
"->",
"path",
",",
"1",
")",
";",
"if",
"(",
"strpos",
"(",
"$",
"tempPath",
",",
"'/'",
")",
"!==",
"false",
")",
"{",
"$",
"pathPieces",
"=",... | Returns an array of the routing path
@return array | [
"Returns",
"an",
"array",
"of",
"the",
"routing",
"path"
] | 3e95fa07f694c0e2288a9e9a0ca106117f501a6e | https://github.com/SlabPHP/router/blob/3e95fa07f694c0e2288a9e9a0ca106117f501a6e/src/Route.php#L254-L266 |
194,333 | SlabPHP/router | src/Route.php | Route.validateDynamicPattern | public function validateDynamicPattern($path, &$debugInformation)
{
if (empty($this->pattern)) {
return false;
}
$value = $this->pattern->testPattern($path, $this->parameters, $debugInformation);
$this->validatedData = $this->pattern->getValidatedData();
return... | php | public function validateDynamicPattern($path, &$debugInformation)
{
if (empty($this->pattern)) {
return false;
}
$value = $this->pattern->testPattern($path, $this->parameters, $debugInformation);
$this->validatedData = $this->pattern->getValidatedData();
return... | [
"public",
"function",
"validateDynamicPattern",
"(",
"$",
"path",
",",
"&",
"$",
"debugInformation",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"pattern",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"value",
"=",
"$",
"this",
"->",
"p... | Validates a pattern against segments or a path
@param string $path
@param array $debugInformation
@return true | [
"Validates",
"a",
"pattern",
"against",
"segments",
"or",
"a",
"path"
] | 3e95fa07f694c0e2288a9e9a0ca106117f501a6e | https://github.com/SlabPHP/router/blob/3e95fa07f694c0e2288a9e9a0ca106117f501a6e/src/Route.php#L289-L300 |
194,334 | Vectrex/vxPHP | src/Routing/Router.php | Router.setRoutes | public function setRoutes(array $routes) {
foreach($routes as $route) {
if(!$route instanceof Route) {
throw new \InvalidArgumentException(sprintf("'%s' is not a Route instance.", $route));
}
$this->addRoute($route);
}
} | php | public function setRoutes(array $routes) {
foreach($routes as $route) {
if(!$route instanceof Route) {
throw new \InvalidArgumentException(sprintf("'%s' is not a Route instance.", $route));
}
$this->addRoute($route);
}
} | [
"public",
"function",
"setRoutes",
"(",
"array",
"$",
"routes",
")",
"{",
"foreach",
"(",
"$",
"routes",
"as",
"$",
"route",
")",
"{",
"if",
"(",
"!",
"$",
"route",
"instanceof",
"Route",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
... | assign routes to router
@param Route[] $routes | [
"assign",
"routes",
"to",
"router"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Routing/Router.php#L89-L101 |
194,335 | Vectrex/vxPHP | src/Routing/Router.php | Router.addRoute | public function addRoute(Route $route) {
$id = $route->getRouteId();
if(array_key_exists($id, $this->routes)) {
throw new \InvalidArgumentException(sprintf("Route with id '%s' already exists.", $id));
}
$this->routes[$id] = $route;
} | php | public function addRoute(Route $route) {
$id = $route->getRouteId();
if(array_key_exists($id, $this->routes)) {
throw new \InvalidArgumentException(sprintf("Route with id '%s' already exists.", $id));
}
$this->routes[$id] = $route;
} | [
"public",
"function",
"addRoute",
"(",
"Route",
"$",
"route",
")",
"{",
"$",
"id",
"=",
"$",
"route",
"->",
"getRouteId",
"(",
")",
";",
"if",
"(",
"array_key_exists",
"(",
"$",
"id",
",",
"$",
"this",
"->",
"routes",
")",
")",
"{",
"throw",
"new",... | add a single route to router
throws an exception when route has already been assigned
@param Route $route | [
"add",
"a",
"single",
"route",
"to",
"router",
"throws",
"an",
"exception",
"when",
"route",
"has",
"already",
"been",
"assigned"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Routing/Router.php#L109-L120 |
194,336 | Vectrex/vxPHP | src/Routing/Router.php | Router.getRouteFromPathInfo | public function getRouteFromPathInfo(Request $request) {
$application = Application::getInstance();
$script = basename($request->getScriptName());
if(!($path = trim($request->getPathInfo(), '/'))) {
$pathSegments = [];
}
else {
$pathSegments = explode('/' , $path);
}
// skip if pathinfo matches s... | php | public function getRouteFromPathInfo(Request $request) {
$application = Application::getInstance();
$script = basename($request->getScriptName());
if(!($path = trim($request->getPathInfo(), '/'))) {
$pathSegments = [];
}
else {
$pathSegments = explode('/' , $path);
}
// skip if pathinfo matches s... | [
"public",
"function",
"getRouteFromPathInfo",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"application",
"=",
"Application",
"::",
"getInstance",
"(",
")",
";",
"$",
"script",
"=",
"basename",
"(",
"$",
"request",
"->",
"getScriptName",
"(",
")",
")",
"... | analyse path and return route associated with it
the first path fragment can be a locale string,
which is then skipped for determining the route
configured routes are first checked whether they fulfill the
request method and whether they match the path
if more than one route matches these requirements the one which
i... | [
"analyse",
"path",
"and",
"return",
"route",
"associated",
"with",
"it",
"the",
"first",
"path",
"fragment",
"can",
"be",
"a",
"locale",
"string",
"which",
"is",
"then",
"skipped",
"for",
"determining",
"the",
"route"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Routing/Router.php#L156-L197 |
194,337 | Vectrex/vxPHP | src/Routing/Router.php | Router.getRoute | public function getRoute($routeId) {
if(!array_key_exists($routeId, $this->routes)) {
throw new ApplicationException(sprintf("No route with id '%s' configured.", $routeId));
}
return $this->routes[$routeId];
} | php | public function getRoute($routeId) {
if(!array_key_exists($routeId, $this->routes)) {
throw new ApplicationException(sprintf("No route with id '%s' configured.", $routeId));
}
return $this->routes[$routeId];
} | [
"public",
"function",
"getRoute",
"(",
"$",
"routeId",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"routeId",
",",
"$",
"this",
"->",
"routes",
")",
")",
"{",
"throw",
"new",
"ApplicationException",
"(",
"sprintf",
"(",
"\"No route with id '%s' c... | get a route identified by its id
@param string $routeId
@return \vxPHP\Routing\Route
@throws \vxPHP\Application\Exception\ApplicationException | [
"get",
"a",
"route",
"identified",
"by",
"its",
"id"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Routing/Router.php#L207-L215 |
194,338 | Vectrex/vxPHP | src/Routing/Router.php | Router.findRoute | private function findRoute(array $pathSegments = null) {
if(!count($this->routes)) {
throw new ApplicationException('Routing aborted: No routes defined.');
}
// if no page given try to get the first from list
if(empty($pathSegments)) {
return reset($this->routes);
}
$pathToCheck = ... | php | private function findRoute(array $pathSegments = null) {
if(!count($this->routes)) {
throw new ApplicationException('Routing aborted: No routes defined.');
}
// if no page given try to get the first from list
if(empty($pathSegments)) {
return reset($this->routes);
}
$pathToCheck = ... | [
"private",
"function",
"findRoute",
"(",
"array",
"$",
"pathSegments",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"count",
"(",
"$",
"this",
"->",
"routes",
")",
")",
"{",
"throw",
"new",
"ApplicationException",
"(",
"'Routing aborted: No routes defined.'",
")",
... | find route which best matches the passed path segments
@param array $pathSegments
@return \vxPHP\Routing\Route
@throws \vxPHP\Application\Exception\ApplicationException | [
"find",
"route",
"which",
"best",
"matches",
"the",
"passed",
"path",
"segments"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Routing/Router.php#L249-L344 |
194,339 | Vectrex/vxPHP | src/Routing/Router.php | Router.authenticateRoute | private function authenticateRoute(Route $route) {
$auth = $route->getAuth();
// authentication required?
if(is_null($auth)) {
return true;
}
if(!$this->authenticator) {
$this->authenticator = new DefaultRouteAuthenticator();
}
return $this->authenticator->authenticate($route, Applicatio... | php | private function authenticateRoute(Route $route) {
$auth = $route->getAuth();
// authentication required?
if(is_null($auth)) {
return true;
}
if(!$this->authenticator) {
$this->authenticator = new DefaultRouteAuthenticator();
}
return $this->authenticator->authenticate($route, Applicatio... | [
"private",
"function",
"authenticateRoute",
"(",
"Route",
"$",
"route",
")",
"{",
"$",
"auth",
"=",
"$",
"route",
"->",
"getAuth",
"(",
")",
";",
"// authentication required?",
"if",
"(",
"is_null",
"(",
"$",
"auth",
")",
")",
"{",
"return",
"true",
";",... | check whether authentication level required by route is met by
currently active user
@param Route $route
@return boolean
@throws \vxPHP\Application\Exception\ApplicationException | [
"check",
"whether",
"authentication",
"level",
"required",
"by",
"route",
"is",
"met",
"by",
"currently",
"active",
"user"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Routing/Router.php#L354-L374 |
194,340 | Vectrex/vxPHP | src/Routing/Router.php | Router.getSatisfiedPlaceholders | private function getSatisfiedPlaceholders($route, $path) {
$placeholderNames = $route->getPlaceholderNames();
if(!empty($placeholderNames)) {
if(preg_match('~(?:/|^)' . $route->getMatchExpression() .'(?:/|$)~', $path, $matches)) {
array_shift($matches);
return array_combine(array_slice($placeholderN... | php | private function getSatisfiedPlaceholders($route, $path) {
$placeholderNames = $route->getPlaceholderNames();
if(!empty($placeholderNames)) {
if(preg_match('~(?:/|^)' . $route->getMatchExpression() .'(?:/|$)~', $path, $matches)) {
array_shift($matches);
return array_combine(array_slice($placeholderN... | [
"private",
"function",
"getSatisfiedPlaceholders",
"(",
"$",
"route",
",",
"$",
"path",
")",
"{",
"$",
"placeholderNames",
"=",
"$",
"route",
"->",
"getPlaceholderNames",
"(",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"placeholderNames",
")",
")",
"{",
... | check path against placeholders of route
and return associative array with placeholders which would have a value assigned
@param Route $route
@param string $path
@return array | [
"check",
"path",
"against",
"placeholders",
"of",
"route",
"and",
"return",
"associative",
"array",
"with",
"placeholders",
"which",
"would",
"have",
"a",
"value",
"assigned"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Routing/Router.php#L384-L398 |
194,341 | Ydle/HubBundle | Manager/LogsManager.php | LogsManager.log | public function log($type, $text, $source='')
{
$log = new Logs();
$log->setType($type);
$log->setSource($source);
$log->setContent($text);
$this->em->persist($log);
$this->em->flush();
return $log;
} | php | public function log($type, $text, $source='')
{
$log = new Logs();
$log->setType($type);
$log->setSource($source);
$log->setContent($text);
$this->em->persist($log);
$this->em->flush();
return $log;
} | [
"public",
"function",
"log",
"(",
"$",
"type",
",",
"$",
"text",
",",
"$",
"source",
"=",
"''",
")",
"{",
"$",
"log",
"=",
"new",
"Logs",
"(",
")",
";",
"$",
"log",
"->",
"setType",
"(",
"$",
"type",
")",
";",
"$",
"log",
"->",
"setSource",
"... | Save a log in database
@param string $type
@param string $text
@return Logs | [
"Save",
"a",
"log",
"in",
"database"
] | 7fa423241246bcfd115f2ed3ad3997b4b63adb01 | https://github.com/Ydle/HubBundle/blob/7fa423241246bcfd115f2ed3ad3997b4b63adb01/Manager/LogsManager.php#L72-L83 |
194,342 | agroff/Command | src/Groff/Command/Command.php | Command.run | final public function run()
{
$this->notify("run");
$this->addOptions();
$this->notify("options added");
$this->populateOptions();
$this->addHelpCommand();
$this->notify("options available");
if ($this->option("help")) {
return $this->printHe... | php | final public function run()
{
$this->notify("run");
$this->addOptions();
$this->notify("options added");
$this->populateOptions();
$this->addHelpCommand();
$this->notify("options available");
if ($this->option("help")) {
return $this->printHe... | [
"final",
"public",
"function",
"run",
"(",
")",
"{",
"$",
"this",
"->",
"notify",
"(",
"\"run\"",
")",
";",
"$",
"this",
"->",
"addOptions",
"(",
")",
";",
"$",
"this",
"->",
"notify",
"(",
"\"options added\"",
")",
";",
"$",
"this",
"->",
"populateO... | This is an instance of the template method pattern. It runs the entire Cli Command
but leaves the `main` method abstract to ensure it is implemented in the
subclass. An optional addOptions hook is also provided here.
@return int Status code. 0 for success, other values indicate an error. | [
"This",
"is",
"an",
"instance",
"of",
"the",
"template",
"method",
"pattern",
".",
"It",
"runs",
"the",
"entire",
"Cli",
"Command",
"but",
"leaves",
"the",
"main",
"method",
"abstract",
"to",
"ensure",
"it",
"is",
"implemented",
"in",
"the",
"subclass",
".... | e71d3af3cfbf83f7fca9aa89e9b4bf03dc9f4c40 | https://github.com/agroff/Command/blob/e71d3af3cfbf83f7fca9aa89e9b4bf03dc9f4c40/src/Groff/Command/Command.php#L98-L127 |
194,343 | agroff/Command | src/Groff/Command/Command.php | Command.option | final public function option($query)
{
try {
$option = $this->options->find($query);
$value = $option->getValue();
} catch (ObjectDoesNotExistException $e) {
$value = false;
}
return $value;
} | php | final public function option($query)
{
try {
$option = $this->options->find($query);
$value = $option->getValue();
} catch (ObjectDoesNotExistException $e) {
$value = false;
}
return $value;
} | [
"final",
"public",
"function",
"option",
"(",
"$",
"query",
")",
"{",
"try",
"{",
"$",
"option",
"=",
"$",
"this",
"->",
"options",
"->",
"find",
"(",
"$",
"query",
")",
";",
"$",
"value",
"=",
"$",
"option",
"->",
"getValue",
"(",
")",
";",
"}",... | Returns an option's value. Facade of OptionCollection.
@param $query string An option's name or alias
@return mixed | [
"Returns",
"an",
"option",
"s",
"value",
".",
"Facade",
"of",
"OptionCollection",
"."
] | e71d3af3cfbf83f7fca9aa89e9b4bf03dc9f4c40 | https://github.com/agroff/Command/blob/e71d3af3cfbf83f7fca9aa89e9b4bf03dc9f4c40/src/Groff/Command/Command.php#L161-L172 |
194,344 | agroff/Command | src/Groff/Command/Command.php | Command.getRawOptions | protected function getRawOptions()
{
global $argv;
if (!is_array($this->rawOptions)) {
$this->setRawOptions($argv);
}
return $this->rawOptions;
} | php | protected function getRawOptions()
{
global $argv;
if (!is_array($this->rawOptions)) {
$this->setRawOptions($argv);
}
return $this->rawOptions;
} | [
"protected",
"function",
"getRawOptions",
"(",
")",
"{",
"global",
"$",
"argv",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
"this",
"->",
"rawOptions",
")",
")",
"{",
"$",
"this",
"->",
"setRawOptions",
"(",
"$",
"argv",
")",
";",
"}",
"return",
"$",
... | Provides CLI arguments. Abstracted since it uses an ugly global variable.
Also allows a subclass to provide its own options.
@return array | [
"Provides",
"CLI",
"arguments",
".",
"Abstracted",
"since",
"it",
"uses",
"an",
"ugly",
"global",
"variable",
".",
"Also",
"allows",
"a",
"subclass",
"to",
"provide",
"its",
"own",
"options",
"."
] | e71d3af3cfbf83f7fca9aa89e9b4bf03dc9f4c40 | https://github.com/agroff/Command/blob/e71d3af3cfbf83f7fca9aa89e9b4bf03dc9f4c40/src/Groff/Command/Command.php#L226-L235 |
194,345 | agroff/Command | src/Groff/Command/Command.php | Command.populateOptions | private function populateOptions()
{
$flatOptions = $this->getRawOptions();
$this->parser->parseInput($flatOptions);
$parsed = $this->parser->getOptions();
foreach ($parsed as $optionName => $optionValue) {
//ignores any options the user sent which were not defined
... | php | private function populateOptions()
{
$flatOptions = $this->getRawOptions();
$this->parser->parseInput($flatOptions);
$parsed = $this->parser->getOptions();
foreach ($parsed as $optionName => $optionValue) {
//ignores any options the user sent which were not defined
... | [
"private",
"function",
"populateOptions",
"(",
")",
"{",
"$",
"flatOptions",
"=",
"$",
"this",
"->",
"getRawOptions",
"(",
")",
";",
"$",
"this",
"->",
"parser",
"->",
"parseInput",
"(",
"$",
"flatOptions",
")",
";",
"$",
"parsed",
"=",
"$",
"this",
"-... | Gets parsed options and uses them to populate options in the options collection | [
"Gets",
"parsed",
"options",
"and",
"uses",
"them",
"to",
"populate",
"options",
"in",
"the",
"options",
"collection"
] | e71d3af3cfbf83f7fca9aa89e9b4bf03dc9f4c40 | https://github.com/agroff/Command/blob/e71d3af3cfbf83f7fca9aa89e9b4bf03dc9f4c40/src/Groff/Command/Command.php#L245-L257 |
194,346 | agroff/Command | src/Groff/Command/Command.php | Command.printHelp | final protected function printHelp()
{
$script = $this->parser->getScriptName();
$this->printUsage($script);
$this->printDescription();
/** @var $option Option */
foreach ($this->options as $option) {
echo " " . $option . "\n";
}
echo "\n";
... | php | final protected function printHelp()
{
$script = $this->parser->getScriptName();
$this->printUsage($script);
$this->printDescription();
/** @var $option Option */
foreach ($this->options as $option) {
echo " " . $option . "\n";
}
echo "\n";
... | [
"final",
"protected",
"function",
"printHelp",
"(",
")",
"{",
"$",
"script",
"=",
"$",
"this",
"->",
"parser",
"->",
"getScriptName",
"(",
")",
";",
"$",
"this",
"->",
"printUsage",
"(",
"$",
"script",
")",
";",
"$",
"this",
"->",
"printDescription",
"... | Prints help output
@return int Status code | [
"Prints",
"help",
"output"
] | e71d3af3cfbf83f7fca9aa89e9b4bf03dc9f4c40 | https://github.com/agroff/Command/blob/e71d3af3cfbf83f7fca9aa89e9b4bf03dc9f4c40/src/Groff/Command/Command.php#L269-L289 |
194,347 | squareproton/Bond | src/Bond/Container/FindFilterComponentFactory.php | FindFilterComponentFactory.getReflClassFromComparisonValue | public function getReflClassFromComparisonValue( $value )
{
if( is_array($value) ) {
$class = $this->namespace . '\\FindFilterComponent\\PropertyAccessArrayEquality';
} elseif ( is_object($value) and $value instanceof Container ) {
$class = $this->namespace . '\\FindFilterCo... | php | public function getReflClassFromComparisonValue( $value )
{
if( is_array($value) ) {
$class = $this->namespace . '\\FindFilterComponent\\PropertyAccessArrayEquality';
} elseif ( is_object($value) and $value instanceof Container ) {
$class = $this->namespace . '\\FindFilterCo... | [
"public",
"function",
"getReflClassFromComparisonValue",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"value",
")",
")",
"{",
"$",
"class",
"=",
"$",
"this",
"->",
"namespace",
".",
"'\\\\FindFilterComponent\\\\PropertyAccessArrayEquality'",
";",
... | Init the correct type of FindFilterComponent based what is passed
@param mixed $value
@return ReflectionClass of the FindFilterComponent | [
"Init",
"the",
"correct",
"type",
"of",
"FindFilterComponent",
"based",
"what",
"is",
"passed"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Container/FindFilterComponentFactory.php#L85-L96 |
194,348 | squareproton/Bond | src/Bond/Container/FindFilterComponentFactory.php | FindFilterComponentFactory.getHelper | private function getHelper( \ReflectionClass $propertyMapper, $name, $operation, $value )
{
$mapper = $propertyMapper->newInstance($name);
$instance = $this->getReflClassFromComparisonValue($value)
->newInstance($mapper, $operation, $value);
return $instance;
} | php | private function getHelper( \ReflectionClass $propertyMapper, $name, $operation, $value )
{
$mapper = $propertyMapper->newInstance($name);
$instance = $this->getReflClassFromComparisonValue($value)
->newInstance($mapper, $operation, $value);
return $instance;
} | [
"private",
"function",
"getHelper",
"(",
"\\",
"ReflectionClass",
"$",
"propertyMapper",
",",
"$",
"name",
",",
"$",
"operation",
",",
"$",
"value",
")",
"{",
"$",
"mapper",
"=",
"$",
"propertyMapper",
"->",
"newInstance",
"(",
"$",
"name",
")",
";",
"$"... | Return a new instance of a FindFilterComponent
@return Bond\Container\FindFilterComponent | [
"Return",
"a",
"new",
"instance",
"of",
"a",
"FindFilterComponent"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Container/FindFilterComponentFactory.php#L102-L108 |
194,349 | squareproton/Bond | src/Bond/Container/FindFilterComponentFactory.php | FindFilterComponentFactory.get | public function get( $name, $operation, $value)
{
$filterComponents = [];
foreach( $this->reflPropertyMappers as $propertyMapper ) {
$filterComponents[] = $this->getHelper( $propertyMapper, $name, $operation, $value );
}
// not a multi - just return the lone FindFilterC... | php | public function get( $name, $operation, $value)
{
$filterComponents = [];
foreach( $this->reflPropertyMappers as $propertyMapper ) {
$filterComponents[] = $this->getHelper( $propertyMapper, $name, $operation, $value );
}
// not a multi - just return the lone FindFilterC... | [
"public",
"function",
"get",
"(",
"$",
"name",
",",
"$",
"operation",
",",
"$",
"value",
")",
"{",
"$",
"filterComponents",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"reflPropertyMappers",
"as",
"$",
"propertyMapper",
")",
"{",
"$",
"filte... | Return a new instance of a FindFilterComponent but Multi-PropertyMapperAware
@return Bond\Container\FindFilterComponent | [
"Return",
"a",
"new",
"instance",
"of",
"a",
"FindFilterComponent",
"but",
"Multi",
"-",
"PropertyMapperAware"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Container/FindFilterComponentFactory.php#L114-L134 |
194,350 | squareproton/Bond | src/Bond/Container/FindFilterComponentFactory.php | FindFilterComponentFactory.getRegex | protected function getRegex()
{
if( !self::$regexDefault ) {
self::$regexDefault = implode(
'|',
array_map(
function($value){
return "(?<=[a-z0-9]){$value}(?=[A-Z])";
},
array_fli... | php | protected function getRegex()
{
if( !self::$regexDefault ) {
self::$regexDefault = implode(
'|',
array_map(
function($value){
return "(?<=[a-z0-9]){$value}(?=[A-Z])";
},
array_fli... | [
"protected",
"function",
"getRegex",
"(",
")",
"{",
"if",
"(",
"!",
"self",
"::",
"$",
"regexDefault",
")",
"{",
"self",
"::",
"$",
"regexDefault",
"=",
"implode",
"(",
"'|'",
",",
"array_map",
"(",
"function",
"(",
"$",
"value",
")",
"{",
"return",
... | Get the regular expression for identifying delimiters and tags within
@return regex | [
"Get",
"the",
"regular",
"expression",
"for",
"identifying",
"delimiters",
"and",
"tags",
"within"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Container/FindFilterComponentFactory.php#L197-L215 |
194,351 | Vectrex/vxPHP | src/Template/Filter/ImageCache.php | ImageCache.sanitizeActions | private function sanitizeActions($actionsString) {
$actions = [];
$actionsString = strtolower($actionsString);
// with duplicate actions the latter ones overwrite previous ones
foreach(explode('|', $actionsString) as $action) {
$action = trim($action);
$action... | php | private function sanitizeActions($actionsString) {
$actions = [];
$actionsString = strtolower($actionsString);
// with duplicate actions the latter ones overwrite previous ones
foreach(explode('|', $actionsString) as $action) {
$action = trim($action);
$action... | [
"private",
"function",
"sanitizeActions",
"(",
"$",
"actionsString",
")",
"{",
"$",
"actions",
"=",
"[",
"]",
";",
"$",
"actionsString",
"=",
"strtolower",
"(",
"$",
"actionsString",
")",
";",
"// with duplicate actions the latter ones overwrite previous ones",
"forea... | turns actions string into array
avoid duplicate actions
@param string $actionsString
@return array | [
"turns",
"actions",
"string",
"into",
"array",
"avoid",
"duplicate",
"actions"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Template/Filter/ImageCache.php#L292-L307 |
194,352 | locomotivemtl/charcoal-config | src/Charcoal/Config/FileAwareTrait.php | FileAwareTrait.loadFile | public function loadFile($path)
{
if (!is_string($path)) {
throw new InvalidArgumentException(
'File must be a string'
);
}
if (!file_exists($path)) {
throw new InvalidArgumentException(
sprintf('File "%s" does not exist', ... | php | public function loadFile($path)
{
if (!is_string($path)) {
throw new InvalidArgumentException(
'File must be a string'
);
}
if (!file_exists($path)) {
throw new InvalidArgumentException(
sprintf('File "%s" does not exist', ... | [
"public",
"function",
"loadFile",
"(",
"$",
"path",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"path",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'File must be a string'",
")",
";",
"}",
"if",
"(",
"!",
"file_exists",
"(",
"$"... | Loads a configuration file.
@param string $path A path to a supported file.
@throws InvalidArgumentException If the path is invalid.
@return array An array on success. | [
"Loads",
"a",
"configuration",
"file",
"."
] | 722b34955360c287dea8fffb3b5491866ce5f6cb | https://github.com/locomotivemtl/charcoal-config/blob/722b34955360c287dea8fffb3b5491866ce5f6cb/src/Charcoal/Config/FileAwareTrait.php#L33-L69 |
194,353 | locomotivemtl/charcoal-config | src/Charcoal/Config/FileAwareTrait.php | FileAwareTrait.loadIniFile | private function loadIniFile($path)
{
$data = parse_ini_file($path, true);
if ($data === false) {
throw new UnexpectedValueException(
sprintf('INI file "%s" is empty or invalid', $path)
);
}
return $data;
} | php | private function loadIniFile($path)
{
$data = parse_ini_file($path, true);
if ($data === false) {
throw new UnexpectedValueException(
sprintf('INI file "%s" is empty or invalid', $path)
);
}
return $data;
} | [
"private",
"function",
"loadIniFile",
"(",
"$",
"path",
")",
"{",
"$",
"data",
"=",
"parse_ini_file",
"(",
"$",
"path",
",",
"true",
")",
";",
"if",
"(",
"$",
"data",
"===",
"false",
")",
"{",
"throw",
"new",
"UnexpectedValueException",
"(",
"sprintf",
... | Load an INI file as an array.
@param string $path A path to an INI file.
@throws UnexpectedValueException If the file can not correctly be parsed into an array.
@return array An array on success. | [
"Load",
"an",
"INI",
"file",
"as",
"an",
"array",
"."
] | 722b34955360c287dea8fffb3b5491866ce5f6cb | https://github.com/locomotivemtl/charcoal-config/blob/722b34955360c287dea8fffb3b5491866ce5f6cb/src/Charcoal/Config/FileAwareTrait.php#L78-L88 |
194,354 | locomotivemtl/charcoal-config | src/Charcoal/Config/FileAwareTrait.php | FileAwareTrait.loadPhpFile | private function loadPhpFile($path)
{
try {
$data = include $path;
} catch (Exception $e) {
$message = sprintf('PHP file "%s" could not be parsed: %s', $path, $e->getMessage());
throw new UnexpectedValueException($message, 0, $e);
} catch (Throwable $e) {
... | php | private function loadPhpFile($path)
{
try {
$data = include $path;
} catch (Exception $e) {
$message = sprintf('PHP file "%s" could not be parsed: %s', $path, $e->getMessage());
throw new UnexpectedValueException($message, 0, $e);
} catch (Throwable $e) {
... | [
"private",
"function",
"loadPhpFile",
"(",
"$",
"path",
")",
"{",
"try",
"{",
"$",
"data",
"=",
"include",
"$",
"path",
";",
"}",
"catch",
"(",
"Exception",
"$",
"e",
")",
"{",
"$",
"message",
"=",
"sprintf",
"(",
"'PHP file \"%s\" could not be parsed: %s'... | Load a PHP file, maybe as an array.
Note:
- The context of $this is bound to the current object.
- Data may be any value; the {@see self::addFile()} method will ignore
anything that isn't an (associative) array.
@param string $path A path to a PHP file.
@throws UnexpectedValueException If the file can not correctly ... | [
"Load",
"a",
"PHP",
"file",
"maybe",
"as",
"an",
"array",
"."
] | 722b34955360c287dea8fffb3b5491866ce5f6cb | https://github.com/locomotivemtl/charcoal-config/blob/722b34955360c287dea8fffb3b5491866ce5f6cb/src/Charcoal/Config/FileAwareTrait.php#L132-L149 |
194,355 | locomotivemtl/charcoal-config | src/Charcoal/Config/FileAwareTrait.php | FileAwareTrait.loadYamlFile | private function loadYamlFile($path)
{
if (!class_exists('Symfony\Component\Yaml\Parser')) {
throw new LogicException('YAML format requires the Symfony YAML component');
}
try {
$yaml = new YamlParser();
$data = $yaml->parseFile($path);
} catch (E... | php | private function loadYamlFile($path)
{
if (!class_exists('Symfony\Component\Yaml\Parser')) {
throw new LogicException('YAML format requires the Symfony YAML component');
}
try {
$yaml = new YamlParser();
$data = $yaml->parseFile($path);
} catch (E... | [
"private",
"function",
"loadYamlFile",
"(",
"$",
"path",
")",
"{",
"if",
"(",
"!",
"class_exists",
"(",
"'Symfony\\Component\\Yaml\\Parser'",
")",
")",
"{",
"throw",
"new",
"LogicException",
"(",
"'YAML format requires the Symfony YAML component'",
")",
";",
"}",
"t... | Load a YAML file as an array.
@param string $path A path to a YAML/YML file.
@throws LogicException If a YAML parser is unavailable.
@throws UnexpectedValueException If the file can not correctly be parsed into an array.
@return array An array on success.
If the file is parsed as any other type, an empty array is ret... | [
"Load",
"a",
"YAML",
"file",
"as",
"an",
"array",
"."
] | 722b34955360c287dea8fffb3b5491866ce5f6cb | https://github.com/locomotivemtl/charcoal-config/blob/722b34955360c287dea8fffb3b5491866ce5f6cb/src/Charcoal/Config/FileAwareTrait.php#L160-L179 |
194,356 | as3io/As3ModlrBundle | DependencyInjection/ServiceLoaderManager.php | ServiceLoaderManager.initLoaders | private function initLoaders()
{
$namespace = sprintf('%s\\ServiceLoader', __NAMESPACE__);
$classes = ['MetadataCache', 'MetadataDrivers', 'MetadataFactory', 'Persisters', 'Rest', 'SearchClients'];
foreach ($classes as $class) {
$fqcn = sprintf('%s\\%s', $namespace, $class);
... | php | private function initLoaders()
{
$namespace = sprintf('%s\\ServiceLoader', __NAMESPACE__);
$classes = ['MetadataCache', 'MetadataDrivers', 'MetadataFactory', 'Persisters', 'Rest', 'SearchClients'];
foreach ($classes as $class) {
$fqcn = sprintf('%s\\%s', $namespace, $class);
... | [
"private",
"function",
"initLoaders",
"(",
")",
"{",
"$",
"namespace",
"=",
"sprintf",
"(",
"'%s\\\\ServiceLoader'",
",",
"__NAMESPACE__",
")",
";",
"$",
"classes",
"=",
"[",
"'MetadataCache'",
",",
"'MetadataDrivers'",
",",
"'MetadataFactory'",
",",
"'Persisters'... | Initializes all service loaders.
@return self | [
"Initializes",
"all",
"service",
"loaders",
"."
] | 7ce2abb7390c7eaf4081c5b7e00b96e7001774a4 | https://github.com/as3io/As3ModlrBundle/blob/7ce2abb7390c7eaf4081c5b7e00b96e7001774a4/DependencyInjection/ServiceLoaderManager.php#L53-L63 |
194,357 | as3io/As3ModlrBundle | DependencyInjection/ServiceLoaderManager.php | ServiceLoaderManager.loadServices | public function loadServices(array $config)
{
foreach ($this->loaders as $loader) {
$loader->load($config, $this->container);
}
return $this;
} | php | public function loadServices(array $config)
{
foreach ($this->loaders as $loader) {
$loader->load($config, $this->container);
}
return $this;
} | [
"public",
"function",
"loadServices",
"(",
"array",
"$",
"config",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"loaders",
"as",
"$",
"loader",
")",
"{",
"$",
"loader",
"->",
"load",
"(",
"$",
"config",
",",
"$",
"this",
"->",
"container",
")",
";",
... | Loads services from all loaders.
@param array $config
@return self | [
"Loads",
"services",
"from",
"all",
"loaders",
"."
] | 7ce2abb7390c7eaf4081c5b7e00b96e7001774a4 | https://github.com/as3io/As3ModlrBundle/blob/7ce2abb7390c7eaf4081c5b7e00b96e7001774a4/DependencyInjection/ServiceLoaderManager.php#L71-L77 |
194,358 | guni12/comment | src/Comments/CommController.php | CommController.toRender | public function toRender($title, $crud, $data)
{
$view = $this->di->get("view");
$pageRender = $this->di->get("pageRender");
$view->add($crud, $data);
$tempfix = "";
$pageRender->renderPage($tempfix, ["title" => $title]);
} | php | public function toRender($title, $crud, $data)
{
$view = $this->di->get("view");
$pageRender = $this->di->get("pageRender");
$view->add($crud, $data);
$tempfix = "";
$pageRender->renderPage($tempfix, ["title" => $title]);
} | [
"public",
"function",
"toRender",
"(",
"$",
"title",
",",
"$",
"crud",
",",
"$",
"data",
")",
"{",
"$",
"view",
"=",
"$",
"this",
"->",
"di",
"->",
"get",
"(",
"\"view\"",
")",
";",
"$",
"pageRender",
"=",
"$",
"this",
"->",
"di",
"->",
"get",
... | Sends data to view
@param string $title
@param string $crud, path to view
@param array $data, htmlcontent to view | [
"Sends",
"data",
"to",
"view"
] | f9c2f3e2093fea414867f548c5f5e07f96c55bfd | https://github.com/guni12/comment/blob/f9c2f3e2093fea414867f548c5f5e07f96c55bfd/src/Comments/CommController.php#L34-L41 |
194,359 | Dhii/config | src/PathSegmentSeparatorAwareTrait.php | PathSegmentSeparatorAwareTrait._setPathSegmentSeparator | protected function _setPathSegmentSeparator($separator)
{
if (
!($separator instanceof Stringable) &&
!is_string($separator) &&
!is_null($separator)
) {
throw $this->_createInvalidArgumentException($this->__('Invalid path segment separator'), null, nul... | php | protected function _setPathSegmentSeparator($separator)
{
if (
!($separator instanceof Stringable) &&
!is_string($separator) &&
!is_null($separator)
) {
throw $this->_createInvalidArgumentException($this->__('Invalid path segment separator'), null, nul... | [
"protected",
"function",
"_setPathSegmentSeparator",
"(",
"$",
"separator",
")",
"{",
"if",
"(",
"!",
"(",
"$",
"separator",
"instanceof",
"Stringable",
")",
"&&",
"!",
"is_string",
"(",
"$",
"separator",
")",
"&&",
"!",
"is_null",
"(",
"$",
"separator",
"... | Assigns the separator of segments in a string path.
@since [*next-version*]
@param string|Stringable|null $separator The separator.
@throws InvalidArgumentException If the separator is invalid. | [
"Assigns",
"the",
"separator",
"of",
"segments",
"in",
"a",
"string",
"path",
"."
] | 1ab9a7ccf9c0ebd7c6fcbce600b4c00b52b2fdcf | https://github.com/Dhii/config/blob/1ab9a7ccf9c0ebd7c6fcbce600b4c00b52b2fdcf/src/PathSegmentSeparatorAwareTrait.php#L39-L50 |
194,360 | theopera/framework | src/Component/Authorization/AccessControlList.php | AccessControlList.hasAccess | public function hasAccess(UserInterface $user, string $permission) : bool
{
return $this->provider->hasRolePermission($user->getRole(), $permission);
} | php | public function hasAccess(UserInterface $user, string $permission) : bool
{
return $this->provider->hasRolePermission($user->getRole(), $permission);
} | [
"public",
"function",
"hasAccess",
"(",
"UserInterface",
"$",
"user",
",",
"string",
"$",
"permission",
")",
":",
"bool",
"{",
"return",
"$",
"this",
"->",
"provider",
"->",
"hasRolePermission",
"(",
"$",
"user",
"->",
"getRole",
"(",
")",
",",
"$",
"per... | Does the given user have access to the provided permission
@param UserInterface $user
@param string $permission
@return bool | [
"Does",
"the",
"given",
"user",
"have",
"access",
"to",
"the",
"provided",
"permission"
] | fa6165d3891a310faa580c81dee49a63c150c711 | https://github.com/theopera/framework/blob/fa6165d3891a310faa580c81dee49a63c150c711/src/Component/Authorization/AccessControlList.php#L40-L43 |
194,361 | SagittariusX/Beluga.IO | src/Beluga/IO/FolderAccessError.php | FolderAccessError.Read | public static function Read(
string $package, string $folder, string $message = null, int $code = \E_USER_ERROR, \Throwable $previous = null )
: FolderAccessError
{
return new FolderAccessError(
$package,
$folder,
static::ACCESS_READ,
$message,
$code,
... | php | public static function Read(
string $package, string $folder, string $message = null, int $code = \E_USER_ERROR, \Throwable $previous = null )
: FolderAccessError
{
return new FolderAccessError(
$package,
$folder,
static::ACCESS_READ,
$message,
$code,
... | [
"public",
"static",
"function",
"Read",
"(",
"string",
"$",
"package",
",",
"string",
"$",
"folder",
",",
"string",
"$",
"message",
"=",
"null",
",",
"int",
"$",
"code",
"=",
"\\",
"E_USER_ERROR",
",",
"\\",
"Throwable",
"$",
"previous",
"=",
"null",
"... | Init a new \Beluga\IO\FolderAccessError for folder read mode.
@param string $package
@param string $folder The folder where reading fails.
@param string $message The optional error message.
@param integer $code A optional error code (Defaults to \E_USER_ERROR)
@param \Throwable $previous A O... | [
"Init",
"a",
"new",
"\\",
"Beluga",
"\\",
"IO",
"\\",
"FolderAccessError",
"for",
"folder",
"read",
"mode",
"."
] | c8af09a1b3cc8a955e43c89b70779d11b30ae29e | https://github.com/SagittariusX/Beluga.IO/blob/c8af09a1b3cc8a955e43c89b70779d11b30ae29e/src/Beluga/IO/FolderAccessError.php#L123-L135 |
194,362 | SagittariusX/Beluga.IO | src/Beluga/IO/FolderAccessError.php | FolderAccessError.Write | public static function Write(
string $package, string $folder, string $message = null, int $code = \E_USER_ERROR, \Throwable $previous = null )
: FolderAccessError
{
return new FolderAccessError(
$package,
$folder,
static::ACCESS_WRITE,
$message,
$code,
... | php | public static function Write(
string $package, string $folder, string $message = null, int $code = \E_USER_ERROR, \Throwable $previous = null )
: FolderAccessError
{
return new FolderAccessError(
$package,
$folder,
static::ACCESS_WRITE,
$message,
$code,
... | [
"public",
"static",
"function",
"Write",
"(",
"string",
"$",
"package",
",",
"string",
"$",
"folder",
",",
"string",
"$",
"message",
"=",
"null",
",",
"int",
"$",
"code",
"=",
"\\",
"E_USER_ERROR",
",",
"\\",
"Throwable",
"$",
"previous",
"=",
"null",
... | Init a new \Beluga\IO\FolderAccessError for folder write mode.
@param string $package
@param string $folder The folder where reading fails.
@param string $message The optional error message.
@param integer $code A optional error code (Defaults to \E_USER_ERROR)
@param \Throwable $previous A ... | [
"Init",
"a",
"new",
"\\",
"Beluga",
"\\",
"IO",
"\\",
"FolderAccessError",
"for",
"folder",
"write",
"mode",
"."
] | c8af09a1b3cc8a955e43c89b70779d11b30ae29e | https://github.com/SagittariusX/Beluga.IO/blob/c8af09a1b3cc8a955e43c89b70779d11b30ae29e/src/Beluga/IO/FolderAccessError.php#L147-L159 |
194,363 | horntell/php-sdk | lib/guzzle/GuzzleHttp/Adapter/StreamAdapter.php | StreamAdapter.getSaveToBody | private function getSaveToBody(
RequestInterface $request,
StreamInterface $stream
) {
if ($saveTo = $request->getConfig()['save_to']) {
// Stream the response into the destination stream
$saveTo = is_string($saveTo)
? new Stream(Utils::open($saveTo, '... | php | private function getSaveToBody(
RequestInterface $request,
StreamInterface $stream
) {
if ($saveTo = $request->getConfig()['save_to']) {
// Stream the response into the destination stream
$saveTo = is_string($saveTo)
? new Stream(Utils::open($saveTo, '... | [
"private",
"function",
"getSaveToBody",
"(",
"RequestInterface",
"$",
"request",
",",
"StreamInterface",
"$",
"stream",
")",
"{",
"if",
"(",
"$",
"saveTo",
"=",
"$",
"request",
"->",
"getConfig",
"(",
")",
"[",
"'save_to'",
"]",
")",
"{",
"// Stream the resp... | Drain the stream into the destination stream | [
"Drain",
"the",
"stream",
"into",
"the",
"destination",
"stream"
] | e5205e9396a21b754d5651a8aa5898da5922a1b7 | https://github.com/horntell/php-sdk/blob/e5205e9396a21b754d5651a8aa5898da5922a1b7/lib/guzzle/GuzzleHttp/Adapter/StreamAdapter.php#L116-L135 |
194,364 | horntell/php-sdk | lib/guzzle/GuzzleHttp/Adapter/StreamAdapter.php | StreamAdapter.createStream | private function createStream(
RequestInterface $request,
&$http_response_header
) {
static $methods;
if (!$methods) {
$methods = array_flip(get_class_methods(__CLASS__));
}
$params = [];
$options = $this->getDefaultOptions($request);
fore... | php | private function createStream(
RequestInterface $request,
&$http_response_header
) {
static $methods;
if (!$methods) {
$methods = array_flip(get_class_methods(__CLASS__));
}
$params = [];
$options = $this->getDefaultOptions($request);
fore... | [
"private",
"function",
"createStream",
"(",
"RequestInterface",
"$",
"request",
",",
"&",
"$",
"http_response_header",
")",
"{",
"static",
"$",
"methods",
";",
"if",
"(",
"!",
"$",
"methods",
")",
"{",
"$",
"methods",
"=",
"array_flip",
"(",
"get_class_metho... | Create the stream for the request with the context options.
@param RequestInterface $request Request being sent
@param mixed $http_response_header Populated by stream wrapper
@return resource | [
"Create",
"the",
"stream",
"for",
"the",
"request",
"with",
"the",
"context",
"options",
"."
] | e5205e9396a21b754d5651a8aa5898da5922a1b7 | https://github.com/horntell/php-sdk/blob/e5205e9396a21b754d5651a8aa5898da5922a1b7/lib/guzzle/GuzzleHttp/Adapter/StreamAdapter.php#L192-L219 |
194,365 | perryflynn/PerrysLambda | src/PerrysLambda/IO/File.php | File.openDir | public function openDir()
{
if(!$this->isDir())
{
throw new IOException("Not a directory");
}
$dirconv = DirectoryConverter::fromPath($this);
$dirconv->setRoot($this->getRootDirectory());
$type = $this->getDirectoryType();
return new $type($dircon... | php | public function openDir()
{
if(!$this->isDir())
{
throw new IOException("Not a directory");
}
$dirconv = DirectoryConverter::fromPath($this);
$dirconv->setRoot($this->getRootDirectory());
$type = $this->getDirectoryType();
return new $type($dircon... | [
"public",
"function",
"openDir",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isDir",
"(",
")",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"Not a directory\"",
")",
";",
"}",
"$",
"dirconv",
"=",
"DirectoryConverter",
"::",
"fromPath",
"(",
... | Open new Directory instance
@return \PerrysLambda\IO\Directory | [
"Open",
"new",
"Directory",
"instance"
] | 9f1734ae4689d73278b887f9354dfd31428e96de | https://github.com/perryflynn/PerrysLambda/blob/9f1734ae4689d73278b887f9354dfd31428e96de/src/PerrysLambda/IO/File.php#L138-L150 |
194,366 | pluf/tenant | src/Tenant/Views/BankBackend.php | Tenant_Views_BankBackend.get | public function get($request, $match, $p)
{
$backend = parent::getObject($request, $match, $p);
if ($backend->tenant !== Tenant_Shortcuts_GetMainTenant()->id) {
throw new Pluf_HTTP_Error404("Object not found (" . $p['model'] . "," . $backend->id . ")");
}
return $backend;... | php | public function get($request, $match, $p)
{
$backend = parent::getObject($request, $match, $p);
if ($backend->tenant !== Tenant_Shortcuts_GetMainTenant()->id) {
throw new Pluf_HTTP_Error404("Object not found (" . $p['model'] . "," . $backend->id . ")");
}
return $backend;... | [
"public",
"function",
"get",
"(",
"$",
"request",
",",
"$",
"match",
",",
"$",
"p",
")",
"{",
"$",
"backend",
"=",
"parent",
"::",
"getObject",
"(",
"$",
"request",
",",
"$",
"match",
",",
"$",
"p",
")",
";",
"if",
"(",
"$",
"backend",
"->",
"t... | Returns bank-backend determined by given id.
This method returns backend if and only if backend with given id blongs to main tenant
else it throws not found exception
@param Pluf_HTTP_Request $request
@param array $match
@param array $p | [
"Returns",
"bank",
"-",
"backend",
"determined",
"by",
"given",
"id",
".",
"This",
"method",
"returns",
"backend",
"if",
"and",
"only",
"if",
"backend",
"with",
"given",
"id",
"blongs",
"to",
"main",
"tenant",
"else",
"it",
"throws",
"not",
"found",
"excep... | a06359c52b9a257b5a0a186264e8770acfc54b73 | https://github.com/pluf/tenant/blob/a06359c52b9a257b5a0a186264e8770acfc54b73/src/Tenant/Views/BankBackend.php#L39-L46 |
194,367 | brightnucleus/options-store | src/OptionsStore.php | OptionsStore.set | public function set(string $key, $value): Option
{
$option = $this->repository->find($key);
return $option->setValue($value);
} | php | public function set(string $key, $value): Option
{
$option = $this->repository->find($key);
return $option->setValue($value);
} | [
"public",
"function",
"set",
"(",
"string",
"$",
"key",
",",
"$",
"value",
")",
":",
"Option",
"{",
"$",
"option",
"=",
"$",
"this",
"->",
"repository",
"->",
"find",
"(",
"$",
"key",
")",
";",
"return",
"$",
"option",
"->",
"setValue",
"(",
"$",
... | Set the value for a specific key.
@since 0.1.0
@param string $key Option key to set the value of.
@param mixed $value New value to set the option to.
@return Option Modified Option object. | [
"Set",
"the",
"value",
"for",
"a",
"specific",
"key",
"."
] | 9a9ef2a160bbacd69fe3e9db0be8ed89e6905ef1 | https://github.com/brightnucleus/options-store/blob/9a9ef2a160bbacd69fe3e9db0be8ed89e6905ef1/src/OptionsStore.php#L114-L119 |
194,368 | mossphp/moss-storage | Moss/Storage/Model/Definition/Relation/AbstractRelation.php | AbstractRelation.containerName | protected function containerName($container = null)
{
if ($container !== null) {
return $container;
}
$pos = strrpos($this->entity, '\\');
if ($pos === false) {
return $this->entity;
}
return substr($this->entity, strrpos($this->entity, '\\')... | php | protected function containerName($container = null)
{
if ($container !== null) {
return $container;
}
$pos = strrpos($this->entity, '\\');
if ($pos === false) {
return $this->entity;
}
return substr($this->entity, strrpos($this->entity, '\\')... | [
"protected",
"function",
"containerName",
"(",
"$",
"container",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"container",
"!==",
"null",
")",
"{",
"return",
"$",
"container",
";",
"}",
"$",
"pos",
"=",
"strrpos",
"(",
"$",
"this",
"->",
"entity",
",",
"'\... | Returns container name or builds it from namespaced class name if passed name is empty string
@param null|string $container
@return string | [
"Returns",
"container",
"name",
"or",
"builds",
"it",
"from",
"namespaced",
"class",
"name",
"if",
"passed",
"name",
"is",
"empty",
"string"
] | 0d123e7ae6bbfce1e2a18e73bf70997277b430c1 | https://github.com/mossphp/moss-storage/blob/0d123e7ae6bbfce1e2a18e73bf70997277b430c1/Moss/Storage/Model/Definition/Relation/AbstractRelation.php#L46-L58 |
194,369 | mossphp/moss-storage | Moss/Storage/Model/Definition/Relation/AbstractRelation.php | AbstractRelation.assignKeys | protected function assignKeys(array $keys, array &$container)
{
foreach ($keys as $local => $foreign) {
$this->assertField($local);
$this->assertField($foreign);
$container[$local] = $foreign;
}
} | php | protected function assignKeys(array $keys, array &$container)
{
foreach ($keys as $local => $foreign) {
$this->assertField($local);
$this->assertField($foreign);
$container[$local] = $foreign;
}
} | [
"protected",
"function",
"assignKeys",
"(",
"array",
"$",
"keys",
",",
"array",
"&",
"$",
"container",
")",
"{",
"foreach",
"(",
"$",
"keys",
"as",
"$",
"local",
"=>",
"$",
"foreign",
")",
"{",
"$",
"this",
"->",
"assertField",
"(",
"$",
"local",
")"... | Assigns key pairs to passed container
@param array $keys
@param array $container | [
"Assigns",
"key",
"pairs",
"to",
"passed",
"container"
] | 0d123e7ae6bbfce1e2a18e73bf70997277b430c1 | https://github.com/mossphp/moss-storage/blob/0d123e7ae6bbfce1e2a18e73bf70997277b430c1/Moss/Storage/Model/Definition/Relation/AbstractRelation.php#L66-L74 |
194,370 | mossphp/moss-storage | Moss/Storage/Model/Definition/Relation/AbstractRelation.php | AbstractRelation.assertTroughKeys | protected function assertTroughKeys($inKeys, $outKeys)
{
if (empty($inKeys) || empty($outKeys)) {
throw new DefinitionException(sprintf('Invalid keys for relation "%s", must be two arrays with key-value pairs', $this->entity, count($inKeys)));
}
if (count($inKeys) !== count($out... | php | protected function assertTroughKeys($inKeys, $outKeys)
{
if (empty($inKeys) || empty($outKeys)) {
throw new DefinitionException(sprintf('Invalid keys for relation "%s", must be two arrays with key-value pairs', $this->entity, count($inKeys)));
}
if (count($inKeys) !== count($out... | [
"protected",
"function",
"assertTroughKeys",
"(",
"$",
"inKeys",
",",
"$",
"outKeys",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"inKeys",
")",
"||",
"empty",
"(",
"$",
"outKeys",
")",
")",
"{",
"throw",
"new",
"DefinitionException",
"(",
"sprintf",
"(",
... | Asserts trough keys, must be same number in both arrays
@param array $inKeys
@param array $outKeys
@throws DefinitionException | [
"Asserts",
"trough",
"keys",
"must",
"be",
"same",
"number",
"in",
"both",
"arrays"
] | 0d123e7ae6bbfce1e2a18e73bf70997277b430c1 | https://github.com/mossphp/moss-storage/blob/0d123e7ae6bbfce1e2a18e73bf70997277b430c1/Moss/Storage/Model/Definition/Relation/AbstractRelation.php#L99-L108 |
194,371 | mossphp/moss-storage | Moss/Storage/Model/Definition/Relation/AbstractRelation.php | AbstractRelation.assertField | protected function assertField($field)
{
if (empty($field)) {
throw new DefinitionException(sprintf('Invalid field name for relation "%s.%s" can not be empty', $this->entity, $field));
}
if (is_numeric($field)) {
throw new DefinitionException(sprintf('Invalid field n... | php | protected function assertField($field)
{
if (empty($field)) {
throw new DefinitionException(sprintf('Invalid field name for relation "%s.%s" can not be empty', $this->entity, $field));
}
if (is_numeric($field)) {
throw new DefinitionException(sprintf('Invalid field n... | [
"protected",
"function",
"assertField",
"(",
"$",
"field",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"field",
")",
")",
"{",
"throw",
"new",
"DefinitionException",
"(",
"sprintf",
"(",
"'Invalid field name for relation \"%s.%s\" can not be empty'",
",",
"$",
"this",... | Asserts field name
@param string $field
@throws DefinitionException | [
"Asserts",
"field",
"name"
] | 0d123e7ae6bbfce1e2a18e73bf70997277b430c1 | https://github.com/mossphp/moss-storage/blob/0d123e7ae6bbfce1e2a18e73bf70997277b430c1/Moss/Storage/Model/Definition/Relation/AbstractRelation.php#L117-L130 |
194,372 | makinacorpus/drupal-apubsub | src/Admin/FormatterListForm.php | FormatterListForm.disableSubmit | public function disableSubmit(array &$form, FormStateInterface $form_state)
{
$types = array();
foreach ($form_state->getValue('types') as $type => $selected) {
if ($type === $selected) {
$types[] = $type;
}
}
if (empty($types)) {
... | php | public function disableSubmit(array &$form, FormStateInterface $form_state)
{
$types = array();
foreach ($form_state->getValue('types') as $type => $selected) {
if ($type === $selected) {
$types[] = $type;
}
}
if (empty($types)) {
... | [
"public",
"function",
"disableSubmit",
"(",
"array",
"&",
"$",
"form",
",",
"FormStateInterface",
"$",
"form_state",
")",
"{",
"$",
"types",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"form_state",
"->",
"getValue",
"(",
"'types'",
")",
"as",
"$",... | Notification types admin form disable selected submit handler | [
"Notification",
"types",
"admin",
"form",
"disable",
"selected",
"submit",
"handler"
] | 534fbecf67c880996ae02210c0bfdb3e0d3699b6 | https://github.com/makinacorpus/drupal-apubsub/blob/534fbecf67c880996ae02210c0bfdb3e0d3699b6/src/Admin/FormatterListForm.php#L127-L151 |
194,373 | squareproton/Bond | src/Bond/Repository.php | Repository.find | public function find( $key, $disableLateLoading = null )
{
// $disableLateLoading default value management
if( !is_bool( $disableLateLoading ) ) {
$disableLateLoading = false;
}
// empty key
if( is_null( $key ) or !is_scalar( $key ) or strlen( trim( $key ) ) ===... | php | public function find( $key, $disableLateLoading = null )
{
// $disableLateLoading default value management
if( !is_bool( $disableLateLoading ) ) {
$disableLateLoading = false;
}
// empty key
if( is_null( $key ) or !is_scalar( $key ) or strlen( trim( $key ) ) ===... | [
"public",
"function",
"find",
"(",
"$",
"key",
",",
"$",
"disableLateLoading",
"=",
"null",
")",
"{",
"// $disableLateLoading default value management",
"if",
"(",
"!",
"is_bool",
"(",
"$",
"disableLateLoading",
")",
")",
"{",
"$",
"disableLateLoading",
"=",
"fa... | Lookup a entity based on it's 'primary key' or key column
This will either return null or a Entity
@param mixed $key
@param bool $disableLateLoading | [
"Lookup",
"a",
"entity",
"based",
"on",
"it",
"s",
"primary",
"key",
"or",
"key",
"column",
"This",
"will",
"either",
"return",
"null",
"or",
"a",
"Entity"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Repository.php#L167-L188 |
194,374 | squareproton/Bond | src/Bond/Repository.php | Repository.entityFactory | private function entityFactory()
{
// this is a little tortuous but some constructor flows require the EntityManager
// as this point in the refactor I'm unwilling to modify the constructor of the Entity
// TODO. Fix this. Constructor injection
$entity = $this->reflEntityClass->newIn... | php | private function entityFactory()
{
// this is a little tortuous but some constructor flows require the EntityManager
// as this point in the refactor I'm unwilling to modify the constructor of the Entity
// TODO. Fix this. Constructor injection
$entity = $this->reflEntityClass->newIn... | [
"private",
"function",
"entityFactory",
"(",
")",
"{",
"// this is a little tortuous but some constructor flows require the EntityManager",
"// as this point in the refactor I'm unwilling to modify the constructor of the Entity",
"// TODO. Fix this. Constructor injection",
"$",
"entity",
"=",
... | Temp helper method which actually does the instantiation work and ensure our Entity has a link to the EntityManager
@return Bond\Base | [
"Temp",
"helper",
"method",
"which",
"actually",
"does",
"the",
"instantiation",
"work",
"and",
"ensure",
"our",
"Entity",
"has",
"a",
"link",
"to",
"the",
"EntityManager"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Repository.php#L239-L252 |
194,375 | squareproton/Bond | src/Bond/Repository.php | Repository.make | public function make( array $data = null )
{
if( !$this->makeableSafetyCheck() ) {
return null;
}
$entity = $this->entityFactory();
if( $data !== null ) {
$entity->set(
$data,
// as data is a array the second argument doesn't ... | php | public function make( array $data = null )
{
if( !$this->makeableSafetyCheck() ) {
return null;
}
$entity = $this->entityFactory();
if( $data !== null ) {
$entity->set(
$data,
// as data is a array the second argument doesn't ... | [
"public",
"function",
"make",
"(",
"array",
"$",
"data",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"makeableSafetyCheck",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"$",
"entity",
"=",
"$",
"this",
"->",
"entityFactory",
"(",
"... | Returns a new entity of the correct type.
@return Base | [
"Returns",
"a",
"new",
"entity",
"of",
"the",
"correct",
"type",
"."
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Repository.php#L258-L277 |
194,376 | squareproton/Bond | src/Bond/Repository.php | Repository.makeableSafetyCheck | protected function makeableSafetyCheck()
{
// makeable check
switch( $this->makeable ) {
case self::MAKEABLE_DISABLE:
return false;
case self::MAKEABLE_EXCEPTION:
throw new EntityNotMakeableException("Making objects of this type is restricted. ... | php | protected function makeableSafetyCheck()
{
// makeable check
switch( $this->makeable ) {
case self::MAKEABLE_DISABLE:
return false;
case self::MAKEABLE_EXCEPTION:
throw new EntityNotMakeableException("Making objects of this type is restricted. ... | [
"protected",
"function",
"makeableSafetyCheck",
"(",
")",
"{",
"// makeable check",
"switch",
"(",
"$",
"this",
"->",
"makeable",
")",
"{",
"case",
"self",
"::",
"MAKEABLE_DISABLE",
":",
"return",
"false",
";",
"case",
"self",
"::",
"MAKEABLE_EXCEPTION",
":",
... | Check to see if a repository is makeable
@return bool; | [
"Check",
"to",
"see",
"if",
"a",
"repository",
"is",
"makeable"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Repository.php#L283-L293 |
194,377 | squareproton/Bond | src/Bond/Repository.php | Repository.hasReference | public function hasReference( $reference, &$referenceDetail = null )
{
$referenceDetail = null;
foreach( $this->__get('references') as $name => $detail ) {
if( $name == $reference or $detail[0] == $reference ) {
$referenceDetail = $detail;
return $name;... | php | public function hasReference( $reference, &$referenceDetail = null )
{
$referenceDetail = null;
foreach( $this->__get('references') as $name => $detail ) {
if( $name == $reference or $detail[0] == $reference ) {
$referenceDetail = $detail;
return $name;... | [
"public",
"function",
"hasReference",
"(",
"$",
"reference",
",",
"&",
"$",
"referenceDetail",
"=",
"null",
")",
"{",
"$",
"referenceDetail",
"=",
"null",
";",
"foreach",
"(",
"$",
"this",
"->",
"__get",
"(",
"'references'",
")",
"as",
"$",
"name",
"=>",... | Check if Entity has link
@param mixed $reference
@param mixed $referenceDetail
@return boolean | [
"Check",
"if",
"Entity",
"has",
"link"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Repository.php#L441-L457 |
194,378 | squareproton/Bond | src/Bond/Repository.php | Repository.referencesGet | public function referencesGet( $entityOrContainer, $reference, $source = null )
{
if( !( $entityOrContainer instanceof Base || $entityOrContainer instanceof Container ) ) {
throw new \InvalidArgumentException("You can only lookup references by Entity or Container");
}
if( !$thi... | php | public function referencesGet( $entityOrContainer, $reference, $source = null )
{
if( !( $entityOrContainer instanceof Base || $entityOrContainer instanceof Container ) ) {
throw new \InvalidArgumentException("You can only lookup references by Entity or Container");
}
if( !$thi... | [
"public",
"function",
"referencesGet",
"(",
"$",
"entityOrContainer",
",",
"$",
"reference",
",",
"$",
"source",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"(",
"$",
"entityOrContainer",
"instanceof",
"Base",
"||",
"$",
"entityOrContainer",
"instanceof",
"Containe... | Get all references
@param Base|Container $entityOrContainer - Starting Entity.
@param mixed $foreignEntity - The type of target Entity we want to retrieve.
@param int $source - The source of the links, either PERSISTED, UNPERSISTED, CHANGED or ALL.
@return Entity|Container|null - whatever is apropriate for the link t... | [
"Get",
"all",
"references"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Repository.php#L468-L497 |
194,379 | squareproton/Bond | src/Bond/Repository.php | Repository.hasLink | public function hasLink( $link, &$linkDetail = null )
{
$links = $this->__get('links');
if( isset($links[$link])) {
$linkDetail = $links[$link];
return $link;
}
foreach( $links as $via => $linkDetail ){
if( in_array( $link, $linkDetail->foreignE... | php | public function hasLink( $link, &$linkDetail = null )
{
$links = $this->__get('links');
if( isset($links[$link])) {
$linkDetail = $links[$link];
return $link;
}
foreach( $links as $via => $linkDetail ){
if( in_array( $link, $linkDetail->foreignE... | [
"public",
"function",
"hasLink",
"(",
"$",
"link",
",",
"&",
"$",
"linkDetail",
"=",
"null",
")",
"{",
"$",
"links",
"=",
"$",
"this",
"->",
"__get",
"(",
"'links'",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"links",
"[",
"$",
"link",
"]",
")",
"... | Check if Entity has a named link
@param mixed $linkName or $foreignEntity
@param mixed $linkDetail - Link information
@return mixed | [
"Check",
"if",
"Entity",
"has",
"a",
"named",
"link"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Repository.php#L506-L524 |
194,380 | squareproton/Bond | src/Bond/Repository.php | Repository.findByApiKey | public function findByApiKey( $value )
{
$apiOptions = $this->__get('apiOptions');
if( !isset( $apiOptions['findByKey'] ) ) {
return $this->find( $value, true );
}
$property = $apiOptions['findByKey'];
$filter = $this->getFindFilterFactory()
->get(... | php | public function findByApiKey( $value )
{
$apiOptions = $this->__get('apiOptions');
if( !isset( $apiOptions['findByKey'] ) ) {
return $this->find( $value, true );
}
$property = $apiOptions['findByKey'];
$filter = $this->getFindFilterFactory()
->get(... | [
"public",
"function",
"findByApiKey",
"(",
"$",
"value",
")",
"{",
"$",
"apiOptions",
"=",
"$",
"this",
"->",
"__get",
"(",
"'apiOptions'",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"apiOptions",
"[",
"'findByKey'",
"]",
")",
")",
"{",
"return",
"... | Look up a entity based on it's api key
@param mixed $value
@return entity | | [
"Look",
"up",
"a",
"entity",
"based",
"on",
"it",
"s",
"api",
"key"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Repository.php#L590-L610 |
194,381 | squareproton/Bond | src/Bond/Repository.php | Repository.getFindFilterFactory | private function getFindFilterFactory( $source = 0 )
{
$propertyMappers = [ PropertyMapperEntityData::class ];
if( $source & Base::INITIAL ) {
$propertyMappers[] = [ PropertyMapperEntityInitial::class ];
}
return new FindFilterComponentFactory( $propertyMappers );
} | php | private function getFindFilterFactory( $source = 0 )
{
$propertyMappers = [ PropertyMapperEntityData::class ];
if( $source & Base::INITIAL ) {
$propertyMappers[] = [ PropertyMapperEntityInitial::class ];
}
return new FindFilterComponentFactory( $propertyMappers );
} | [
"private",
"function",
"getFindFilterFactory",
"(",
"$",
"source",
"=",
"0",
")",
"{",
"$",
"propertyMappers",
"=",
"[",
"PropertyMapperEntityData",
"::",
"class",
"]",
";",
"if",
"(",
"$",
"source",
"&",
"Base",
"::",
"INITIAL",
")",
"{",
"$",
"propertyMa... | Instantiate a appropriate FindFilterFactory
@param int Bitfield Bond\Entity\Base::INITIAL and possibly others
@return Bond\Container\FindFilterFactory | [
"Instantiate",
"a",
"appropriate",
"FindFilterFactory"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Repository.php#L734-L741 |
194,382 | squareproton/Bond | src/Bond/Repository.php | Repository.findByFilterComponentsSourceSetup | protected function findByFilterComponentsSourceSetup( $source )
{
// Set source defaults
if( !( $source & ( self::PERSISTED | self::UNPERSISTED ) ) ) {
$source += self::PERSISTED + self::UNPERSISTED;
}
if( !( $source & ( self::CHANGED | self::UNCHANGED ) ) ) {
... | php | protected function findByFilterComponentsSourceSetup( $source )
{
// Set source defaults
if( !( $source & ( self::PERSISTED | self::UNPERSISTED ) ) ) {
$source += self::PERSISTED + self::UNPERSISTED;
}
if( !( $source & ( self::CHANGED | self::UNCHANGED ) ) ) {
... | [
"protected",
"function",
"findByFilterComponentsSourceSetup",
"(",
"$",
"source",
")",
"{",
"// Set source defaults",
"if",
"(",
"!",
"(",
"$",
"source",
"&",
"(",
"self",
"::",
"PERSISTED",
"|",
"self",
"::",
"UNPERSISTED",
")",
")",
")",
"{",
"$",
"source"... | Set source defaults.
Helper method of findByFilterComponents
@param mixed $source | [
"Set",
"source",
"defaults",
".",
"Helper",
"method",
"of",
"findByFilterComponents"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Repository.php#L748-L770 |
194,383 | squareproton/Bond | src/Bond/Repository.php | Repository.findByFilterComponentsFormatReturnValue | public function findByFilterComponentsFormatReturnValue( $qty, Container $output )
{
if( $qty === FindFilterComponentFactory::FIND_ALL ) {
return $output;
}
switch( $count = count( $output ) ) {
case 0:
return null;
case 1:
... | php | public function findByFilterComponentsFormatReturnValue( $qty, Container $output )
{
if( $qty === FindFilterComponentFactory::FIND_ALL ) {
return $output;
}
switch( $count = count( $output ) ) {
case 0:
return null;
case 1:
... | [
"public",
"function",
"findByFilterComponentsFormatReturnValue",
"(",
"$",
"qty",
",",
"Container",
"$",
"output",
")",
"{",
"if",
"(",
"$",
"qty",
"===",
"FindFilterComponentFactory",
"::",
"FIND_ALL",
")",
"{",
"return",
"$",
"output",
";",
"}",
"switch",
"(... | Format the return value of a findByFilterComponents query
@param self::FIND_ALL|FIND_ONE $qty
@param Container $output
@return Container | [
"Format",
"the",
"return",
"value",
"of",
"a",
"findByFilterComponents",
"query"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Repository.php#L778-L794 |
194,384 | squareproton/Bond | src/Bond/Repository.php | Repository.findByFilterComponentsDatabase | protected function findByFilterComponentsDatabase( array $filterComponents, $source )
{
// hit the database and find something
$query = $this->buildQuery( $this->db, $filterComponents );
// get records from database
$result = $this->db->query( $query )->fetch( Result::FLATTEN_PREVE... | php | protected function findByFilterComponentsDatabase( array $filterComponents, $source )
{
// hit the database and find something
$query = $this->buildQuery( $this->db, $filterComponents );
// get records from database
$result = $this->db->query( $query )->fetch( Result::FLATTEN_PREVE... | [
"protected",
"function",
"findByFilterComponentsDatabase",
"(",
"array",
"$",
"filterComponents",
",",
"$",
"source",
")",
"{",
"// hit the database and find something",
"$",
"query",
"=",
"$",
"this",
"->",
"buildQuery",
"(",
"$",
"this",
"->",
"db",
",",
"$",
... | Find a entity having been passed the filters.
@param array $filterComponents
@return Base|Container | [
"Find",
"a",
"entity",
"having",
"been",
"passed",
"the",
"filters",
"."
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Repository.php#L802-L834 |
194,385 | squareproton/Bond | src/Bond/Repository.php | Repository.buildQuery | protected function buildQuery( QuoteInterface $db, $filterComponents )
{
// primary keys
$filterTags = array();
$dataTypes = $this->dataTypesGet();
// have we got components that we can't handle
if( $dataTypesMissing = array_diff( array_keys( $filterComponents ), array_keys... | php | protected function buildQuery( QuoteInterface $db, $filterComponents )
{
// primary keys
$filterTags = array();
$dataTypes = $this->dataTypesGet();
// have we got components that we can't handle
if( $dataTypesMissing = array_diff( array_keys( $filterComponents ), array_keys... | [
"protected",
"function",
"buildQuery",
"(",
"QuoteInterface",
"$",
"db",
",",
"$",
"filterComponents",
")",
"{",
"// primary keys",
"$",
"filterTags",
"=",
"array",
"(",
")",
";",
"$",
"dataTypes",
"=",
"$",
"this",
"->",
"dataTypesGet",
"(",
")",
";",
"//... | Build a Query object
@param array $filterComponents
@return Bond\Pg\Query | [
"Build",
"a",
"Query",
"object"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Repository.php#L921-L958 |
194,386 | squareproton/Bond | src/Bond/Repository.php | Repository.dataTypesGet | public function dataTypesGet( $filter = null )
{
// array of string
if( func_num_args() > 1 and \Bond\array_check( 'is_string', func_get_args() ) ) {
$filter = func_get_args();
}
// filter constants
if( is_int( $filter ) ) {
$dataTypes = array();
... | php | public function dataTypesGet( $filter = null )
{
// array of string
if( func_num_args() > 1 and \Bond\array_check( 'is_string', func_get_args() ) ) {
$filter = func_get_args();
}
// filter constants
if( is_int( $filter ) ) {
$dataTypes = array();
... | [
"public",
"function",
"dataTypesGet",
"(",
"$",
"filter",
"=",
"null",
")",
"{",
"// array of string",
"if",
"(",
"func_num_args",
"(",
")",
">",
"1",
"and",
"\\",
"Bond",
"\\",
"array_check",
"(",
"'is_string'",
",",
"func_get_args",
"(",
")",
")",
")",
... | Helper function. Get dataTypes for this Entity.
@return array | [
"Helper",
"function",
".",
"Get",
"dataTypes",
"for",
"this",
"Entity",
"."
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Repository.php#L1065-L1139 |
194,387 | squareproton/Bond | src/Bond/Repository.php | Repository.getFilterByIsChangedCallback | public function getFilterByIsChangedCallback( $source )
{
$changed = !( $source & self::CHANGED );
$unchanged = !( $source & self::UNCHANGED );
if( $changed and $unchanged ) {
return function() {
return false;
};
}
if( !$changed and ... | php | public function getFilterByIsChangedCallback( $source )
{
$changed = !( $source & self::CHANGED );
$unchanged = !( $source & self::UNCHANGED );
if( $changed and $unchanged ) {
return function() {
return false;
};
}
if( !$changed and ... | [
"public",
"function",
"getFilterByIsChangedCallback",
"(",
"$",
"source",
")",
"{",
"$",
"changed",
"=",
"!",
"(",
"$",
"source",
"&",
"self",
"::",
"CHANGED",
")",
";",
"$",
"unchanged",
"=",
"!",
"(",
"$",
"source",
"&",
"self",
"::",
"UNCHANGED",
")... | Filter entities by their changed status.
@param bool $changed. Remove entities which are changed
@param bool $uchanged. Remove unchanged entities
@return $this | [
"Filter",
"entities",
"by",
"their",
"changed",
"status",
"."
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Repository.php#L1147-L1169 |
194,388 | squareproton/Bond | src/Bond/Repository.php | Repository.makeNewContainer | protected function makeNewContainer()
{
$container = new Container();
$container->classSet($this->entityClass);
$container->setPropertyMapper( PropertyMapperEntityData::class );
return $container;
} | php | protected function makeNewContainer()
{
$container = new Container();
$container->classSet($this->entityClass);
$container->setPropertyMapper( PropertyMapperEntityData::class );
return $container;
} | [
"protected",
"function",
"makeNewContainer",
"(",
")",
"{",
"$",
"container",
"=",
"new",
"Container",
"(",
")",
";",
"$",
"container",
"->",
"classSet",
"(",
"$",
"this",
"->",
"entityClass",
")",
";",
"$",
"container",
"->",
"setPropertyMapper",
"(",
"Pr... | Get a new Container
@param string Class
@return Bond\Container | [
"Get",
"a",
"new",
"Container"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Repository.php#L1203-L1209 |
194,389 | maddoger/yii2-cms-user | backend/controllers/RoleController.php | RoleController.actionCreate | public function actionCreate()
{
$model = new Role();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->name]);
} else {
return $this->render('create', [
'model' => $model,
])... | php | public function actionCreate()
{
$model = new Role();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['view', 'id' => $model->name]);
} else {
return $this->render('create', [
'model' => $model,
])... | [
"public",
"function",
"actionCreate",
"(",
")",
"{",
"$",
"model",
"=",
"new",
"Role",
"(",
")",
";",
"if",
"(",
"$",
"model",
"->",
"load",
"(",
"Yii",
"::",
"$",
"app",
"->",
"request",
"->",
"post",
"(",
")",
")",
"&&",
"$",
"model",
"->",
"... | Creates a new Role model.
If creation is successful, the browser will be redirected to the 'view' page.
@return mixed | [
"Creates",
"a",
"new",
"Role",
"model",
".",
"If",
"creation",
"is",
"successful",
"the",
"browser",
"will",
"be",
"redirected",
"to",
"the",
"view",
"page",
"."
] | 6792d1d0d2c0bf01fe87729985b5659de4c1aac1 | https://github.com/maddoger/yii2-cms-user/blob/6792d1d0d2c0bf01fe87729985b5659de4c1aac1/backend/controllers/RoleController.php#L99-L110 |
194,390 | maddoger/yii2-cms-user | backend/controllers/RoleController.php | RoleController.findModel | protected function findModel($id)
{
if (($model = Role::findByName($id)) !== null) {
return $model;
} else {
throw new NotFoundHttpException(Yii::t('maddoger/user', 'The requested role does not exist.'));
}
} | php | protected function findModel($id)
{
if (($model = Role::findByName($id)) !== null) {
return $model;
} else {
throw new NotFoundHttpException(Yii::t('maddoger/user', 'The requested role does not exist.'));
}
} | [
"protected",
"function",
"findModel",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"(",
"$",
"model",
"=",
"Role",
"::",
"findByName",
"(",
"$",
"id",
")",
")",
"!==",
"null",
")",
"{",
"return",
"$",
"model",
";",
"}",
"else",
"{",
"throw",
"new",
"NotF... | Finds the Role model based on its primary key value.
If the model is not found, a 404 HTTP exception will be thrown.
@param string $id
@return Role the loaded model
@throws NotFoundHttpException if the model cannot be found | [
"Finds",
"the",
"Role",
"model",
"based",
"on",
"its",
"primary",
"key",
"value",
".",
"If",
"the",
"model",
"is",
"not",
"found",
"a",
"404",
"HTTP",
"exception",
"will",
"be",
"thrown",
"."
] | 6792d1d0d2c0bf01fe87729985b5659de4c1aac1 | https://github.com/maddoger/yii2-cms-user/blob/6792d1d0d2c0bf01fe87729985b5659de4c1aac1/backend/controllers/RoleController.php#L341-L348 |
194,391 | zodream/database | src/Query/Builder.php | Builder.flush | public function flush($tag) {
$args = func_get_args();
foreach ($args as $item) {
if (in_array($item, $this->sequence)) {
$this->$item = [];
}
}
return $this;
} | php | public function flush($tag) {
$args = func_get_args();
foreach ($args as $item) {
if (in_array($item, $this->sequence)) {
$this->$item = [];
}
}
return $this;
} | [
"public",
"function",
"flush",
"(",
"$",
"tag",
")",
"{",
"$",
"args",
"=",
"func_get_args",
"(",
")",
";",
"foreach",
"(",
"$",
"args",
"as",
"$",
"item",
")",
"{",
"if",
"(",
"in_array",
"(",
"$",
"item",
",",
"$",
"this",
"->",
"sequence",
")"... | MAKE LIKE 'SELECT' TO EMPTY ARRAY!
@param $tag
@return static | [
"MAKE",
"LIKE",
"SELECT",
"TO",
"EMPTY",
"ARRAY!"
] | 03712219c057799d07350a3a2650c55bcc92c28e | https://github.com/zodream/database/blob/03712219c057799d07350a3a2650c55bcc92c28e/src/Query/Builder.php#L94-L102 |
194,392 | zodream/database | src/Query/Builder.php | Builder.getBindings | public function getBindings() {
$keys = func_num_args() < 1 ? array_keys($this->bindings) : func_get_args();
$args = [];
foreach ($keys as $item) {
if (!array_key_exists($item, $this->bindings)) {
continue;
}
$args = array_merge($args, $this->b... | php | public function getBindings() {
$keys = func_num_args() < 1 ? array_keys($this->bindings) : func_get_args();
$args = [];
foreach ($keys as $item) {
if (!array_key_exists($item, $this->bindings)) {
continue;
}
$args = array_merge($args, $this->b... | [
"public",
"function",
"getBindings",
"(",
")",
"{",
"$",
"keys",
"=",
"func_num_args",
"(",
")",
"<",
"1",
"?",
"array_keys",
"(",
"$",
"this",
"->",
"bindings",
")",
":",
"func_get_args",
"(",
")",
";",
"$",
"args",
"=",
"[",
"]",
";",
"foreach",
... | Get the current query value bindings in a flattened array.
@return array | [
"Get",
"the",
"current",
"query",
"value",
"bindings",
"in",
"a",
"flattened",
"array",
"."
] | 03712219c057799d07350a3a2650c55bcc92c28e | https://github.com/zodream/database/blob/03712219c057799d07350a3a2650c55bcc92c28e/src/Query/Builder.php#L253-L263 |
194,393 | sil-project/SeedBatchBundle | src/Entity/CertificationType.php | CertificationType.setLogo | public function setLogo($logo = null)
{
// @TODO: Ugly hack to avoid $form->handleRequest() changing this value from null to empty array
if (is_array($logo)) {
$logo = null;
}
$this->logo = $logo;
return $this;
} | php | public function setLogo($logo = null)
{
// @TODO: Ugly hack to avoid $form->handleRequest() changing this value from null to empty array
if (is_array($logo)) {
$logo = null;
}
$this->logo = $logo;
return $this;
} | [
"public",
"function",
"setLogo",
"(",
"$",
"logo",
"=",
"null",
")",
"{",
"// @TODO: Ugly hack to avoid $form->handleRequest() changing this value from null to empty array",
"if",
"(",
"is_array",
"(",
"$",
"logo",
")",
")",
"{",
"$",
"logo",
"=",
"null",
";",
"}",
... | Set logo.
@param \Librinfo\MediaBundle\Entity\File $logo
@return CertificationType | [
"Set",
"logo",
"."
] | a2640b5359fe31d3bdb9c9fa2f72141ac841729c | https://github.com/sil-project/SeedBatchBundle/blob/a2640b5359fe31d3bdb9c9fa2f72141ac841729c/src/Entity/CertificationType.php#L98-L108 |
194,394 | enikeishik/ufoframework | src/Ufo/Modules/Controller.php | Controller.compose | public function compose(Section $section = null): Result
{
$this->container->set('section', $section);
if (null !== $section) {
$this->initParams();
$this->setParams($section->params);
$this->container->set('params', $this->params);
}
... | php | public function compose(Section $section = null): Result
{
$this->container->set('section', $section);
if (null !== $section) {
$this->initParams();
$this->setParams($section->params);
$this->container->set('params', $this->params);
}
... | [
"public",
"function",
"compose",
"(",
"Section",
"$",
"section",
"=",
"null",
")",
":",
"Result",
"{",
"$",
"this",
"->",
"container",
"->",
"set",
"(",
"'section'",
",",
"$",
"section",
")",
";",
"if",
"(",
"null",
"!==",
"$",
"section",
")",
"{",
... | Main controller method, compose all content.
@param \Ufo\Core\Section $section = null
@return \Ufo\Core\Result
@throws \Ufo\Core\ModuleParameterConflictException
@throws \Ufo\Core\ModuleParameterFormatException;
@throws \Ufo\Core\ModuleParameterUnknownException | [
"Main",
"controller",
"method",
"compose",
"all",
"content",
"."
] | fb44461bcb0506dbc3257724a2281f756594f62f | https://github.com/enikeishik/ufoframework/blob/fb44461bcb0506dbc3257724a2281f756594f62f/src/Ufo/Modules/Controller.php#L71-L84 |
194,395 | enikeishik/ufoframework | src/Ufo/Modules/Controller.php | Controller.initParams | protected function initParams(): void
{
if (0 != count($this->params)) {
return;
}
$this->addParams([
Parameter::makeBool('isRoot', '', 'none', false, true),
Parameter::makeBool('isRss', 'rss', 'path', false, false),
Parameter::makeI... | php | protected function initParams(): void
{
if (0 != count($this->params)) {
return;
}
$this->addParams([
Parameter::makeBool('isRoot', '', 'none', false, true),
Parameter::makeBool('isRss', 'rss', 'path', false, false),
Parameter::makeI... | [
"protected",
"function",
"initParams",
"(",
")",
":",
"void",
"{",
"if",
"(",
"0",
"!=",
"count",
"(",
"$",
"this",
"->",
"params",
")",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"addParams",
"(",
"[",
"Parameter",
"::",
"makeBool",
"(",
"'i... | Initialization of structures of module parameters with default values.
@return void | [
"Initialization",
"of",
"structures",
"of",
"module",
"parameters",
"with",
"default",
"values",
"."
] | fb44461bcb0506dbc3257724a2281f756594f62f | https://github.com/enikeishik/ufoframework/blob/fb44461bcb0506dbc3257724a2281f756594f62f/src/Ufo/Modules/Controller.php#L110-L122 |
194,396 | enikeishik/ufoframework | src/Ufo/Modules/Controller.php | Controller.setDataFromModel | protected function setDataFromModel(ModelInterface $model): void
{
$this->container->set('model', $model);
foreach (get_class_methods($model) as $method) {
if (0 !== strpos($method, 'get')) {
continue;
}
$this->data[strtolower... | php | protected function setDataFromModel(ModelInterface $model): void
{
$this->container->set('model', $model);
foreach (get_class_methods($model) as $method) {
if (0 !== strpos($method, 'get')) {
continue;
}
$this->data[strtolower... | [
"protected",
"function",
"setDataFromModel",
"(",
"ModelInterface",
"$",
"model",
")",
":",
"void",
"{",
"$",
"this",
"->",
"container",
"->",
"set",
"(",
"'model'",
",",
"$",
"model",
")",
";",
"foreach",
"(",
"get_class_methods",
"(",
"$",
"model",
")",
... | This implementation calls all methods with prefix `get` from model.
Implementation may be overridden in inherited method
to call only necessary model methods dependently from parameters.
@param \Ufo\Modules\ModelInterface $model
@return void | [
"This",
"implementation",
"calls",
"all",
"methods",
"with",
"prefix",
"get",
"from",
"model",
".",
"Implementation",
"may",
"be",
"overridden",
"in",
"inherited",
"method",
"to",
"call",
"only",
"necessary",
"model",
"methods",
"dependently",
"from",
"parameters"... | fb44461bcb0506dbc3257724a2281f756594f62f | https://github.com/enikeishik/ufoframework/blob/fb44461bcb0506dbc3257724a2281f756594f62f/src/Ufo/Modules/Controller.php#L191-L202 |
194,397 | enikeishik/ufoframework | src/Ufo/Modules/Controller.php | Controller.composeWidgets | public function composeWidgets(array $widgetsData): array
{
$container = clone $this->container;
unset($container->widget);
unset($container->widgets);
unset($container->model);
$widgetsResults = [];
foreach ($widgetsData as $place => $placeWidgets) ... | php | public function composeWidgets(array $widgetsData): array
{
$container = clone $this->container;
unset($container->widget);
unset($container->widgets);
unset($container->model);
$widgetsResults = [];
foreach ($widgetsData as $place => $placeWidgets) ... | [
"public",
"function",
"composeWidgets",
"(",
"array",
"$",
"widgetsData",
")",
":",
"array",
"{",
"$",
"container",
"=",
"clone",
"$",
"this",
"->",
"container",
";",
"unset",
"(",
"$",
"container",
"->",
"widget",
")",
";",
"unset",
"(",
"$",
"container... | Create object for each widgets data item.
@param array $widgetsData
@return array | [
"Create",
"object",
"for",
"each",
"widgets",
"data",
"item",
"."
] | fb44461bcb0506dbc3257724a2281f756594f62f | https://github.com/enikeishik/ufoframework/blob/fb44461bcb0506dbc3257724a2281f756594f62f/src/Ufo/Modules/Controller.php#L263-L327 |
194,398 | wb-crowdfusion/crowdfusion | system/context/ApplicationContext.php | ApplicationContext.setProperty | protected function setProperty($name, $value)
{
// adds both camelized key and unchanged key to properties
$this->properties[str_replace(' ', '', ltrim(ucwords(preg_replace('/[^A-Z^a-z^0-9]+/', ' ', 'z' . $name)), 'Z'))] = $value;
$this->properties[str_replace(' ', '', ucwords(preg_replace('... | php | protected function setProperty($name, $value)
{
// adds both camelized key and unchanged key to properties
$this->properties[str_replace(' ', '', ltrim(ucwords(preg_replace('/[^A-Z^a-z^0-9]+/', ' ', 'z' . $name)), 'Z'))] = $value;
$this->properties[str_replace(' ', '', ucwords(preg_replace('... | [
"protected",
"function",
"setProperty",
"(",
"$",
"name",
",",
"$",
"value",
")",
"{",
"// adds both camelized key and unchanged key to properties",
"$",
"this",
"->",
"properties",
"[",
"str_replace",
"(",
"' '",
",",
"''",
",",
"ltrim",
"(",
"ucwords",
"(",
"p... | Sets a property on this container.
@param $name
@param $value | [
"Sets",
"a",
"property",
"on",
"this",
"container",
"."
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/context/ApplicationContext.php#L880-L886 |
194,399 | LeadPages/php_pages_component | src/Pages/LeadpagesPages.php | LeadpagesPages.getPages | public function getPages($cursor = false)
{
$queryArray = ['pageSize' => 200];
if ($cursor) {
$queryArray['cursor'] = $cursor;
}
try {
$response = $this->client->get(
$this->PagesUrl, [
'headers' => ['Authorization' => 'Bea... | php | public function getPages($cursor = false)
{
$queryArray = ['pageSize' => 200];
if ($cursor) {
$queryArray['cursor'] = $cursor;
}
try {
$response = $this->client->get(
$this->PagesUrl, [
'headers' => ['Authorization' => 'Bea... | [
"public",
"function",
"getPages",
"(",
"$",
"cursor",
"=",
"false",
")",
"{",
"$",
"queryArray",
"=",
"[",
"'pageSize'",
"=>",
"200",
"]",
";",
"if",
"(",
"$",
"cursor",
")",
"{",
"$",
"queryArray",
"[",
"'cursor'",
"]",
"=",
"$",
"cursor",
";",
"}... | Base function get call get users pages
@param bool $cursor default false
@return array | [
"Base",
"function",
"get",
"call",
"get",
"users",
"pages"
] | 1be2742c402793ddacb3730d28058f6b418abeb4 | https://github.com/LeadPages/php_pages_component/blob/1be2742c402793ddacb3730d28058f6b418abeb4/src/Pages/LeadpagesPages.php#L51-L87 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.