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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
205,600 | aryelgois/medools-router | src/Router.php | Router.parseFields | protected function parseFields(Resource $resource)
{
$fields = $resource->getFields();
if (!is_array($fields)) {
$this->sendError(static::ERROR_UNKNOWN_FIELDS, $fields);
}
return $fields;
} | php | protected function parseFields(Resource $resource)
{
$fields = $resource->getFields();
if (!is_array($fields)) {
$this->sendError(static::ERROR_UNKNOWN_FIELDS, $fields);
}
return $fields;
} | [
"protected",
"function",
"parseFields",
"(",
"Resource",
"$",
"resource",
")",
"{",
"$",
"fields",
"=",
"$",
"resource",
"->",
"getFields",
"(",
")",
";",
"if",
"(",
"!",
"is_array",
"(",
"$",
"fields",
")",
")",
"{",
"$",
"this",
"->",
"sendError",
... | Parses fields query and validate against a resource
@param Resource $resource Resource
@return string[]
@throws RouterException If fields query parameter has invalid fields | [
"Parses",
"fields",
"query",
"and",
"validate",
"against",
"a",
"resource"
] | 5d755f53b8099952d60cf15a0eb209af5fa3ca8a | https://github.com/aryelgois/medools-router/blob/5d755f53b8099952d60cf15a0eb209af5fa3ca8a/src/Router.php#L1429-L1436 |
205,601 | aryelgois/medools-router | src/Router.php | Router.createModel | protected function createModel(Resource $resource)
{
$model = new $resource->model_class;
$model->fill($resource->data);
$result = $model->save();
if ($result === true) {
return $model;
}
$code = (empty($resource->data) || $result === null)
?... | php | protected function createModel(Resource $resource)
{
$model = new $resource->model_class;
$model->fill($resource->data);
$result = $model->save();
if ($result === true) {
return $model;
}
$code = (empty($resource->data) || $result === null)
?... | [
"protected",
"function",
"createModel",
"(",
"Resource",
"$",
"resource",
")",
"{",
"$",
"model",
"=",
"new",
"$",
"resource",
"->",
"model_class",
";",
"$",
"model",
"->",
"fill",
"(",
"$",
"resource",
"->",
"data",
")",
";",
"$",
"result",
"=",
"$",
... | Creates a Model in the Database
@param Resource $resource Processed route
@return Model
@throws RouterException If could not save the new Model | [
"Creates",
"a",
"Model",
"in",
"the",
"Database"
] | 5d755f53b8099952d60cf15a0eb209af5fa3ca8a | https://github.com/aryelgois/medools-router/blob/5d755f53b8099952d60cf15a0eb209af5fa3ca8a/src/Router.php#L1658-L1683 |
205,602 | aryelgois/medools-router | src/Router.php | Router.deleteModel | protected function deleteModel(
Model $model,
Resource $resource,
string $route = null
) {
if ($model->delete()) {
return;
}
$message = "Resource '" . ($route ?? $resource->route)
. "' could not be deleted";
$this->sendError(static::E... | php | protected function deleteModel(
Model $model,
Resource $resource,
string $route = null
) {
if ($model->delete()) {
return;
}
$message = "Resource '" . ($route ?? $resource->route)
. "' could not be deleted";
$this->sendError(static::E... | [
"protected",
"function",
"deleteModel",
"(",
"Model",
"$",
"model",
",",
"Resource",
"$",
"resource",
",",
"string",
"$",
"route",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"model",
"->",
"delete",
"(",
")",
")",
"{",
"return",
";",
"}",
"$",
"message",... | Deletes a Model
@param Model $model Model to be deleted
@param Resource $resource Resource that loaded $model
@param string $route Alternative route to $model
@throws RouterException If could not delete the Model | [
"Deletes",
"a",
"Model"
] | 5d755f53b8099952d60cf15a0eb209af5fa3ca8a | https://github.com/aryelgois/medools-router/blob/5d755f53b8099952d60cf15a0eb209af5fa3ca8a/src/Router.php#L1694-L1707 |
205,603 | aryelgois/medools-router | src/Router.php | Router.updateModel | protected function updateModel(
Model $model,
Resource $resource,
string $route = null
) {
$model->fill($resource->data);
$result = $model->update(array_keys($resource->data));
if ($result === true) {
return;
}
$message = "Resource '" . (... | php | protected function updateModel(
Model $model,
Resource $resource,
string $route = null
) {
$model->fill($resource->data);
$result = $model->update(array_keys($resource->data));
if ($result === true) {
return;
}
$message = "Resource '" . (... | [
"protected",
"function",
"updateModel",
"(",
"Model",
"$",
"model",
",",
"Resource",
"$",
"resource",
",",
"string",
"$",
"route",
"=",
"null",
")",
"{",
"$",
"model",
"->",
"fill",
"(",
"$",
"resource",
"->",
"data",
")",
";",
"$",
"result",
"=",
"$... | Updates a Model
@param Model $model Model to be updated
@param Resource $resource Resource that loaded $model
@param string $route Alternative route to $model
@throws RouterException If could not update the Model | [
"Updates",
"a",
"Model"
] | 5d755f53b8099952d60cf15a0eb209af5fa3ca8a | https://github.com/aryelgois/medools-router/blob/5d755f53b8099952d60cf15a0eb209af5fa3ca8a/src/Router.php#L1718-L1738 |
205,604 | aryelgois/medools-router | src/Router.php | Router.checkCache | protected function checkCache(
Response $response,
string $e_tags,
int $max_age
) {
$result = $response;
$cache_method = $this->cache_method;
if (is_callable($cache_method)) {
$hash = '"' . $cache_method(serialize($response->body)) . '"';
if ... | php | protected function checkCache(
Response $response,
string $e_tags,
int $max_age
) {
$result = $response;
$cache_method = $this->cache_method;
if (is_callable($cache_method)) {
$hash = '"' . $cache_method(serialize($response->body)) . '"';
if ... | [
"protected",
"function",
"checkCache",
"(",
"Response",
"$",
"response",
",",
"string",
"$",
"e_tags",
",",
"int",
"$",
"max_age",
")",
"{",
"$",
"result",
"=",
"$",
"response",
";",
"$",
"cache_method",
"=",
"$",
"this",
"->",
"cache_method",
";",
"if",... | Checks if Response is modified from Client's cache
It adds caching headers
@param Response $response Response to be checked
@param string $e_tags Request If-None-Match Header
@param integer $max_age Resource max_age
@return Response With caching headers or with Not Modified status
@throws RouterException If '... | [
"Checks",
"if",
"Response",
"is",
"modified",
"from",
"Client",
"s",
"cache"
] | 5d755f53b8099952d60cf15a0eb209af5fa3ca8a | https://github.com/aryelgois/medools-router/blob/5d755f53b8099952d60cf15a0eb209af5fa3ca8a/src/Router.php#L1758-L1793 |
205,605 | aryelgois/medools-router | src/Router.php | Router.checkMissingFields | protected function checkMissingFields(Resource $resource)
{
$missing = array_diff(
$resource->model_class::getRequiredColumns(),
array_keys($resource->data)
);
if (!empty($missing)) {
$message = "Resource '$resource->name' requires the following "
... | php | protected function checkMissingFields(Resource $resource)
{
$missing = array_diff(
$resource->model_class::getRequiredColumns(),
array_keys($resource->data)
);
if (!empty($missing)) {
$message = "Resource '$resource->name' requires the following "
... | [
"protected",
"function",
"checkMissingFields",
"(",
"Resource",
"$",
"resource",
")",
"{",
"$",
"missing",
"=",
"array_diff",
"(",
"$",
"resource",
"->",
"model_class",
"::",
"getRequiredColumns",
"(",
")",
",",
"array_keys",
"(",
"$",
"resource",
"->",
"data"... | Checks if resource data fulfills the required columns
@param Resource $resource Resource
@throws RouterException If required fields are missing | [
"Checks",
"if",
"resource",
"data",
"fulfills",
"the",
"required",
"columns"
] | 5d755f53b8099952d60cf15a0eb209af5fa3ca8a | https://github.com/aryelgois/medools-router/blob/5d755f53b8099952d60cf15a0eb209af5fa3ca8a/src/Router.php#L1802-L1814 |
205,606 | aryelgois/medools-router | src/Router.php | Router.checkUnknownField | protected function checkUnknownField(Resource $resource, array $fields)
{
$message = $resource->hasFields($fields);
if ($message !== true) {
$this->sendError(static::ERROR_UNKNOWN_FIELDS, $message);
}
} | php | protected function checkUnknownField(Resource $resource, array $fields)
{
$message = $resource->hasFields($fields);
if ($message !== true) {
$this->sendError(static::ERROR_UNKNOWN_FIELDS, $message);
}
} | [
"protected",
"function",
"checkUnknownField",
"(",
"Resource",
"$",
"resource",
",",
"array",
"$",
"fields",
")",
"{",
"$",
"message",
"=",
"$",
"resource",
"->",
"hasFields",
"(",
"$",
"fields",
")",
";",
"if",
"(",
"$",
"message",
"!==",
"true",
")",
... | Checks if a resource has all fields passed
@param Resource $resource Resource
@param string[] $fields List of fields to test
@throws RouterException If there are unknown fields | [
"Checks",
"if",
"a",
"resource",
"has",
"all",
"fields",
"passed"
] | 5d755f53b8099952d60cf15a0eb209af5fa3ca8a | https://github.com/aryelgois/medools-router/blob/5d755f53b8099952d60cf15a0eb209af5fa3ca8a/src/Router.php#L1824-L1830 |
205,607 | aryelgois/medools-router | src/Router.php | Router.compareAccept | public static function compareAccept(string $accept, array $available)
{
$result = [];
foreach (static::parseAccept($accept) as $type => $priority) {
if (strpos($type, '*') === false) {
if (in_array($type, $available)) {
$result[$type] = max($result[$t... | php | public static function compareAccept(string $accept, array $available)
{
$result = [];
foreach (static::parseAccept($accept) as $type => $priority) {
if (strpos($type, '*') === false) {
if (in_array($type, $available)) {
$result[$type] = max($result[$t... | [
"public",
"static",
"function",
"compareAccept",
"(",
"string",
"$",
"accept",
",",
"array",
"$",
"available",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"foreach",
"(",
"static",
"::",
"parseAccept",
"(",
"$",
"accept",
")",
"as",
"$",
"type",
"=>",... | Compares content types in an Accept header with a list of available types
@param string $accept Accept header
@param string[] $available Available content types
@return float[] With 'type' => priority | [
"Compares",
"content",
"types",
"in",
"an",
"Accept",
"header",
"with",
"a",
"list",
"of",
"available",
"types"
] | 5d755f53b8099952d60cf15a0eb209af5fa3ca8a | https://github.com/aryelgois/medools-router/blob/5d755f53b8099952d60cf15a0eb209af5fa3ca8a/src/Router.php#L1840-L1860 |
205,608 | aryelgois/medools-router | src/Router.php | Router.countResource | protected function countResource(string $resource, array $where = null)
{
$model = $this->resources[$resource]['model'];
$database = $model::getDatabase();
return $database->count($model::TABLE, $where ?? []);
} | php | protected function countResource(string $resource, array $where = null)
{
$model = $this->resources[$resource]['model'];
$database = $model::getDatabase();
return $database->count($model::TABLE, $where ?? []);
} | [
"protected",
"function",
"countResource",
"(",
"string",
"$",
"resource",
",",
"array",
"$",
"where",
"=",
"null",
")",
"{",
"$",
"model",
"=",
"$",
"this",
"->",
"resources",
"[",
"$",
"resource",
"]",
"[",
"'model'",
"]",
";",
"$",
"database",
"=",
... | Counts rows in Resource's table
@param string $resource Resource name
@param mixed[] $where \Medoo\Medoo $where clause
@return integer | [
"Counts",
"rows",
"in",
"Resource",
"s",
"table"
] | 5d755f53b8099952d60cf15a0eb209af5fa3ca8a | https://github.com/aryelgois/medools-router/blob/5d755f53b8099952d60cf15a0eb209af5fa3ca8a/src/Router.php#L1870-L1875 |
205,609 | aryelgois/medools-router | src/Router.php | Router.externalHandler | protected function externalHandler(Resource $resource)
{
$handlers = $this->resources[$resource->name]['handlers'] ?? [];
if (!empty($handlers)) {
if ($this->safe_method) {
$handlers = $handlers['GET'] ?? null;
if (is_array($handlers)) {
... | php | protected function externalHandler(Resource $resource)
{
$handlers = $this->resources[$resource->name]['handlers'] ?? [];
if (!empty($handlers)) {
if ($this->safe_method) {
$handlers = $handlers['GET'] ?? null;
if (is_array($handlers)) {
... | [
"protected",
"function",
"externalHandler",
"(",
"Resource",
"$",
"resource",
")",
"{",
"$",
"handlers",
"=",
"$",
"this",
"->",
"resources",
"[",
"$",
"resource",
"->",
"name",
"]",
"[",
"'handlers'",
"]",
"??",
"[",
"]",
";",
"if",
"(",
"!",
"empty",... | Determines external handler for a Resource and executes it
@param Resource $resource Resource to be sent to handler
@return boolean For success or failure
@throws RouterException If handler is invalid | [
"Determines",
"external",
"handler",
"for",
"a",
"Resource",
"and",
"executes",
"it"
] | 5d755f53b8099952d60cf15a0eb209af5fa3ca8a | https://github.com/aryelgois/medools-router/blob/5d755f53b8099952d60cf15a0eb209af5fa3ca8a/src/Router.php#L1886-L1939 |
205,610 | aryelgois/medools-router | src/Router.php | Router.firstHigher | public static function firstHigher(
array $list,
float $min = null,
float $max = null
) {
$bounded_list = array_merge([$min ?? 0, $max ?? 1], $list);
$min = min($bounded_list);
$max = max($bounded_list);
$result = null;
$higher = $min;
forea... | php | public static function firstHigher(
array $list,
float $min = null,
float $max = null
) {
$bounded_list = array_merge([$min ?? 0, $max ?? 1], $list);
$min = min($bounded_list);
$max = max($bounded_list);
$result = null;
$higher = $min;
forea... | [
"public",
"static",
"function",
"firstHigher",
"(",
"array",
"$",
"list",
",",
"float",
"$",
"min",
"=",
"null",
",",
"float",
"$",
"max",
"=",
"null",
")",
"{",
"$",
"bounded_list",
"=",
"array_merge",
"(",
"[",
"$",
"min",
"??",
"0",
",",
"$",
"m... | Returns key for first highest value
@param float[] $list List of numbers between min and max
@param float $min Min value to test (default is 0)
@param float $max Max value to test (default is 1)
@return mixed $list key
@return null If no value was higher than $min | [
"Returns",
"key",
"for",
"first",
"highest",
"value"
] | 5d755f53b8099952d60cf15a0eb209af5fa3ca8a | https://github.com/aryelgois/medools-router/blob/5d755f53b8099952d60cf15a0eb209af5fa3ca8a/src/Router.php#L1951-L1975 |
205,611 | aryelgois/medools-router | src/Router.php | Router.getAcceptedResourceType | protected function getAcceptedResourceType(string $resource, string $accept)
{
$available = array_keys($this->getAvailableTypes($resource));
if (empty($available)) {
$this->sendError(
static::ERROR_INTERNAL_SERVER,
"Resource '$resource' has invalid GET han... | php | protected function getAcceptedResourceType(string $resource, string $accept)
{
$available = array_keys($this->getAvailableTypes($resource));
if (empty($available)) {
$this->sendError(
static::ERROR_INTERNAL_SERVER,
"Resource '$resource' has invalid GET han... | [
"protected",
"function",
"getAcceptedResourceType",
"(",
"string",
"$",
"resource",
",",
"string",
"$",
"accept",
")",
"{",
"$",
"available",
"=",
"array_keys",
"(",
"$",
"this",
"->",
"getAvailableTypes",
"(",
"$",
"resource",
")",
")",
";",
"if",
"(",
"e... | Determines an accepted Content-Type for a Resource
@see getAcceptedType()
@param string $resource Resource name
@param string $accept Accept header
@return string
@throws RouterException If $resource has invalid Content-Type
@throws RouterException If no content type is acceptable | [
"Determines",
"an",
"accepted",
"Content",
"-",
"Type",
"for",
"a",
"Resource"
] | 5d755f53b8099952d60cf15a0eb209af5fa3ca8a | https://github.com/aryelgois/medools-router/blob/5d755f53b8099952d60cf15a0eb209af5fa3ca8a/src/Router.php#L1990-L2008 |
205,612 | aryelgois/medools-router | src/Router.php | Router.getAcceptedType | public static function getAcceptedType(string $accept, array $available)
{
$list = static::compareAccept($accept, $available);
if (empty($list)) {
return array_values($available)[0];
}
$result = static::firstHigher($list);
if ($result !== null) {
retu... | php | public static function getAcceptedType(string $accept, array $available)
{
$list = static::compareAccept($accept, $available);
if (empty($list)) {
return array_values($available)[0];
}
$result = static::firstHigher($list);
if ($result !== null) {
retu... | [
"public",
"static",
"function",
"getAcceptedType",
"(",
"string",
"$",
"accept",
",",
"array",
"$",
"available",
")",
"{",
"$",
"list",
"=",
"static",
"::",
"compareAccept",
"(",
"$",
"accept",
",",
"$",
"available",
")",
";",
"if",
"(",
"empty",
"(",
... | Determines an accepted Content-Type from a list
NOTE:
- If no $available content types match $accept, but at least one of them
is not forbidden by $accept (i.e. ';q=0'), it is returned. It is better
to respond something the client doesn't complain about than a useless
error message
@param string $accept Accept h... | [
"Determines",
"an",
"accepted",
"Content",
"-",
"Type",
"from",
"a",
"list"
] | 5d755f53b8099952d60cf15a0eb209af5fa3ca8a | https://github.com/aryelgois/medools-router/blob/5d755f53b8099952d60cf15a0eb209af5fa3ca8a/src/Router.php#L2025-L2047 |
205,613 | aryelgois/medools-router | src/Router.php | Router.getAllowedMethods | protected function getAllowedMethods(string $resource)
{
$cached = $this->cache['allowed_methods'][$resource] ?? null;
if ($cached !== null) {
return $cached;
}
$resource_data = $this->resources[$resource] ?? null;
if ($resource_data === null) {
throw... | php | protected function getAllowedMethods(string $resource)
{
$cached = $this->cache['allowed_methods'][$resource] ?? null;
if ($cached !== null) {
return $cached;
}
$resource_data = $this->resources[$resource] ?? null;
if ($resource_data === null) {
throw... | [
"protected",
"function",
"getAllowedMethods",
"(",
"string",
"$",
"resource",
")",
"{",
"$",
"cached",
"=",
"$",
"this",
"->",
"cache",
"[",
"'allowed_methods'",
"]",
"[",
"$",
"resource",
"]",
"??",
"null",
";",
"if",
"(",
"$",
"cached",
"!==",
"null",
... | Returns a list of allowed methods for a resource
NOTE:
- It caches results
@param string $resource Resource name
@return string[]
@throws \DomainException If $resource is invalid | [
"Returns",
"a",
"list",
"of",
"allowed",
"methods",
"for",
"a",
"resource"
] | 5d755f53b8099952d60cf15a0eb209af5fa3ca8a | https://github.com/aryelgois/medools-router/blob/5d755f53b8099952d60cf15a0eb209af5fa3ca8a/src/Router.php#L2061-L2085 |
205,614 | aryelgois/medools-router | src/Router.php | Router.getAvailableTypes | protected function getAvailableTypes(string $resource)
{
$cached = $this->cache['available_types'][$resource] ?? null;
if ($cached !== null) {
return $cached;
}
$types = $this->resources[$resource]['handlers']['GET'] ?? [];
$types = (is_array($types))
... | php | protected function getAvailableTypes(string $resource)
{
$cached = $this->cache['available_types'][$resource] ?? null;
if ($cached !== null) {
return $cached;
}
$types = $this->resources[$resource]['handlers']['GET'] ?? [];
$types = (is_array($types))
... | [
"protected",
"function",
"getAvailableTypes",
"(",
"string",
"$",
"resource",
")",
"{",
"$",
"cached",
"=",
"$",
"this",
"->",
"cache",
"[",
"'available_types'",
"]",
"[",
"$",
"resource",
"]",
"??",
"null",
";",
"if",
"(",
"$",
"cached",
"!==",
"null",
... | Computes GET Resource's content types
NOTE:
- It caches results
@param string $resource Resource name
@return mixed[] | [
"Computes",
"GET",
"Resource",
"s",
"content",
"types"
] | 5d755f53b8099952d60cf15a0eb209af5fa3ca8a | https://github.com/aryelgois/medools-router/blob/5d755f53b8099952d60cf15a0eb209af5fa3ca8a/src/Router.php#L2097-L2111 |
205,615 | aryelgois/medools-router | src/Router.php | Router.getAuthorizedResources | protected function getAuthorizedResources($methods = null)
{
$resources = [];
if ($this->auth instanceof Authentication) {
$allow = (array) ($methods ?? $this->method);
$authorizations = Authorization::dump(
[
'user' => $this->auth->id,
... | php | protected function getAuthorizedResources($methods = null)
{
$resources = [];
if ($this->auth instanceof Authentication) {
$allow = (array) ($methods ?? $this->method);
$authorizations = Authorization::dump(
[
'user' => $this->auth->id,
... | [
"protected",
"function",
"getAuthorizedResources",
"(",
"$",
"methods",
"=",
"null",
")",
"{",
"$",
"resources",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"this",
"->",
"auth",
"instanceof",
"Authentication",
")",
"{",
"$",
"allow",
"=",
"(",
"array",
")",
"... | Returns authorized resources for the authenticated user and their filters
@param string|string[] $methods Which methods to test
Default is requested method
@return mixed[] With 'resource' => filter | [
"Returns",
"authorized",
"resources",
"for",
"the",
"authenticated",
"user",
"and",
"their",
"filters"
] | 5d755f53b8099952d60cf15a0eb209af5fa3ca8a | https://github.com/aryelgois/medools-router/blob/5d755f53b8099952d60cf15a0eb209af5fa3ca8a/src/Router.php#L2121-L2170 |
205,616 | aryelgois/medools-router | src/Router.php | Router.getContentLocation | protected function getContentLocation(Model $model, Resource $resource)
{
$query = http_build_query($resource->query);
$content_location = "$this->url/$resource->name/"
. $this->getPrimaryKey($model)
. ($query !== '' ? '?' . $query : '');
return $content_location;
... | php | protected function getContentLocation(Model $model, Resource $resource)
{
$query = http_build_query($resource->query);
$content_location = "$this->url/$resource->name/"
. $this->getPrimaryKey($model)
. ($query !== '' ? '?' . $query : '');
return $content_location;
... | [
"protected",
"function",
"getContentLocation",
"(",
"Model",
"$",
"model",
",",
"Resource",
"$",
"resource",
")",
"{",
"$",
"query",
"=",
"http_build_query",
"(",
"$",
"resource",
"->",
"query",
")",
";",
"$",
"content_location",
"=",
"\"$this->url/$resource->na... | Returns Content-Location for a Model in a Resource
@param Model $model Model to get Location
@param Resource $resource Resource that loaded $model
@return string | [
"Returns",
"Content",
"-",
"Location",
"for",
"a",
"Model",
"in",
"a",
"Resource"
] | 5d755f53b8099952d60cf15a0eb209af5fa3ca8a | https://github.com/aryelgois/medools-router/blob/5d755f53b8099952d60cf15a0eb209af5fa3ca8a/src/Router.php#L2180-L2189 |
205,617 | aryelgois/medools-router | src/Router.php | Router.getForeignRoutes | protected function getForeignRoutes(Model $model, array $filter = null)
{
$routes = [];
$foreigns = $model::FOREIGN_KEYS;
if (!empty($filter)) {
$foreigns = Utils::arrayWhitelist($foreigns, $filter);
}
foreach ($foreigns as $column => $fk) {
foreach ... | php | protected function getForeignRoutes(Model $model, array $filter = null)
{
$routes = [];
$foreigns = $model::FOREIGN_KEYS;
if (!empty($filter)) {
$foreigns = Utils::arrayWhitelist($foreigns, $filter);
}
foreach ($foreigns as $column => $fk) {
foreach ... | [
"protected",
"function",
"getForeignRoutes",
"(",
"Model",
"$",
"model",
",",
"array",
"$",
"filter",
"=",
"null",
")",
"{",
"$",
"routes",
"=",
"[",
"]",
";",
"$",
"foreigns",
"=",
"$",
"model",
"::",
"FOREIGN_KEYS",
";",
"if",
"(",
"!",
"empty",
"(... | Returns list of routes to Model's Foreigns
@param Model $model Model whose Foreigns' routes will be returned
@param string[] $filter Only returns routes for foreigns listed here
Invalid columns are silently ignored
@return string[] | [
"Returns",
"list",
"of",
"routes",
"to",
"Model",
"s",
"Foreigns"
] | 5d755f53b8099952d60cf15a0eb209af5fa3ca8a | https://github.com/aryelgois/medools-router/blob/5d755f53b8099952d60cf15a0eb209af5fa3ca8a/src/Router.php#L2200-L2223 |
205,618 | aryelgois/medools-router | src/Router.php | Router.headerLink | protected function headerLink(array $routes)
{
$links = [];
foreach ($routes as $rel => $route) {
$links[] = '<' . $this->url . $route . '>; rel="' . $rel . '"';
}
return implode(', ', $links);
} | php | protected function headerLink(array $routes)
{
$links = [];
foreach ($routes as $rel => $route) {
$links[] = '<' . $this->url . $route . '>; rel="' . $rel . '"';
}
return implode(', ', $links);
} | [
"protected",
"function",
"headerLink",
"(",
"array",
"$",
"routes",
")",
"{",
"$",
"links",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"routes",
"as",
"$",
"rel",
"=>",
"$",
"route",
")",
"{",
"$",
"links",
"[",
"]",
"=",
"'<'",
".",
"$",
"this",
... | Generates content for Link header
@param string[] $routes List of routes
@return string | [
"Generates",
"content",
"for",
"Link",
"header"
] | 5d755f53b8099952d60cf15a0eb209af5fa3ca8a | https://github.com/aryelgois/medools-router/blob/5d755f53b8099952d60cf15a0eb209af5fa3ca8a/src/Router.php#L2244-L2251 |
205,619 | aryelgois/medools-router | src/Router.php | Router.isPublic | protected function isPublic(string $resource, $methods = null)
{
if (($this->authentication ?? null) === null) {
return true;
}
$resource_data = $this->resources[$resource] ?? null;
if ($resource_data === null) {
return false;
}
$public = $re... | php | protected function isPublic(string $resource, $methods = null)
{
if (($this->authentication ?? null) === null) {
return true;
}
$resource_data = $this->resources[$resource] ?? null;
if ($resource_data === null) {
return false;
}
$public = $re... | [
"protected",
"function",
"isPublic",
"(",
"string",
"$",
"resource",
",",
"$",
"methods",
"=",
"null",
")",
"{",
"if",
"(",
"(",
"$",
"this",
"->",
"authentication",
"??",
"null",
")",
"===",
"null",
")",
"{",
"return",
"true",
";",
"}",
"$",
"resour... | Tells if a resource's method has public access
@param string $resource Resource name
@param string|string[] $methods Which methods to test
Default is requested method
@return boolean For success or failure | [
"Tells",
"if",
"a",
"resource",
"s",
"method",
"has",
"public",
"access"
] | 5d755f53b8099952d60cf15a0eb209af5fa3ca8a | https://github.com/aryelgois/medools-router/blob/5d755f53b8099952d60cf15a0eb209af5fa3ca8a/src/Router.php#L2262-L2283 |
205,620 | aryelgois/medools-router | src/Router.php | Router.prepareResponse | protected function prepareResponse()
{
$response = new Response;
$response->method = $this->method;
$response->zlib_compression = $this->zlib_compression;
return $response;
} | php | protected function prepareResponse()
{
$response = new Response;
$response->method = $this->method;
$response->zlib_compression = $this->zlib_compression;
return $response;
} | [
"protected",
"function",
"prepareResponse",
"(",
")",
"{",
"$",
"response",
"=",
"new",
"Response",
";",
"$",
"response",
"->",
"method",
"=",
"$",
"this",
"->",
"method",
";",
"$",
"response",
"->",
"zlib_compression",
"=",
"$",
"this",
"->",
"zlib_compre... | Creates a new Response object with some properties filled
@return Response | [
"Creates",
"a",
"new",
"Response",
"object",
"with",
"some",
"properties",
"filled"
] | 5d755f53b8099952d60cf15a0eb209af5fa3ca8a | https://github.com/aryelgois/medools-router/blob/5d755f53b8099952d60cf15a0eb209af5fa3ca8a/src/Router.php#L2290-L2296 |
205,621 | aryelgois/medools-router | src/Router.php | Router.reverseForeignKey | public static function reverseForeignKey(
string $model_class,
Model $target
) {
$target_class = get_class($target);
$column = null;
$found = false;
foreach ($model_class::FOREIGN_KEYS as $column => $fk) {
if ($target_class === $fk[0]) {
$... | php | public static function reverseForeignKey(
string $model_class,
Model $target
) {
$target_class = get_class($target);
$column = null;
$found = false;
foreach ($model_class::FOREIGN_KEYS as $column => $fk) {
if ($target_class === $fk[0]) {
$... | [
"public",
"static",
"function",
"reverseForeignKey",
"(",
"string",
"$",
"model_class",
",",
"Model",
"$",
"target",
")",
"{",
"$",
"target_class",
"=",
"get_class",
"(",
"$",
"target",
")",
";",
"$",
"column",
"=",
"null",
";",
"$",
"found",
"=",
"false... | Finds the Foreign Key for a Model instance from a Model class
NOTE:
- If $model_class has multiple foreign keys for $target, only the first
one is used. You should redesign your database, duplicate the target
class with a new name or create a new class that extends target, if you
want to match later $model_class forei... | [
"Finds",
"the",
"Foreign",
"Key",
"for",
"a",
"Model",
"instance",
"from",
"a",
"Model",
"class"
] | 5d755f53b8099952d60cf15a0eb209af5fa3ca8a | https://github.com/aryelgois/medools-router/blob/5d755f53b8099952d60cf15a0eb209af5fa3ca8a/src/Router.php#L2314-L2333 |
205,622 | ZhukV/LanguageDetector | src/Ideea/LanguageDetector/Dictionary/PhpFileDictionary.php | PhpFileDictionary.flush | public function flush()
{
if (!count($this->updated)) {
// Not updated words
return;
}
foreach ($this->updated as $lang => $true) {
// Grouping all words by language
$words = array();
foreach ($this->words as $word => $wordLanguag... | php | public function flush()
{
if (!count($this->updated)) {
// Not updated words
return;
}
foreach ($this->updated as $lang => $true) {
// Grouping all words by language
$words = array();
foreach ($this->words as $word => $wordLanguag... | [
"public",
"function",
"flush",
"(",
")",
"{",
"if",
"(",
"!",
"count",
"(",
"$",
"this",
"->",
"updated",
")",
")",
"{",
"// Not updated words",
"return",
";",
"}",
"foreach",
"(",
"$",
"this",
"->",
"updated",
"as",
"$",
"lang",
"=>",
"$",
"true",
... | Flush updated dictionaries | [
"Flush",
"updated",
"dictionaries"
] | e5138f4c789e899801e098ce1e719337b015af7c | https://github.com/ZhukV/LanguageDetector/blob/e5138f4c789e899801e098ce1e719337b015af7c/src/Ideea/LanguageDetector/Dictionary/PhpFileDictionary.php#L112-L132 |
205,623 | ZhukV/LanguageDetector | src/Ideea/LanguageDetector/Dictionary/PhpFileDictionary.php | PhpFileDictionary.loadDictionaries | private function loadDictionaries()
{
if (null !== $this->words) {
// Dictionaries already loaded
return;
}
$this->words = array();
$dictionaryFiles = glob($this->dictionaryDir . '/*');
foreach ($dictionaryFiles as $dictionaryFile) {
$fi... | php | private function loadDictionaries()
{
if (null !== $this->words) {
// Dictionaries already loaded
return;
}
$this->words = array();
$dictionaryFiles = glob($this->dictionaryDir . '/*');
foreach ($dictionaryFiles as $dictionaryFile) {
$fi... | [
"private",
"function",
"loadDictionaries",
"(",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"this",
"->",
"words",
")",
"{",
"// Dictionaries already loaded",
"return",
";",
"}",
"$",
"this",
"->",
"words",
"=",
"array",
"(",
")",
";",
"$",
"dictionaryFiles",... | Load dictionaries from directory | [
"Load",
"dictionaries",
"from",
"directory"
] | e5138f4c789e899801e098ce1e719337b015af7c | https://github.com/ZhukV/LanguageDetector/blob/e5138f4c789e899801e098ce1e719337b015af7c/src/Ideea/LanguageDetector/Dictionary/PhpFileDictionary.php#L137-L166 |
205,624 | pmdevelopment/tool-bundle | Command/FOSUserCommand.php | FOSUserCommand.actionPasswordReplace | private function actionPasswordReplace(SymfonyStyle $helper)
{
if (false === $helper->confirm('Are you sure? Only use this for development purposes!', false)) {
return null;
}
$userClass = $this->getUserEntityClass();
if (null === $userClass) {
throw new \Run... | php | private function actionPasswordReplace(SymfonyStyle $helper)
{
if (false === $helper->confirm('Are you sure? Only use this for development purposes!', false)) {
return null;
}
$userClass = $this->getUserEntityClass();
if (null === $userClass) {
throw new \Run... | [
"private",
"function",
"actionPasswordReplace",
"(",
"SymfonyStyle",
"$",
"helper",
")",
"{",
"if",
"(",
"false",
"===",
"$",
"helper",
"->",
"confirm",
"(",
"'Are you sure? Only use this for development purposes!'",
",",
"false",
")",
")",
"{",
"return",
"null",
... | Password Replace action
@param SymfonyStyle $helper
@return null | [
"Password",
"Replace",
"action"
] | 2cbc9f82c5b33fd7a9d389edd3676e9f70ea8129 | https://github.com/pmdevelopment/tool-bundle/blob/2cbc9f82c5b33fd7a9d389edd3676e9f70ea8129/Command/FOSUserCommand.php#L91-L112 |
205,625 | pmdevelopment/tool-bundle | Command/FOSUserCommand.php | FOSUserCommand.getUserEntityClass | private function getUserEntityClass()
{
/** @var ClassMetadata $meta */
foreach ($this->getDoctrine()->getManager()->getMetadataFactory()->getAllMetadata() as $meta) {
$reflectionClass = $meta->getReflectionClass();
if (true === $this->hasAbstractParent($reflectionClass, Use... | php | private function getUserEntityClass()
{
/** @var ClassMetadata $meta */
foreach ($this->getDoctrine()->getManager()->getMetadataFactory()->getAllMetadata() as $meta) {
$reflectionClass = $meta->getReflectionClass();
if (true === $this->hasAbstractParent($reflectionClass, Use... | [
"private",
"function",
"getUserEntityClass",
"(",
")",
"{",
"/** @var ClassMetadata $meta */",
"foreach",
"(",
"$",
"this",
"->",
"getDoctrine",
"(",
")",
"->",
"getManager",
"(",
")",
"->",
"getMetadataFactory",
"(",
")",
"->",
"getAllMetadata",
"(",
")",
"as",... | Get User Entity Class
@return null|string | [
"Get",
"User",
"Entity",
"Class"
] | 2cbc9f82c5b33fd7a9d389edd3676e9f70ea8129 | https://github.com/pmdevelopment/tool-bundle/blob/2cbc9f82c5b33fd7a9d389edd3676e9f70ea8129/Command/FOSUserCommand.php#L119-L131 |
205,626 | tarsana/syntax | src/OptionalSyntax.php | OptionalSyntax.parse | public function parse(string $text)
{
try {
$result = $this->syntax->parse($text);
$this->success = true;
} catch (ParseException $e) {
$result = $this->default;
$this->success = false;
}
return $result;
} | php | public function parse(string $text)
{
try {
$result = $this->syntax->parse($text);
$this->success = true;
} catch (ParseException $e) {
$result = $this->default;
$this->success = false;
}
return $result;
} | [
"public",
"function",
"parse",
"(",
"string",
"$",
"text",
")",
"{",
"try",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"syntax",
"->",
"parse",
"(",
"$",
"text",
")",
";",
"$",
"this",
"->",
"success",
"=",
"true",
";",
"}",
"catch",
"(",
"Parse... | Tries to parse the string using the syntax and return
the result. If the parse failed, `success` flag is
set to false and the default value is returned.
@param string $text the string to parse
@return mixed | [
"Tries",
"to",
"parse",
"the",
"string",
"using",
"the",
"syntax",
"and",
"return",
"the",
"result",
".",
"If",
"the",
"parse",
"failed",
"success",
"flag",
"is",
"set",
"to",
"false",
"and",
"the",
"default",
"value",
"is",
"returned",
"."
] | fd3f8a25e3be0e391c8fd486ccfcffe913ade534 | https://github.com/tarsana/syntax/blob/fd3f8a25e3be0e391c8fd486ccfcffe913ade534/src/OptionalSyntax.php#L110-L121 |
205,627 | 3ev/wordpress-core | src/Tev/Plugin/Loader.php | Loader.load | public function load($basePath)
{
$this->basePath = $basePath;
$this->renderer = new Renderer($this->getViewsPath());
return
$this
->loadCustomTables()
->loadPostTypes()
->loadFieldGroups()
->loadAcfJson()
... | php | public function load($basePath)
{
$this->basePath = $basePath;
$this->renderer = new Renderer($this->getViewsPath());
return
$this
->loadCustomTables()
->loadPostTypes()
->loadFieldGroups()
->loadAcfJson()
... | [
"public",
"function",
"load",
"(",
"$",
"basePath",
")",
"{",
"$",
"this",
"->",
"basePath",
"=",
"$",
"basePath",
";",
"$",
"this",
"->",
"renderer",
"=",
"new",
"Renderer",
"(",
"$",
"this",
"->",
"getViewsPath",
"(",
")",
")",
";",
"return",
"$",
... | Load all plugin configuration.
@param string $basePath Plugin path
@return \Tev\Plugin\Loader This, for chaining | [
"Load",
"all",
"plugin",
"configuration",
"."
] | da674fbec5bf3d5bd2a2141680a4c141113eb6b0 | https://github.com/3ev/wordpress-core/blob/da674fbec5bf3d5bd2a2141680a4c141113eb6b0/src/Tev/Plugin/Loader.php#L96-L111 |
205,628 | 3ev/wordpress-core | src/Tev/Plugin/Loader.php | Loader.loadCustomTables | protected function loadCustomTables()
{
if ($config = $this->loadConfigFile('tables.php')) {
$app = $this->app;
foreach ($config as $installerClass) {
if (is_string($installerClass) && is_subclass_of($installerClass, 'Tev\Database\CustomTables\AbstractInstaller')) {
... | php | protected function loadCustomTables()
{
if ($config = $this->loadConfigFile('tables.php')) {
$app = $this->app;
foreach ($config as $installerClass) {
if (is_string($installerClass) && is_subclass_of($installerClass, 'Tev\Database\CustomTables\AbstractInstaller')) {
... | [
"protected",
"function",
"loadCustomTables",
"(",
")",
"{",
"if",
"(",
"$",
"config",
"=",
"$",
"this",
"->",
"loadConfigFile",
"(",
"'tables.php'",
")",
")",
"{",
"$",
"app",
"=",
"$",
"this",
"->",
"app",
";",
"foreach",
"(",
"$",
"config",
"as",
"... | Load custom database table installers from configuration files.
@return \Tev\Plugin\Loader This, for chaining | [
"Load",
"custom",
"database",
"table",
"installers",
"from",
"configuration",
"files",
"."
] | da674fbec5bf3d5bd2a2141680a4c141113eb6b0 | https://github.com/3ev/wordpress-core/blob/da674fbec5bf3d5bd2a2141680a4c141113eb6b0/src/Tev/Plugin/Loader.php#L118-L141 |
205,629 | 3ev/wordpress-core | src/Tev/Plugin/Loader.php | Loader.loadPostTypes | protected function loadPostTypes()
{
if ($config = $this->loadConfigFile('post_types.php')) {
$callbacks = array();
// Create one callback for each post type, and register in
// init action
foreach ($config as $postTypeName => $args) {
$callb... | php | protected function loadPostTypes()
{
if ($config = $this->loadConfigFile('post_types.php')) {
$callbacks = array();
// Create one callback for each post type, and register in
// init action
foreach ($config as $postTypeName => $args) {
$callb... | [
"protected",
"function",
"loadPostTypes",
"(",
")",
"{",
"if",
"(",
"$",
"config",
"=",
"$",
"this",
"->",
"loadConfigFile",
"(",
"'post_types.php'",
")",
")",
"{",
"$",
"callbacks",
"=",
"array",
"(",
")",
";",
"// Create one callback for each post type, and re... | Load custom post types from configuration files.
@return \Tev\Plugin\Loader This, for chaining | [
"Load",
"custom",
"post",
"types",
"from",
"configuration",
"files",
"."
] | da674fbec5bf3d5bd2a2141680a4c141113eb6b0 | https://github.com/3ev/wordpress-core/blob/da674fbec5bf3d5bd2a2141680a4c141113eb6b0/src/Tev/Plugin/Loader.php#L148-L177 |
205,630 | 3ev/wordpress-core | src/Tev/Plugin/Loader.php | Loader.loadFieldGroups | protected function loadFieldGroups()
{
if (function_exists('register_field_group') && ($config = $this->loadConfigFile('field_groups.php'))) {
foreach ($config as $fieldGroupConfig) {
register_field_group($fieldGroupConfig);
}
}
return $this;
} | php | protected function loadFieldGroups()
{
if (function_exists('register_field_group') && ($config = $this->loadConfigFile('field_groups.php'))) {
foreach ($config as $fieldGroupConfig) {
register_field_group($fieldGroupConfig);
}
}
return $this;
} | [
"protected",
"function",
"loadFieldGroups",
"(",
")",
"{",
"if",
"(",
"function_exists",
"(",
"'register_field_group'",
")",
"&&",
"(",
"$",
"config",
"=",
"$",
"this",
"->",
"loadConfigFile",
"(",
"'field_groups.php'",
")",
")",
")",
"{",
"foreach",
"(",
"$... | Load custom field groups from configuration files.
@return \Tev\Plugin\Loader This, for chaining | [
"Load",
"custom",
"field",
"groups",
"from",
"configuration",
"files",
"."
] | da674fbec5bf3d5bd2a2141680a4c141113eb6b0 | https://github.com/3ev/wordpress-core/blob/da674fbec5bf3d5bd2a2141680a4c141113eb6b0/src/Tev/Plugin/Loader.php#L184-L193 |
205,631 | 3ev/wordpress-core | src/Tev/Plugin/Loader.php | Loader.loadActions | protected function loadActions()
{
if ($config = $this->loadConfigFile('actions.php')) {
$app = $this->app;
$renderer = $this->renderer;
foreach ($config as $actionName => $provider) {
if (is_string($provider) && is_subclass_of($provider, 'Tev\Plugin... | php | protected function loadActions()
{
if ($config = $this->loadConfigFile('actions.php')) {
$app = $this->app;
$renderer = $this->renderer;
foreach ($config as $actionName => $provider) {
if (is_string($provider) && is_subclass_of($provider, 'Tev\Plugin... | [
"protected",
"function",
"loadActions",
"(",
")",
"{",
"if",
"(",
"$",
"config",
"=",
"$",
"this",
"->",
"loadConfigFile",
"(",
"'actions.php'",
")",
")",
"{",
"$",
"app",
"=",
"$",
"this",
"->",
"app",
";",
"$",
"renderer",
"=",
"$",
"this",
"->",
... | Load actions from configuration providers.
@return \Tev\Plugin\Loader This, for chaining | [
"Load",
"actions",
"from",
"configuration",
"providers",
"."
] | da674fbec5bf3d5bd2a2141680a4c141113eb6b0 | https://github.com/3ev/wordpress-core/blob/da674fbec5bf3d5bd2a2141680a4c141113eb6b0/src/Tev/Plugin/Loader.php#L200-L223 |
205,632 | 3ev/wordpress-core | src/Tev/Plugin/Loader.php | Loader.loadAcfJson | protected function loadAcfJson()
{
$config = $this->getConfigPath() . '/acf-json';
if (file_exists($config)) {
add_filter('acf/settings/load_json', function ($paths) use ($config) {
$paths[] = $config;
return $paths;
});
}
ret... | php | protected function loadAcfJson()
{
$config = $this->getConfigPath() . '/acf-json';
if (file_exists($config)) {
add_filter('acf/settings/load_json', function ($paths) use ($config) {
$paths[] = $config;
return $paths;
});
}
ret... | [
"protected",
"function",
"loadAcfJson",
"(",
")",
"{",
"$",
"config",
"=",
"$",
"this",
"->",
"getConfigPath",
"(",
")",
".",
"'/acf-json'",
";",
"if",
"(",
"file_exists",
"(",
"$",
"config",
")",
")",
"{",
"add_filter",
"(",
"'acf/settings/load_json'",
",... | Load ACF JSON config if supplied.
@return \Tev\Plugin\Loader This, for chaining | [
"Load",
"ACF",
"JSON",
"config",
"if",
"supplied",
"."
] | da674fbec5bf3d5bd2a2141680a4c141113eb6b0 | https://github.com/3ev/wordpress-core/blob/da674fbec5bf3d5bd2a2141680a4c141113eb6b0/src/Tev/Plugin/Loader.php#L230-L242 |
205,633 | 3ev/wordpress-core | src/Tev/Plugin/Loader.php | Loader.loadShortCodes | protected function loadShortCodes()
{
if ($config = $this->loadConfigFile('shortcodes.php')) {
$renderer = $this->renderer;
$app = $this->app;
foreach ($config as $shortcode => $provider) {
add_shortcode($shortcode, function ($attrs, $content) use ($... | php | protected function loadShortCodes()
{
if ($config = $this->loadConfigFile('shortcodes.php')) {
$renderer = $this->renderer;
$app = $this->app;
foreach ($config as $shortcode => $provider) {
add_shortcode($shortcode, function ($attrs, $content) use ($... | [
"protected",
"function",
"loadShortCodes",
"(",
")",
"{",
"if",
"(",
"$",
"config",
"=",
"$",
"this",
"->",
"loadConfigFile",
"(",
"'shortcodes.php'",
")",
")",
"{",
"$",
"renderer",
"=",
"$",
"this",
"->",
"renderer",
";",
"$",
"app",
"=",
"$",
"this"... | Load shortcodes from configuration files.
@return \Tev\Plugin\Loader This, for chaining | [
"Load",
"shortcodes",
"from",
"configuration",
"files",
"."
] | da674fbec5bf3d5bd2a2141680a4c141113eb6b0 | https://github.com/3ev/wordpress-core/blob/da674fbec5bf3d5bd2a2141680a4c141113eb6b0/src/Tev/Plugin/Loader.php#L249-L269 |
205,634 | 3ev/wordpress-core | src/Tev/Plugin/Loader.php | Loader.loadOptionScreens | protected function loadOptionScreens()
{
if (function_exists('acf_add_options_page') && ($config = $this->loadConfigFile('option_screens.php'))) {
foreach ($config as $optionScreenConfig) {
acf_add_options_page($optionScreenConfig);
}
}
return $this;
... | php | protected function loadOptionScreens()
{
if (function_exists('acf_add_options_page') && ($config = $this->loadConfigFile('option_screens.php'))) {
foreach ($config as $optionScreenConfig) {
acf_add_options_page($optionScreenConfig);
}
}
return $this;
... | [
"protected",
"function",
"loadOptionScreens",
"(",
")",
"{",
"if",
"(",
"function_exists",
"(",
"'acf_add_options_page'",
")",
"&&",
"(",
"$",
"config",
"=",
"$",
"this",
"->",
"loadConfigFile",
"(",
"'option_screens.php'",
")",
")",
")",
"{",
"foreach",
"(",
... | Load custom option screens from configuration files.
@return \Tev\Plugin\Loader This, for chaining | [
"Load",
"custom",
"option",
"screens",
"from",
"configuration",
"files",
"."
] | da674fbec5bf3d5bd2a2141680a4c141113eb6b0 | https://github.com/3ev/wordpress-core/blob/da674fbec5bf3d5bd2a2141680a4c141113eb6b0/src/Tev/Plugin/Loader.php#L276-L285 |
205,635 | 3ev/wordpress-core | src/Tev/Plugin/Loader.php | Loader.loadCliCommands | protected function loadCliCommands()
{
if (defined('WP_CLI') && WP_CLI && ($config = $this->loadConfigFile('commands.php'))) {
foreach ($config as $command => $className) {
\WP_CLI::add_command($command, $className);
}
}
return $this;
} | php | protected function loadCliCommands()
{
if (defined('WP_CLI') && WP_CLI && ($config = $this->loadConfigFile('commands.php'))) {
foreach ($config as $command => $className) {
\WP_CLI::add_command($command, $className);
}
}
return $this;
} | [
"protected",
"function",
"loadCliCommands",
"(",
")",
"{",
"if",
"(",
"defined",
"(",
"'WP_CLI'",
")",
"&&",
"WP_CLI",
"&&",
"(",
"$",
"config",
"=",
"$",
"this",
"->",
"loadConfigFile",
"(",
"'commands.php'",
")",
")",
")",
"{",
"foreach",
"(",
"$",
"... | Load custom WP CLI commands from configuration files.
@return \Tev\Plugin\Loader This, for chaining | [
"Load",
"custom",
"WP",
"CLI",
"commands",
"from",
"configuration",
"files",
"."
] | da674fbec5bf3d5bd2a2141680a4c141113eb6b0 | https://github.com/3ev/wordpress-core/blob/da674fbec5bf3d5bd2a2141680a4c141113eb6b0/src/Tev/Plugin/Loader.php#L292-L301 |
205,636 | 3ev/wordpress-core | src/Tev/Plugin/Loader.php | Loader.loadConfigFile | protected function loadConfigFile($file)
{
$path = $this->getConfigPath() . '/' . $file;
if (file_exists($path)) {
$config = include $path;
return is_array($config) ? $config : null;
}
return null;
} | php | protected function loadConfigFile($file)
{
$path = $this->getConfigPath() . '/' . $file;
if (file_exists($path)) {
$config = include $path;
return is_array($config) ? $config : null;
}
return null;
} | [
"protected",
"function",
"loadConfigFile",
"(",
"$",
"file",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"getConfigPath",
"(",
")",
".",
"'/'",
".",
"$",
"file",
";",
"if",
"(",
"file_exists",
"(",
"$",
"path",
")",
")",
"{",
"$",
"config",
"=",... | Load a config file from the config directory.
@param string $file Filename
@return array|null Array config or null if not found | [
"Load",
"a",
"config",
"file",
"from",
"the",
"config",
"directory",
"."
] | da674fbec5bf3d5bd2a2141680a4c141113eb6b0 | https://github.com/3ev/wordpress-core/blob/da674fbec5bf3d5bd2a2141680a4c141113eb6b0/src/Tev/Plugin/Loader.php#L349-L359 |
205,637 | AntonyThorpe/consumer | src/Consumer.php | Consumer.isTimestamp | public static function isTimestamp($string)
{
if (substr($string, 0, 5) == "/Date") {
return true;
}
try {
new DateTime('@' . $string);
} catch (Exception $e) {
return false;
}
return true;
} | php | public static function isTimestamp($string)
{
if (substr($string, 0, 5) == "/Date") {
return true;
}
try {
new DateTime('@' . $string);
} catch (Exception $e) {
return false;
}
return true;
} | [
"public",
"static",
"function",
"isTimestamp",
"(",
"$",
"string",
")",
"{",
"if",
"(",
"substr",
"(",
"$",
"string",
",",
"0",
",",
"5",
")",
"==",
"\"/Date\"",
")",
"{",
"return",
"true",
";",
"}",
"try",
"{",
"new",
"DateTime",
"(",
"'@'",
".",
... | Determine if the string is a Unix Timestamp
@link(Stack Overflow, http://stackoverflow.com/questions/2524680/check-whether-the-string-is-a-unix-timestamp)
@param string $string
@return boolean | [
"Determine",
"if",
"the",
"string",
"is",
"a",
"Unix",
"Timestamp"
] | c9f464b901c09ab0bfbb62c94589637363af7bf0 | https://github.com/AntonyThorpe/consumer/blob/c9f464b901c09ab0bfbb62c94589637363af7bf0/src/Consumer.php#L49-L61 |
205,638 | AntonyThorpe/consumer | src/Consumer.php | Consumer.setMaxExternalLastEdited | public function setMaxExternalLastEdited(array $apidata)
{
$external_last_edited_key = $this->ExternalLastEditedKey;
// Validation
if (!$external_last_edited_key) {
user_error(
_t('Consumer.ExternalLastEditedKeyNeeded', 'Property ExternalLastEditedKey needs to be... | php | public function setMaxExternalLastEdited(array $apidata)
{
$external_last_edited_key = $this->ExternalLastEditedKey;
// Validation
if (!$external_last_edited_key) {
user_error(
_t('Consumer.ExternalLastEditedKeyNeeded', 'Property ExternalLastEditedKey needs to be... | [
"public",
"function",
"setMaxExternalLastEdited",
"(",
"array",
"$",
"apidata",
")",
"{",
"$",
"external_last_edited_key",
"=",
"$",
"this",
"->",
"ExternalLastEditedKey",
";",
"// Validation",
"if",
"(",
"!",
"$",
"external_last_edited_key",
")",
"{",
"user_error",... | Set the ExternalLastEdited to the maximum last edited date
@param array $apidata
@return $this | [
"Set",
"the",
"ExternalLastEdited",
"to",
"the",
"maximum",
"last",
"edited",
"date"
] | c9f464b901c09ab0bfbb62c94589637363af7bf0 | https://github.com/AntonyThorpe/consumer/blob/c9f464b901c09ab0bfbb62c94589637363af7bf0/src/Consumer.php#L68-L91 |
205,639 | acacha/forge-publish | src/Console/Commands/PublishAssignmentUsers.php | PublishAssignmentUsers.assignUsersToAssignment | protected function assignUsersToAssignment()
{
$assignment = fp_env('ACACHA_FORGE_ASSIGNMENT');
foreach ( $this->users as $user) {
$uri = str_replace('{assignment}', $assignment, config('forge-publish.assign_user_to_assignment_uri'));
$uri = str_replace('{user}', $user, $uri)... | php | protected function assignUsersToAssignment()
{
$assignment = fp_env('ACACHA_FORGE_ASSIGNMENT');
foreach ( $this->users as $user) {
$uri = str_replace('{assignment}', $assignment, config('forge-publish.assign_user_to_assignment_uri'));
$uri = str_replace('{user}', $user, $uri)... | [
"protected",
"function",
"assignUsersToAssignment",
"(",
")",
"{",
"$",
"assignment",
"=",
"fp_env",
"(",
"'ACACHA_FORGE_ASSIGNMENT'",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"users",
"as",
"$",
"user",
")",
"{",
"$",
"uri",
"=",
"str_replace",
"(",
"... | Assign users to assignment
@return array|mixed | [
"Assign",
"users",
"to",
"assignment"
] | 010779e3d2297c763b82dc3fbde992edffb3a6c6 | https://github.com/acacha/forge-publish/blob/010779e3d2297c763b82dc3fbde992edffb3a6c6/src/Console/Commands/PublishAssignmentUsers.php#L83-L107 |
205,640 | acacha/forge-publish | src/Console/Commands/PublishAssignmentUsers.php | PublishAssignmentUsers.askForUsers | protected function askForUsers()
{
$default = 0;
$users = $this->users();
$user_names = array_merge(
['Skip'],
collect($users)->pluck('name')->toArray()
);
$selected_user_names = $this->choice('Users?', $user_names ,$default, null, true);
if... | php | protected function askForUsers()
{
$default = 0;
$users = $this->users();
$user_names = array_merge(
['Skip'],
collect($users)->pluck('name')->toArray()
);
$selected_user_names = $this->choice('Users?', $user_names ,$default, null, true);
if... | [
"protected",
"function",
"askForUsers",
"(",
")",
"{",
"$",
"default",
"=",
"0",
";",
"$",
"users",
"=",
"$",
"this",
"->",
"users",
"(",
")",
";",
"$",
"user_names",
"=",
"array_merge",
"(",
"[",
"'Skip'",
"]",
",",
"collect",
"(",
"$",
"users",
"... | Ask for users.
@return string | [
"Ask",
"for",
"users",
"."
] | 010779e3d2297c763b82dc3fbde992edffb3a6c6 | https://github.com/acacha/forge-publish/blob/010779e3d2297c763b82dc3fbde992edffb3a6c6/src/Console/Commands/PublishAssignmentUsers.php#L135-L152 |
205,641 | schpill/thin | src/Paypal.php | Paypal.ipn | public static function ipn()
{
// only accept post data
if (!count($_POST)) {
return false;
}
// if production mode...
if (Config::get('paypal.production_mode')) {
// use production endpoint
$endpoint = ... | php | public static function ipn()
{
// only accept post data
if (!count($_POST)) {
return false;
}
// if production mode...
if (Config::get('paypal.production_mode')) {
// use production endpoint
$endpoint = ... | [
"public",
"static",
"function",
"ipn",
"(",
")",
"{",
"// only accept post data",
"if",
"(",
"!",
"count",
"(",
"$",
"_POST",
")",
")",
"{",
"return",
"false",
";",
"}",
"// if production mode...",
"if",
"(",
"Config",
"::",
"get",
"(",
"'paypal.production_m... | Automatically verify Paypal IPN communications.
@return boolean | [
"Automatically",
"verify",
"Paypal",
"IPN",
"communications",
"."
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Paypal.php#L79-L128 |
205,642 | ajaxtown/eaglehorn_framework | src/Eaglehorn/worker/Profiler/Profiler.php | Profiler.profile | public function profile($classname, $methodname, $methodargs, $invocations = 1)
{
if (class_exists($classname) != TRUE) {
throw new Exception("{$classname} doesn't exist");
}
$method = new ReflectionMethod($classname, $methodname);
$instance = NULL;
if (!$method... | php | public function profile($classname, $methodname, $methodargs, $invocations = 1)
{
if (class_exists($classname) != TRUE) {
throw new Exception("{$classname} doesn't exist");
}
$method = new ReflectionMethod($classname, $methodname);
$instance = NULL;
if (!$method... | [
"public",
"function",
"profile",
"(",
"$",
"classname",
",",
"$",
"methodname",
",",
"$",
"methodargs",
",",
"$",
"invocations",
"=",
"1",
")",
"{",
"if",
"(",
"class_exists",
"(",
"$",
"classname",
")",
"!=",
"TRUE",
")",
"{",
"throw",
"new",
"Excepti... | Runs a method with the provided arguments, and
returns details about how long it took. Works
with instance methods and static methods.
@param string $classname
@param string $methodname
@param array $methodargs
@param int $invocations
@throws Exception
@internal param string $classname
@internal param string $meth... | [
"Runs",
"a",
"method",
"with",
"the",
"provided",
"arguments",
"and",
"returns",
"details",
"about",
"how",
"long",
"it",
"took",
".",
"Works",
"with",
"instance",
"methods",
"and",
"static",
"methods",
"."
] | 5e2a1456ff6c65b3925f1219f115d8a919930f52 | https://github.com/ajaxtown/eaglehorn_framework/blob/5e2a1456ff6c65b3925f1219f115d8a919930f52/src/Eaglehorn/worker/Profiler/Profiler.php#L53-L85 |
205,643 | phavour/phavour | Phavour/Cache/AdapterMemcache.php | AdapterMemcache.flush | public function flush()
{
if (!$this->hasConnection()) {
// @codeCoverageIgnoreStart
return false;
// @codeCoverageIgnoreEnd
}
try {
return $this->memcache->flush();
// @codeCoverageIgnoreStart
} catch (\Exception $e) {
... | php | public function flush()
{
if (!$this->hasConnection()) {
// @codeCoverageIgnoreStart
return false;
// @codeCoverageIgnoreEnd
}
try {
return $this->memcache->flush();
// @codeCoverageIgnoreStart
} catch (\Exception $e) {
... | [
"public",
"function",
"flush",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasConnection",
"(",
")",
")",
"{",
"// @codeCoverageIgnoreStart",
"return",
"false",
";",
"// @codeCoverageIgnoreEnd",
"}",
"try",
"{",
"return",
"$",
"this",
"->",
"memcache"... | Flush all existing Cache
@return boolean | [
"Flush",
"all",
"existing",
"Cache"
] | 2246f78203312eb2e23fdb0f776f790e81b4d20f | https://github.com/phavour/phavour/blob/2246f78203312eb2e23fdb0f776f790e81b4d20f/Phavour/Cache/AdapterMemcache.php#L217-L233 |
205,644 | stonedz/pff2 | src/Abs/AController.php | AController.beforeFilter | public function beforeFilter() {
if(!isset($this->_beforeFilters[$this->_action])) {
return false;
}
foreach($this->_beforeFilters[$this->_action] as $method) {
call_user_func($method);
}
} | php | public function beforeFilter() {
if(!isset($this->_beforeFilters[$this->_action])) {
return false;
}
foreach($this->_beforeFilters[$this->_action] as $method) {
call_user_func($method);
}
} | [
"public",
"function",
"beforeFilter",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"_beforeFilters",
"[",
"$",
"this",
"->",
"_action",
"]",
")",
")",
"{",
"return",
"false",
";",
"}",
"foreach",
"(",
"$",
"this",
"->",
"_beforeFil... | Executes all the registered beforeFilters for the current action | [
"Executes",
"all",
"the",
"registered",
"beforeFilters",
"for",
"the",
"current",
"action"
] | ec3b087d4d4732816f61ac487f0cb25511e0da88 | https://github.com/stonedz/pff2/blob/ec3b087d4d4732816f61ac487f0cb25511e0da88/src/Abs/AController.php#L314-L322 |
205,645 | stonedz/pff2 | src/Abs/AController.php | AController.afterFilter | public function afterFilter() {
if(!isset($this->_afterFilters[$this->_action])) {
return false;
}
foreach($this->_afterFilters[$this->_action] as $method) {
call_user_func($method);
}
} | php | public function afterFilter() {
if(!isset($this->_afterFilters[$this->_action])) {
return false;
}
foreach($this->_afterFilters[$this->_action] as $method) {
call_user_func($method);
}
} | [
"public",
"function",
"afterFilter",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"_afterFilters",
"[",
"$",
"this",
"->",
"_action",
"]",
")",
")",
"{",
"return",
"false",
";",
"}",
"foreach",
"(",
"$",
"this",
"->",
"_afterFilter... | Execute all the registered afterFilters for the current action | [
"Execute",
"all",
"the",
"registered",
"afterFilters",
"for",
"the",
"current",
"action"
] | ec3b087d4d4732816f61ac487f0cb25511e0da88 | https://github.com/stonedz/pff2/blob/ec3b087d4d4732816f61ac487f0cb25511e0da88/src/Abs/AController.php#L327-L335 |
205,646 | smalldb/libSmalldb | class/AbstractMachine.php | AbstractMachine.getView | public final function getView($id, $view, & $properties_cache = null, & $view_cache = null, & $persistent_view_cache = null)
{
// Check cache
if (isset($view_cache[$view])) {
return $view_cache[$view];
}
switch ($view) {
case 'url':
// Get URL of this state machine
return $this->urlFormat($id, $... | php | public final function getView($id, $view, & $properties_cache = null, & $view_cache = null, & $persistent_view_cache = null)
{
// Check cache
if (isset($view_cache[$view])) {
return $view_cache[$view];
}
switch ($view) {
case 'url':
// Get URL of this state machine
return $this->urlFormat($id, $... | [
"public",
"final",
"function",
"getView",
"(",
"$",
"id",
",",
"$",
"view",
",",
"&",
"$",
"properties_cache",
"=",
"null",
",",
"&",
"$",
"view_cache",
"=",
"null",
",",
"&",
"$",
"persistent_view_cache",
"=",
"null",
")",
"{",
"// Check cache",
"if",
... | Get properties in given view.
Just like SQL view, the property view is transformed set of
properties. These views are useful when some properties require
heavy calculations.
Keep in mind, that view name must not interfere with Reference
properties, otherwise the view is inaccessible directly.
Array $properties_cache... | [
"Get",
"properties",
"in",
"given",
"view",
"."
] | b94d22af5014e8060d0530fc7043768cdc57b01a | https://github.com/smalldb/libSmalldb/blob/b94d22af5014e8060d0530fc7043768cdc57b01a/class/AbstractMachine.php#L469-L504 |
205,647 | smalldb/libSmalldb | class/AbstractMachine.php | AbstractMachine.urlFormat | protected function urlFormat($id, $url_fmt, $properties_cache): string
{
if (isset($url_fmt)) {
if ($properties_cache === null) {
// URL contains ID only, so there is no need to load properties.
return Utils::filename_format($url_fmt, array_combine($this->describeId(), (array) $id));
} else {
// Ho... | php | protected function urlFormat($id, $url_fmt, $properties_cache): string
{
if (isset($url_fmt)) {
if ($properties_cache === null) {
// URL contains ID only, so there is no need to load properties.
return Utils::filename_format($url_fmt, array_combine($this->describeId(), (array) $id));
} else {
// Ho... | [
"protected",
"function",
"urlFormat",
"(",
"$",
"id",
",",
"$",
"url_fmt",
",",
"$",
"properties_cache",
")",
":",
"string",
"{",
"if",
"(",
"isset",
"(",
"$",
"url_fmt",
")",
")",
"{",
"if",
"(",
"$",
"properties_cache",
"===",
"null",
")",
"{",
"//... | Create URL using properties and given format. | [
"Create",
"URL",
"using",
"properties",
"and",
"given",
"format",
"."
] | b94d22af5014e8060d0530fc7043768cdc57b01a | https://github.com/smalldb/libSmalldb/blob/b94d22af5014e8060d0530fc7043768cdc57b01a/class/AbstractMachine.php#L523-L537 |
205,648 | smalldb/libSmalldb | class/AbstractMachine.php | AbstractMachine.resolveMachineReference | protected function resolveMachineReference(string $reference_name, array $properties_cache): Reference
{
if (!isset($this->references[$reference_name])) {
throw new \InvalidArgumentException('Unknown reference: '.$reference_name);
}
// Get reference configuration
$r = $this->references[$reference_name];
... | php | protected function resolveMachineReference(string $reference_name, array $properties_cache): Reference
{
if (!isset($this->references[$reference_name])) {
throw new \InvalidArgumentException('Unknown reference: '.$reference_name);
}
// Get reference configuration
$r = $this->references[$reference_name];
... | [
"protected",
"function",
"resolveMachineReference",
"(",
"string",
"$",
"reference_name",
",",
"array",
"$",
"properties_cache",
")",
":",
"Reference",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"references",
"[",
"$",
"reference_name",
"]",
")",
... | Helper function to resolve reference to another machine.
@param string $reference_name Name of the reference in AbstractMachine::references.
@param array $properties_cache Properties of referencing machine.
@return Reference to referred machine. | [
"Helper",
"function",
"to",
"resolve",
"reference",
"to",
"another",
"machine",
"."
] | b94d22af5014e8060d0530fc7043768cdc57b01a | https://github.com/smalldb/libSmalldb/blob/b94d22af5014e8060d0530fc7043768cdc57b01a/class/AbstractMachine.php#L547-L566 |
205,649 | smalldb/libSmalldb | class/AbstractMachine.php | AbstractMachine.isTransitionAllowed | public function isTransitionAllowed(Reference $ref, $transition_name, $state = null, & $access_policy = null)
{
if ($state === null) {
$state = $ref->state;
}
if ($transition_name == '') {
// Read access
$access_policy = $this->read_access_policy;
return $this->checkAccessPolicy($this->read_access_p... | php | public function isTransitionAllowed(Reference $ref, $transition_name, $state = null, & $access_policy = null)
{
if ($state === null) {
$state = $ref->state;
}
if ($transition_name == '') {
// Read access
$access_policy = $this->read_access_policy;
return $this->checkAccessPolicy($this->read_access_p... | [
"public",
"function",
"isTransitionAllowed",
"(",
"Reference",
"$",
"ref",
",",
"$",
"transition_name",
",",
"$",
"state",
"=",
"null",
",",
"&",
"$",
"access_policy",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"state",
"===",
"null",
")",
"{",
"$",
"state... | Returns true if transition can be invoked right now.
TODO: Transition should not have full definition of the policy, only
its name. Definitions should be in common place. | [
"Returns",
"true",
"if",
"transition",
"can",
"be",
"invoked",
"right",
"now",
"."
] | b94d22af5014e8060d0530fc7043768cdc57b01a | https://github.com/smalldb/libSmalldb/blob/b94d22af5014e8060d0530fc7043768cdc57b01a/class/AbstractMachine.php#L575-L602 |
205,650 | smalldb/libSmalldb | class/AbstractMachine.php | AbstractMachine.ref | public function ref($id): Reference
{
$ref = new $this->reference_class($this->smalldb, $this, $id);
if ($this->debug_logger) {
$this->debug_logger->afterReferenceCreated(null, $ref);
}
return $ref;
} | php | public function ref($id): Reference
{
$ref = new $this->reference_class($this->smalldb, $this, $id);
if ($this->debug_logger) {
$this->debug_logger->afterReferenceCreated(null, $ref);
}
return $ref;
} | [
"public",
"function",
"ref",
"(",
"$",
"id",
")",
":",
"Reference",
"{",
"$",
"ref",
"=",
"new",
"$",
"this",
"->",
"reference_class",
"(",
"$",
"this",
"->",
"smalldb",
",",
"$",
"this",
",",
"$",
"id",
")",
";",
"if",
"(",
"$",
"this",
"->",
... | Helper to create Reference to this machine.
@see AbstractBackend::ref | [
"Helper",
"to",
"create",
"Reference",
"to",
"this",
"machine",
"."
] | b94d22af5014e8060d0530fc7043768cdc57b01a | https://github.com/smalldb/libSmalldb/blob/b94d22af5014e8060d0530fc7043768cdc57b01a/class/AbstractMachine.php#L758-L765 |
205,651 | smalldb/libSmalldb | class/AbstractMachine.php | AbstractMachine.hotRef | public function hotRef($properties): Reference
{
$ref = $this->reference_class::createPreheatedReference($this->smalldb, $this, $properties);
if ($this->debug_logger) {
$this->debug_logger->afterReferenceCreated(null, $ref, $properties);
}
return $ref;
} | php | public function hotRef($properties): Reference
{
$ref = $this->reference_class::createPreheatedReference($this->smalldb, $this, $properties);
if ($this->debug_logger) {
$this->debug_logger->afterReferenceCreated(null, $ref, $properties);
}
return $ref;
} | [
"public",
"function",
"hotRef",
"(",
"$",
"properties",
")",
":",
"Reference",
"{",
"$",
"ref",
"=",
"$",
"this",
"->",
"reference_class",
"::",
"createPreheatedReference",
"(",
"$",
"this",
"->",
"smalldb",
",",
"$",
"this",
",",
"$",
"properties",
")",
... | Create pre-heated reference using properties loaded from elsewhere.
@warning This may break things a lot. Be careful. | [
"Create",
"pre",
"-",
"heated",
"reference",
"using",
"properties",
"loaded",
"from",
"elsewhere",
"."
] | b94d22af5014e8060d0530fc7043768cdc57b01a | https://github.com/smalldb/libSmalldb/blob/b94d22af5014e8060d0530fc7043768cdc57b01a/class/AbstractMachine.php#L788-L795 |
205,652 | smalldb/libSmalldb | class/AbstractMachine.php | AbstractMachine.performSelfCheck | public function performSelfCheck()
{
$results = [];
$results['id'] = $this->describeId();
$results['class'] = get_class($this);
$results['missing_methods'] = [];
$results['errors'] = $this->errors;
foreach ($this->describeAllMachineActions() as $a => $action) {
foreach ($action['transitions'] as $t =>... | php | public function performSelfCheck()
{
$results = [];
$results['id'] = $this->describeId();
$results['class'] = get_class($this);
$results['missing_methods'] = [];
$results['errors'] = $this->errors;
foreach ($this->describeAllMachineActions() as $a => $action) {
foreach ($action['transitions'] as $t =>... | [
"public",
"function",
"performSelfCheck",
"(",
")",
"{",
"$",
"results",
"=",
"[",
"]",
";",
"$",
"results",
"[",
"'id'",
"]",
"=",
"$",
"this",
"->",
"describeId",
"(",
")",
";",
"$",
"results",
"[",
"'class'",
"]",
"=",
"get_class",
"(",
"$",
"th... | Perform self-check.
TODO: Extend this method with more checks.
@see AbstractBackend::performSelfCheck() | [
"Perform",
"self",
"-",
"check",
"."
] | b94d22af5014e8060d0530fc7043768cdc57b01a | https://github.com/smalldb/libSmalldb/blob/b94d22af5014e8060d0530fc7043768cdc57b01a/class/AbstractMachine.php#L805-L829 |
205,653 | smalldb/libSmalldb | class/AbstractMachine.php | AbstractMachine.findUnreachableStates | public function findUnreachableStates(): array
{
$g = new Graph();
$g->indexNodeAttr('unreachable');
$g->createNode('', ['unreachable' => false]);
foreach ($this->states as $s => $state) {
if ($s !== '') {
$g->createNode($s, ['unreachable' => true]);
}
}
foreach ($this->actions as $a => $action... | php | public function findUnreachableStates(): array
{
$g = new Graph();
$g->indexNodeAttr('unreachable');
$g->createNode('', ['unreachable' => false]);
foreach ($this->states as $s => $state) {
if ($s !== '') {
$g->createNode($s, ['unreachable' => true]);
}
}
foreach ($this->actions as $a => $action... | [
"public",
"function",
"findUnreachableStates",
"(",
")",
":",
"array",
"{",
"$",
"g",
"=",
"new",
"Graph",
"(",
")",
";",
"$",
"g",
"->",
"indexNodeAttr",
"(",
"'unreachable'",
")",
";",
"$",
"g",
"->",
"createNode",
"(",
"''",
",",
"[",
"'unreachable'... | Run DFS from not-exists state and return list of unreachable states. | [
"Run",
"DFS",
"from",
"not",
"-",
"exists",
"state",
"and",
"return",
"list",
"of",
"unreachable",
"states",
"."
] | b94d22af5014e8060d0530fc7043768cdc57b01a | https://github.com/smalldb/libSmalldb/blob/b94d22af5014e8060d0530fc7043768cdc57b01a/class/AbstractMachine.php#L835-L863 |
205,654 | smalldb/libSmalldb | class/AbstractMachine.php | AbstractMachine.exportDotRenderGroups | private function exportDotRenderGroups($groups, $group_content, $indent = "\t") {
foreach ($groups as $g => $group) {
echo $indent, "subgraph ", $this->exportDotIdentifier($g, 'cluster_'), " {\n";
if (isset($group['label'])) {
echo $indent, "\t", "label = \"", addcslashes($group['label'], '"'), "\";\n";
... | php | private function exportDotRenderGroups($groups, $group_content, $indent = "\t") {
foreach ($groups as $g => $group) {
echo $indent, "subgraph ", $this->exportDotIdentifier($g, 'cluster_'), " {\n";
if (isset($group['label'])) {
echo $indent, "\t", "label = \"", addcslashes($group['label'], '"'), "\";\n";
... | [
"private",
"function",
"exportDotRenderGroups",
"(",
"$",
"groups",
",",
"$",
"group_content",
",",
"$",
"indent",
"=",
"\"\\t\"",
")",
"{",
"foreach",
"(",
"$",
"groups",
"as",
"$",
"g",
"=>",
"$",
"group",
")",
"{",
"echo",
"$",
"indent",
",",
"\"sub... | Recursively render groups in state machine diagram. | [
"Recursively",
"render",
"groups",
"in",
"state",
"machine",
"diagram",
"."
] | b94d22af5014e8060d0530fc7043768cdc57b01a | https://github.com/smalldb/libSmalldb/blob/b94d22af5014e8060d0530fc7043768cdc57b01a/class/AbstractMachine.php#L1480-L1502 |
205,655 | smalldb/libSmalldb | class/AbstractMachine.php | AbstractMachine.exportDotRenderExtras | protected function exportDotRenderExtras($debug_opts)
{
if (!empty($this->state_diagram_extras)) {
echo "\tsubgraph cluster_extras {\n",
"\t\tgraph [ margin = 10; ];\n",
"\t\tcolor=transparent;\n\n";
foreach($this->state_diagram_extras as $i => $e) {
echo "\n\t# Extras ", str_replace("\n", " ", $i)... | php | protected function exportDotRenderExtras($debug_opts)
{
if (!empty($this->state_diagram_extras)) {
echo "\tsubgraph cluster_extras {\n",
"\t\tgraph [ margin = 10; ];\n",
"\t\tcolor=transparent;\n\n";
foreach($this->state_diagram_extras as $i => $e) {
echo "\n\t# Extras ", str_replace("\n", " ", $i)... | [
"protected",
"function",
"exportDotRenderExtras",
"(",
"$",
"debug_opts",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"state_diagram_extras",
")",
")",
"{",
"echo",
"\"\\tsubgraph cluster_extras {\\n\"",
",",
"\"\\t\\tgraph [ margin = 10; ];\\n\"",
",",... | Render extra diagram features.
Writes Graphviz dot syntax to stdout (echo), output is placed just
before digraph's closing bracket.
@param mixed $debug_opts Machine-specific Options to configure visible
debug data. | [
"Render",
"extra",
"diagram",
"features",
"."
] | b94d22af5014e8060d0530fc7043768cdc57b01a | https://github.com/smalldb/libSmalldb/blob/b94d22af5014e8060d0530fc7043768cdc57b01a/class/AbstractMachine.php#L1514-L1526 |
205,656 | smalldb/libSmalldb | class/AbstractMachine.php | AbstractMachine.exportJsonAddExtras | protected function exportJsonAddExtras($debug_opts, array $machine_graph): array
{
if (!empty($this->state_diagram_extras_json)) {
$graph = $this->state_diagram_extras_json;
if (!isset($graph['layout'])) {
$graph['layout'] = 'row';
$graph['layoutOptions'] = [
'align' => 'top',
];
}
if (!... | php | protected function exportJsonAddExtras($debug_opts, array $machine_graph): array
{
if (!empty($this->state_diagram_extras_json)) {
$graph = $this->state_diagram_extras_json;
if (!isset($graph['layout'])) {
$graph['layout'] = 'row';
$graph['layoutOptions'] = [
'align' => 'top',
];
}
if (!... | [
"protected",
"function",
"exportJsonAddExtras",
"(",
"$",
"debug_opts",
",",
"array",
"$",
"machine_graph",
")",
":",
"array",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"state_diagram_extras_json",
")",
")",
"{",
"$",
"graph",
"=",
"$",
"this",... | Add extra diagram features into the diagram.
Extend this method to add debugging visualizations.
@see AbstractMachine::exportJson().
@see https://grafovatko.smalldb.org/
@param mixed $debug_opts Machine-specific Options to configure visible
debug data.
@param array $machine_graph Smalldb state chart wrapped in a 'sm... | [
"Add",
"extra",
"diagram",
"features",
"into",
"the",
"diagram",
"."
] | b94d22af5014e8060d0530fc7043768cdc57b01a | https://github.com/smalldb/libSmalldb/blob/b94d22af5014e8060d0530fc7043768cdc57b01a/class/AbstractMachine.php#L1541-L1569 |
205,657 | wigedev/farm | src/DataAccess/MsSQL.php | MsSQL.disconnect | public function disconnect() : void
{
if ($this->dbconn->inTransaction()) {
$this->dbconn->rollBack();
}
$this->dbconn = null;
$this->is_connected = false;
} | php | public function disconnect() : void
{
if ($this->dbconn->inTransaction()) {
$this->dbconn->rollBack();
}
$this->dbconn = null;
$this->is_connected = false;
} | [
"public",
"function",
"disconnect",
"(",
")",
":",
"void",
"{",
"if",
"(",
"$",
"this",
"->",
"dbconn",
"->",
"inTransaction",
"(",
")",
")",
"{",
"$",
"this",
"->",
"dbconn",
"->",
"rollBack",
"(",
")",
";",
"}",
"$",
"this",
"->",
"dbconn",
"=",
... | Close the connection if it has been established. | [
"Close",
"the",
"connection",
"if",
"it",
"has",
"been",
"established",
"."
] | 7a1729ec78628b7e5435e4a42e42d547a07af851 | https://github.com/wigedev/farm/blob/7a1729ec78628b7e5435e4a42e42d547a07af851/src/DataAccess/MsSQL.php#L92-L99 |
205,658 | wigedev/farm | src/DataAccess/MsSQL.php | MsSQL.beginTransaction | public function beginTransaction() : bool
{
if ($this->dbconn->inTransaction()) {
throw new TransactionErrorException("A transaction has already been started.");
}
try {
return $this->dbconn->beginTransaction();
} catch (\PDOException $exception) {
... | php | public function beginTransaction() : bool
{
if ($this->dbconn->inTransaction()) {
throw new TransactionErrorException("A transaction has already been started.");
}
try {
return $this->dbconn->beginTransaction();
} catch (\PDOException $exception) {
... | [
"public",
"function",
"beginTransaction",
"(",
")",
":",
"bool",
"{",
"if",
"(",
"$",
"this",
"->",
"dbconn",
"->",
"inTransaction",
"(",
")",
")",
"{",
"throw",
"new",
"TransactionErrorException",
"(",
"\"A transaction has already been started.\"",
")",
";",
"}... | Start a transaction.
@return bool
@throws TransactionErrorException if a transaction is already started
@throws TransactionsNotSupportedException if transactions are not supported | [
"Start",
"a",
"transaction",
"."
] | 7a1729ec78628b7e5435e4a42e42d547a07af851 | https://github.com/wigedev/farm/blob/7a1729ec78628b7e5435e4a42e42d547a07af851/src/DataAccess/MsSQL.php#L108-L118 |
205,659 | wigedev/farm | src/DataAccess/MsSQL.php | MsSQL.toArray | public function toArray() : ?array
{
if (null === $this->stmt || false === $this->stmt) {
return null;
}
return $this->stmt->toArray();
} | php | public function toArray() : ?array
{
if (null === $this->stmt || false === $this->stmt) {
return null;
}
return $this->stmt->toArray();
} | [
"public",
"function",
"toArray",
"(",
")",
":",
"?",
"array",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"stmt",
"||",
"false",
"===",
"$",
"this",
"->",
"stmt",
")",
"{",
"return",
"null",
";",
"}",
"return",
"$",
"this",
"->",
"stmt",
"-... | Gets the results and a multidimensional array.
@return array|null The results as an array or null if this was not a select or if there was an error. | [
"Gets",
"the",
"results",
"and",
"a",
"multidimensional",
"array",
"."
] | 7a1729ec78628b7e5435e4a42e42d547a07af851 | https://github.com/wigedev/farm/blob/7a1729ec78628b7e5435e4a42e42d547a07af851/src/DataAccess/MsSQL.php#L223-L229 |
205,660 | amarcinkowski/hospitalplugin | src/utils/ExcelExport.php | ExcelExport.clearName | private static function clearName($string, $removeWords) {
$string = str_replace ( ' ', '-', $string );
$string = preg_replace ( '/[^A-Za-z0-9\-]/', '', $string );
foreach ( $removeWords as $word ) {
$string = str_replace ( $word, '', $string );
}
$string = substr ( $string, 0, 29 );
return $string;
} | php | private static function clearName($string, $removeWords) {
$string = str_replace ( ' ', '-', $string );
$string = preg_replace ( '/[^A-Za-z0-9\-]/', '', $string );
foreach ( $removeWords as $word ) {
$string = str_replace ( $word, '', $string );
}
$string = substr ( $string, 0, 29 );
return $string;
} | [
"private",
"static",
"function",
"clearName",
"(",
"$",
"string",
",",
"$",
"removeWords",
")",
"{",
"$",
"string",
"=",
"str_replace",
"(",
"' '",
",",
"'-'",
",",
"$",
"string",
")",
";",
"$",
"string",
"=",
"preg_replace",
"(",
"'/[^A-Za-z0-9\\-]/'",
... | remove special chars and words from string
@param unknown $string | [
"remove",
"special",
"chars",
"and",
"words",
"from",
"string"
] | acdc2be5157abfbdcafb4dcf6c6ba505e291263f | https://github.com/amarcinkowski/hospitalplugin/blob/acdc2be5157abfbdcafb4dcf6c6ba505e291263f/src/utils/ExcelExport.php#L94-L102 |
205,661 | chilimatic/chilimatic-framework | lib/file/Upload.php | Upload.upload | public function upload($file = null)
{
if (empty($file) || !is_array($file)) return false;
$this->u_tmp_name = $file['tmp_name'];
$this->u_name = $file['name'];
$this->u_size = $file['size'];
$this->u_mime_type = $file['type'];
$this->u_error = isset(... | php | public function upload($file = null)
{
if (empty($file) || !is_array($file)) return false;
$this->u_tmp_name = $file['tmp_name'];
$this->u_name = $file['name'];
$this->u_size = $file['size'];
$this->u_mime_type = $file['type'];
$this->u_error = isset(... | [
"public",
"function",
"upload",
"(",
"$",
"file",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"file",
")",
"||",
"!",
"is_array",
"(",
"$",
"file",
")",
")",
"return",
"false",
";",
"$",
"this",
"->",
"u_tmp_name",
"=",
"$",
"file",
"[",... | current upload process
@param $file array
@return bool
@throws FileException | [
"current",
"upload",
"process"
] | 8df7f12e75d75d3fd2197a58c80d39cbb4b9ff12 | https://github.com/chilimatic/chilimatic-framework/blob/8df7f12e75d75d3fd2197a58c80d39cbb4b9ff12/lib/file/Upload.php#L80-L98 |
205,662 | chilimatic/chilimatic-framework | lib/file/Upload.php | Upload._get_file_extension | private function _get_file_extension()
{
if (empty($this->u_mime_type)) return false;
$tmp = explode('/', $this->u_mime_type);
$this->file_extension = array_pop($tmp);
unset($tmp);
return true;
} | php | private function _get_file_extension()
{
if (empty($this->u_mime_type)) return false;
$tmp = explode('/', $this->u_mime_type);
$this->file_extension = array_pop($tmp);
unset($tmp);
return true;
} | [
"private",
"function",
"_get_file_extension",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"u_mime_type",
")",
")",
"return",
"false",
";",
"$",
"tmp",
"=",
"explode",
"(",
"'/'",
",",
"$",
"this",
"->",
"u_mime_type",
")",
";",
"$",
"t... | gets the suffix for the file that has been uploaded
@return bool | [
"gets",
"the",
"suffix",
"for",
"the",
"file",
"that",
"has",
"been",
"uploaded"
] | 8df7f12e75d75d3fd2197a58c80d39cbb4b9ff12 | https://github.com/chilimatic/chilimatic-framework/blob/8df7f12e75d75d3fd2197a58c80d39cbb4b9ff12/lib/file/Upload.php#L106-L117 |
205,663 | smalldb/libSmalldb | class/Graph/ElementAttrIndex.php | ElementAttrIndex.rebuildAttrIndex | private function rebuildAttrIndex(string $key)
{
$this->index[$key] = [];
foreach ($this->elements as $id => $element) {
if ($element instanceof $this->elementClassName) {
$value = $element->getAttr($key);
$this->index[$key][$value][$id] = $element;
} else {
throw new \InvalidArgumentException("... | php | private function rebuildAttrIndex(string $key)
{
$this->index[$key] = [];
foreach ($this->elements as $id => $element) {
if ($element instanceof $this->elementClassName) {
$value = $element->getAttr($key);
$this->index[$key][$value][$id] = $element;
} else {
throw new \InvalidArgumentException("... | [
"private",
"function",
"rebuildAttrIndex",
"(",
"string",
"$",
"key",
")",
"{",
"$",
"this",
"->",
"index",
"[",
"$",
"key",
"]",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"elements",
"as",
"$",
"id",
"=>",
"$",
"element",
")",
"{",
... | Rebuild the entire index from provided elements. | [
"Rebuild",
"the",
"entire",
"index",
"from",
"provided",
"elements",
"."
] | b94d22af5014e8060d0530fc7043768cdc57b01a | https://github.com/smalldb/libSmalldb/blob/b94d22af5014e8060d0530fc7043768cdc57b01a/class/Graph/ElementAttrIndex.php#L85-L97 |
205,664 | smalldb/libSmalldb | class/Graph/ElementAttrIndex.php | ElementAttrIndex.removeElement | public function removeElement(AbstractElement $element)
{
$id = $element->getId();
if (!isset($this->elements[$id])) {
throw new MissingElementException("Element \"$id\" is not indexed.");
}
unset($this->elements[$id]);
$indexedAttrs = array_intersect_key($element->getAttributes(), $this->index);
for... | php | public function removeElement(AbstractElement $element)
{
$id = $element->getId();
if (!isset($this->elements[$id])) {
throw new MissingElementException("Element \"$id\" is not indexed.");
}
unset($this->elements[$id]);
$indexedAttrs = array_intersect_key($element->getAttributes(), $this->index);
for... | [
"public",
"function",
"removeElement",
"(",
"AbstractElement",
"$",
"element",
")",
"{",
"$",
"id",
"=",
"$",
"element",
"->",
"getId",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"elements",
"[",
"$",
"id",
"]",
")",
")",
"{",
... | Remove element from index | [
"Remove",
"element",
"from",
"index"
] | b94d22af5014e8060d0530fc7043768cdc57b01a | https://github.com/smalldb/libSmalldb/blob/b94d22af5014e8060d0530fc7043768cdc57b01a/class/Graph/ElementAttrIndex.php#L127-L141 |
205,665 | smalldb/libSmalldb | class/Graph/ElementAttrIndex.php | ElementAttrIndex.update | public function update(string $key, $oldValue, $newValue, AbstractElement $element)
{
if (!isset($this->index[$key])) {
throw new MissingAttrIndexException("Attribute index \"$key\" is not defined.");
}
$id = $element->getId();
if (isset($this->index[$key][$oldValue][$id])) {
unset($this->index[$key][$... | php | public function update(string $key, $oldValue, $newValue, AbstractElement $element)
{
if (!isset($this->index[$key])) {
throw new MissingAttrIndexException("Attribute index \"$key\" is not defined.");
}
$id = $element->getId();
if (isset($this->index[$key][$oldValue][$id])) {
unset($this->index[$key][$... | [
"public",
"function",
"update",
"(",
"string",
"$",
"key",
",",
"$",
"oldValue",
",",
"$",
"newValue",
",",
"AbstractElement",
"$",
"element",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"index",
"[",
"$",
"key",
"]",
")",
")",
"{",
... | Update indices to match the changed attribute of the element | [
"Update",
"indices",
"to",
"match",
"the",
"changed",
"attribute",
"of",
"the",
"element"
] | b94d22af5014e8060d0530fc7043768cdc57b01a | https://github.com/smalldb/libSmalldb/blob/b94d22af5014e8060d0530fc7043768cdc57b01a/class/Graph/ElementAttrIndex.php#L147-L162 |
205,666 | smalldb/libSmalldb | class/Graph/ElementAttrIndex.php | ElementAttrIndex.getElements | public function getElements(string $key, $value): array
{
if (!isset($this->index[$key])) {
throw new MissingAttrIndexException("Attribute index \"$key\" is not defined.");
}
return $this->index[$key][$value] ?? [];
} | php | public function getElements(string $key, $value): array
{
if (!isset($this->index[$key])) {
throw new MissingAttrIndexException("Attribute index \"$key\" is not defined.");
}
return $this->index[$key][$value] ?? [];
} | [
"public",
"function",
"getElements",
"(",
"string",
"$",
"key",
",",
"$",
"value",
")",
":",
"array",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"index",
"[",
"$",
"key",
"]",
")",
")",
"{",
"throw",
"new",
"MissingAttrIndexException",
"("... | Get elements by the value of the attribute | [
"Get",
"elements",
"by",
"the",
"value",
"of",
"the",
"attribute"
] | b94d22af5014e8060d0530fc7043768cdc57b01a | https://github.com/smalldb/libSmalldb/blob/b94d22af5014e8060d0530fc7043768cdc57b01a/class/Graph/ElementAttrIndex.php#L179-L186 |
205,667 | luoxiaojun1992/lb_framework | components/helpers/HtmlHelper.php | HtmlHelper.image | public static function image($src, $alt = '', $options = [])
{
$image_tag_tpl = '<img src="%s" alt="%s"%s />';
$cdnHost = Lb::app()->getCdnHost();
if ($cdnHost) {
if (!ValidationHelper::isUrl($src)) {
$src = $cdnHost . $src;
} else {
$s... | php | public static function image($src, $alt = '', $options = [])
{
$image_tag_tpl = '<img src="%s" alt="%s"%s />';
$cdnHost = Lb::app()->getCdnHost();
if ($cdnHost) {
if (!ValidationHelper::isUrl($src)) {
$src = $cdnHost . $src;
} else {
$s... | [
"public",
"static",
"function",
"image",
"(",
"$",
"src",
",",
"$",
"alt",
"=",
"''",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"image_tag_tpl",
"=",
"'<img src=\"%s\" alt=\"%s\"%s />'",
";",
"$",
"cdnHost",
"=",
"Lb",
"::",
"app",
"(",
")",
... | Generate image tag
@param $src
@param string $alt
@param array $options
@return string | [
"Generate",
"image",
"tag"
] | 12a865729e7738d7d1e07371ad7203243c4571fa | https://github.com/luoxiaojun1992/lb_framework/blob/12a865729e7738d7d1e07371ad7203243c4571fa/components/helpers/HtmlHelper.php#L84-L96 |
205,668 | luoxiaojun1992/lb_framework | components/helpers/HtmlHelper.php | HtmlHelper.purify | public static function purify($dirtyHtml)
{
if (self::$htmlPurifier && self::$htmlPurifier instanceof \HTMLPurifier) {
$purifier = self::$htmlPurifier;
} else {
$purifier = (self::$htmlPurifier = new \HTMLPurifier(\HTMLPurifier_Config::createDefault()));
}
ret... | php | public static function purify($dirtyHtml)
{
if (self::$htmlPurifier && self::$htmlPurifier instanceof \HTMLPurifier) {
$purifier = self::$htmlPurifier;
} else {
$purifier = (self::$htmlPurifier = new \HTMLPurifier(\HTMLPurifier_Config::createDefault()));
}
ret... | [
"public",
"static",
"function",
"purify",
"(",
"$",
"dirtyHtml",
")",
"{",
"if",
"(",
"self",
"::",
"$",
"htmlPurifier",
"&&",
"self",
"::",
"$",
"htmlPurifier",
"instanceof",
"\\",
"HTMLPurifier",
")",
"{",
"$",
"purifier",
"=",
"self",
"::",
"$",
"html... | Purify dirty html
@param $dirtyHtml
@return mixed | [
"Purify",
"dirty",
"html"
] | 12a865729e7738d7d1e07371ad7203243c4571fa | https://github.com/luoxiaojun1992/lb_framework/blob/12a865729e7738d7d1e07371ad7203243c4571fa/components/helpers/HtmlHelper.php#L120-L128 |
205,669 | krupni/yii-eoauth | src/EOAuthUtils.php | EOAuthUtils.GetRequestToken | public static function GetRequestToken(OAuthConsumer $consumer, $scope,
$endpoint, $applicationName, $callbackUrl) {
$signatureMethod = new OAuthSignatureMethod_HMAC_SHA1();
// Set parameters.
$params = array();
$params['scope'] = $scope;
if (isset($applicationName)) {
$params['xoauth_d... | php | public static function GetRequestToken(OAuthConsumer $consumer, $scope,
$endpoint, $applicationName, $callbackUrl) {
$signatureMethod = new OAuthSignatureMethod_HMAC_SHA1();
// Set parameters.
$params = array();
$params['scope'] = $scope;
if (isset($applicationName)) {
$params['xoauth_d... | [
"public",
"static",
"function",
"GetRequestToken",
"(",
"OAuthConsumer",
"$",
"consumer",
",",
"$",
"scope",
",",
"$",
"endpoint",
",",
"$",
"applicationName",
",",
"$",
"callbackUrl",
")",
"{",
"$",
"signatureMethod",
"=",
"new",
"OAuthSignatureMethod_HMAC_SHA1",... | Using the consumer and scope provided, a request is made to the endpoint
to generate an OAuth request token.
@param OAuthConsumer $consumer the consumer
@param string $scope the scope of the application to authorize
@param string $endpoint the OAuth endpoint to make the request against
@param string $applicationName op... | [
"Using",
"the",
"consumer",
"and",
"scope",
"provided",
"a",
"request",
"is",
"made",
"to",
"the",
"endpoint",
"to",
"generate",
"an",
"OAuth",
"request",
"token",
"."
] | 182bcaaea73c87d90635c2201213273f40cfab26 | https://github.com/krupni/yii-eoauth/blob/182bcaaea73c87d90635c2201213273f40cfab26/src/EOAuthUtils.php#L35-L56 |
205,670 | krupni/yii-eoauth | src/EOAuthUtils.php | EOAuthUtils.GetAccessToken | public static function GetAccessToken(OAuthConsumer $consumer,
OAuthToken $token, $verifier, $endpoint) {
$signatureMethod = new OAuthSignatureMethod_HMAC_SHA1();
// Set parameters.
$params = array();
$params['oauth_verifier'] = $verifier;
// Create and sign request.
$request = OAuthRequ... | php | public static function GetAccessToken(OAuthConsumer $consumer,
OAuthToken $token, $verifier, $endpoint) {
$signatureMethod = new OAuthSignatureMethod_HMAC_SHA1();
// Set parameters.
$params = array();
$params['oauth_verifier'] = $verifier;
// Create and sign request.
$request = OAuthRequ... | [
"public",
"static",
"function",
"GetAccessToken",
"(",
"OAuthConsumer",
"$",
"consumer",
",",
"OAuthToken",
"$",
"token",
",",
"$",
"verifier",
",",
"$",
"endpoint",
")",
"{",
"$",
"signatureMethod",
"=",
"new",
"OAuthSignatureMethod_HMAC_SHA1",
"(",
")",
";",
... | Using the provided consumer and authorized request token, a request is
made to the endpoint to generate an OAuth access token.
@param OAuthConsumer $consumer the consumer
@param OAuthToken $token the authorized request token
@param string $verifier the OAuth verifier code returned with the callback
@param string $endpo... | [
"Using",
"the",
"provided",
"consumer",
"and",
"authorized",
"request",
"token",
"a",
"request",
"is",
"made",
"to",
"the",
"endpoint",
"to",
"generate",
"an",
"OAuth",
"access",
"token",
"."
] | 182bcaaea73c87d90635c2201213273f40cfab26 | https://github.com/krupni/yii-eoauth/blob/182bcaaea73c87d90635c2201213273f40cfab26/src/EOAuthUtils.php#L80-L95 |
205,671 | krupni/yii-eoauth | src/EOAuthUtils.php | EOAuthUtils.GetTokenFromUrl | private static function GetTokenFromUrl($url) {
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$response = curl_exec($ch);
$headers = curl_getin... | php | private static function GetTokenFromUrl($url) {
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
$response = curl_exec($ch);
$headers = curl_getin... | [
"private",
"static",
"function",
"GetTokenFromUrl",
"(",
"$",
"url",
")",
"{",
"$",
"ch",
"=",
"curl_init",
"(",
"$",
"url",
")",
";",
"curl_setopt",
"(",
"$",
"ch",
",",
"CURLOPT_FOLLOWLOCATION",
",",
"1",
")",
";",
"curl_setopt",
"(",
"$",
"ch",
",",... | Makes an HTTP request to the given URL and extracts the returned OAuth
token.
@param string $url the URL to make the request to
@return OAuthToken the returned token | [
"Makes",
"an",
"HTTP",
"request",
"to",
"the",
"given",
"URL",
"and",
"extracts",
"the",
"returned",
"OAuth",
"token",
"."
] | 182bcaaea73c87d90635c2201213273f40cfab26 | https://github.com/krupni/yii-eoauth/blob/182bcaaea73c87d90635c2201213273f40cfab26/src/EOAuthUtils.php#L103-L118 |
205,672 | chilimatic/chilimatic-framework | lib/database/sql/mysql/MySQLClone.php | MySQLClone.init | public function init($main_db, $clone_db, $table_list = null)
{
try {
if (empty($main_db) && empty($clone_db)) return false;
if (!$this->select_db((string)$main_db)) {
throw new DatabaseException('Could not select Main Database ' . $main_db);
}
... | php | public function init($main_db, $clone_db, $table_list = null)
{
try {
if (empty($main_db) && empty($clone_db)) return false;
if (!$this->select_db((string)$main_db)) {
throw new DatabaseException('Could not select Main Database ' . $main_db);
}
... | [
"public",
"function",
"init",
"(",
"$",
"main_db",
",",
"$",
"clone_db",
",",
"$",
"table_list",
"=",
"null",
")",
"{",
"try",
"{",
"if",
"(",
"empty",
"(",
"$",
"main_db",
")",
"&&",
"empty",
"(",
"$",
"clone_db",
")",
")",
"return",
"false",
";",... | starts the cloning process
@param $main_db string
@param $clone_db string
@param $table_list array|string
@throws \chilimatic\exception\DatabaseException
@throws \Exception
@return boolean | [
"starts",
"the",
"cloning",
"process"
] | 8df7f12e75d75d3fd2197a58c80d39cbb4b9ff12 | https://github.com/chilimatic/chilimatic-framework/blob/8df7f12e75d75d3fd2197a58c80d39cbb4b9ff12/lib/database/sql/mysql/MySQLClone.php#L77-L129 |
205,673 | chilimatic/chilimatic-framework | lib/database/sql/mysql/MySQLClone.php | MySQLClone.clone_database | public function clone_database($main_db = null, $clone_db = null)
{
if (empty($this->db)) {
throw new DatabaseException('Clone or Main database not connected');
}
if (empty($main_db) || empty($clone_db)) {
throw new DatabaseException('clone names havent been set');
... | php | public function clone_database($main_db = null, $clone_db = null)
{
if (empty($this->db)) {
throw new DatabaseException('Clone or Main database not connected');
}
if (empty($main_db) || empty($clone_db)) {
throw new DatabaseException('clone names havent been set');
... | [
"public",
"function",
"clone_database",
"(",
"$",
"main_db",
"=",
"null",
",",
"$",
"clone_db",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"db",
")",
")",
"{",
"throw",
"new",
"DatabaseException",
"(",
"'Clone or Main database not c... | clones the specific database
@param $main_db string
@param $clone_db string
@return bool
@throws DatabaseException
@throws \Exception | [
"clones",
"the",
"specific",
"database"
] | 8df7f12e75d75d3fd2197a58c80d39cbb4b9ff12 | https://github.com/chilimatic/chilimatic-framework/blob/8df7f12e75d75d3fd2197a58c80d39cbb4b9ff12/lib/database/sql/mysql/MySQLClone.php#L142-L163 |
205,674 | ben-gibson/foursquare-venue-client | src/Factory/Photo/PhotoGroupFactory.php | PhotoGroupFactory.getPhotos | private function getPhotos(Description $description)
{
return array_map(
function (\stdClass $photoDescription) {
return $this->photoFactory->create(new Description($photoDescription));
},
$description->getOptionalProperty('items', [])
);
} | php | private function getPhotos(Description $description)
{
return array_map(
function (\stdClass $photoDescription) {
return $this->photoFactory->create(new Description($photoDescription));
},
$description->getOptionalProperty('items', [])
);
} | [
"private",
"function",
"getPhotos",
"(",
"Description",
"$",
"description",
")",
"{",
"return",
"array_map",
"(",
"function",
"(",
"\\",
"stdClass",
"$",
"photoDescription",
")",
"{",
"return",
"$",
"this",
"->",
"photoFactory",
"->",
"create",
"(",
"new",
"... | Get the venue photos.
@param Description $description The photo group description.
@return Photo[] | [
"Get",
"the",
"venue",
"photos",
"."
] | ce5e7c308f87d5ccc28ab8d27a9cb51bd106d969 | https://github.com/ben-gibson/foursquare-venue-client/blob/ce5e7c308f87d5ccc28ab8d27a9cb51bd106d969/src/Factory/Photo/PhotoGroupFactory.php#L49-L57 |
205,675 | andyburton/Sonic-Framework | src/Message.php | Message.getString | public static function getString ($status = FALSE, $tagStart = NULL, $tagEnd = "\n")
{
// Get messages
$arr = self::get ($status);
// Set message string
$str = '';
foreach ($arr as $msg)
{
$str .= $tagStart . $msg . $tagEnd;
}
// Return message
return $str;
} | php | public static function getString ($status = FALSE, $tagStart = NULL, $tagEnd = "\n")
{
// Get messages
$arr = self::get ($status);
// Set message string
$str = '';
foreach ($arr as $msg)
{
$str .= $tagStart . $msg . $tagEnd;
}
// Return message
return $str;
} | [
"public",
"static",
"function",
"getString",
"(",
"$",
"status",
"=",
"FALSE",
",",
"$",
"tagStart",
"=",
"NULL",
",",
"$",
"tagEnd",
"=",
"\"\\n\"",
")",
"{",
"// Get messages",
"$",
"arr",
"=",
"self",
"::",
"get",
"(",
"$",
"status",
")",
";",
"//... | Return messages as a string
@param mixed $status Message status to return
@param string $tagStart Opening tag for each message
@param string $tagEnd Closing tag for each message
@return string | [
"Return",
"messages",
"as",
"a",
"string"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Message.php#L71-L91 |
205,676 | andyburton/Sonic-Framework | src/Message.php | Message.count | public static function count ($status = FALSE)
{
// If no status return all messages
if ($status === FALSE)
{
return count (self::$messages);
}
// Return messages for a specific status
if (isset (self::$messages[$status]))
{
return count (self::$messages[$status]);
}
else
{
ret... | php | public static function count ($status = FALSE)
{
// If no status return all messages
if ($status === FALSE)
{
return count (self::$messages);
}
// Return messages for a specific status
if (isset (self::$messages[$status]))
{
return count (self::$messages[$status]);
}
else
{
ret... | [
"public",
"static",
"function",
"count",
"(",
"$",
"status",
"=",
"FALSE",
")",
"{",
"// If no status return all messages",
"if",
"(",
"$",
"status",
"===",
"FALSE",
")",
"{",
"return",
"count",
"(",
"self",
"::",
"$",
"messages",
")",
";",
"}",
"// Return... | Return number of messages
@param mixed $status Message status to count
@return integer | [
"Return",
"number",
"of",
"messages"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Message.php#L126-L147 |
205,677 | smartboxgroup/camel-config-bundle | DependencyInjection/FlowsBuilderCompilerPass.php | FlowsBuilderCompilerPass.getBasicDefinition | public function getBasicDefinition($class)
{
if (!class_exists($class)) {
throw new \InvalidArgumentException("$class is not a valid class name");
}
$definition = new Definition($class, []);
$traits = $this->classUsesDeep($class);
foreach ($traits as $trait) {
... | php | public function getBasicDefinition($class)
{
if (!class_exists($class)) {
throw new \InvalidArgumentException("$class is not a valid class name");
}
$definition = new Definition($class, []);
$traits = $this->classUsesDeep($class);
foreach ($traits as $trait) {
... | [
"public",
"function",
"getBasicDefinition",
"(",
"$",
"class",
")",
"{",
"if",
"(",
"!",
"class_exists",
"(",
"$",
"class",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"\"$class is not a valid class name\"",
")",
";",
"}",
"$",
"defin... | Creates a basic service definition for the given class, injecting the typical dependencies according with the
traits the class uses.
@return Definition | [
"Creates",
"a",
"basic",
"service",
"definition",
"for",
"the",
"given",
"class",
"injecting",
"the",
"typical",
"dependencies",
"according",
"with",
"the",
"traits",
"the",
"class",
"uses",
"."
] | f38505c50a446707b8e8f79ecaa1addd0a6cca11 | https://github.com/smartboxgroup/camel-config-bundle/blob/f38505c50a446707b8e8f79ecaa1addd0a6cca11/DependencyInjection/FlowsBuilderCompilerPass.php#L123-L173 |
205,678 | phPoirot/Stream | Filter/aFilterStreamCustom.php | aFilterStreamCustom.getLabel | function getLabel()
{
if ($this->filtername)
return $this->filtername;
$className = explode('\\', get_class($this));
$className = $className[count($className)-1];
return $className.'.*';
} | php | function getLabel()
{
if ($this->filtername)
return $this->filtername;
$className = explode('\\', get_class($this));
$className = $className[count($className)-1];
return $className.'.*';
} | [
"function",
"getLabel",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"filtername",
")",
"return",
"$",
"this",
"->",
"filtername",
";",
"$",
"className",
"=",
"explode",
"(",
"'\\\\'",
",",
"get_class",
"(",
"$",
"this",
")",
")",
";",
"$",
"classNam... | Label Used To Register Our Filter
@return string | [
"Label",
"Used",
"To",
"Register",
"Our",
"Filter"
] | db448ee0528c2a5b07c594b8a30e2543fbc15f57 | https://github.com/phPoirot/Stream/blob/db448ee0528c2a5b07c594b8a30e2543fbc15f57/Filter/aFilterStreamCustom.php#L72-L81 |
205,679 | phPoirot/Stream | Filter/aFilterStreamCustom.php | aFilterStreamCustom._getDataFromBucket | protected function _getDataFromBucket($in, &$consumed)
{
$data = '';
while ($bucket = stream_bucket_make_writeable($in)) {
$data .= $bucket->data;
$consumed += $bucket->datalen;
}
return $data;
} | php | protected function _getDataFromBucket($in, &$consumed)
{
$data = '';
while ($bucket = stream_bucket_make_writeable($in)) {
$data .= $bucket->data;
$consumed += $bucket->datalen;
}
return $data;
} | [
"protected",
"function",
"_getDataFromBucket",
"(",
"$",
"in",
",",
"&",
"$",
"consumed",
")",
"{",
"$",
"data",
"=",
"''",
";",
"while",
"(",
"$",
"bucket",
"=",
"stream_bucket_make_writeable",
"(",
"$",
"in",
")",
")",
"{",
"$",
"data",
".=",
"$",
... | Read Data From Bucket
@param resource $in userfilter.bucket brigade
@param int $consumed
@return string | [
"Read",
"Data",
"From",
"Bucket"
] | db448ee0528c2a5b07c594b8a30e2543fbc15f57 | https://github.com/phPoirot/Stream/blob/db448ee0528c2a5b07c594b8a30e2543fbc15f57/Filter/aFilterStreamCustom.php#L156-L165 |
205,680 | phPoirot/Stream | Filter/aFilterStreamCustom.php | aFilterStreamCustom._writeBackDataOut | protected function _writeBackDataOut($out, $data)
{
$buck = stream_bucket_new($this->bufferHandle, '');
if (false === $buck)
// trigger filter error
return PSFS_ERR_FATAL;
$buck->data = $data;
stream_bucket_append($out, $buck);
// data was processed ... | php | protected function _writeBackDataOut($out, $data)
{
$buck = stream_bucket_new($this->bufferHandle, '');
if (false === $buck)
// trigger filter error
return PSFS_ERR_FATAL;
$buck->data = $data;
stream_bucket_append($out, $buck);
// data was processed ... | [
"protected",
"function",
"_writeBackDataOut",
"(",
"$",
"out",
",",
"$",
"data",
")",
"{",
"$",
"buck",
"=",
"stream_bucket_new",
"(",
"$",
"this",
"->",
"bufferHandle",
",",
"''",
")",
";",
"if",
"(",
"false",
"===",
"$",
"buck",
")",
"// trigger filter... | Write Back Filtered Data On Out Bucket
@param resource $out userfilter.bucket brigade
@param string $data
@return int PSFS_ERR_FATAL|PSFS_PASS_ON | [
"Write",
"Back",
"Filtered",
"Data",
"On",
"Out",
"Bucket"
] | db448ee0528c2a5b07c594b8a30e2543fbc15f57 | https://github.com/phPoirot/Stream/blob/db448ee0528c2a5b07c594b8a30e2543fbc15f57/Filter/aFilterStreamCustom.php#L175-L187 |
205,681 | zikula/FileSystem | Facade/SftpFacade.php | SftpFacade.authPubkey | public function authPubkey($session, $username, $pubkey, $privkey, $passphrase)
{
return ssh2_auth_pubkey_file($session, $username, $pubkey, $privkey, $passphrase);
} | php | public function authPubkey($session, $username, $pubkey, $privkey, $passphrase)
{
return ssh2_auth_pubkey_file($session, $username, $pubkey, $privkey, $passphrase);
} | [
"public",
"function",
"authPubkey",
"(",
"$",
"session",
",",
"$",
"username",
",",
"$",
"pubkey",
",",
"$",
"privkey",
",",
"$",
"passphrase",
")",
"{",
"return",
"ssh2_auth_pubkey_file",
"(",
"$",
"session",
",",
"$",
"username",
",",
"$",
"pubkey",
",... | Facade for ssh2_auth_pubkey_file.
@param resource $session The resource to login to.
@param string $username The username to login with.
@param string $pubkey The path to the public key to use.
@param string $privkey The path to the private key.
@param string $passphrase The passphrase for the key.... | [
"Facade",
"for",
"ssh2_auth_pubkey_file",
"."
] | 8e12d6839aa50a7590f5ad22cc2d33c8f88ff726 | https://github.com/zikula/FileSystem/blob/8e12d6839aa50a7590f5ad22cc2d33c8f88ff726/Facade/SftpFacade.php#L68-L71 |
205,682 | zikula/FileSystem | Facade/SftpFacade.php | SftpFacade.scpSend | public function scpSend($session, $local_file, $remote_file, $create_mode = 0644)
{
return ssh2_scp_send($session, $local_file, $remote_file, $create_mode);
} | php | public function scpSend($session, $local_file, $remote_file, $create_mode = 0644)
{
return ssh2_scp_send($session, $local_file, $remote_file, $create_mode);
} | [
"public",
"function",
"scpSend",
"(",
"$",
"session",
",",
"$",
"local_file",
",",
"$",
"remote_file",
",",
"$",
"create_mode",
"=",
"0644",
")",
"{",
"return",
"ssh2_scp_send",
"(",
"$",
"session",
",",
"$",
"local_file",
",",
"$",
"remote_file",
",",
"... | Facade for ssh2_scp_send.
@param resource $session The sftp resource to use.
@param string $local_file The local file to send.
@param string $remote_file The remote path to write to.
@param int $create_mode The permission of the remote file.
@return boolean True on success. | [
"Facade",
"for",
"ssh2_scp_send",
"."
] | 8e12d6839aa50a7590f5ad22cc2d33c8f88ff726 | https://github.com/zikula/FileSystem/blob/8e12d6839aa50a7590f5ad22cc2d33c8f88ff726/Facade/SftpFacade.php#L110-L113 |
205,683 | keeko/framework | src/foundation/ModuleManager.php | ModuleManager.load | public function load($packageName) {
if ($this->loadedModules->has($packageName)) {
return $this->loadedModules->get($packageName);
}
// check existence
if (!$this->installedModules->has($packageName)) {
throw new ModuleException(sprintf('Module (%s) does not exist.', $packageName), 500);
}
// check... | php | public function load($packageName) {
if ($this->loadedModules->has($packageName)) {
return $this->loadedModules->get($packageName);
}
// check existence
if (!$this->installedModules->has($packageName)) {
throw new ModuleException(sprintf('Module (%s) does not exist.', $packageName), 500);
}
// check... | [
"public",
"function",
"load",
"(",
"$",
"packageName",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"loadedModules",
"->",
"has",
"(",
"$",
"packageName",
")",
")",
"{",
"return",
"$",
"this",
"->",
"loadedModules",
"->",
"get",
"(",
"$",
"packageName",
")"... | Loads a module and returns the associated class or returns if already loaded
@param String $packageName
@throws ModuleException
@return AbstractModule | [
"Loads",
"a",
"module",
"and",
"returns",
"the",
"associated",
"class",
"or",
"returns",
"if",
"already",
"loaded"
] | a2c5d76a4ab7bd658e81d88fb3c98eee115c06ac | https://github.com/keeko/framework/blob/a2c5d76a4ab7bd658e81d88fb3c98eee115c06ac/src/foundation/ModuleManager.php#L126-L160 |
205,684 | prooph/processing | library/Type/String.php | String.buildDescription | public static function buildDescription()
{
if (DescriptionRegistry::hasDescription(__CLASS__)) return DescriptionRegistry::getDescription(__CLASS__);
$desc = new Description('String', NativeType::STRING, false);
DescriptionRegistry::registerDescriptionFor(__CLASS__, $desc);
retur... | php | public static function buildDescription()
{
if (DescriptionRegistry::hasDescription(__CLASS__)) return DescriptionRegistry::getDescription(__CLASS__);
$desc = new Description('String', NativeType::STRING, false);
DescriptionRegistry::registerDescriptionFor(__CLASS__, $desc);
retur... | [
"public",
"static",
"function",
"buildDescription",
"(",
")",
"{",
"if",
"(",
"DescriptionRegistry",
"::",
"hasDescription",
"(",
"__CLASS__",
")",
")",
"return",
"DescriptionRegistry",
"::",
"getDescription",
"(",
"__CLASS__",
")",
";",
"$",
"desc",
"=",
"new",... | The description is cached in the internal description property
Implement the method to build the description only once and only if it is requested
@return Description | [
"The",
"description",
"is",
"cached",
"in",
"the",
"internal",
"description",
"property"
] | a2947bccbffeecc4ca93a15e38ab53814e3e53e5 | https://github.com/prooph/processing/blob/a2947bccbffeecc4ca93a15e38ab53814e3e53e5/library/Type/String.php#L34-L43 |
205,685 | fxpio/fxp-gluon | Block/Type/PanelSectionType.php | PanelSectionType.setLastRow | protected function setLastRow(BlockInterface $block, BlockInterface $row)
{
if (!BlockUtil::isBlockType($row, PanelRowSpacerType::class)) {
$block->setAttribute('last_row', $row->getName());
}
} | php | protected function setLastRow(BlockInterface $block, BlockInterface $row)
{
if (!BlockUtil::isBlockType($row, PanelRowSpacerType::class)) {
$block->setAttribute('last_row', $row->getName());
}
} | [
"protected",
"function",
"setLastRow",
"(",
"BlockInterface",
"$",
"block",
",",
"BlockInterface",
"$",
"row",
")",
"{",
"if",
"(",
"!",
"BlockUtil",
"::",
"isBlockType",
"(",
"$",
"row",
",",
"PanelRowSpacerType",
"::",
"class",
")",
")",
"{",
"$",
"block... | Set the last row.
@param BlockInterface $block
@param BlockInterface $row | [
"Set",
"the",
"last",
"row",
"."
] | 0548b7d598ef4b0785b5df3b849a10f439b2dc65 | https://github.com/fxpio/fxp-gluon/blob/0548b7d598ef4b0785b5df3b849a10f439b2dc65/Block/Type/PanelSectionType.php#L218-L223 |
205,686 | fxpio/fxp-gluon | Block/Type/PanelSectionType.php | PanelSectionType.getLastRow | protected function getLastRow(BlockInterface $block)
{
if ($block->hasAttribute('last_row')) {
$row = $block->get($block->getAttribute('last_row'));
// return current row
if (\count($row) < $row->getOption('column')) {
return $row;
}
}... | php | protected function getLastRow(BlockInterface $block)
{
if ($block->hasAttribute('last_row')) {
$row = $block->get($block->getAttribute('last_row'));
// return current row
if (\count($row) < $row->getOption('column')) {
return $row;
}
}... | [
"protected",
"function",
"getLastRow",
"(",
"BlockInterface",
"$",
"block",
")",
"{",
"if",
"(",
"$",
"block",
"->",
"hasAttribute",
"(",
"'last_row'",
")",
")",
"{",
"$",
"row",
"=",
"$",
"block",
"->",
"get",
"(",
"$",
"block",
"->",
"getAttribute",
... | Get the last row.
@param BlockInterface $block
@return BlockInterface | [
"Get",
"the",
"last",
"row",
"."
] | 0548b7d598ef4b0785b5df3b849a10f439b2dc65 | https://github.com/fxpio/fxp-gluon/blob/0548b7d598ef4b0785b5df3b849a10f439b2dc65/Block/Type/PanelSectionType.php#L232-L248 |
205,687 | ajaxtown/eaglehorn_framework | src/Eaglehorn/Router.php | Router.execute | static function execute(Base $base)
{
self::$_base = $base;
//first we separate the parameters
$request = isset($_REQUEST['route']) ? $_REQUEST['route'] : '/';
if(strpos($request,'?') > 0) {
$split = explode('?',$request);
$request = $split[0];
}
... | php | static function execute(Base $base)
{
self::$_base = $base;
//first we separate the parameters
$request = isset($_REQUEST['route']) ? $_REQUEST['route'] : '/';
if(strpos($request,'?') > 0) {
$split = explode('?',$request);
$request = $split[0];
}
... | [
"static",
"function",
"execute",
"(",
"Base",
"$",
"base",
")",
"{",
"self",
"::",
"$",
"_base",
"=",
"$",
"base",
";",
"//first we separate the parameters",
"$",
"request",
"=",
"isset",
"(",
"$",
"_REQUEST",
"[",
"'route'",
"]",
")",
"?",
"$",
"_REQUES... | Executes the router
@return mixed | [
"Executes",
"the",
"router"
] | 5e2a1456ff6c65b3925f1219f115d8a919930f52 | https://github.com/ajaxtown/eaglehorn_framework/blob/5e2a1456ff6c65b3925f1219f115d8a919930f52/src/Eaglehorn/Router.php#L59-L76 |
205,688 | ajaxtown/eaglehorn_framework | src/Eaglehorn/Router.php | Router._run | private static function _run($request)
{
// Whether or not we have matched the URL to a route
$matched_route = false;
$request = '/' . $request;
//make sure the request has a trailing slash
$request = rtrim($request, '/') . '/';
$request = str_replace("//","/",$req... | php | private static function _run($request)
{
// Whether or not we have matched the URL to a route
$matched_route = false;
$request = '/' . $request;
//make sure the request has a trailing slash
$request = rtrim($request, '/') . '/';
$request = str_replace("//","/",$req... | [
"private",
"static",
"function",
"_run",
"(",
"$",
"request",
")",
"{",
"// Whether or not we have matched the URL to a route",
"$",
"matched_route",
"=",
"false",
";",
"$",
"request",
"=",
"'/'",
".",
"$",
"request",
";",
"//make sure the request has a trailing slash",... | Tries to match one of the URL routes to the current URL, otherwise
execute the default function.
Sets the callback that needs to be returned
@param string $request | [
"Tries",
"to",
"match",
"one",
"of",
"the",
"URL",
"routes",
"to",
"the",
"current",
"URL",
"otherwise",
"execute",
"the",
"default",
"function",
".",
"Sets",
"the",
"callback",
"that",
"needs",
"to",
"be",
"returned"
] | 5e2a1456ff6c65b3925f1219f115d8a919930f52 | https://github.com/ajaxtown/eaglehorn_framework/blob/5e2a1456ff6c65b3925f1219f115d8a919930f52/src/Eaglehorn/Router.php#L86-L129 |
205,689 | ajaxtown/eaglehorn_framework | src/Eaglehorn/Router.php | Router._set_callback | private static function _set_callback($destination)
{
if(is_callable($destination))
{
self::$callback = array($destination,self::$_attr);
}
else
{
$result = explode('/', trim($destination, '/'));
//fix the controller now
$contr... | php | private static function _set_callback($destination)
{
if(is_callable($destination))
{
self::$callback = array($destination,self::$_attr);
}
else
{
$result = explode('/', trim($destination, '/'));
//fix the controller now
$contr... | [
"private",
"static",
"function",
"_set_callback",
"(",
"$",
"destination",
")",
"{",
"if",
"(",
"is_callable",
"(",
"$",
"destination",
")",
")",
"{",
"self",
"::",
"$",
"callback",
"=",
"array",
"(",
"$",
"destination",
",",
"self",
"::",
"$",
"_attr",
... | Sets the callback as an array containing Controller, Method & Parameters
@param string $destination | [
"Sets",
"the",
"callback",
"as",
"an",
"array",
"containing",
"Controller",
"Method",
"&",
"Parameters"
] | 5e2a1456ff6c65b3925f1219f115d8a919930f52 | https://github.com/ajaxtown/eaglehorn_framework/blob/5e2a1456ff6c65b3925f1219f115d8a919930f52/src/Eaglehorn/Router.php#L136-L166 |
205,690 | phPoirot/Client-OAuth2 | src/Grant/aGrantRequest.php | aGrantRequest.__toArray | function __toArray()
{
$params = __( new HydrateGetters($this) )
->setExcludeNullValues();
$params = StdTravers::of($params)->toArray(null, true);
return $params;
} | php | function __toArray()
{
$params = __( new HydrateGetters($this) )
->setExcludeNullValues();
$params = StdTravers::of($params)->toArray(null, true);
return $params;
} | [
"function",
"__toArray",
"(",
")",
"{",
"$",
"params",
"=",
"__",
"(",
"new",
"HydrateGetters",
"(",
"$",
"this",
")",
")",
"->",
"setExcludeNullValues",
"(",
")",
";",
"$",
"params",
"=",
"StdTravers",
"::",
"of",
"(",
"$",
"params",
")",
"->",
"toA... | Get Grant Request Params As Array
@return array | [
"Get",
"Grant",
"Request",
"Params",
"As",
"Array"
] | 8745fd54afbbb185669b9e38b1241ecc8ffc7268 | https://github.com/phPoirot/Client-OAuth2/blob/8745fd54afbbb185669b9e38b1241ecc8ffc7268/src/Grant/aGrantRequest.php#L33-L40 |
205,691 | inhere/php-library-plus | libs/Task/Handlers/Task.php | Task.run | public function run($workload, TaskWrapper $task)
{
$result = false;
$this->id = $task->getId();
$this->name = $task->getName();
try {
if (false !== $this->beforeRun($workload, $task)) {
$result = $this->doRun($workload, $task);
$this->af... | php | public function run($workload, TaskWrapper $task)
{
$result = false;
$this->id = $task->getId();
$this->name = $task->getName();
try {
if (false !== $this->beforeRun($workload, $task)) {
$result = $this->doRun($workload, $task);
$this->af... | [
"public",
"function",
"run",
"(",
"$",
"workload",
",",
"TaskWrapper",
"$",
"task",
")",
"{",
"$",
"result",
"=",
"false",
";",
"$",
"this",
"->",
"id",
"=",
"$",
"task",
"->",
"getId",
"(",
")",
";",
"$",
"this",
"->",
"name",
"=",
"$",
"task",
... | do the job
@param string $workload
@param TaskWrapper $task
@return mixed | [
"do",
"the",
"job"
] | 8604e037937d31fa2338d79aaf9d0910cb48f559 | https://github.com/inhere/php-library-plus/blob/8604e037937d31fa2338d79aaf9d0910cb48f559/libs/Task/Handlers/Task.php#L48-L65 |
205,692 | schpill/thin | src/Filter/Normalize.php | Normalize.filter | public function filter($value)
{
// transliteration
$value = strtr($value, $this->transliteration);
// change to lowercase
if($this->transformCase) {
$value = mb_convert_case($value, MB_CASE_LOWER, 'utf8');
}
// replace pu... | php | public function filter($value)
{
// transliteration
$value = strtr($value, $this->transliteration);
// change to lowercase
if($this->transformCase) {
$value = mb_convert_case($value, MB_CASE_LOWER, 'utf8');
}
// replace pu... | [
"public",
"function",
"filter",
"(",
"$",
"value",
")",
"{",
"// transliteration",
"$",
"value",
"=",
"strtr",
"(",
"$",
"value",
",",
"$",
"this",
"->",
"transliteration",
")",
";",
"// change to lowercase",
"if",
"(",
"$",
"this",
"->",
"transformCase",
... | Normalise the input string
@param string $value String to be normalised
@return string Normalised string | [
"Normalise",
"the",
"input",
"string"
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Filter/Normalize.php#L115-L131 |
205,693 | schpill/thin | src/Filter/Normalize.php | Normalize.setTransliterationReplacements | public function setTransliterationReplacements($replacements)
{
if(!is_array($replacements)) {
throw new \Thin\Exception(__METHOD__ . ': method expects a keyed array as argument.', 500);
}
foreach($replacements as $key => $value) {
$this->trans... | php | public function setTransliterationReplacements($replacements)
{
if(!is_array($replacements)) {
throw new \Thin\Exception(__METHOD__ . ': method expects a keyed array as argument.', 500);
}
foreach($replacements as $key => $value) {
$this->trans... | [
"public",
"function",
"setTransliterationReplacements",
"(",
"$",
"replacements",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"replacements",
")",
")",
"{",
"throw",
"new",
"\\",
"Thin",
"\\",
"Exception",
"(",
"__METHOD__",
".",
"': method expects a keyed a... | Set transliteration replacement values.
@param array $replacements A keyed array of characters to replace, e.g. ['Å' => 'L'];
@return \Thin\Filter\Normalise Provides a fluent interface
@throws \Thin\Exception in case the argument is not an array. | [
"Set",
"transliteration",
"replacement",
"values",
"."
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Filter/Normalize.php#L174-L183 |
205,694 | schpill/thin | src/Filter/Normalize.php | Normalize.setPunctuationReplacements | public function setPunctuationReplacements($replacements)
{
if(!is_array($replacements)) {
throw new \Thin\Exception(__METHOD__ . ': method expects a keyed array as argument.', 500);
}
foreach($replacements as $key => $value) {
$this->punctuati... | php | public function setPunctuationReplacements($replacements)
{
if(!is_array($replacements)) {
throw new \Thin\Exception(__METHOD__ . ': method expects a keyed array as argument.', 500);
}
foreach($replacements as $key => $value) {
$this->punctuati... | [
"public",
"function",
"setPunctuationReplacements",
"(",
"$",
"replacements",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"replacements",
")",
")",
"{",
"throw",
"new",
"\\",
"Thin",
"\\",
"Exception",
"(",
"__METHOD__",
".",
"': method expects a keyed array... | Set punctuation replacement values.
@param array $replacements A keyed array of characters to replace, e.g. [' ' => '_'];
@return \Thin\Filter\Normalise Provides a fluent interface
@throws \Thin\Exception in case the argument is not an array. | [
"Set",
"punctuation",
"replacement",
"values",
"."
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Filter/Normalize.php#L196-L205 |
205,695 | rkeet/zf-doctrine-mvc | src/Entity/AbstractEntity.php | AbstractEntity.getArrayCopy | public function getArrayCopy() : array
{
$values = get_object_vars($this);
foreach ($values as $property => $value) {
// Skip relations
if (is_object($value)) {
unset($values[$property]);
}
}
return $values;
} | php | public function getArrayCopy() : array
{
$values = get_object_vars($this);
foreach ($values as $property => $value) {
// Skip relations
if (is_object($value)) {
unset($values[$property]);
}
}
return $values;
} | [
"public",
"function",
"getArrayCopy",
"(",
")",
":",
"array",
"{",
"$",
"values",
"=",
"get_object_vars",
"(",
"$",
"this",
")",
";",
"foreach",
"(",
"$",
"values",
"as",
"$",
"property",
"=>",
"$",
"value",
")",
"{",
"// Skip relations",
"if",
"(",
"i... | Gets an array copy | [
"Gets",
"an",
"array",
"copy"
] | ec5fb19e453824383b39570d15bd77b85cec3ca1 | https://github.com/rkeet/zf-doctrine-mvc/blob/ec5fb19e453824383b39570d15bd77b85cec3ca1/src/Entity/AbstractEntity.php#L144-L155 |
205,696 | rkeet/zf-doctrine-mvc | src/Entity/AbstractEntity.php | AbstractEntity.exchangeArray | public function exchangeArray($data)
{
foreach ($data as $property => $value) {
if (isset($this->$property)) {
$method = 'set' . ucfirst($property);
$this->$method($value);
}
}
} | php | public function exchangeArray($data)
{
foreach ($data as $property => $value) {
if (isset($this->$property)) {
$method = 'set' . ucfirst($property);
$this->$method($value);
}
}
} | [
"public",
"function",
"exchangeArray",
"(",
"$",
"data",
")",
"{",
"foreach",
"(",
"$",
"data",
"as",
"$",
"property",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"$",
"property",
")",
")",
"{",
"$",
"method",
"=",
"... | Maps the specified data to the properties of this object
@param array $data | [
"Maps",
"the",
"specified",
"data",
"to",
"the",
"properties",
"of",
"this",
"object"
] | ec5fb19e453824383b39570d15bd77b85cec3ca1 | https://github.com/rkeet/zf-doctrine-mvc/blob/ec5fb19e453824383b39570d15bd77b85cec3ca1/src/Entity/AbstractEntity.php#L162-L170 |
205,697 | andyburton/Sonic-Framework | src/Controller/Session.php | Session.callAction | public function callAction ()
{
// Only call the method if the user is authenticated
if ($this->checkAuthenticated ())
{
$this->view->assign ('user', $this->user);
parent::callAction ();
}
} | php | public function callAction ()
{
// Only call the method if the user is authenticated
if ($this->checkAuthenticated ())
{
$this->view->assign ('user', $this->user);
parent::callAction ();
}
} | [
"public",
"function",
"callAction",
"(",
")",
"{",
"// Only call the method if the user is authenticated",
"if",
"(",
"$",
"this",
"->",
"checkAuthenticated",
"(",
")",
")",
"{",
"$",
"this",
"->",
"view",
"->",
"assign",
"(",
"'user'",
",",
"$",
"this",
"->",... | Call controller action method
@return void | [
"Call",
"controller",
"action",
"method"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Controller/Session.php#L36-L47 |
205,698 | ezsystems/ezprestapiprovider | classes/models/rest_content_model.php | ezpRestContentModel.getMetadataByContent | public static function getMetadataByContent( ezpContent $content )
{
$aMetadata = array(
'objectName' => $content->name,
'classIdentifier' => $content->classIdentifier,
'datePublished' => (int)$content->datePublished,
'dateModified' ... | php | public static function getMetadataByContent( ezpContent $content )
{
$aMetadata = array(
'objectName' => $content->name,
'classIdentifier' => $content->classIdentifier,
'datePublished' => (int)$content->datePublished,
'dateModified' ... | [
"public",
"static",
"function",
"getMetadataByContent",
"(",
"ezpContent",
"$",
"content",
")",
"{",
"$",
"aMetadata",
"=",
"array",
"(",
"'objectName'",
"=>",
"$",
"content",
"->",
"name",
",",
"'classIdentifier'",
"=>",
"$",
"content",
"->",
"classIdentifier",... | Returns metadata for given content as array
@param ezpContent $content
@return array | [
"Returns",
"metadata",
"for",
"given",
"content",
"as",
"array"
] | 98012d22225fca242fa6b87cd7c71bf912ca8cbd | https://github.com/ezsystems/ezprestapiprovider/blob/98012d22225fca242fa6b87cd7c71bf912ca8cbd/classes/models/rest_content_model.php#L19-L31 |
205,699 | ezsystems/ezprestapiprovider | classes/models/rest_content_model.php | ezpRestContentModel.getMetadataByLocation | public static function getMetadataByLocation( ezpContentLocation $location )
{
$url = $location->url_alias;
eZURI::transformURI( $url, false, 'full' ); // $url is passed as a reference
$aMetadata = array(
'nodeId' => (int)$location->node_id,
'nodeRemoteId' =>... | php | public static function getMetadataByLocation( ezpContentLocation $location )
{
$url = $location->url_alias;
eZURI::transformURI( $url, false, 'full' ); // $url is passed as a reference
$aMetadata = array(
'nodeId' => (int)$location->node_id,
'nodeRemoteId' =>... | [
"public",
"static",
"function",
"getMetadataByLocation",
"(",
"ezpContentLocation",
"$",
"location",
")",
"{",
"$",
"url",
"=",
"$",
"location",
"->",
"url_alias",
";",
"eZURI",
"::",
"transformURI",
"(",
"$",
"url",
",",
"false",
",",
"'full'",
")",
";",
... | Returns metadata for given content location as array
@param ezpContentLocation $location
@return array | [
"Returns",
"metadata",
"for",
"given",
"content",
"location",
"as",
"array"
] | 98012d22225fca242fa6b87cd7c71bf912ca8cbd | https://github.com/ezsystems/ezprestapiprovider/blob/98012d22225fca242fa6b87cd7c71bf912ca8cbd/classes/models/rest_content_model.php#L38-L50 |
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.