repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
fdmweb/FDM-netaxept | src/Netaxept/Api.php | Api.getTransaction | public function getTransaction($transactionId): QueryInterface
{
$uri = $this->getUri('query', $this->getParameters(['transactionId' => $transactionId]));
/** @var QueryInterface $response */
$response = $this->performRequest((string) $uri);
Assert::isInstanceOf($response, QueryInte... | php | public function getTransaction($transactionId): QueryInterface
{
$uri = $this->getUri('query', $this->getParameters(['transactionId' => $transactionId]));
/** @var QueryInterface $response */
$response = $this->performRequest((string) $uri);
Assert::isInstanceOf($response, QueryInte... | [
"public",
"function",
"getTransaction",
"(",
"$",
"transactionId",
")",
":",
"QueryInterface",
"{",
"$",
"uri",
"=",
"$",
"this",
"->",
"getUri",
"(",
"'query'",
",",
"$",
"this",
"->",
"getParameters",
"(",
"[",
"'transactionId'",
"=>",
"$",
"transactionId"... | Get a Query response object for the provided transaction ID.
@param string $transactionId
@return QueryInterface | [
"Get",
"a",
"Query",
"response",
"object",
"for",
"the",
"provided",
"transaction",
"ID",
"."
] | 0afcf18056387976fc4ca5933ea8c15b24d005cc | https://github.com/fdmweb/FDM-netaxept/blob/0afcf18056387976fc4ca5933ea8c15b24d005cc/src/Netaxept/Api.php#L105-L115 | train |
fdmweb/FDM-netaxept | src/Netaxept/Api.php | Api.registerTransaction | public function registerTransaction(array $transactionData): RegisterInterface
{
$uri = $this->getUri('register', $this->getParameters($transactionData));
/** @var RegisterInterface $response */
$response = $this->performRequest((string) $uri);
Assert::isInstanceOf($response, Regist... | php | public function registerTransaction(array $transactionData): RegisterInterface
{
$uri = $this->getUri('register', $this->getParameters($transactionData));
/** @var RegisterInterface $response */
$response = $this->performRequest((string) $uri);
Assert::isInstanceOf($response, Regist... | [
"public",
"function",
"registerTransaction",
"(",
"array",
"$",
"transactionData",
")",
":",
"RegisterInterface",
"{",
"$",
"uri",
"=",
"$",
"this",
"->",
"getUri",
"(",
"'register'",
",",
"$",
"this",
"->",
"getParameters",
"(",
"$",
"transactionData",
")",
... | Registers a transaction
@param array $transactionData
@return RegisterInterface | [
"Registers",
"a",
"transaction"
] | 0afcf18056387976fc4ca5933ea8c15b24d005cc | https://github.com/fdmweb/FDM-netaxept/blob/0afcf18056387976fc4ca5933ea8c15b24d005cc/src/Netaxept/Api.php#L124-L133 | train |
fdmweb/FDM-netaxept | src/Netaxept/Api.php | Api.processTransaction | public function processTransaction(array $transactionData, string $operation): ProcessInterface
{
// When hitting the process endpoint, we only need the transactionId and operation key/value pairs, and
// optionally the transactionAmount if we are capturing a portion of the total amount.
$tr... | php | public function processTransaction(array $transactionData, string $operation): ProcessInterface
{
// When hitting the process endpoint, we only need the transactionId and operation key/value pairs, and
// optionally the transactionAmount if we are capturing a portion of the total amount.
$tr... | [
"public",
"function",
"processTransaction",
"(",
"array",
"$",
"transactionData",
",",
"string",
"$",
"operation",
")",
":",
"ProcessInterface",
"{",
"// When hitting the process endpoint, we only need the transactionId and operation key/value pairs, and",
"// optionally the transact... | Processes a transaction
@param array $transactionData
@return ProcessInterface | [
"Processes",
"a",
"transaction"
] | 0afcf18056387976fc4ca5933ea8c15b24d005cc | https://github.com/fdmweb/FDM-netaxept/blob/0afcf18056387976fc4ca5933ea8c15b24d005cc/src/Netaxept/Api.php#L142-L157 | train |
fdmweb/FDM-netaxept | src/Netaxept/Api.php | Api.getTerminalUri | public function getTerminalUri(string $transactionId): Uri
{
$uri = $this->getUri('terminal', ['merchantId' => $this->merchantId, 'transactionId' => $transactionId]);
return $uri;
} | php | public function getTerminalUri(string $transactionId): Uri
{
$uri = $this->getUri('terminal', ['merchantId' => $this->merchantId, 'transactionId' => $transactionId]);
return $uri;
} | [
"public",
"function",
"getTerminalUri",
"(",
"string",
"$",
"transactionId",
")",
":",
"Uri",
"{",
"$",
"uri",
"=",
"$",
"this",
"->",
"getUri",
"(",
"'terminal'",
",",
"[",
"'merchantId'",
"=>",
"$",
"this",
"->",
"merchantId",
",",
"'transactionId'",
"=>... | Given the transaction ID, returns a URI that the user should be redirected to in order to enter their card
details for that transaction.
@param string $transactionId
@return Uri | [
"Given",
"the",
"transaction",
"ID",
"returns",
"a",
"URI",
"that",
"the",
"user",
"should",
"be",
"redirected",
"to",
"in",
"order",
"to",
"enter",
"their",
"card",
"details",
"for",
"that",
"transaction",
"."
] | 0afcf18056387976fc4ca5933ea8c15b24d005cc | https://github.com/fdmweb/FDM-netaxept/blob/0afcf18056387976fc4ca5933ea8c15b24d005cc/src/Netaxept/Api.php#L251-L256 | train |
fdmweb/FDM-netaxept | src/Netaxept/Api.php | Api.performRequest | protected function performRequest(string $uri)
{
$httpResponse = $this->client->get($uri);
Assert::eq($httpResponse->getStatusCode(), 200, 'Request failed.');
$content = $httpResponse->getBody()->getContents();
$xml = simplexml_load_string($content);
$this->exceptionOnError... | php | protected function performRequest(string $uri)
{
$httpResponse = $this->client->get($uri);
Assert::eq($httpResponse->getStatusCode(), 200, 'Request failed.');
$content = $httpResponse->getBody()->getContents();
$xml = simplexml_load_string($content);
$this->exceptionOnError... | [
"protected",
"function",
"performRequest",
"(",
"string",
"$",
"uri",
")",
"{",
"$",
"httpResponse",
"=",
"$",
"this",
"->",
"client",
"->",
"get",
"(",
"$",
"uri",
")",
";",
"Assert",
"::",
"eq",
"(",
"$",
"httpResponse",
"->",
"getStatusCode",
"(",
"... | Performs a request to the provided URI, and returns the appropriate response object, based on the content of the
HTTP response.
@param string $uri
@return mixed | [
"Performs",
"a",
"request",
"to",
"the",
"provided",
"URI",
"and",
"returns",
"the",
"appropriate",
"response",
"object",
"based",
"on",
"the",
"content",
"of",
"the",
"HTTP",
"response",
"."
] | 0afcf18056387976fc4ca5933ea8c15b24d005cc | https://github.com/fdmweb/FDM-netaxept/blob/0afcf18056387976fc4ca5933ea8c15b24d005cc/src/Netaxept/Api.php#L266-L277 | train |
fdmweb/FDM-netaxept | src/Netaxept/Api.php | Api.getUri | protected function getUri(string $endpoint, array $parameters = []): Uri
{
Assert::keyExists(self::ENDPOINTS, $endpoint, "Named endpoint {$endpoint} is unknown.");
$uri = $this->sandbox ? self::SANDBOX_URL : self::PRODUCTION_URL;
$uri .= self::ENDPOINTS[$endpoint];
if ($parameters)... | php | protected function getUri(string $endpoint, array $parameters = []): Uri
{
Assert::keyExists(self::ENDPOINTS, $endpoint, "Named endpoint {$endpoint} is unknown.");
$uri = $this->sandbox ? self::SANDBOX_URL : self::PRODUCTION_URL;
$uri .= self::ENDPOINTS[$endpoint];
if ($parameters)... | [
"protected",
"function",
"getUri",
"(",
"string",
"$",
"endpoint",
",",
"array",
"$",
"parameters",
"=",
"[",
"]",
")",
":",
"Uri",
"{",
"Assert",
"::",
"keyExists",
"(",
"self",
"::",
"ENDPOINTS",
",",
"$",
"endpoint",
",",
"\"Named endpoint {$endpoint} is ... | Builds a URI, based on the named endpoint and provided parameters. The Netaxept API claims to be a REST API, but
it is not in any way, shape, or form a REST API. It requires all requests to be GET requests, and all parameters
to be URLencoded and provided in the query string. About as far away from REST as you can get.... | [
"Builds",
"a",
"URI",
"based",
"on",
"the",
"named",
"endpoint",
"and",
"provided",
"parameters",
".",
"The",
"Netaxept",
"API",
"claims",
"to",
"be",
"a",
"REST",
"API",
"but",
"it",
"is",
"not",
"in",
"any",
"way",
"shape",
"or",
"form",
"a",
"REST",... | 0afcf18056387976fc4ca5933ea8c15b24d005cc | https://github.com/fdmweb/FDM-netaxept/blob/0afcf18056387976fc4ca5933ea8c15b24d005cc/src/Netaxept/Api.php#L304-L316 | train |
SetBased/php-abc-babel-core | src/CoreBabel.php | CoreBabel.getFormattedDate | public function getFormattedDate(int $dateType, $date): string
{
if ($date=='') return '';
switch ($dateType)
{
case self::FORMAT_FULL:
$format = $this->language['lan_date_format_full'];
break;
case self::FORMAT_LONG:
$format = $this->language['lan_date_format_long'];... | php | public function getFormattedDate(int $dateType, $date): string
{
if ($date=='') return '';
switch ($dateType)
{
case self::FORMAT_FULL:
$format = $this->language['lan_date_format_full'];
break;
case self::FORMAT_LONG:
$format = $this->language['lan_date_format_long'];... | [
"public",
"function",
"getFormattedDate",
"(",
"int",
"$",
"dateType",
",",
"$",
"date",
")",
":",
"string",
"{",
"if",
"(",
"$",
"date",
"==",
"''",
")",
"return",
"''",
";",
"switch",
"(",
"$",
"dateType",
")",
"{",
"case",
"self",
"::",
"FORMAT_FU... | Returns a date formatted according to a date format specifier.
@param int $dateType The date format specifier. One of:
<ul>
<li>Babel::FORMAT_FULL
<li>Babel::FORMAT_LONG
<li>Babel::FORMAT_MEDIUM
<li>Babel::FORMAT_SHORT
</ul>
@param string|\DateTimeInterface|null $date The date.
@return ... | [
"Returns",
"a",
"date",
"formatted",
"according",
"to",
"a",
"date",
"format",
"specifier",
"."
] | db409d04bac4d1e0c3ca2f19b46cce3b3b92401d | https://github.com/SetBased/php-abc-babel-core/blob/db409d04bac4d1e0c3ca2f19b46cce3b3b92401d/src/CoreBabel.php#L79-L130 | train |
SetBased/php-abc-babel-core | src/CoreBabel.php | CoreBabel.getText | public function getText(int $txtId): string
{
return Abc::$DL->abcBabelCoreTextGetText($txtId, $this->language['lan_id']);
} | php | public function getText(int $txtId): string
{
return Abc::$DL->abcBabelCoreTextGetText($txtId, $this->language['lan_id']);
} | [
"public",
"function",
"getText",
"(",
"int",
"$",
"txtId",
")",
":",
"string",
"{",
"return",
"Abc",
"::",
"$",
"DL",
"->",
"abcBabelCoreTextGetText",
"(",
"$",
"txtId",
",",
"$",
"this",
"->",
"language",
"[",
"'lan_id'",
"]",
")",
";",
"}"
] | Returns the value of a text.
@param int $txtId The ID of the text.
@return string
@since 1.0.0
@api | [
"Returns",
"the",
"value",
"of",
"a",
"text",
"."
] | db409d04bac4d1e0c3ca2f19b46cce3b3b92401d | https://github.com/SetBased/php-abc-babel-core/blob/db409d04bac4d1e0c3ca2f19b46cce3b3b92401d/src/CoreBabel.php#L349-L352 | train |
SetBased/php-abc-babel-core | src/CoreBabel.php | CoreBabel.getWord | public function getWord(int $wrdId): string
{
return Abc::$DL->abcBabelCoreWordGetWord($wrdId, $this->language['lan_id']);
} | php | public function getWord(int $wrdId): string
{
return Abc::$DL->abcBabelCoreWordGetWord($wrdId, $this->language['lan_id']);
} | [
"public",
"function",
"getWord",
"(",
"int",
"$",
"wrdId",
")",
":",
"string",
"{",
"return",
"Abc",
"::",
"$",
"DL",
"->",
"abcBabelCoreWordGetWord",
"(",
"$",
"wrdId",
",",
"$",
"this",
"->",
"language",
"[",
"'lan_id'",
"]",
")",
";",
"}"
] | Returns the text of a word.
@param int $wrdId The ID of the word.
@return string
@since 1.0.0
@api | [
"Returns",
"the",
"text",
"of",
"a",
"word",
"."
] | db409d04bac4d1e0c3ca2f19b46cce3b3b92401d | https://github.com/SetBased/php-abc-babel-core/blob/db409d04bac4d1e0c3ca2f19b46cce3b3b92401d/src/CoreBabel.php#L405-L408 | train |
SetBased/php-abc-babel-core | src/CoreBabel.php | CoreBabel.popLanguage | public function popLanguage(): void
{
array_pop($this->stack);
$this->language = $this->stack[count($this->stack) - 1];
} | php | public function popLanguage(): void
{
array_pop($this->stack);
$this->language = $this->stack[count($this->stack) - 1];
} | [
"public",
"function",
"popLanguage",
"(",
")",
":",
"void",
"{",
"array_pop",
"(",
"$",
"this",
"->",
"stack",
")",
";",
"$",
"this",
"->",
"language",
"=",
"$",
"this",
"->",
"stack",
"[",
"count",
"(",
"$",
"this",
"->",
"stack",
")",
"-",
"1",
... | Restores the previous language as the current language.
@return void
@since 1.0.0
@api | [
"Restores",
"the",
"previous",
"language",
"as",
"the",
"current",
"language",
"."
] | db409d04bac4d1e0c3ca2f19b46cce3b3b92401d | https://github.com/SetBased/php-abc-babel-core/blob/db409d04bac4d1e0c3ca2f19b46cce3b3b92401d/src/CoreBabel.php#L419-L423 | train |
SetBased/php-abc-babel-core | src/CoreBabel.php | CoreBabel.pushLanguage | public function pushLanguage(int $lanId): void
{
$this->language = Abc::$DL->abcBabelCoreLanguageGetDetails($lanId);
array_push($this->stack, $this->language);
} | php | public function pushLanguage(int $lanId): void
{
$this->language = Abc::$DL->abcBabelCoreLanguageGetDetails($lanId);
array_push($this->stack, $this->language);
} | [
"public",
"function",
"pushLanguage",
"(",
"int",
"$",
"lanId",
")",
":",
"void",
"{",
"$",
"this",
"->",
"language",
"=",
"Abc",
"::",
"$",
"DL",
"->",
"abcBabelCoreLanguageGetDetails",
"(",
"$",
"lanId",
")",
";",
"array_push",
"(",
"$",
"this",
"->",
... | Sets and pushes a new current language.
@param int $lanId The ID of the new current language.
@return void
@since 1.0.0
@api | [
"Sets",
"and",
"pushes",
"a",
"new",
"current",
"language",
"."
] | db409d04bac4d1e0c3ca2f19b46cce3b3b92401d | https://github.com/SetBased/php-abc-babel-core/blob/db409d04bac4d1e0c3ca2f19b46cce3b3b92401d/src/CoreBabel.php#L436-L440 | train |
SetBased/php-abc-babel-core | src/CoreBabel.php | CoreBabel.setLanguage | public function setLanguage(int $lanId): void
{
$this->language = Abc::$DL->abcBabelCoreLanguageGetDetails($lanId);
$this->stack[max(0, count($this->stack) - 1)] = $this->language;
} | php | public function setLanguage(int $lanId): void
{
$this->language = Abc::$DL->abcBabelCoreLanguageGetDetails($lanId);
$this->stack[max(0, count($this->stack) - 1)] = $this->language;
} | [
"public",
"function",
"setLanguage",
"(",
"int",
"$",
"lanId",
")",
":",
"void",
"{",
"$",
"this",
"->",
"language",
"=",
"Abc",
"::",
"$",
"DL",
"->",
"abcBabelCoreLanguageGetDetails",
"(",
"$",
"lanId",
")",
";",
"$",
"this",
"->",
"stack",
"[",
"max... | Replaces the current language.
@param int $lanId The ID of the new current language.
@return void
@since 1.0.0
@api | [
"Replaces",
"the",
"current",
"language",
"."
] | db409d04bac4d1e0c3ca2f19b46cce3b3b92401d | https://github.com/SetBased/php-abc-babel-core/blob/db409d04bac4d1e0c3ca2f19b46cce3b3b92401d/src/CoreBabel.php#L453-L457 | train |
mpf-soft/admin-widgets | menu/items/Link.php | Link.getIcon | public function getIcon()
{
if (!$this->icon) {
return "";
}
return Html::get()->image($this->icon, $this->translate($this->label));
} | php | public function getIcon()
{
if (!$this->icon) {
return "";
}
return Html::get()->image($this->icon, $this->translate($this->label));
} | [
"public",
"function",
"getIcon",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"icon",
")",
"{",
"return",
"\"\"",
";",
"}",
"return",
"Html",
"::",
"get",
"(",
")",
"->",
"image",
"(",
"$",
"this",
"->",
"icon",
",",
"$",
"this",
"->",
"tr... | Get HTML image for selected icon
@return string | [
"Get",
"HTML",
"image",
"for",
"selected",
"icon"
] | 92597f9a09d086664268d6b7e0111d5a5586d8c7 | https://github.com/mpf-soft/admin-widgets/blob/92597f9a09d086664268d6b7e0111d5a5586d8c7/menu/items/Link.php#L141-L147 | train |
mpf-soft/admin-widgets | menu/items/Link.php | Link.getURL | public function getURL()
{
if (is_string($this->url)) {
return $this->url;
}
return \mpf\WebApp::get()->request()->createURL(isset($this->url[0]) ? $this->url[0] : 'home', isset($this->url[1]) ? $this->url[1] : null, (isset($this->url[2]) && is_array($this->url[2])) ? $this->url[... | php | public function getURL()
{
if (is_string($this->url)) {
return $this->url;
}
return \mpf\WebApp::get()->request()->createURL(isset($this->url[0]) ? $this->url[0] : 'home', isset($this->url[1]) ? $this->url[1] : null, (isset($this->url[2]) && is_array($this->url[2])) ? $this->url[... | [
"public",
"function",
"getURL",
"(",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"this",
"->",
"url",
")",
")",
"{",
"return",
"$",
"this",
"->",
"url",
";",
"}",
"return",
"\\",
"mpf",
"\\",
"WebApp",
"::",
"get",
"(",
")",
"->",
"request",
"(",... | Get string url from array|string input
@return string | [
"Get",
"string",
"url",
"from",
"array|string",
"input"
] | 92597f9a09d086664268d6b7e0111d5a5586d8c7 | https://github.com/mpf-soft/admin-widgets/blob/92597f9a09d086664268d6b7e0111d5a5586d8c7/menu/items/Link.php#L153-L159 | train |
mpf-soft/admin-widgets | menu/items/Link.php | Link.isSelected | public function isSelected()
{
if (!is_null($this->isSelected))
return $this->isSelected;
if (is_string($this->url) && $this->url == \mpf\WebApp::get()->request()->getCurrentURL()) {
return true;
} elseif (is_array($this->url)) {
$controller = isset($this-... | php | public function isSelected()
{
if (!is_null($this->isSelected))
return $this->isSelected;
if (is_string($this->url) && $this->url == \mpf\WebApp::get()->request()->getCurrentURL()) {
return true;
} elseif (is_array($this->url)) {
$controller = isset($this-... | [
"public",
"function",
"isSelected",
"(",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
"isSelected",
")",
")",
"return",
"$",
"this",
"->",
"isSelected",
";",
"if",
"(",
"is_string",
"(",
"$",
"this",
"->",
"url",
")",
"&&",
"$",
"th... | Check if this is the current page.
@return boolean | [
"Check",
"if",
"this",
"is",
"the",
"current",
"page",
"."
] | 92597f9a09d086664268d6b7e0111d5a5586d8c7 | https://github.com/mpf-soft/admin-widgets/blob/92597f9a09d086664268d6b7e0111d5a5586d8c7/menu/items/Link.php#L165-L186 | train |
mpf-soft/admin-widgets | menu/items/Link.php | Link.getModule | protected function getModule()
{
$module = \mpf\WebApp::get()->request()->getModule();
if (isset($this->url[2]) && !is_array($this->url[2])) { // is module
$module = $this->url[2];
} elseif (isset($this->url[3]) && !is_array($this->url[3])) { // this is module then
$m... | php | protected function getModule()
{
$module = \mpf\WebApp::get()->request()->getModule();
if (isset($this->url[2]) && !is_array($this->url[2])) { // is module
$module = $this->url[2];
} elseif (isset($this->url[3]) && !is_array($this->url[3])) { // this is module then
$m... | [
"protected",
"function",
"getModule",
"(",
")",
"{",
"$",
"module",
"=",
"\\",
"mpf",
"\\",
"WebApp",
"::",
"get",
"(",
")",
"->",
"request",
"(",
")",
"->",
"getModule",
"(",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"url",
"[",
"2",... | Get name of the link module;
@return string | [
"Get",
"name",
"of",
"the",
"link",
"module",
";"
] | 92597f9a09d086664268d6b7e0111d5a5586d8c7 | https://github.com/mpf-soft/admin-widgets/blob/92597f9a09d086664268d6b7e0111d5a5586d8c7/menu/items/Link.php#L192-L201 | train |
mpf-soft/admin-widgets | menu/items/Link.php | Link.isVisible | public function isVisible()
{
if ((!is_array($this->url)) || (!$this->visible)) { // if it's not array, or not visible then just return visible value, no need to check anything
return $this->visible;
}
$controller = isset($this->url[0]) ? $this->url[0] : 'home';
$action =... | php | public function isVisible()
{
if ((!is_array($this->url)) || (!$this->visible)) { // if it's not array, or not visible then just return visible value, no need to check anything
return $this->visible;
}
$controller = isset($this->url[0]) ? $this->url[0] : 'home';
$action =... | [
"public",
"function",
"isVisible",
"(",
")",
"{",
"if",
"(",
"(",
"!",
"is_array",
"(",
"$",
"this",
"->",
"url",
")",
")",
"||",
"(",
"!",
"$",
"this",
"->",
"visible",
")",
")",
"{",
"// if it's not array, or not visible then just return visible value, no ne... | Check if current item is visible or not.
@return boolean | [
"Check",
"if",
"current",
"item",
"is",
"visible",
"or",
"not",
"."
] | 92597f9a09d086664268d6b7e0111d5a5586d8c7 | https://github.com/mpf-soft/admin-widgets/blob/92597f9a09d086664268d6b7e0111d5a5586d8c7/menu/items/Link.php#L207-L226 | train |
netbull/CoreBundle | Templating/Helper/PhoneNumberHelper.php | PhoneNumberHelper.format | public function format(PhoneNumber $phoneNumber, $format = PhoneNumberFormat::INTERNATIONAL)
{
if (true === is_string($format)) {
$constant = '\libphonenumber\PhoneNumberFormat::' . $format;
if (false === defined($constant)) {
throw new InvalidArgumentException('The ... | php | public function format(PhoneNumber $phoneNumber, $format = PhoneNumberFormat::INTERNATIONAL)
{
if (true === is_string($format)) {
$constant = '\libphonenumber\PhoneNumberFormat::' . $format;
if (false === defined($constant)) {
throw new InvalidArgumentException('The ... | [
"public",
"function",
"format",
"(",
"PhoneNumber",
"$",
"phoneNumber",
",",
"$",
"format",
"=",
"PhoneNumberFormat",
"::",
"INTERNATIONAL",
")",
"{",
"if",
"(",
"true",
"===",
"is_string",
"(",
"$",
"format",
")",
")",
"{",
"$",
"constant",
"=",
"'\\libph... | Format a phone number.
@param PhoneNumber $phoneNumber Phone number.
@param int|string $format Format, or format constant name.
@return string Formatted phone number.
@throws InvalidArgumentException If an argument is invalid. | [
"Format",
"a",
"phone",
"number",
"."
] | 0bacc1d9e4733b6da613027400c48421e5a14645 | https://github.com/netbull/CoreBundle/blob/0bacc1d9e4733b6da613027400c48421e5a14645/Templating/Helper/PhoneNumberHelper.php#L74-L87 | train |
benjamindulau/BarbeQ | src/BarbeQ/BarbeQ.php | BarbeQ.publish | public function publish($queue, MessageInterface $message)
{
$message->setQueue($queue);
$this->getAdapter()->publish($queue, $message);
} | php | public function publish($queue, MessageInterface $message)
{
$message->setQueue($queue);
$this->getAdapter()->publish($queue, $message);
} | [
"public",
"function",
"publish",
"(",
"$",
"queue",
",",
"MessageInterface",
"$",
"message",
")",
"{",
"$",
"message",
"->",
"setQueue",
"(",
"$",
"queue",
")",
";",
"$",
"this",
"->",
"getAdapter",
"(",
")",
"->",
"publish",
"(",
"$",
"queue",
",",
... | Publish a message
@param string $queue Target queue to push message in
@param MessageInterface $message Message content | [
"Publish",
"a",
"message"
] | d1fd7caa1ba700ac317282948c6fc9d62fe6d523 | https://github.com/benjamindulau/BarbeQ/blob/d1fd7caa1ba700ac317282948c6fc9d62fe6d523/src/BarbeQ/BarbeQ.php#L51-L55 | train |
benjamindulau/BarbeQ | src/BarbeQ/BarbeQ.php | BarbeQ.consumeOne | public function consumeOne(MessageInterface $message)
{
$consumeEvent = new ConsumeEvent($message);
try {
$this->dispatcher->dispatch(BarbeQEvents::PRE_CONSUME, $consumeEvent);
$message->start();
$this->messageDispatcher->dispatch($message->getQueue(),... | php | public function consumeOne(MessageInterface $message)
{
$consumeEvent = new ConsumeEvent($message);
try {
$this->dispatcher->dispatch(BarbeQEvents::PRE_CONSUME, $consumeEvent);
$message->start();
$this->messageDispatcher->dispatch($message->getQueue(),... | [
"public",
"function",
"consumeOne",
"(",
"MessageInterface",
"$",
"message",
")",
"{",
"$",
"consumeEvent",
"=",
"new",
"ConsumeEvent",
"(",
"$",
"message",
")",
";",
"try",
"{",
"$",
"this",
"->",
"dispatcher",
"->",
"dispatch",
"(",
"BarbeQEvents",
"::",
... | Dispatches a Message to all interested consumers
@param MessageInterface $message
@throws ConsumerIndigestionException | [
"Dispatches",
"a",
"Message",
"to",
"all",
"interested",
"consumers"
] | d1fd7caa1ba700ac317282948c6fc9d62fe6d523 | https://github.com/benjamindulau/BarbeQ/blob/d1fd7caa1ba700ac317282948c6fc9d62fe6d523/src/BarbeQ/BarbeQ.php#L108-L132 | train |
benjamindulau/BarbeQ | src/BarbeQ/BarbeQ.php | BarbeQ.addConsumer | public function addConsumer($queue, ConsumerInterface $consumer, $priority = 0)
{
$this->messageDispatcher->addListener($queue, array($consumer, 'consume'), $priority);
} | php | public function addConsumer($queue, ConsumerInterface $consumer, $priority = 0)
{
$this->messageDispatcher->addListener($queue, array($consumer, 'consume'), $priority);
} | [
"public",
"function",
"addConsumer",
"(",
"$",
"queue",
",",
"ConsumerInterface",
"$",
"consumer",
",",
"$",
"priority",
"=",
"0",
")",
"{",
"$",
"this",
"->",
"messageDispatcher",
"->",
"addListener",
"(",
"$",
"queue",
",",
"array",
"(",
"$",
"consumer",... | Adds a consumer for messages from the given queue name
@param string $queue
@param ConsumerInterface $consumer
@param int $priority
@return void | [
"Adds",
"a",
"consumer",
"for",
"messages",
"from",
"the",
"given",
"queue",
"name"
] | d1fd7caa1ba700ac317282948c6fc9d62fe6d523 | https://github.com/benjamindulau/BarbeQ/blob/d1fd7caa1ba700ac317282948c6fc9d62fe6d523/src/BarbeQ/BarbeQ.php#L157-L160 | train |
robertmain/communique | src/Curl.php | Curl.headers_to_array | private static function headers_to_array($headerContent) {
$headers = array();
$arrRequests = explode("\r\n\r\n", $headerContent);
foreach (explode("\r\n", $arrRequests[0]) as $i => $line) {
if ($i === 0) {
$headers['http_code'] = $line;
} else {
list($key, $value) = explode(': ', $line);
$heade... | php | private static function headers_to_array($headerContent) {
$headers = array();
$arrRequests = explode("\r\n\r\n", $headerContent);
foreach (explode("\r\n", $arrRequests[0]) as $i => $line) {
if ($i === 0) {
$headers['http_code'] = $line;
} else {
list($key, $value) = explode(': ', $line);
$heade... | [
"private",
"static",
"function",
"headers_to_array",
"(",
"$",
"headerContent",
")",
"{",
"$",
"headers",
"=",
"array",
"(",
")",
";",
"$",
"arrRequests",
"=",
"explode",
"(",
"\"\\r\\n\\r\\n\"",
",",
"$",
"headerContent",
")",
";",
"foreach",
"(",
"explode"... | Converts a string containing multiple headers into an array that can be used programatically.
@param string $headerContent A header string
@return array An indexable array of headers | [
"Converts",
"a",
"string",
"containing",
"multiple",
"headers",
"into",
"an",
"array",
"that",
"can",
"be",
"used",
"programatically",
"."
] | 025d4f0f9bc391f6f9fc653a363158d2f83e9051 | https://github.com/robertmain/communique/blob/025d4f0f9bc391f6f9fc653a363158d2f83e9051/src/Curl.php#L67-L79 | train |
robertmain/communique | src/Curl.php | Curl.exec | public function exec() {
if ($response = curl_exec($this->_ch)) {
$header_size = $this->getinfo(CURLINFO_HEADER_SIZE);
return array(
'http_status_code' => $this->getinfo(CURLINFO_HTTP_CODE),
'body' => substr($response, $header_size),
'headers' => self::headers_to_array(substr($response, 0, $header_s... | php | public function exec() {
if ($response = curl_exec($this->_ch)) {
$header_size = $this->getinfo(CURLINFO_HEADER_SIZE);
return array(
'http_status_code' => $this->getinfo(CURLINFO_HTTP_CODE),
'body' => substr($response, $header_size),
'headers' => self::headers_to_array(substr($response, 0, $header_s... | [
"public",
"function",
"exec",
"(",
")",
"{",
"if",
"(",
"$",
"response",
"=",
"curl_exec",
"(",
"$",
"this",
"->",
"_ch",
")",
")",
"{",
"$",
"header_size",
"=",
"$",
"this",
"->",
"getinfo",
"(",
"CURLINFO_HEADER_SIZE",
")",
";",
"return",
"array",
... | This function should be called after initializing a cURL session and all the options for the session are set
@see http://php.net/manual/en/function.curl-exec.php Official PHP documentation for curl_exec()
@return boolean|mixed Returns **TRUE** on success or **FALSE** on failiure. However, if the **CURLOPT_RETURNTAN... | [
"This",
"function",
"should",
"be",
"called",
"after",
"initializing",
"a",
"cURL",
"session",
"and",
"all",
"the",
"options",
"for",
"the",
"session",
"are",
"set"
] | 025d4f0f9bc391f6f9fc653a363158d2f83e9051 | https://github.com/robertmain/communique/blob/025d4f0f9bc391f6f9fc653a363158d2f83e9051/src/Curl.php#L146-L157 | train |
OxfordInfoLabs/kinikit-core | src/Util/Annotation/ClassAnnotationParser.php | ClassAnnotationParser.parse | public function parse($className) {
try {
$class = new \ReflectionClass($className);
} catch (\ReflectionException $e) {
return new ClassAnnotations($className, array(), array(), array());
}
// get the master annotations
$classComment = $class->getDocC... | php | public function parse($className) {
try {
$class = new \ReflectionClass($className);
} catch (\ReflectionException $e) {
return new ClassAnnotations($className, array(), array(), array());
}
// get the master annotations
$classComment = $class->getDocC... | [
"public",
"function",
"parse",
"(",
"$",
"className",
")",
"{",
"try",
"{",
"$",
"class",
"=",
"new",
"\\",
"ReflectionClass",
"(",
"$",
"className",
")",
";",
"}",
"catch",
"(",
"\\",
"ReflectionException",
"$",
"e",
")",
"{",
"return",
"new",
"ClassA... | Parse annotations for a class | [
"Parse",
"annotations",
"for",
"a",
"class"
] | edc1b2e6ffabd595c4c7d322279b3dd1e59ef359 | https://github.com/OxfordInfoLabs/kinikit-core/blob/edc1b2e6ffabd595c4c7d322279b3dd1e59ef359/src/Util/Annotation/ClassAnnotationParser.php#L29-L84 | train |
OxfordInfoLabs/kinikit-core | src/Util/Annotation/ClassAnnotationParser.php | ClassAnnotationParser.cleanComment | private function cleanComment($comment) {
$commentLines = explode(PHP_EOL, $comment);
for ($i = sizeof($commentLines) - 1; $i >= 0; $i--) {
$commentLine = $commentLines[$i];
if (is_numeric(strpos($commentLine, "/**")) ||
is_numeric(strpos($commentLine, "*/")) ||
... | php | private function cleanComment($comment) {
$commentLines = explode(PHP_EOL, $comment);
for ($i = sizeof($commentLines) - 1; $i >= 0; $i--) {
$commentLine = $commentLines[$i];
if (is_numeric(strpos($commentLine, "/**")) ||
is_numeric(strpos($commentLine, "*/")) ||
... | [
"private",
"function",
"cleanComment",
"(",
"$",
"comment",
")",
"{",
"$",
"commentLines",
"=",
"explode",
"(",
"PHP_EOL",
",",
"$",
"comment",
")",
";",
"for",
"(",
"$",
"i",
"=",
"sizeof",
"(",
"$",
"commentLines",
")",
"-",
"1",
";",
"$",
"i",
"... | Clean a comment | [
"Clean",
"a",
"comment"
] | edc1b2e6ffabd595c4c7d322279b3dd1e59ef359 | https://github.com/OxfordInfoLabs/kinikit-core/blob/edc1b2e6ffabd595c4c7d322279b3dd1e59ef359/src/Util/Annotation/ClassAnnotationParser.php#L104-L117 | train |
ekyna/Table | Util/FilterOperator.php | FilterOperator.isValid | static public function isValid($operator, $throwException = false)
{
$operator = intval($operator);
if ($operator > 0 && $operator <= static::IS_NOT_NULL) {
return true;
}
if ($throwException) {
throw new InvalidArgumentException('Unexpected filter operator.'... | php | static public function isValid($operator, $throwException = false)
{
$operator = intval($operator);
if ($operator > 0 && $operator <= static::IS_NOT_NULL) {
return true;
}
if ($throwException) {
throw new InvalidArgumentException('Unexpected filter operator.'... | [
"static",
"public",
"function",
"isValid",
"(",
"$",
"operator",
",",
"$",
"throwException",
"=",
"false",
")",
"{",
"$",
"operator",
"=",
"intval",
"(",
"$",
"operator",
")",
";",
"if",
"(",
"$",
"operator",
">",
"0",
"&&",
"$",
"operator",
"<=",
"s... | Returns whether the operator is valid or not.
@param string $operator
@param bool $throwException
@return bool | [
"Returns",
"whether",
"the",
"operator",
"is",
"valid",
"or",
"not",
"."
] | 6f06e8fd8a3248d52f3a91f10508471344db311a | https://github.com/ekyna/Table/blob/6f06e8fd8a3248d52f3a91f10508471344db311a/Util/FilterOperator.php#L60-L72 | train |
ekyna/Table | Util/FilterOperator.php | FilterOperator.getChoices | static public function getChoices(array $operators)
{
$choices = [];
foreach ($operators as $operator) {
$choices[static::getLabel($operator)] = $operator;
}
return $choices;
} | php | static public function getChoices(array $operators)
{
$choices = [];
foreach ($operators as $operator) {
$choices[static::getLabel($operator)] = $operator;
}
return $choices;
} | [
"static",
"public",
"function",
"getChoices",
"(",
"array",
"$",
"operators",
")",
"{",
"$",
"choices",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"operators",
"as",
"$",
"operator",
")",
"{",
"$",
"choices",
"[",
"static",
"::",
"getLabel",
"(",
"$",
... | Returns the available operators choices.
@param array $operators
@return array | [
"Returns",
"the",
"available",
"operators",
"choices",
"."
] | 6f06e8fd8a3248d52f3a91f10508471344db311a | https://github.com/ekyna/Table/blob/6f06e8fd8a3248d52f3a91f10508471344db311a/Util/FilterOperator.php#L127-L135 | train |
romm/configuration_object | Classes/Traits/ConfigurationObject/MagicMethodsTrait.php | MagicMethodsTrait.isPropertyAccessible | private function isPropertyAccessible($propertyName)
{
$result = false;
$className = get_class($this);
$reflectionService = ReflectionService::get();
if ($reflectionService->isClassPropertyAccessible($className, $propertyName)) {
$property = $reflectionService->getClassA... | php | private function isPropertyAccessible($propertyName)
{
$result = false;
$className = get_class($this);
$reflectionService = ReflectionService::get();
if ($reflectionService->isClassPropertyAccessible($className, $propertyName)) {
$property = $reflectionService->getClassA... | [
"private",
"function",
"isPropertyAccessible",
"(",
"$",
"propertyName",
")",
"{",
"$",
"result",
"=",
"false",
";",
"$",
"className",
"=",
"get_class",
"(",
"$",
"this",
")",
";",
"$",
"reflectionService",
"=",
"ReflectionService",
"::",
"get",
"(",
")",
... | Returns true if the given property name is accessible for the current
instance of this class.
Note that the list of accessible properties for this class is stored in
cache to improve performances.
@param string $propertyName
@return bool | [
"Returns",
"true",
"if",
"the",
"given",
"property",
"name",
"is",
"accessible",
"for",
"the",
"current",
"instance",
"of",
"this",
"class",
"."
] | d3a40903386c2e0766bd8279337fe6da45cf5ce3 | https://github.com/romm/configuration_object/blob/d3a40903386c2e0766bd8279337fe6da45cf5ce3/Classes/Traits/ConfigurationObject/MagicMethodsTrait.php#L127-L139 | train |
jaypha/mysqli-ext | src/MySQLiExt.php | MySQLiExtTrait.queryColumn | function queryColumn($query)
{
$data = [];
$res = $this->q($query);
while ($row = $res->fetch_row())
{
if ($res->field_count == 1)
$data[] = $row[0];
else
$data[$row[0]] = $row[1];
}
$res->close();
return $data;
} | php | function queryColumn($query)
{
$data = [];
$res = $this->q($query);
while ($row = $res->fetch_row())
{
if ($res->field_count == 1)
$data[] = $row[0];
else
$data[$row[0]] = $row[1];
}
$res->close();
return $data;
} | [
"function",
"queryColumn",
"(",
"$",
"query",
")",
"{",
"$",
"data",
"=",
"[",
"]",
";",
"$",
"res",
"=",
"$",
"this",
"->",
"q",
"(",
"$",
"query",
")",
";",
"while",
"(",
"$",
"row",
"=",
"$",
"res",
"->",
"fetch_row",
"(",
")",
")",
"{",
... | If two fields are queried, the first is used as an index. | [
"If",
"two",
"fields",
"are",
"queried",
"the",
"first",
"is",
"used",
"as",
"an",
"index",
"."
] | b13ea5dfeef4090fcd235f8aaa25728a582a93c2 | https://github.com/jaypha/mysqli-ext/blob/b13ea5dfeef4090fcd235f8aaa25728a582a93c2/src/MySQLiExt.php#L127-L140 | train |
pixelpolishers/makedocs | src/MakeDocs/Generator/Generator.php | Generator.getPageManager | public function getPageManager()
{
if ($this->pageManager === null) {
$this->pageManager = new PageManager($this);
}
return $this->pageManager;
} | php | public function getPageManager()
{
if ($this->pageManager === null) {
$this->pageManager = new PageManager($this);
}
return $this->pageManager;
} | [
"public",
"function",
"getPageManager",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"pageManager",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"pageManager",
"=",
"new",
"PageManager",
"(",
"$",
"this",
")",
";",
"}",
"return",
"$",
"this",
"->",
"p... | Gets the page manager.
@return PageManager | [
"Gets",
"the",
"page",
"manager",
"."
] | 1fa243b52565b5de417ef2dbdfbcae9896b6b483 | https://github.com/pixelpolishers/makedocs/blob/1fa243b52565b5de417ef2dbdfbcae9896b6b483/src/MakeDocs/Generator/Generator.php#L80-L86 | train |
pixelpolishers/makedocs | src/MakeDocs/Generator/Generator.php | Generator.getConfig | public function getConfig()
{
if ($this->config === null) {
$path = $this->getInputDirectory() . '/makedocs.json';
if (!is_file($path)) {
throw new \RuntimeException('The input directory does not contain a makedocs.json file.');
}
$data = json... | php | public function getConfig()
{
if ($this->config === null) {
$path = $this->getInputDirectory() . '/makedocs.json';
if (!is_file($path)) {
throw new \RuntimeException('The input directory does not contain a makedocs.json file.');
}
$data = json... | [
"public",
"function",
"getConfig",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"config",
"===",
"null",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"getInputDirectory",
"(",
")",
".",
"'/makedocs.json'",
";",
"if",
"(",
"!",
"is_file",
"(",
"$",
... | Gets the configuration of the project to generate the documentation for.
@return Config
@throws \RuntimeException | [
"Gets",
"the",
"configuration",
"of",
"the",
"project",
"to",
"generate",
"the",
"documentation",
"for",
"."
] | 1fa243b52565b5de417ef2dbdfbcae9896b6b483 | https://github.com/pixelpolishers/makedocs/blob/1fa243b52565b5de417ef2dbdfbcae9896b6b483/src/MakeDocs/Generator/Generator.php#L159-L175 | train |
pixelpolishers/makedocs | src/MakeDocs/Generator/Generator.php | Generator.generate | public function generate()
{
if (!is_dir($this->getInputDirectory())) {
throw new \RuntimeException('The MakeDocs input directory does not exist.');
}
if (!$this->builders) {
throw new \RuntimeException('No MakeDocs builders present.');
}
// First we... | php | public function generate()
{
if (!is_dir($this->getInputDirectory())) {
throw new \RuntimeException('The MakeDocs input directory does not exist.');
}
if (!$this->builders) {
throw new \RuntimeException('No MakeDocs builders present.');
}
// First we... | [
"public",
"function",
"generate",
"(",
")",
"{",
"if",
"(",
"!",
"is_dir",
"(",
"$",
"this",
"->",
"getInputDirectory",
"(",
")",
")",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"'The MakeDocs input directory does not exist.'",
")",
";",
"}",
"... | Generates the documentation for all the renderers. | [
"Generates",
"the",
"documentation",
"for",
"all",
"the",
"renderers",
"."
] | 1fa243b52565b5de417ef2dbdfbcae9896b6b483 | https://github.com/pixelpolishers/makedocs/blob/1fa243b52565b5de417ef2dbdfbcae9896b6b483/src/MakeDocs/Generator/Generator.php#L180-L201 | train |
gplcart/cli | controllers/commands/Event.php | Event.cmdGetEvent | public function cmdGetEvent()
{
$result = $this->getListEvent();
$this->outputFormat($result);
$this->outputFormatTableEvent($result);
$this->output();
} | php | public function cmdGetEvent()
{
$result = $this->getListEvent();
$this->outputFormat($result);
$this->outputFormatTableEvent($result);
$this->output();
} | [
"public",
"function",
"cmdGetEvent",
"(",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"getListEvent",
"(",
")",
";",
"$",
"this",
"->",
"outputFormat",
"(",
"$",
"result",
")",
";",
"$",
"this",
"->",
"outputFormatTableEvent",
"(",
"$",
"result",
... | Callback for "event-get" command | [
"Callback",
"for",
"event",
"-",
"get",
"command"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/Event.php#L40-L46 | train |
gplcart/cli | controllers/commands/Event.php | Event.cmdDeleteEvent | public function cmdDeleteEvent()
{
if ($this->getParam('expired')) {
$this->report->deleteExpired();
} else {
$this->report->delete();
}
$this->output();
} | php | public function cmdDeleteEvent()
{
if ($this->getParam('expired')) {
$this->report->deleteExpired();
} else {
$this->report->delete();
}
$this->output();
} | [
"public",
"function",
"cmdDeleteEvent",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getParam",
"(",
"'expired'",
")",
")",
"{",
"$",
"this",
"->",
"report",
"->",
"deleteExpired",
"(",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"report",
"->",
... | Callback for "event-delete" command | [
"Callback",
"for",
"event",
"-",
"delete",
"command"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/Event.php#L51-L60 | train |
gplcart/cli | controllers/commands/Event.php | Event.getListEvent | protected function getListEvent()
{
$options = array(
'order' => 'desc',
'sort' => 'created',
'limit' => $this->getLimit(),
'severity' => $this->getParam('severity')
);
return (array) $this->report->getList($options);
} | php | protected function getListEvent()
{
$options = array(
'order' => 'desc',
'sort' => 'created',
'limit' => $this->getLimit(),
'severity' => $this->getParam('severity')
);
return (array) $this->report->getList($options);
} | [
"protected",
"function",
"getListEvent",
"(",
")",
"{",
"$",
"options",
"=",
"array",
"(",
"'order'",
"=>",
"'desc'",
",",
"'sort'",
"=>",
"'created'",
",",
"'limit'",
"=>",
"$",
"this",
"->",
"getLimit",
"(",
")",
",",
"'severity'",
"=>",
"$",
"this",
... | Returns an array of events
@return array | [
"Returns",
"an",
"array",
"of",
"events"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/Event.php#L66-L76 | train |
gplcart/cli | controllers/commands/Event.php | Event.outputFormatTableEvent | protected function outputFormatTableEvent(array $events)
{
$header = array(
$this->text('Text'),
$this->text('Type'),
$this->text('Severity'),
$this->text('Created')
);
$rows = array();
foreach ($events as $item) {
$text =... | php | protected function outputFormatTableEvent(array $events)
{
$header = array(
$this->text('Text'),
$this->text('Type'),
$this->text('Severity'),
$this->text('Created')
);
$rows = array();
foreach ($events as $item) {
$text =... | [
"protected",
"function",
"outputFormatTableEvent",
"(",
"array",
"$",
"events",
")",
"{",
"$",
"header",
"=",
"array",
"(",
"$",
"this",
"->",
"text",
"(",
"'Text'",
")",
",",
"$",
"this",
"->",
"text",
"(",
"'Type'",
")",
",",
"$",
"this",
"->",
"te... | Output events in a table
@param array $events | [
"Output",
"events",
"in",
"a",
"table"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/Event.php#L82-L104 | train |
Wedeto/DB | src/Query/TableClause.php | TableClause.toSQL | public function toSQL(Parameters $params, bool $inner_clause)
{
$name = $this->getTable();
$alias = $this->getAlias();
$prefix_disabled = $this->getDisablePrefixing();
$drv = $params->getDriver();
list($tname, $talias) = $params->resolveTable($name);
if (!empty($tali... | php | public function toSQL(Parameters $params, bool $inner_clause)
{
$name = $this->getTable();
$alias = $this->getAlias();
$prefix_disabled = $this->getDisablePrefixing();
$drv = $params->getDriver();
list($tname, $talias) = $params->resolveTable($name);
if (!empty($tali... | [
"public",
"function",
"toSQL",
"(",
"Parameters",
"$",
"params",
",",
"bool",
"$",
"inner_clause",
")",
"{",
"$",
"name",
"=",
"$",
"this",
"->",
"getTable",
"(",
")",
";",
"$",
"alias",
"=",
"$",
"this",
"->",
"getAlias",
"(",
")",
";",
"$",
"pref... | Write an function as SQL query syntax
@param Parameters $params The query parameters: tables and placeholder values
@param bool $inner_clause Unused
@return string The generated SQL | [
"Write",
"an",
"function",
"as",
"SQL",
"query",
"syntax"
] | 715f8f2e3ae6b53c511c40b620921cb9c87e6f62 | https://github.com/Wedeto/DB/blob/715f8f2e3ae6b53c511c40b620921cb9c87e6f62/src/Query/TableClause.php#L92-L104 | train |
Wedeto/FileFormats | src/CSV/Reader.php | Reader.readFile | public function readFile(string $file_name)
{
$data = array();
$this->file_handle = fopen($file_name, "r");
foreach ($this as $row)
$data[] = $row;
return $data;
} | php | public function readFile(string $file_name)
{
$data = array();
$this->file_handle = fopen($file_name, "r");
foreach ($this as $row)
$data[] = $row;
return $data;
} | [
"public",
"function",
"readFile",
"(",
"string",
"$",
"file_name",
")",
"{",
"$",
"data",
"=",
"array",
"(",
")",
";",
"$",
"this",
"->",
"file_handle",
"=",
"fopen",
"(",
"$",
"file_name",
",",
"\"r\"",
")",
";",
"foreach",
"(",
"$",
"this",
"as",
... | Read CSV data from a file
@param string $file_name The name of the file to read
@return array The parsed data | [
"Read",
"CSV",
"data",
"from",
"a",
"file"
] | 65b71fbd38a2ee6b504622aca4f4047ce9d31e9f | https://github.com/Wedeto/FileFormats/blob/65b71fbd38a2ee6b504622aca4f4047ce9d31e9f/src/CSV/Reader.php#L151-L160 | train |
Wedeto/FileFormats | src/CSV/Reader.php | Reader.readFileHandle | public function readFileHandle($file_handle)
{
if (!is_resource($file_handle))
throw new \InvalidArgumentException("No file handle was provided");
$data = array();
$this->file_handle = $file_handle;
foreach ($this as $row)
$data[] = $row;
return $da... | php | public function readFileHandle($file_handle)
{
if (!is_resource($file_handle))
throw new \InvalidArgumentException("No file handle was provided");
$data = array();
$this->file_handle = $file_handle;
foreach ($this as $row)
$data[] = $row;
return $da... | [
"public",
"function",
"readFileHandle",
"(",
"$",
"file_handle",
")",
"{",
"if",
"(",
"!",
"is_resource",
"(",
"$",
"file_handle",
")",
")",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"\"No file handle was provided\"",
")",
";",
"$",
"data",
"=",
"... | Read CSV from a stream.
@param resource $file_handle The stream to read CSV from
@return array The parsed data | [
"Read",
"CSV",
"from",
"a",
"stream",
"."
] | 65b71fbd38a2ee6b504622aca4f4047ce9d31e9f | https://github.com/Wedeto/FileFormats/blob/65b71fbd38a2ee6b504622aca4f4047ce9d31e9f/src/CSV/Reader.php#L168-L180 | train |
Wedeto/FileFormats | src/CSV/Reader.php | Reader.readString | public function readString(string $data)
{
$this->file_handle = fopen('php://temp', 'rw');
fwrite($this->file_handle, $data);
$data = array();
foreach ($this as $row)
$data[] = $row;
return $data;
} | php | public function readString(string $data)
{
$this->file_handle = fopen('php://temp', 'rw');
fwrite($this->file_handle, $data);
$data = array();
foreach ($this as $row)
$data[] = $row;
return $data;
} | [
"public",
"function",
"readString",
"(",
"string",
"$",
"data",
")",
"{",
"$",
"this",
"->",
"file_handle",
"=",
"fopen",
"(",
"'php://temp'",
",",
"'rw'",
")",
";",
"fwrite",
"(",
"$",
"this",
"->",
"file_handle",
",",
"$",
"data",
")",
";",
"$",
"d... | Read CSV from a string. This will write the data to a temporary stream
@param string $data The data to read as CSV
@return array The parsed data | [
"Read",
"CSV",
"from",
"a",
"string",
".",
"This",
"will",
"write",
"the",
"data",
"to",
"a",
"temporary",
"stream"
] | 65b71fbd38a2ee6b504622aca4f4047ce9d31e9f | https://github.com/Wedeto/FileFormats/blob/65b71fbd38a2ee6b504622aca4f4047ce9d31e9f/src/CSV/Reader.php#L188-L198 | train |
Wedeto/FileFormats | src/CSV/Reader.php | Reader.rewind | public function rewind()
{
rewind($this->file_handle);
$this->line_number = 0;
$this->current_line = null;
$this->header = null;
} | php | public function rewind()
{
rewind($this->file_handle);
$this->line_number = 0;
$this->current_line = null;
$this->header = null;
} | [
"public",
"function",
"rewind",
"(",
")",
"{",
"rewind",
"(",
"$",
"this",
"->",
"file_handle",
")",
";",
"$",
"this",
"->",
"line_number",
"=",
"0",
";",
"$",
"this",
"->",
"current_line",
"=",
"null",
";",
"$",
"this",
"->",
"header",
"=",
"null",
... | Rewind the file handle to the start | [
"Rewind",
"the",
"file",
"handle",
"to",
"the",
"start"
] | 65b71fbd38a2ee6b504622aca4f4047ce9d31e9f | https://github.com/Wedeto/FileFormats/blob/65b71fbd38a2ee6b504622aca4f4047ce9d31e9f/src/CSV/Reader.php#L203-L209 | train |
covex-nn/JooS | src/JooS/Options.php | Options.loadJson | public function loadJson($filename)
{
$result = false;
if (file_exists($filename) && is_file($filename)) {
$json = file_get_contents($filename);
$data = json_decode($json, true);
if (is_array($data)) {
foreach ($data as $name => $value) {
$this->__set($name, $value);
... | php | public function loadJson($filename)
{
$result = false;
if (file_exists($filename) && is_file($filename)) {
$json = file_get_contents($filename);
$data = json_decode($json, true);
if (is_array($data)) {
foreach ($data as $name => $value) {
$this->__set($name, $value);
... | [
"public",
"function",
"loadJson",
"(",
"$",
"filename",
")",
"{",
"$",
"result",
"=",
"false",
";",
"if",
"(",
"file_exists",
"(",
"$",
"filename",
")",
"&&",
"is_file",
"(",
"$",
"filename",
")",
")",
"{",
"$",
"json",
"=",
"file_get_contents",
"(",
... | Load options from filename.json
@param string $filename Path to config file
@return boolean | [
"Load",
"options",
"from",
"filename",
".",
"json"
] | 8dfb94edccecaf307787d4091ba7f20a674b7792 | https://github.com/covex-nn/JooS/blob/8dfb94edccecaf307787d4091ba7f20a674b7792/src/JooS/Options.php#L99-L113 | train |
covex-nn/JooS | src/JooS/Options.php | Options.getDefault | protected function getDefault($name)
{
if (is_null($this->_defaultData)) {
$subject = $this->getSubject();
if (!is_null($subject) && $subject instanceof Options_Subject) {
$this->_defaultData = $subject->getDefaultOptions();
} else {
$this->_defaultData = array();
}
}
... | php | protected function getDefault($name)
{
if (is_null($this->_defaultData)) {
$subject = $this->getSubject();
if (!is_null($subject) && $subject instanceof Options_Subject) {
$this->_defaultData = $subject->getDefaultOptions();
} else {
$this->_defaultData = array();
}
}
... | [
"protected",
"function",
"getDefault",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"this",
"->",
"_defaultData",
")",
")",
"{",
"$",
"subject",
"=",
"$",
"this",
"->",
"getSubject",
"(",
")",
";",
"if",
"(",
"!",
"is_null",
"(",
"$"... | Return default value
@param string $name Property name
@return mixed | [
"Return",
"default",
"value"
] | 8dfb94edccecaf307787d4091ba7f20a674b7792 | https://github.com/covex-nn/JooS/blob/8dfb94edccecaf307787d4091ba7f20a674b7792/src/JooS/Options.php#L146-L164 | train |
field-interactive/cito-bundle | Controller/CitoController.php | CitoController.getLocaleFromUrl | protected function getLocaleFromUrl(string $url)
{
$locale = trim(substr($url, 0, 3), '/');
if (strlen($locale) > 2 || strlen($locale) < 2) {
return false;
}
return $locale;
} | php | protected function getLocaleFromUrl(string $url)
{
$locale = trim(substr($url, 0, 3), '/');
if (strlen($locale) > 2 || strlen($locale) < 2) {
return false;
}
return $locale;
} | [
"protected",
"function",
"getLocaleFromUrl",
"(",
"string",
"$",
"url",
")",
"{",
"$",
"locale",
"=",
"trim",
"(",
"substr",
"(",
"$",
"url",
",",
"0",
",",
"3",
")",
",",
"'/'",
")",
";",
"if",
"(",
"strlen",
"(",
"$",
"locale",
")",
">",
"2",
... | Gets the locale out of the url if it's in
return string|false | [
"Gets",
"the",
"locale",
"out",
"of",
"the",
"url",
"if",
"it",
"s",
"in"
] | 41cab570f960d964916e278c616720b17de258c1 | https://github.com/field-interactive/cito-bundle/blob/41cab570f960d964916e278c616720b17de258c1/Controller/CitoController.php#L110-L118 | train |
field-interactive/cito-bundle | Controller/CitoController.php | CitoController.isUARouted | protected function isUARouted(string $url)
{
$exploded = explode('/', $url);
$uaRoute = $exploded[0];
$routingData = $this->getParameter('field_cito.routing.user_agent_routing');
foreach ($routingData as $route => $browsers) {
if ($route === $uaRoute) {
r... | php | protected function isUARouted(string $url)
{
$exploded = explode('/', $url);
$uaRoute = $exploded[0];
$routingData = $this->getParameter('field_cito.routing.user_agent_routing');
foreach ($routingData as $route => $browsers) {
if ($route === $uaRoute) {
r... | [
"protected",
"function",
"isUARouted",
"(",
"string",
"$",
"url",
")",
"{",
"$",
"exploded",
"=",
"explode",
"(",
"'/'",
",",
"$",
"url",
")",
";",
"$",
"uaRoute",
"=",
"$",
"exploded",
"[",
"0",
"]",
";",
"$",
"routingData",
"=",
"$",
"this",
"->"... | Checks if UserAgent is Routed | [
"Checks",
"if",
"UserAgent",
"is",
"Routed"
] | 41cab570f960d964916e278c616720b17de258c1 | https://github.com/field-interactive/cito-bundle/blob/41cab570f960d964916e278c616720b17de258c1/Controller/CitoController.php#L123-L135 | train |
field-interactive/cito-bundle | Controller/CitoController.php | CitoController.getBrowserData | protected static function getBrowserData($userAgent)
{
$matches = [];
if (strpos($userAgent, 'Opera') !== false) {
$browserName = 'Opera';
preg_match_all('/Version\/([\d]+)/', $_SERVER['HTTP_USER_AGENT'], $matches);
} elseif (strpos($userAgent, 'OPR/') !== false) {
... | php | protected static function getBrowserData($userAgent)
{
$matches = [];
if (strpos($userAgent, 'Opera') !== false) {
$browserName = 'Opera';
preg_match_all('/Version\/([\d]+)/', $_SERVER['HTTP_USER_AGENT'], $matches);
} elseif (strpos($userAgent, 'OPR/') !== false) {
... | [
"protected",
"static",
"function",
"getBrowserData",
"(",
"$",
"userAgent",
")",
"{",
"$",
"matches",
"=",
"[",
"]",
";",
"if",
"(",
"strpos",
"(",
"$",
"userAgent",
",",
"'Opera'",
")",
"!==",
"false",
")",
"{",
"$",
"browserName",
"=",
"'Opera'",
";"... | Gets the browser data | [
"Gets",
"the",
"browser",
"data"
] | 41cab570f960d964916e278c616720b17de258c1 | https://github.com/field-interactive/cito-bundle/blob/41cab570f960d964916e278c616720b17de258c1/Controller/CitoController.php#L140-L175 | train |
wb-crowdfusion/crowdfusion | system/core/classes/mvc/templateengines/PresenterTemplateEngine.php | PresenterTemplateEngine.render | protected function render(Template $template)
{
$presenter = $this->createPresenter($template->getPresenter());
try {
$arguments = $this->getArguments($presenter, $template);
$this->logger->debug($arguments);
$result = call_user_func_array($presenter, $arguments)... | php | protected function render(Template $template)
{
$presenter = $this->createPresenter($template->getPresenter());
try {
$arguments = $this->getArguments($presenter, $template);
$this->logger->debug($arguments);
$result = call_user_func_array($presenter, $arguments)... | [
"protected",
"function",
"render",
"(",
"Template",
"$",
"template",
")",
"{",
"$",
"presenter",
"=",
"$",
"this",
"->",
"createPresenter",
"(",
"$",
"template",
"->",
"getPresenter",
"(",
")",
")",
";",
"try",
"{",
"$",
"arguments",
"=",
"$",
"this",
... | Loads a presenter, calls its method and returns the result.
@param Template $template
@return string
@throws Exception | [
"Loads",
"a",
"presenter",
"calls",
"its",
"method",
"and",
"returns",
"the",
"result",
"."
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/mvc/templateengines/PresenterTemplateEngine.php#L159-L182 | train |
wb-crowdfusion/crowdfusion | system/core/classes/mvc/templateengines/PresenterTemplateEngine.php | PresenterTemplateEngine.createPresenter | protected function createPresenter($presenter)
{
if (false === strpos($presenter, '::')) {
throw new TemplateEngineException(sprintf('Presenter must be in the format class|service::method', $presenter));
}
list($class, $method) = explode('::', $presenter, 2);
$presenter ... | php | protected function createPresenter($presenter)
{
if (false === strpos($presenter, '::')) {
throw new TemplateEngineException(sprintf('Presenter must be in the format class|service::method', $presenter));
}
list($class, $method) = explode('::', $presenter, 2);
$presenter ... | [
"protected",
"function",
"createPresenter",
"(",
"$",
"presenter",
")",
"{",
"if",
"(",
"false",
"===",
"strpos",
"(",
"$",
"presenter",
",",
"'::'",
")",
")",
"{",
"throw",
"new",
"TemplateEngineException",
"(",
"sprintf",
"(",
"'Presenter must be in the format... | Returns a callable for the given presenter.
@param string $presenter A Presenter string
@return mixed A PHP callable
@throws TemplateEngineException | [
"Returns",
"a",
"callable",
"for",
"the",
"given",
"presenter",
"."
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/mvc/templateengines/PresenterTemplateEngine.php#L193-L207 | train |
kyoya-de/random-string-generator | lib/Generator.php | Generator.generate | public function generate($length)
{
$realPool = $this->mergePools($this->characterPools);
$max = (count($realPool) - 1);
mt_srand();
$randomString = '';
for ($i = 0; $i < $length; $i++) {
$randomString .= $realPool[mt_rand(0, $max)];
}
return $r... | php | public function generate($length)
{
$realPool = $this->mergePools($this->characterPools);
$max = (count($realPool) - 1);
mt_srand();
$randomString = '';
for ($i = 0; $i < $length; $i++) {
$randomString .= $realPool[mt_rand(0, $max)];
}
return $r... | [
"public",
"function",
"generate",
"(",
"$",
"length",
")",
"{",
"$",
"realPool",
"=",
"$",
"this",
"->",
"mergePools",
"(",
"$",
"this",
"->",
"characterPools",
")",
";",
"$",
"max",
"=",
"(",
"count",
"(",
"$",
"realPool",
")",
"-",
"1",
")",
";",... | Generates a random string with the given length based on the character pools.
@param int $length Length of the result string.
@return string | [
"Generates",
"a",
"random",
"string",
"with",
"the",
"given",
"length",
"based",
"on",
"the",
"character",
"pools",
"."
] | 9c8212ddd093c23e2af73840330fc62db48c0023 | https://github.com/kyoya-de/random-string-generator/blob/9c8212ddd093c23e2af73840330fc62db48c0023/lib/Generator.php#L50-L63 | train |
kyoya-de/random-string-generator | lib/Generator.php | Generator.mergePools | protected function mergePools($pools)
{
$mergedPool = [];
foreach ($pools as $pool) {
foreach ($pool->getCharacters() as $character) {
$mergedPool[] = $character;
}
}
return $mergedPool;
} | php | protected function mergePools($pools)
{
$mergedPool = [];
foreach ($pools as $pool) {
foreach ($pool->getCharacters() as $character) {
$mergedPool[] = $character;
}
}
return $mergedPool;
} | [
"protected",
"function",
"mergePools",
"(",
"$",
"pools",
")",
"{",
"$",
"mergedPool",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"pools",
"as",
"$",
"pool",
")",
"{",
"foreach",
"(",
"$",
"pool",
"->",
"getCharacters",
"(",
")",
"as",
"$",
"character"... | Merges all characters from the registered pools into one array.
@param CharacterPoolInterface[] $pools
@return array | [
"Merges",
"all",
"characters",
"from",
"the",
"registered",
"pools",
"into",
"one",
"array",
"."
] | 9c8212ddd093c23e2af73840330fc62db48c0023 | https://github.com/kyoya-de/random-string-generator/blob/9c8212ddd093c23e2af73840330fc62db48c0023/lib/Generator.php#L72-L83 | train |
Dhii/callback-abstract | src/ValidateParamsCapableTrait.php | ValidateParamsCapableTrait._validateParams | protected function _validateParams($args, $spec)
{
$errors = $this->_getArgsListErrors($args, $spec);
if ($this->_countIterable($errors)) {
throw $this->_createValidationFailedException(null, null, null, null, $args, $errors);
}
} | php | protected function _validateParams($args, $spec)
{
$errors = $this->_getArgsListErrors($args, $spec);
if ($this->_countIterable($errors)) {
throw $this->_createValidationFailedException(null, null, null, null, $args, $errors);
}
} | [
"protected",
"function",
"_validateParams",
"(",
"$",
"args",
",",
"$",
"spec",
")",
"{",
"$",
"errors",
"=",
"$",
"this",
"->",
"_getArgsListErrors",
"(",
"$",
"args",
",",
"$",
"spec",
")",
";",
"if",
"(",
"$",
"this",
"->",
"_countIterable",
"(",
... | Validates a function or method's arguments according to the method's parameter specification.
@since [*next-version*]
@param array $args The arguments to validate.
@param ReflectionParameter[]|stdClass|Traversable $spec The parameter specification. | [
"Validates",
"a",
"function",
"or",
"method",
"s",
"arguments",
"according",
"to",
"the",
"method",
"s",
"parameter",
"specification",
"."
] | 43ed4e99fc6ccdaf46a25d06da482a2fba8d9b19 | https://github.com/Dhii/callback-abstract/blob/43ed4e99fc6ccdaf46a25d06da482a2fba8d9b19/src/ValidateParamsCapableTrait.php#L29-L35 | train |
the-eater/odango.php | src/NyaaMatcher/Fuzzy.php | Fuzzy.construct | public static function construct($minMatches = .7, $maxDistance = .2)
{
$fuzzy = new static();
$fuzzy->minMatches = $minMatches;
$fuzzy->maxDistance = $maxDistance;
return $fuzzy;
} | php | public static function construct($minMatches = .7, $maxDistance = .2)
{
$fuzzy = new static();
$fuzzy->minMatches = $minMatches;
$fuzzy->maxDistance = $maxDistance;
return $fuzzy;
} | [
"public",
"static",
"function",
"construct",
"(",
"$",
"minMatches",
"=",
".7",
",",
"$",
"maxDistance",
"=",
".2",
")",
"{",
"$",
"fuzzy",
"=",
"new",
"static",
"(",
")",
";",
"$",
"fuzzy",
"->",
"minMatches",
"=",
"$",
"minMatches",
";",
"$",
"fuzz... | Creates a new instance of NyaaMatcher\Fuzzy
@param int $minMatches The ratio of minimal amount of words that should fall in the max distance to match (0 - 1)
@param int $maxDistance The max distance of how different a word may be to match
@return NyaaMatcher\Fuzzy | [
"Creates",
"a",
"new",
"instance",
"of",
"NyaaMatcher",
"\\",
"Fuzzy"
] | 6c78f983e7b3c49ff2f8a10ce7299747d3c82e3f | https://github.com/the-eater/odango.php/blob/6c78f983e7b3c49ff2f8a10ce7299747d3c82e3f/src/NyaaMatcher/Fuzzy.php#L16-L23 | train |
translationexchange/tml-php-clientsdk | library/Tr8n/Translation.php | Translation.calculatePrecedence | public function calculatePrecedence() {
$this->precedence = 0;
if (!$this->hasContextRules()) {
return;
}
foreach($this->context as $token_name=>$rules) {
foreach($rules as $context_key=>$rule_key) {
if ($rule_key == "other")
... | php | public function calculatePrecedence() {
$this->precedence = 0;
if (!$this->hasContextRules()) {
return;
}
foreach($this->context as $token_name=>$rules) {
foreach($rules as $context_key=>$rule_key) {
if ($rule_key == "other")
... | [
"public",
"function",
"calculatePrecedence",
"(",
")",
"{",
"$",
"this",
"->",
"precedence",
"=",
"0",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"hasContextRules",
"(",
")",
")",
"{",
"return",
";",
"}",
"foreach",
"(",
"$",
"this",
"->",
"context",
"a... | the precedence is based on the number of fallback rules in the context.
a fallback rule is indicated by the keyword "other"
the more "others" are used the lower the precedence will be
0 indicates the highest precedence | [
"the",
"precedence",
"is",
"based",
"on",
"the",
"number",
"of",
"fallback",
"rules",
"in",
"the",
"context",
".",
"a",
"fallback",
"rule",
"is",
"indicated",
"by",
"the",
"keyword",
"other",
"the",
"more",
"others",
"are",
"used",
"the",
"lower",
"the",
... | fe51473824e62cfd883c6aa0c6a3783a16ce8425 | https://github.com/translationexchange/tml-php-clientsdk/blob/fe51473824e62cfd883c6aa0c6a3783a16ce8425/library/Tr8n/Translation.php#L103-L116 | train |
ColonelBlimp/NsanjaCore | src/Nsanja/Core/Util.php | Util.scanDirectory | public function scanDirectory(string $path): array
{
$files = [];
$rdi = new \RecursiveDirectoryIterator(
$path,
\FilesystemIterator::SKIP_DOTS |
\FilesystemIterator::KEY_AS_FILENAME |
\FilesystemIterator::CURRENT_AS_FILEINFO
);
$rii ... | php | public function scanDirectory(string $path): array
{
$files = [];
$rdi = new \RecursiveDirectoryIterator(
$path,
\FilesystemIterator::SKIP_DOTS |
\FilesystemIterator::KEY_AS_FILENAME |
\FilesystemIterator::CURRENT_AS_FILEINFO
);
$rii ... | [
"public",
"function",
"scanDirectory",
"(",
"string",
"$",
"path",
")",
":",
"array",
"{",
"$",
"files",
"=",
"[",
"]",
";",
"$",
"rdi",
"=",
"new",
"\\",
"RecursiveDirectoryIterator",
"(",
"$",
"path",
",",
"\\",
"FilesystemIterator",
"::",
"SKIP_DOTS",
... | Scans the given directory and its sub-directories and returns a list of all the files
@return array | [
"Scans",
"the",
"given",
"directory",
"and",
"its",
"sub",
"-",
"directories",
"and",
"returns",
"a",
"list",
"of",
"all",
"the",
"files"
] | 935b7363ae21b340eaa5867560a29f965ec7d012 | https://github.com/ColonelBlimp/NsanjaCore/blob/935b7363ae21b340eaa5867560a29f965ec7d012/src/Nsanja/Core/Util.php#L35-L53 | train |
ColonelBlimp/NsanjaCore | src/Nsanja/Core/Util.php | Util.markdownToText | public function markdownToText(string $markdown): string
{
if (empty($markdown)) {
return '';
}
$pattern = array(
'/(\.|)#/',
'/(\.|)\*/',
'/(\.|)~/'
);
return preg_replace($pattern, '', $markdown);
} | php | public function markdownToText(string $markdown): string
{
if (empty($markdown)) {
return '';
}
$pattern = array(
'/(\.|)#/',
'/(\.|)\*/',
'/(\.|)~/'
);
return preg_replace($pattern, '', $markdown);
} | [
"public",
"function",
"markdownToText",
"(",
"string",
"$",
"markdown",
")",
":",
"string",
"{",
"if",
"(",
"empty",
"(",
"$",
"markdown",
")",
")",
"{",
"return",
"''",
";",
"}",
"$",
"pattern",
"=",
"array",
"(",
"'/(\\.|)#/'",
",",
"'/(\\.|)\\*/'",
... | Strips the given text of the markdown but not '\n'.
@param string $markdown
@return string | [
"Strips",
"the",
"given",
"text",
"of",
"the",
"markdown",
"but",
"not",
"\\",
"n",
"."
] | 935b7363ae21b340eaa5867560a29f965ec7d012 | https://github.com/ColonelBlimp/NsanjaCore/blob/935b7363ae21b340eaa5867560a29f965ec7d012/src/Nsanja/Core/Util.php#L60-L73 | train |
ColonelBlimp/NsanjaCore | src/Nsanja/Core/Util.php | Util.startswith | public function startswith(string $haystack, string $needle) : bool
{
return (substr($haystack, 0, strlen($needle)) === $needle);
} | php | public function startswith(string $haystack, string $needle) : bool
{
return (substr($haystack, 0, strlen($needle)) === $needle);
} | [
"public",
"function",
"startswith",
"(",
"string",
"$",
"haystack",
",",
"string",
"$",
"needle",
")",
":",
"bool",
"{",
"return",
"(",
"substr",
"(",
"$",
"haystack",
",",
"0",
",",
"strlen",
"(",
"$",
"needle",
")",
")",
"===",
"$",
"needle",
")",
... | String startswith.
@param string $haystack The input string.
@param string $needle The string search for.
@return bool Returns true if the $haystack ends with the $needle, otherwise false. | [
"String",
"startswith",
"."
] | 935b7363ae21b340eaa5867560a29f965ec7d012 | https://github.com/ColonelBlimp/NsanjaCore/blob/935b7363ae21b340eaa5867560a29f965ec7d012/src/Nsanja/Core/Util.php#L81-L84 | train |
ColonelBlimp/NsanjaCore | src/Nsanja/Core/Util.php | Util.endswith | public function endswith(string $haystack, string $needle) : bool
{
return (substr($haystack, -1 * strlen($needle)) === $needle);
} | php | public function endswith(string $haystack, string $needle) : bool
{
return (substr($haystack, -1 * strlen($needle)) === $needle);
} | [
"public",
"function",
"endswith",
"(",
"string",
"$",
"haystack",
",",
"string",
"$",
"needle",
")",
":",
"bool",
"{",
"return",
"(",
"substr",
"(",
"$",
"haystack",
",",
"-",
"1",
"*",
"strlen",
"(",
"$",
"needle",
")",
")",
"===",
"$",
"needle",
... | String endswith.
@param string $haystack The input string.
@param string $needle The string search for.
@return bool Returns true if the $haystack starts with the $needle, otherwise false. | [
"String",
"endswith",
"."
] | 935b7363ae21b340eaa5867560a29f965ec7d012 | https://github.com/ColonelBlimp/NsanjaCore/blob/935b7363ae21b340eaa5867560a29f965ec7d012/src/Nsanja/Core/Util.php#L92-L95 | train |
Torann/skosh-generator | src/Twig/Loader.php | Loader.getSource | function getSource($name)
{
if (isset($this->site->pages[$name])) {
$content = $this->site->pages[$name];
}
else {
throw new \Exception("Cannot find content \"$name\".");
}
if (!$content->template) {
throw new \Exception("Content does not ... | php | function getSource($name)
{
if (isset($this->site->pages[$name])) {
$content = $this->site->pages[$name];
}
else {
throw new \Exception("Cannot find content \"$name\".");
}
if (!$content->template) {
throw new \Exception("Content does not ... | [
"function",
"getSource",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"site",
"->",
"pages",
"[",
"$",
"name",
"]",
")",
")",
"{",
"$",
"content",
"=",
"$",
"this",
"->",
"site",
"->",
"pages",
"[",
"$",
"name",
"]",
... | Generates the template for a given page path. | [
"Generates",
"the",
"template",
"for",
"a",
"given",
"page",
"path",
"."
] | ea60e037d92398d7c146eb2349735d5692e3c48c | https://github.com/Torann/skosh-generator/blob/ea60e037d92398d7c146eb2349735d5692e3c48c/src/Twig/Loader.php#L22-L54 | train |
WideFocus/Feed-Writer | src/WriterTrait.php | WriterTrait.write | public function write(Iterator $dataIterator)
{
$this->initialize();
foreach ($dataIterator as $item) {
$this->writeItem($item);
}
$this->finish();
} | php | public function write(Iterator $dataIterator)
{
$this->initialize();
foreach ($dataIterator as $item) {
$this->writeItem($item);
}
$this->finish();
} | [
"public",
"function",
"write",
"(",
"Iterator",
"$",
"dataIterator",
")",
"{",
"$",
"this",
"->",
"initialize",
"(",
")",
";",
"foreach",
"(",
"$",
"dataIterator",
"as",
"$",
"item",
")",
"{",
"$",
"this",
"->",
"writeItem",
"(",
"$",
"item",
")",
";... | Write the feed.
@param Iterator|ArrayAccess[] $dataIterator
@return void | [
"Write",
"the",
"feed",
"."
] | c2698394645c75db06962e5e9d638f0cabe69fe3 | https://github.com/WideFocus/Feed-Writer/blob/c2698394645c75db06962e5e9d638f0cabe69fe3/src/WriterTrait.php#L24-L31 | train |
ciims/ciims-modules-hybridauth | models/RemoteIdentityForm.php | RemoteIdentityForm.validateIdentity | public function validateIdentity($attributes, $params)
{
// Search the database for a user with that information
$metadata = UserMetadata::model()->findByAttributes(array(
'key' => $this->provider.'Provider',
'value' => $this->adapter->identifier
));
// Retur... | php | public function validateIdentity($attributes, $params)
{
// Search the database for a user with that information
$metadata = UserMetadata::model()->findByAttributes(array(
'key' => $this->provider.'Provider',
'value' => $this->adapter->identifier
));
// Retur... | [
"public",
"function",
"validateIdentity",
"(",
"$",
"attributes",
",",
"$",
"params",
")",
"{",
"// Search the database for a user with that information",
"$",
"metadata",
"=",
"UserMetadata",
"::",
"model",
"(",
")",
"->",
"findByAttributes",
"(",
"array",
"(",
"'k... | Validates that we have an identity on file for this user
@param array $attributes
@param array $params
@return boolean | [
"Validates",
"that",
"we",
"have",
"an",
"identity",
"on",
"file",
"for",
"this",
"user"
] | 417b2682bf3468dd509164a9b773d886359a7aec | https://github.com/ciims/ciims-modules-hybridauth/blob/417b2682bf3468dd509164a9b773d886359a7aec/models/RemoteIdentityForm.php#L47-L72 | train |
ciims/ciims-modules-hybridauth | models/RemoteIdentityForm.php | RemoteIdentityForm.login | public function login()
{
if (!$this->authenticate())
return false;
if($this->_identity->errorCode===RemoteUserIdentity::ERROR_NONE)
{
Yii::app()->user->logout();
return Yii::app()->user->login($this->_identity,3600*24);
}
else
return false;
} | php | public function login()
{
if (!$this->authenticate())
return false;
if($this->_identity->errorCode===RemoteUserIdentity::ERROR_NONE)
{
Yii::app()->user->logout();
return Yii::app()->user->login($this->_identity,3600*24);
}
else
return false;
} | [
"public",
"function",
"login",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"authenticate",
"(",
")",
")",
"return",
"false",
";",
"if",
"(",
"$",
"this",
"->",
"_identity",
"->",
"errorCode",
"===",
"RemoteUserIdentity",
"::",
"ERROR_NONE",
")",
... | Logins the user in using their Remote user information
@return boolean | [
"Logins",
"the",
"user",
"in",
"using",
"their",
"Remote",
"user",
"information"
] | 417b2682bf3468dd509164a9b773d886359a7aec | https://github.com/ciims/ciims-modules-hybridauth/blob/417b2682bf3468dd509164a9b773d886359a7aec/models/RemoteIdentityForm.php#L92-L105 | train |
Xsaven/laravel-intelect-admin | src/Auth/Database/HasPermissions.php | HasPermissions.roles | public function roles() : BelongsToMany
{
$pivotTable = config('lia.database.role_users_table');
$relatedModel = config('lia.database.roles_model');
return $this->belongsToMany($relatedModel, $pivotTable, 'user_id', 'role_id');
} | php | public function roles() : BelongsToMany
{
$pivotTable = config('lia.database.role_users_table');
$relatedModel = config('lia.database.roles_model');
return $this->belongsToMany($relatedModel, $pivotTable, 'user_id', 'role_id');
} | [
"public",
"function",
"roles",
"(",
")",
":",
"BelongsToMany",
"{",
"$",
"pivotTable",
"=",
"config",
"(",
"'lia.database.role_users_table'",
")",
";",
"$",
"relatedModel",
"=",
"config",
"(",
"'lia.database.roles_model'",
")",
";",
"return",
"$",
"this",
"->",
... | A user has and belongs to many roles.
@return BelongsToMany | [
"A",
"user",
"has",
"and",
"belongs",
"to",
"many",
"roles",
"."
] | 592574633d12c74cf25b43dd6694fee496abefcb | https://github.com/Xsaven/laravel-intelect-admin/blob/592574633d12c74cf25b43dd6694fee496abefcb/src/Auth/Database/HasPermissions.php#L32-L39 | train |
Xsaven/laravel-intelect-admin | src/Auth/Database/HasPermissions.php | HasPermissions.permissions | public function permissions() : BelongsToMany
{
$pivotTable = config('lia.database.user_permissions_table');
$relatedModel = config('lia.database.permissions_model');
return $this->belongsToMany($relatedModel, $pivotTable, 'user_id', 'permission_id');
} | php | public function permissions() : BelongsToMany
{
$pivotTable = config('lia.database.user_permissions_table');
$relatedModel = config('lia.database.permissions_model');
return $this->belongsToMany($relatedModel, $pivotTable, 'user_id', 'permission_id');
} | [
"public",
"function",
"permissions",
"(",
")",
":",
"BelongsToMany",
"{",
"$",
"pivotTable",
"=",
"config",
"(",
"'lia.database.user_permissions_table'",
")",
";",
"$",
"relatedModel",
"=",
"config",
"(",
"'lia.database.permissions_model'",
")",
";",
"return",
"$",
... | A User has and belongs to many permissions.
@return BelongsToMany | [
"A",
"User",
"has",
"and",
"belongs",
"to",
"many",
"permissions",
"."
] | 592574633d12c74cf25b43dd6694fee496abefcb | https://github.com/Xsaven/laravel-intelect-admin/blob/592574633d12c74cf25b43dd6694fee496abefcb/src/Auth/Database/HasPermissions.php#L46-L53 | train |
ScaraMVC/Framework | src/Scara/Routing/Route.php | Route.register | public function register($method, $url, $action)
{
if (in_array($method, $this->_methods)) {
if (is_array($action)) {
if (!empty($action)) {
$exp = explode('@', $action['uses']);
$this->_routes[] = [
'controller' => ... | php | public function register($method, $url, $action)
{
if (in_array($method, $this->_methods)) {
if (is_array($action)) {
if (!empty($action)) {
$exp = explode('@', $action['uses']);
$this->_routes[] = [
'controller' => ... | [
"public",
"function",
"register",
"(",
"$",
"method",
",",
"$",
"url",
",",
"$",
"action",
")",
"{",
"if",
"(",
"in_array",
"(",
"$",
"method",
",",
"$",
"this",
"->",
"_methods",
")",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"action",
")",
")"... | Registers each route.
@param string $method - Route's request method
@param string $url - Route's URL
@param mixed $action - Route's action
@throws \Exception
@return void | [
"Registers",
"each",
"route",
"."
] | 199b08b45fadf5dae14ac4732af03b36e15bbef2 | https://github.com/ScaraMVC/Framework/blob/199b08b45fadf5dae14ac4732af03b36e15bbef2/src/Scara/Routing/Route.php#L35-L62 | train |
Subscribo/psr-http-message-tools | src/Factories/UriFactory.php | UriFactory.make | public static function make($uri, array $queryParameters = [])
{
$uri = ($uri instanceof UriInterface) ? $uri : new Uri($uri);
if ($queryParameters) {
$uri = static::addQueryParameters($uri, $queryParameters);
}
return $uri;
} | php | public static function make($uri, array $queryParameters = [])
{
$uri = ($uri instanceof UriInterface) ? $uri : new Uri($uri);
if ($queryParameters) {
$uri = static::addQueryParameters($uri, $queryParameters);
}
return $uri;
} | [
"public",
"static",
"function",
"make",
"(",
"$",
"uri",
",",
"array",
"$",
"queryParameters",
"=",
"[",
"]",
")",
"{",
"$",
"uri",
"=",
"(",
"$",
"uri",
"instanceof",
"UriInterface",
")",
"?",
"$",
"uri",
":",
"new",
"Uri",
"(",
"$",
"uri",
")",
... | Makes PSR-7 compliant Uri object
@param string|UriInterface $uri
@param array $queryParameters Query parameters to add / overwrite
@return UriInterface | [
"Makes",
"PSR",
"-",
"7",
"compliant",
"Uri",
"object"
] | b1dfa0b1dd646f353634b5c9603fd6c75a7b73bd | https://github.com/Subscribo/psr-http-message-tools/blob/b1dfa0b1dd646f353634b5c9603fd6c75a7b73bd/src/Factories/UriFactory.php#L20-L27 | train |
vukbgit/PHPCraft.Subject | src/Traits/Authentication.php | Authentication.execLoginForm | protected function execLoginForm()
{
$this->loadTranslations('form', sprintf('private/global/locales/%s/form.ini', LANGUAGE));
$this->templateParameters['translations'] = $this->translations;
$this->renderTemplate();
} | php | protected function execLoginForm()
{
$this->loadTranslations('form', sprintf('private/global/locales/%s/form.ini', LANGUAGE));
$this->templateParameters['translations'] = $this->translations;
$this->renderTemplate();
} | [
"protected",
"function",
"execLoginForm",
"(",
")",
"{",
"$",
"this",
"->",
"loadTranslations",
"(",
"'form'",
",",
"sprintf",
"(",
"'private/global/locales/%s/form.ini'",
",",
"LANGUAGE",
")",
")",
";",
"$",
"this",
"->",
"templateParameters",
"[",
"'translations... | displays login form | [
"displays",
"login",
"form"
] | a43ad7868098ff1e7bda6819547ea64f9a853732 | https://github.com/vukbgit/PHPCraft.Subject/blob/a43ad7868098ff1e7bda6819547ea64f9a853732/src/Traits/Authentication.php#L56-L61 | train |
vukbgit/PHPCraft.Subject | src/Traits/Authentication.php | Authentication.getUserData | private function getUserData()
{
$auth = $this->authFactory->newInstance();
return null !== $auth->getUserData() ? $auth->getUserData() : false;
} | php | private function getUserData()
{
$auth = $this->authFactory->newInstance();
return null !== $auth->getUserData() ? $auth->getUserData() : false;
} | [
"private",
"function",
"getUserData",
"(",
")",
"{",
"$",
"auth",
"=",
"$",
"this",
"->",
"authFactory",
"->",
"newInstance",
"(",
")",
";",
"return",
"null",
"!==",
"$",
"auth",
"->",
"getUserData",
"(",
")",
"?",
"$",
"auth",
"->",
"getUserData",
"("... | gets current user | [
"gets",
"current",
"user"
] | a43ad7868098ff1e7bda6819547ea64f9a853732 | https://github.com/vukbgit/PHPCraft.Subject/blob/a43ad7868098ff1e7bda6819547ea64f9a853732/src/Traits/Authentication.php#L116-L120 | train |
vukbgit/PHPCraft.Subject | src/Traits/Authentication.php | Authentication.setUserData | private function setUserData($property, $value)
{
$auth = $this->authFactory->newInstance();
$userData = $auth->getUserData();
if(!$userData) {
return;
}
$userData[$property] = $value;
$auth->setUserData($userData);
} | php | private function setUserData($property, $value)
{
$auth = $this->authFactory->newInstance();
$userData = $auth->getUserData();
if(!$userData) {
return;
}
$userData[$property] = $value;
$auth->setUserData($userData);
} | [
"private",
"function",
"setUserData",
"(",
"$",
"property",
",",
"$",
"value",
")",
"{",
"$",
"auth",
"=",
"$",
"this",
"->",
"authFactory",
"->",
"newInstance",
"(",
")",
";",
"$",
"userData",
"=",
"$",
"auth",
"->",
"getUserData",
"(",
")",
";",
"i... | Sets a property for current user | [
"Sets",
"a",
"property",
"for",
"current",
"user"
] | a43ad7868098ff1e7bda6819547ea64f9a853732 | https://github.com/vukbgit/PHPCraft.Subject/blob/a43ad7868098ff1e7bda6819547ea64f9a853732/src/Traits/Authentication.php#L125-L134 | train |
ekyna/Resource | Doctrine/ORM/Listener/TranslatableListener.php | TranslatableListener.hasUniqueConstraint | private function hasUniqueConstraint(ClassMetadata $metadata, array $columns)
{
if (!isset($metadata->table['uniqueConstraints'])) {
return false;
}
foreach ($metadata->table['uniqueConstraints'] as $constraint) {
if (!array_diff($constraint['columns'], $columns)) {
... | php | private function hasUniqueConstraint(ClassMetadata $metadata, array $columns)
{
if (!isset($metadata->table['uniqueConstraints'])) {
return false;
}
foreach ($metadata->table['uniqueConstraints'] as $constraint) {
if (!array_diff($constraint['columns'], $columns)) {
... | [
"private",
"function",
"hasUniqueConstraint",
"(",
"ClassMetadata",
"$",
"metadata",
",",
"array",
"$",
"columns",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"metadata",
"->",
"table",
"[",
"'uniqueConstraints'",
"]",
")",
")",
"{",
"return",
"false",
";... | Check if an unique constraint has been defined.
@param ClassMetadata $metadata
@param array $columns
@return bool | [
"Check",
"if",
"an",
"unique",
"constraint",
"has",
"been",
"defined",
"."
] | 96ee3d28e02bd9513705408e3bb7f88a76e52f56 | https://github.com/ekyna/Resource/blob/96ee3d28e02bd9513705408e3bb7f88a76e52f56/Doctrine/ORM/Listener/TranslatableListener.php#L146-L159 | train |
ekyna/Resource | Doctrine/ORM/Listener/TranslatableListener.php | TranslatableListener.postLoad | public function postLoad(LifecycleEventArgs $args)
{
$entity = $args->getEntity();
if (!$entity instanceof TranslatableInterface) {
return;
}
$entity->initializeTranslations();
$entity->setCurrentLocale($this->localeProvider->getCurrentLocale());
$entity... | php | public function postLoad(LifecycleEventArgs $args)
{
$entity = $args->getEntity();
if (!$entity instanceof TranslatableInterface) {
return;
}
$entity->initializeTranslations();
$entity->setCurrentLocale($this->localeProvider->getCurrentLocale());
$entity... | [
"public",
"function",
"postLoad",
"(",
"LifecycleEventArgs",
"$",
"args",
")",
"{",
"$",
"entity",
"=",
"$",
"args",
"->",
"getEntity",
"(",
")",
";",
"if",
"(",
"!",
"$",
"entity",
"instanceof",
"TranslatableInterface",
")",
"{",
"return",
";",
"}",
"$"... | Translatable post load event handler.
Initializes the translations and sets the current and fallback locales.
@param LifecycleEventArgs $args | [
"Translatable",
"post",
"load",
"event",
"handler",
"."
] | 96ee3d28e02bd9513705408e3bb7f88a76e52f56 | https://github.com/ekyna/Resource/blob/96ee3d28e02bd9513705408e3bb7f88a76e52f56/Doctrine/ORM/Listener/TranslatableListener.php#L168-L179 | train |
ekyna/Resource | Doctrine/ORM/Listener/TranslatableListener.php | TranslatableListener.onTranslatablePreFlush | public function onTranslatablePreFlush(TranslatableInterface $translatable, PreFlushEventArgs $event)
{
if (null === $config = $this->registry->findConfiguration($translatable, false)) {
return;
}
$accessor = $this->getPropertyAccessor();
foreach ($translatable->getTran... | php | public function onTranslatablePreFlush(TranslatableInterface $translatable, PreFlushEventArgs $event)
{
if (null === $config = $this->registry->findConfiguration($translatable, false)) {
return;
}
$accessor = $this->getPropertyAccessor();
foreach ($translatable->getTran... | [
"public",
"function",
"onTranslatablePreFlush",
"(",
"TranslatableInterface",
"$",
"translatable",
",",
"PreFlushEventArgs",
"$",
"event",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"config",
"=",
"$",
"this",
"->",
"registry",
"->",
"findConfiguration",
"(",
"$",... | Translatable pre flush event handler.
Removes translations when all 'content' fields are set to null.
@param TranslatableInterface $translatable
@param PreFlushEventArgs $event | [
"Translatable",
"pre",
"flush",
"event",
"handler",
"."
] | 96ee3d28e02bd9513705408e3bb7f88a76e52f56 | https://github.com/ekyna/Resource/blob/96ee3d28e02bd9513705408e3bb7f88a76e52f56/Doctrine/ORM/Listener/TranslatableListener.php#L189-L206 | train |
noodle69/EdgarEzUISitesBundle | src/bundle/EventListener/ConfigureMenuListener.php | ConfigureMenuListener.onMenuConfigure | public function onMenuConfigure(ConfigureMenuEvent $event)
{
if ($this->permissionResolver->hasAccess('uisites', 'read')) {
$menu = $event->getMenu();
$menu->addChild(self::ITEM_SITES, []);
}
} | php | public function onMenuConfigure(ConfigureMenuEvent $event)
{
if ($this->permissionResolver->hasAccess('uisites', 'read')) {
$menu = $event->getMenu();
$menu->addChild(self::ITEM_SITES, []);
}
} | [
"public",
"function",
"onMenuConfigure",
"(",
"ConfigureMenuEvent",
"$",
"event",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"permissionResolver",
"->",
"hasAccess",
"(",
"'uisites'",
",",
"'read'",
")",
")",
"{",
"$",
"menu",
"=",
"$",
"event",
"->",
"getMen... | Add Sites entry menu.
@param ConfigureMenuEvent $event | [
"Add",
"Sites",
"entry",
"menu",
"."
] | 737aaaf3da004c5461bf146ba7df1dff10e3d476 | https://github.com/noodle69/EdgarEzUISitesBundle/blob/737aaaf3da004c5461bf146ba7df1dff10e3d476/src/bundle/EventListener/ConfigureMenuListener.php#L33-L40 | train |
vainproject/vain-user | src/User/Providers/UserServiceProvider.php | UserServiceProvider.composeViews | protected function composeViews()
{
// user menu in app
View::composer('app', function ($view) {
$view->getFactory()->inject('account', view('user::menu', ['guest' => Auth::guest(), 'user' => Auth::user()]));
});
View::composer('admin', function ($view) {
// ... | php | protected function composeViews()
{
// user menu in app
View::composer('app', function ($view) {
$view->getFactory()->inject('account', view('user::menu', ['guest' => Auth::guest(), 'user' => Auth::user()]));
});
View::composer('admin', function ($view) {
// ... | [
"protected",
"function",
"composeViews",
"(",
")",
"{",
"// user menu in app",
"View",
"::",
"composer",
"(",
"'app'",
",",
"function",
"(",
"$",
"view",
")",
"{",
"$",
"view",
"->",
"getFactory",
"(",
")",
"->",
"inject",
"(",
"'account'",
",",
"view",
... | composes admin views. | [
"composes",
"admin",
"views",
"."
] | 1c059faa61ebf289fcaea39a90b4523cfc9d6efc | https://github.com/vainproject/vain-user/blob/1c059faa61ebf289fcaea39a90b4523cfc9d6efc/src/User/Providers/UserServiceProvider.php#L50-L64 | train |
lasallecms/lasallecms-l5-usermanagement-pkg | src/Listeners/Createlasallecrmrecords/CreatePeopleRecord.php | CreatePeopleRecord.splitName | public function splitName($name, $firstOrSurname="surname") {
// The first name is considered to be all the characters to the left of the final space.
// The surname is considered to be all the characters to the right of the final space.
// oh, just in case the name ends with a space
$... | php | public function splitName($name, $firstOrSurname="surname") {
// The first name is considered to be all the characters to the left of the final space.
// The surname is considered to be all the characters to the right of the final space.
// oh, just in case the name ends with a space
$... | [
"public",
"function",
"splitName",
"(",
"$",
"name",
",",
"$",
"firstOrSurname",
"=",
"\"surname\"",
")",
"{",
"// The first name is considered to be all the characters to the left of the final space.",
"// The surname is considered to be all the characters to the right of the final spac... | First name and surnames are combined during registration.
Split 'em and return either the first name or the suranme
@param string $name Name entered during the registration process
@param string $firstOrSurname Return the "firstname"; or, the "surname"
@return string | [
"First",
"name",
"and",
"surnames",
"are",
"combined",
"during",
"registration",
".",
"Split",
"em",
"and",
"return",
"either",
"the",
"first",
"name",
"or",
"the",
"suranme"
] | b5203d596e18e2566e7fdcd3f13868bb44a94c1d | https://github.com/lasallecms/lasallecms-l5-usermanagement-pkg/blob/b5203d596e18e2566e7fdcd3f13868bb44a94c1d/src/Listeners/Createlasallecrmrecords/CreatePeopleRecord.php#L151-L166 | train |
locomotivemtl/charcoal-translator | src/Charcoal/Translator/LocalesManager.php | LocalesManager.setDefaultLocale | private function setDefaultLocale($lang)
{
if ($lang === null) {
$this->defaultLanguage = $this->languages[0];
return;
}
if (!$this->hasLocale($lang)) {
if (!is_string($lang)) {
$lang = is_object($lang) ? get_class($lang) : gettype($lang);... | php | private function setDefaultLocale($lang)
{
if ($lang === null) {
$this->defaultLanguage = $this->languages[0];
return;
}
if (!$this->hasLocale($lang)) {
if (!is_string($lang)) {
$lang = is_object($lang) ? get_class($lang) : gettype($lang);... | [
"private",
"function",
"setDefaultLocale",
"(",
"$",
"lang",
")",
"{",
"if",
"(",
"$",
"lang",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"defaultLanguage",
"=",
"$",
"this",
"->",
"languages",
"[",
"0",
"]",
";",
"return",
";",
"}",
"if",
"(",
"!... | Set the default language.
@param string|null $lang The default language code.
If NULL, the first language is assigned.
@throws InvalidArgumentException If the language is invalid.
@return void | [
"Set",
"the",
"default",
"language",
"."
] | 0a64432baef223dcccbfecf057015440dfa76e49 | https://github.com/locomotivemtl/charcoal-translator/blob/0a64432baef223dcccbfecf057015440dfa76e49/src/Charcoal/Translator/LocalesManager.php#L104-L124 | train |
locomotivemtl/charcoal-translator | src/Charcoal/Translator/LocalesManager.php | LocalesManager.setCurrentLocale | public function setCurrentLocale($lang)
{
if ($lang === null) {
$this->currentLanguage = null;
return;
}
if (!$this->hasLocale($lang)) {
if (!is_string($lang)) {
$lang = is_object($lang) ? get_class($lang) : gettype($lang);
}
... | php | public function setCurrentLocale($lang)
{
if ($lang === null) {
$this->currentLanguage = null;
return;
}
if (!$this->hasLocale($lang)) {
if (!is_string($lang)) {
$lang = is_object($lang) ? get_class($lang) : gettype($lang);
}
... | [
"public",
"function",
"setCurrentLocale",
"(",
"$",
"lang",
")",
"{",
"if",
"(",
"$",
"lang",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"currentLanguage",
"=",
"null",
";",
"return",
";",
"}",
"if",
"(",
"!",
"$",
"this",
"->",
"hasLocale",
"(",
... | Set the current language.
@param string|null $lang The current language code.
If NULL, the current language is unset.
@throws InvalidArgumentException If the language is invalid.
@return void | [
"Set",
"the",
"current",
"language",
"."
] | 0a64432baef223dcccbfecf057015440dfa76e49 | https://github.com/locomotivemtl/charcoal-translator/blob/0a64432baef223dcccbfecf057015440dfa76e49/src/Charcoal/Translator/LocalesManager.php#L144-L164 | train |
locomotivemtl/charcoal-translator | src/Charcoal/Translator/LocalesManager.php | LocalesManager.setLocales | private function setLocales(array $locales)
{
$locales = $this->filterLocales($locales);
uasort($locales, [ $this, 'sortLocalesByPriority' ]);
$this->locales = [];
$this->languages = [];
foreach ($locales as $langCode => $locale) {
$this->locales[$langCode] = $... | php | private function setLocales(array $locales)
{
$locales = $this->filterLocales($locales);
uasort($locales, [ $this, 'sortLocalesByPriority' ]);
$this->locales = [];
$this->languages = [];
foreach ($locales as $langCode => $locale) {
$this->locales[$langCode] = $... | [
"private",
"function",
"setLocales",
"(",
"array",
"$",
"locales",
")",
"{",
"$",
"locales",
"=",
"$",
"this",
"->",
"filterLocales",
"(",
"$",
"locales",
")",
";",
"uasort",
"(",
"$",
"locales",
",",
"[",
"$",
"this",
",",
"'sortLocalesByPriority'",
"]"... | Set the available languages.
Ensure that explicitely inactive locales are excluded and that the required
values are set on the locales configuration structure.
This method is only called from the constructor.
@param array $locales The locales configuration structure.
@throws InvalidArgumentException If there are no... | [
"Set",
"the",
"available",
"languages",
"."
] | 0a64432baef223dcccbfecf057015440dfa76e49 | https://github.com/locomotivemtl/charcoal-translator/blob/0a64432baef223dcccbfecf057015440dfa76e49/src/Charcoal/Translator/LocalesManager.php#L202-L219 | train |
locomotivemtl/charcoal-translator | src/Charcoal/Translator/LocalesManager.php | LocalesManager.filterLocales | private function filterLocales(array $locales)
{
$z = self::DEFAULT_SORT_PRIORITY;
$filteredLocales = [];
foreach ($locales as $langCode => $locale) {
if (isset($locale['active']) && !$locale['active']) {
continue;
}
if (!isset($locale['p... | php | private function filterLocales(array $locales)
{
$z = self::DEFAULT_SORT_PRIORITY;
$filteredLocales = [];
foreach ($locales as $langCode => $locale) {
if (isset($locale['active']) && !$locale['active']) {
continue;
}
if (!isset($locale['p... | [
"private",
"function",
"filterLocales",
"(",
"array",
"$",
"locales",
")",
"{",
"$",
"z",
"=",
"self",
"::",
"DEFAULT_SORT_PRIORITY",
";",
"$",
"filteredLocales",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"locales",
"as",
"$",
"langCode",
"=>",
"$",
"loca... | Filter the available languages.
Routine:
1. Removes disabled languages
2. Assigns a priority, if absent
3. Assigns a locale, if absent
@param array $locales The locales configuration structure.
@return array The parsed language structures. | [
"Filter",
"the",
"available",
"languages",
"."
] | 0a64432baef223dcccbfecf057015440dfa76e49 | https://github.com/locomotivemtl/charcoal-translator/blob/0a64432baef223dcccbfecf057015440dfa76e49/src/Charcoal/Translator/LocalesManager.php#L232-L254 | train |
jenskooij/cloudcontrol | src/search/DocumentTokenizer.php | DocumentTokenizer.tokenize | private function tokenize()
{
$this->tokenizeTitle();
$this->tokenizeFields();
$this->tokenizeBricks();
$this->tokenizeDynamicBricks();
$this->tokenVector = array_filter($this->tokenVector);
arsort($this->tokenVector);
} | php | private function tokenize()
{
$this->tokenizeTitle();
$this->tokenizeFields();
$this->tokenizeBricks();
$this->tokenizeDynamicBricks();
$this->tokenVector = array_filter($this->tokenVector);
arsort($this->tokenVector);
} | [
"private",
"function",
"tokenize",
"(",
")",
"{",
"$",
"this",
"->",
"tokenizeTitle",
"(",
")",
";",
"$",
"this",
"->",
"tokenizeFields",
"(",
")",
";",
"$",
"this",
"->",
"tokenizeBricks",
"(",
")",
";",
"$",
"this",
"->",
"tokenizeDynamicBricks",
"(",
... | Execute tokenization of all document fields | [
"Execute",
"tokenization",
"of",
"all",
"document",
"fields"
] | 76e5d9ac8f9c50d06d39a995d13cc03742536548 | https://github.com/jenskooij/cloudcontrol/blob/76e5d9ac8f9c50d06d39a995d13cc03742536548/src/search/DocumentTokenizer.php#L43-L51 | train |
jenskooij/cloudcontrol | src/search/DocumentTokenizer.php | DocumentTokenizer.addTokenToVector | private function addTokenToVector($token, $field, $count = 1)
{
if (!empty($token)) {
if (isset($this->tokenVector[$field][$token])) {
$this->tokenVector[$field][$token] += $count;
} else {
$this->tokenVector[$field][$token] = $count;
}
... | php | private function addTokenToVector($token, $field, $count = 1)
{
if (!empty($token)) {
if (isset($this->tokenVector[$field][$token])) {
$this->tokenVector[$field][$token] += $count;
} else {
$this->tokenVector[$field][$token] = $count;
}
... | [
"private",
"function",
"addTokenToVector",
"(",
"$",
"token",
",",
"$",
"field",
",",
"$",
"count",
"=",
"1",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"token",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"tokenVector",
"[",
"$"... | Add a token to the existing tokenvector
@param $token
@param string $field
@param int $count | [
"Add",
"a",
"token",
"to",
"the",
"existing",
"tokenvector"
] | 76e5d9ac8f9c50d06d39a995d13cc03742536548 | https://github.com/jenskooij/cloudcontrol/blob/76e5d9ac8f9c50d06d39a995d13cc03742536548/src/search/DocumentTokenizer.php#L125-L134 | train |
jenskooij/cloudcontrol | src/search/DocumentTokenizer.php | DocumentTokenizer.addTokenVectorToVector | private function addTokenVectorToVector($tokenVector, $field)
{
foreach ($tokenVector as $token => $count) {
$this->addTokenToVector($token, $field, $count);
}
} | php | private function addTokenVectorToVector($tokenVector, $field)
{
foreach ($tokenVector as $token => $count) {
$this->addTokenToVector($token, $field, $count);
}
} | [
"private",
"function",
"addTokenVectorToVector",
"(",
"$",
"tokenVector",
",",
"$",
"field",
")",
"{",
"foreach",
"(",
"$",
"tokenVector",
"as",
"$",
"token",
"=>",
"$",
"count",
")",
"{",
"$",
"this",
"->",
"addTokenToVector",
"(",
"$",
"token",
",",
"$... | Add a complete token vector to the existing one.
@param $tokenVector
@param $field | [
"Add",
"a",
"complete",
"token",
"vector",
"to",
"the",
"existing",
"one",
"."
] | 76e5d9ac8f9c50d06d39a995d13cc03742536548 | https://github.com/jenskooij/cloudcontrol/blob/76e5d9ac8f9c50d06d39a995d13cc03742536548/src/search/DocumentTokenizer.php#L141-L146 | train |
jenskooij/cloudcontrol | src/search/DocumentTokenizer.php | DocumentTokenizer.getFieldType | private function getFieldType($fieldName, $documentDefinition)
{
foreach ($documentDefinition->fields as $fieldTypeDefinition) {
if ($fieldTypeDefinition->slug === $fieldName) {
return $fieldTypeDefinition->type;
}
}
throw new \Exception('Unknown fiel... | php | private function getFieldType($fieldName, $documentDefinition)
{
foreach ($documentDefinition->fields as $fieldTypeDefinition) {
if ($fieldTypeDefinition->slug === $fieldName) {
return $fieldTypeDefinition->type;
}
}
throw new \Exception('Unknown fiel... | [
"private",
"function",
"getFieldType",
"(",
"$",
"fieldName",
",",
"$",
"documentDefinition",
")",
"{",
"foreach",
"(",
"$",
"documentDefinition",
"->",
"fields",
"as",
"$",
"fieldTypeDefinition",
")",
"{",
"if",
"(",
"$",
"fieldTypeDefinition",
"->",
"slug",
... | Get the type for a field
@param $fieldName
@param $documentDefinition
@return mixed
@throws \Exception | [
"Get",
"the",
"type",
"for",
"a",
"field"
] | 76e5d9ac8f9c50d06d39a995d13cc03742536548 | https://github.com/jenskooij/cloudcontrol/blob/76e5d9ac8f9c50d06d39a995d13cc03742536548/src/search/DocumentTokenizer.php#L155-L164 | train |
wobblecode/WobbleCodeUserBundle | Document/Invitation.php | Invitation.isDifferentEmail | public function isDifferentEmail(ExecutionContextInterface $context)
{
if ($this->getEmail() == $this->getFrom()->getEmail()) {
$context->buildViolation('You can\'t invite yourself!')
->atPath('email')
->addViolation();
}
} | php | public function isDifferentEmail(ExecutionContextInterface $context)
{
if ($this->getEmail() == $this->getFrom()->getEmail()) {
$context->buildViolation('You can\'t invite yourself!')
->atPath('email')
->addViolation();
}
} | [
"public",
"function",
"isDifferentEmail",
"(",
"ExecutionContextInterface",
"$",
"context",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getEmail",
"(",
")",
"==",
"$",
"this",
"->",
"getFrom",
"(",
")",
"->",
"getEmail",
"(",
")",
")",
"{",
"$",
"context",
... | Callback to check the if is a different email from it self | [
"Callback",
"to",
"check",
"the",
"if",
"is",
"a",
"different",
"email",
"from",
"it",
"self"
] | 7b8206f8b4a50fbc61f7bfe4f83eb466cad96440 | https://github.com/wobblecode/WobbleCodeUserBundle/blob/7b8206f8b4a50fbc61f7bfe4f83eb466cad96440/Document/Invitation.php#L120-L127 | train |
shgysk8zer0/core_api | abstracts/error_logger.php | Error_Logger.callErrorLogger | final protected static function callErrorLogger($level, $message)
{
if (is_null(static::$errorLoggerInstance)) {
static::$errorLoggerInstance = new self;
}
static::$errorLoggerInstance->{
static::$errorLoggerInstance->errorToLogLevel($level)
}($message);
} | php | final protected static function callErrorLogger($level, $message)
{
if (is_null(static::$errorLoggerInstance)) {
static::$errorLoggerInstance = new self;
}
static::$errorLoggerInstance->{
static::$errorLoggerInstance->errorToLogLevel($level)
}($message);
} | [
"final",
"protected",
"static",
"function",
"callErrorLogger",
"(",
"$",
"level",
",",
"$",
"message",
")",
"{",
"if",
"(",
"is_null",
"(",
"static",
"::",
"$",
"errorLoggerInstance",
")",
")",
"{",
"static",
"::",
"$",
"errorLoggerInstance",
"=",
"new",
"... | Passes the error to logger as an exception, converting error level
to Logger level.
@param int $level Error level from `E_*` error constants
@param string $message Message given with the error | [
"Passes",
"the",
"error",
"to",
"logger",
"as",
"an",
"exception",
"converting",
"error",
"level",
"to",
"Logger",
"level",
"."
] | 9e9b8baf761af874b95256ad2462e55fbb2b2e58 | https://github.com/shgysk8zer0/core_api/blob/9e9b8baf761af874b95256ad2462e55fbb2b2e58/abstracts/error_logger.php#L94-L102 | train |
myENA/default-psr-logger | src/DefaultLogger.php | DefaultLogger.setLogLevel | public function setLogLevel($logLevel)
{
if (!is_string($logLevel) || '' === ($level = strtolower($logLevel)) || !isset($this->levelMap[$level]))
{
throw new \InvalidArgumentException(sprintf(
'%s - Log level must be one of the following values: ["%s"]. %s seen.',
... | php | public function setLogLevel($logLevel)
{
if (!is_string($logLevel) || '' === ($level = strtolower($logLevel)) || !isset($this->levelMap[$level]))
{
throw new \InvalidArgumentException(sprintf(
'%s - Log level must be one of the following values: ["%s"]. %s seen.',
... | [
"public",
"function",
"setLogLevel",
"(",
"$",
"logLevel",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"logLevel",
")",
"||",
"''",
"===",
"(",
"$",
"level",
"=",
"strtolower",
"(",
"$",
"logLevel",
")",
")",
"||",
"!",
"isset",
"(",
"$",
"thi... | setLogLevel will limit what is written to a level greater than or equal to value passed in.
@param string $logLevel | [
"setLogLevel",
"will",
"limit",
"what",
"is",
"written",
"to",
"a",
"level",
"greater",
"than",
"or",
"equal",
"to",
"value",
"passed",
"in",
"."
] | a414fc861885ade353a1a0dd3bb09a3d5e532f87 | https://github.com/myENA/default-psr-logger/blob/a414fc861885ade353a1a0dd3bb09a3d5e532f87/src/DefaultLogger.php#L98-L111 | train |
myENA/default-psr-logger | src/DefaultLogger.php | DefaultLogger.tryLog | protected function tryLog($msg, $tries = 0)
{
if ((bool)@fwrite($this->stream, $msg))
return;
if (0 < $tries)
{
trigger_error(sprintf('%s - Unable to log message: "%s"', get_called_class(), $tries, $msg));
return;
}
$this->attemptStreamRe... | php | protected function tryLog($msg, $tries = 0)
{
if ((bool)@fwrite($this->stream, $msg))
return;
if (0 < $tries)
{
trigger_error(sprintf('%s - Unable to log message: "%s"', get_called_class(), $tries, $msg));
return;
}
$this->attemptStreamRe... | [
"protected",
"function",
"tryLog",
"(",
"$",
"msg",
",",
"$",
"tries",
"=",
"0",
")",
"{",
"if",
"(",
"(",
"bool",
")",
"@",
"fwrite",
"(",
"$",
"this",
"->",
"stream",
",",
"$",
"msg",
")",
")",
"return",
";",
"if",
"(",
"0",
"<",
"$",
"trie... | tryLog will attempt to write output to local stream. If unable, will kick-off re-open attempt
@param string $msg
@param int $tries | [
"tryLog",
"will",
"attempt",
"to",
"write",
"output",
"to",
"local",
"stream",
".",
"If",
"unable",
"will",
"kick",
"-",
"off",
"re",
"-",
"open",
"attempt"
] | a414fc861885ade353a1a0dd3bb09a3d5e532f87 | https://github.com/myENA/default-psr-logger/blob/a414fc861885ade353a1a0dd3bb09a3d5e532f87/src/DefaultLogger.php#L156-L170 | train |
myENA/default-psr-logger | src/DefaultLogger.php | DefaultLogger.attemptStreamRecovery | protected function attemptStreamRecovery()
{
if ('resource' === gettype($this->stream))
{
@fflush($this->stream);
@fclose($this->stream);
}
$this->stream = fopen($this->streamURI, $this->streamMode);
if (false === $this->stream)
{
... | php | protected function attemptStreamRecovery()
{
if ('resource' === gettype($this->stream))
{
@fflush($this->stream);
@fclose($this->stream);
}
$this->stream = fopen($this->streamURI, $this->streamMode);
if (false === $this->stream)
{
... | [
"protected",
"function",
"attemptStreamRecovery",
"(",
")",
"{",
"if",
"(",
"'resource'",
"===",
"gettype",
"(",
"$",
"this",
"->",
"stream",
")",
")",
"{",
"@",
"fflush",
"(",
"$",
"this",
"->",
"stream",
")",
";",
"@",
"fclose",
"(",
"$",
"this",
"... | Will attempt to re-open stream in the event that it was closed unexpectedly. Will use default if unable to
re-open custom
@see DefaultLogger::defaultStream() | [
"Will",
"attempt",
"to",
"re",
"-",
"open",
"stream",
"in",
"the",
"event",
"that",
"it",
"was",
"closed",
"unexpectedly",
".",
"Will",
"use",
"default",
"if",
"unable",
"to",
"re",
"-",
"open",
"custom"
] | a414fc861885ade353a1a0dd3bb09a3d5e532f87 | https://github.com/myENA/default-psr-logger/blob/a414fc861885ade353a1a0dd3bb09a3d5e532f87/src/DefaultLogger.php#L178-L196 | train |
Vectrex/vxPHP | src/Webpage/Menu/Menu.php | Menu.insertEntry | protected function insertEntry(MenuEntry $entry, $ndx = NULL) {
if($entry instanceof DynamicMenuEntry) {
$this->dynamicEntries[] = $entry;
}
if(!isset($ndx) || $ndx >= count($this->entries)) {
$this->entries[] = $entry;
}
else {
array_splice($this->entries, $ndx, 0, [$entry]);
}
$entry->setMen... | php | protected function insertEntry(MenuEntry $entry, $ndx = NULL) {
if($entry instanceof DynamicMenuEntry) {
$this->dynamicEntries[] = $entry;
}
if(!isset($ndx) || $ndx >= count($this->entries)) {
$this->entries[] = $entry;
}
else {
array_splice($this->entries, $ndx, 0, [$entry]);
}
$entry->setMen... | [
"protected",
"function",
"insertEntry",
"(",
"MenuEntry",
"$",
"entry",
",",
"$",
"ndx",
"=",
"NULL",
")",
"{",
"if",
"(",
"$",
"entry",
"instanceof",
"DynamicMenuEntry",
")",
"{",
"$",
"this",
"->",
"dynamicEntries",
"[",
"]",
"=",
"$",
"entry",
";",
... | insert or append menu entry
@param MenuEntry $entry
@param int $ndx
@return Menu | [
"insert",
"or",
"append",
"menu",
"entry"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Webpage/Menu/Menu.php#L129-L146 | train |
Vectrex/vxPHP | src/Webpage/Menu/Menu.php | Menu.insertEntries | public function insertEntries(array $entries, $ndx) {
foreach($entries as $e) {
$this->insertEntry($e, $ndx++);
}
return $this;
} | php | public function insertEntries(array $entries, $ndx) {
foreach($entries as $e) {
$this->insertEntry($e, $ndx++);
}
return $this;
} | [
"public",
"function",
"insertEntries",
"(",
"array",
"$",
"entries",
",",
"$",
"ndx",
")",
"{",
"foreach",
"(",
"$",
"entries",
"as",
"$",
"e",
")",
"{",
"$",
"this",
"->",
"insertEntry",
"(",
"$",
"e",
",",
"$",
"ndx",
"++",
")",
";",
"}",
"retu... | insert or append several MenuEntry objects
@param array $entries
@param insert $ndx
@return Menu | [
"insert",
"or",
"append",
"several",
"MenuEntry",
"objects"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Webpage/Menu/Menu.php#L155-L163 | train |
Vectrex/vxPHP | src/Webpage/Menu/Menu.php | Menu.insertBeforeEntry | public function insertBeforeEntry(MenuEntry $new, MenuEntry $pos) {
foreach($this->entries as $k => $e) {
if($e === $pos) {
$this->insertEntry($new, $k);
break;
}
}
return $this;
} | php | public function insertBeforeEntry(MenuEntry $new, MenuEntry $pos) {
foreach($this->entries as $k => $e) {
if($e === $pos) {
$this->insertEntry($new, $k);
break;
}
}
return $this;
} | [
"public",
"function",
"insertBeforeEntry",
"(",
"MenuEntry",
"$",
"new",
",",
"MenuEntry",
"$",
"pos",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"entries",
"as",
"$",
"k",
"=>",
"$",
"e",
")",
"{",
"if",
"(",
"$",
"e",
"===",
"$",
"pos",
")",
... | insert a MenuEntry before an existing MenuEntry
@param MenuEntry $new
@param MenuEntry $pos
@return Menu | [
"insert",
"a",
"MenuEntry",
"before",
"an",
"existing",
"MenuEntry"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Webpage/Menu/Menu.php#L202-L213 | train |
Vectrex/vxPHP | src/Webpage/Menu/Menu.php | Menu.replaceEntry | public function replaceEntry(MenuEntry $new, MenuEntry $toReplace) {
foreach($this->entries as $k => $e) {
if($e === $toReplace) {
$this->insertEntry($new, $k);
$this->removeEntry($toReplace);
break;
}
}
return $this;
} | php | public function replaceEntry(MenuEntry $new, MenuEntry $toReplace) {
foreach($this->entries as $k => $e) {
if($e === $toReplace) {
$this->insertEntry($new, $k);
$this->removeEntry($toReplace);
break;
}
}
return $this;
} | [
"public",
"function",
"replaceEntry",
"(",
"MenuEntry",
"$",
"new",
",",
"MenuEntry",
"$",
"toReplace",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"entries",
"as",
"$",
"k",
"=>",
"$",
"e",
")",
"{",
"if",
"(",
"$",
"e",
"===",
"$",
"toReplace",
... | replace a MenuEntry by another one
@param MenuEntry $new
@param MenuEntry $toReplace
@return Menu | [
"replace",
"a",
"MenuEntry",
"by",
"another",
"one"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Webpage/Menu/Menu.php#L234-L246 | train |
Vectrex/vxPHP | src/Webpage/Menu/Menu.php | Menu.removeEntry | public function removeEntry(MenuEntry $toRemove) {
foreach($this->entries as $k => $e) {
if($e === $toRemove) {
array_splice($this->entries, $k, 1);
if($toRemove instanceof DynamicMenuEntry) {
$ndx = array_search($toRemove, $this->dynamicEntries, TRUE);
if($ndx !== FALSE) {
array_spli... | php | public function removeEntry(MenuEntry $toRemove) {
foreach($this->entries as $k => $e) {
if($e === $toRemove) {
array_splice($this->entries, $k, 1);
if($toRemove instanceof DynamicMenuEntry) {
$ndx = array_search($toRemove, $this->dynamicEntries, TRUE);
if($ndx !== FALSE) {
array_spli... | [
"public",
"function",
"removeEntry",
"(",
"MenuEntry",
"$",
"toRemove",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"entries",
"as",
"$",
"k",
"=>",
"$",
"e",
")",
"{",
"if",
"(",
"$",
"e",
"===",
"$",
"toRemove",
")",
"{",
"array_splice",
"(",
"$... | remove a MenuEntry
@param MenuEntry $toRemove
@return Menu | [
"remove",
"a",
"MenuEntry"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Webpage/Menu/Menu.php#L254-L279 | train |
cloudtek/dynamodm | lib/Cloudtek/DynamoDM/Schema/Index/CompositeIndex.php | CompositeIndex.isSecondaryLocal | public function isSecondaryLocal()
{
if (!$this->isSecondary()) {
return false;
}
$hashKey = $this->getHashKey()->getPropertyMetadata()->name;
$hashKeyPrimary = $this->class->getIndex()->getHashKey()->getPropertyMetadata()->name;
return $hashKey === $hash... | php | public function isSecondaryLocal()
{
if (!$this->isSecondary()) {
return false;
}
$hashKey = $this->getHashKey()->getPropertyMetadata()->name;
$hashKeyPrimary = $this->class->getIndex()->getHashKey()->getPropertyMetadata()->name;
return $hashKey === $hash... | [
"public",
"function",
"isSecondaryLocal",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isSecondary",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"hashKey",
"=",
"$",
"this",
"->",
"getHashKey",
"(",
")",
"->",
"getPropertyMetadata",
"("... | Is this a local secondary index?
@return bool | [
"Is",
"this",
"a",
"local",
"secondary",
"index?"
] | 119d355e2c5cbaef1f867970349b4432f5704fcd | https://github.com/cloudtek/dynamodm/blob/119d355e2c5cbaef1f867970349b4432f5704fcd/lib/Cloudtek/DynamoDM/Schema/Index/CompositeIndex.php#L115-L125 | train |
agentmedia/phine-core | src/Core/Logic/Logging/LogEvaluator.php | LogEvaluator.LastPageModLog | static function LastPageModLog(Page $page, Interfaces\IContainerReferenceResolver $resolver)
{
$lastLog = self::LastPageLog($page);
$pageContents = PageContent::Schema()->FetchByPage(false, $page);
foreach ($pageContents as $pageContent)
{
$content = $pageContent->GetCont... | php | static function LastPageModLog(Page $page, Interfaces\IContainerReferenceResolver $resolver)
{
$lastLog = self::LastPageLog($page);
$pageContents = PageContent::Schema()->FetchByPage(false, $page);
foreach ($pageContents as $pageContent)
{
$content = $pageContent->GetCont... | [
"static",
"function",
"LastPageModLog",
"(",
"Page",
"$",
"page",
",",
"Interfaces",
"\\",
"IContainerReferenceResolver",
"$",
"resolver",
")",
"{",
"$",
"lastLog",
"=",
"self",
"::",
"LastPageLog",
"(",
"$",
"page",
")",
";",
"$",
"pageContents",
"=",
"Page... | Gets the last page modification log item
@param Page $page The page
@param Interfaces\IContainerReferenceResolver $resolver
@return LogItem Returns the last log item that changed anything related to the page | [
"Gets",
"the",
"last",
"page",
"modification",
"log",
"item"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Logging/LogEvaluator.php#L34-L53 | train |
agentmedia/phine-core | src/Core/Logic/Logging/LogEvaluator.php | LogEvaluator.LastContainerModLog | static function LastContainerModLog(Container $container)
{
$lastLog = self::LastContainerLog($container);
$containerContents = ContainerContent::Schema()->FetchByContainer(false, $container);
foreach ($containerContents as $containerContent)
{
$content = $containerConten... | php | static function LastContainerModLog(Container $container)
{
$lastLog = self::LastContainerLog($container);
$containerContents = ContainerContent::Schema()->FetchByContainer(false, $container);
foreach ($containerContents as $containerContent)
{
$content = $containerConten... | [
"static",
"function",
"LastContainerModLog",
"(",
"Container",
"$",
"container",
")",
"{",
"$",
"lastLog",
"=",
"self",
"::",
"LastContainerLog",
"(",
"$",
"container",
")",
";",
"$",
"containerContents",
"=",
"ContainerContent",
"::",
"Schema",
"(",
")",
"->"... | Gets the last container modification log item
@param Container $container The container
@return LogItem Returns the last log item that changed anything related to the container | [
"Gets",
"the",
"last",
"container",
"modification",
"log",
"item"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Logging/LogEvaluator.php#L60-L74 | train |
agentmedia/phine-core | src/Core/Logic/Logging/LogEvaluator.php | LogEvaluator.LastLayoutModLog | static function LastLayoutModLog(Layout $layout)
{
$lastLog = $this->LastLayoutLog($layout);
$areas = Area::Schema()->FetchByLayout(false, $layout);
foreach ($areas as $area)
{
$areaLog = self::LastAreaModLog($area);
if (self::IsAfter($areaLog, $lastLog))
... | php | static function LastLayoutModLog(Layout $layout)
{
$lastLog = $this->LastLayoutLog($layout);
$areas = Area::Schema()->FetchByLayout(false, $layout);
foreach ($areas as $area)
{
$areaLog = self::LastAreaModLog($area);
if (self::IsAfter($areaLog, $lastLog))
... | [
"static",
"function",
"LastLayoutModLog",
"(",
"Layout",
"$",
"layout",
")",
"{",
"$",
"lastLog",
"=",
"$",
"this",
"->",
"LastLayoutLog",
"(",
"$",
"layout",
")",
";",
"$",
"areas",
"=",
"Area",
"::",
"Schema",
"(",
")",
"->",
"FetchByLayout",
"(",
"f... | Gets the last layout modification log item
@param Layout $layout The layout
@return LogItem Returns the last log item that changed anything related to the layout | [
"Gets",
"the",
"last",
"layout",
"modification",
"log",
"item"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Logging/LogEvaluator.php#L81-L94 | train |
agentmedia/phine-core | src/Core/Logic/Logging/LogEvaluator.php | LogEvaluator.LastAreaModLog | static function LastAreaModLog(Area $area, Interfaces\IContainerReferenceResolver $resolver)
{
$lastLog = $this->LastAreaLog($area);
$areaContents = LayoutContent::Schema()->FetchByArea(false, $area);
foreach ($areaContents as $areaContent)
{
$content = $areaContent->GetC... | php | static function LastAreaModLog(Area $area, Interfaces\IContainerReferenceResolver $resolver)
{
$lastLog = $this->LastAreaLog($area);
$areaContents = LayoutContent::Schema()->FetchByArea(false, $area);
foreach ($areaContents as $areaContent)
{
$content = $areaContent->GetC... | [
"static",
"function",
"LastAreaModLog",
"(",
"Area",
"$",
"area",
",",
"Interfaces",
"\\",
"IContainerReferenceResolver",
"$",
"resolver",
")",
"{",
"$",
"lastLog",
"=",
"$",
"this",
"->",
"LastAreaLog",
"(",
"$",
"area",
")",
";",
"$",
"areaContents",
"=",
... | Gets the last area modification log item
@param Area $area The area
@return LogItem Returns the last log item that changed anything related to the area | [
"Gets",
"the",
"last",
"area",
"modification",
"log",
"item"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Logging/LogEvaluator.php#L101-L115 | train |
agentmedia/phine-core | src/Core/Logic/Logging/LogEvaluator.php | LogEvaluator.LastContentModLog | function LastContentModLog(Content $content, Interfaces\IContainerReferenceResolver $resolver = null)
{
$lastLog = self::LastContentLog($content);
$container = $resolver ? $resolver->GetReferencedContainer($content) : null;
if ($container)
{
$containerLog = self::LastCont... | php | function LastContentModLog(Content $content, Interfaces\IContainerReferenceResolver $resolver = null)
{
$lastLog = self::LastContentLog($content);
$container = $resolver ? $resolver->GetReferencedContainer($content) : null;
if ($container)
{
$containerLog = self::LastCont... | [
"function",
"LastContentModLog",
"(",
"Content",
"$",
"content",
",",
"Interfaces",
"\\",
"IContainerReferenceResolver",
"$",
"resolver",
"=",
"null",
")",
"{",
"$",
"lastLog",
"=",
"self",
"::",
"LastContentLog",
"(",
"$",
"content",
")",
";",
"$",
"container... | Gets the last content modification log item
@param Content $content The content
@return LogItem Returns the last log item that changed anything related to the content | [
"Gets",
"the",
"last",
"content",
"modification",
"log",
"item"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Logging/LogEvaluator.php#L122-L143 | train |
agentmedia/phine-core | src/Core/Logic/Logging/LogEvaluator.php | LogEvaluator.IsAfter | static function IsAfter(LogItem $lhs = null, LogItem $rhs = null)
{
if (!$lhs)
{
return false;
}
if (!$rhs)
{
return true;
}
return $lhs->GetChanged()->IsAfter($rhs->GetChanged());
} | php | static function IsAfter(LogItem $lhs = null, LogItem $rhs = null)
{
if (!$lhs)
{
return false;
}
if (!$rhs)
{
return true;
}
return $lhs->GetChanged()->IsAfter($rhs->GetChanged());
} | [
"static",
"function",
"IsAfter",
"(",
"LogItem",
"$",
"lhs",
"=",
"null",
",",
"LogItem",
"$",
"rhs",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"lhs",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"!",
"$",
"rhs",
")",
"{",
"return",
"tru... | Compares two log item by date
@param LogItem $lhs The left hand side
@param LogItem $rhs The right hand side
@return boolean Returns trie if right hand side is null and lhs is not, or change date of lhs is after change date of rhs | [
"Compares",
"two",
"log",
"item",
"by",
"date"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Logging/LogEvaluator.php#L151-L162 | train |
agentmedia/phine-core | src/Core/Logic/Logging/LogEvaluator.php | LogEvaluator.LastPageLog | static function LastPageLog(Page $page)
{
$tblLogPage = LogPage::Schema()->Table();
$tblLogItem = LogItem::Schema()->Table();
$sql = Access::SqlBuilder();
$orderBy = $sql->OrderList($sql->OrderDesc($tblLogItem->Field('Changed')));
$joinCond = $sql->Equals($tblLogPage->Field('... | php | static function LastPageLog(Page $page)
{
$tblLogPage = LogPage::Schema()->Table();
$tblLogItem = LogItem::Schema()->Table();
$sql = Access::SqlBuilder();
$orderBy = $sql->OrderList($sql->OrderDesc($tblLogItem->Field('Changed')));
$joinCond = $sql->Equals($tblLogPage->Field('... | [
"static",
"function",
"LastPageLog",
"(",
"Page",
"$",
"page",
")",
"{",
"$",
"tblLogPage",
"=",
"LogPage",
"::",
"Schema",
"(",
")",
"->",
"Table",
"(",
")",
";",
"$",
"tblLogItem",
"=",
"LogItem",
"::",
"Schema",
"(",
")",
"->",
"Table",
"(",
")",
... | The last log item that is directly related to the page
@param Page $page The page
@return LogItem Returns the log item | [
"The",
"last",
"log",
"item",
"that",
"is",
"directly",
"related",
"to",
"the",
"page"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Logic/Logging/LogEvaluator.php#L169-L178 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.