repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
4devs/ElfinderPhpConnector | Driver/LocalDriver.php | LocalDriver.getFileInfo | private function getFileInfo($file)
{
if (!file_exists($file)) {
throw new NotFoundException(sprintf('file "%s" not found', $file));
}
$fileStat = stat($file);
$directory = dirname($file) == '.' ? '' : dirname($file);
$fileInfo = new FileInfo($this->basename($file... | php | private function getFileInfo($file)
{
if (!file_exists($file)) {
throw new NotFoundException(sprintf('file "%s" not found', $file));
}
$fileStat = stat($file);
$directory = dirname($file) == '.' ? '' : dirname($file);
$fileInfo = new FileInfo($this->basename($file... | [
"private",
"function",
"getFileInfo",
"(",
"$",
"file",
")",
"{",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"file",
")",
")",
"{",
"throw",
"new",
"NotFoundException",
"(",
"sprintf",
"(",
"'file \"%s\" not found'",
",",
"$",
"file",
")",
")",
";",
"}",
... | get file info by full path file name.
@param string $file
@return FileInfo | [
"get",
"file",
"info",
"by",
"full",
"path",
"file",
"name",
"."
] | train | https://github.com/4devs/ElfinderPhpConnector/blob/510e295dcafeaa0f796986ad87b3ed5f6b0d9338/Driver/LocalDriver.php#L525-L546 |
4devs/ElfinderPhpConnector | Driver/LocalDriver.php | LocalDriver.getMimeType | private function getMimeType($file)
{
$type = FileInfo::DIRECTORY_MIME_TYPE;
if (is_file($file)) {
if (class_exists('finfo')) {
$finfo = new \finfo(FILEINFO_MIME);
$type = $finfo->file($file);
} else {
$type = MimeType::getTypeB... | php | private function getMimeType($file)
{
$type = FileInfo::DIRECTORY_MIME_TYPE;
if (is_file($file)) {
if (class_exists('finfo')) {
$finfo = new \finfo(FILEINFO_MIME);
$type = $finfo->file($file);
} else {
$type = MimeType::getTypeB... | [
"private",
"function",
"getMimeType",
"(",
"$",
"file",
")",
"{",
"$",
"type",
"=",
"FileInfo",
"::",
"DIRECTORY_MIME_TYPE",
";",
"if",
"(",
"is_file",
"(",
"$",
"file",
")",
")",
"{",
"if",
"(",
"class_exists",
"(",
"'finfo'",
")",
")",
"{",
"$",
"f... | get Mime Type by File.
@param string $file
@return string | [
"get",
"Mime",
"Type",
"by",
"File",
"."
] | train | https://github.com/4devs/ElfinderPhpConnector/blob/510e295dcafeaa0f796986ad87b3ed5f6b0d9338/Driver/LocalDriver.php#L555-L569 |
4devs/ElfinderPhpConnector | Driver/LocalDriver.php | LocalDriver.scanDir | private function scanDir($dir, $onlyDir = 0)
{
$files = array();
foreach (glob($dir.'/*', $onlyDir) as $name) {
if ($this->isShowFile($name, $this->driverOptions['showHidden'])) {
$file = $this->getFileInfo($name);
$this->setDirs($file, $name);
... | php | private function scanDir($dir, $onlyDir = 0)
{
$files = array();
foreach (glob($dir.'/*', $onlyDir) as $name) {
if ($this->isShowFile($name, $this->driverOptions['showHidden'])) {
$file = $this->getFileInfo($name);
$this->setDirs($file, $name);
... | [
"private",
"function",
"scanDir",
"(",
"$",
"dir",
",",
"$",
"onlyDir",
"=",
"0",
")",
"{",
"$",
"files",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"glob",
"(",
"$",
"dir",
".",
"'/*'",
",",
"$",
"onlyDir",
")",
"as",
"$",
"name",
")",
"{",
... | get Files by dir name.
@param string $dir
@param int $onlyDir
@return FileInfo[] | [
"get",
"Files",
"by",
"dir",
"name",
"."
] | train | https://github.com/4devs/ElfinderPhpConnector/blob/510e295dcafeaa0f796986ad87b3ed5f6b0d9338/Driver/LocalDriver.php#L579-L591 |
4devs/ElfinderPhpConnector | Driver/LocalDriver.php | LocalDriver.setDirs | private function setDirs(FileInfo $file, $fulName)
{
if ($file->isDir()) {
if (count(glob($fulName.DIRECTORY_SEPARATOR.'*', GLOB_ONLYDIR))) {
$file->setDirs(1);
}
}
} | php | private function setDirs(FileInfo $file, $fulName)
{
if ($file->isDir()) {
if (count(glob($fulName.DIRECTORY_SEPARATOR.'*', GLOB_ONLYDIR))) {
$file->setDirs(1);
}
}
} | [
"private",
"function",
"setDirs",
"(",
"FileInfo",
"$",
"file",
",",
"$",
"fulName",
")",
"{",
"if",
"(",
"$",
"file",
"->",
"isDir",
"(",
")",
")",
"{",
"if",
"(",
"count",
"(",
"glob",
"(",
"$",
"fulName",
".",
"DIRECTORY_SEPARATOR",
".",
"'*'",
... | set dit $file if it has folders.
@param FileInfo $file
@param string $fulName | [
"set",
"dit",
"$file",
"if",
"it",
"has",
"folders",
"."
] | train | https://github.com/4devs/ElfinderPhpConnector/blob/510e295dcafeaa0f796986ad87b3ed5f6b0d9338/Driver/LocalDriver.php#L606-L613 |
maniaplanet/maniaplanet-ws-sdk | libraries/Maniaplanet/WebServices/HTTPClient.php | HTTPClient.execute | protected function execute($method, $ressource, array $params = array())
{
$this->lastException = null;
$url = $this->APIURL.$ressource;
// If we need a request body, it's the last element of the params array
// Otherwise it's null
if($method == 'POST' || $method == 'PUT')
{
$data = array_pop($params)... | php | protected function execute($method, $ressource, array $params = array())
{
$this->lastException = null;
$url = $this->APIURL.$ressource;
// If we need a request body, it's the last element of the params array
// Otherwise it's null
if($method == 'POST' || $method == 'PUT')
{
$data = array_pop($params)... | [
"protected",
"function",
"execute",
"(",
"$",
"method",
",",
"$",
"ressource",
",",
"array",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"$",
"this",
"->",
"lastException",
"=",
"null",
";",
"$",
"url",
"=",
"$",
"this",
"->",
"APIURL",
".",
"... | Executes a HTTP request on the API.
The usage of the $ressource and $params parameters is similar to the use
of the sprintf() function. You can PUT sprintf() placeholders in the
$ressource, and the first elements of the $params array will be
urlencode'd and sprintf()'ed in the ressource. The last element of the
$param... | [
"Executes",
"a",
"HTTP",
"request",
"on",
"the",
"API",
"."
] | train | https://github.com/maniaplanet/maniaplanet-ws-sdk/blob/027a458388035fe66f2f56ff3ea1f85eff2a5a4e/libraries/Maniaplanet/WebServices/HTTPClient.php#L208-L381 |
sparwelt/imgix-lib | src/Components/HtmlTransformer.php | HtmlTransformer.transformHtml | public function transformHtml($originalHtml, array $attributesFilters = [])
{
// regex is used because:
// 1 - preserves the original html, that would otherwise change when converted to a DOM abstraction
// 2 - works with invalid surrounding html
return preg_replace_callback('/(<img[... | php | public function transformHtml($originalHtml, array $attributesFilters = [])
{
// regex is used because:
// 1 - preserves the original html, that would otherwise change when converted to a DOM abstraction
// 2 - works with invalid surrounding html
return preg_replace_callback('/(<img[... | [
"public",
"function",
"transformHtml",
"(",
"$",
"originalHtml",
",",
"array",
"$",
"attributesFilters",
"=",
"[",
"]",
")",
"{",
"// regex is used because:",
"// 1 - preserves the original html, that would otherwise change when converted to a DOM abstraction",
"// 2 - works with i... | @param string $originalHtml
@param array $attributesFilters
@return null|string|string[] | [
"@param",
"string",
"$originalHtml",
"@param",
"array",
"$attributesFilters"
] | train | https://github.com/sparwelt/imgix-lib/blob/330e1db2bed71bc283e5a2da6246528f240939ec/src/Components/HtmlTransformer.php#L36-L51 |
factorio-item-browser/export-data | src/Entity/Machine.php | Machine.writeData | public function writeData(): array
{
$dataBuilder = new DataBuilder();
$dataBuilder->setString('n', $this->name, '')
->setArray('l', $this->labels->writeData(), null, [])
->setArray('d', $this->descriptions->writeData(), null, [])
->setArra... | php | public function writeData(): array
{
$dataBuilder = new DataBuilder();
$dataBuilder->setString('n', $this->name, '')
->setArray('l', $this->labels->writeData(), null, [])
->setArray('d', $this->descriptions->writeData(), null, [])
->setArra... | [
"public",
"function",
"writeData",
"(",
")",
":",
"array",
"{",
"$",
"dataBuilder",
"=",
"new",
"DataBuilder",
"(",
")",
";",
"$",
"dataBuilder",
"->",
"setString",
"(",
"'n'",
",",
"$",
"this",
"->",
"name",
",",
"''",
")",
"->",
"setArray",
"(",
"'... | Writes the entity data to an array.
@return array | [
"Writes",
"the",
"entity",
"data",
"to",
"an",
"array",
"."
] | train | https://github.com/factorio-item-browser/export-data/blob/1413b2eed0fbfed0521457ac7ef0d668ac30c212/src/Entity/Machine.php#L364-L380 |
factorio-item-browser/export-data | src/Entity/Machine.php | Machine.readData | public function readData(DataContainer $data)
{
$this->name = $data->getString('n', '');
$this->labels->readData($data->getObject('l'));
$this->descriptions->readData($data->getObject('d'));
$this->craftingCategories = array_map('strval', $data->getArray('c'));
$this->craftin... | php | public function readData(DataContainer $data)
{
$this->name = $data->getString('n', '');
$this->labels->readData($data->getObject('l'));
$this->descriptions->readData($data->getObject('d'));
$this->craftingCategories = array_map('strval', $data->getArray('c'));
$this->craftin... | [
"public",
"function",
"readData",
"(",
"DataContainer",
"$",
"data",
")",
"{",
"$",
"this",
"->",
"name",
"=",
"$",
"data",
"->",
"getString",
"(",
"'n'",
",",
"''",
")",
";",
"$",
"this",
"->",
"labels",
"->",
"readData",
"(",
"$",
"data",
"->",
"... | Reads the entity data.
@param DataContainer $data
@return $this | [
"Reads",
"the",
"entity",
"data",
"."
] | train | https://github.com/factorio-item-browser/export-data/blob/1413b2eed0fbfed0521457ac7ef0d668ac30c212/src/Entity/Machine.php#L387-L402 |
factorio-item-browser/export-data | src/Entity/Machine.php | Machine.calculateHash | public function calculateHash(): string
{
return EntityUtils::calculateHashOfArray([
$this->name,
$this->labels->calculateHash(),
$this->descriptions->calculateHash(),
$this->craftingCategories,
$this->craftingSpeed,
$this->numberOfItem... | php | public function calculateHash(): string
{
return EntityUtils::calculateHashOfArray([
$this->name,
$this->labels->calculateHash(),
$this->descriptions->calculateHash(),
$this->craftingCategories,
$this->craftingSpeed,
$this->numberOfItem... | [
"public",
"function",
"calculateHash",
"(",
")",
":",
"string",
"{",
"return",
"EntityUtils",
"::",
"calculateHashOfArray",
"(",
"[",
"$",
"this",
"->",
"name",
",",
"$",
"this",
"->",
"labels",
"->",
"calculateHash",
"(",
")",
",",
"$",
"this",
"->",
"d... | Calculates a hash value representing the entity.
@return string | [
"Calculates",
"a",
"hash",
"value",
"representing",
"the",
"entity",
"."
] | train | https://github.com/factorio-item-browser/export-data/blob/1413b2eed0fbfed0521457ac7ef0d668ac30c212/src/Entity/Machine.php#L408-L424 |
matthewbdaly/postcode-client | src/Client.php | Client.get | public function get(string $postcode)
{
$url = $this->getBaseUrl() . rawurlencode($postcode) . '?' . http_build_query([
'api_key' => $this->getKey()
]);
$request = $this->messageFactory->createRequest(
'GET',
$url,
[],
null,
... | php | public function get(string $postcode)
{
$url = $this->getBaseUrl() . rawurlencode($postcode) . '?' . http_build_query([
'api_key' => $this->getKey()
]);
$request = $this->messageFactory->createRequest(
'GET',
$url,
[],
null,
... | [
"public",
"function",
"get",
"(",
"string",
"$",
"postcode",
")",
"{",
"$",
"url",
"=",
"$",
"this",
"->",
"getBaseUrl",
"(",
")",
".",
"rawurlencode",
"(",
"$",
"postcode",
")",
".",
"'?'",
".",
"http_build_query",
"(",
"[",
"'api_key'",
"=>",
"$",
... | Make the HTTP request
@param string $postcode The postcode to look up.
@return mixed
@throws PaymentRequired Payment required to perform the lookup.
@throws PostcodeNotFound Postcode not found. | [
"Make",
"the",
"HTTP",
"request"
] | train | https://github.com/matthewbdaly/postcode-client/blob/0900247f2b26d60c7d4141e846f123f660756421/src/Client.php#L86-L107 |
SAREhub/PHP_Commons | src/SAREhub/Commons/Misc/PeriodicTimer.php | PeriodicTimer.update | public function update($now)
{
if ($now >= ($this->lastCallTime + $this->interval)) {
$this->lastCallTime = $now;
$this->callNow();
}
} | php | public function update($now)
{
if ($now >= ($this->lastCallTime + $this->interval)) {
$this->lastCallTime = $now;
$this->callNow();
}
} | [
"public",
"function",
"update",
"(",
"$",
"now",
")",
"{",
"if",
"(",
"$",
"now",
">=",
"(",
"$",
"this",
"->",
"lastCallTime",
"+",
"$",
"this",
"->",
"interval",
")",
")",
"{",
"$",
"this",
"->",
"lastCallTime",
"=",
"$",
"now",
";",
"$",
"this... | Updates that timer if is after next call its calls callback.
@param int $now | [
"Updates",
"that",
"timer",
"if",
"is",
"after",
"next",
"call",
"its",
"calls",
"callback",
"."
] | train | https://github.com/SAREhub/PHP_Commons/blob/4e1769ab6411a584112df1151dcc90e6b82fe2bb/src/SAREhub/Commons/Misc/PeriodicTimer.php#L52-L58 |
GrahamDeprecated/CMS-Core | src/Seeds/CommentsTableSeeder.php | CommentsTableSeeder.run | public function run()
{
DB::table('comments')->delete();
$comment = array(
'body' => 'This is an example comment.',
'user_id' => 1,
'post_id' => 1,
'created_at' => new DateTime,
'updated_at' => new DateTime
);
... | php | public function run()
{
DB::table('comments')->delete();
$comment = array(
'body' => 'This is an example comment.',
'user_id' => 1,
'post_id' => 1,
'created_at' => new DateTime,
'updated_at' => new DateTime
);
... | [
"public",
"function",
"run",
"(",
")",
"{",
"DB",
"::",
"table",
"(",
"'comments'",
")",
"->",
"delete",
"(",
")",
";",
"$",
"comment",
"=",
"array",
"(",
"'body'",
"=>",
"'This is an example comment.'",
",",
"'user_id'",
"=>",
"1",
",",
"'post_id'",
"=>... | Run the database seeding.
@return void | [
"Run",
"the",
"database",
"seeding",
"."
] | train | https://github.com/GrahamDeprecated/CMS-Core/blob/5603e2bfa2fac6cf46ca3ed62d21518f2f653675/src/Seeds/CommentsTableSeeder.php#L39-L52 |
digitalkaoz/versioneye-php | src/Api/Products.php | Products.search | public function search($query, $language = null, $group = null)
{
$url = sprintf('products/search/%s?%s', $query, http_build_query([
'lang' => $language,
'g' => $group,
'page' => 1,
]));
return $this->request($url);
} | php | public function search($query, $language = null, $group = null)
{
$url = sprintf('products/search/%s?%s', $query, http_build_query([
'lang' => $language,
'g' => $group,
'page' => 1,
]));
return $this->request($url);
} | [
"public",
"function",
"search",
"(",
"$",
"query",
",",
"$",
"language",
"=",
"null",
",",
"$",
"group",
"=",
"null",
")",
"{",
"$",
"url",
"=",
"sprintf",
"(",
"'products/search/%s?%s'",
",",
"$",
"query",
",",
"http_build_query",
"(",
"[",
"'lang'",
... | search packages.
@param string $query
@param string $language
@param string $group
@return array | [
"search",
"packages",
"."
] | train | https://github.com/digitalkaoz/versioneye-php/blob/7b8eb9cdc83e01138dda0e709c07e3beb6aad136/src/Api/Products.php#L23-L32 |
digitalkaoz/versioneye-php | src/Api/Products.php | Products.show | public function show($language, $product)
{
return $this->request(sprintf('products/%s/%s', $language, $this->transform($product)));
} | php | public function show($language, $product)
{
return $this->request(sprintf('products/%s/%s', $language, $this->transform($product)));
} | [
"public",
"function",
"show",
"(",
"$",
"language",
",",
"$",
"product",
")",
"{",
"return",
"$",
"this",
"->",
"request",
"(",
"sprintf",
"(",
"'products/%s/%s'",
",",
"$",
"language",
",",
"$",
"this",
"->",
"transform",
"(",
"$",
"product",
")",
")"... | detailed information for specific package.
@param string $language
@param string $product
@return array | [
"detailed",
"information",
"for",
"specific",
"package",
"."
] | train | https://github.com/digitalkaoz/versioneye-php/blob/7b8eb9cdc83e01138dda0e709c07e3beb6aad136/src/Api/Products.php#L42-L45 |
digitalkaoz/versioneye-php | src/Api/Products.php | Products.followStatus | public function followStatus($language, $product)
{
return $this->request(sprintf('products/%s/%s/follow', $language, $this->transform($product)));
} | php | public function followStatus($language, $product)
{
return $this->request(sprintf('products/%s/%s/follow', $language, $this->transform($product)));
} | [
"public",
"function",
"followStatus",
"(",
"$",
"language",
",",
"$",
"product",
")",
"{",
"return",
"$",
"this",
"->",
"request",
"(",
"sprintf",
"(",
"'products/%s/%s/follow'",
",",
"$",
"language",
",",
"$",
"this",
"->",
"transform",
"(",
"$",
"product... | check your following status.
@param string $language
@param string $product
@return array | [
"check",
"your",
"following",
"status",
"."
] | train | https://github.com/digitalkaoz/versioneye-php/blob/7b8eb9cdc83e01138dda0e709c07e3beb6aad136/src/Api/Products.php#L55-L58 |
digitalkaoz/versioneye-php | src/Api/Products.php | Products.follow | public function follow($language, $product)
{
return $this->request(sprintf('products/%s/%s/follow', $language, $this->transform($product)), 'POST');
} | php | public function follow($language, $product)
{
return $this->request(sprintf('products/%s/%s/follow', $language, $this->transform($product)), 'POST');
} | [
"public",
"function",
"follow",
"(",
"$",
"language",
",",
"$",
"product",
")",
"{",
"return",
"$",
"this",
"->",
"request",
"(",
"sprintf",
"(",
"'products/%s/%s/follow'",
",",
"$",
"language",
",",
"$",
"this",
"->",
"transform",
"(",
"$",
"product",
"... | follow your favorite software package.
@param string $language
@param string $product
@return array | [
"follow",
"your",
"favorite",
"software",
"package",
"."
] | train | https://github.com/digitalkaoz/versioneye-php/blob/7b8eb9cdc83e01138dda0e709c07e3beb6aad136/src/Api/Products.php#L68-L71 |
digitalkaoz/versioneye-php | src/Api/Products.php | Products.unfollow | public function unfollow($language, $product)
{
return $this->request(sprintf('products/%s/%s/follow', $language, $this->transform($product)), 'DELETE');
} | php | public function unfollow($language, $product)
{
return $this->request(sprintf('products/%s/%s/follow', $language, $this->transform($product)), 'DELETE');
} | [
"public",
"function",
"unfollow",
"(",
"$",
"language",
",",
"$",
"product",
")",
"{",
"return",
"$",
"this",
"->",
"request",
"(",
"sprintf",
"(",
"'products/%s/%s/follow'",
",",
"$",
"language",
",",
"$",
"this",
"->",
"transform",
"(",
"$",
"product",
... | unfollow given software package.
@param string $language
@param string $product
@return array | [
"unfollow",
"given",
"software",
"package",
"."
] | train | https://github.com/digitalkaoz/versioneye-php/blob/7b8eb9cdc83e01138dda0e709c07e3beb6aad136/src/Api/Products.php#L81-L84 |
digitalkaoz/versioneye-php | src/Api/Products.php | Products.references | public function references($language, $product)
{
return $this->request(sprintf('products/%s/%s/references?page=%d', $language, $this->transform($product), 1));
} | php | public function references($language, $product)
{
return $this->request(sprintf('products/%s/%s/references?page=%d', $language, $this->transform($product), 1));
} | [
"public",
"function",
"references",
"(",
"$",
"language",
",",
"$",
"product",
")",
"{",
"return",
"$",
"this",
"->",
"request",
"(",
"sprintf",
"(",
"'products/%s/%s/references?page=%d'",
",",
"$",
"language",
",",
"$",
"this",
"->",
"transform",
"(",
"$",
... | shows all references for the given package.
@param string $language
@param string $product
@return array | [
"shows",
"all",
"references",
"for",
"the",
"given",
"package",
"."
] | train | https://github.com/digitalkaoz/versioneye-php/blob/7b8eb9cdc83e01138dda0e709c07e3beb6aad136/src/Api/Products.php#L94-L97 |
digitalkaoz/versioneye-php | src/Api/Products.php | Products.versions | public function versions($language, $product)
{
return $this->request(sprintf('products/%s/%s/versions', $language, $this->transform($product)));
} | php | public function versions($language, $product)
{
return $this->request(sprintf('products/%s/%s/versions', $language, $this->transform($product)));
} | [
"public",
"function",
"versions",
"(",
"$",
"language",
",",
"$",
"product",
")",
"{",
"return",
"$",
"this",
"->",
"request",
"(",
"sprintf",
"(",
"'products/%s/%s/versions'",
",",
"$",
"language",
",",
"$",
"this",
"->",
"transform",
"(",
"$",
"product",... | shows all version for the given package.
@param string $language
@param string $product
@return array | [
"shows",
"all",
"version",
"for",
"the",
"given",
"package",
"."
] | train | https://github.com/digitalkaoz/versioneye-php/blob/7b8eb9cdc83e01138dda0e709c07e3beb6aad136/src/Api/Products.php#L107-L110 |
mihai-stancu/serializer | Serializer/Normalizer/DateTimeNormalizer.php | DateTimeNormalizer.normalize | public function normalize($object, $format = null, array $context = array())
{
if (!$object instanceof \DateTimeInterface) {
throw new InvalidArgumentException('The object must implement the "\DateTimeInterface".');
}
$format = isset($context[static::CONTEXT_FORMAT]) ? $context[... | php | public function normalize($object, $format = null, array $context = array())
{
if (!$object instanceof \DateTimeInterface) {
throw new InvalidArgumentException('The object must implement the "\DateTimeInterface".');
}
$format = isset($context[static::CONTEXT_FORMAT]) ? $context[... | [
"public",
"function",
"normalize",
"(",
"$",
"object",
",",
"$",
"format",
"=",
"null",
",",
"array",
"$",
"context",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"!",
"$",
"object",
"instanceof",
"\\",
"DateTimeInterface",
")",
"{",
"throw",
"new",
... | @param object $object
@param string $format
@param array $context
@return string | [
"@param",
"object",
"$object",
"@param",
"string",
"$format",
"@param",
"array",
"$context"
] | train | https://github.com/mihai-stancu/serializer/blob/4d96f942a3c44d5b5652868be726af656bf1baad/Serializer/Normalizer/DateTimeNormalizer.php#L64-L73 |
mihai-stancu/serializer | Serializer/Normalizer/DateTimeNormalizer.php | DateTimeNormalizer.denormalize | public function denormalize($data, $class, $format = null, array $context = array())
{
preg_match(static::REGEX, $data, $parts);
$format = '';
$format .= !empty($parts['date']) ? 'Y-m-d' : '';
$format .= !empty($parts['tsep']) ? str_replace('T', '\T', $parts['tsep']) : '';
$... | php | public function denormalize($data, $class, $format = null, array $context = array())
{
preg_match(static::REGEX, $data, $parts);
$format = '';
$format .= !empty($parts['date']) ? 'Y-m-d' : '';
$format .= !empty($parts['tsep']) ? str_replace('T', '\T', $parts['tsep']) : '';
$... | [
"public",
"function",
"denormalize",
"(",
"$",
"data",
",",
"$",
"class",
",",
"$",
"format",
"=",
"null",
",",
"array",
"$",
"context",
"=",
"array",
"(",
")",
")",
"{",
"preg_match",
"(",
"static",
"::",
"REGEX",
",",
"$",
"data",
",",
"$",
"part... | @param string $data
@param string $class
@param string $format
@param array $context
@return \DateTimeInterface | [
"@param",
"string",
"$data",
"@param",
"string",
"$class",
"@param",
"string",
"$format",
"@param",
"array",
"$context"
] | train | https://github.com/mihai-stancu/serializer/blob/4d96f942a3c44d5b5652868be726af656bf1baad/Serializer/Normalizer/DateTimeNormalizer.php#L94-L112 |
mihai-stancu/serializer | Serializer/Normalizer/DateTimeNormalizer.php | DateTimeNormalizer.supportsDenormalization | public function supportsDenormalization($data, $type, $format = null)
{
return in_array($type, static::$classes) or in_array($type, static::$types)
and is_string($data) and preg_match(static::REGEX, $data) > 0;
} | php | public function supportsDenormalization($data, $type, $format = null)
{
return in_array($type, static::$classes) or in_array($type, static::$types)
and is_string($data) and preg_match(static::REGEX, $data) > 0;
} | [
"public",
"function",
"supportsDenormalization",
"(",
"$",
"data",
",",
"$",
"type",
",",
"$",
"format",
"=",
"null",
")",
"{",
"return",
"in_array",
"(",
"$",
"type",
",",
"static",
"::",
"$",
"classes",
")",
"or",
"in_array",
"(",
"$",
"type",
",",
... | @param mixed $data
@param string $type
@param string $format
@return bool | [
"@param",
"mixed",
"$data",
"@param",
"string",
"$type",
"@param",
"string",
"$format"
] | train | https://github.com/mihai-stancu/serializer/blob/4d96f942a3c44d5b5652868be726af656bf1baad/Serializer/Normalizer/DateTimeNormalizer.php#L121-L125 |
ondrakoupil/tools | src/Time.php | Time.convert | static function convert($input,$outputFormat=self::PHP) {
if ($input===false) {
$input=time();
}
if ($input instanceof \DateTime) {
if ($outputFormat===self::INT) return $input->getTimestamp();
if (is_string($outputFormat)) return date($outputFormat,$input->getTimestamp());
if ($outputFormat===self::... | php | static function convert($input,$outputFormat=self::PHP) {
if ($input===false) {
$input=time();
}
if ($input instanceof \DateTime) {
if ($outputFormat===self::INT) return $input->getTimestamp();
if (is_string($outputFormat)) return date($outputFormat,$input->getTimestamp());
if ($outputFormat===self::... | [
"static",
"function",
"convert",
"(",
"$",
"input",
",",
"$",
"outputFormat",
"=",
"self",
"::",
"PHP",
")",
"{",
"if",
"(",
"$",
"input",
"===",
"false",
")",
"{",
"$",
"input",
"=",
"time",
"(",
")",
";",
"}",
"if",
"(",
"$",
"input",
"instance... | Konverze časového údaje do různých formátů.
@param bool|int|string|\DateTime $input Vstupní čas. False = aktuální čas.
@param int $outputFormat Konstanty
@return \DateTime|string|int
@throws \InvalidArgumentException | [
"Konverze",
"časového",
"údaje",
"do",
"různých",
"formátů",
"."
] | train | https://github.com/ondrakoupil/tools/blob/7ecbe3652e379802fbaabf4fe8f27b96dcbadb22/src/Time.php#L73-L104 |
ondrakoupil/tools | src/Time.php | Time.relative | static function relative($time, $alwaysTime = false) {
$time=self::convert($time, self::PHP);
$today=date("Ymd");
if ($time->format("Ymd")==$today) {
return "dnes v ".$time->format("H.i");
}
$time2=clone $time;
if ($time2->add(new DateInterval("P1D"))->format("Ymd")==$today) {
return "včera v ".$time-... | php | static function relative($time, $alwaysTime = false) {
$time=self::convert($time, self::PHP);
$today=date("Ymd");
if ($time->format("Ymd")==$today) {
return "dnes v ".$time->format("H.i");
}
$time2=clone $time;
if ($time2->add(new DateInterval("P1D"))->format("Ymd")==$today) {
return "včera v ".$time-... | [
"static",
"function",
"relative",
"(",
"$",
"time",
",",
"$",
"alwaysTime",
"=",
"false",
")",
"{",
"$",
"time",
"=",
"self",
"::",
"convert",
"(",
"$",
"time",
",",
"self",
"::",
"PHP",
")",
";",
"$",
"today",
"=",
"date",
"(",
"\"Ymd\"",
")",
"... | České vyjádření relativního času k dnešku. Česky.
@param mixed $time Cokoliv, co umí přijmout convertTime()
@param bool $alwaysTime True = i u starých událostí přidávat čas dne
@return string | [
"České",
"vyjádření",
"relativního",
"času",
"k",
"dnešku",
".",
"Česky",
"."
] | train | https://github.com/ondrakoupil/tools/blob/7ecbe3652e379802fbaabf4fe8f27b96dcbadb22/src/Time.php#L112-L130 |
ondrakoupil/tools | src/Time.php | Time.age | static function age($kdy) {
$kdy = self::convert($kdy, self::INT);
$stari=floor((time()-$kdy)/60);
if ($stari<60) {$stari=$stari." ".Strings::plural($stari,"minuta","minuty","minut");}
else {$stari=floor($stari/60);
if ($stari>=24) {$stari=(floor($stari/24)); $stari.=" ".Strings::plural($stari,"den","dny","d... | php | static function age($kdy) {
$kdy = self::convert($kdy, self::INT);
$stari=floor((time()-$kdy)/60);
if ($stari<60) {$stari=$stari." ".Strings::plural($stari,"minuta","minuty","minut");}
else {$stari=floor($stari/60);
if ($stari>=24) {$stari=(floor($stari/24)); $stari.=" ".Strings::plural($stari,"den","dny","d... | [
"static",
"function",
"age",
"(",
"$",
"kdy",
")",
"{",
"$",
"kdy",
"=",
"self",
"::",
"convert",
"(",
"$",
"kdy",
",",
"self",
"::",
"INT",
")",
";",
"$",
"stari",
"=",
"floor",
"(",
"(",
"time",
"(",
")",
"-",
"$",
"kdy",
")",
"/",
"60",
... | Vrátí textový údaj o stáří něčeho; používá různé jednotky. Pouze v češtině.
@param int|\DateTime $kdy Doba, kdy se stalo to něco (timestamp)
@return string Nějaký text typu '8 dní' nebo '7 minut' | [
"Vrátí",
"textový",
"údaj",
"o",
"stáří",
"něčeho",
";",
"používá",
"různé",
"jednotky",
".",
"Pouze",
"v",
"češtině",
"."
] | train | https://github.com/ondrakoupil/tools/blob/7ecbe3652e379802fbaabf4fe8f27b96dcbadb22/src/Time.php#L139-L149 |
ondrakoupil/tools | src/Time.php | Time.holiday | static function holiday($time, $weekends = true) {
$date = self::convert($time, self::PHP);
if ($weekends) {
$w = $date->format("w");
if ($w == 0 or $w == 6) return 2;
}
$day = $date->format("dm");
if ($day == "0101" or $day == "0105" or $day == "0805" or $day == "0507" or $day == "0607"
or $day ... | php | static function holiday($time, $weekends = true) {
$date = self::convert($time, self::PHP);
if ($weekends) {
$w = $date->format("w");
if ($w == 0 or $w == 6) return 2;
}
$day = $date->format("dm");
if ($day == "0101" or $day == "0105" or $day == "0805" or $day == "0507" or $day == "0607"
or $day ... | [
"static",
"function",
"holiday",
"(",
"$",
"time",
",",
"$",
"weekends",
"=",
"true",
")",
"{",
"$",
"date",
"=",
"self",
"::",
"convert",
"(",
"$",
"time",
",",
"self",
"::",
"PHP",
")",
";",
"if",
"(",
"$",
"weekends",
")",
"{",
"$",
"w",
"="... | Ověří, zda v daný den je nějaký svátek a tudíž není pracovní den. Bude fungovat do roku 2020, pak bude třeba doplnit velikonoce.
@param mixed $time
@param bool $weekends True = Vyhodnocovat i víkendy. False = jen státní svátky.
@return int 0 = pracovní den. 1 = svátek. 2 = víkend (if $weekends) | [
"Ověří",
"zda",
"v",
"daný",
"den",
"je",
"nějaký",
"svátek",
"a",
"tudíž",
"není",
"pracovní",
"den",
".",
"Bude",
"fungovat",
"do",
"roku",
"2020",
"pak",
"bude",
"třeba",
"doplnit",
"velikonoce",
"."
] | train | https://github.com/ondrakoupil/tools/blob/7ecbe3652e379802fbaabf4fe8f27b96dcbadb22/src/Time.php#L157-L181 |
ondrakoupil/tools | src/Time.php | Time.convertInterval | static function convertInterval(DateInterval $d) {
$i = 0;
$i += $d->s;
$i += $d->i * self::MINUTE;
$i += $d->h * self::HOUR;
$i += $d->d * self::DAY;
$i += $d->m * self::MONTH;
$i += $d->y * self::YEAR;
return $i;
} | php | static function convertInterval(DateInterval $d) {
$i = 0;
$i += $d->s;
$i += $d->i * self::MINUTE;
$i += $d->h * self::HOUR;
$i += $d->d * self::DAY;
$i += $d->m * self::MONTH;
$i += $d->y * self::YEAR;
return $i;
} | [
"static",
"function",
"convertInterval",
"(",
"DateInterval",
"$",
"d",
")",
"{",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"+=",
"$",
"d",
"->",
"s",
";",
"$",
"i",
"+=",
"$",
"d",
"->",
"i",
"*",
"self",
"::",
"MINUTE",
";",
"$",
"i",
"+=",
"$",
... | Převede DateInterval na počet sekund.
Pokud je interval delší než 1 měsíc, pracuje jen přibližně (za měsíc se považuje cca 30,4 dne)
@param DateInterval $d
@return int | [
"Převede",
"DateInterval",
"na",
"počet",
"sekund",
".",
"Pokud",
"je",
"interval",
"delší",
"než",
"1",
"měsíc",
"pracuje",
"jen",
"přibližně",
"(",
"za",
"měsíc",
"se",
"považuje",
"cca",
"30",
"4",
"dne",
")"
] | train | https://github.com/ondrakoupil/tools/blob/7ecbe3652e379802fbaabf4fe8f27b96dcbadb22/src/Time.php#L190-L200 |
UnionOfRAD/li3_behaviors | data/model/Behaviors.php | Behaviors._initializeBehaviors | protected static function _initializeBehaviors() {
$model = get_called_class();
if (!empty(static::$_initializedBehaviors[$model])) {
return;
}
static::$_initializedBehaviors[$model] = true;
$self = $model::_object();
if (!property_exists($self, '_actsAs')) {
return;
}
foreach (Set::normalize($... | php | protected static function _initializeBehaviors() {
$model = get_called_class();
if (!empty(static::$_initializedBehaviors[$model])) {
return;
}
static::$_initializedBehaviors[$model] = true;
$self = $model::_object();
if (!property_exists($self, '_actsAs')) {
return;
}
foreach (Set::normalize($... | [
"protected",
"static",
"function",
"_initializeBehaviors",
"(",
")",
"{",
"$",
"model",
"=",
"get_called_class",
"(",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"static",
"::",
"$",
"_initializedBehaviors",
"[",
"$",
"model",
"]",
")",
")",
"{",
"return",
"... | Initializes behaviors from the `$_actsAs` property of the model.
@return void | [
"Initializes",
"behaviors",
"from",
"the",
"$_actsAs",
"property",
"of",
"the",
"model",
"."
] | train | https://github.com/UnionOfRAD/li3_behaviors/blob/b7051a300f91323f8776088b20e84c79790015ea/data/model/Behaviors.php#L93-L109 |
UnionOfRAD/li3_behaviors | data/model/Behaviors.php | Behaviors.bindBehavior | public static function bindBehavior($name, array $config = []) {
list($model, $class) = static::_classesForBehavior($name);
static::_initializeBehaviors();
if (is_object($name)) {
$name->config($config);
} else {
if (!class_exists($class)) {
$message = "Behavior class `{$class}` does not exist. ";
... | php | public static function bindBehavior($name, array $config = []) {
list($model, $class) = static::_classesForBehavior($name);
static::_initializeBehaviors();
if (is_object($name)) {
$name->config($config);
} else {
if (!class_exists($class)) {
$message = "Behavior class `{$class}` does not exist. ";
... | [
"public",
"static",
"function",
"bindBehavior",
"(",
"$",
"name",
",",
"array",
"$",
"config",
"=",
"[",
"]",
")",
"{",
"list",
"(",
"$",
"model",
",",
"$",
"class",
")",
"=",
"static",
"::",
"_classesForBehavior",
"(",
"$",
"name",
")",
";",
"static... | Binds a new instance of a behavior to the model using given config or
entirely replacing an existing behavior instance with new config.
@param string|object $name The name of the behavior or an instance of it.
@param array $config Configuration for the behavior instance. | [
"Binds",
"a",
"new",
"instance",
"of",
"a",
"behavior",
"to",
"the",
"model",
"using",
"given",
"config",
"or",
"entirely",
"replacing",
"an",
"existing",
"behavior",
"instance",
"with",
"new",
"config",
"."
] | train | https://github.com/UnionOfRAD/li3_behaviors/blob/b7051a300f91323f8776088b20e84c79790015ea/data/model/Behaviors.php#L196-L212 |
UnionOfRAD/li3_behaviors | data/model/Behaviors.php | Behaviors.unbindBehavior | public static function unbindBehavior($name) {
list($model, $class) = static::_classesForBehavior($name);
static::_initializeBehaviors();
if (!isset(static::$_behaviors[$model][$class])) {
throw new RuntimeException("Behavior `{$class}` not bound to model `{$model}`.");
}
unset(static::$_behaviors[$model]... | php | public static function unbindBehavior($name) {
list($model, $class) = static::_classesForBehavior($name);
static::_initializeBehaviors();
if (!isset(static::$_behaviors[$model][$class])) {
throw new RuntimeException("Behavior `{$class}` not bound to model `{$model}`.");
}
unset(static::$_behaviors[$model]... | [
"public",
"static",
"function",
"unbindBehavior",
"(",
"$",
"name",
")",
"{",
"list",
"(",
"$",
"model",
",",
"$",
"class",
")",
"=",
"static",
"::",
"_classesForBehavior",
"(",
"$",
"name",
")",
";",
"static",
"::",
"_initializeBehaviors",
"(",
")",
";"... | Unbinds an instance of a behavior from the model. Will throw
an exception if behavior is not bound.
@param string $name The name of the behavior. | [
"Unbinds",
"an",
"instance",
"of",
"a",
"behavior",
"from",
"the",
"model",
".",
"Will",
"throw",
"an",
"exception",
"if",
"behavior",
"is",
"not",
"bound",
"."
] | train | https://github.com/UnionOfRAD/li3_behaviors/blob/b7051a300f91323f8776088b20e84c79790015ea/data/model/Behaviors.php#L220-L228 |
UnionOfRAD/li3_behaviors | data/model/Behaviors.php | Behaviors.hasBehavior | public static function hasBehavior($name) {
static::_initializeBehaviors();
try {
list($model, $class) = static::_classesForBehavior($name);
} catch (Exception $e) {
return false;
}
return isset(static::$_behaviors[$model][$class]);
} | php | public static function hasBehavior($name) {
static::_initializeBehaviors();
try {
list($model, $class) = static::_classesForBehavior($name);
} catch (Exception $e) {
return false;
}
return isset(static::$_behaviors[$model][$class]);
} | [
"public",
"static",
"function",
"hasBehavior",
"(",
"$",
"name",
")",
"{",
"static",
"::",
"_initializeBehaviors",
"(",
")",
";",
"try",
"{",
"list",
"(",
"$",
"model",
",",
"$",
"class",
")",
"=",
"static",
"::",
"_classesForBehavior",
"(",
"$",
"name",... | Allows to check if a certain behavior is bound to the model.
@param string $name The name of the behavior.
@return boolean | [
"Allows",
"to",
"check",
"if",
"a",
"certain",
"behavior",
"is",
"bound",
"to",
"the",
"model",
"."
] | train | https://github.com/UnionOfRAD/li3_behaviors/blob/b7051a300f91323f8776088b20e84c79790015ea/data/model/Behaviors.php#L236-L245 |
UnionOfRAD/li3_behaviors | data/model/Behaviors.php | Behaviors._classesForBehavior | protected static function _classesForBehavior($name) {
$model = get_called_class();
if (is_object($name)) {
$class = get_class($name);
} elseif (!$class = Libraries::locate('behavior', $name)) {
throw new RuntimeException("No behavior named `{$name}` found.");
}
return [$model, $class];
} | php | protected static function _classesForBehavior($name) {
$model = get_called_class();
if (is_object($name)) {
$class = get_class($name);
} elseif (!$class = Libraries::locate('behavior', $name)) {
throw new RuntimeException("No behavior named `{$name}` found.");
}
return [$model, $class];
} | [
"protected",
"static",
"function",
"_classesForBehavior",
"(",
"$",
"name",
")",
"{",
"$",
"model",
"=",
"get_called_class",
"(",
")",
";",
"if",
"(",
"is_object",
"(",
"$",
"name",
")",
")",
"{",
"$",
"class",
"=",
"get_class",
"(",
"$",
"name",
")",
... | Helper method to retrieve current model class and behavior class for name.
@param string|object $name The name of the behavior or an instance of it.
@return array An array usable with `list()` with the model and behavior classes. | [
"Helper",
"method",
"to",
"retrieve",
"current",
"model",
"class",
"and",
"behavior",
"class",
"for",
"name",
"."
] | train | https://github.com/UnionOfRAD/li3_behaviors/blob/b7051a300f91323f8776088b20e84c79790015ea/data/model/Behaviors.php#L253-L262 |
kuria/event | src/EventSubscriber.php | EventSubscriber.listen | protected function listen(string $event, string $methodName, int $priority = 0): EventListener
{
return new EventListener($event, [$this, $methodName], $priority);
} | php | protected function listen(string $event, string $methodName, int $priority = 0): EventListener
{
return new EventListener($event, [$this, $methodName], $priority);
} | [
"protected",
"function",
"listen",
"(",
"string",
"$",
"event",
",",
"string",
"$",
"methodName",
",",
"int",
"$",
"priority",
"=",
"0",
")",
":",
"EventListener",
"{",
"return",
"new",
"EventListener",
"(",
"$",
"event",
",",
"[",
"$",
"this",
",",
"$... | Create an event listener and map it to a method of this class | [
"Create",
"an",
"event",
"listener",
"and",
"map",
"it",
"to",
"a",
"method",
"of",
"this",
"class"
] | train | https://github.com/kuria/event/blob/9ee95e751270831d5aca04f3a34a2e03b786ff41/src/EventSubscriber.php#L47-L50 |
webforge-labs/psc-cms | lib/Psc/Doctrine/TypeExporter.php | TypeExporter.getPscType | public function getPscType($dcTypeConstant) {
if ($dcTypeConstant === NULL) throw new TypeConversionException('dcTypeConstant kann nicht NULL sein');
$flip = array_flip($this->casts);
if (!array_key_exists($dcTypeConstant, $flip)) {
throw TypeConversionException::typeTarget('Doctrine-Type: '... | php | public function getPscType($dcTypeConstant) {
if ($dcTypeConstant === NULL) throw new TypeConversionException('dcTypeConstant kann nicht NULL sein');
$flip = array_flip($this->casts);
if (!array_key_exists($dcTypeConstant, $flip)) {
throw TypeConversionException::typeTarget('Doctrine-Type: '... | [
"public",
"function",
"getPscType",
"(",
"$",
"dcTypeConstant",
")",
"{",
"if",
"(",
"$",
"dcTypeConstant",
"===",
"NULL",
")",
"throw",
"new",
"TypeConversionException",
"(",
"'dcTypeConstant kann nicht NULL sein'",
")",
";",
"$",
"flip",
"=",
"array_flip",
"(",
... | Wandelt einen Doctrine Type in einen Psc Type um
@return Webforge\Types\Type | [
"Wandelt",
"einen",
"Doctrine",
"Type",
"in",
"einen",
"Psc",
"Type",
"um"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Doctrine/TypeExporter.php#L67-L77 |
danrevah/shortify-punit | src/Matcher/ArgumentMatcher.php | ArgumentMatcher.checkMatchingArguments | protected static function checkMatchingArguments($returnValues, $arguments)
{
// if doesn't have exactly the arguments check for Hamcrest-PHP functions to validate
foreach ($returnValues as $currentMethodArguments => $currentMethod)
{
// if not its not an Hamcrest Function
... | php | protected static function checkMatchingArguments($returnValues, $arguments)
{
// if doesn't have exactly the arguments check for Hamcrest-PHP functions to validate
foreach ($returnValues as $currentMethodArguments => $currentMethod)
{
// if not its not an Hamcrest Function
... | [
"protected",
"static",
"function",
"checkMatchingArguments",
"(",
"$",
"returnValues",
",",
"$",
"arguments",
")",
"{",
"// if doesn't have exactly the arguments check for Hamcrest-PHP functions to validate",
"foreach",
"(",
"$",
"returnValues",
"as",
"$",
"currentMethodArgumen... | Checking if there is a matching Hamcrest Function
in case of founding returns the Hamcrest object otherwise returns NULL
@param $returnValues - Current return values hierarchy with the current method name
@param $arguments - Arguments to match
@return NULL or Hamcrest | [
"Checking",
"if",
"there",
"is",
"a",
"matching",
"Hamcrest",
"Function",
"in",
"case",
"of",
"founding",
"returns",
"the",
"Hamcrest",
"object",
"otherwise",
"returns",
"NULL"
] | train | https://github.com/danrevah/shortify-punit/blob/cedd08f31de8e7409a07d2630701ef4e924cc5f0/src/Matcher/ArgumentMatcher.php#L21-L61 |
VincentChalnot/SidusAdminBundle | Form/FormHelper.php | FormHelper.getEmptyForm | public function getEmptyForm(
Action $action,
Request $request,
$data
): FormInterface {
$dataId = $data && method_exists($data, 'getId') ? $data->getId() : null;
$formOptions = $this->getDefaultFormOptions($action, $request, $dataId);
return $this->formFactory->crea... | php | public function getEmptyForm(
Action $action,
Request $request,
$data
): FormInterface {
$dataId = $data && method_exists($data, 'getId') ? $data->getId() : null;
$formOptions = $this->getDefaultFormOptions($action, $request, $dataId);
return $this->formFactory->crea... | [
"public",
"function",
"getEmptyForm",
"(",
"Action",
"$",
"action",
",",
"Request",
"$",
"request",
",",
"$",
"data",
")",
":",
"FormInterface",
"{",
"$",
"dataId",
"=",
"$",
"data",
"&&",
"method_exists",
"(",
"$",
"data",
",",
"'getId'",
")",
"?",
"$... | @param Action $action
@param Request $request
@param mixed $data
@return FormInterface | [
"@param",
"Action",
"$action",
"@param",
"Request",
"$request",
"@param",
"mixed",
"$data"
] | train | https://github.com/VincentChalnot/SidusAdminBundle/blob/3366f3f1525435860cf275ed2f1f0b58cf6eea18/Form/FormHelper.php#L65-L79 |
VincentChalnot/SidusAdminBundle | Form/FormHelper.php | FormHelper.getDefaultFormOptions | public function getDefaultFormOptions(Action $action, Request $request, $dataId = null): array
{
$dataId = $dataId ?: 'new';
return array_merge(
$action->getFormOptions(),
[
'action' => $this->routingHelper->getCurrentUri($action, $request),
'... | php | public function getDefaultFormOptions(Action $action, Request $request, $dataId = null): array
{
$dataId = $dataId ?: 'new';
return array_merge(
$action->getFormOptions(),
[
'action' => $this->routingHelper->getCurrentUri($action, $request),
'... | [
"public",
"function",
"getDefaultFormOptions",
"(",
"Action",
"$",
"action",
",",
"Request",
"$",
"request",
",",
"$",
"dataId",
"=",
"null",
")",
":",
"array",
"{",
"$",
"dataId",
"=",
"$",
"dataId",
"?",
":",
"'new'",
";",
"return",
"array_merge",
"(",... | @param Action $action
@param Request $request
@param null $dataId
@return array | [
"@param",
"Action",
"$action",
"@param",
"Request",
"$request",
"@param",
"null",
"$dataId"
] | train | https://github.com/VincentChalnot/SidusAdminBundle/blob/3366f3f1525435860cf275ed2f1f0b58cf6eea18/Form/FormHelper.php#L112-L127 |
CakeCMS/Core | src/View/Helper/UrlHelper.php | UrlHelper.assetPath | public function assetPath($source, $type = null)
{
$ext = FS::ext($source);
$type = (empty($type)) ? $ext : $type;
$path = FS::clean(WWW_ROOT . '/' . $source, '/');
if (FS::isFile($path)) {
return $path;
}
$path = FS::clean(WWW_ROOT . '/' . $type . '/' ... | php | public function assetPath($source, $type = null)
{
$ext = FS::ext($source);
$type = (empty($type)) ? $ext : $type;
$path = FS::clean(WWW_ROOT . '/' . $source, '/');
if (FS::isFile($path)) {
return $path;
}
$path = FS::clean(WWW_ROOT . '/' . $type . '/' ... | [
"public",
"function",
"assetPath",
"(",
"$",
"source",
",",
"$",
"type",
"=",
"null",
")",
"{",
"$",
"ext",
"=",
"FS",
"::",
"ext",
"(",
"$",
"source",
")",
";",
"$",
"type",
"=",
"(",
"empty",
"(",
"$",
"type",
")",
")",
"?",
"$",
"ext",
":"... | Get absolute asset path.
@param string $source Plugin.path/to/file.css
@param null|string $type Assets folder - default is file ext
@return bool|string | [
"Get",
"absolute",
"asset",
"path",
"."
] | train | https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/View/Helper/UrlHelper.php#L38-L56 |
CakeCMS/Core | src/View/Helper/UrlHelper.php | UrlHelper._findPluginAsset | protected function _findPluginAsset($source, $type = null)
{
list($plugin, $path) = pluginSplit($source);
$plugin = (string) $plugin;
if (Plugin::loaded($plugin)) {
$plgPath = implode('/', [Plugin::path($plugin), Configure::read('App.webroot'), $type, $path]);
$plgPat... | php | protected function _findPluginAsset($source, $type = null)
{
list($plugin, $path) = pluginSplit($source);
$plugin = (string) $plugin;
if (Plugin::loaded($plugin)) {
$plgPath = implode('/', [Plugin::path($plugin), Configure::read('App.webroot'), $type, $path]);
$plgPat... | [
"protected",
"function",
"_findPluginAsset",
"(",
"$",
"source",
",",
"$",
"type",
"=",
"null",
")",
"{",
"list",
"(",
"$",
"plugin",
",",
"$",
"path",
")",
"=",
"pluginSplit",
"(",
"$",
"source",
")",
";",
"$",
"plugin",
"=",
"(",
"string",
")",
"... | Find plugin assets by source.
@param string $source
@param null|string $type
@return bool|string | [
"Find",
"plugin",
"assets",
"by",
"source",
"."
] | train | https://github.com/CakeCMS/Core/blob/f9cba7aa0043a10e5c35bd45fbad158688a09a96/src/View/Helper/UrlHelper.php#L65-L78 |
aedart/laravel-helpers | src/Traits/Queue/QueueFactoryTrait.php | QueueFactoryTrait.getQueueFactory | public function getQueueFactory(): ?Factory
{
if (!$this->hasQueueFactory()) {
$this->setQueueFactory($this->getDefaultQueueFactory());
}
return $this->queueFactory;
} | php | public function getQueueFactory(): ?Factory
{
if (!$this->hasQueueFactory()) {
$this->setQueueFactory($this->getDefaultQueueFactory());
}
return $this->queueFactory;
} | [
"public",
"function",
"getQueueFactory",
"(",
")",
":",
"?",
"Factory",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasQueueFactory",
"(",
")",
")",
"{",
"$",
"this",
"->",
"setQueueFactory",
"(",
"$",
"this",
"->",
"getDefaultQueueFactory",
"(",
")",
")",
... | Get queue factory
If no queue factory has been set, this method will
set and return a default queue factory, if any such
value is available
@see getDefaultQueueFactory()
@return Factory|null queue factory or null if none queue factory has been set | [
"Get",
"queue",
"factory"
] | train | https://github.com/aedart/laravel-helpers/blob/8b81a2d6658f3f8cb62b6be2c34773aaa2df219a/src/Traits/Queue/QueueFactoryTrait.php#L53-L59 |
iocaste/microservice-foundation | src/MicroserviceServiceProvider.php | MicroserviceServiceProvider.register | public function register()
{
$this->setupConfig();
$services = config('microservice.services');
$currentEnv = app()->environment();
/** @var array $services */
foreach ($services as $service) {
if ($service['enabled'] && $this->isInCurrentEnv($currentEnv, $servi... | php | public function register()
{
$this->setupConfig();
$services = config('microservice.services');
$currentEnv = app()->environment();
/** @var array $services */
foreach ($services as $service) {
if ($service['enabled'] && $this->isInCurrentEnv($currentEnv, $servi... | [
"public",
"function",
"register",
"(",
")",
"{",
"$",
"this",
"->",
"setupConfig",
"(",
")",
";",
"$",
"services",
"=",
"config",
"(",
"'microservice.services'",
")",
";",
"$",
"currentEnv",
"=",
"app",
"(",
")",
"->",
"environment",
"(",
")",
";",
"/*... | Register the application services. | [
"Register",
"the",
"application",
"services",
"."
] | train | https://github.com/iocaste/microservice-foundation/blob/274a154de4299e8a57314bab972e09f6d8cdae9e/src/MicroserviceServiceProvider.php#L26-L45 |
iocaste/microservice-foundation | src/MicroserviceServiceProvider.php | MicroserviceServiceProvider.isInCurrentEnv | protected function isInCurrentEnv(string $currentEnv = '*', array $envList = []): bool
{
if (in_array('*', $envList, false)) {
return true;
}
if (in_array($currentEnv, $envList, false)) {
return true;
}
return false;
} | php | protected function isInCurrentEnv(string $currentEnv = '*', array $envList = []): bool
{
if (in_array('*', $envList, false)) {
return true;
}
if (in_array($currentEnv, $envList, false)) {
return true;
}
return false;
} | [
"protected",
"function",
"isInCurrentEnv",
"(",
"string",
"$",
"currentEnv",
"=",
"'*'",
",",
"array",
"$",
"envList",
"=",
"[",
"]",
")",
":",
"bool",
"{",
"if",
"(",
"in_array",
"(",
"'*'",
",",
"$",
"envList",
",",
"false",
")",
")",
"{",
"return"... | @param string $currentEnv
@param array $envList
@return bool | [
"@param",
"string",
"$currentEnv",
"@param",
"array",
"$envList"
] | train | https://github.com/iocaste/microservice-foundation/blob/274a154de4299e8a57314bab972e09f6d8cdae9e/src/MicroserviceServiceProvider.php#L69-L80 |
inpsyde/inpsyde-filter | src/WordPress/SanitizeKey.php | SanitizeKey.filter | public function filter( $value ) {
if ( ! is_string( $value ) || empty( $value ) ) {
do_action( 'inpsyde.filter.error', 'The given value is not string or empty.', [ 'method' => __METHOD__, 'value' => $value ] );
return $value;
}
return sanitize_key( $value );
} | php | public function filter( $value ) {
if ( ! is_string( $value ) || empty( $value ) ) {
do_action( 'inpsyde.filter.error', 'The given value is not string or empty.', [ 'method' => __METHOD__, 'value' => $value ] );
return $value;
}
return sanitize_key( $value );
} | [
"public",
"function",
"filter",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"value",
")",
"||",
"empty",
"(",
"$",
"value",
")",
")",
"{",
"do_action",
"(",
"'inpsyde.filter.error'",
",",
"'The given value is not string or empty.'",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/inpsyde/inpsyde-filter/blob/777a6208ea4dfbeed89e6d0712a35dc25eab498b/src/WordPress/SanitizeKey.php#L18-L27 |
ruvents/ruwork-upload-bundle | DependencyInjection/RuworkUploadExtension.php | RuworkUploadExtension.loadInternal | public function loadInternal(array $config, ContainerBuilder $container): void
{
(new PhpFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')))
->load('services.php');
$container->setParameter('ruwork_upload.uploads_dir', $config['uploads_dir']);
$container->f... | php | public function loadInternal(array $config, ContainerBuilder $container): void
{
(new PhpFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')))
->load('services.php');
$container->setParameter('ruwork_upload.uploads_dir', $config['uploads_dir']);
$container->f... | [
"public",
"function",
"loadInternal",
"(",
"array",
"$",
"config",
",",
"ContainerBuilder",
"$",
"container",
")",
":",
"void",
"{",
"(",
"new",
"PhpFileLoader",
"(",
"$",
"container",
",",
"new",
"FileLocator",
"(",
"__DIR__",
".",
"'/../Resources/config'",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/ruvents/ruwork-upload-bundle/blob/8ad09cc2dce6ab389105c440d791346696da43af/DependencyInjection/RuworkUploadExtension.php#L19-L31 |
ClanCats/Core | src/classes/CCIn.php | CCIn.instance | public static function instance( $set = null )
{
if ( is_null( $set ) )
{
return static::$_instance;
}
if ( !$set instanceof CCIn_Instance )
{
throw new \InvalidArgumentException('CCIn::set() - only CCIn_Instance object can be passed.');
}
static::$_instance = $set;
} | php | public static function instance( $set = null )
{
if ( is_null( $set ) )
{
return static::$_instance;
}
if ( !$set instanceof CCIn_Instance )
{
throw new \InvalidArgumentException('CCIn::set() - only CCIn_Instance object can be passed.');
}
static::$_instance = $set;
} | [
"public",
"static",
"function",
"instance",
"(",
"$",
"set",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"set",
")",
")",
"{",
"return",
"static",
"::",
"$",
"_instance",
";",
"}",
"if",
"(",
"!",
"$",
"set",
"instanceof",
"CCIn_Instance",... | get the current input instance
@param CCIn_Instance $set if set the current instance gets updated
@return CCIn_Instance | [
"get",
"the",
"current",
"input",
"instance"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCIn.php#L29-L42 |
ClanCats/Core | src/classes/CCIn.php | CCIn.create | public static function create( $get, $post, $cookie, $files, $server )
{
return new CCIn_Instance( $get, $post, $cookie, $files, $server );
} | php | public static function create( $get, $post, $cookie, $files, $server )
{
return new CCIn_Instance( $get, $post, $cookie, $files, $server );
} | [
"public",
"static",
"function",
"create",
"(",
"$",
"get",
",",
"$",
"post",
",",
"$",
"cookie",
",",
"$",
"files",
",",
"$",
"server",
")",
"{",
"return",
"new",
"CCIn_Instance",
"(",
"$",
"get",
",",
"$",
"post",
",",
"$",
"cookie",
",",
"$",
"... | create new instance
assign the main vars GET, POST, COOKIE, FILES, SERVER here
@param array $get
@param array $post
@param array $cookie
@param array $files
@param array $server | [
"create",
"new",
"instance",
"assign",
"the",
"main",
"vars",
"GET",
"POST",
"COOKIE",
"FILES",
"SERVER",
"here"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCIn.php#L54-L57 |
qcubed/orm | src/Database/PostgreSql/Database.php | Database.connect | public function connect()
{
// Lookup Adapter-Specific Connection Properties
$strServer = $this->Server;
$strName = $this->Database;
$strUsername = $this->Username;
$strPassword = $this->Password;
$strPort = $this->Port;
// Connect to the Database Server
... | php | public function connect()
{
// Lookup Adapter-Specific Connection Properties
$strServer = $this->Server;
$strName = $this->Database;
$strUsername = $this->Username;
$strPassword = $this->Password;
$strPort = $this->Port;
// Connect to the Database Server
... | [
"public",
"function",
"connect",
"(",
")",
"{",
"// Lookup Adapter-Specific Connection Properties",
"$",
"strServer",
"=",
"$",
"this",
"->",
"Server",
";",
"$",
"strName",
"=",
"$",
"this",
"->",
"Database",
";",
"$",
"strUsername",
"=",
"$",
"this",
"->",
... | Connects to the database
@throws Exception | [
"Connects",
"to",
"the",
"database"
] | train | https://github.com/qcubed/orm/blob/f320eba671f20874b1f3809c5293f8c02d5b1204/src/Database/PostgreSql/Database.php#L248-L267 |
qcubed/orm | src/Database/PostgreSql/Database.php | Database.getTables | public function getTables()
{
$objResult = $this->query("SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = current_schema() AND TABLE_TYPE = 'BASE TABLE' ORDER BY TABLE_NAME ASC");
$strToReturn = array();
while ($strRowArray = $objResult->fetchRow()) {
array_p... | php | public function getTables()
{
$objResult = $this->query("SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = current_schema() AND TABLE_TYPE = 'BASE TABLE' ORDER BY TABLE_NAME ASC");
$strToReturn = array();
while ($strRowArray = $objResult->fetchRow()) {
array_p... | [
"public",
"function",
"getTables",
"(",
")",
"{",
"$",
"objResult",
"=",
"$",
"this",
"->",
"query",
"(",
"\"SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = current_schema() AND TABLE_TYPE = 'BASE TABLE' ORDER BY TABLE_NAME ASC\"",
")",
";",
"$",
"strToRetur... | Returns the list of tables in the database as string
@return array List of tables in the database as string | [
"Returns",
"the",
"list",
"of",
"tables",
"in",
"the",
"database",
"as",
"string"
] | train | https://github.com/qcubed/orm/blob/f320eba671f20874b1f3809c5293f8c02d5b1204/src/Database/PostgreSql/Database.php#L323-L331 |
ppetermann/king23 | src/Controller/Controller.php | Controller.dispatch | public function dispatch($action, ServerRequestInterface $request) : ResponseInterface
{
$this->getLogger()->debug('dispatching to action: '.$action);
if (!method_exists($this, $action) && !method_exists($this, '__call')) {
throw new ActionDoesNotExistException();
}
$res... | php | public function dispatch($action, ServerRequestInterface $request) : ResponseInterface
{
$this->getLogger()->debug('dispatching to action: '.$action);
if (!method_exists($this, $action) && !method_exists($this, '__call')) {
throw new ActionDoesNotExistException();
}
$res... | [
"public",
"function",
"dispatch",
"(",
"$",
"action",
",",
"ServerRequestInterface",
"$",
"request",
")",
":",
"ResponseInterface",
"{",
"$",
"this",
"->",
"getLogger",
"(",
")",
"->",
"debug",
"(",
"'dispatching to action: '",
".",
"$",
"action",
")",
";",
... | function to dispatch requests coming through the router
@param $action
@param ServerRequestInterface $request
@return ResponseInterface
@throws ActionDoesNotExistException | [
"function",
"to",
"dispatch",
"requests",
"coming",
"through",
"the",
"router"
] | train | https://github.com/ppetermann/king23/blob/603896083ec89f5ac4d744abd3b1b4db3e914c95/src/Controller/Controller.php#L52-L61 |
Falc/FlysystemLocalSymlinkPlugin | src/DeleteSymlink.php | DeleteSymlink.handle | public function handle($symlink)
{
$symlink = $this->filesystem->getAdapter()->applyPathPrefix($symlink);
if (!is_link($symlink)) {
return false;
}
return unlink($symlink);
} | php | public function handle($symlink)
{
$symlink = $this->filesystem->getAdapter()->applyPathPrefix($symlink);
if (!is_link($symlink)) {
return false;
}
return unlink($symlink);
} | [
"public",
"function",
"handle",
"(",
"$",
"symlink",
")",
"{",
"$",
"symlink",
"=",
"$",
"this",
"->",
"filesystem",
"->",
"getAdapter",
"(",
")",
"->",
"applyPathPrefix",
"(",
"$",
"symlink",
")",
";",
"if",
"(",
"!",
"is_link",
"(",
"$",
"symlink",
... | Method logic.
Deletes a symlink.
@see http://php.net/manual/en/function.unlink.php Documentation of unlink().
@param string $symlink Symlink name.
@return boolean True on success. False on failure. | [
"Method",
"logic",
"."
] | train | https://github.com/Falc/FlysystemLocalSymlinkPlugin/blob/9301f51f172a030d07e49472d11f3e6b10a6a459/src/DeleteSymlink.php#L59-L68 |
periaptio/empress-generator | src/Generators/MigrationGenerator.php | MigrationGenerator.generateMigrationFile | public function generateMigrationFile($method, $tables)
{
if ($method == 'create') {
$function = 'getFields';
$prefix = 'create';
} elseif ($method = 'foreign_keys') {
$function = 'getForeignKeyConstraints';
$prefix = 'add_foreign_keys_to';
... | php | public function generateMigrationFile($method, $tables)
{
if ($method == 'create') {
$function = 'getFields';
$prefix = 'create';
} elseif ($method = 'foreign_keys') {
$function = 'getForeignKeyConstraints';
$prefix = 'add_foreign_keys_to';
... | [
"public",
"function",
"generateMigrationFile",
"(",
"$",
"method",
",",
"$",
"tables",
")",
"{",
"if",
"(",
"$",
"method",
"==",
"'create'",
")",
"{",
"$",
"function",
"=",
"'getFields'",
";",
"$",
"prefix",
"=",
"'create'",
";",
"}",
"elseif",
"(",
"$... | Generate Migrations
@param string $method Create Tables or Foreign Keys ['create', 'foreign_keys']
@param array $tables List of tables to create migrations for
@throws MethodNotFoundException
@return void | [
"Generate",
"Migrations"
] | train | https://github.com/periaptio/empress-generator/blob/749fb4b12755819e9c97377ebfb446ee0822168a/src/Generators/MigrationGenerator.php#L63-L96 |
periaptio/empress-generator | src/Generators/MigrationGenerator.php | MigrationGenerator.getTemplateData | public function getTemplateData($fields, $data = [])
{
if ($data['METHOD'] == 'create') {
$up = (new AddToTable)->run($fields, $data['TABLE']);
$down = '';
} else {
$up = (new AddForeignKeysToTable)->run($fields, $data['TABLE']);
$down = (new RemoveFor... | php | public function getTemplateData($fields, $data = [])
{
if ($data['METHOD'] == 'create') {
$up = (new AddToTable)->run($fields, $data['TABLE']);
$down = '';
} else {
$up = (new AddForeignKeysToTable)->run($fields, $data['TABLE']);
$down = (new RemoveFor... | [
"public",
"function",
"getTemplateData",
"(",
"$",
"fields",
",",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"$",
"data",
"[",
"'METHOD'",
"]",
"==",
"'create'",
")",
"{",
"$",
"up",
"=",
"(",
"new",
"AddToTable",
")",
"->",
"run",
"(",
"$"... | Fetch the template data
@return array | [
"Fetch",
"the",
"template",
"data"
] | train | https://github.com/periaptio/empress-generator/blob/749fb4b12755819e9c97377ebfb446ee0822168a/src/Generators/MigrationGenerator.php#L103-L117 |
aedart/laravel-helpers | src/Traits/Auth/AuthTrait.php | AuthTrait.getAuth | public function getAuth(): ?Guard
{
if (!$this->hasAuth()) {
$this->setAuth($this->getDefaultAuth());
}
return $this->auth;
} | php | public function getAuth(): ?Guard
{
if (!$this->hasAuth()) {
$this->setAuth($this->getDefaultAuth());
}
return $this->auth;
} | [
"public",
"function",
"getAuth",
"(",
")",
":",
"?",
"Guard",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasAuth",
"(",
")",
")",
"{",
"$",
"this",
"->",
"setAuth",
"(",
"$",
"this",
"->",
"getDefaultAuth",
"(",
")",
")",
";",
"}",
"return",
"$",
... | Get auth
If no auth has been set, this method will
set and return a default auth, if any such
value is available
@see getDefaultAuth()
@return Guard|null auth or null if none auth has been set | [
"Get",
"auth"
] | train | https://github.com/aedart/laravel-helpers/blob/8b81a2d6658f3f8cb62b6be2c34773aaa2df219a/src/Traits/Auth/AuthTrait.php#L53-L59 |
aedart/laravel-helpers | src/Traits/Auth/AuthTrait.php | AuthTrait.getDefaultAuth | public function getDefaultAuth(): ?Guard
{
// By default, the Auth Facade does not return the
// any actual authentication guard, but rather an
// instance of \Illuminate\Auth\AuthManager.
// Therefore, we make sure only to obtain its
// "default guard", to make sure that its... | php | public function getDefaultAuth(): ?Guard
{
// By default, the Auth Facade does not return the
// any actual authentication guard, but rather an
// instance of \Illuminate\Auth\AuthManager.
// Therefore, we make sure only to obtain its
// "default guard", to make sure that its... | [
"public",
"function",
"getDefaultAuth",
"(",
")",
":",
"?",
"Guard",
"{",
"// By default, the Auth Facade does not return the",
"// any actual authentication guard, but rather an",
"// instance of \\Illuminate\\Auth\\AuthManager.",
"// Therefore, we make sure only to obtain its",
"// \"def... | Get a default auth value, if any is available
@return Guard|null A default auth value or Null if no default value is available | [
"Get",
"a",
"default",
"auth",
"value",
"if",
"any",
"is",
"available"
] | train | https://github.com/aedart/laravel-helpers/blob/8b81a2d6658f3f8cb62b6be2c34773aaa2df219a/src/Traits/Auth/AuthTrait.php#L76-L89 |
krzysztofmazur/ntp-client | src/Impl/UdpNtpClient.php | UdpNtpClient.getUnixTime | public function getUnixTime(): int
{
$socket = $this->connect();
$this->sendInitPackage($socket);
$response = $this->readResponse($socket, 48);
$this->close($socket);
return $this->extractTime($response) - self::SINCE_1900_TO_UNIX;
} | php | public function getUnixTime(): int
{
$socket = $this->connect();
$this->sendInitPackage($socket);
$response = $this->readResponse($socket, 48);
$this->close($socket);
return $this->extractTime($response) - self::SINCE_1900_TO_UNIX;
} | [
"public",
"function",
"getUnixTime",
"(",
")",
":",
"int",
"{",
"$",
"socket",
"=",
"$",
"this",
"->",
"connect",
"(",
")",
";",
"$",
"this",
"->",
"sendInitPackage",
"(",
"$",
"socket",
")",
";",
"$",
"response",
"=",
"$",
"this",
"->",
"readRespons... | {@inheritdoc} | [
"{"
] | train | https://github.com/krzysztofmazur/ntp-client/blob/3e15ce8ee26d6e2e57a8bdbdf67273762e3fbfd2/src/Impl/UdpNtpClient.php#L31-L39 |
askupasoftware/amarkal | Template/Controller.php | Controller.render | public function render( $echo = false ){
$rendered_image = '';
if( file_exists( $this->get_script_path() ) )
{
ob_start();
include( $this->get_script_path() );
$rendered_image = ob_get_clean();
}
else
{
... | php | public function render( $echo = false ){
$rendered_image = '';
if( file_exists( $this->get_script_path() ) )
{
ob_start();
include( $this->get_script_path() );
$rendered_image = ob_get_clean();
}
else
{
... | [
"public",
"function",
"render",
"(",
"$",
"echo",
"=",
"false",
")",
"{",
"$",
"rendered_image",
"=",
"''",
";",
"if",
"(",
"file_exists",
"(",
"$",
"this",
"->",
"get_script_path",
"(",
")",
")",
")",
"{",
"ob_start",
"(",
")",
";",
"include",
"(",
... | Render the template with the local properties.
@return string The rendered template.
@throws TemplateNotFoundException Thrown if the template file can
not found. | [
"Render",
"the",
"template",
"with",
"the",
"local",
"properties",
"."
] | train | https://github.com/askupasoftware/amarkal/blob/fe8283e2d6847ef697abec832da7ee741a85058c/Template/Controller.php#L60-L80 |
askupasoftware/amarkal | Template/Controller.php | Controller.get_script_path | protected function get_script_path()
{
if( null == $this->script_path )
{
$class_name = substr( get_called_class() , strrpos( get_called_class(), '\\') + 1);
$this->script_path = $this->get_dir() . '/' . $class_name . '.phtml';
}
return $this->script_path;
... | php | protected function get_script_path()
{
if( null == $this->script_path )
{
$class_name = substr( get_called_class() , strrpos( get_called_class(), '\\') + 1);
$this->script_path = $this->get_dir() . '/' . $class_name . '.phtml';
}
return $this->script_path;
... | [
"protected",
"function",
"get_script_path",
"(",
")",
"{",
"if",
"(",
"null",
"==",
"$",
"this",
"->",
"script_path",
")",
"{",
"$",
"class_name",
"=",
"substr",
"(",
"get_called_class",
"(",
")",
",",
"strrpos",
"(",
"get_called_class",
"(",
")",
",",
"... | Get the full path to the template file.
@return string The full path. | [
"Get",
"the",
"full",
"path",
"to",
"the",
"template",
"file",
"."
] | train | https://github.com/askupasoftware/amarkal/blob/fe8283e2d6847ef697abec832da7ee741a85058c/Template/Controller.php#L87-L95 |
steeffeen/FancyManiaLinks | FML/Components/ValuePicker.php | ValuePicker.createEntry | protected function createEntry()
{
$entry = new Entry();
$entry->setVisible(false)
->setName($this->name);
$this->setEntry($entry);
return $entry;
} | php | protected function createEntry()
{
$entry = new Entry();
$entry->setVisible(false)
->setName($this->name);
$this->setEntry($entry);
return $entry;
} | [
"protected",
"function",
"createEntry",
"(",
")",
"{",
"$",
"entry",
"=",
"new",
"Entry",
"(",
")",
";",
"$",
"entry",
"->",
"setVisible",
"(",
"false",
")",
"->",
"setName",
"(",
"$",
"this",
"->",
"name",
")",
";",
"$",
"this",
"->",
"setEntry",
... | Create the hidden Entry
@return Entry | [
"Create",
"the",
"hidden",
"Entry"
] | train | https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Components/ValuePicker.php#L202-L209 |
aedart/laravel-helpers | src/Traits/Session/SessionTrait.php | SessionTrait.getSession | public function getSession(): ?Session
{
if (!$this->hasSession()) {
$this->setSession($this->getDefaultSession());
}
return $this->session;
} | php | public function getSession(): ?Session
{
if (!$this->hasSession()) {
$this->setSession($this->getDefaultSession());
}
return $this->session;
} | [
"public",
"function",
"getSession",
"(",
")",
":",
"?",
"Session",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"hasSession",
"(",
")",
")",
"{",
"$",
"this",
"->",
"setSession",
"(",
"$",
"this",
"->",
"getDefaultSession",
"(",
")",
")",
";",
"}",
"ret... | Get session
If no session has been set, this method will
set and return a default session, if any such
value is available
@see getDefaultSession()
@return Session|null session or null if none session has been set | [
"Get",
"session"
] | train | https://github.com/aedart/laravel-helpers/blob/8b81a2d6658f3f8cb62b6be2c34773aaa2df219a/src/Traits/Session/SessionTrait.php#L53-L59 |
aedart/laravel-helpers | src/Traits/Session/SessionTrait.php | SessionTrait.getDefaultSession | public function getDefaultSession(): ?Session
{
// By default, the Session Facade does not return the
// any actual session instance, but rather an
// instance of \Illuminate\Session\SessionManager.
// Therefore, we make sure only to obtain its
// "driver", to make sure that ... | php | public function getDefaultSession(): ?Session
{
// By default, the Session Facade does not return the
// any actual session instance, but rather an
// instance of \Illuminate\Session\SessionManager.
// Therefore, we make sure only to obtain its
// "driver", to make sure that ... | [
"public",
"function",
"getDefaultSession",
"(",
")",
":",
"?",
"Session",
"{",
"// By default, the Session Facade does not return the",
"// any actual session instance, but rather an",
"// instance of \\Illuminate\\Session\\SessionManager.",
"// Therefore, we make sure only to obtain its",
... | Get a default session value, if any is available
@return Session|null A default session value or Null if no default value is available | [
"Get",
"a",
"default",
"session",
"value",
"if",
"any",
"is",
"available"
] | train | https://github.com/aedart/laravel-helpers/blob/8b81a2d6658f3f8cb62b6be2c34773aaa2df219a/src/Traits/Session/SessionTrait.php#L76-L89 |
simple-php-mvc/simple-php-mvc | src/MVC/Provider/Provider.php | Provider.getOption | final public function getOption($name)
{
if (!isset($this->options[$name])) {
throw new \LogicException(sprintf('The option "%s" don\'t exists.', $name));
}
return $this->options[$name];
} | php | final public function getOption($name)
{
if (!isset($this->options[$name])) {
throw new \LogicException(sprintf('The option "%s" don\'t exists.', $name));
}
return $this->options[$name];
} | [
"final",
"public",
"function",
"getOption",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"options",
"[",
"$",
"name",
"]",
")",
")",
"{",
"throw",
"new",
"\\",
"LogicException",
"(",
"sprintf",
"(",
"'The option \"%s\" d... | Get option value from name
@param string $name
@return mixed
@throws \LogicException | [
"Get",
"option",
"value",
"from",
"name"
] | train | https://github.com/simple-php-mvc/simple-php-mvc/blob/e319eb09d29afad6993acb4a7e35f32a87dd0841/src/MVC/Provider/Provider.php#L61-L67 |
webforge-labs/psc-cms | lib/Psc/HTML/HTML.php | HTML.string2class | public static function string2class($stringValue) {
// dirty hack: Psc\Code\Code::camelCase2dash benutzt dies hier: also aufpassen, bei großen Änderungen refactorn
$stringValue = trim($stringValue);
if ($stringValue === '') {
return $stringValue;
}
if (Preg::match($stringValue, '/^[A-Z0-... | php | public static function string2class($stringValue) {
// dirty hack: Psc\Code\Code::camelCase2dash benutzt dies hier: also aufpassen, bei großen Änderungen refactorn
$stringValue = trim($stringValue);
if ($stringValue === '') {
return $stringValue;
}
if (Preg::match($stringValue, '/^[A-Z0-... | [
"public",
"static",
"function",
"string2class",
"(",
"$",
"stringValue",
")",
"{",
"// dirty hack: Psc\\Code\\Code::camelCase2dash benutzt dies hier: also aufpassen, bei großen Änderungen refactorn",
"$",
"stringValue",
"=",
"trim",
"(",
"$",
"stringValue",
")",
";",
"if",
"(... | Erstells aus einem CamelCase Namen oder einer Klasse oder einem String eine html-klasse | [
"Erstells",
"aus",
"einem",
"CamelCase",
"Namen",
"oder",
"einer",
"Klasse",
"oder",
"einem",
"String",
"eine",
"html",
"-",
"klasse"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/HTML/HTML.php#L37-L64 |
ray-di/Ray.ValidateModule | docs/demo/1.on_failure.php | Fake1.onInvalidOnPost | public function onInvalidOnPost(FailureInterface $failure)
{
$msg = $failure->getMessages();
$args = (array) $failure->getInvocation()->getArguments();
return [$msg, $args];
} | php | public function onInvalidOnPost(FailureInterface $failure)
{
$msg = $failure->getMessages();
$args = (array) $failure->getInvocation()->getArguments();
return [$msg, $args];
} | [
"public",
"function",
"onInvalidOnPost",
"(",
"FailureInterface",
"$",
"failure",
")",
"{",
"$",
"msg",
"=",
"$",
"failure",
"->",
"getMessages",
"(",
")",
";",
"$",
"args",
"=",
"(",
"array",
")",
"$",
"failure",
"->",
"getInvocation",
"(",
")",
"->",
... | @param FailureInterface $failure
@OnFailure | [
"@param",
"FailureInterface",
"$failure"
] | train | https://github.com/ray-di/Ray.ValidateModule/blob/7e4e3c4a05e11dc989d689202ac6ae625695588e/docs/demo/1.on_failure.php#L51-L57 |
kherge-abandoned/php-wise | src/lib/Herrera/Wise/Loader/LoaderResolver.php | LoaderResolver.setResourceCollector | public function setResourceCollector(ResourceCollectorInterface $collector)
{
$this->collector = $collector;
foreach ($this->getLoaders() as $loader) {
if ($loader instanceof ResourceAwareInterface) {
$loader->setResourceCollector($collector);
}
}
... | php | public function setResourceCollector(ResourceCollectorInterface $collector)
{
$this->collector = $collector;
foreach ($this->getLoaders() as $loader) {
if ($loader instanceof ResourceAwareInterface) {
$loader->setResourceCollector($collector);
}
}
... | [
"public",
"function",
"setResourceCollector",
"(",
"ResourceCollectorInterface",
"$",
"collector",
")",
"{",
"$",
"this",
"->",
"collector",
"=",
"$",
"collector",
";",
"foreach",
"(",
"$",
"this",
"->",
"getLoaders",
"(",
")",
"as",
"$",
"loader",
")",
"{",... | {@inheritDoc} | [
"{"
] | train | https://github.com/kherge-abandoned/php-wise/blob/7621e0be7dbb2a015d68197d290fe8469f539a4d/src/lib/Herrera/Wise/Loader/LoaderResolver.php#L70-L79 |
kherge-abandoned/php-wise | src/lib/Herrera/Wise/Loader/LoaderResolver.php | LoaderResolver.setWise | public function setWise(Wise $wise)
{
$this->wise = $wise;
foreach ($this->getLoaders() as $loader) {
if ($loader instanceof WiseAwareInterface) {
$loader->setWise($wise);
}
}
} | php | public function setWise(Wise $wise)
{
$this->wise = $wise;
foreach ($this->getLoaders() as $loader) {
if ($loader instanceof WiseAwareInterface) {
$loader->setWise($wise);
}
}
} | [
"public",
"function",
"setWise",
"(",
"Wise",
"$",
"wise",
")",
"{",
"$",
"this",
"->",
"wise",
"=",
"$",
"wise",
";",
"foreach",
"(",
"$",
"this",
"->",
"getLoaders",
"(",
")",
"as",
"$",
"loader",
")",
"{",
"if",
"(",
"$",
"loader",
"instanceof",... | {@inheritDoc} | [
"{"
] | train | https://github.com/kherge-abandoned/php-wise/blob/7621e0be7dbb2a015d68197d290fe8469f539a4d/src/lib/Herrera/Wise/Loader/LoaderResolver.php#L84-L93 |
ClanCats/Core | src/bundles/Mail/Transporter/File.php | Transporter_File.send | public function send( CCMail $mail )
{
$data = $mail->export_data();
$filename = 'mails/'.date( 'Y-m' ).'/'.date( 'd' ).'/'.date("H-i-s").'-'.\CCStr::clean_url( $data['subject'] ).'.log';
\CCFile::append( \CCStorage::path( $filename ), \CCJson::encode( $data, true ) );
} | php | public function send( CCMail $mail )
{
$data = $mail->export_data();
$filename = 'mails/'.date( 'Y-m' ).'/'.date( 'd' ).'/'.date("H-i-s").'-'.\CCStr::clean_url( $data['subject'] ).'.log';
\CCFile::append( \CCStorage::path( $filename ), \CCJson::encode( $data, true ) );
} | [
"public",
"function",
"send",
"(",
"CCMail",
"$",
"mail",
")",
"{",
"$",
"data",
"=",
"$",
"mail",
"->",
"export_data",
"(",
")",
";",
"$",
"filename",
"=",
"'mails/'",
".",
"date",
"(",
"'Y-m'",
")",
".",
"'/'",
".",
"date",
"(",
"'d'",
")",
"."... | Send the mail
@param CCMail $mail The mail object.
@return void
@throws Mail\Exception | [
"Send",
"the",
"mail"
] | train | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Mail/Transporter/File.php#L25-L32 |
netgen/ngopengraph | classes/ngopengraphimage.php | ngOpenGraphImage.getData | public function getData()
{
if ( $this->ContentObjectAttribute->hasContent() )
{
$imageAliasHandler = $this->ContentObjectAttribute->attribute( 'content' );
$imageAlias = $imageAliasHandler->imageAlias( 'opengraph' );
if ( $imageAlias['is_valid'] == 1 )
... | php | public function getData()
{
if ( $this->ContentObjectAttribute->hasContent() )
{
$imageAliasHandler = $this->ContentObjectAttribute->attribute( 'content' );
$imageAlias = $imageAliasHandler->imageAlias( 'opengraph' );
if ( $imageAlias['is_valid'] == 1 )
... | [
"public",
"function",
"getData",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"ContentObjectAttribute",
"->",
"hasContent",
"(",
")",
")",
"{",
"$",
"imageAliasHandler",
"=",
"$",
"this",
"->",
"ContentObjectAttribute",
"->",
"attribute",
"(",
"'content'",
"... | Returns data for the attribute
@return string | [
"Returns",
"data",
"for",
"the",
"attribute"
] | train | https://github.com/netgen/ngopengraph/blob/68a99862f240ee74174ea9b888a9a33743142e27/classes/ngopengraphimage.php#L10-L24 |
digitalkaoz/versioneye-php | src/Api/BaseApi.php | BaseApi.request | protected function request($url, $method = 'GET', array $params = [])
{
$url = $this->sanitizeQuery($url);
$response = $this->client->request($method, $url, $params);
if (is_array($response) && isset($response['paging'])) {
$response = $this->injectPager($response, $method, $ur... | php | protected function request($url, $method = 'GET', array $params = [])
{
$url = $this->sanitizeQuery($url);
$response = $this->client->request($method, $url, $params);
if (is_array($response) && isset($response['paging'])) {
$response = $this->injectPager($response, $method, $ur... | [
"protected",
"function",
"request",
"(",
"$",
"url",
",",
"$",
"method",
"=",
"'GET'",
",",
"array",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"$",
"url",
"=",
"$",
"this",
"->",
"sanitizeQuery",
"(",
"$",
"url",
")",
";",
"$",
"response",
"=",
"$"... | performs the request.
@param string $url
@param string $method
@param array $params
@return array | [
"performs",
"the",
"request",
"."
] | train | https://github.com/digitalkaoz/versioneye-php/blob/7b8eb9cdc83e01138dda0e709c07e3beb6aad136/src/Api/BaseApi.php#L37-L48 |
digitalkaoz/versioneye-php | src/Api/BaseApi.php | BaseApi.sanitizeQuery | private function sanitizeQuery($query)
{
$parts = parse_url($query);
$path = $parts['path'];
if (!isset($parts['query'])) {
return $query;
}
$vars = explode('&', $parts['query']);
$final = [];
if (!empty($vars)) {
foreach ($vars as... | php | private function sanitizeQuery($query)
{
$parts = parse_url($query);
$path = $parts['path'];
if (!isset($parts['query'])) {
return $query;
}
$vars = explode('&', $parts['query']);
$final = [];
if (!empty($vars)) {
foreach ($vars as... | [
"private",
"function",
"sanitizeQuery",
"(",
"$",
"query",
")",
"{",
"$",
"parts",
"=",
"parse_url",
"(",
"$",
"query",
")",
";",
"$",
"path",
"=",
"$",
"parts",
"[",
"'path'",
"]",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"parts",
"[",
"'query'",
... | removes empty query string parameters.
@param string $query
@return string | [
"removes",
"empty",
"query",
"string",
"parameters",
"."
] | train | https://github.com/digitalkaoz/versioneye-php/blob/7b8eb9cdc83e01138dda0e709c07e3beb6aad136/src/Api/BaseApi.php#L69-L96 |
digitalkaoz/versioneye-php | src/Api/BaseApi.php | BaseApi.injectPager | private function injectPager(array $response, $method, $url, array $params = [])
{
while (next($response)) {
if ('paging' === key($response)) {
prev($response);
break;
}
}
$pageableKey = key($response);
$response[$pageableKey]... | php | private function injectPager(array $response, $method, $url, array $params = [])
{
while (next($response)) {
if ('paging' === key($response)) {
prev($response);
break;
}
}
$pageableKey = key($response);
$response[$pageableKey]... | [
"private",
"function",
"injectPager",
"(",
"array",
"$",
"response",
",",
"$",
"method",
",",
"$",
"url",
",",
"array",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"while",
"(",
"next",
"(",
"$",
"response",
")",
")",
"{",
"if",
"(",
"'paging'",
"===",... | converts the pageable data into a real pager.
@param array $response
@param string $method
@param string $url
@param array $params
@return array | [
"converts",
"the",
"pageable",
"data",
"into",
"a",
"real",
"pager",
"."
] | train | https://github.com/digitalkaoz/versioneye-php/blob/7b8eb9cdc83e01138dda0e709c07e3beb6aad136/src/Api/BaseApi.php#L108-L124 |
terion-name/package-installer | src/Terion/PackageInstaller/ConfigUpdater.php | ConfigUpdater.addProvider | public function addProvider($provider)
{
if (!in_array($provider, $this->getServiceProviders())) {
$quote = $this->getQuoteType('providers');
$separator = $this->getArrayItemsSeparator('providers');
$anchor = $this->getInsertPoint('providers');
$insert = $sep... | php | public function addProvider($provider)
{
if (!in_array($provider, $this->getServiceProviders())) {
$quote = $this->getQuoteType('providers');
$separator = $this->getArrayItemsSeparator('providers');
$anchor = $this->getInsertPoint('providers');
$insert = $sep... | [
"public",
"function",
"addProvider",
"(",
"$",
"provider",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"provider",
",",
"$",
"this",
"->",
"getServiceProviders",
"(",
")",
")",
")",
"{",
"$",
"quote",
"=",
"$",
"this",
"->",
"getQuoteType",
"(",
... | Add specified provider.
@param $provider | [
"Add",
"specified",
"provider",
"."
] | train | https://github.com/terion-name/package-installer/blob/a1f53085b0b5dbbcc308476f61188103051bd201/src/Terion/PackageInstaller/ConfigUpdater.php#L110-L121 |
terion-name/package-installer | src/Terion/PackageInstaller/ConfigUpdater.php | ConfigUpdater.getQuoteType | protected function getQuoteType($item)
{
$bounds = $this->getConfigItemBounds($item);
if (!$bounds[0] or !$bounds[1]) {
return $this->defaultQuoteType;
}
$file = $this->getFileContents();
$substr = substr($file, $bounds[0], $bounds[1] - $bounds[0] + 1);
... | php | protected function getQuoteType($item)
{
$bounds = $this->getConfigItemBounds($item);
if (!$bounds[0] or !$bounds[1]) {
return $this->defaultQuoteType;
}
$file = $this->getFileContents();
$substr = substr($file, $bounds[0], $bounds[1] - $bounds[0] + 1);
... | [
"protected",
"function",
"getQuoteType",
"(",
"$",
"item",
")",
"{",
"$",
"bounds",
"=",
"$",
"this",
"->",
"getConfigItemBounds",
"(",
"$",
"item",
")",
";",
"if",
"(",
"!",
"$",
"bounds",
"[",
"0",
"]",
"or",
"!",
"$",
"bounds",
"[",
"1",
"]",
... | Detect quote type used in selected config item (providers, aliases).
@param $item
@return string | [
"Detect",
"quote",
"type",
"used",
"in",
"selected",
"config",
"item",
"(",
"providers",
"aliases",
")",
"."
] | train | https://github.com/terion-name/package-installer/blob/a1f53085b0b5dbbcc308476f61188103051bd201/src/Terion/PackageInstaller/ConfigUpdater.php#L130-L141 |
terion-name/package-installer | src/Terion/PackageInstaller/ConfigUpdater.php | ConfigUpdater.getConfigItemBounds | protected function getConfigItemBounds($item)
{
$file = $this->getFileContents();
if (!$file) {
return [null, null];
}
$searchStart = '/[\'"]' . $item . '[\'"]/';
preg_match($searchStart, $file, $matchStart, PREG_OFFSET_CAPTURE);
$start = array_get(reset... | php | protected function getConfigItemBounds($item)
{
$file = $this->getFileContents();
if (!$file) {
return [null, null];
}
$searchStart = '/[\'"]' . $item . '[\'"]/';
preg_match($searchStart, $file, $matchStart, PREG_OFFSET_CAPTURE);
$start = array_get(reset... | [
"protected",
"function",
"getConfigItemBounds",
"(",
"$",
"item",
")",
"{",
"$",
"file",
"=",
"$",
"this",
"->",
"getFileContents",
"(",
")",
";",
"if",
"(",
"!",
"$",
"file",
")",
"{",
"return",
"[",
"null",
",",
"null",
"]",
";",
"}",
"$",
"searc... | Get bite bounds of selected config item (providers, aliases) in file.
@param $item
@return array | [
"Get",
"bite",
"bounds",
"of",
"selected",
"config",
"item",
"(",
"providers",
"aliases",
")",
"in",
"file",
"."
] | train | https://github.com/terion-name/package-installer/blob/a1f53085b0b5dbbcc308476f61188103051bd201/src/Terion/PackageInstaller/ConfigUpdater.php#L150-L176 |
terion-name/package-installer | src/Terion/PackageInstaller/ConfigUpdater.php | ConfigUpdater.getArrayItemsSeparator | protected function getArrayItemsSeparator($item)
{
$cfg = $this->file->getRequire($this->configFile);
if (!$cfg) {
return $this->defaultSeparator;
}
$file = $this->getFileContents();
$arr = array_get($cfg, $item);
$lastItem = end($arr);
$preLas... | php | protected function getArrayItemsSeparator($item)
{
$cfg = $this->file->getRequire($this->configFile);
if (!$cfg) {
return $this->defaultSeparator;
}
$file = $this->getFileContents();
$arr = array_get($cfg, $item);
$lastItem = end($arr);
$preLas... | [
"protected",
"function",
"getArrayItemsSeparator",
"(",
"$",
"item",
")",
"{",
"$",
"cfg",
"=",
"$",
"this",
"->",
"file",
"->",
"getRequire",
"(",
"$",
"this",
"->",
"configFile",
")",
";",
"if",
"(",
"!",
"$",
"cfg",
")",
"{",
"return",
"$",
"this"... | Detect config items separator used in selected config item (providers, aliases).
@param $item
@return string | [
"Detect",
"config",
"items",
"separator",
"used",
"in",
"selected",
"config",
"item",
"(",
"providers",
"aliases",
")",
"."
] | train | https://github.com/terion-name/package-installer/blob/a1f53085b0b5dbbcc308476f61188103051bd201/src/Terion/PackageInstaller/ConfigUpdater.php#L185-L218 |
terion-name/package-installer | src/Terion/PackageInstaller/ConfigUpdater.php | ConfigUpdater.getInsertPoint | protected function getInsertPoint($for)
{
$bound = $this->getConfigItemBounds($for);
$file = $this->getFileContents();
$match = ['\'', '"', ','];
$matches = [];
for ($i = $bound[0]; $i <= $bound[1]; ++$i) {
$char = $file[$i];
if (in_array($char, $matc... | php | protected function getInsertPoint($for)
{
$bound = $this->getConfigItemBounds($for);
$file = $this->getFileContents();
$match = ['\'', '"', ','];
$matches = [];
for ($i = $bound[0]; $i <= $bound[1]; ++$i) {
$char = $file[$i];
if (in_array($char, $matc... | [
"protected",
"function",
"getInsertPoint",
"(",
"$",
"for",
")",
"{",
"$",
"bound",
"=",
"$",
"this",
"->",
"getConfigItemBounds",
"(",
"$",
"for",
")",
";",
"$",
"file",
"=",
"$",
"this",
"->",
"getFileContents",
"(",
")",
";",
"$",
"match",
"=",
"[... | Detect point where to insert new data for selected config item (providers, aliases).
@param $for
@return array | [
"Detect",
"point",
"where",
"to",
"insert",
"new",
"data",
"for",
"selected",
"config",
"item",
"(",
"providers",
"aliases",
")",
"."
] | train | https://github.com/terion-name/package-installer/blob/a1f53085b0b5dbbcc308476f61188103051bd201/src/Terion/PackageInstaller/ConfigUpdater.php#L227-L243 |
terion-name/package-installer | src/Terion/PackageInstaller/ConfigUpdater.php | ConfigUpdater.isCharInComment | protected function isCharInComment($haystack, $charPosition)
{
// check for line comment
for ($c = $charPosition; $c > 0; --$c) {
if ($haystack[$c] === PHP_EOL) {
break;
} elseif ($haystack[$c] === '#' or ($haystack[$c] === '/'
and ($haysta... | php | protected function isCharInComment($haystack, $charPosition)
{
// check for line comment
for ($c = $charPosition; $c > 0; --$c) {
if ($haystack[$c] === PHP_EOL) {
break;
} elseif ($haystack[$c] === '#' or ($haystack[$c] === '/'
and ($haysta... | [
"protected",
"function",
"isCharInComment",
"(",
"$",
"haystack",
",",
"$",
"charPosition",
")",
"{",
"// check for line comment",
"for",
"(",
"$",
"c",
"=",
"$",
"charPosition",
";",
"$",
"c",
">",
"0",
";",
"--",
"$",
"c",
")",
"{",
"if",
"(",
"$",
... | Detect is character at specified position is inside of a comment
@param $haystack
@param $charPosition
@return bool | [
"Detect",
"is",
"character",
"at",
"specified",
"position",
"is",
"inside",
"of",
"a",
"comment"
] | train | https://github.com/terion-name/package-installer/blob/a1f53085b0b5dbbcc308476f61188103051bd201/src/Terion/PackageInstaller/ConfigUpdater.php#L253-L280 |
terion-name/package-installer | src/Terion/PackageInstaller/ConfigUpdater.php | ConfigUpdater.write | protected function write($text, $anchor)
{
$this->backup();
$file = $this->getFileContents();
if ($anchor['symbol'] === ',') {
$text = ltrim($text, ',');
}
$file = substr_replace($file, $text, $anchor['position'], 0);
$this->file->put($this->configFile, $f... | php | protected function write($text, $anchor)
{
$this->backup();
$file = $this->getFileContents();
if ($anchor['symbol'] === ',') {
$text = ltrim($text, ',');
}
$file = substr_replace($file, $text, $anchor['position'], 0);
$this->file->put($this->configFile, $f... | [
"protected",
"function",
"write",
"(",
"$",
"text",
",",
"$",
"anchor",
")",
"{",
"$",
"this",
"->",
"backup",
"(",
")",
";",
"$",
"file",
"=",
"$",
"this",
"->",
"getFileContents",
"(",
")",
";",
"if",
"(",
"$",
"anchor",
"[",
"'symbol'",
"]",
"... | Write new data to config file for selected config item (providers, aliases).
@param $text
@param $anchor | [
"Write",
"new",
"data",
"to",
"config",
"file",
"for",
"selected",
"config",
"item",
"(",
"providers",
"aliases",
")",
"."
] | train | https://github.com/terion-name/package-installer/blob/a1f53085b0b5dbbcc308476f61188103051bd201/src/Terion/PackageInstaller/ConfigUpdater.php#L288-L298 |
terion-name/package-installer | src/Terion/PackageInstaller/ConfigUpdater.php | ConfigUpdater.backup | protected function backup()
{
$from = $this->configFile;
$pathinfo = pathinfo($from);
$to = $pathinfo['dirname'] . DIRECTORY_SEPARATOR . $pathinfo['filename'] . '.bak.php';
$this->file->copy($from, $to);
} | php | protected function backup()
{
$from = $this->configFile;
$pathinfo = pathinfo($from);
$to = $pathinfo['dirname'] . DIRECTORY_SEPARATOR . $pathinfo['filename'] . '.bak.php';
$this->file->copy($from, $to);
} | [
"protected",
"function",
"backup",
"(",
")",
"{",
"$",
"from",
"=",
"$",
"this",
"->",
"configFile",
";",
"$",
"pathinfo",
"=",
"pathinfo",
"(",
"$",
"from",
")",
";",
"$",
"to",
"=",
"$",
"pathinfo",
"[",
"'dirname'",
"]",
".",
"DIRECTORY_SEPARATOR",
... | Backup config file | [
"Backup",
"config",
"file"
] | train | https://github.com/terion-name/package-installer/blob/a1f53085b0b5dbbcc308476f61188103051bd201/src/Terion/PackageInstaller/ConfigUpdater.php#L303-L309 |
terion-name/package-installer | src/Terion/PackageInstaller/ConfigUpdater.php | ConfigUpdater.cleanup | protected function cleanup()
{
$pathinfo = pathinfo($this->configFile);
$backup = $pathinfo['dirname'] . DIRECTORY_SEPARATOR . $pathinfo['filename'] . '.bak.php';
$this->file->delete($backup);
} | php | protected function cleanup()
{
$pathinfo = pathinfo($this->configFile);
$backup = $pathinfo['dirname'] . DIRECTORY_SEPARATOR . $pathinfo['filename'] . '.bak.php';
$this->file->delete($backup);
} | [
"protected",
"function",
"cleanup",
"(",
")",
"{",
"$",
"pathinfo",
"=",
"pathinfo",
"(",
"$",
"this",
"->",
"configFile",
")",
";",
"$",
"backup",
"=",
"$",
"pathinfo",
"[",
"'dirname'",
"]",
".",
"DIRECTORY_SEPARATOR",
".",
"$",
"pathinfo",
"[",
"'file... | Cleanup backup | [
"Cleanup",
"backup"
] | train | https://github.com/terion-name/package-installer/blob/a1f53085b0b5dbbcc308476f61188103051bd201/src/Terion/PackageInstaller/ConfigUpdater.php#L314-L319 |
terion-name/package-installer | src/Terion/PackageInstaller/ConfigUpdater.php | ConfigUpdater.addAlias | public function addAlias($alias, $facade)
{
if ($facadeCurrent = array_get($this->getAliases(), $alias)) {
if ($facadeCurrent === $facade) {
return;
}
$this->commentOut($alias, 'aliases');
}
$quote = $this->getQuoteType('aliases');
... | php | public function addAlias($alias, $facade)
{
if ($facadeCurrent = array_get($this->getAliases(), $alias)) {
if ($facadeCurrent === $facade) {
return;
}
$this->commentOut($alias, 'aliases');
}
$quote = $this->getQuoteType('aliases');
... | [
"public",
"function",
"addAlias",
"(",
"$",
"alias",
",",
"$",
"facade",
")",
"{",
"if",
"(",
"$",
"facadeCurrent",
"=",
"array_get",
"(",
"$",
"this",
"->",
"getAliases",
"(",
")",
",",
"$",
"alias",
")",
")",
"{",
"if",
"(",
"$",
"facadeCurrent",
... | Add specified facade.
@param $alias
@param $facade | [
"Add",
"specified",
"facade",
"."
] | train | https://github.com/terion-name/package-installer/blob/a1f53085b0b5dbbcc308476f61188103051bd201/src/Terion/PackageInstaller/ConfigUpdater.php#L327-L343 |
terion-name/package-installer | src/Terion/PackageInstaller/ConfigUpdater.php | ConfigUpdater.commentOut | protected function commentOut($search, $from)
{
$bounds = $this->getConfigItemBounds($from);
$file = $this->getFileContents();
$cutted = substr($file, 0, $bounds[1]);
preg_match_all(
'/[\'"]' . preg_quote($search) . '[\'"]/',
$cutted,
$matchFacade... | php | protected function commentOut($search, $from)
{
$bounds = $this->getConfigItemBounds($from);
$file = $this->getFileContents();
$cutted = substr($file, 0, $bounds[1]);
preg_match_all(
'/[\'"]' . preg_quote($search) . '[\'"]/',
$cutted,
$matchFacade... | [
"protected",
"function",
"commentOut",
"(",
"$",
"search",
",",
"$",
"from",
")",
"{",
"$",
"bounds",
"=",
"$",
"this",
"->",
"getConfigItemBounds",
"(",
"$",
"from",
")",
";",
"$",
"file",
"=",
"$",
"this",
"->",
"getFileContents",
"(",
")",
";",
"$... | Comment item
@param $search
@param $from | [
"Comment",
"item"
] | train | https://github.com/terion-name/package-installer/blob/a1f53085b0b5dbbcc308476f61188103051bd201/src/Terion/PackageInstaller/ConfigUpdater.php#L351-L375 |
nodes-php/database | src/Support/Traits/Date.php | Date.getDateHumanReadable | public function getDateHumanReadable($column, $format = 'd-m-Y H:i:s', $maxDays = 3)
{
// Retrieve value of column
$date = $this->{$column};
// Make sure date is a Carbon object
// otherwise just return untouched value
if (! $date instanceof Carbon) {
return $col... | php | public function getDateHumanReadable($column, $format = 'd-m-Y H:i:s', $maxDays = 3)
{
// Retrieve value of column
$date = $this->{$column};
// Make sure date is a Carbon object
// otherwise just return untouched value
if (! $date instanceof Carbon) {
return $col... | [
"public",
"function",
"getDateHumanReadable",
"(",
"$",
"column",
",",
"$",
"format",
"=",
"'d-m-Y H:i:s'",
",",
"$",
"maxDays",
"=",
"3",
")",
"{",
"// Retrieve value of column",
"$",
"date",
"=",
"$",
"this",
"->",
"{",
"$",
"column",
"}",
";",
"// Make ... | Convert date to human-readable
E.g. "2 hours ago".
@author Morten Rugaard <moru@nodes.dk>
@date 21-10-2015
@param string $column
@param string $format
@param int $maxDays
@return string | [
"Convert",
"date",
"to",
"human",
"-",
"readable",
"E",
".",
"g",
".",
"2",
"hours",
"ago",
"."
] | train | https://github.com/nodes-php/database/blob/ec58a01a2b966f89efeac58ac9ac633919c04a52/src/Support/Traits/Date.php#L26-L45 |
webforge-labs/psc-cms | lib/Psc/CMS/Controller/ContentStreamController.php | ContentStreamController.processEntityFormRequest | protected function processEntityFormRequest(Entity $entity, FormData $requestData, $revision) {
$dataName = 'layoutManager';
if (isset($requestData->$dataName) && count($requestData->$dataName) > 0) {
$serialized = $requestData->$dataName;
} /*else {
throw $this->err->validationError($dataN... | php | protected function processEntityFormRequest(Entity $entity, FormData $requestData, $revision) {
$dataName = 'layoutManager';
if (isset($requestData->$dataName) && count($requestData->$dataName) > 0) {
$serialized = $requestData->$dataName;
} /*else {
throw $this->err->validationError($dataN... | [
"protected",
"function",
"processEntityFormRequest",
"(",
"Entity",
"$",
"entity",
",",
"FormData",
"$",
"requestData",
",",
"$",
"revision",
")",
"{",
"$",
"dataName",
"=",
"'layoutManager'",
";",
"if",
"(",
"isset",
"(",
"$",
"requestData",
"->",
"$",
"dat... | Überschreibt die AbstractEntityController FUnktion die den FormPanel abspeichert | [
"Überschreibt",
"die",
"AbstractEntityController",
"FUnktion",
"die",
"den",
"FormPanel",
"abspeichert"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/CMS/Controller/ContentStreamController.php#L71-L99 |
webforge-labs/psc-cms | lib/Psc/CMS/Controller/ContentStreamController.php | ContentStreamController.prepareFor | public function prepareFor(ContentStreamAware $entity, $type, $locale, $revision = 'default', $save = TRUE) {
try {
$contentStream =
$entity->getContentStream()
->locale($locale)
->type($type)
->revision($revision)
->one()
;
} catch (NoContentS... | php | public function prepareFor(ContentStreamAware $entity, $type, $locale, $revision = 'default', $save = TRUE) {
try {
$contentStream =
$entity->getContentStream()
->locale($locale)
->type($type)
->revision($revision)
->one()
;
} catch (NoContentS... | [
"public",
"function",
"prepareFor",
"(",
"ContentStreamAware",
"$",
"entity",
",",
"$",
"type",
",",
"$",
"locale",
",",
"$",
"revision",
"=",
"'default'",
",",
"$",
"save",
"=",
"TRUE",
")",
"{",
"try",
"{",
"$",
"contentStream",
"=",
"$",
"entity",
"... | Adds or returns a new ContentStream for the entity
@param bool $save per default the new contentStream (if created) is persisted and the em is flushed(!)
@return ContentStream (created or fetched from db) | [
"Adds",
"or",
"returns",
"a",
"new",
"ContentStream",
"for",
"the",
"entity"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/CMS/Controller/ContentStreamController.php#L147-L173 |
webforge-labs/psc-cms | lib/Psc/Data/ArrayCollection.php | ArrayCollection.deleteDiff | public function deleteDiff(Collection $collection, $compareFunction) {
return new ArrayCollection(array_merge(
$this->difference($this->toArray(), $collection->toArray(), $compareFunction)
));
} | php | public function deleteDiff(Collection $collection, $compareFunction) {
return new ArrayCollection(array_merge(
$this->difference($this->toArray(), $collection->toArray(), $compareFunction)
));
} | [
"public",
"function",
"deleteDiff",
"(",
"Collection",
"$",
"collection",
",",
"$",
"compareFunction",
")",
"{",
"return",
"new",
"ArrayCollection",
"(",
"array_merge",
"(",
"$",
"this",
"->",
"difference",
"(",
"$",
"this",
"->",
"toArray",
"(",
")",
",",
... | Gibt alle Elemente zurück, die in dieser Collection, aber nicht in $collection sind
man müsste also die elemente dieser Ausgabe von $this entfernen, um zu $collection gleich zu sein
die $compareFunction bekommt 2 Parameter: $item1 und $item2. Diese sind aus $collection und $this
Bei Gleichheit muss sie 0 zurückgeben
... | [
"Gibt",
"alle",
"Elemente",
"zurück",
"die",
"in",
"dieser",
"Collection",
"aber",
"nicht",
"in",
"$collection",
"sind"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Data/ArrayCollection.php#L88-L92 |
webforge-labs/psc-cms | lib/Psc/Data/ArrayCollection.php | ArrayCollection.isSame | public function isSame(Collection $collection, $compareFunction) {
// ungleiche Anzahl ist nie gleich => fastcheck
if (count($this) !== count($collection)) return FALSE;
// Anzahl ist gleich, d. h. es sollte keine Elemente geben, die an einem Index nicht dem anderen Array identisch sind
$compareFun... | php | public function isSame(Collection $collection, $compareFunction) {
// ungleiche Anzahl ist nie gleich => fastcheck
if (count($this) !== count($collection)) return FALSE;
// Anzahl ist gleich, d. h. es sollte keine Elemente geben, die an einem Index nicht dem anderen Array identisch sind
$compareFun... | [
"public",
"function",
"isSame",
"(",
"Collection",
"$",
"collection",
",",
"$",
"compareFunction",
")",
"{",
"// ungleiche Anzahl ist nie gleich => fastcheck",
"if",
"(",
"count",
"(",
"$",
"this",
")",
"!==",
"count",
"(",
"$",
"collection",
")",
")",
"return",... | Vergleicht die Collections auf identische Inhalte
Die Inhalte 2er Collections sind identisch, für alle Elemente an der Position $x der collections gilt:
$compareFunction($this[$x], $collection[$x]) === 0
die angegebene $compareFunction kann unabhängig von einer Reihenfolge der Elemente sein. (nur Ausgabe === 0 ist wi... | [
"Vergleicht",
"die",
"Collections",
"auf",
"identische",
"Inhalte"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Data/ArrayCollection.php#L153-L171 |
webforge-labs/psc-cms | lib/Psc/Data/ArrayCollection.php | ArrayCollection.isEqual | public function isEqual(Collection $collection, $compareFunction) {
// ungleiche Anzahl ist nie gleich => fastcheck
if (count($this) !== count($collection)) return FALSE;
if (count($this->insertDiff($collection, $compareFunction)) > 0) return FALSE;
if (count($this->deleteDiff($collection, $compareFunc... | php | public function isEqual(Collection $collection, $compareFunction) {
// ungleiche Anzahl ist nie gleich => fastcheck
if (count($this) !== count($collection)) return FALSE;
if (count($this->insertDiff($collection, $compareFunction)) > 0) return FALSE;
if (count($this->deleteDiff($collection, $compareFunc... | [
"public",
"function",
"isEqual",
"(",
"Collection",
"$",
"collection",
",",
"$",
"compareFunction",
")",
"{",
"// ungleiche Anzahl ist nie gleich => fastcheck",
"if",
"(",
"count",
"(",
"$",
"this",
")",
"!==",
"count",
"(",
"$",
"collection",
")",
")",
"return"... | Vergleicht die Inhalte zweier Collections
die Schlüssel der Elemente sind nicht relevant (anders als bei isSame)
@return bool | [
"Vergleicht",
"die",
"Inhalte",
"zweier",
"Collections"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Data/ArrayCollection.php#L179-L187 |
webforge-labs/psc-cms | lib/Psc/Data/ArrayCollection.php | ArrayCollection.computeCUDSets | public function computeCUDSets(Collection $collection, $compareFunction, $uniqueHashFunction = NULL) {
$compareFunction = $this->compileCompareFunction($compareFunction);
if (!isset($uniqueHashFunction)) {
$uniqueHashFunction = function ($o) {
return spl_object_hash($o);
};
}
$u... | php | public function computeCUDSets(Collection $collection, $compareFunction, $uniqueHashFunction = NULL) {
$compareFunction = $this->compileCompareFunction($compareFunction);
if (!isset($uniqueHashFunction)) {
$uniqueHashFunction = function ($o) {
return spl_object_hash($o);
};
}
$u... | [
"public",
"function",
"computeCUDSets",
"(",
"Collection",
"$",
"collection",
",",
"$",
"compareFunction",
",",
"$",
"uniqueHashFunction",
"=",
"NULL",
")",
"{",
"$",
"compareFunction",
"=",
"$",
"this",
"->",
"compileCompareFunction",
"(",
"$",
"compareFunction",... | Berechnet updates / inserts / deletes (komplettes diff) 2er Collections
Natürlich ist es auch möglich diese mit insertDiff/deleteDiff/Intersect zu berechnen. Diese Funktion ist aber schneller und benötigt dafür nur ein uniqueHash-Kriterium (welches standardmäßig der spl_object_hash ist).
D. h. im DefaultFall funkionie... | [
"Berechnet",
"updates",
"/",
"inserts",
"/",
"deletes",
"(",
"komplettes",
"diff",
")",
"2er",
"Collections"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Data/ArrayCollection.php#L200-L241 |
webforge-labs/psc-cms | lib/Psc/CMS/Controller/ExcelController.php | ExcelController.convert | public function convert(\stdClass $table, $excelFile = NULL, $removeEmpty = TRUE) {
$excelFile = $excelFile ?: $this->v->validateUploadedFile('excelFile');
$reader = PHPExcel_IOFactory::createReaderForFile((string) $excelFile);
$excel = $reader->load((string) $excelFile);
$sheet = $excel->getSheet(... | php | public function convert(\stdClass $table, $excelFile = NULL, $removeEmpty = TRUE) {
$excelFile = $excelFile ?: $this->v->validateUploadedFile('excelFile');
$reader = PHPExcel_IOFactory::createReaderForFile((string) $excelFile);
$excel = $reader->load((string) $excelFile);
$sheet = $excel->getSheet(... | [
"public",
"function",
"convert",
"(",
"\\",
"stdClass",
"$",
"table",
",",
"$",
"excelFile",
"=",
"NULL",
",",
"$",
"removeEmpty",
"=",
"TRUE",
")",
"{",
"$",
"excelFile",
"=",
"$",
"excelFile",
"?",
":",
"$",
"this",
"->",
"v",
"->",
"validateUploaded... | Konvertiert ein Excel in einen Array
Erwartet excelFile als Uploaded File
der zurückgegebene Array hat jedoch keine Zahlen Columns sondern auch einen 0 basierten index
auch die Rows sind 0 basierend
@controller-api
@return array | [
"Konvertiert",
"ein",
"Excel",
"in",
"einen",
"Array"
] | train | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/CMS/Controller/ExcelController.php#L95-L132 |
4devs/ElfinderPhpConnector | Util/ImageManagerTrait.php | ImageManagerTrait.setImageManager | public function setImageManager(ImageManager $imageManager = null, array $config = [])
{
if (!$imageManager) {
$imageManager = new ImageManager($config);
}
$this->imageManager = $imageManager;
return $this;
} | php | public function setImageManager(ImageManager $imageManager = null, array $config = [])
{
if (!$imageManager) {
$imageManager = new ImageManager($config);
}
$this->imageManager = $imageManager;
return $this;
} | [
"public",
"function",
"setImageManager",
"(",
"ImageManager",
"$",
"imageManager",
"=",
"null",
",",
"array",
"$",
"config",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"$",
"imageManager",
")",
"{",
"$",
"imageManager",
"=",
"new",
"ImageManager",
"(",
"$"... | @param ImageManager $imageManager
@param array $config
@return $this | [
"@param",
"ImageManager",
"$imageManager",
"@param",
"array",
"$config"
] | train | https://github.com/4devs/ElfinderPhpConnector/blob/510e295dcafeaa0f796986ad87b3ed5f6b0d9338/Util/ImageManagerTrait.php#L18-L26 |
spiral-modules/auth | source/Auth/Operators/Bridges/CookieBridge.php | CookieBridge.hasToken | public function hasToken(Request $request): bool
{
$cookies = $request->getCookieParams();
return isset($cookies[$this->cookie]);
} | php | public function hasToken(Request $request): bool
{
$cookies = $request->getCookieParams();
return isset($cookies[$this->cookie]);
} | [
"public",
"function",
"hasToken",
"(",
"Request",
"$",
"request",
")",
":",
"bool",
"{",
"$",
"cookies",
"=",
"$",
"request",
"->",
"getCookieParams",
"(",
")",
";",
"return",
"isset",
"(",
"$",
"cookies",
"[",
"$",
"this",
"->",
"cookie",
"]",
")",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/spiral-modules/auth/blob/24e2070028f7257e8192914556963a4794428a99/source/Auth/Operators/Bridges/CookieBridge.php#L45-L50 |
spiral-modules/auth | source/Auth/Operators/Bridges/CookieBridge.php | CookieBridge.fetchToken | public function fetchToken(Request $request)
{
$cookies = $request->getCookieParams();
return isset($cookies[$this->cookie]) ? $cookies[$this->cookie] : null;
} | php | public function fetchToken(Request $request)
{
$cookies = $request->getCookieParams();
return isset($cookies[$this->cookie]) ? $cookies[$this->cookie] : null;
} | [
"public",
"function",
"fetchToken",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"cookies",
"=",
"$",
"request",
"->",
"getCookieParams",
"(",
")",
";",
"return",
"isset",
"(",
"$",
"cookies",
"[",
"$",
"this",
"->",
"cookie",
"]",
")",
"?",
"$",
"... | {@inheritdoc} | [
"{"
] | train | https://github.com/spiral-modules/auth/blob/24e2070028f7257e8192914556963a4794428a99/source/Auth/Operators/Bridges/CookieBridge.php#L55-L60 |
spiral-modules/auth | source/Auth/Operators/Bridges/CookieBridge.php | CookieBridge.writeToken | public function writeToken(
Request $request,
Response $response,
int $lifetime,
string $token = null
): Response {
$cookies = $request->getCookieParams();
if (isset($cookies[$this->cookie]) && $cookies[$this->cookie] == $token) {
//Nothing to do
... | php | public function writeToken(
Request $request,
Response $response,
int $lifetime,
string $token = null
): Response {
$cookies = $request->getCookieParams();
if (isset($cookies[$this->cookie]) && $cookies[$this->cookie] == $token) {
//Nothing to do
... | [
"public",
"function",
"writeToken",
"(",
"Request",
"$",
"request",
",",
"Response",
"$",
"response",
",",
"int",
"$",
"lifetime",
",",
"string",
"$",
"token",
"=",
"null",
")",
":",
"Response",
"{",
"$",
"cookies",
"=",
"$",
"request",
"->",
"getCookieP... | {@inheritdoc} | [
"{"
] | train | https://github.com/spiral-modules/auth/blob/24e2070028f7257e8192914556963a4794428a99/source/Auth/Operators/Bridges/CookieBridge.php#L65-L87 |
picamator/CacheManager | src/Data/SearchCriteriaBuilder.php | SearchCriteriaBuilder.build | public function build() : SearchCriteriaInterface
{
/** @var SearchCriteriaInterface $result */
$result = $this->objectManager->create($this->className, $this->data);
$this->cleanData();
return $result;
} | php | public function build() : SearchCriteriaInterface
{
/** @var SearchCriteriaInterface $result */
$result = $this->objectManager->create($this->className, $this->data);
$this->cleanData();
return $result;
} | [
"public",
"function",
"build",
"(",
")",
":",
"SearchCriteriaInterface",
"{",
"/** @var SearchCriteriaInterface $result */",
"$",
"result",
"=",
"$",
"this",
"->",
"objectManager",
"->",
"create",
"(",
"$",
"this",
"->",
"className",
",",
"$",
"this",
"->",
"dat... | {@inheritdoc} | [
"{"
] | train | https://github.com/picamator/CacheManager/blob/5e5493910610b65ae31a362786d7963ba3e33806/src/Data/SearchCriteriaBuilder.php#L104-L111 |
picamator/CacheManager | src/Data/SearchCriteriaBuilder.php | SearchCriteriaBuilder.cleanData | private function cleanData()
{
foreach ($this->data as &$item) {
$item = is_array($item) ? [] : null;
}
unset($item); // prevent unexpected behaviour
} | php | private function cleanData()
{
foreach ($this->data as &$item) {
$item = is_array($item) ? [] : null;
}
unset($item); // prevent unexpected behaviour
} | [
"private",
"function",
"cleanData",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"data",
"as",
"&",
"$",
"item",
")",
"{",
"$",
"item",
"=",
"is_array",
"(",
"$",
"item",
")",
"?",
"[",
"]",
":",
"null",
";",
"}",
"unset",
"(",
"$",
"item"... | Clean data. | [
"Clean",
"data",
"."
] | train | https://github.com/picamator/CacheManager/blob/5e5493910610b65ae31a362786d7963ba3e33806/src/Data/SearchCriteriaBuilder.php#L116-L122 |
jacobemerick/pqp | src/PhpQuickProfiler.php | PhpQuickProfiler.gatherFileData | public function gatherFileData()
{
$files = get_included_files();
$data = array();
foreach ($files as $file) {
array_push($data, array(
'name' => $file,
'size' => filesize($file)
));
}
return $data;
} | php | public function gatherFileData()
{
$files = get_included_files();
$data = array();
foreach ($files as $file) {
array_push($data, array(
'name' => $file,
'size' => filesize($file)
));
}
return $data;
} | [
"public",
"function",
"gatherFileData",
"(",
")",
"{",
"$",
"files",
"=",
"get_included_files",
"(",
")",
";",
"$",
"data",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"files",
"as",
"$",
"file",
")",
"{",
"array_push",
"(",
"$",
"data",
",",
... | Get data about files loaded for the application to current point
@returns array | [
"Get",
"data",
"about",
"files",
"loaded",
"for",
"the",
"application",
"to",
"current",
"point"
] | train | https://github.com/jacobemerick/pqp/blob/08276f050425d1ab71e7ca3b897eb8c409ccbe70/src/PhpQuickProfiler.php#L64-L75 |
jacobemerick/pqp | src/PhpQuickProfiler.php | PhpQuickProfiler.gatherQueryData | public function gatherQueryData($dbConnection = null)
{
if (is_null($dbConnection)) {
return array();
}
if (empty($this->profiledQueries) && property_exists($dbConnection, 'queries')) {
$this->setProfiledQueries($dbConnection->queries);
}
$data = arr... | php | public function gatherQueryData($dbConnection = null)
{
if (is_null($dbConnection)) {
return array();
}
if (empty($this->profiledQueries) && property_exists($dbConnection, 'queries')) {
$this->setProfiledQueries($dbConnection->queries);
}
$data = arr... | [
"public",
"function",
"gatherQueryData",
"(",
"$",
"dbConnection",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"dbConnection",
")",
")",
"{",
"return",
"array",
"(",
")",
";",
"}",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"profiledQueries... | Get data about sql usage of the application
@param object $dbConnection
@returns array | [
"Get",
"data",
"about",
"sql",
"usage",
"of",
"the",
"application"
] | train | https://github.com/jacobemerick/pqp/blob/08276f050425d1ab71e7ca3b897eb8c409ccbe70/src/PhpQuickProfiler.php#L106-L125 |
jacobemerick/pqp | src/PhpQuickProfiler.php | PhpQuickProfiler.explainQuery | protected function explainQuery($dbConnection, $query, $parameters = array())
{
$driver = $dbConnection->getAttribute(\PDO::ATTR_DRIVER_NAME);
$query = $this->getExplainQuery($query, $driver);
$statement = $dbConnection->prepare($query);
if ($statement === false) {
throw ... | php | protected function explainQuery($dbConnection, $query, $parameters = array())
{
$driver = $dbConnection->getAttribute(\PDO::ATTR_DRIVER_NAME);
$query = $this->getExplainQuery($query, $driver);
$statement = $dbConnection->prepare($query);
if ($statement === false) {
throw ... | [
"protected",
"function",
"explainQuery",
"(",
"$",
"dbConnection",
",",
"$",
"query",
",",
"$",
"parameters",
"=",
"array",
"(",
")",
")",
"{",
"$",
"driver",
"=",
"$",
"dbConnection",
"->",
"getAttribute",
"(",
"\\",
"PDO",
"::",
"ATTR_DRIVER_NAME",
")",
... | Attempts to explain a query
@param object $dbConnection
@param string $query
@param array $parameters
@throws Exception
@return array | [
"Attempts",
"to",
"explain",
"a",
"query"
] | train | https://github.com/jacobemerick/pqp/blob/08276f050425d1ab71e7ca3b897eb8c409ccbe70/src/PhpQuickProfiler.php#L136-L150 |
jacobemerick/pqp | src/PhpQuickProfiler.php | PhpQuickProfiler.gatherSpeedData | public function gatherSpeedData()
{
$elapsedTime = microtime(true) - $this->startTime;
$elapsedTime = round($elapsedTime, 3);
$allowedTime = ini_get('max_execution_time');
return array(
'elapsed' => $elapsedTime,
'allowed' => $allowedTime
);
} | php | public function gatherSpeedData()
{
$elapsedTime = microtime(true) - $this->startTime;
$elapsedTime = round($elapsedTime, 3);
$allowedTime = ini_get('max_execution_time');
return array(
'elapsed' => $elapsedTime,
'allowed' => $allowedTime
);
} | [
"public",
"function",
"gatherSpeedData",
"(",
")",
"{",
"$",
"elapsedTime",
"=",
"microtime",
"(",
"true",
")",
"-",
"$",
"this",
"->",
"startTime",
";",
"$",
"elapsedTime",
"=",
"round",
"(",
"$",
"elapsedTime",
",",
"3",
")",
";",
"$",
"allowedTime",
... | Get data about speed of the application
@returns array | [
"Get",
"data",
"about",
"speed",
"of",
"the",
"application"
] | train | https://github.com/jacobemerick/pqp/blob/08276f050425d1ab71e7ca3b897eb8c409ccbe70/src/PhpQuickProfiler.php#L175-L184 |
jacobemerick/pqp | src/PhpQuickProfiler.php | PhpQuickProfiler.display | public function display($dbConnection = null)
{
if (!isset($this->display)) {
throw new Exception('Display object has not been injected into Profiler');
}
if (!isset($this->console)) {
throw new Exception('Console object has not been injected into Profiler');
... | php | public function display($dbConnection = null)
{
if (!isset($this->display)) {
throw new Exception('Display object has not been injected into Profiler');
}
if (!isset($this->console)) {
throw new Exception('Console object has not been injected into Profiler');
... | [
"public",
"function",
"display",
"(",
"$",
"dbConnection",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"display",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"'Display object has not been injected into Profiler'",
")",
";",
"... | Triggers end display of the profiling data
@param object $dbConnection
@throws Exception | [
"Triggers",
"end",
"display",
"of",
"the",
"profiling",
"data"
] | train | https://github.com/jacobemerick/pqp/blob/08276f050425d1ab71e7ca3b897eb8c409ccbe70/src/PhpQuickProfiler.php#L192-L209 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.