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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
36,000 | honey-comb/starter | src/Providers/HCBaseServiceProvider.php | HCBaseServiceProvider.loadRoutes | protected function loadRoutes(Router $router): void
{
foreach ($this->getRoutes() as $route) {
$router->namespace($this->namespace)
->group($route);
}
} | php | protected function loadRoutes(Router $router): void
{
foreach ($this->getRoutes() as $route) {
$router->namespace($this->namespace)
->group($route);
}
} | [
"protected",
"function",
"loadRoutes",
"(",
"Router",
"$",
"router",
")",
":",
"void",
"{",
"foreach",
"(",
"$",
"this",
"->",
"getRoutes",
"(",
")",
"as",
"$",
"route",
")",
"{",
"$",
"router",
"->",
"namespace",
"(",
"$",
"this",
"->",
"namespace",
... | Load package routes
@param Router $router | [
"Load",
"package",
"routes"
] | 2c5330a49eb5204a6b748368aca835b7ecb02393 | https://github.com/honey-comb/starter/blob/2c5330a49eb5204a6b748368aca835b7ecb02393/src/Providers/HCBaseServiceProvider.php#L99-L105 |
36,001 | honey-comb/starter | src/Http/Controllers/HCFormManagerController.php | HCFormManagerController.getStructure | public function getStructure(string $key, string $type = null): JsonResponse
{
try {
$form = $this->formManager->getForm($key, $type);
} catch (HCException $exception) {
return $this->response->error($exception->getMessage());
}
return $this->response->succes... | php | public function getStructure(string $key, string $type = null): JsonResponse
{
try {
$form = $this->formManager->getForm($key, $type);
} catch (HCException $exception) {
return $this->response->error($exception->getMessage());
}
return $this->response->succes... | [
"public",
"function",
"getStructure",
"(",
"string",
"$",
"key",
",",
"string",
"$",
"type",
"=",
"null",
")",
":",
"JsonResponse",
"{",
"try",
"{",
"$",
"form",
"=",
"$",
"this",
"->",
"formManager",
"->",
"getForm",
"(",
"$",
"key",
",",
"$",
"type... | Get form structure as json object
@param string $key
@param string|null $type
@return JsonResponse
@throws \Illuminate\Contracts\Container\BindingResolutionException
@throws \ReflectionException | [
"Get",
"form",
"structure",
"as",
"json",
"object"
] | 2c5330a49eb5204a6b748368aca835b7ecb02393 | https://github.com/honey-comb/starter/blob/2c5330a49eb5204a6b748368aca835b7ecb02393/src/Http/Controllers/HCFormManagerController.php#L75-L84 |
36,002 | CMProductions/http-client | src/Client/Traits/ClientTrait.php | ClientTrait.send | public function send(Request $request)
{
$this->logger()->debug('Sending request. {request}', [
'request' => $request,
]);
$response = $this->sendOrRetry($request, $request->getRetries());
$this->logger()->debug('Response received. {response}', [
'request' ... | php | public function send(Request $request)
{
$this->logger()->debug('Sending request. {request}', [
'request' => $request,
]);
$response = $this->sendOrRetry($request, $request->getRetries());
$this->logger()->debug('Response received. {response}', [
'request' ... | [
"public",
"function",
"send",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"this",
"->",
"logger",
"(",
")",
"->",
"debug",
"(",
"'Sending request. {request}'",
",",
"[",
"'request'",
"=>",
"$",
"request",
",",
"]",
")",
";",
"$",
"response",
"=",
"$... | Executes a request returning back the response
@param Request $request
@return Response
@throws RequestExecutionException
@throws RuntimeException | [
"Executes",
"a",
"request",
"returning",
"back",
"the",
"response"
] | d7e5a74cdf94b6b50a229db6698c81fd055ff2ce | https://github.com/CMProductions/http-client/blob/d7e5a74cdf94b6b50a229db6698c81fd055ff2ce/src/Client/Traits/ClientTrait.php#L39-L53 |
36,003 | Orbitale/DoctrineTools | EntityRepositoryHelperTrait.php | EntityRepositoryHelperTrait.findAllRoot | public function findAllRoot($indexBy = null): iterable
{
$this->checkRepository();
$data = $this->createQueryBuilder('object')
->getQuery()
->getResult()
;
if ($data && $indexBy) {
$data = $this->sortCollection($data, $indexBy);
}
... | php | public function findAllRoot($indexBy = null): iterable
{
$this->checkRepository();
$data = $this->createQueryBuilder('object')
->getQuery()
->getResult()
;
if ($data && $indexBy) {
$data = $this->sortCollection($data, $indexBy);
}
... | [
"public",
"function",
"findAllRoot",
"(",
"$",
"indexBy",
"=",
"null",
")",
":",
"iterable",
"{",
"$",
"this",
"->",
"checkRepository",
"(",
")",
";",
"$",
"data",
"=",
"$",
"this",
"->",
"createQueryBuilder",
"(",
"'object'",
")",
"->",
"getQuery",
"(",... | Finds all objects and retrieve only "root" objects, without their associated relatives.
This prevends potential "fetch=EAGER" to be thrown. | [
"Finds",
"all",
"objects",
"and",
"retrieve",
"only",
"root",
"objects",
"without",
"their",
"associated",
"relatives",
".",
"This",
"prevends",
"potential",
"fetch",
"=",
"EAGER",
"to",
"be",
"thrown",
"."
] | 517a321786073a9bc935bb0cb3014df4bb25dade | https://github.com/Orbitale/DoctrineTools/blob/517a321786073a9bc935bb0cb3014df4bb25dade/EntityRepositoryHelperTrait.php#L34-L48 |
36,004 | Orbitale/DoctrineTools | EntityRepositoryHelperTrait.php | EntityRepositoryHelperTrait.findAllArray | public function findAllArray($indexBy = null): array
{
$this->checkRepository();
$data = $this->createQueryBuilder('object', $indexBy)->getQuery()->getArrayResult();
if ($data && $indexBy) {
$data = $this->sortCollection($data, $indexBy);
}
return $data;
} | php | public function findAllArray($indexBy = null): array
{
$this->checkRepository();
$data = $this->createQueryBuilder('object', $indexBy)->getQuery()->getArrayResult();
if ($data && $indexBy) {
$data = $this->sortCollection($data, $indexBy);
}
return $data;
} | [
"public",
"function",
"findAllArray",
"(",
"$",
"indexBy",
"=",
"null",
")",
":",
"array",
"{",
"$",
"this",
"->",
"checkRepository",
"(",
")",
";",
"$",
"data",
"=",
"$",
"this",
"->",
"createQueryBuilder",
"(",
"'object'",
",",
"$",
"indexBy",
")",
"... | Finds all objects and fetches them as array. | [
"Finds",
"all",
"objects",
"and",
"fetches",
"them",
"as",
"array",
"."
] | 517a321786073a9bc935bb0cb3014df4bb25dade | https://github.com/Orbitale/DoctrineTools/blob/517a321786073a9bc935bb0cb3014df4bb25dade/EntityRepositoryHelperTrait.php#L53-L64 |
36,005 | Orbitale/DoctrineTools | EntityRepositoryHelperTrait.php | EntityRepositoryHelperTrait.getNumberOfElements | public function getNumberOfElements(): ?int
{
$this->checkRepository();
return $this->_em->createQueryBuilder()
->select('count(a)')
->from($this->getEntityName(), 'a')
->getQuery()
->getSingleScalarResult()
;
} | php | public function getNumberOfElements(): ?int
{
$this->checkRepository();
return $this->_em->createQueryBuilder()
->select('count(a)')
->from($this->getEntityName(), 'a')
->getQuery()
->getSingleScalarResult()
;
} | [
"public",
"function",
"getNumberOfElements",
"(",
")",
":",
"?",
"int",
"{",
"$",
"this",
"->",
"checkRepository",
"(",
")",
";",
"return",
"$",
"this",
"->",
"_em",
"->",
"createQueryBuilder",
"(",
")",
"->",
"select",
"(",
"'count(a)'",
")",
"->",
"fro... | Gets total number of elements in the table. | [
"Gets",
"total",
"number",
"of",
"elements",
"in",
"the",
"table",
"."
] | 517a321786073a9bc935bb0cb3014df4bb25dade | https://github.com/Orbitale/DoctrineTools/blob/517a321786073a9bc935bb0cb3014df4bb25dade/EntityRepositoryHelperTrait.php#L125-L135 |
36,006 | Orbitale/DoctrineTools | EntityRepositoryHelperTrait.php | EntityRepositoryHelperTrait.sortCollection | public function sortCollection(iterable $collection, $indexBy = null): iterable
{
$this->checkRepository();
$finalCollection = [];
$currentObject = current($collection);
$accessor = class_exists('Symfony\Component\PropertyAccess\PropertyAccess') ? PropertyAccess::createProp... | php | public function sortCollection(iterable $collection, $indexBy = null): iterable
{
$this->checkRepository();
$finalCollection = [];
$currentObject = current($collection);
$accessor = class_exists('Symfony\Component\PropertyAccess\PropertyAccess') ? PropertyAccess::createProp... | [
"public",
"function",
"sortCollection",
"(",
"iterable",
"$",
"collection",
",",
"$",
"indexBy",
"=",
"null",
")",
":",
"iterable",
"{",
"$",
"this",
"->",
"checkRepository",
"(",
")",
";",
"$",
"finalCollection",
"=",
"[",
"]",
";",
"$",
"currentObject",
... | Sorts a collection by a specific key, usually the primary key one,
but you can specify any key.
For "cleanest" uses, you'd better use a primary or unique key. | [
"Sorts",
"a",
"collection",
"by",
"a",
"specific",
"key",
"usually",
"the",
"primary",
"key",
"one",
"but",
"you",
"can",
"specify",
"any",
"key",
".",
"For",
"cleanest",
"uses",
"you",
"d",
"better",
"use",
"a",
"primary",
"or",
"unique",
"key",
"."
] | 517a321786073a9bc935bb0cb3014df4bb25dade | https://github.com/Orbitale/DoctrineTools/blob/517a321786073a9bc935bb0cb3014df4bb25dade/EntityRepositoryHelperTrait.php#L142-L177 |
36,007 | edmondscommerce/phpqa | src/PHPUnit/CheckAnnotations.php | CheckAnnotations.main | public function main(string $pathToTestsDirectory): array
{
if (!is_dir($pathToTestsDirectory)) {
throw new \InvalidArgumentException(
'$pathToTestsDirectory "' . $pathToTestsDirectory . '" does not exist"'
);
}
$this->largePath = $pathToTestsDirector... | php | public function main(string $pathToTestsDirectory): array
{
if (!is_dir($pathToTestsDirectory)) {
throw new \InvalidArgumentException(
'$pathToTestsDirectory "' . $pathToTestsDirectory . '" does not exist"'
);
}
$this->largePath = $pathToTestsDirector... | [
"public",
"function",
"main",
"(",
"string",
"$",
"pathToTestsDirectory",
")",
":",
"array",
"{",
"if",
"(",
"!",
"is_dir",
"(",
"$",
"pathToTestsDirectory",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'$pathToTestsDirectory \"'",
".",... | Check the Large and Medium directories, if they exist, and then assert that all tests have the correct annotation
@param string $pathToTestsDirectory
@return array of errors | [
"Check",
"the",
"Large",
"and",
"Medium",
"directories",
"if",
"they",
"exist",
"and",
"then",
"assert",
"that",
"all",
"tests",
"have",
"the",
"correct",
"annotation"
] | fdcaa19f7505d16f7c751991cc2e4d113891be91 | https://github.com/edmondscommerce/phpqa/blob/fdcaa19f7505d16f7c751991cc2e4d113891be91/src/PHPUnit/CheckAnnotations.php#L42-L57 |
36,008 | matthewbdaly/proper | src/Traits/IsCollection.php | IsCollection.groupBy | public function groupBy(string $key)
{
$items = [];
foreach ($this->items as $item) {
$items[$item[$key]][] = $item;
}
return new static($items);
} | php | public function groupBy(string $key)
{
$items = [];
foreach ($this->items as $item) {
$items[$item[$key]][] = $item;
}
return new static($items);
} | [
"public",
"function",
"groupBy",
"(",
"string",
"$",
"key",
")",
"{",
"$",
"items",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"items",
"as",
"$",
"item",
")",
"{",
"$",
"items",
"[",
"$",
"item",
"[",
"$",
"key",
"]",
"]",
"[",
"... | Group by a given key
@param string $key Key to group by.
@return Collectable | [
"Group",
"by",
"a",
"given",
"key"
] | dac8d6f9ff245b189c57139b79b9dd08cb13bfdd | https://github.com/matthewbdaly/proper/blob/dac8d6f9ff245b189c57139b79b9dd08cb13bfdd/src/Traits/IsCollection.php#L378-L385 |
36,009 | br-monteiro/htr-core | src/Common/Json.php | Json.decode | public static function decode(string $value)
{
$stdObject = json_decode($value);
// catch error if it occurs
self::catchError();
if (self::getError()) {
return self::getError();
}
return $stdObject;
} | php | public static function decode(string $value)
{
$stdObject = json_decode($value);
// catch error if it occurs
self::catchError();
if (self::getError()) {
return self::getError();
}
return $stdObject;
} | [
"public",
"static",
"function",
"decode",
"(",
"string",
"$",
"value",
")",
"{",
"$",
"stdObject",
"=",
"json_decode",
"(",
"$",
"value",
")",
";",
"// catch error if it occurs",
"self",
"::",
"catchError",
"(",
")",
";",
"if",
"(",
"self",
"::",
"getError... | Decode the JSON string to \stdClass
@author Edson B S Monteiro <bruno.monteirodg@gmail.com>
@since 1.0
@param string $value
@return \stdClass|string | [
"Decode",
"the",
"JSON",
"string",
"to",
"\\",
"stdClass"
] | 04c85684e9317fdc52c47aacb357661b4939fb4b | https://github.com/br-monteiro/htr-core/blob/04c85684e9317fdc52c47aacb357661b4939fb4b/src/Common/Json.php#L52-L63 |
36,010 | br-monteiro/htr-core | src/Common/Json.php | Json.catchError | private static function catchError()
{
switch (json_last_error()) {
case JSON_ERROR_NONE:
self::$error = false;
break;
case JSON_ERROR_DEPTH:
self::$error = 'Maximum stack depth exceeded';
break;
case JSON_ER... | php | private static function catchError()
{
switch (json_last_error()) {
case JSON_ERROR_NONE:
self::$error = false;
break;
case JSON_ERROR_DEPTH:
self::$error = 'Maximum stack depth exceeded';
break;
case JSON_ER... | [
"private",
"static",
"function",
"catchError",
"(",
")",
"{",
"switch",
"(",
"json_last_error",
"(",
")",
")",
"{",
"case",
"JSON_ERROR_NONE",
":",
"self",
"::",
"$",
"error",
"=",
"false",
";",
"break",
";",
"case",
"JSON_ERROR_DEPTH",
":",
"self",
"::",
... | Catch error if it occurs
@author Edson B S Monteiro <bruno.monteirodg@gmail.com>
@since 1.0 | [
"Catch",
"error",
"if",
"it",
"occurs"
] | 04c85684e9317fdc52c47aacb357661b4939fb4b | https://github.com/br-monteiro/htr-core/blob/04c85684e9317fdc52c47aacb357661b4939fb4b/src/Common/Json.php#L83-L108 |
36,011 | br-monteiro/htr-core | src/Common/Json.php | Json.validate | public static function validate($data, string $fileSchema): bool
{
/**
* Throw an \Exception in case if there's no file or is unreadable
*/
if (!file_exists($fileSchema) || !is_readable($fileSchema)) {
throw new \Exception("The file {$fileSchema} not exists or is not re... | php | public static function validate($data, string $fileSchema): bool
{
/**
* Throw an \Exception in case if there's no file or is unreadable
*/
if (!file_exists($fileSchema) || !is_readable($fileSchema)) {
throw new \Exception("The file {$fileSchema} not exists or is not re... | [
"public",
"static",
"function",
"validate",
"(",
"$",
"data",
",",
"string",
"$",
"fileSchema",
")",
":",
"bool",
"{",
"/**\n * Throw an \\Exception in case if there's no file or is unreadable\n */",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"fileSchema",
... | Check if the data is according JSON Schema
@author Edson B S Monteiro <bruno.monteirodg@gmail.com>
@since 1.0
@param \stdClass|array $data
@param string $fileSchema
@return bool
@throws \Exception | [
"Check",
"if",
"the",
"data",
"is",
"according",
"JSON",
"Schema"
] | 04c85684e9317fdc52c47aacb357661b4939fb4b | https://github.com/br-monteiro/htr-core/blob/04c85684e9317fdc52c47aacb357661b4939fb4b/src/Common/Json.php#L120-L134 |
36,012 | stubbles/stubbles-console | src/main/php/input/RequestParser.php | RequestParser.parseInto | public function parseInto($object, string $group = null)
{
if ($this->request->hasParam('h') || $this->request->hasParam('help')) {
throw new HelpScreen(
$this->request->readEnv('SCRIPT_NAME')->unsecure(),
$object,
$group
);... | php | public function parseInto($object, string $group = null)
{
if ($this->request->hasParam('h') || $this->request->hasParam('help')) {
throw new HelpScreen(
$this->request->readEnv('SCRIPT_NAME')->unsecure(),
$object,
$group
);... | [
"public",
"function",
"parseInto",
"(",
"$",
"object",
",",
"string",
"$",
"group",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"request",
"->",
"hasParam",
"(",
"'h'",
")",
"||",
"$",
"this",
"->",
"request",
"->",
"hasParam",
"(",
"'help'"... | parses request data into given object
Prints help for given object when -h or --help param is set.
@param object $object
@param string $group restrict parsing to given group
@return object
@throws \stubbles\console\input\HelpScreen
@throws \stubbles\console\input\InvalidOptionValue | [
"parses",
"request",
"data",
"into",
"given",
"object"
] | 9b8d8e0d92e3c6b629a0fa860ace957016d20047 | https://github.com/stubbles/stubbles-console/blob/9b8d8e0d92e3c6b629a0fa860ace957016d20047/src/main/php/input/RequestParser.php#L82-L105 |
36,013 | br-monteiro/htr-core | src/Database/AdapterResults.php | AdapterResults.makeObject | private static function makeObject($entity)
{
$methodsGet = get_class_methods($entity);
$methodsGet = array_filter($methodsGet, function($value) {
return (bool) preg_match('/^get.*$/', $value);
});
$std = new \stdClass();
foreach ($methodsGet as $attribute) {
... | php | private static function makeObject($entity)
{
$methodsGet = get_class_methods($entity);
$methodsGet = array_filter($methodsGet, function($value) {
return (bool) preg_match('/^get.*$/', $value);
});
$std = new \stdClass();
foreach ($methodsGet as $attribute) {
... | [
"private",
"static",
"function",
"makeObject",
"(",
"$",
"entity",
")",
"{",
"$",
"methodsGet",
"=",
"get_class_methods",
"(",
"$",
"entity",
")",
";",
"$",
"methodsGet",
"=",
"array_filter",
"(",
"$",
"methodsGet",
",",
"function",
"(",
"$",
"value",
")",... | Extract the attributes of etities
@author Edson B S Monteiro <bruno.monteirodg@gmail.com>
@since 1.0
@param mixed $entity
@return \stdClass | [
"Extract",
"the",
"attributes",
"of",
"etities"
] | 04c85684e9317fdc52c47aacb357661b4939fb4b | https://github.com/br-monteiro/htr-core/blob/04c85684e9317fdc52c47aacb357661b4939fb4b/src/Database/AdapterResults.php#L18-L31 |
36,014 | br-monteiro/htr-core | src/Database/AdapterResults.php | AdapterResults.adapter | final public static function adapter($result)
{
if (is_array($result)) {
$arr = [];
foreach ($result as $key => $value) {
$arr[$key] = self::makeObject($value);
}
return $arr;
}
return self::makeObject($result);
} | php | final public static function adapter($result)
{
if (is_array($result)) {
$arr = [];
foreach ($result as $key => $value) {
$arr[$key] = self::makeObject($value);
}
return $arr;
}
return self::makeObject($result);
} | [
"final",
"public",
"static",
"function",
"adapter",
"(",
"$",
"result",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"result",
")",
")",
"{",
"$",
"arr",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"result",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
... | Adapter the results
@author Edson B S Monteiro <bruno.monteirodg@gmail.com>
@since 1.0
@param mixed $result
@return \stdClass | [
"Adapter",
"the",
"results"
] | 04c85684e9317fdc52c47aacb357661b4939fb4b | https://github.com/br-monteiro/htr-core/blob/04c85684e9317fdc52c47aacb357661b4939fb4b/src/Database/AdapterResults.php#L41-L52 |
36,015 | honey-comb/starter | src/Helpers/HCConfigParseHelper.php | HCConfigParseHelper.sortByPriority | private function sortByPriority(array $filePaths): array
{
$toSort = [];
foreach ($filePaths as $filePath) {
$file = json_decode(file_get_contents($filePath), true);
$sequence = Arr::get($file, 'general.sequence', 0);
$toSort[$sequence][] = $filePath;
}... | php | private function sortByPriority(array $filePaths): array
{
$toSort = [];
foreach ($filePaths as $filePath) {
$file = json_decode(file_get_contents($filePath), true);
$sequence = Arr::get($file, 'general.sequence', 0);
$toSort[$sequence][] = $filePath;
}... | [
"private",
"function",
"sortByPriority",
"(",
"array",
"$",
"filePaths",
")",
":",
"array",
"{",
"$",
"toSort",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"filePaths",
"as",
"$",
"filePath",
")",
"{",
"$",
"file",
"=",
"json_decode",
"(",
"file_get_content... | Sort hc-config.json files by sequence
@param array $filePaths
@return array | [
"Sort",
"hc",
"-",
"config",
".",
"json",
"files",
"by",
"sequence"
] | 2c5330a49eb5204a6b748368aca835b7ecb02393 | https://github.com/honey-comb/starter/blob/2c5330a49eb5204a6b748368aca835b7ecb02393/src/Helpers/HCConfigParseHelper.php#L66-L81 |
36,016 | stubbles/stubbles-console | src/main/php/input/ConsoleRequest.php | ConsoleRequest.readEnv | public function readEnv(string $envName): ValueReader
{
return new ValueReader(
$this->env->errors(),
$envName,
$this->env->value($envName)
);
} | php | public function readEnv(string $envName): ValueReader
{
return new ValueReader(
$this->env->errors(),
$envName,
$this->env->value($envName)
);
} | [
"public",
"function",
"readEnv",
"(",
"string",
"$",
"envName",
")",
":",
"ValueReader",
"{",
"return",
"new",
"ValueReader",
"(",
"$",
"this",
"->",
"env",
"->",
"errors",
"(",
")",
",",
"$",
"envName",
",",
"$",
"this",
"->",
"env",
"->",
"value",
... | returns request value from params for validation
@param string $envName name of environment value
@return \stubbles\input\ValueReader | [
"returns",
"request",
"value",
"from",
"params",
"for",
"validation"
] | 9b8d8e0d92e3c6b629a0fa860ace957016d20047 | https://github.com/stubbles/stubbles-console/blob/9b8d8e0d92e3c6b629a0fa860ace957016d20047/src/main/php/input/ConsoleRequest.php#L117-L124 |
36,017 | honey-comb/starter | src/Services/HCLanguageService.php | HCLanguageService.getInterfaceActiveLanguages | public function getInterfaceActiveLanguages(): Collection
{
return cache()->remember($this->interfaceCacheKey, now()->addWeek(), function () {
return $this->getRepository()->getInterfaceLanguages();
});
} | php | public function getInterfaceActiveLanguages(): Collection
{
return cache()->remember($this->interfaceCacheKey, now()->addWeek(), function () {
return $this->getRepository()->getInterfaceLanguages();
});
} | [
"public",
"function",
"getInterfaceActiveLanguages",
"(",
")",
":",
"Collection",
"{",
"return",
"cache",
"(",
")",
"->",
"remember",
"(",
"$",
"this",
"->",
"interfaceCacheKey",
",",
"now",
"(",
")",
"->",
"addWeek",
"(",
")",
",",
"function",
"(",
")",
... | Get all available interface languages
@return Collection
@throws \Exception | [
"Get",
"all",
"available",
"interface",
"languages"
] | 2c5330a49eb5204a6b748368aca835b7ecb02393 | https://github.com/honey-comb/starter/blob/2c5330a49eb5204a6b748368aca835b7ecb02393/src/Services/HCLanguageService.php#L89-L94 |
36,018 | hiqdev/hipanel-module-client | src/logic/PhoneConfirmer.php | PhoneConfirmer.requestCode | public function requestCode()
{
if (!$this->notifyTries->isIntervalSatisfied()) {
throw new PhoneConfirmationException('Minimum interval between confirmation code requests is not satisfied');
}
if (!$this->notifyTries->tries_left) {
throw new PhoneConfirmationExceptio... | php | public function requestCode()
{
if (!$this->notifyTries->isIntervalSatisfied()) {
throw new PhoneConfirmationException('Minimum interval between confirmation code requests is not satisfied');
}
if (!$this->notifyTries->tries_left) {
throw new PhoneConfirmationExceptio... | [
"public",
"function",
"requestCode",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"notifyTries",
"->",
"isIntervalSatisfied",
"(",
")",
")",
"{",
"throw",
"new",
"PhoneConfirmationException",
"(",
"'Minimum interval between confirmation code requests is not satisfi... | Requests API to send the phone number confirmation code.
@throws PhoneConfirmationException
@return bool | [
"Requests",
"API",
"to",
"send",
"the",
"phone",
"number",
"confirmation",
"code",
"."
] | 569d87de369ccf8646087dde566d26a41995c8cb | https://github.com/hiqdev/hipanel-module-client/blob/569d87de369ccf8646087dde566d26a41995c8cb/src/logic/PhoneConfirmer.php#L47-L66 |
36,019 | hiqdev/hipanel-module-client | src/logic/PhoneConfirmer.php | PhoneConfirmer.submitCode | public function submitCode()
{
if (!$this->model->validate()) {
throw new PhoneConfirmationException('Form validation failed');
}
try {
Contact::perform('confirm-phone', [
'id' => $this->model->id,
'type' => $this->model->type,
... | php | public function submitCode()
{
if (!$this->model->validate()) {
throw new PhoneConfirmationException('Form validation failed');
}
try {
Contact::perform('confirm-phone', [
'id' => $this->model->id,
'type' => $this->model->type,
... | [
"public",
"function",
"submitCode",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"model",
"->",
"validate",
"(",
")",
")",
"{",
"throw",
"new",
"PhoneConfirmationException",
"(",
"'Form validation failed'",
")",
";",
"}",
"try",
"{",
"Contact",
"::",
... | Sends the phone number confirmation code to the API.
@throws PhoneConfirmationException
@return bool whether code was submitted successfully | [
"Sends",
"the",
"phone",
"number",
"confirmation",
"code",
"to",
"the",
"API",
"."
] | 569d87de369ccf8646087dde566d26a41995c8cb | https://github.com/hiqdev/hipanel-module-client/blob/569d87de369ccf8646087dde566d26a41995c8cb/src/logic/PhoneConfirmer.php#L74-L96 |
36,020 | symbiote/php-wordpress-database-tools | src/WordpressDatabase.php | WordpressDatabase.getTerms | public function getTerms($taxonomy) {
static $table = 'terms';
$this->_init();
$taxonomy = $this->_db->real_escape_string($taxonomy);
$termIds = $this->_query('SELECT term_taxonomy_id FROM '.$this->getTable('term_taxonomy').' WHERE taxonomy = \''.$taxonomy.'\'', 'term_taxonomy_id', true);
$result = $this->_qu... | php | public function getTerms($taxonomy) {
static $table = 'terms';
$this->_init();
$taxonomy = $this->_db->real_escape_string($taxonomy);
$termIds = $this->_query('SELECT term_taxonomy_id FROM '.$this->getTable('term_taxonomy').' WHERE taxonomy = \''.$taxonomy.'\'', 'term_taxonomy_id', true);
$result = $this->_qu... | [
"public",
"function",
"getTerms",
"(",
"$",
"taxonomy",
")",
"{",
"static",
"$",
"table",
"=",
"'terms'",
";",
"$",
"this",
"->",
"_init",
"(",
")",
";",
"$",
"taxonomy",
"=",
"$",
"this",
"->",
"_db",
"->",
"real_escape_string",
"(",
"$",
"taxonomy",
... | Get all terms that exist in a taxonomy type. To determine what taxonomy types are available, call 'getTermTypes' and use
one of the names provided.
@return array | [
"Get",
"all",
"terms",
"that",
"exist",
"in",
"a",
"taxonomy",
"type",
".",
"To",
"determine",
"what",
"taxonomy",
"types",
"are",
"available",
"call",
"getTermTypes",
"and",
"use",
"one",
"of",
"the",
"names",
"provided",
"."
] | 93b1ae969722d7235dbbe6374f381daea0e0d5d7 | https://github.com/symbiote/php-wordpress-database-tools/blob/93b1ae969722d7235dbbe6374f381daea0e0d5d7/src/WordpressDatabase.php#L113-L124 |
36,021 | symbiote/php-wordpress-database-tools | src/WordpressDatabase.php | WordpressDatabase.getFrontPageID | public function getFrontPageID() {
// Core WP only handles either 'page' or 'posts' as of 2016-07-22
$type = $this->getOption('show_on_front');
if ($type !== 'page')
{
throw new Exception('Cannot use "'.__FUNCTION__.'" if Wordpress database isn\'t using a page as it\'s home page. Type = '.$type);
}
$word... | php | public function getFrontPageID() {
// Core WP only handles either 'page' or 'posts' as of 2016-07-22
$type = $this->getOption('show_on_front');
if ($type !== 'page')
{
throw new Exception('Cannot use "'.__FUNCTION__.'" if Wordpress database isn\'t using a page as it\'s home page. Type = '.$type);
}
$word... | [
"public",
"function",
"getFrontPageID",
"(",
")",
"{",
"// Core WP only handles either 'page' or 'posts' as of 2016-07-22",
"$",
"type",
"=",
"$",
"this",
"->",
"getOption",
"(",
"'show_on_front'",
")",
";",
"if",
"(",
"$",
"type",
"!==",
"'page'",
")",
"{",
"thro... | Return the front page.
Throw an exception if this Wordpress DB isn't using a 'page' as the homepage
and is showing a post listing instead.
@return array|null | [
"Return",
"the",
"front",
"page",
"."
] | 93b1ae969722d7235dbbe6374f381daea0e0d5d7 | https://github.com/symbiote/php-wordpress-database-tools/blob/93b1ae969722d7235dbbe6374f381daea0e0d5d7/src/WordpressDatabase.php#L197-L211 |
36,022 | hiqdev/hipanel-module-client | src/forms/EmployeeForm.php | EmployeeForm.extractContract | protected function extractContract($contact)
{
foreach ($contact->documents as $document) {
if ($document->type === 'contract') {
$document->scenario = $this->scenario;
return $document;
}
}
return null;
} | php | protected function extractContract($contact)
{
foreach ($contact->documents as $document) {
if ($document->type === 'contract') {
$document->scenario = $this->scenario;
return $document;
}
}
return null;
} | [
"protected",
"function",
"extractContract",
"(",
"$",
"contact",
")",
"{",
"foreach",
"(",
"$",
"contact",
"->",
"documents",
"as",
"$",
"document",
")",
"{",
"if",
"(",
"$",
"document",
"->",
"type",
"===",
"'contract'",
")",
"{",
"$",
"document",
"->",... | Extracts contract out of documents array.
@param Contact $contact
@return Document|null | [
"Extracts",
"contract",
"out",
"of",
"documents",
"array",
"."
] | 569d87de369ccf8646087dde566d26a41995c8cb | https://github.com/hiqdev/hipanel-module-client/blob/569d87de369ccf8646087dde566d26a41995c8cb/src/forms/EmployeeForm.php#L85-L96 |
36,023 | hiqdev/hipanel-module-client | src/forms/EmployeeForm.php | EmployeeForm.validate | public function validate()
{
$contacts = $this->getContactsCollection();
if (!$contacts->validate()) {
return $contacts->getFirstError();
}
if ($this->getContract() !== null) {
if (!$this->getContract()->validate()) {
return reset($this->getCo... | php | public function validate()
{
$contacts = $this->getContactsCollection();
if (!$contacts->validate()) {
return $contacts->getFirstError();
}
if ($this->getContract() !== null) {
if (!$this->getContract()->validate()) {
return reset($this->getCo... | [
"public",
"function",
"validate",
"(",
")",
"{",
"$",
"contacts",
"=",
"$",
"this",
"->",
"getContactsCollection",
"(",
")",
";",
"if",
"(",
"!",
"$",
"contacts",
"->",
"validate",
"(",
")",
")",
"{",
"return",
"$",
"contacts",
"->",
"getFirstError",
"... | Validates all models of the form.
@return true|string | [
"Validates",
"all",
"models",
"of",
"the",
"form",
"."
] | 569d87de369ccf8646087dde566d26a41995c8cb | https://github.com/hiqdev/hipanel-module-client/blob/569d87de369ccf8646087dde566d26a41995c8cb/src/forms/EmployeeForm.php#L171-L185 |
36,024 | hiqdev/hipanel-module-client | src/forms/EmployeeForm.php | EmployeeForm.save | public function save()
{
$collection = $this->getContactsCollection();
try {
$contractSaved = true;
$contactsSaved = $collection->save();
if ($this->getContract() !== null) {
$this->getContract()->save();
}
return $contac... | php | public function save()
{
$collection = $this->getContactsCollection();
try {
$contractSaved = true;
$contactsSaved = $collection->save();
if ($this->getContract() !== null) {
$this->getContract()->save();
}
return $contac... | [
"public",
"function",
"save",
"(",
")",
"{",
"$",
"collection",
"=",
"$",
"this",
"->",
"getContactsCollection",
"(",
")",
";",
"try",
"{",
"$",
"contractSaved",
"=",
"true",
";",
"$",
"contactsSaved",
"=",
"$",
"collection",
"->",
"save",
"(",
")",
";... | Saves all model of the form.
@return bool | [
"Saves",
"all",
"model",
"of",
"the",
"form",
"."
] | 569d87de369ccf8646087dde566d26a41995c8cb | https://github.com/hiqdev/hipanel-module-client/blob/569d87de369ccf8646087dde566d26a41995c8cb/src/forms/EmployeeForm.php#L192-L208 |
36,025 | hiqdev/hipanel-module-client | src/forms/EmployeeForm.php | EmployeeForm.contactLocalization | protected function contactLocalization($originalContact, $language, $createWhenNotExists = true)
{
$originalContact->scenario = $this->scenario;
if ($language === self::LANGUAGE_DEFAULT) {
$originalContact->localization = $language;
return $originalContact;
}
... | php | protected function contactLocalization($originalContact, $language, $createWhenNotExists = true)
{
$originalContact->scenario = $this->scenario;
if ($language === self::LANGUAGE_DEFAULT) {
$originalContact->localization = $language;
return $originalContact;
}
... | [
"protected",
"function",
"contactLocalization",
"(",
"$",
"originalContact",
",",
"$",
"language",
",",
"$",
"createWhenNotExists",
"=",
"true",
")",
"{",
"$",
"originalContact",
"->",
"scenario",
"=",
"$",
"this",
"->",
"scenario",
";",
"if",
"(",
"$",
"lan... | Gets localized version of this contact.
@param $originalContact
@param $language
@param bool $createWhenNotExists
@return Contact | [
"Gets",
"localized",
"version",
"of",
"this",
"contact",
"."
] | 569d87de369ccf8646087dde566d26a41995c8cb | https://github.com/hiqdev/hipanel-module-client/blob/569d87de369ccf8646087dde566d26a41995c8cb/src/forms/EmployeeForm.php#L267-L298 |
36,026 | GrottoPress/jentil | app/libraries/Jentil/Setups/Views/Search.php | Search.searchQuery | private function searchQuery(): string
{
$url = \parse_url($this->app->utilities->page->URL('full'));
\parse_str(($url['query'] ?? ''), $query_params);
return $query_params['s'] ?? '';
} | php | private function searchQuery(): string
{
$url = \parse_url($this->app->utilities->page->URL('full'));
\parse_str(($url['query'] ?? ''), $query_params);
return $query_params['s'] ?? '';
} | [
"private",
"function",
"searchQuery",
"(",
")",
":",
"string",
"{",
"$",
"url",
"=",
"\\",
"parse_url",
"(",
"$",
"this",
"->",
"app",
"->",
"utilities",
"->",
"page",
"->",
"URL",
"(",
"'full'",
")",
")",
";",
"\\",
"parse_str",
"(",
"(",
"$",
"ur... | Returns the value of the 's' query parameter in the
current page's URL.
Unlike WordPress' `get_search_query()`, this looks for
the presence of 's' query parameter in the URL, and
ignores any URL rewrites of the search page URL. | [
"Returns",
"the",
"value",
"of",
"the",
"s",
"query",
"parameter",
"in",
"the",
"current",
"page",
"s",
"URL",
"."
] | ad3341c91e0386256d4a2fbe8b7a201c9b706c10 | https://github.com/GrottoPress/jentil/blob/ad3341c91e0386256d4a2fbe8b7a201c9b706c10/app/libraries/Jentil/Setups/Views/Search.php#L62-L68 |
36,027 | GrottoPress/jentil | app/libraries/Jentil/Utilities/FileSystem.php | FileSystem.dir | public function dir(string $type, string $append = ''): string
{
return $this->_dir($type, $append);
} | php | public function dir(string $type, string $append = ''): string
{
return $this->_dir($type, $append);
} | [
"public",
"function",
"dir",
"(",
"string",
"$",
"type",
",",
"string",
"$",
"append",
"=",
"''",
")",
":",
"string",
"{",
"return",
"$",
"this",
"->",
"_dir",
"(",
"$",
"type",
",",
"$",
"append",
")",
";",
"}"
] | Get Jentil directory
@param string $type 'path' or 'url'. | [
"Get",
"Jentil",
"directory"
] | ad3341c91e0386256d4a2fbe8b7a201c9b706c10 | https://github.com/GrottoPress/jentil/blob/ad3341c91e0386256d4a2fbe8b7a201c9b706c10/app/libraries/Jentil/Utilities/FileSystem.php#L38-L41 |
36,028 | GrottoPress/jentil | app/libraries/Jentil/Utilities/FileSystem.php | FileSystem.partialsDir | public function partialsDir(
string $type,
string $append = '',
string $form = ''
): string {
return $this->_dir($type, "/app/partials{$append}", $form);
} | php | public function partialsDir(
string $type,
string $append = '',
string $form = ''
): string {
return $this->_dir($type, "/app/partials{$append}", $form);
} | [
"public",
"function",
"partialsDir",
"(",
"string",
"$",
"type",
",",
"string",
"$",
"append",
"=",
"''",
",",
"string",
"$",
"form",
"=",
"''",
")",
":",
"string",
"{",
"return",
"$",
"this",
"->",
"_dir",
"(",
"$",
"type",
",",
"\"/app/partials{$appe... | Get Jentil partials directory
@param string $type 'path' or 'url'.
@param string $form 'relative' or 'absolute'. | [
"Get",
"Jentil",
"partials",
"directory"
] | ad3341c91e0386256d4a2fbe8b7a201c9b706c10 | https://github.com/GrottoPress/jentil/blob/ad3341c91e0386256d4a2fbe8b7a201c9b706c10/app/libraries/Jentil/Utilities/FileSystem.php#L49-L55 |
36,029 | GrottoPress/jentil | app/libraries/Jentil/Utilities/FileSystem.php | FileSystem.templatesDir | public function templatesDir(
string $type,
string $append = '',
string $form = ''
): string {
return $this->_dir($type, "/app/templates{$append}", $form);
} | php | public function templatesDir(
string $type,
string $append = '',
string $form = ''
): string {
return $this->_dir($type, "/app/templates{$append}", $form);
} | [
"public",
"function",
"templatesDir",
"(",
"string",
"$",
"type",
",",
"string",
"$",
"append",
"=",
"''",
",",
"string",
"$",
"form",
"=",
"''",
")",
":",
"string",
"{",
"return",
"$",
"this",
"->",
"_dir",
"(",
"$",
"type",
",",
"\"/app/templates{$ap... | Get Jentil templates directory
@param string $type 'path' or 'url'.
@param string $form 'relative' or 'absolute'. | [
"Get",
"Jentil",
"templates",
"directory"
] | ad3341c91e0386256d4a2fbe8b7a201c9b706c10 | https://github.com/GrottoPress/jentil/blob/ad3341c91e0386256d4a2fbe8b7a201c9b706c10/app/libraries/Jentil/Utilities/FileSystem.php#L63-L69 |
36,030 | GrottoPress/jentil | app/libraries/Jentil/Utilities/FileSystem.php | FileSystem.vendorDir | public function vendorDir(
string $type,
string $append = '',
string $form = ''
): string {
$rel_dir = \explode('/', $this->relativeDir());
$vendor = \reset($rel_dir) ?: 'vendor';
return 'relative' === $form ?
"{$vendor}{$append}" :
$this->the... | php | public function vendorDir(
string $type,
string $append = '',
string $form = ''
): string {
$rel_dir = \explode('/', $this->relativeDir());
$vendor = \reset($rel_dir) ?: 'vendor';
return 'relative' === $form ?
"{$vendor}{$append}" :
$this->the... | [
"public",
"function",
"vendorDir",
"(",
"string",
"$",
"type",
",",
"string",
"$",
"append",
"=",
"''",
",",
"string",
"$",
"form",
"=",
"''",
")",
":",
"string",
"{",
"$",
"rel_dir",
"=",
"\\",
"explode",
"(",
"'/'",
",",
"$",
"this",
"->",
"relat... | Get composer's vendor directory
@param string $type 'path' or 'url'.
@param string $form 'relative' or 'absolute'. | [
"Get",
"composer",
"s",
"vendor",
"directory"
] | ad3341c91e0386256d4a2fbe8b7a201c9b706c10 | https://github.com/GrottoPress/jentil/blob/ad3341c91e0386256d4a2fbe8b7a201c9b706c10/app/libraries/Jentil/Utilities/FileSystem.php#L77-L88 |
36,031 | GrottoPress/jentil | app/libraries/Jentil/Utilities/FileSystem.php | FileSystem.themeDir | public function themeDir(string $type, string $append = ''): string
{
$stylesheet = $type === 'path'
? \get_stylesheet_directory()
: \get_stylesheet_directory_uri();
if (0 === strpos($this->{'dir'.\ucfirst($type)}, $stylesheet)) {
return $stylesheet.$append;
... | php | public function themeDir(string $type, string $append = ''): string
{
$stylesheet = $type === 'path'
? \get_stylesheet_directory()
: \get_stylesheet_directory_uri();
if (0 === strpos($this->{'dir'.\ucfirst($type)}, $stylesheet)) {
return $stylesheet.$append;
... | [
"public",
"function",
"themeDir",
"(",
"string",
"$",
"type",
",",
"string",
"$",
"append",
"=",
"''",
")",
":",
"string",
"{",
"$",
"stylesheet",
"=",
"$",
"type",
"===",
"'path'",
"?",
"\\",
"get_stylesheet_directory",
"(",
")",
":",
"\\",
"get_stylesh... | Get directory of theme under which Jentil is installed.
@param string $type 'url' or 'path'
@return string Path. Same as $this->dir() if Jentil is theme. | [
"Get",
"directory",
"of",
"theme",
"under",
"which",
"Jentil",
"is",
"installed",
"."
] | ad3341c91e0386256d4a2fbe8b7a201c9b706c10 | https://github.com/GrottoPress/jentil/blob/ad3341c91e0386256d4a2fbe8b7a201c9b706c10/app/libraries/Jentil/Utilities/FileSystem.php#L110-L125 |
36,032 | stubbles/stubbles-console | src/main/php/Console.php | Console.prompt | public function prompt(string $message, ParamErrors $paramErrors = null): ValueReader
{
$this->out->write($message);
return $this->readValue($paramErrors);
} | php | public function prompt(string $message, ParamErrors $paramErrors = null): ValueReader
{
$this->out->write($message);
return $this->readValue($paramErrors);
} | [
"public",
"function",
"prompt",
"(",
"string",
"$",
"message",
",",
"ParamErrors",
"$",
"paramErrors",
"=",
"null",
")",
":",
"ValueReader",
"{",
"$",
"this",
"->",
"out",
"->",
"write",
"(",
"$",
"message",
")",
";",
"return",
"$",
"this",
"->",
"read... | prompt user for entering a value
Echhos given message to stdout and expects the user to enter a value on
stdin. In case you need access to error messages that may happen during
value validation you need to supply <ParamErrors>, errors will be
accumulated therein under the param name stdin.
@api
@param string ... | [
"prompt",
"user",
"for",
"entering",
"a",
"value"
] | 9b8d8e0d92e3c6b629a0fa860ace957016d20047 | https://github.com/stubbles/stubbles-console/blob/9b8d8e0d92e3c6b629a0fa860ace957016d20047/src/main/php/Console.php#L73-L77 |
36,033 | stubbles/stubbles-console | src/main/php/Console.php | Console.confirm | public function confirm(string $message, string $default = null): bool
{
$result = null;
while (null === $result) {
$result = $this->prompt($message)->ifIsOneOf(['y', 'Y', 'n', 'N', '']);
if ('' === $result) {
$result = ((null !== $default) ? ($default) : (nul... | php | public function confirm(string $message, string $default = null): bool
{
$result = null;
while (null === $result) {
$result = $this->prompt($message)->ifIsOneOf(['y', 'Y', 'n', 'N', '']);
if ('' === $result) {
$result = ((null !== $default) ? ($default) : (nul... | [
"public",
"function",
"confirm",
"(",
"string",
"$",
"message",
",",
"string",
"$",
"default",
"=",
"null",
")",
":",
"bool",
"{",
"$",
"result",
"=",
"null",
";",
"while",
"(",
"null",
"===",
"$",
"result",
")",
"{",
"$",
"result",
"=",
"$",
"this... | ask the user to confirm something
Repeats the message until user enters <y> or <n> (case insensitive). In
case a default is given and the users enters nothing this default will
be used - if the default is <y> it will return <true>, and <false>
otherwise.
@api
@param string $message message to show before requesti... | [
"ask",
"the",
"user",
"to",
"confirm",
"something"
] | 9b8d8e0d92e3c6b629a0fa860ace957016d20047 | https://github.com/stubbles/stubbles-console/blob/9b8d8e0d92e3c6b629a0fa860ace957016d20047/src/main/php/Console.php#L93-L104 |
36,034 | stubbles/stubbles-console | src/main/php/Console.php | Console.readValue | public function readValue(ParamErrors $paramErrors = null): ValueReader
{
if (null === $paramErrors) {
return ValueReader::forValue($this->in->readLine());
}
return new ValueReader($paramErrors, 'stdin', Value::of($this->in->readLine()));
} | php | public function readValue(ParamErrors $paramErrors = null): ValueReader
{
if (null === $paramErrors) {
return ValueReader::forValue($this->in->readLine());
}
return new ValueReader($paramErrors, 'stdin', Value::of($this->in->readLine()));
} | [
"public",
"function",
"readValue",
"(",
"ParamErrors",
"$",
"paramErrors",
"=",
"null",
")",
":",
"ValueReader",
"{",
"if",
"(",
"null",
"===",
"$",
"paramErrors",
")",
"{",
"return",
"ValueReader",
"::",
"forValue",
"(",
"$",
"this",
"->",
"in",
"->",
"... | reads a value from command line input
Read a value entered on stdin. Returns a <ValueReader> which can be used
to get a typed value. In case you need access to error messages that may
happen during value validation you need to supply <ParamErrors>, errors
will be accumulated therein under the param name stdin.
@api
@... | [
"reads",
"a",
"value",
"from",
"command",
"line",
"input"
] | 9b8d8e0d92e3c6b629a0fa860ace957016d20047 | https://github.com/stubbles/stubbles-console/blob/9b8d8e0d92e3c6b629a0fa860ace957016d20047/src/main/php/Console.php#L119-L126 |
36,035 | stubbles/stubbles-console | src/main/php/Console.php | Console.close | public function close()
{
$this->in->close();
$this->out->close();
$this->err->close();
} | php | public function close()
{
$this->in->close();
$this->out->close();
$this->err->close();
} | [
"public",
"function",
"close",
"(",
")",
"{",
"$",
"this",
"->",
"in",
"->",
"close",
"(",
")",
";",
"$",
"this",
"->",
"out",
"->",
"close",
"(",
")",
";",
"$",
"this",
"->",
"err",
"->",
"close",
"(",
")",
";",
"}"
] | closes all underlying streams
@since 2.4.0 | [
"closes",
"all",
"underlying",
"streams"
] | 9b8d8e0d92e3c6b629a0fa860ace957016d20047 | https://github.com/stubbles/stubbles-console/blob/9b8d8e0d92e3c6b629a0fa860ace957016d20047/src/main/php/Console.php#L311-L316 |
36,036 | electro-modules/matisse-components | MatisseComponents/Dropzone.php | Dropzone.dropzoneUpload | static function dropzoneUpload ($request, $response)
{
$ds = DIRECTORY_SEPARATOR;
$storeFolder = self::TEMP_STORE_FOLDER_NAME;
$storePath = sys_get_temp_dir().$ds.$storeFolder;
if (!is_dir($storePath))
mkdir($storePath);
$file = "";
foreach ($request->getUploadedFiles() as $oFile)
... | php | static function dropzoneUpload ($request, $response)
{
$ds = DIRECTORY_SEPARATOR;
$storeFolder = self::TEMP_STORE_FOLDER_NAME;
$storePath = sys_get_temp_dir().$ds.$storeFolder;
if (!is_dir($storePath))
mkdir($storePath);
$file = "";
foreach ($request->getUploadedFiles() as $oFile)
... | [
"static",
"function",
"dropzoneUpload",
"(",
"$",
"request",
",",
"$",
"response",
")",
"{",
"$",
"ds",
"=",
"DIRECTORY_SEPARATOR",
";",
"$",
"storeFolder",
"=",
"self",
"::",
"TEMP_STORE_FOLDER_NAME",
";",
"$",
"storePath",
"=",
"sys_get_temp_dir",
"(",
")",
... | Handles file uploads.
@param ServerRequestInterface $request
@param ResponseInterface $response
@return ResponseInterface
@internal param ContentRepositoryInterface $repository | [
"Handles",
"file",
"uploads",
"."
] | 3a746f796157ef72b585a5994394483fbe500861 | https://github.com/electro-modules/matisse-components/blob/3a746f796157ef72b585a5994394483fbe500861/MatisseComponents/Dropzone.php#L129-L147 |
36,037 | electro-modules/matisse-components | MatisseComponents/Dropzone.php | Dropzone.getFieldValue | private function getFieldValue()
{
$model = $this->modelController->getModel();
$fieldName = str_replace('model/','', $this->props->name);
return $model->$fieldName;
} | php | private function getFieldValue()
{
$model = $this->modelController->getModel();
$fieldName = str_replace('model/','', $this->props->name);
return $model->$fieldName;
} | [
"private",
"function",
"getFieldValue",
"(",
")",
"{",
"$",
"model",
"=",
"$",
"this",
"->",
"modelController",
"->",
"getModel",
"(",
")",
";",
"$",
"fieldName",
"=",
"str_replace",
"(",
"'model/'",
",",
"''",
",",
"$",
"this",
"->",
"props",
"->",
"n... | Private function to get value of this drozpone field
@return mixed | [
"Private",
"function",
"to",
"get",
"value",
"of",
"this",
"drozpone",
"field"
] | 3a746f796157ef72b585a5994394483fbe500861 | https://github.com/electro-modules/matisse-components/blob/3a746f796157ef72b585a5994394483fbe500861/MatisseComponents/Dropzone.php#L162-L167 |
36,038 | electro-modules/matisse-components | MatisseComponents/Dropzone.php | Dropzone.getImagesInFieldValue | private function getImagesInFieldValue($value)
{
$aImages = explode(',', $value);
$arrImages = [];
foreach ($aImages as $aImage)
{
$oImage = File::where('path',$aImage)->first();
if (!$oImage) continue;
$fileName = "$oImage->name.$oImage->ext";
$arrImages[] = [
'filenam... | php | private function getImagesInFieldValue($value)
{
$aImages = explode(',', $value);
$arrImages = [];
foreach ($aImages as $aImage)
{
$oImage = File::where('path',$aImage)->first();
if (!$oImage) continue;
$fileName = "$oImage->name.$oImage->ext";
$arrImages[] = [
'filenam... | [
"private",
"function",
"getImagesInFieldValue",
"(",
"$",
"value",
")",
"{",
"$",
"aImages",
"=",
"explode",
"(",
"','",
",",
"$",
"value",
")",
";",
"$",
"arrImages",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"aImages",
"as",
"$",
"aImage",
")",
"{",... | Private function to get all uploaded images in this dropzone
@param $value
@return array | [
"Private",
"function",
"to",
"get",
"all",
"uploaded",
"images",
"in",
"this",
"dropzone"
] | 3a746f796157ef72b585a5994394483fbe500861 | https://github.com/electro-modules/matisse-components/blob/3a746f796157ef72b585a5994394483fbe500861/MatisseComponents/Dropzone.php#L174-L196 |
36,039 | stubbles/stubbles-console | src/main/php/Executor.php | Executor.execute | public function execute(string $command, callable $collect = null, string $redirect = '2>&1'): self
{
foreach ($this->outputOf($command, $redirect) as $line) {
if (null !== $collect) {
$collect($line);
}
}
return $this;
} | php | public function execute(string $command, callable $collect = null, string $redirect = '2>&1'): self
{
foreach ($this->outputOf($command, $redirect) as $line) {
if (null !== $collect) {
$collect($line);
}
}
return $this;
} | [
"public",
"function",
"execute",
"(",
"string",
"$",
"command",
",",
"callable",
"$",
"collect",
"=",
"null",
",",
"string",
"$",
"redirect",
"=",
"'2>&1'",
")",
":",
"self",
"{",
"foreach",
"(",
"$",
"this",
"->",
"outputOf",
"(",
"$",
"command",
",",... | executes given command
@param string $command
@param callable $collect optional callable which will receive each line from the command output
@param string $redirect optional how to redirect error output
@return \stubbles\console\Executor | [
"executes",
"given",
"command"
] | 9b8d8e0d92e3c6b629a0fa860ace957016d20047 | https://github.com/stubbles/stubbles-console/blob/9b8d8e0d92e3c6b629a0fa860ace957016d20047/src/main/php/Executor.php#L54-L63 |
36,040 | stubbles/stubbles-console | src/main/php/Executor.php | Executor.executeAsync | public function executeAsync(string $command, string $redirect = '2>&1'): InputStream
{
return new class(
$this->runCommand($command, $redirect),
$command
) extends ResourceInputStream {
public function __construct($resource, string $command)
{... | php | public function executeAsync(string $command, string $redirect = '2>&1'): InputStream
{
return new class(
$this->runCommand($command, $redirect),
$command
) extends ResourceInputStream {
public function __construct($resource, string $command)
{... | [
"public",
"function",
"executeAsync",
"(",
"string",
"$",
"command",
",",
"string",
"$",
"redirect",
"=",
"'2>&1'",
")",
":",
"InputStream",
"{",
"return",
"new",
"class",
"(",
"$",
"this",
"->",
"runCommand",
"(",
"$",
"command",
",",
"$",
"redirect",
"... | executes given command asynchronous
The method starts the command, and returns an input stream which can be
used to read the output of the command at a later point in time.
@param string $command
@param string $redirect optional how to redirect error output
@return \stubbles\streams\InputStream | [
"executes",
"given",
"command",
"asynchronous"
] | 9b8d8e0d92e3c6b629a0fa860ace957016d20047 | https://github.com/stubbles/stubbles-console/blob/9b8d8e0d92e3c6b629a0fa860ace957016d20047/src/main/php/Executor.php#L75-L143 |
36,041 | stubbles/stubbles-console | src/main/php/Executor.php | Executor.outputOf | public function outputOf(string $command, string $redirect = '2>&1')
{
$pd = $this->runCommand($command, $redirect);
while (!feof($pd) && false !== ($line = fgets($pd, 4096))) {
yield rtrim($line);
}
$returnCode = pclose($pd);
if (0 != $returnCode) {
... | php | public function outputOf(string $command, string $redirect = '2>&1')
{
$pd = $this->runCommand($command, $redirect);
while (!feof($pd) && false !== ($line = fgets($pd, 4096))) {
yield rtrim($line);
}
$returnCode = pclose($pd);
if (0 != $returnCode) {
... | [
"public",
"function",
"outputOf",
"(",
"string",
"$",
"command",
",",
"string",
"$",
"redirect",
"=",
"'2>&1'",
")",
"{",
"$",
"pd",
"=",
"$",
"this",
"->",
"runCommand",
"(",
"$",
"command",
",",
"$",
"redirect",
")",
";",
"while",
"(",
"!",
"feof",... | returns output from a command as it occurs
@param string $command
@param string $redirect optional how to redirect error output
@return \Generator
@since 6.0.0 | [
"returns",
"output",
"from",
"a",
"command",
"as",
"it",
"occurs"
] | 9b8d8e0d92e3c6b629a0fa860ace957016d20047 | https://github.com/stubbles/stubbles-console/blob/9b8d8e0d92e3c6b629a0fa860ace957016d20047/src/main/php/Executor.php#L153-L167 |
36,042 | stubbles/stubbles-console | src/main/php/Executor.php | Executor.runCommand | private function runCommand(string $command, string $redirect = '2>&1')
{
$pd = popen($command . ' ' . $redirect, 'r');
if (false === $pd) {
throw new \RuntimeException('Can not execute ' . $command);
}
return $pd;
} | php | private function runCommand(string $command, string $redirect = '2>&1')
{
$pd = popen($command . ' ' . $redirect, 'r');
if (false === $pd) {
throw new \RuntimeException('Can not execute ' . $command);
}
return $pd;
} | [
"private",
"function",
"runCommand",
"(",
"string",
"$",
"command",
",",
"string",
"$",
"redirect",
"=",
"'2>&1'",
")",
"{",
"$",
"pd",
"=",
"popen",
"(",
"$",
"command",
".",
"' '",
".",
"$",
"redirect",
",",
"'r'",
")",
";",
"if",
"(",
"false",
"... | runs given command and returns a handle to it
@param string $command
@param string $redirect optional how to redirect error output
@return resource
@throws \RuntimeException | [
"runs",
"given",
"command",
"and",
"returns",
"a",
"handle",
"to",
"it"
] | 9b8d8e0d92e3c6b629a0fa860ace957016d20047 | https://github.com/stubbles/stubbles-console/blob/9b8d8e0d92e3c6b629a0fa860ace957016d20047/src/main/php/Executor.php#L177-L185 |
36,043 | edineibauer/uebConfig | public/include/Conn.php | Conn.databaseExist | public function databaseExist(): bool
{
try {
$dsn = 'mysql:host=' . $this->host . ';dbname=' . $this->database;
$options = [\PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES UTF8'];
$connect = new \PDO($dsn, $this->user, $this->pass, $options);
$connect->setAttribu... | php | public function databaseExist(): bool
{
try {
$dsn = 'mysql:host=' . $this->host . ';dbname=' . $this->database;
$options = [\PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES UTF8'];
$connect = new \PDO($dsn, $this->user, $this->pass, $options);
$connect->setAttribu... | [
"public",
"function",
"databaseExist",
"(",
")",
":",
"bool",
"{",
"try",
"{",
"$",
"dsn",
"=",
"'mysql:host='",
".",
"$",
"this",
"->",
"host",
".",
"';dbname='",
".",
"$",
"this",
"->",
"database",
";",
"$",
"options",
"=",
"[",
"\\",
"PDO",
"::",
... | Verifica se credenciais e database Mysql exist
@return bool | [
"Verifica",
"se",
"credenciais",
"e",
"database",
"Mysql",
"exist"
] | 6792d15656f5a9f78f2510d4850aa21102f96c1f | https://github.com/edineibauer/uebConfig/blob/6792d15656f5a9f78f2510d4850aa21102f96c1f/public/include/Conn.php#L38-L50 |
36,044 | edineibauer/uebConfig | public/include/Conn.php | Conn.createDatabase | public function createDatabase()
{
try {
$dsn = 'mysql:host=' . $this->host . ';';
$options = [\PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES UTF8'];
$connect = new \PDO($dsn, $this->user, $this->pass, $options);
$connect->setAttribute(\PDO::ATTR_ERRMODE, \PDO::E... | php | public function createDatabase()
{
try {
$dsn = 'mysql:host=' . $this->host . ';';
$options = [\PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES UTF8'];
$connect = new \PDO($dsn, $this->user, $this->pass, $options);
$connect->setAttribute(\PDO::ATTR_ERRMODE, \PDO::E... | [
"public",
"function",
"createDatabase",
"(",
")",
"{",
"try",
"{",
"$",
"dsn",
"=",
"'mysql:host='",
".",
"$",
"this",
"->",
"host",
".",
"';'",
";",
"$",
"options",
"=",
"[",
"\\",
"PDO",
"::",
"MYSQL_ATTR_INIT_COMMAND",
"=>",
"'SET NAMES UTF8'",
"]",
"... | Cria a database informada no construtor | [
"Cria",
"a",
"database",
"informada",
"no",
"construtor"
] | 6792d15656f5a9f78f2510d4850aa21102f96c1f | https://github.com/edineibauer/uebConfig/blob/6792d15656f5a9f78f2510d4850aa21102f96c1f/public/include/Conn.php#L73-L87 |
36,045 | edineibauer/uebConfig | public/include/Conn.php | Conn.databaseIsEmpty | public function databaseIsEmpty()
{
try {
$dsn = 'mysql:host=' . $this->host . ';dbname=' . $this->database;
$options = [\PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES UTF8'];
$connect = new \PDO($dsn, $this->user, $this->pass, $options);
$connect->setAttribute(\... | php | public function databaseIsEmpty()
{
try {
$dsn = 'mysql:host=' . $this->host . ';dbname=' . $this->database;
$options = [\PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES UTF8'];
$connect = new \PDO($dsn, $this->user, $this->pass, $options);
$connect->setAttribute(\... | [
"public",
"function",
"databaseIsEmpty",
"(",
")",
"{",
"try",
"{",
"$",
"dsn",
"=",
"'mysql:host='",
".",
"$",
"this",
"->",
"host",
".",
"';dbname='",
".",
"$",
"this",
"->",
"database",
";",
"$",
"options",
"=",
"[",
"\\",
"PDO",
"::",
"MYSQL_ATTR_I... | Verifica se database esta vazia | [
"Verifica",
"se",
"database",
"esta",
"vazia"
] | 6792d15656f5a9f78f2510d4850aa21102f96c1f | https://github.com/edineibauer/uebConfig/blob/6792d15656f5a9f78f2510d4850aa21102f96c1f/public/include/Conn.php#L92-L108 |
36,046 | edineibauer/uebConfig | public/include/Conn.php | Conn.clearDatabase | public function clearDatabase()
{
try {
$dsn = 'mysql:host=' . $this->host . ';dbname=' . $this->database;
$options = [\PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES UTF8'];
$connect = new \PDO($dsn, $this->user, $this->pass, $options);
$connect->setAttribute(\PD... | php | public function clearDatabase()
{
try {
$dsn = 'mysql:host=' . $this->host . ';dbname=' . $this->database;
$options = [\PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES UTF8'];
$connect = new \PDO($dsn, $this->user, $this->pass, $options);
$connect->setAttribute(\PD... | [
"public",
"function",
"clearDatabase",
"(",
")",
"{",
"try",
"{",
"$",
"dsn",
"=",
"'mysql:host='",
".",
"$",
"this",
"->",
"host",
".",
"';dbname='",
".",
"$",
"this",
"->",
"database",
";",
"$",
"options",
"=",
"[",
"\\",
"PDO",
"::",
"MYSQL_ATTR_INI... | Limpa as tabelas presentes na database | [
"Limpa",
"as",
"tabelas",
"presentes",
"na",
"database"
] | 6792d15656f5a9f78f2510d4850aa21102f96c1f | https://github.com/edineibauer/uebConfig/blob/6792d15656f5a9f78f2510d4850aa21102f96c1f/public/include/Conn.php#L113-L138 |
36,047 | CharlotteDunois/Validator | src/Validator.php | Validator.addRule | static function addRule(\CharlotteDunois\Validation\RuleInterface $rule) {
if(static::$rulesets === null) {
static::initRules();
}
$class = \get_class($rule);
$arrname = \explode('\\', $class);
$name = \array_pop($arrname);
$rname = \str_repl... | php | static function addRule(\CharlotteDunois\Validation\RuleInterface $rule) {
if(static::$rulesets === null) {
static::initRules();
}
$class = \get_class($rule);
$arrname = \explode('\\', $class);
$name = \array_pop($arrname);
$rname = \str_repl... | [
"static",
"function",
"addRule",
"(",
"\\",
"CharlotteDunois",
"\\",
"Validation",
"\\",
"RuleInterface",
"$",
"rule",
")",
"{",
"if",
"(",
"static",
"::",
"$",
"rulesets",
"===",
"null",
")",
"{",
"static",
"::",
"initRules",
"(",
")",
";",
"}",
"$",
... | Adds a new rule.
@param \CharlotteDunois\Validation\RuleInterface $rule
@return void
@throws \InvalidArgumentException | [
"Adds",
"a",
"new",
"rule",
"."
] | 0c7abddc87174039145bf0ce21d56937f1851365 | https://github.com/CharlotteDunois/Validator/blob/0c7abddc87174039145bf0ce21d56937f1851365/src/Validator.php#L77-L92 |
36,048 | CharlotteDunois/Validator | src/Validator.php | Validator.setDefaultLanguage | static function setDefaultLanguage(string $language) {
if(!\class_exists($language, true)) {
throw new \InvalidArgumentException('Unknown language class');
} elseif(!\in_array(\CharlotteDunois\Validation\LanguageInterface::class, \class_implements($language), true)) {
throw new \... | php | static function setDefaultLanguage(string $language) {
if(!\class_exists($language, true)) {
throw new \InvalidArgumentException('Unknown language class');
} elseif(!\in_array(\CharlotteDunois\Validation\LanguageInterface::class, \class_implements($language), true)) {
throw new \... | [
"static",
"function",
"setDefaultLanguage",
"(",
"string",
"$",
"language",
")",
"{",
"if",
"(",
"!",
"\\",
"class_exists",
"(",
"$",
"language",
",",
"true",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Unknown language class'",
")"... | Sets the default language for the Validator.
@param string $language
@return void
@throws \InvalidArgumentException | [
"Sets",
"the",
"default",
"language",
"for",
"the",
"Validator",
"."
] | 0c7abddc87174039145bf0ce21d56937f1851365 | https://github.com/CharlotteDunois/Validator/blob/0c7abddc87174039145bf0ce21d56937f1851365/src/Validator.php#L100-L108 |
36,049 | marczhermo/search-list | src/SearchList.php | SearchList.addFilter | public function addFilter($filterArray)
{
foreach ($filterArray as $expression => $value) {
$this->filters[][$expression] = $value;
}
return $this;
} | php | public function addFilter($filterArray)
{
foreach ($filterArray as $expression => $value) {
$this->filters[][$expression] = $value;
}
return $this;
} | [
"public",
"function",
"addFilter",
"(",
"$",
"filterArray",
")",
"{",
"foreach",
"(",
"$",
"filterArray",
"as",
"$",
"expression",
"=>",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"filters",
"[",
"]",
"[",
"$",
"expression",
"]",
"=",
"$",
"value",
"... | Collates an array of filter requirements
@param array $filterArray
@return $this | [
"Collates",
"an",
"array",
"of",
"filter",
"requirements"
] | 851f42b021c5934a2905026d57feb85e595b8f80 | https://github.com/marczhermo/search-list/blob/851f42b021c5934a2905026d57feb85e595b8f80/src/SearchList.php#L100-L107 |
36,050 | matthewbdaly/proper | src/Traits/IsString.php | IsString.replace | public function replace(string $find, string $replace): Stringable
{
return new static(str_replace($find, $replace, $this->string));
} | php | public function replace(string $find, string $replace): Stringable
{
return new static(str_replace($find, $replace, $this->string));
} | [
"public",
"function",
"replace",
"(",
"string",
"$",
"find",
",",
"string",
"$",
"replace",
")",
":",
"Stringable",
"{",
"return",
"new",
"static",
"(",
"str_replace",
"(",
"$",
"find",
",",
"$",
"replace",
",",
"$",
"this",
"->",
"string",
")",
")",
... | Find and replace text
@param string $find Text to find.
@param string $replace Text to replace.
@return Stringable | [
"Find",
"and",
"replace",
"text"
] | dac8d6f9ff245b189c57139b79b9dd08cb13bfdd | https://github.com/matthewbdaly/proper/blob/dac8d6f9ff245b189c57139b79b9dd08cb13bfdd/src/Traits/IsString.php#L153-L156 |
36,051 | GrottoPress/jentil | app/libraries/Jentil/Utilities/Loader.php | Loader.load | private function load(string $type, string $slug, string $name = ''): string
{
$slug = \ltrim($slug, '/');
$slug = \rtrim($slug, '.php');
$this->doAction($type, $slug, $name);
$slug = $this->rewriteSlug($type, $slug);
$rel_dir = $this->utilities->fileSystem->relativeDir();
... | php | private function load(string $type, string $slug, string $name = ''): string
{
$slug = \ltrim($slug, '/');
$slug = \rtrim($slug, '.php');
$this->doAction($type, $slug, $name);
$slug = $this->rewriteSlug($type, $slug);
$rel_dir = $this->utilities->fileSystem->relativeDir();
... | [
"private",
"function",
"load",
"(",
"string",
"$",
"type",
",",
"string",
"$",
"slug",
",",
"string",
"$",
"name",
"=",
"''",
")",
":",
"string",
"{",
"$",
"slug",
"=",
"\\",
"ltrim",
"(",
"$",
"slug",
",",
"'/'",
")",
";",
"$",
"slug",
"=",
"\... | Helper to load partial or template
This mimics WordPress' `\get_template_part()` function.
@see
https://developer.wordpress.org/reference/functions/get_template_part/
@param string $type 'template' or 'partial' | [
"Helper",
"to",
"load",
"partial",
"or",
"template"
] | ad3341c91e0386256d4a2fbe8b7a201c9b706c10 | https://github.com/GrottoPress/jentil/blob/ad3341c91e0386256d4a2fbe8b7a201c9b706c10/app/libraries/Jentil/Utilities/Loader.php#L58-L85 |
36,052 | br-monteiro/htr-core | src/Common/Authenticator.php | Authenticator.generateToken | public static function generateToken(array $options): string
{
$issuedAt = time();
$expire = $issuedAt + $options['expiration_sec']; // tempo de expiracao do token
$tokenParam = [
'iat' => $issuedAt, // timestamp de geracao do token
'iss' => $options['host'], // domi... | php | public static function generateToken(array $options): string
{
$issuedAt = time();
$expire = $issuedAt + $options['expiration_sec']; // tempo de expiracao do token
$tokenParam = [
'iat' => $issuedAt, // timestamp de geracao do token
'iss' => $options['host'], // domi... | [
"public",
"static",
"function",
"generateToken",
"(",
"array",
"$",
"options",
")",
":",
"string",
"{",
"$",
"issuedAt",
"=",
"time",
"(",
")",
";",
"$",
"expire",
"=",
"$",
"issuedAt",
"+",
"$",
"options",
"[",
"'expiration_sec'",
"]",
";",
"// tempo de... | Generate the JSON Web Token
@author Edson B S Monteiro <bruno.monteirodg@gmail.com>
@since 1.0
@param array $options
@return string | [
"Generate",
"the",
"JSON",
"Web",
"Token"
] | 04c85684e9317fdc52c47aacb357661b4939fb4b | https://github.com/br-monteiro/htr-core/blob/04c85684e9317fdc52c47aacb357661b4939fb4b/src/Common/Authenticator.php#L24-L38 |
36,053 | AeonDigital/PHP-Tools | src/Date.php | Date.firstWeekOfYear | public static function firstWeekOfYear(int $y) : \Datetime
{
$date = (string)$y . "-01-01 00:00:00";
$format = "Y-m-d H:i:s";
$o = \DateTime::createFromFormat($format, $date);
$wnDay = date("N", strtotime($date));
$addD = (integer)((11 - $wnDay) % 7);
$o->add(new \D... | php | public static function firstWeekOfYear(int $y) : \Datetime
{
$date = (string)$y . "-01-01 00:00:00";
$format = "Y-m-d H:i:s";
$o = \DateTime::createFromFormat($format, $date);
$wnDay = date("N", strtotime($date));
$addD = (integer)((11 - $wnDay) % 7);
$o->add(new \D... | [
"public",
"static",
"function",
"firstWeekOfYear",
"(",
"int",
"$",
"y",
")",
":",
"\\",
"Datetime",
"{",
"$",
"date",
"=",
"(",
"string",
")",
"$",
"y",
".",
"\"-01-01 00:00:00\"",
";",
"$",
"format",
"=",
"\"Y-m-d H:i:s\"",
";",
"$",
"o",
"=",
"\\",
... | Retorna um objeto DateTime referente ao primeiro dia da primeira semana do ano informado.
@param int $y
Ano.
@return DateTime | [
"Retorna",
"um",
"objeto",
"DateTime",
"referente",
"ao",
"primeiro",
"dia",
"da",
"primeira",
"semana",
"do",
"ano",
"informado",
"."
] | 502fad10aadb37fce98bd3994e866a8bfdc8dc00 | https://github.com/AeonDigital/PHP-Tools/blob/502fad10aadb37fce98bd3994e866a8bfdc8dc00/src/Date.php#L181-L194 |
36,054 | AeonDigital/PHP-Tools | src/Date.php | Date.weeksInYear | public static function weeksInYear(int $y) : int
{
$lWeek = self::lastWeekOfYear($y);
return (int)$lWeek->format("W");
} | php | public static function weeksInYear(int $y) : int
{
$lWeek = self::lastWeekOfYear($y);
return (int)$lWeek->format("W");
} | [
"public",
"static",
"function",
"weeksInYear",
"(",
"int",
"$",
"y",
")",
":",
"int",
"{",
"$",
"lWeek",
"=",
"self",
"::",
"lastWeekOfYear",
"(",
"$",
"y",
")",
";",
"return",
"(",
"int",
")",
"$",
"lWeek",
"->",
"format",
"(",
"\"W\"",
")",
";",
... | Calcula a quantidade de semanas que o ano informado tem.
@param int $y
Ano.
@return int | [
"Calcula",
"a",
"quantidade",
"de",
"semanas",
"que",
"o",
"ano",
"informado",
"tem",
"."
] | 502fad10aadb37fce98bd3994e866a8bfdc8dc00 | https://github.com/AeonDigital/PHP-Tools/blob/502fad10aadb37fce98bd3994e866a8bfdc8dc00/src/Date.php#L224-L228 |
36,055 | AeonDigital/PHP-Tools | src/Date.php | Date.dateOfWeek | public static function dateOfWeek($obj) : ?\DateTime
{
$oD = null;
$wM = null;
if ($obj !== null) {
if (is_string($obj) === true) {
$wM = self::weekMember($obj);
$oD = self::dateOfWeek($wM);
} else {
if (is_array($obj) ... | php | public static function dateOfWeek($obj) : ?\DateTime
{
$oD = null;
$wM = null;
if ($obj !== null) {
if (is_string($obj) === true) {
$wM = self::weekMember($obj);
$oD = self::dateOfWeek($wM);
} else {
if (is_array($obj) ... | [
"public",
"static",
"function",
"dateOfWeek",
"(",
"$",
"obj",
")",
":",
"?",
"\\",
"DateTime",
"{",
"$",
"oD",
"=",
"null",
";",
"$",
"wM",
"=",
"null",
";",
"if",
"(",
"$",
"obj",
"!==",
"null",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"ob... | Retorna um DateTime conforme parametros passados.
@param mixed $sW
Texto no formato "week" ou
array associativo com os dados brutos da data.
@return ?DateTime | [
"Retorna",
"um",
"DateTime",
"conforme",
"parametros",
"passados",
"."
] | 502fad10aadb37fce98bd3994e866a8bfdc8dc00 | https://github.com/AeonDigital/PHP-Tools/blob/502fad10aadb37fce98bd3994e866a8bfdc8dc00/src/Date.php#L325-L363 |
36,056 | CMProductions/http-client | src/ClientBuilder.php | ClientBuilder.withGuzzleSender | public function withGuzzleSender(GuzzleClientInterface $client = null)
{
$this->sender = $this->buildGuzzleSender($client);
return $this;
} | php | public function withGuzzleSender(GuzzleClientInterface $client = null)
{
$this->sender = $this->buildGuzzleSender($client);
return $this;
} | [
"public",
"function",
"withGuzzleSender",
"(",
"GuzzleClientInterface",
"$",
"client",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"sender",
"=",
"$",
"this",
"->",
"buildGuzzleSender",
"(",
"$",
"client",
")",
";",
"return",
"$",
"this",
";",
"}"
] | Automatically generates a sender to use guzzle as a http client behind the scenes
IMPORTANT: you need to install 'guzzlehttp/guzzle' to use this feature
@param GuzzleClientInterface|null $client
@return $this | [
"Automatically",
"generates",
"a",
"sender",
"to",
"use",
"guzzle",
"as",
"a",
"http",
"client",
"behind",
"the",
"scenes"
] | d7e5a74cdf94b6b50a229db6698c81fd055ff2ce | https://github.com/CMProductions/http-client/blob/d7e5a74cdf94b6b50a229db6698c81fd055ff2ce/src/ClientBuilder.php#L69-L74 |
36,057 | CMProductions/http-client | src/ClientBuilder.php | ClientBuilder.withYamlConfig | public function withYamlConfig($file)
{
if (!class_exists(Yaml::class)) {
throw new RuntimeException("You need to install 'symfony/yaml' to use this feature");
}
if (!is_readable($file)) {
throw new RuntimeException("The configuration file is not readable");
... | php | public function withYamlConfig($file)
{
if (!class_exists(Yaml::class)) {
throw new RuntimeException("You need to install 'symfony/yaml' to use this feature");
}
if (!is_readable($file)) {
throw new RuntimeException("The configuration file is not readable");
... | [
"public",
"function",
"withYamlConfig",
"(",
"$",
"file",
")",
"{",
"if",
"(",
"!",
"class_exists",
"(",
"Yaml",
"::",
"class",
")",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"You need to install 'symfony/yaml' to use this feature\"",
")",
";",
"}",
"... | Allows you load the configuration from a yaml file
IMPORTANT: you need to install 'symfony/yaml' to use this feature
@param string $file
@return $this | [
"Allows",
"you",
"load",
"the",
"configuration",
"from",
"a",
"yaml",
"file"
] | d7e5a74cdf94b6b50a229db6698c81fd055ff2ce | https://github.com/CMProductions/http-client/blob/d7e5a74cdf94b6b50a229db6698c81fd055ff2ce/src/ClientBuilder.php#L113-L131 |
36,058 | CMProductions/http-client | src/ClientBuilder.php | ClientBuilder.withConsoleDebug | public function withConsoleDebug()
{
if (!class_exists(ConsoleLogger::class)) {
throw new RuntimeException("You need to install 'symfony/console' to use this feature");
}
$this->logger = new ConsoleLogger(new ConsoleOutput(), [LogLevel::DEBUG => ConsoleOutput::VERBOSITY_NORMAL])... | php | public function withConsoleDebug()
{
if (!class_exists(ConsoleLogger::class)) {
throw new RuntimeException("You need to install 'symfony/console' to use this feature");
}
$this->logger = new ConsoleLogger(new ConsoleOutput(), [LogLevel::DEBUG => ConsoleOutput::VERBOSITY_NORMAL])... | [
"public",
"function",
"withConsoleDebug",
"(",
")",
"{",
"if",
"(",
"!",
"class_exists",
"(",
"ConsoleLogger",
"::",
"class",
")",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"You need to install 'symfony/console' to use this feature\"",
")",
";",
"}",
"$",... | Setups a logger to output debug information to the console
@return $this | [
"Setups",
"a",
"logger",
"to",
"output",
"debug",
"information",
"to",
"the",
"console"
] | d7e5a74cdf94b6b50a229db6698c81fd055ff2ce | https://github.com/CMProductions/http-client/blob/d7e5a74cdf94b6b50a229db6698c81fd055ff2ce/src/ClientBuilder.php#L152-L161 |
36,059 | CMProductions/http-client | src/ClientBuilder.php | ClientBuilder.build | public function build($service = null)
{
if (!$this->sender) {
$this->sender = $this->buildGuzzleSender();
}
if (!$this->factory) {
throw new RuntimeException("You need to provide a configuration or a factory for requests");
}
if (!$this->logger) {
... | php | public function build($service = null)
{
if (!$this->sender) {
$this->sender = $this->buildGuzzleSender();
}
if (!$this->factory) {
throw new RuntimeException("You need to provide a configuration or a factory for requests");
}
if (!$this->logger) {
... | [
"public",
"function",
"build",
"(",
"$",
"service",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"sender",
")",
"{",
"$",
"this",
"->",
"sender",
"=",
"$",
"this",
"->",
"buildGuzzleSender",
"(",
")",
";",
"}",
"if",
"(",
"!",
"$",
... | Builds the client with the configured values
@param string|null $service
@return Client | [
"Builds",
"the",
"client",
"with",
"the",
"configured",
"values"
] | d7e5a74cdf94b6b50a229db6698c81fd055ff2ce | https://github.com/CMProductions/http-client/blob/d7e5a74cdf94b6b50a229db6698c81fd055ff2ce/src/ClientBuilder.php#L170-L185 |
36,060 | br-monteiro/htr-core | src/Database/AbstractModel.php | AbstractModel.inputValidate | protected static function inputValidate($data, string $jsonShemaFile): bool
{
$fullPath = cfg::baseDir() . cfg::JSON_SCHEMA . cfg::DS;
$jsonSchema = $fullPath . $jsonShemaFile;
if (Json::validate($data, $jsonSchema)) {
return true;
}
return false;
} | php | protected static function inputValidate($data, string $jsonShemaFile): bool
{
$fullPath = cfg::baseDir() . cfg::JSON_SCHEMA . cfg::DS;
$jsonSchema = $fullPath . $jsonShemaFile;
if (Json::validate($data, $jsonSchema)) {
return true;
}
return false;
} | [
"protected",
"static",
"function",
"inputValidate",
"(",
"$",
"data",
",",
"string",
"$",
"jsonShemaFile",
")",
":",
"bool",
"{",
"$",
"fullPath",
"=",
"cfg",
"::",
"baseDir",
"(",
")",
".",
"cfg",
"::",
"JSON_SCHEMA",
".",
"cfg",
"::",
"DS",
";",
"$",... | Validate the inpute of request
@author Edson B S Monteiro <bruno.monteirodg@gmail.com>
@since 1.0
@param \stdClass|array $data
@param string $jsonShemaFile
@return bool | [
"Validate",
"the",
"inpute",
"of",
"request"
] | 04c85684e9317fdc52c47aacb357661b4939fb4b | https://github.com/br-monteiro/htr-core/blob/04c85684e9317fdc52c47aacb357661b4939fb4b/src/Database/AbstractModel.php#L25-L35 |
36,061 | br-monteiro/htr-core | src/Database/AbstractModel.php | AbstractModel.commonError | protected static function commonError(Response $response, \Exception $ex): Response
{
$data = [
"message" => "Somethings are wrong",
"status" => "error"
];
if (cfg::htrFileConfigs()->devmode ?? false) {
$data['dev_error'] = $ex->getMessage();
}
... | php | protected static function commonError(Response $response, \Exception $ex): Response
{
$data = [
"message" => "Somethings are wrong",
"status" => "error"
];
if (cfg::htrFileConfigs()->devmode ?? false) {
$data['dev_error'] = $ex->getMessage();
}
... | [
"protected",
"static",
"function",
"commonError",
"(",
"Response",
"$",
"response",
",",
"\\",
"Exception",
"$",
"ex",
")",
":",
"Response",
"{",
"$",
"data",
"=",
"[",
"\"message\"",
"=>",
"\"Somethings are wrong\"",
",",
"\"status\"",
"=>",
"\"error\"",
"]",... | Return the Response Object configured with common error
@author Edson B S Monteiro <bruno.monteirodg@gmail.com>
@since 1.0
@param Response $response
@param \Exception $ex
@return Response | [
"Return",
"the",
"Response",
"Object",
"configured",
"with",
"common",
"error"
] | 04c85684e9317fdc52c47aacb357661b4939fb4b | https://github.com/br-monteiro/htr-core/blob/04c85684e9317fdc52c47aacb357661b4939fb4b/src/Database/AbstractModel.php#L46-L57 |
36,062 | br-monteiro/htr-core | src/Database/AbstractModel.php | AbstractModel.outputValidate | protected static function outputValidate($data): AbstractModel
{
if (!self::$that) {
self::$that = new AbstractModel;
}
self::$that->setData(result::adapter($data));
self::$that->setRawData($data);
return self::$that;
} | php | protected static function outputValidate($data): AbstractModel
{
if (!self::$that) {
self::$that = new AbstractModel;
}
self::$that->setData(result::adapter($data));
self::$that->setRawData($data);
return self::$that;
} | [
"protected",
"static",
"function",
"outputValidate",
"(",
"$",
"data",
")",
":",
"AbstractModel",
"{",
"if",
"(",
"!",
"self",
"::",
"$",
"that",
")",
"{",
"self",
"::",
"$",
"that",
"=",
"new",
"AbstractModel",
";",
"}",
"self",
"::",
"$",
"that",
"... | Initialize one new instance of AbstractModel
and configure it with the results of query
@author Edson B S Monteiro <bruno.monteirodg@gmail.com>
@since 1.0
@param mixed $data
@return \App\System\AbstractModel | [
"Initialize",
"one",
"new",
"instance",
"of",
"AbstractModel",
"and",
"configure",
"it",
"with",
"the",
"results",
"of",
"query"
] | 04c85684e9317fdc52c47aacb357661b4939fb4b | https://github.com/br-monteiro/htr-core/blob/04c85684e9317fdc52c47aacb357661b4939fb4b/src/Database/AbstractModel.php#L68-L78 |
36,063 | br-monteiro/htr-core | src/Database/AbstractModel.php | AbstractModel.addingAttribute | private function addingAttribute(\stdClass $obj, array $elements, int $dataKey)
{
foreach ($elements as $name => $value) {
try {
$obj->$name = is_callable($value) ? $value($this->rawData[$dataKey]) : $value;
} catch (\Exception $ex) {
throw new \Except... | php | private function addingAttribute(\stdClass $obj, array $elements, int $dataKey)
{
foreach ($elements as $name => $value) {
try {
$obj->$name = is_callable($value) ? $value($this->rawData[$dataKey]) : $value;
} catch (\Exception $ex) {
throw new \Except... | [
"private",
"function",
"addingAttribute",
"(",
"\\",
"stdClass",
"$",
"obj",
",",
"array",
"$",
"elements",
",",
"int",
"$",
"dataKey",
")",
"{",
"foreach",
"(",
"$",
"elements",
"as",
"$",
"name",
"=>",
"$",
"value",
")",
"{",
"try",
"{",
"$",
"obj"... | Adding new attributes into results for response
@author Edson B S Monteiro <bruno.monteirodg@gmail.com>
@since 1.0
@param \stdClass $obj
@param array $elements
@param int $dataKey
@return \stdClass
@throws \Exception | [
"Adding",
"new",
"attributes",
"into",
"results",
"for",
"response"
] | 04c85684e9317fdc52c47aacb357661b4939fb4b | https://github.com/br-monteiro/htr-core/blob/04c85684e9317fdc52c47aacb357661b4939fb4b/src/Database/AbstractModel.php#L128-L138 |
36,064 | br-monteiro/htr-core | src/Database/AbstractModel.php | AbstractModel.withAttribute | final public function withAttribute($name, $value = null, bool $inAllElements = false): self
{
// insert or update one or more attributes into all elements
if (is_array($this->data) && $inAllElements === true) {
foreach ($this->data as $dataKey => $element) {
if (is_array... | php | final public function withAttribute($name, $value = null, bool $inAllElements = false): self
{
// insert or update one or more attributes into all elements
if (is_array($this->data) && $inAllElements === true) {
foreach ($this->data as $dataKey => $element) {
if (is_array... | [
"final",
"public",
"function",
"withAttribute",
"(",
"$",
"name",
",",
"$",
"value",
"=",
"null",
",",
"bool",
"$",
"inAllElements",
"=",
"false",
")",
":",
"self",
"{",
"// insert or update one or more attributes into all elements",
"if",
"(",
"is_array",
"(",
... | Interface to adding new attributes into results
@author Edson B S Monteiro <bruno.monteirodg@gmail.com>
@since 1.0
@param mixed $name
@param mixed $value
@param bool $inAllElements
@return \self
@throws \Exception | [
"Interface",
"to",
"adding",
"new",
"attributes",
"into",
"results"
] | 04c85684e9317fdc52c47aacb357661b4939fb4b | https://github.com/br-monteiro/htr-core/blob/04c85684e9317fdc52c47aacb357661b4939fb4b/src/Database/AbstractModel.php#L151-L192 |
36,065 | br-monteiro/htr-core | src/Database/AbstractModel.php | AbstractModel.withoutAttribute | final public function withoutAttribute($name): self
{
// remove attributes when $name is a list (array) of attributes to be removed
// remove attributes from root data value
if (is_array($name)) {
foreach ($name as $attribute) {
if ($this->attributeExists($attrib... | php | final public function withoutAttribute($name): self
{
// remove attributes when $name is a list (array) of attributes to be removed
// remove attributes from root data value
if (is_array($name)) {
foreach ($name as $attribute) {
if ($this->attributeExists($attrib... | [
"final",
"public",
"function",
"withoutAttribute",
"(",
"$",
"name",
")",
":",
"self",
"{",
"// remove attributes when $name is a list (array) of attributes to be removed",
"// remove attributes from root data value",
"if",
"(",
"is_array",
"(",
"$",
"name",
")",
")",
"{",
... | Remove one attribute of result
@author Edson B S Monteiro <bruno.monteirodg@gmail.com>
@since 1.0
@param mixed $name
@return \self | [
"Remove",
"one",
"attribute",
"of",
"result"
] | 04c85684e9317fdc52c47aacb357661b4939fb4b | https://github.com/br-monteiro/htr-core/blob/04c85684e9317fdc52c47aacb357661b4939fb4b/src/Database/AbstractModel.php#L202-L236 |
36,066 | br-monteiro/htr-core | src/Utils/IterableUtils.php | IterableUtils.map | public static function map(array $arr, callable $callback): array
{
$arrResult = [];
foreach ($arr as $index => $value) {
$arrResult[] = $callback($value, $index);
}
return $arrResult;
} | php | public static function map(array $arr, callable $callback): array
{
$arrResult = [];
foreach ($arr as $index => $value) {
$arrResult[] = $callback($value, $index);
}
return $arrResult;
} | [
"public",
"static",
"function",
"map",
"(",
"array",
"$",
"arr",
",",
"callable",
"$",
"callback",
")",
":",
"array",
"{",
"$",
"arrResult",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"arr",
"as",
"$",
"index",
"=>",
"$",
"value",
")",
"{",
"$",
"a... | It goes through all the elements and performs the function of callabck
@param array $arr The array to be used
@param callable $callback Function fired in array elements
@return array | [
"It",
"goes",
"through",
"all",
"the",
"elements",
"and",
"performs",
"the",
"function",
"of",
"callabck"
] | 04c85684e9317fdc52c47aacb357661b4939fb4b | https://github.com/br-monteiro/htr-core/blob/04c85684e9317fdc52c47aacb357661b4939fb4b/src/Utils/IterableUtils.php#L14-L23 |
36,067 | br-monteiro/htr-core | src/Utils/IterableUtils.php | IterableUtils.find | public static function find(array $arr, callable $callback)
{
foreach ($arr as $index => $value) {
if ($callback($value, $index) === true) {
return $value;
}
}
return null;
} | php | public static function find(array $arr, callable $callback)
{
foreach ($arr as $index => $value) {
if ($callback($value, $index) === true) {
return $value;
}
}
return null;
} | [
"public",
"static",
"function",
"find",
"(",
"array",
"$",
"arr",
",",
"callable",
"$",
"callback",
")",
"{",
"foreach",
"(",
"$",
"arr",
"as",
"$",
"index",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"callback",
"(",
"$",
"value",
",",
"$",
"... | Find a value in array. Return the first found
@param array $arr The array to be used
@param callable $callback Function fired in array elements
@return mixed | [
"Find",
"a",
"value",
"in",
"array",
".",
"Return",
"the",
"first",
"found"
] | 04c85684e9317fdc52c47aacb357661b4939fb4b | https://github.com/br-monteiro/htr-core/blob/04c85684e9317fdc52c47aacb357661b4939fb4b/src/Utils/IterableUtils.php#L32-L41 |
36,068 | br-monteiro/htr-core | src/Utils/IterableUtils.php | IterableUtils.filter | public static function filter(array $arr, callable $callback): array
{
$arrResult = [];
foreach ($arr as $index => $value) {
if ($callback($value, $index) === true) {
$arrResult[] = $value;
}
}
return $arrResult;
} | php | public static function filter(array $arr, callable $callback): array
{
$arrResult = [];
foreach ($arr as $index => $value) {
if ($callback($value, $index) === true) {
$arrResult[] = $value;
}
}
return $arrResult;
} | [
"public",
"static",
"function",
"filter",
"(",
"array",
"$",
"arr",
",",
"callable",
"$",
"callback",
")",
":",
"array",
"{",
"$",
"arrResult",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"arr",
"as",
"$",
"index",
"=>",
"$",
"value",
")",
"{",
"if",
... | Filter the array according callback
@param array $arr The array to be used
@param callable $callback Function fired in array elements
@return array The array filtered | [
"Filter",
"the",
"array",
"according",
"callback"
] | 04c85684e9317fdc52c47aacb357661b4939fb4b | https://github.com/br-monteiro/htr-core/blob/04c85684e9317fdc52c47aacb357661b4939fb4b/src/Utils/IterableUtils.php#L50-L61 |
36,069 | br-monteiro/htr-core | src/Utils/IterableUtils.php | IterableUtils.only | public static function only(array $arr, callable $callback): bool
{
$arrLength = 0;
foreach ($arr as $index => $value) {
if ($callback($value, $index) === true) {
$arrLength++;
}
}
return $arrLength === 1;
} | php | public static function only(array $arr, callable $callback): bool
{
$arrLength = 0;
foreach ($arr as $index => $value) {
if ($callback($value, $index) === true) {
$arrLength++;
}
}
return $arrLength === 1;
} | [
"public",
"static",
"function",
"only",
"(",
"array",
"$",
"arr",
",",
"callable",
"$",
"callback",
")",
":",
"bool",
"{",
"$",
"arrLength",
"=",
"0",
";",
"foreach",
"(",
"$",
"arr",
"as",
"$",
"index",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"... | Verify if in all elements the condition is once accepted
@param array $arr The array to be used
@param $callback Function fired in array elements
@return bool | [
"Verify",
"if",
"in",
"all",
"elements",
"the",
"condition",
"is",
"once",
"accepted"
] | 04c85684e9317fdc52c47aacb357661b4939fb4b | https://github.com/br-monteiro/htr-core/blob/04c85684e9317fdc52c47aacb357661b4939fb4b/src/Utils/IterableUtils.php#L70-L81 |
36,070 | br-monteiro/htr-core | src/Utils/IterableUtils.php | IterableUtils.even | public static function even(array $arr, callable $callback): bool
{
if (count($arr) === 0) {
return false;
}
foreach ($arr as $index => $value) {
if ($callback($value, $index) !== true) { // false, 0 or null
return false;
}
}
... | php | public static function even(array $arr, callable $callback): bool
{
if (count($arr) === 0) {
return false;
}
foreach ($arr as $index => $value) {
if ($callback($value, $index) !== true) { // false, 0 or null
return false;
}
}
... | [
"public",
"static",
"function",
"even",
"(",
"array",
"$",
"arr",
",",
"callable",
"$",
"callback",
")",
":",
"bool",
"{",
"if",
"(",
"count",
"(",
"$",
"arr",
")",
"===",
"0",
")",
"{",
"return",
"false",
";",
"}",
"foreach",
"(",
"$",
"arr",
"a... | Verify if in all elements the condition is always accepted
@param array $arr The array to be used
@param $callback Function fired in array elements
@return bool | [
"Verify",
"if",
"in",
"all",
"elements",
"the",
"condition",
"is",
"always",
"accepted"
] | 04c85684e9317fdc52c47aacb357661b4939fb4b | https://github.com/br-monteiro/htr-core/blob/04c85684e9317fdc52c47aacb357661b4939fb4b/src/Utils/IterableUtils.php#L90-L103 |
36,071 | br-monteiro/htr-core | src/Utils/IterableUtils.php | IterableUtils.last | public static function last(array $arr, callable $callback)
{
$arrLength = count($arr);
if ($arrLength === 0) {
return null;
}
$index = $arrLength - 1;
while($index >= 0) {
if ($callback($arr[$index], $index) === true) {
return $arr[... | php | public static function last(array $arr, callable $callback)
{
$arrLength = count($arr);
if ($arrLength === 0) {
return null;
}
$index = $arrLength - 1;
while($index >= 0) {
if ($callback($arr[$index], $index) === true) {
return $arr[... | [
"public",
"static",
"function",
"last",
"(",
"array",
"$",
"arr",
",",
"callable",
"$",
"callback",
")",
"{",
"$",
"arrLength",
"=",
"count",
"(",
"$",
"arr",
")",
";",
"if",
"(",
"$",
"arrLength",
"===",
"0",
")",
"{",
"return",
"null",
";",
"}",
... | Find a value in array. Return the last found
@param array $arr The array to be used
@param callable $callback Function fired in array elements
@return mixed | [
"Find",
"a",
"value",
"in",
"array",
".",
"Return",
"the",
"last",
"found"
] | 04c85684e9317fdc52c47aacb357661b4939fb4b | https://github.com/br-monteiro/htr-core/blob/04c85684e9317fdc52c47aacb357661b4939fb4b/src/Utils/IterableUtils.php#L112-L130 |
36,072 | br-monteiro/htr-core | src/Common/DefaultContainer.php | DefaultContainer.setUp | private static function setUp(): Container
{
if (!self::$container) {
//Create Your container
self::$container = new Container();
}
$c = self::$container;
//$c['settings'] = Configuration::SLIM_SETTINGS['settings'];
// Not Found Configs
$c['no... | php | private static function setUp(): Container
{
if (!self::$container) {
//Create Your container
self::$container = new Container();
}
$c = self::$container;
//$c['settings'] = Configuration::SLIM_SETTINGS['settings'];
// Not Found Configs
$c['no... | [
"private",
"static",
"function",
"setUp",
"(",
")",
":",
"Container",
"{",
"if",
"(",
"!",
"self",
"::",
"$",
"container",
")",
"{",
"//Create Your container",
"self",
"::",
"$",
"container",
"=",
"new",
"Container",
"(",
")",
";",
"}",
"$",
"c",
"=",
... | Config the container used in Slim Framework
@author Edson B S Monteiro <bruno.monteirodg@gmail.com>
@since 1.0
@return Slim\Container | [
"Config",
"the",
"container",
"used",
"in",
"Slim",
"Framework"
] | 04c85684e9317fdc52c47aacb357661b4939fb4b | https://github.com/br-monteiro/htr-core/blob/04c85684e9317fdc52c47aacb357661b4939fb4b/src/Common/DefaultContainer.php#L28-L79 |
36,073 | hiqdev/hipanel-module-client | src/grid/ClientColumn.php | ClientColumn.init | public function init()
{
parent::init();
$this->visible = Yii::$app->user->can('access-subclients');
if (!$this->visible) {
return null;
}
if (!$this->sortAttribute) {
$this->sortAttribute = $this->nameAttribute;
}
if ($this->value ==... | php | public function init()
{
parent::init();
$this->visible = Yii::$app->user->can('access-subclients');
if (!$this->visible) {
return null;
}
if (!$this->sortAttribute) {
$this->sortAttribute = $this->nameAttribute;
}
if ($this->value ==... | [
"public",
"function",
"init",
"(",
")",
"{",
"parent",
"::",
"init",
"(",
")",
";",
"$",
"this",
"->",
"visible",
"=",
"Yii",
"::",
"$",
"app",
"->",
"user",
"->",
"can",
"(",
"'access-subclients'",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"v... | Sets visibility and default behaviour for value and filter when visible. | [
"Sets",
"visibility",
"and",
"default",
"behaviour",
"for",
"value",
"and",
"filter",
"when",
"visible",
"."
] | 569d87de369ccf8646087dde566d26a41995c8cb | https://github.com/hiqdev/hipanel-module-client/blob/569d87de369ccf8646087dde566d26a41995c8cb/src/grid/ClientColumn.php#L36-L67 |
36,074 | symbiote/php-wordpress-database-tools | src/WordpressAttachmentFileResolver.php | WordpressAttachmentFileResolver.isFileExtensionImage | public function isFileExtensionImage($name) {
static $imageExtensions = array(
'jpg' => true,
'png' => true,
'jpeg' => true,
'bmp' => true,
'ico' => true,
'gif' => true,
'tiff' => true,
'jpeg-large' => true,
'jpg-large' => true,
);
$ext = pathinfo($name, PATHINFO_EXTENSION);
return ($... | php | public function isFileExtensionImage($name) {
static $imageExtensions = array(
'jpg' => true,
'png' => true,
'jpeg' => true,
'bmp' => true,
'ico' => true,
'gif' => true,
'tiff' => true,
'jpeg-large' => true,
'jpg-large' => true,
);
$ext = pathinfo($name, PATHINFO_EXTENSION);
return ($... | [
"public",
"function",
"isFileExtensionImage",
"(",
"$",
"name",
")",
"{",
"static",
"$",
"imageExtensions",
"=",
"array",
"(",
"'jpg'",
"=>",
"true",
",",
"'png'",
"=>",
"true",
",",
"'jpeg'",
"=>",
"true",
",",
"'bmp'",
"=>",
"true",
",",
"'ico'",
"=>",... | Check if filename is image based on filename
@return boolean | [
"Check",
"if",
"filename",
"is",
"image",
"based",
"on",
"filename"
] | 93b1ae969722d7235dbbe6374f381daea0e0d5d7 | https://github.com/symbiote/php-wordpress-database-tools/blob/93b1ae969722d7235dbbe6374f381daea0e0d5d7/src/WordpressAttachmentFileResolver.php#L54-L68 |
36,075 | symbiote/php-wordpress-database-tools | src/WordpressAttachmentFileResolver.php | WordpressAttachmentFileResolver.getFilepathsFromRecord | public function getFilepathsFromRecord($wpData) {
if (isset($wpData['guid'])) {
// NOTE(Jake): Attempts to access cache to avoid function call overhead.
$files = ($this->_runtime_cache !== null) ? $this->_runtime_cache : $this->getFilesRecursive();
$basename = basename($wpData['guid']);
if (isset($files[$... | php | public function getFilepathsFromRecord($wpData) {
if (isset($wpData['guid'])) {
// NOTE(Jake): Attempts to access cache to avoid function call overhead.
$files = ($this->_runtime_cache !== null) ? $this->_runtime_cache : $this->getFilesRecursive();
$basename = basename($wpData['guid']);
if (isset($files[$... | [
"public",
"function",
"getFilepathsFromRecord",
"(",
"$",
"wpData",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"wpData",
"[",
"'guid'",
"]",
")",
")",
"{",
"// NOTE(Jake): Attempts to access cache to avoid function call overhead.",
"$",
"files",
"=",
"(",
"$",
"this"... | Returns an array of the files that have that basename.
If false = Cannot find file in database or on HDD
If null = Invalid data/array passed in.
@return array|false|null | [
"Returns",
"an",
"array",
"of",
"the",
"files",
"that",
"have",
"that",
"basename",
"."
] | 93b1ae969722d7235dbbe6374f381daea0e0d5d7 | https://github.com/symbiote/php-wordpress-database-tools/blob/93b1ae969722d7235dbbe6374f381daea0e0d5d7/src/WordpressAttachmentFileResolver.php#L190-L201 |
36,076 | stubbles/stubbles-console | src/main/php/creator/ConsoleAppCreator.php | ConsoleAppCreator.run | public function run(): int
{
$className = $this->console->writeLine('Stubbles ConsoleAppCreator')
->writeLine(' (c) 2012-2016 Stubbles Development Group')
->writeEmptyLine()
->prompt('Please enter the full qualified class name for the console app: ')
... | php | public function run(): int
{
$className = $this->console->writeLine('Stubbles ConsoleAppCreator')
->writeLine(' (c) 2012-2016 Stubbles Development Group')
->writeEmptyLine()
->prompt('Please enter the full qualified class name for the console app: ')
... | [
"public",
"function",
"run",
"(",
")",
":",
"int",
"{",
"$",
"className",
"=",
"$",
"this",
"->",
"console",
"->",
"writeLine",
"(",
"'Stubbles ConsoleAppCreator'",
")",
"->",
"writeLine",
"(",
"' (c) 2012-2016 Stubbles Development Group'",
")",
"->",
"writeEmptyL... | runs the command and returns an exit code
@return int | [
"runs",
"the",
"command",
"and",
"returns",
"an",
"exit",
"code"
] | 9b8d8e0d92e3c6b629a0fa860ace957016d20047 | https://github.com/stubbles/stubbles-console/blob/9b8d8e0d92e3c6b629a0fa860ace957016d20047/src/main/php/creator/ConsoleAppCreator.php#L69-L85 |
36,077 | gdbots/query-parser-php | src/Builder/ElasticaQueryBuilder.php | ElasticaQueryBuilder.addTermToQuery | protected function addTermToQuery(string $method, Node $node, ?Field $field = null, bool $cacheable = false): void
{
if ($node instanceof Emoji && $this->ignoreEmojis) {
return;
}
if ($node instanceof Emoticon && $this->ignoreEmoticons) {
return;
}
$... | php | protected function addTermToQuery(string $method, Node $node, ?Field $field = null, bool $cacheable = false): void
{
if ($node instanceof Emoji && $this->ignoreEmojis) {
return;
}
if ($node instanceof Emoticon && $this->ignoreEmoticons) {
return;
}
$... | [
"protected",
"function",
"addTermToQuery",
"(",
"string",
"$",
"method",
",",
"Node",
"$",
"node",
",",
"?",
"Field",
"$",
"field",
"=",
"null",
",",
"bool",
"$",
"cacheable",
"=",
"false",
")",
":",
"void",
"{",
"if",
"(",
"$",
"node",
"instanceof",
... | Adds a term to the bool query or filter context. Filter context is used when the
request for that item could be cached, like documents with hashtag of cats.
@param string $method
@param Node $node
@param Field $field
@param bool $cacheable | [
"Adds",
"a",
"term",
"to",
"the",
"bool",
"query",
"or",
"filter",
"context",
".",
"Filter",
"context",
"is",
"used",
"when",
"the",
"request",
"for",
"that",
"item",
"could",
"be",
"cached",
"like",
"documents",
"with",
"hashtag",
"of",
"cats",
"."
] | bc5d0238d7fe3481ec9649875581d26571d6851b | https://github.com/gdbots/query-parser-php/blob/bc5d0238d7fe3481ec9649875581d26571d6851b/src/Builder/ElasticaQueryBuilder.php#L444-L500 |
36,078 | gdbots/query-parser-php | src/Node/Date.php | Date.toDateTime | public function toDateTime(\DateTimeZone $timeZone = null): \DateTime
{
if (null === self::$utc) {
self::$utc = new \DateTimeZone('UTC');
}
$date = \DateTime::createFromFormat('!Y-m-d', $this->getValue(), $timeZone ?: self::$utc);
if (!$date instanceof \DateTime) {
... | php | public function toDateTime(\DateTimeZone $timeZone = null): \DateTime
{
if (null === self::$utc) {
self::$utc = new \DateTimeZone('UTC');
}
$date = \DateTime::createFromFormat('!Y-m-d', $this->getValue(), $timeZone ?: self::$utc);
if (!$date instanceof \DateTime) {
... | [
"public",
"function",
"toDateTime",
"(",
"\\",
"DateTimeZone",
"$",
"timeZone",
"=",
"null",
")",
":",
"\\",
"DateTime",
"{",
"if",
"(",
"null",
"===",
"self",
"::",
"$",
"utc",
")",
"{",
"self",
"::",
"$",
"utc",
"=",
"new",
"\\",
"DateTimeZone",
"(... | Always returns a DateTime in UTC. Use the time zone option to inform this class
that the value it holds is localized and should be converted to UTC.
@param \DateTimeZone $timeZone
@return \DateTime | [
"Always",
"returns",
"a",
"DateTime",
"in",
"UTC",
".",
"Use",
"the",
"time",
"zone",
"option",
"to",
"inform",
"this",
"class",
"that",
"the",
"value",
"it",
"holds",
"is",
"localized",
"and",
"should",
"be",
"converted",
"to",
"UTC",
"."
] | bc5d0238d7fe3481ec9649875581d26571d6851b | https://github.com/gdbots/query-parser-php/blob/bc5d0238d7fe3481ec9649875581d26571d6851b/src/Node/Date.php#L116-L132 |
36,079 | gdbots/query-parser-php | src/TokenStream.php | TokenStream.reset | public function reset(): self
{
$this->position = 0;
$this->current = isset($this->tokens[$this->position]) ? $this->tokens[$this->position] : self::$eoi;
return $this;
} | php | public function reset(): self
{
$this->position = 0;
$this->current = isset($this->tokens[$this->position]) ? $this->tokens[$this->position] : self::$eoi;
return $this;
} | [
"public",
"function",
"reset",
"(",
")",
":",
"self",
"{",
"$",
"this",
"->",
"position",
"=",
"0",
";",
"$",
"this",
"->",
"current",
"=",
"isset",
"(",
"$",
"this",
"->",
"tokens",
"[",
"$",
"this",
"->",
"position",
"]",
")",
"?",
"$",
"this",... | Resets the stream.
@return self | [
"Resets",
"the",
"stream",
"."
] | bc5d0238d7fe3481ec9649875581d26571d6851b | https://github.com/gdbots/query-parser-php/blob/bc5d0238d7fe3481ec9649875581d26571d6851b/src/TokenStream.php#L38-L43 |
36,080 | gdbots/query-parser-php | src/TokenStream.php | TokenStream.next | public function next(): bool
{
$this->current = isset($this->tokens[$this->position]) ? $this->tokens[$this->position++] : self::$eoi;
return !$this->current->typeEquals(Token::T_EOI);
} | php | public function next(): bool
{
$this->current = isset($this->tokens[$this->position]) ? $this->tokens[$this->position++] : self::$eoi;
return !$this->current->typeEquals(Token::T_EOI);
} | [
"public",
"function",
"next",
"(",
")",
":",
"bool",
"{",
"$",
"this",
"->",
"current",
"=",
"isset",
"(",
"$",
"this",
"->",
"tokens",
"[",
"$",
"this",
"->",
"position",
"]",
")",
"?",
"$",
"this",
"->",
"tokens",
"[",
"$",
"this",
"->",
"posit... | Increments the position and sets the current token to the previous token.
Returns true if the new "current" is not EOI.
@return bool | [
"Increments",
"the",
"position",
"and",
"sets",
"the",
"current",
"token",
"to",
"the",
"previous",
"token",
".",
"Returns",
"true",
"if",
"the",
"new",
"current",
"is",
"not",
"EOI",
"."
] | bc5d0238d7fe3481ec9649875581d26571d6851b | https://github.com/gdbots/query-parser-php/blob/bc5d0238d7fe3481ec9649875581d26571d6851b/src/TokenStream.php#L51-L55 |
36,081 | gdbots/query-parser-php | src/TokenStream.php | TokenStream.skipUntil | public function skipUntil(int $type): void
{
while (!$this->current->typeEquals($type) && !$this->current->typeEquals(Token::T_EOI)) {
$this->next();
}
} | php | public function skipUntil(int $type): void
{
while (!$this->current->typeEquals($type) && !$this->current->typeEquals(Token::T_EOI)) {
$this->next();
}
} | [
"public",
"function",
"skipUntil",
"(",
"int",
"$",
"type",
")",
":",
"void",
"{",
"while",
"(",
"!",
"$",
"this",
"->",
"current",
"->",
"typeEquals",
"(",
"$",
"type",
")",
"&&",
"!",
"$",
"this",
"->",
"current",
"->",
"typeEquals",
"(",
"Token",
... | Skips tokens until it sees a token with the given value.
@param int $type | [
"Skips",
"tokens",
"until",
"it",
"sees",
"a",
"token",
"with",
"the",
"given",
"value",
"."
] | bc5d0238d7fe3481ec9649875581d26571d6851b | https://github.com/gdbots/query-parser-php/blob/bc5d0238d7fe3481ec9649875581d26571d6851b/src/TokenStream.php#L62-L67 |
36,082 | gdbots/query-parser-php | src/TokenStream.php | TokenStream.nextIf | public function nextIf(int $type): bool
{
if (!$this->current->typeEquals($type)) {
return false;
}
$this->next();
return true;
} | php | public function nextIf(int $type): bool
{
if (!$this->current->typeEquals($type)) {
return false;
}
$this->next();
return true;
} | [
"public",
"function",
"nextIf",
"(",
"int",
"$",
"type",
")",
":",
"bool",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"current",
"->",
"typeEquals",
"(",
"$",
"type",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"this",
"->",
"next",
"(",
")",
... | If the current token type matches the given type, move to the next token.
Returns true if next was fired.
@param int $type
@return bool | [
"If",
"the",
"current",
"token",
"type",
"matches",
"the",
"given",
"type",
"move",
"to",
"the",
"next",
"token",
".",
"Returns",
"true",
"if",
"next",
"was",
"fired",
"."
] | bc5d0238d7fe3481ec9649875581d26571d6851b | https://github.com/gdbots/query-parser-php/blob/bc5d0238d7fe3481ec9649875581d26571d6851b/src/TokenStream.php#L77-L85 |
36,083 | gdbots/query-parser-php | src/TokenStream.php | TokenStream.nextIfAnyOf | public function nextIfAnyOf(array $types): bool
{
if (!$this->current->typeEqualsAnyOf($types)) {
return false;
}
$this->next();
return true;
} | php | public function nextIfAnyOf(array $types): bool
{
if (!$this->current->typeEqualsAnyOf($types)) {
return false;
}
$this->next();
return true;
} | [
"public",
"function",
"nextIfAnyOf",
"(",
"array",
"$",
"types",
")",
":",
"bool",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"current",
"->",
"typeEqualsAnyOf",
"(",
"$",
"types",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"this",
"->",
"next",
... | If the current token type matches any of the given types, move to the next token.
Returns true if next was fired.
@param int[] $types
@return bool | [
"If",
"the",
"current",
"token",
"type",
"matches",
"any",
"of",
"the",
"given",
"types",
"move",
"to",
"the",
"next",
"token",
".",
"Returns",
"true",
"if",
"next",
"was",
"fired",
"."
] | bc5d0238d7fe3481ec9649875581d26571d6851b | https://github.com/gdbots/query-parser-php/blob/bc5d0238d7fe3481ec9649875581d26571d6851b/src/TokenStream.php#L95-L103 |
36,084 | gdbots/query-parser-php | src/TokenStream.php | TokenStream.nextIfLookahead | public function nextIfLookahead(int $type): bool
{
if (!isset($this->tokens[$this->position]) || !$this->tokens[$this->position]->typeEquals($type)) {
return false;
}
$this->next();
return true;
} | php | public function nextIfLookahead(int $type): bool
{
if (!isset($this->tokens[$this->position]) || !$this->tokens[$this->position]->typeEquals($type)) {
return false;
}
$this->next();
return true;
} | [
"public",
"function",
"nextIfLookahead",
"(",
"int",
"$",
"type",
")",
":",
"bool",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"tokens",
"[",
"$",
"this",
"->",
"position",
"]",
")",
"||",
"!",
"$",
"this",
"->",
"tokens",
"[",
"$",
"t... | If the lookahead token type matches the given type, move to the next token.
@param int $type
@return bool | [
"If",
"the",
"lookahead",
"token",
"type",
"matches",
"the",
"given",
"type",
"move",
"to",
"the",
"next",
"token",
"."
] | bc5d0238d7fe3481ec9649875581d26571d6851b | https://github.com/gdbots/query-parser-php/blob/bc5d0238d7fe3481ec9649875581d26571d6851b/src/TokenStream.php#L112-L120 |
36,085 | gdbots/query-parser-php | src/TokenStream.php | TokenStream.nextIfLookaheadAnyOf | public function nextIfLookaheadAnyOf(array $types): bool
{
if (!isset($this->tokens[$this->position]) || !$this->tokens[$this->position]->typeEqualsAnyOf($types)) {
return false;
}
$this->next();
return true;
} | php | public function nextIfLookaheadAnyOf(array $types): bool
{
if (!isset($this->tokens[$this->position]) || !$this->tokens[$this->position]->typeEqualsAnyOf($types)) {
return false;
}
$this->next();
return true;
} | [
"public",
"function",
"nextIfLookaheadAnyOf",
"(",
"array",
"$",
"types",
")",
":",
"bool",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"tokens",
"[",
"$",
"this",
"->",
"position",
"]",
")",
"||",
"!",
"$",
"this",
"->",
"tokens",
"[",
"... | If the lookahead token type matches any of the given types, move to the next token.
@param int[] $types
@return bool | [
"If",
"the",
"lookahead",
"token",
"type",
"matches",
"any",
"of",
"the",
"given",
"types",
"move",
"to",
"the",
"next",
"token",
"."
] | bc5d0238d7fe3481ec9649875581d26571d6851b | https://github.com/gdbots/query-parser-php/blob/bc5d0238d7fe3481ec9649875581d26571d6851b/src/TokenStream.php#L129-L137 |
36,086 | gdbots/query-parser-php | src/TokenStream.php | TokenStream.lookaheadTypeIs | public function lookaheadTypeIs(int $type): bool
{
return isset($this->tokens[$this->position]) && $this->tokens[$this->position]->typeEquals($type);
} | php | public function lookaheadTypeIs(int $type): bool
{
return isset($this->tokens[$this->position]) && $this->tokens[$this->position]->typeEquals($type);
} | [
"public",
"function",
"lookaheadTypeIs",
"(",
"int",
"$",
"type",
")",
":",
"bool",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"tokens",
"[",
"$",
"this",
"->",
"position",
"]",
")",
"&&",
"$",
"this",
"->",
"tokens",
"[",
"$",
"this",
"->",
"... | Returns true if the lookahead type equals the given type.
@param int $type
@return bool | [
"Returns",
"true",
"if",
"the",
"lookahead",
"type",
"equals",
"the",
"given",
"type",
"."
] | bc5d0238d7fe3481ec9649875581d26571d6851b | https://github.com/gdbots/query-parser-php/blob/bc5d0238d7fe3481ec9649875581d26571d6851b/src/TokenStream.php#L170-L173 |
36,087 | gdbots/query-parser-php | src/TokenStream.php | TokenStream.lookaheadTypeIsAnyOf | public function lookaheadTypeIsAnyOf(array $types): bool
{
return isset($this->tokens[$this->position]) && $this->tokens[$this->position]->typeEqualsAnyOf($types);
} | php | public function lookaheadTypeIsAnyOf(array $types): bool
{
return isset($this->tokens[$this->position]) && $this->tokens[$this->position]->typeEqualsAnyOf($types);
} | [
"public",
"function",
"lookaheadTypeIsAnyOf",
"(",
"array",
"$",
"types",
")",
":",
"bool",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"tokens",
"[",
"$",
"this",
"->",
"position",
"]",
")",
"&&",
"$",
"this",
"->",
"tokens",
"[",
"$",
"this",
"... | Returns true if the lookahead type equals any of the given types.
@param array $types
@return bool | [
"Returns",
"true",
"if",
"the",
"lookahead",
"type",
"equals",
"any",
"of",
"the",
"given",
"types",
"."
] | bc5d0238d7fe3481ec9649875581d26571d6851b | https://github.com/gdbots/query-parser-php/blob/bc5d0238d7fe3481ec9649875581d26571d6851b/src/TokenStream.php#L182-L185 |
36,088 | gdbots/query-parser-php | src/TokenStream.php | TokenStream.prevTypeIsAnyOf | public function prevTypeIsAnyOf(array $types): bool
{
return isset($this->tokens[$this->position - 2]) && $this->tokens[$this->position - 2]->typeEqualsAnyOf($types);
} | php | public function prevTypeIsAnyOf(array $types): bool
{
return isset($this->tokens[$this->position - 2]) && $this->tokens[$this->position - 2]->typeEqualsAnyOf($types);
} | [
"public",
"function",
"prevTypeIsAnyOf",
"(",
"array",
"$",
"types",
")",
":",
"bool",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"tokens",
"[",
"$",
"this",
"->",
"position",
"-",
"2",
"]",
")",
"&&",
"$",
"this",
"->",
"tokens",
"[",
"$",
"t... | Returns true if the previous token type equals any of the given types.
@param array $types
@return bool | [
"Returns",
"true",
"if",
"the",
"previous",
"token",
"type",
"equals",
"any",
"of",
"the",
"given",
"types",
"."
] | bc5d0238d7fe3481ec9649875581d26571d6851b | https://github.com/gdbots/query-parser-php/blob/bc5d0238d7fe3481ec9649875581d26571d6851b/src/TokenStream.php#L206-L209 |
36,089 | gdbots/query-parser-php | src/ParsedQuery.php | ParsedQuery.hasAMatchableNode | public function hasAMatchableNode(): bool
{
foreach ($this->nodes as $node) {
if (!$node->isProhibited()) {
return true;
}
}
return false;
} | php | public function hasAMatchableNode(): bool
{
foreach ($this->nodes as $node) {
if (!$node->isProhibited()) {
return true;
}
}
return false;
} | [
"public",
"function",
"hasAMatchableNode",
"(",
")",
":",
"bool",
"{",
"foreach",
"(",
"$",
"this",
"->",
"nodes",
"as",
"$",
"node",
")",
"{",
"if",
"(",
"!",
"$",
"node",
"->",
"isProhibited",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
... | Returns true if the parsed query contains at least one request for an item
matching the query. If all of the nodes are "prohibited" values it
can easily review your entire index.
@return bool | [
"Returns",
"true",
"if",
"the",
"parsed",
"query",
"contains",
"at",
"least",
"one",
"request",
"for",
"an",
"item",
"matching",
"the",
"query",
".",
"If",
"all",
"of",
"the",
"nodes",
"are",
"prohibited",
"values",
"it",
"can",
"easily",
"review",
"your",... | bc5d0238d7fe3481ec9649875581d26571d6851b | https://github.com/gdbots/query-parser-php/blob/bc5d0238d7fe3481ec9649875581d26571d6851b/src/ParsedQuery.php#L102-L111 |
36,090 | timtoday/voyager-cn | src/Http/Controllers/Traits/BreadRelationshipParser.php | BreadRelationshipParser.getRelationships | protected function getRelationships(DataType $dataType)
{
$relationships = [];
$dataType->browseRows->each(function ($item) use (&$relationships) {
$details = json_decode($item->details);
if (isset($details->relationship) && isset($item->field)) {
$relation =... | php | protected function getRelationships(DataType $dataType)
{
$relationships = [];
$dataType->browseRows->each(function ($item) use (&$relationships) {
$details = json_decode($item->details);
if (isset($details->relationship) && isset($item->field)) {
$relation =... | [
"protected",
"function",
"getRelationships",
"(",
"DataType",
"$",
"dataType",
")",
"{",
"$",
"relationships",
"=",
"[",
"]",
";",
"$",
"dataType",
"->",
"browseRows",
"->",
"each",
"(",
"function",
"(",
"$",
"item",
")",
"use",
"(",
"&",
"$",
"relations... | Build the relationships array for the model's eager load.
@param DataType $dataType
@return array | [
"Build",
"the",
"relationships",
"array",
"for",
"the",
"model",
"s",
"eager",
"load",
"."
] | 4c36c25ee411aefecea13a95d99497810e49e418 | https://github.com/timtoday/voyager-cn/blob/4c36c25ee411aefecea13a95d99497810e49e418/src/Http/Controllers/Traits/BreadRelationshipParser.php#L20-L48 |
36,091 | timtoday/voyager-cn | src/Http/Controllers/Traits/BreadRelationshipParser.php | BreadRelationshipParser.resolveRelations | protected function resolveRelations($dataTypeContent, DataType $dataType)
{
// In case of using server-side pagination, we need to work on the Collection (BROWSE)
if ($dataTypeContent instanceof LengthAwarePaginator) {
$dataTypeCollection = $dataTypeContent->getCollection();
}
... | php | protected function resolveRelations($dataTypeContent, DataType $dataType)
{
// In case of using server-side pagination, we need to work on the Collection (BROWSE)
if ($dataTypeContent instanceof LengthAwarePaginator) {
$dataTypeCollection = $dataTypeContent->getCollection();
}
... | [
"protected",
"function",
"resolveRelations",
"(",
"$",
"dataTypeContent",
",",
"DataType",
"$",
"dataType",
")",
"{",
"// In case of using server-side pagination, we need to work on the Collection (BROWSE)",
"if",
"(",
"$",
"dataTypeContent",
"instanceof",
"LengthAwarePaginator",... | Replace relationships' keys for labels and create READ links if a slug is provided.
@param $dataTypeContent Can be either an eloquent Model, Collection or LengthAwarePaginator instance.
@param DataType $dataType
@return $dataTypeContent | [
"Replace",
"relationships",
"keys",
"for",
"labels",
"and",
"create",
"READ",
"links",
"if",
"a",
"slug",
"is",
"provided",
"."
] | 4c36c25ee411aefecea13a95d99497810e49e418 | https://github.com/timtoday/voyager-cn/blob/4c36c25ee411aefecea13a95d99497810e49e418/src/Http/Controllers/Traits/BreadRelationshipParser.php#L58-L78 |
36,092 | timtoday/voyager-cn | src/Traits/Translatable.php | Translatable.translate | public function translate($language = null, $fallback = true)
{
if ($this->relationLoaded('translations')) {
$this->load('translations');
}
return (new Translator($this))->translate($language, $fallback);
} | php | public function translate($language = null, $fallback = true)
{
if ($this->relationLoaded('translations')) {
$this->load('translations');
}
return (new Translator($this))->translate($language, $fallback);
} | [
"public",
"function",
"translate",
"(",
"$",
"language",
"=",
"null",
",",
"$",
"fallback",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"relationLoaded",
"(",
"'translations'",
")",
")",
"{",
"$",
"this",
"->",
"load",
"(",
"'translations'",
"... | Translate the whole model.
@param null|string $language
@param bool[string $fallback
@return Translator | [
"Translate",
"the",
"whole",
"model",
"."
] | 4c36c25ee411aefecea13a95d99497810e49e418 | https://github.com/timtoday/voyager-cn/blob/4c36c25ee411aefecea13a95d99497810e49e418/src/Traits/Translatable.php#L108-L115 |
36,093 | timtoday/voyager-cn | src/Http/Controllers/VoyagerMenuController.php | VoyagerMenuController.saveMenuTranslations | protected function saveMenuTranslations($_menuItem, &$data, $action)
{
if (isBreadTranslatable($_menuItem)) {
$key = $action.'_title_i18n';
$trans = json_decode($data[$key], true);
// Set field value with the default locale
$data['title'] = $trans[config('voy... | php | protected function saveMenuTranslations($_menuItem, &$data, $action)
{
if (isBreadTranslatable($_menuItem)) {
$key = $action.'_title_i18n';
$trans = json_decode($data[$key], true);
// Set field value with the default locale
$data['title'] = $trans[config('voy... | [
"protected",
"function",
"saveMenuTranslations",
"(",
"$",
"_menuItem",
",",
"&",
"$",
"data",
",",
"$",
"action",
")",
"{",
"if",
"(",
"isBreadTranslatable",
"(",
"$",
"_menuItem",
")",
")",
"{",
"$",
"key",
"=",
"$",
"action",
".",
"'_title_i18n'",
";"... | Save menu translations.
@param object $_menuItem
@param array $data menu data
@param string $action add or edit action
@return JSON translated item | [
"Save",
"menu",
"translations",
"."
] | 4c36c25ee411aefecea13a95d99497810e49e418 | https://github.com/timtoday/voyager-cn/blob/4c36c25ee411aefecea13a95d99497810e49e418/src/Http/Controllers/VoyagerMenuController.php#L145-L161 |
36,094 | timtoday/voyager-cn | src/Http/Controllers/VoyagerMediaController.php | VoyagerMediaController.get_all_dirs | public function get_all_dirs(Request $request)
{
$folderLocation = $request->folder_location;
if (is_array($folderLocation)) {
$folderLocation = rtrim(implode('/', $folderLocation), '/');
}
$location = "{$this->directory}/{$folderLocation}";
return response()->... | php | public function get_all_dirs(Request $request)
{
$folderLocation = $request->folder_location;
if (is_array($folderLocation)) {
$folderLocation = rtrim(implode('/', $folderLocation), '/');
}
$location = "{$this->directory}/{$folderLocation}";
return response()->... | [
"public",
"function",
"get_all_dirs",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"folderLocation",
"=",
"$",
"request",
"->",
"folder_location",
";",
"if",
"(",
"is_array",
"(",
"$",
"folderLocation",
")",
")",
"{",
"$",
"folderLocation",
"=",
"rtrim",
... | GET ALL DIRECTORIES Working with Laravel 5.3 | [
"GET",
"ALL",
"DIRECTORIES",
"Working",
"with",
"Laravel",
"5",
".",
"3"
] | 4c36c25ee411aefecea13a95d99497810e49e418 | https://github.com/timtoday/voyager-cn/blob/4c36c25ee411aefecea13a95d99497810e49e418/src/Http/Controllers/VoyagerMediaController.php#L99-L112 |
36,095 | timtoday/voyager-cn | src/Http/Controllers/VoyagerDatabaseController.php | VoyagerDatabaseController.update | public function update(Request $request)
{
Voyager::canOrFail('browse_database');
$table = json_decode($request->table, true);
try {
DatabaseUpdater::update($table);
// TODO: synch BREAD with Table
// $this->cleanOldAndCreateNew($request->original_name, ... | php | public function update(Request $request)
{
Voyager::canOrFail('browse_database');
$table = json_decode($request->table, true);
try {
DatabaseUpdater::update($table);
// TODO: synch BREAD with Table
// $this->cleanOldAndCreateNew($request->original_name, ... | [
"public",
"function",
"update",
"(",
"Request",
"$",
"request",
")",
"{",
"Voyager",
"::",
"canOrFail",
"(",
"'browse_database'",
")",
";",
"$",
"table",
"=",
"json_decode",
"(",
"$",
"request",
"->",
"table",
",",
"true",
")",
";",
"try",
"{",
"Database... | Update database table.
@param \Illuminate\Http\Request $request
@return \Illuminate\Http\RedirectResponse | [
"Update",
"database",
"table",
"."
] | 4c36c25ee411aefecea13a95d99497810e49e418 | https://github.com/timtoday/voyager-cn/blob/4c36c25ee411aefecea13a95d99497810e49e418/src/Http/Controllers/VoyagerDatabaseController.php#L110-L127 |
36,096 | yawik/install | src/Filter/DbNameExtractor.php | DbNameExtractor.filter | public function filter($value)
{
// extract database
$dbName = preg_match('~^mongodb://[^/]+/([^\?]+)~', $value, $match)
? $match[1]
: $this->getDefaultDatabaseName();
return $dbName;
} | php | public function filter($value)
{
// extract database
$dbName = preg_match('~^mongodb://[^/]+/([^\?]+)~', $value, $match)
? $match[1]
: $this->getDefaultDatabaseName();
return $dbName;
} | [
"public",
"function",
"filter",
"(",
"$",
"value",
")",
"{",
"// extract database",
"$",
"dbName",
"=",
"preg_match",
"(",
"'~^mongodb://[^/]+/([^\\?]+)~'",
",",
"$",
"value",
",",
"$",
"match",
")",
"?",
"$",
"match",
"[",
"1",
"]",
":",
"$",
"this",
"-... | Extracts the database name of a mongo db connection string.
If no database is specified in the connection string, the default
value {@link defaultDatabaseName} is returned.
@param mixed $value
@return string | [
"Extracts",
"the",
"database",
"name",
"of",
"a",
"mongo",
"db",
"connection",
"string",
"."
] | 1283d512a852d305e18d311c3eb1a84da98b9656 | https://github.com/yawik/install/blob/1283d512a852d305e18d311c3eb1a84da98b9656/src/Filter/DbNameExtractor.php#L81-L89 |
36,097 | n2n/n2n-web | src/app/n2n/web/ui/view/View.php | View.compile | protected function compile(OutputBuffer $contentBuffer, BuildContext $buildContext) {
$n2nContext = $this->getN2nContext();
return $this->bufferContents(array('request' => $this->getHttpContext()->getRequest(),
'response' => $this->getHttpContext()->getResponse(), 'view' => $this,
'httpContext' => $thi... | php | protected function compile(OutputBuffer $contentBuffer, BuildContext $buildContext) {
$n2nContext = $this->getN2nContext();
return $this->bufferContents(array('request' => $this->getHttpContext()->getRequest(),
'response' => $this->getHttpContext()->getResponse(), 'view' => $this,
'httpContext' => $thi... | [
"protected",
"function",
"compile",
"(",
"OutputBuffer",
"$",
"contentBuffer",
",",
"BuildContext",
"$",
"buildContext",
")",
"{",
"$",
"n2nContext",
"=",
"$",
"this",
"->",
"getN2nContext",
"(",
")",
";",
"return",
"$",
"this",
"->",
"bufferContents",
"(",
... | Builds view content
@return OutputBuffer | [
"Builds",
"view",
"content"
] | 1640c79f05d10d73093b98b70860ef8076d23e81 | https://github.com/n2n/n2n-web/blob/1640c79f05d10d73093b98b70860ef8076d23e81/src/app/n2n/web/ui/view/View.php#L461-L466 |
36,098 | yawik/install | src/Controller/Plugin/UserCreator.php | UserCreator.process | public function process($username, $password, $email)
{
$dm = $this->documentManager;
/* @var UserRepository $repo */
$repo = $dm->getRepository(User::class);
$credential = $this->credentialFilter->filter($password);
$info = new Info();
$info->setEmail($email);
... | php | public function process($username, $password, $email)
{
$dm = $this->documentManager;
/* @var UserRepository $repo */
$repo = $dm->getRepository(User::class);
$credential = $this->credentialFilter->filter($password);
$info = new Info();
$info->setEmail($email);
... | [
"public",
"function",
"process",
"(",
"$",
"username",
",",
"$",
"password",
",",
"$",
"email",
")",
"{",
"$",
"dm",
"=",
"$",
"this",
"->",
"documentManager",
";",
"/* @var UserRepository $repo */",
"$",
"repo",
"=",
"$",
"dm",
"->",
"getRepository",
"(",... | Inserts a minimalistic user document into the database.
@param string $username Login name
@param string $password Credential
@param string $email Email
@throws \Exception when fail store user entity
@return bool | [
"Inserts",
"a",
"minimalistic",
"user",
"document",
"into",
"the",
"database",
"."
] | 1283d512a852d305e18d311c3eb1a84da98b9656 | https://github.com/yawik/install/blob/1283d512a852d305e18d311c3eb1a84da98b9656/src/Controller/Plugin/UserCreator.php#L63-L89 |
36,099 | yawik/install | src/Validator/MongoDbConnectionString.php | MongoDbConnectionString.isValid | public function isValid($value)
{
$this->databaseError = null;
// Empty connection string is valid (defaults to localhost:defaultPort)
if (!empty($value) && !preg_match($this->pattern, $value)) {
$this->error(self::INVALID);
return false;
}
return t... | php | public function isValid($value)
{
$this->databaseError = null;
// Empty connection string is valid (defaults to localhost:defaultPort)
if (!empty($value) && !preg_match($this->pattern, $value)) {
$this->error(self::INVALID);
return false;
}
return t... | [
"public",
"function",
"isValid",
"(",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"databaseError",
"=",
"null",
";",
"// Empty connection string is valid (defaults to localhost:defaultPort)",
"if",
"(",
"!",
"empty",
"(",
"$",
"value",
")",
"&&",
"!",
"preg_match",... | Returns true if the passed string is a valid mongodb connection string.
{@inheritDoc}
@param string $value | [
"Returns",
"true",
"if",
"the",
"passed",
"string",
"is",
"a",
"valid",
"mongodb",
"connection",
"string",
"."
] | 1283d512a852d305e18d311c3eb1a84da98b9656 | https://github.com/yawik/install/blob/1283d512a852d305e18d311c3eb1a84da98b9656/src/Validator/MongoDbConnectionString.php#L59-L71 |
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.