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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
NukaCode/core | src/NukaCode/Core/Http/Controllers/BaseController.php | BaseController.setJavascriptData | protected function setJavascriptData($key, $value = null)
{
if (is_array($key)) {
JavaScriptFacade::put($key);
} else {
JavaScriptFacade::put([$key => $value]);
}
} | php | protected function setJavascriptData($key, $value = null)
{
if (is_array($key)) {
JavaScriptFacade::put($key);
} else {
JavaScriptFacade::put([$key => $value]);
}
} | [
"protected",
"function",
"setJavascriptData",
"(",
"$",
"key",
",",
"$",
"value",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"key",
")",
")",
"{",
"JavaScriptFacade",
"::",
"put",
"(",
"$",
"key",
")",
";",
"}",
"else",
"{",
"JavaScriptF... | Pass data directly to Javascript.
@link https://github.com/laracasts/PHP-Vars-To-Js-Transformer
@param mixed $key
@param mixed $value
@return $this | [
"Pass",
"data",
"directly",
"to",
"Javascript",
"."
] | 75b20903fb068a7df22cdec34ae729279fbaab3c | https://github.com/NukaCode/core/blob/75b20903fb068a7df22cdec34ae729279fbaab3c/src/NukaCode/Core/Http/Controllers/BaseController.php#L75-L82 | train |
ddrv-test/firmapi-core | src/Object/Company.php | Company.actionAdd | protected function actionAdd($params=array())
{
$response = array(
'errors' => array(),
'data' => array(),
);
$values = $this->company->prepareParams($params);
if (empty($values['name'])) {
$response['errors'][] = 'cmp01';
}
... | php | protected function actionAdd($params=array())
{
$response = array(
'errors' => array(),
'data' => array(),
);
$values = $this->company->prepareParams($params);
if (empty($values['name'])) {
$response['errors'][] = 'cmp01';
}
... | [
"protected",
"function",
"actionAdd",
"(",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"$",
"response",
"=",
"array",
"(",
"'errors'",
"=>",
"array",
"(",
")",
",",
"'data'",
"=>",
"array",
"(",
")",
",",
")",
";",
"$",
"values",
"=",
"$",
"... | Add company.
@param array $params
@return array | [
"Add",
"company",
"."
] | 8f8843f0fb134568e7764cabd5039e15c579976d | https://github.com/ddrv-test/firmapi-core/blob/8f8843f0fb134568e7764cabd5039e15c579976d/src/Object/Company.php#L75-L107 | train |
Weblab-nl/restclient | src/RESTClient.php | RESTClient.put | public function put($url, $params, $options = [], $headers = []) {
return $this->update('put', $url, $params, $options, $headers);
} | php | public function put($url, $params, $options = [], $headers = []) {
return $this->update('put', $url, $params, $options, $headers);
} | [
"public",
"function",
"put",
"(",
"$",
"url",
",",
"$",
"params",
",",
"$",
"options",
"=",
"[",
"]",
",",
"$",
"headers",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"update",
"(",
"'put'",
",",
"$",
"url",
",",
"$",
"params",
",",
... | Do a PUT request
@param string $url
@param array $params
@param array $options
@param array $headers
@return mixed
@throws \Exception | [
"Do",
"a",
"PUT",
"request"
] | 6bc4e7890580b7b31e78032e40be5a67122b0dd0 | https://github.com/Weblab-nl/restclient/blob/6bc4e7890580b7b31e78032e40be5a67122b0dd0/src/RESTClient.php#L115-L117 | train |
Weblab-nl/restclient | src/RESTClient.php | RESTClient.update | protected function update($type, $url, $params, $options = [], $headers = []) {
return $this->makeCall($type, $url, $params, $options, $headers);
} | php | protected function update($type, $url, $params, $options = [], $headers = []) {
return $this->makeCall($type, $url, $params, $options, $headers);
} | [
"protected",
"function",
"update",
"(",
"$",
"type",
",",
"$",
"url",
",",
"$",
"params",
",",
"$",
"options",
"=",
"[",
"]",
",",
"$",
"headers",
"=",
"[",
"]",
")",
"{",
"return",
"$",
"this",
"->",
"makeCall",
"(",
"$",
"type",
",",
"$",
"ur... | Proxy function for both edit requests types
@param string $type
@param string $url
@param array $params
@param array $options
@param array $headers
@return mixed
@throws \Exception | [
"Proxy",
"function",
"for",
"both",
"edit",
"requests",
"types"
] | 6bc4e7890580b7b31e78032e40be5a67122b0dd0 | https://github.com/Weblab-nl/restclient/blob/6bc4e7890580b7b31e78032e40be5a67122b0dd0/src/RESTClient.php#L144-L146 | train |
Weblab-nl/restclient | src/RESTClient.php | RESTClient.makeCall | protected function makeCall($type, $url, $params, $options, $headers) {
// Throw exception when adapter is not set
if (!isset($this->adapter)) {
throw new NoAdapterException('No adapter set');
}
// Remove potential leading slashes
if (substr($url, 0, 1) === '/') {
... | php | protected function makeCall($type, $url, $params, $options, $headers) {
// Throw exception when adapter is not set
if (!isset($this->adapter)) {
throw new NoAdapterException('No adapter set');
}
// Remove potential leading slashes
if (substr($url, 0, 1) === '/') {
... | [
"protected",
"function",
"makeCall",
"(",
"$",
"type",
",",
"$",
"url",
",",
"$",
"params",
",",
"$",
"options",
",",
"$",
"headers",
")",
"{",
"// Throw exception when adapter is not set",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"adapter",
")",
... | Calls the adapter which will perform the request
@param string $type
@param string $url
@param array $params
@param array $options
@param array $headers
@return Result
@throws NoAdapterException
@throws \Exception | [
"Calls",
"the",
"adapter",
"which",
"will",
"perform",
"the",
"request"
] | 6bc4e7890580b7b31e78032e40be5a67122b0dd0 | https://github.com/Weblab-nl/restclient/blob/6bc4e7890580b7b31e78032e40be5a67122b0dd0/src/RESTClient.php#L174-L190 | train |
Weblab-nl/restclient | src/RESTClient.php | RESTClient.runResponseHandler | protected function runResponseHandler(Result $result, $type, $url, $params) {
// Check if a status specific handler isset or else fallback to the default
if (isset($this->responseHandlers[$result->getStatus()])) {
$handler = $this->responseHandlers[$result->getStatus()];
} else {
... | php | protected function runResponseHandler(Result $result, $type, $url, $params) {
// Check if a status specific handler isset or else fallback to the default
if (isset($this->responseHandlers[$result->getStatus()])) {
$handler = $this->responseHandlers[$result->getStatus()];
} else {
... | [
"protected",
"function",
"runResponseHandler",
"(",
"Result",
"$",
"result",
",",
"$",
"type",
",",
"$",
"url",
",",
"$",
"params",
")",
"{",
"// Check if a status specific handler isset or else fallback to the default",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
... | Run the correct response handler function
@param Result $result
@param string $type
@param string $url
@param array $params
@return Result
@throws \Exception | [
"Run",
"the",
"correct",
"response",
"handler",
"function"
] | 6bc4e7890580b7b31e78032e40be5a67122b0dd0 | https://github.com/Weblab-nl/restclient/blob/6bc4e7890580b7b31e78032e40be5a67122b0dd0/src/RESTClient.php#L215-L234 | train |
proem-components/service | AssetManager.php | AssetManager.set | public function set($index, AssetInterface $asset)
{
$this->data[$index] = $asset;
$this->provides[] = $asset->is();
return $this;
} | php | public function set($index, AssetInterface $asset)
{
$this->data[$index] = $asset;
$this->provides[] = $asset->is();
return $this;
} | [
"public",
"function",
"set",
"(",
"$",
"index",
",",
"AssetInterface",
"$",
"asset",
")",
"{",
"$",
"this",
"->",
"data",
"[",
"$",
"index",
"]",
"=",
"$",
"asset",
";",
"$",
"this",
"->",
"provides",
"[",
"]",
"=",
"$",
"asset",
"->",
"is",
"(",... | Store an Asset container by named index.
@param string $index The index the asset will be referenced by.
@param Proem\Service\AssetInterface $asset
@return Proem\Service\AssetManagerInterface | [
"Store",
"an",
"Asset",
"container",
"by",
"named",
"index",
"."
] | 8c8e9547f16ecaa2789482f34947618f96e453cc | https://github.com/proem-components/service/blob/8c8e9547f16ecaa2789482f34947618f96e453cc/AssetManager.php#L75-L80 | train |
proem-components/service | AssetManager.php | AssetManager.get | public function get($index, array $params = [], $asAsset = false)
{
if (!$asAsset) {
return isset($this->data[$index]) ? $this->data[$index]->fetch($params, $this) : null;
}
return isset($this->data[$index]) ? $this->data[$index] : null;
} | php | public function get($index, array $params = [], $asAsset = false)
{
if (!$asAsset) {
return isset($this->data[$index]) ? $this->data[$index]->fetch($params, $this) : null;
}
return isset($this->data[$index]) ? $this->data[$index] : null;
} | [
"public",
"function",
"get",
"(",
"$",
"index",
",",
"array",
"$",
"params",
"=",
"[",
"]",
",",
"$",
"asAsset",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"$",
"asAsset",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"data",
"[",
"$",
"ind... | Retrieve an asset.
Returns an instantiated obejct by default or optionaly the
asset container itself.
@param string $index The index the asset is referenced by
@param array $params Allow last minute setting of parameters.
@param bool Wether or not to return the asset's object or container
@return object The object pr... | [
"Retrieve",
"an",
"asset",
"."
] | 8c8e9547f16ecaa2789482f34947618f96e453cc | https://github.com/proem-components/service/blob/8c8e9547f16ecaa2789482f34947618f96e453cc/AssetManager.php#L93-L100 | train |
lassodatasystems/LassoMailParserBundle | Parser.php | Parser.parse | public function parse($mail)
{
// Initial
/** @var Part $mailPart */
$mailPart = $this->workAroundMissingBoundary(
$this->partFactory->getPart($mail),
$mail
);
$partTreeFactory = new PartTreeFactory($this->partFactory);
$partTree = $partTreeFa... | php | public function parse($mail)
{
// Initial
/** @var Part $mailPart */
$mailPart = $this->workAroundMissingBoundary(
$this->partFactory->getPart($mail),
$mail
);
$partTreeFactory = new PartTreeFactory($this->partFactory);
$partTree = $partTreeFa... | [
"public",
"function",
"parse",
"(",
"$",
"mail",
")",
"{",
"// Initial",
"/** @var Part $mailPart */",
"$",
"mailPart",
"=",
"$",
"this",
"->",
"workAroundMissingBoundary",
"(",
"$",
"this",
"->",
"partFactory",
"->",
"getPart",
"(",
"$",
"mail",
")",
",",
"... | Accepts the raw email as a string, including headers and body. Has to be called before the other functions
are available.
@param string $mail
@return ParsedMail | [
"Accepts",
"the",
"raw",
"email",
"as",
"a",
"string",
"including",
"headers",
"and",
"body",
".",
"Has",
"to",
"be",
"called",
"before",
"the",
"other",
"functions",
"are",
"available",
"."
] | c7d2bde3034462fd305e38481cfb737b50eede0a | https://github.com/lassodatasystems/LassoMailParserBundle/blob/c7d2bde3034462fd305e38481cfb737b50eede0a/Parser.php#L57-L88 | train |
lassodatasystems/LassoMailParserBundle | Parser.php | Parser.workAroundMissingBoundary | private function workAroundMissingBoundary(Part $part, $rawMailBody)
{
try {
$part->countParts();
} catch (RuntimeException $e) {
if (count($part->getHeaders()) > 0
&& $part->getHeaders()->has('Content-Type')
&& array_key_exists('boundary', $th... | php | private function workAroundMissingBoundary(Part $part, $rawMailBody)
{
try {
$part->countParts();
} catch (RuntimeException $e) {
if (count($part->getHeaders()) > 0
&& $part->getHeaders()->has('Content-Type')
&& array_key_exists('boundary', $th... | [
"private",
"function",
"workAroundMissingBoundary",
"(",
"Part",
"$",
"part",
",",
"$",
"rawMailBody",
")",
"{",
"try",
"{",
"$",
"part",
"->",
"countParts",
"(",
")",
";",
"}",
"catch",
"(",
"RuntimeException",
"$",
"e",
")",
"{",
"if",
"(",
"count",
... | Some emails are missing a MIME closing boundary. This violations the standard,
but most software still handles it well - except the Zend Framework, who rather
don't want to accommodate broken emails.
Since they don't provide any meaningful way to test if the message was decoded
correctly (like a $part->test() method o... | [
"Some",
"emails",
"are",
"missing",
"a",
"MIME",
"closing",
"boundary",
".",
"This",
"violations",
"the",
"standard",
"but",
"most",
"software",
"still",
"handles",
"it",
"well",
"-",
"except",
"the",
"Zend",
"Framework",
"who",
"rather",
"don",
"t",
"want",... | c7d2bde3034462fd305e38481cfb737b50eede0a | https://github.com/lassodatasystems/LassoMailParserBundle/blob/c7d2bde3034462fd305e38481cfb737b50eede0a/Parser.php#L106-L128 | train |
lassodatasystems/LassoMailParserBundle | Parser.php | Parser.getLoggingEmails | private function getLoggingEmails($mail, $parts)
{
$emailAddresses = $this->flattenEmailAddresses(
$this->getAllEmailAddresses($parts)
);
$messageIds = [];
$headers = $mail->getHeaders();
if (!empty($headers) && $headers->has('message-id')) {
$mess... | php | private function getLoggingEmails($mail, $parts)
{
$emailAddresses = $this->flattenEmailAddresses(
$this->getAllEmailAddresses($parts)
);
$messageIds = [];
$headers = $mail->getHeaders();
if (!empty($headers) && $headers->has('message-id')) {
$mess... | [
"private",
"function",
"getLoggingEmails",
"(",
"$",
"mail",
",",
"$",
"parts",
")",
"{",
"$",
"emailAddresses",
"=",
"$",
"this",
"->",
"flattenEmailAddresses",
"(",
"$",
"this",
"->",
"getAllEmailAddresses",
"(",
"$",
"parts",
")",
")",
";",
"$",
"messag... | Returns a list of all emails in the parser, including
the message id. This is mostly useful for logging.
@param Part $mail
@param Part[] $parts
@return array | [
"Returns",
"a",
"list",
"of",
"all",
"emails",
"in",
"the",
"parser",
"including",
"the",
"message",
"id",
".",
"This",
"is",
"mostly",
"useful",
"for",
"logging",
"."
] | c7d2bde3034462fd305e38481cfb737b50eede0a | https://github.com/lassodatasystems/LassoMailParserBundle/blob/c7d2bde3034462fd305e38481cfb737b50eede0a/Parser.php#L141-L169 | train |
lassodatasystems/LassoMailParserBundle | Parser.php | Parser.flattenEmailAddresses | private function flattenEmailAddresses($emailAddressesByField) {
$flattened = [];
foreach ($emailAddressesByField as $field => $emailAddresses) {
foreach ($emailAddresses as $emailAddress) {
$flattened[] = $emailAddress;
}
}
return array_unique($f... | php | private function flattenEmailAddresses($emailAddressesByField) {
$flattened = [];
foreach ($emailAddressesByField as $field => $emailAddresses) {
foreach ($emailAddresses as $emailAddress) {
$flattened[] = $emailAddress;
}
}
return array_unique($f... | [
"private",
"function",
"flattenEmailAddresses",
"(",
"$",
"emailAddressesByField",
")",
"{",
"$",
"flattened",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"emailAddressesByField",
"as",
"$",
"field",
"=>",
"$",
"emailAddresses",
")",
"{",
"foreach",
"(",
"$",
"... | Takes the hash of email address and the field they were found in and
returns a flattened array of those email addresses.
@param $emailAddressesByField
@return array | [
"Takes",
"the",
"hash",
"of",
"email",
"address",
"and",
"the",
"field",
"they",
"were",
"found",
"in",
"and",
"returns",
"a",
"flattened",
"array",
"of",
"those",
"email",
"addresses",
"."
] | c7d2bde3034462fd305e38481cfb737b50eede0a | https://github.com/lassodatasystems/LassoMailParserBundle/blob/c7d2bde3034462fd305e38481cfb737b50eede0a/Parser.php#L179-L188 | train |
lassodatasystems/LassoMailParserBundle | Parser.php | Parser.getAddressesFromFieldInPart | private function getAddressesFromFieldInPart($field, Part $part)
{
$addresses = [];
$headers = $part->getHeaders();
if (empty($headers)) {
return $addresses;
}
if (!$headers->has($field)) {
return $addresses;
}
/** @var AbstractAddre... | php | private function getAddressesFromFieldInPart($field, Part $part)
{
$addresses = [];
$headers = $part->getHeaders();
if (empty($headers)) {
return $addresses;
}
if (!$headers->has($field)) {
return $addresses;
}
/** @var AbstractAddre... | [
"private",
"function",
"getAddressesFromFieldInPart",
"(",
"$",
"field",
",",
"Part",
"$",
"part",
")",
"{",
"$",
"addresses",
"=",
"[",
"]",
";",
"$",
"headers",
"=",
"$",
"part",
"->",
"getHeaders",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"hea... | Retrieves the addresses from a specific field in a part
@param string $field
@param Part $part
@return array | [
"Retrieves",
"the",
"addresses",
"from",
"a",
"specific",
"field",
"in",
"a",
"part"
] | c7d2bde3034462fd305e38481cfb737b50eede0a | https://github.com/lassodatasystems/LassoMailParserBundle/blob/c7d2bde3034462fd305e38481cfb737b50eede0a/Parser.php#L223-L254 | train |
fridge-project/dbal | src/Fridge/DBAL/SchemaManager/SQLCollector/AlterTableSQLCollector.php | AlterTableSQLCollector.init | public function init()
{
$this->renameTableQueries = array();
$this->dropCheckQueries = array();
$this->dropForeignKeyQueries = array();
$this->dropIndexQueries = array();
$this->dropPrimaryKeyQueries = array();
$this->dropColumnQueries = array();
$this->alter... | php | public function init()
{
$this->renameTableQueries = array();
$this->dropCheckQueries = array();
$this->dropForeignKeyQueries = array();
$this->dropIndexQueries = array();
$this->dropPrimaryKeyQueries = array();
$this->dropColumnQueries = array();
$this->alter... | [
"public",
"function",
"init",
"(",
")",
"{",
"$",
"this",
"->",
"renameTableQueries",
"=",
"array",
"(",
")",
";",
"$",
"this",
"->",
"dropCheckQueries",
"=",
"array",
"(",
")",
";",
"$",
"this",
"->",
"dropForeignKeyQueries",
"=",
"array",
"(",
")",
"... | Reinitilizes SQL collector. | [
"Reinitilizes",
"SQL",
"collector",
"."
] | d0b8c3551922d696836487aa0eb1bd74014edcd4 | https://github.com/fridge-project/dbal/blob/d0b8c3551922d696836487aa0eb1bd74014edcd4/src/Fridge/DBAL/SchemaManager/SQLCollector/AlterTableSQLCollector.php#L112-L126 | train |
fridge-project/dbal | src/Fridge/DBAL/SchemaManager/SQLCollector/AlterTableSQLCollector.php | AlterTableSQLCollector.collect | public function collect(TableDiff $tableDiff)
{
if ($tableDiff->getOldAsset()->getName() !== $tableDiff->getNewAsset()->getName()) {
$this->renameTableQueries = array_merge(
$this->renameTableQueries,
$this->platform->getRenameTableSQLQueries($tableDiff)
... | php | public function collect(TableDiff $tableDiff)
{
if ($tableDiff->getOldAsset()->getName() !== $tableDiff->getNewAsset()->getName()) {
$this->renameTableQueries = array_merge(
$this->renameTableQueries,
$this->platform->getRenameTableSQLQueries($tableDiff)
... | [
"public",
"function",
"collect",
"(",
"TableDiff",
"$",
"tableDiff",
")",
"{",
"if",
"(",
"$",
"tableDiff",
"->",
"getOldAsset",
"(",
")",
"->",
"getName",
"(",
")",
"!==",
"$",
"tableDiff",
"->",
"getNewAsset",
"(",
")",
"->",
"getName",
"(",
")",
")"... | Collects queries to alter tables.
@param \Fridge\DBAL\Schema\Diff\TableDiff $tableDiff The table difference. | [
"Collects",
"queries",
"to",
"alter",
"tables",
"."
] | d0b8c3551922d696836487aa0eb1bd74014edcd4 | https://github.com/fridge-project/dbal/blob/d0b8c3551922d696836487aa0eb1bd74014edcd4/src/Fridge/DBAL/SchemaManager/SQLCollector/AlterTableSQLCollector.php#L133-L147 | train |
fridge-project/dbal | src/Fridge/DBAL/SchemaManager/SQLCollector/AlterTableSQLCollector.php | AlterTableSQLCollector.getQueries | public function getQueries()
{
return array_merge(
$this->getRenameTableQueries(),
$this->getDropCheckQueries(),
$this->getDropForeignKeyQueries(),
$this->getDropIndexQueries(),
$this->getDropPrimaryKeyQueries(),
$this->getDropColumnQue... | php | public function getQueries()
{
return array_merge(
$this->getRenameTableQueries(),
$this->getDropCheckQueries(),
$this->getDropForeignKeyQueries(),
$this->getDropIndexQueries(),
$this->getDropPrimaryKeyQueries(),
$this->getDropColumnQue... | [
"public",
"function",
"getQueries",
"(",
")",
"{",
"return",
"array_merge",
"(",
"$",
"this",
"->",
"getRenameTableQueries",
"(",
")",
",",
"$",
"this",
"->",
"getDropCheckQueries",
"(",
")",
",",
"$",
"this",
"->",
"getDropForeignKeyQueries",
"(",
")",
",",... | Gets the queries collected to alter the table.
@return array The queries collected to alter the table. | [
"Gets",
"the",
"queries",
"collected",
"to",
"alter",
"the",
"table",
"."
] | d0b8c3551922d696836487aa0eb1bd74014edcd4 | https://github.com/fridge-project/dbal/blob/d0b8c3551922d696836487aa0eb1bd74014edcd4/src/Fridge/DBAL/SchemaManager/SQLCollector/AlterTableSQLCollector.php#L274-L290 | train |
fridge-project/dbal | src/Fridge/DBAL/SchemaManager/SQLCollector/AlterTableSQLCollector.php | AlterTableSQLCollector.collectColumns | private function collectColumns(TableDiff $tableDiff)
{
foreach ($tableDiff->getCreatedColumns() as $column) {
$this->createColumnQueries = array_merge(
$this->createColumnQueries,
$this->platform->getCreateColumnSQLQueries($column, $tableDiff->getNewAsset()->getN... | php | private function collectColumns(TableDiff $tableDiff)
{
foreach ($tableDiff->getCreatedColumns() as $column) {
$this->createColumnQueries = array_merge(
$this->createColumnQueries,
$this->platform->getCreateColumnSQLQueries($column, $tableDiff->getNewAsset()->getN... | [
"private",
"function",
"collectColumns",
"(",
"TableDiff",
"$",
"tableDiff",
")",
"{",
"foreach",
"(",
"$",
"tableDiff",
"->",
"getCreatedColumns",
"(",
")",
"as",
"$",
"column",
")",
"{",
"$",
"this",
"->",
"createColumnQueries",
"=",
"array_merge",
"(",
"$... | Collects queries about column to alter a table.
@param \Fridge\DBAL\Schema\Diff\TableDiff $tableDiff The table difference. | [
"Collects",
"queries",
"about",
"column",
"to",
"alter",
"a",
"table",
"."
] | d0b8c3551922d696836487aa0eb1bd74014edcd4 | https://github.com/fridge-project/dbal/blob/d0b8c3551922d696836487aa0eb1bd74014edcd4/src/Fridge/DBAL/SchemaManager/SQLCollector/AlterTableSQLCollector.php#L297-L319 | train |
fridge-project/dbal | src/Fridge/DBAL/SchemaManager/SQLCollector/AlterTableSQLCollector.php | AlterTableSQLCollector.collectPrimaryKeys | private function collectPrimaryKeys(TableDiff $tableDiff)
{
if ($tableDiff->getCreatedPrimaryKey() !== null) {
$this->createPrimaryKeyQueries = array_merge(
$this->createPrimaryKeyQueries,
$this->platform->getCreatePrimaryKeySQLQueries(
$tableD... | php | private function collectPrimaryKeys(TableDiff $tableDiff)
{
if ($tableDiff->getCreatedPrimaryKey() !== null) {
$this->createPrimaryKeyQueries = array_merge(
$this->createPrimaryKeyQueries,
$this->platform->getCreatePrimaryKeySQLQueries(
$tableD... | [
"private",
"function",
"collectPrimaryKeys",
"(",
"TableDiff",
"$",
"tableDiff",
")",
"{",
"if",
"(",
"$",
"tableDiff",
"->",
"getCreatedPrimaryKey",
"(",
")",
"!==",
"null",
")",
"{",
"$",
"this",
"->",
"createPrimaryKeyQueries",
"=",
"array_merge",
"(",
"$",... | Collect queries about primary keys to alter a table.
@param \Fridge\DBAL\Schema\Diff\TableDiff $tableDiff The table difference. | [
"Collect",
"queries",
"about",
"primary",
"keys",
"to",
"alter",
"a",
"table",
"."
] | d0b8c3551922d696836487aa0eb1bd74014edcd4 | https://github.com/fridge-project/dbal/blob/d0b8c3551922d696836487aa0eb1bd74014edcd4/src/Fridge/DBAL/SchemaManager/SQLCollector/AlterTableSQLCollector.php#L326-L347 | train |
fridge-project/dbal | src/Fridge/DBAL/SchemaManager/SQLCollector/AlterTableSQLCollector.php | AlterTableSQLCollector.collectForeignKeys | private function collectForeignKeys(TableDiff $tableDiff)
{
foreach ($tableDiff->getCreatedForeignKeys() as $foreignKey) {
$this->createForeignKeyQueries = array_merge(
$this->createForeignKeyQueries,
$this->platform->getCreateForeignKeySQLQueries($foreignKey, $ta... | php | private function collectForeignKeys(TableDiff $tableDiff)
{
foreach ($tableDiff->getCreatedForeignKeys() as $foreignKey) {
$this->createForeignKeyQueries = array_merge(
$this->createForeignKeyQueries,
$this->platform->getCreateForeignKeySQLQueries($foreignKey, $ta... | [
"private",
"function",
"collectForeignKeys",
"(",
"TableDiff",
"$",
"tableDiff",
")",
"{",
"foreach",
"(",
"$",
"tableDiff",
"->",
"getCreatedForeignKeys",
"(",
")",
"as",
"$",
"foreignKey",
")",
"{",
"$",
"this",
"->",
"createForeignKeyQueries",
"=",
"array_mer... | Collects queries about foreign keys to alter a table.
@param \Fridge\DBAL\Schema\Diff\TableDiff $tableDiff The table difference. | [
"Collects",
"queries",
"about",
"foreign",
"keys",
"to",
"alter",
"a",
"table",
"."
] | d0b8c3551922d696836487aa0eb1bd74014edcd4 | https://github.com/fridge-project/dbal/blob/d0b8c3551922d696836487aa0eb1bd74014edcd4/src/Fridge/DBAL/SchemaManager/SQLCollector/AlterTableSQLCollector.php#L354-L369 | train |
fridge-project/dbal | src/Fridge/DBAL/SchemaManager/SQLCollector/AlterTableSQLCollector.php | AlterTableSQLCollector.collectIndexes | private function collectIndexes(TableDiff $tableDiff)
{
foreach ($tableDiff->getCreatedIndexes() as $index) {
$this->createIndexQueries = array_merge(
$this->createIndexQueries,
$this->platform->getCreateIndexSQLQueries($index, $tableDiff->getNewAsset()->getName()... | php | private function collectIndexes(TableDiff $tableDiff)
{
foreach ($tableDiff->getCreatedIndexes() as $index) {
$this->createIndexQueries = array_merge(
$this->createIndexQueries,
$this->platform->getCreateIndexSQLQueries($index, $tableDiff->getNewAsset()->getName()... | [
"private",
"function",
"collectIndexes",
"(",
"TableDiff",
"$",
"tableDiff",
")",
"{",
"foreach",
"(",
"$",
"tableDiff",
"->",
"getCreatedIndexes",
"(",
")",
"as",
"$",
"index",
")",
"{",
"$",
"this",
"->",
"createIndexQueries",
"=",
"array_merge",
"(",
"$",... | Collects queries about indexes to alter a table.
@param \Fridge\DBAL\Schema\Diff\TableDiff $tableDiff The table difference. | [
"Collects",
"queries",
"about",
"indexes",
"to",
"alter",
"a",
"table",
"."
] | d0b8c3551922d696836487aa0eb1bd74014edcd4 | https://github.com/fridge-project/dbal/blob/d0b8c3551922d696836487aa0eb1bd74014edcd4/src/Fridge/DBAL/SchemaManager/SQLCollector/AlterTableSQLCollector.php#L376-L391 | train |
fridge-project/dbal | src/Fridge/DBAL/SchemaManager/SQLCollector/AlterTableSQLCollector.php | AlterTableSQLCollector.collectChecks | private function collectChecks(TableDiff $tableDiff)
{
foreach ($tableDiff->getCreatedChecks() as $check) {
$this->createCheckQueries = array_merge(
$this->createCheckQueries,
$this->platform->getCreateCheckSQLQueries($check, $tableDiff->getNewAsset()->getName())
... | php | private function collectChecks(TableDiff $tableDiff)
{
foreach ($tableDiff->getCreatedChecks() as $check) {
$this->createCheckQueries = array_merge(
$this->createCheckQueries,
$this->platform->getCreateCheckSQLQueries($check, $tableDiff->getNewAsset()->getName())
... | [
"private",
"function",
"collectChecks",
"(",
"TableDiff",
"$",
"tableDiff",
")",
"{",
"foreach",
"(",
"$",
"tableDiff",
"->",
"getCreatedChecks",
"(",
")",
"as",
"$",
"check",
")",
"{",
"$",
"this",
"->",
"createCheckQueries",
"=",
"array_merge",
"(",
"$",
... | Collects queries about checks to alter a table.
@param \Fridge\DBAL\Schema\Diff\TableDiff $tableDiff The table difference. | [
"Collects",
"queries",
"about",
"checks",
"to",
"alter",
"a",
"table",
"."
] | d0b8c3551922d696836487aa0eb1bd74014edcd4 | https://github.com/fridge-project/dbal/blob/d0b8c3551922d696836487aa0eb1bd74014edcd4/src/Fridge/DBAL/SchemaManager/SQLCollector/AlterTableSQLCollector.php#L398-L413 | train |
SlaxWeb/Hooks | src/Factory.php | Factory.init | public static function init(Config $config): Container
{
$logger = Logger::init($config);
return new Container($logger);
} | php | public static function init(Config $config): Container
{
$logger = Logger::init($config);
return new Container($logger);
} | [
"public",
"static",
"function",
"init",
"(",
"Config",
"$",
"config",
")",
":",
"Container",
"{",
"$",
"logger",
"=",
"Logger",
"::",
"init",
"(",
"$",
"config",
")",
";",
"return",
"new",
"Container",
"(",
"$",
"logger",
")",
";",
"}"
] | Initiate Hooks Container
Init the logger through its own factory and create an object of the Hooks
container, and return it to the caller. For this the configuration
component is required, so the logger can be instantiated.
@param \SlaxWeb\Config\Container $config Configuration component
@return \SlaxWeb\Hooks\Contai... | [
"Initiate",
"Hooks",
"Container"
] | 678f4d5425c27e0dd2a61b68d59bfb2793955b91 | https://github.com/SlaxWeb/Hooks/blob/678f4d5425c27e0dd2a61b68d59bfb2793955b91/src/Factory.php#L32-L36 | train |
horntell/php-sdk | lib/guzzle/GuzzleHttp/Event/RequestEvents.php | RequestEvents.emitBefore | public static function emitBefore(TransactionInterface $transaction)
{
$request = $transaction->getRequest();
try {
$request->getEmitter()->emit(
'before',
new BeforeEvent($transaction)
);
} catch (RequestException $e) {
// ... | php | public static function emitBefore(TransactionInterface $transaction)
{
$request = $transaction->getRequest();
try {
$request->getEmitter()->emit(
'before',
new BeforeEvent($transaction)
);
} catch (RequestException $e) {
// ... | [
"public",
"static",
"function",
"emitBefore",
"(",
"TransactionInterface",
"$",
"transaction",
")",
"{",
"$",
"request",
"=",
"$",
"transaction",
"->",
"getRequest",
"(",
")",
";",
"try",
"{",
"$",
"request",
"->",
"getEmitter",
"(",
")",
"->",
"emit",
"("... | Emits the before send event for a request and emits an error
event if an error is encountered during the before send.
@param TransactionInterface $transaction
@throws RequestException | [
"Emits",
"the",
"before",
"send",
"event",
"for",
"a",
"request",
"and",
"emits",
"an",
"error",
"event",
"if",
"an",
"error",
"is",
"encountered",
"during",
"the",
"before",
"send",
"."
] | e5205e9396a21b754d5651a8aa5898da5922a1b7 | https://github.com/horntell/php-sdk/blob/e5205e9396a21b754d5651a8aa5898da5922a1b7/lib/guzzle/GuzzleHttp/Event/RequestEvents.php#L33-L55 | train |
horntell/php-sdk | lib/guzzle/GuzzleHttp/Event/RequestEvents.php | RequestEvents.emitComplete | public static function emitComplete(
TransactionInterface $transaction,
array $stats = []
) {
$request = $transaction->getRequest();
$transaction->getResponse()->setEffectiveUrl($request->getUrl());
try {
$request->getEmitter()->emit(
'complete',
... | php | public static function emitComplete(
TransactionInterface $transaction,
array $stats = []
) {
$request = $transaction->getRequest();
$transaction->getResponse()->setEffectiveUrl($request->getUrl());
try {
$request->getEmitter()->emit(
'complete',
... | [
"public",
"static",
"function",
"emitComplete",
"(",
"TransactionInterface",
"$",
"transaction",
",",
"array",
"$",
"stats",
"=",
"[",
"]",
")",
"{",
"$",
"request",
"=",
"$",
"transaction",
"->",
"getRequest",
"(",
")",
";",
"$",
"transaction",
"->",
"get... | Emits the complete event for a request and emits an error
event if an error is encountered during the after send.
@param TransactionInterface $transaction Transaction to emit for
@param array $stats Transfer stats
@throws RequestException | [
"Emits",
"the",
"complete",
"event",
"for",
"a",
"request",
"and",
"emits",
"an",
"error",
"event",
"if",
"an",
"error",
"is",
"encountered",
"during",
"the",
"after",
"send",
"."
] | e5205e9396a21b754d5651a8aa5898da5922a1b7 | https://github.com/horntell/php-sdk/blob/e5205e9396a21b754d5651a8aa5898da5922a1b7/lib/guzzle/GuzzleHttp/Event/RequestEvents.php#L66-L80 | train |
horntell/php-sdk | lib/guzzle/GuzzleHttp/Event/RequestEvents.php | RequestEvents.emitError | public static function emitError(
TransactionInterface $transaction,
\Exception $e,
array $stats = []
) {
$request = $transaction->getRequest();
// Convert non-request exception to a wrapped exception
if (!($e instanceof RequestException)) {
$e = new Requ... | php | public static function emitError(
TransactionInterface $transaction,
\Exception $e,
array $stats = []
) {
$request = $transaction->getRequest();
// Convert non-request exception to a wrapped exception
if (!($e instanceof RequestException)) {
$e = new Requ... | [
"public",
"static",
"function",
"emitError",
"(",
"TransactionInterface",
"$",
"transaction",
",",
"\\",
"Exception",
"$",
"e",
",",
"array",
"$",
"stats",
"=",
"[",
"]",
")",
"{",
"$",
"request",
"=",
"$",
"transaction",
"->",
"getRequest",
"(",
")",
";... | Emits an error event for a request and accounts for the propagation
of an error event being stopped to prevent the exception from being
thrown.
@param TransactionInterface $transaction
@param \Exception $e
@param array $stats
@throws \GuzzleHttp\Exception\RequestException | [
"Emits",
"an",
"error",
"event",
"for",
"a",
"request",
"and",
"accounts",
"for",
"the",
"propagation",
"of",
"an",
"error",
"event",
"being",
"stopped",
"to",
"prevent",
"the",
"exception",
"from",
"being",
"thrown",
"."
] | e5205e9396a21b754d5651a8aa5898da5922a1b7 | https://github.com/horntell/php-sdk/blob/e5205e9396a21b754d5651a8aa5898da5922a1b7/lib/guzzle/GuzzleHttp/Event/RequestEvents.php#L106-L130 | train |
horntell/php-sdk | lib/guzzle/GuzzleHttp/Event/RequestEvents.php | RequestEvents.convertEventArray | public static function convertEventArray(
array $options,
array $events,
$handler
) {
foreach ($events as $name) {
if (!isset($options[$name])) {
$options[$name] = [$handler];
} elseif (is_callable($options[$name])) {
$options[$... | php | public static function convertEventArray(
array $options,
array $events,
$handler
) {
foreach ($events as $name) {
if (!isset($options[$name])) {
$options[$name] = [$handler];
} elseif (is_callable($options[$name])) {
$options[$... | [
"public",
"static",
"function",
"convertEventArray",
"(",
"array",
"$",
"options",
",",
"array",
"$",
"events",
",",
"$",
"handler",
")",
"{",
"foreach",
"(",
"$",
"events",
"as",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"options",
"... | Converts an array of event options into a formatted array of valid event
configuration.
@param array $options Event array to convert
@param array $events Event names to convert in the options array.
@param mixed $handler Event handler to utilize
@return array
@throws \InvalidArgumentException if the event config is ... | [
"Converts",
"an",
"array",
"of",
"event",
"options",
"into",
"a",
"formatted",
"array",
"of",
"valid",
"event",
"configuration",
"."
] | e5205e9396a21b754d5651a8aa5898da5922a1b7 | https://github.com/horntell/php-sdk/blob/e5205e9396a21b754d5651a8aa5898da5922a1b7/lib/guzzle/GuzzleHttp/Event/RequestEvents.php#L144-L166 | train |
Raphhh/puppy-application | src/Controller/FrontController.php | FrontController.addController | public function addController($uriPattern, callable $controller, $method='', $contentType='')
{
$routeBuilder = new RouteBuilder();
$routeBuilder
->addUriPattern($uriPattern)
->addController($controller, $this->getAppController())
->addMethod($method)
... | php | public function addController($uriPattern, callable $controller, $method='', $contentType='')
{
$routeBuilder = new RouteBuilder();
$routeBuilder
->addUriPattern($uriPattern)
->addController($controller, $this->getAppController())
->addMethod($method)
... | [
"public",
"function",
"addController",
"(",
"$",
"uriPattern",
",",
"callable",
"$",
"controller",
",",
"$",
"method",
"=",
"''",
",",
"$",
"contentType",
"=",
"''",
")",
"{",
"$",
"routeBuilder",
"=",
"new",
"RouteBuilder",
"(",
")",
";",
"$",
"routeBui... | Adds a controller to the list of observed controllers.
@param string $uriPattern
@param callable $controller
@param string $method
@param string $contentType
@return \Puppy\Route\Route | [
"Adds",
"a",
"controller",
"to",
"the",
"list",
"of",
"observed",
"controllers",
"."
] | 9291543cd28e19a2986abd7fb146898ca5f5f5da | https://github.com/Raphhh/puppy-application/blob/9291543cd28e19a2986abd7fb146898ca5f5f5da/src/Controller/FrontController.php#L44-L56 | train |
Raphhh/puppy-application | src/Controller/FrontController.php | FrontController.call | public function call(Request $request)
{
if($request !== $this->getRequestStack()->getCurrentRequest()){
$this->getRequestStack()->push($request);
}
if(!$request->getRequestFormat(null) && $request->getAcceptableContentTypes()){
$request->setRequestFormat($request->g... | php | public function call(Request $request)
{
if($request !== $this->getRequestStack()->getCurrentRequest()){
$this->getRequestStack()->push($request);
}
if(!$request->getRequestFormat(null) && $request->getAcceptableContentTypes()){
$request->setRequestFormat($request->g... | [
"public",
"function",
"call",
"(",
"Request",
"$",
"request",
")",
"{",
"if",
"(",
"$",
"request",
"!==",
"$",
"this",
"->",
"getRequestStack",
"(",
")",
"->",
"getCurrentRequest",
"(",
")",
")",
"{",
"$",
"this",
"->",
"getRequestStack",
"(",
")",
"->... | Calls the controller matched with the request uri.
@param Request $request
@return Response | [
"Calls",
"the",
"controller",
"matched",
"with",
"the",
"request",
"uri",
"."
] | 9291543cd28e19a2986abd7fb146898ca5f5f5da | https://github.com/Raphhh/puppy-application/blob/9291543cd28e19a2986abd7fb146898ca5f5f5da/src/Controller/FrontController.php#L64-L82 | train |
ValkSystems/bootbuilder | src/bootbuilder/Controls/TextArea.php | TextArea.renderBasic | public function renderBasic() {
$html = "<textarea rows='$this->rows'";
$html .= " " . $this->getCompiledAttributes("form-control");
$html .= ">";
$html .= $this->value;
$html .= "</textarea>";
return $html;
} | php | public function renderBasic() {
$html = "<textarea rows='$this->rows'";
$html .= " " . $this->getCompiledAttributes("form-control");
$html .= ">";
$html .= $this->value;
$html .= "</textarea>";
return $html;
} | [
"public",
"function",
"renderBasic",
"(",
")",
"{",
"$",
"html",
"=",
"\"<textarea rows='$this->rows'\"",
";",
"$",
"html",
".=",
"\" \"",
".",
"$",
"this",
"->",
"getCompiledAttributes",
"(",
"\"form-control\"",
")",
";",
"$",
"html",
".=",
"\">\"",
";",
"$... | Render basics of textarea | [
"Render",
"basics",
"of",
"textarea"
] | 7601a403f42eba47ce4cf02a3c852d5196b1d860 | https://github.com/ValkSystems/bootbuilder/blob/7601a403f42eba47ce4cf02a3c852d5196b1d860/src/bootbuilder/Controls/TextArea.php#L26-L33 | train |
SlaxWeb/Router | src/Response.php | Response.addContent | public function addContent(string $content): \Symfony\Component\HttpFoundation\Response
{
return $this->setContent($this->getContent() . $content);
} | php | public function addContent(string $content): \Symfony\Component\HttpFoundation\Response
{
return $this->setContent($this->getContent() . $content);
} | [
"public",
"function",
"addContent",
"(",
"string",
"$",
"content",
")",
":",
"\\",
"Symfony",
"\\",
"Component",
"\\",
"HttpFoundation",
"\\",
"Response",
"{",
"return",
"$",
"this",
"->",
"setContent",
"(",
"$",
"this",
"->",
"getContent",
"(",
")",
".",
... | Add To Content
Add retrieved input to the end of already existing content in the
Response object.
@param string $content Content to be added.
@return \Symfony\Component\HttpFoundation\Response | [
"Add",
"To",
"Content"
] | b4a25655710638c71787a8498d267a663ef2e819 | https://github.com/SlaxWeb/Router/blob/b4a25655710638c71787a8498d267a663ef2e819/src/Response.php#L39-L42 | train |
nicolasdewez/webhome-common | Client/AbstractClient.php | AbstractClient.deserialize | protected function deserialize(ResponseInterface $response, $type, $format = 'json')
{
try {
return $this->serializer->deserialize(
(string) $response->getBody(),
$type,
$format
);
} catch (\Exception $exception) {
$... | php | protected function deserialize(ResponseInterface $response, $type, $format = 'json')
{
try {
return $this->serializer->deserialize(
(string) $response->getBody(),
$type,
$format
);
} catch (\Exception $exception) {
$... | [
"protected",
"function",
"deserialize",
"(",
"ResponseInterface",
"$",
"response",
",",
"$",
"type",
",",
"$",
"format",
"=",
"'json'",
")",
"{",
"try",
"{",
"return",
"$",
"this",
"->",
"serializer",
"->",
"deserialize",
"(",
"(",
"string",
")",
"$",
"r... | Deserializes request content.
@param ResponseInterface $response
@param string $type
@param string $format
@return mixed
@throws \Exception | [
"Deserializes",
"request",
"content",
"."
] | a9f6f83fa929ebd0510818c388cfb1ed44b87205 | https://github.com/nicolasdewez/webhome-common/blob/a9f6f83fa929ebd0510818c388cfb1ed44b87205/Client/AbstractClient.php#L95-L114 | train |
Subscribo/psr-http-message-tools | src/Factories/RequestFactory.php | RequestFactory.make | public static function make($uri, $data = null, array $queryParameters = [], array $headers = [], $method = null, $contentType = null, $contentCharset = null)
{
if (is_null($method)) {
$method = is_null($data) ? static::METHOD_GET : static::METHOD_POST;
}
$uri = UriFactory::make(... | php | public static function make($uri, $data = null, array $queryParameters = [], array $headers = [], $method = null, $contentType = null, $contentCharset = null)
{
if (is_null($method)) {
$method = is_null($data) ? static::METHOD_GET : static::METHOD_POST;
}
$uri = UriFactory::make(... | [
"public",
"static",
"function",
"make",
"(",
"$",
"uri",
",",
"$",
"data",
"=",
"null",
",",
"array",
"$",
"queryParameters",
"=",
"[",
"]",
",",
"array",
"$",
"headers",
"=",
"[",
"]",
",",
"$",
"method",
"=",
"null",
",",
"$",
"contentType",
"=",... | Makes PSR-7 compliant Request object from provided parameters
@param UriInterface|string $uri
@param null|string|array $data
@param array $queryParameters
@param array $headers
@param null|string $method
@param null|string $contentType
@param null|string $contentCharset
@return RequestInterface
@throws InvalidArgument... | [
"Makes",
"PSR",
"-",
"7",
"compliant",
"Request",
"object",
"from",
"provided",
"parameters"
] | b1dfa0b1dd646f353634b5c9603fd6c75a7b73bd | https://github.com/Subscribo/psr-http-message-tools/blob/b1dfa0b1dd646f353634b5c9603fd6c75a7b73bd/src/Factories/RequestFactory.php#L40-L71 | train |
Subscribo/psr-http-message-tools | src/Factories/RequestFactory.php | RequestFactory.extractCharset | private static function extractCharset(array $contentTypeParts)
{
foreach ($contentTypeParts as $part) {
$elements = explode('=', $part);
$key = trim(array_shift($elements));
if (strtolower($key) === 'charset') {
$value = trim(reset($elements));
... | php | private static function extractCharset(array $contentTypeParts)
{
foreach ($contentTypeParts as $part) {
$elements = explode('=', $part);
$key = trim(array_shift($elements));
if (strtolower($key) === 'charset') {
$value = trim(reset($elements));
... | [
"private",
"static",
"function",
"extractCharset",
"(",
"array",
"$",
"contentTypeParts",
")",
"{",
"foreach",
"(",
"$",
"contentTypeParts",
"as",
"$",
"part",
")",
"{",
"$",
"elements",
"=",
"explode",
"(",
"'='",
",",
"$",
"part",
")",
";",
"$",
"key",... | Tries to extract charset from pre-parsed part of Content-Type value
@param array $contentTypeParts
@return null|string | [
"Tries",
"to",
"extract",
"charset",
"from",
"pre",
"-",
"parsed",
"part",
"of",
"Content",
"-",
"Type",
"value"
] | b1dfa0b1dd646f353634b5c9603fd6c75a7b73bd | https://github.com/Subscribo/psr-http-message-tools/blob/b1dfa0b1dd646f353634b5c9603fd6c75a7b73bd/src/Factories/RequestFactory.php#L100-L111 | train |
gmazzap/HooksMock | src/HooksMock.php | HooksMock.hasAction | public static function hasAction($hook = '', callable $callback = null, $priority = null)
{
return static::hasHook('action', $hook, $callback, $priority);
} | php | public static function hasAction($hook = '', callable $callback = null, $priority = null)
{
return static::hasHook('action', $hook, $callback, $priority);
} | [
"public",
"static",
"function",
"hasAction",
"(",
"$",
"hook",
"=",
"''",
",",
"callable",
"$",
"callback",
"=",
"null",
",",
"$",
"priority",
"=",
"null",
")",
"{",
"return",
"static",
"::",
"hasHook",
"(",
"'action'",
",",
"$",
"hook",
",",
"$",
"c... | Check if an action hook is added. Optionally check a specific callback and and priority.
@param string $hook Hook to check
@param callable $callback Callback to check
@param int $priority Priority to check
@return boolean | [
"Check",
"if",
"an",
"action",
"hook",
"is",
"added",
".",
"Optionally",
"check",
"a",
"specific",
"callback",
"and",
"and",
"priority",
"."
] | b34b5819b96876f23daea9b7fde1b58925da6eab | https://github.com/gmazzap/HooksMock/blob/b34b5819b96876f23daea9b7fde1b58925da6eab/src/HooksMock.php#L159-L162 | train |
gmazzap/HooksMock | src/HooksMock.php | HooksMock.hasFilter | public static function hasFilter($hook = '', callable $callback = null, $priority = null)
{
return static::hasHook('filter', $hook, $callback, $priority);
} | php | public static function hasFilter($hook = '', callable $callback = null, $priority = null)
{
return static::hasHook('filter', $hook, $callback, $priority);
} | [
"public",
"static",
"function",
"hasFilter",
"(",
"$",
"hook",
"=",
"''",
",",
"callable",
"$",
"callback",
"=",
"null",
",",
"$",
"priority",
"=",
"null",
")",
"{",
"return",
"static",
"::",
"hasHook",
"(",
"'filter'",
",",
"$",
"hook",
",",
"$",
"c... | Check if an filter hook is added. Optionally check a specific callback and and priority.
@param string $hook Hook to check
@param callable $callback Callback to check
@param int $priority Priority to check
@return boolean | [
"Check",
"if",
"an",
"filter",
"hook",
"is",
"added",
".",
"Optionally",
"check",
"a",
"specific",
"callback",
"and",
"and",
"priority",
"."
] | b34b5819b96876f23daea9b7fde1b58925da6eab | https://github.com/gmazzap/HooksMock/blob/b34b5819b96876f23daea9b7fde1b58925da6eab/src/HooksMock.php#L172-L175 | train |
gmazzap/HooksMock | src/HooksMock.php | HooksMock.hasHookFired | public static function hasHookFired($type = 'action', $hook = null)
{
if (! in_array($type, ['action', 'filter'], true)) {
$type = 'action';
}
$target = $type === 'filter' ? 'filters' : 'actions';
if (empty($hook) || ! is_string($hook)) {
$msg = __METHOD__.' n... | php | public static function hasHookFired($type = 'action', $hook = null)
{
if (! in_array($type, ['action', 'filter'], true)) {
$type = 'action';
}
$target = $type === 'filter' ? 'filters' : 'actions';
if (empty($hook) || ! is_string($hook)) {
$msg = __METHOD__.' n... | [
"public",
"static",
"function",
"hasHookFired",
"(",
"$",
"type",
"=",
"'action'",
",",
"$",
"hook",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"type",
",",
"[",
"'action'",
",",
"'filter'",
"]",
",",
"true",
")",
")",
"{",
"$",
... | Check if an hook is was fired.
@param string $type Type of hook, 'action' or 'filter'
@param string $hook Filter hook to check
@return boolean | [
"Check",
"if",
"an",
"hook",
"is",
"was",
"fired",
"."
] | b34b5819b96876f23daea9b7fde1b58925da6eab | https://github.com/gmazzap/HooksMock/blob/b34b5819b96876f23daea9b7fde1b58925da6eab/src/HooksMock.php#L184-L196 | train |
gmazzap/HooksMock | src/HooksMock.php | HooksMock.assertActionAdded | public static function assertActionAdded(
$hook = '',
$callback = null,
$priority = null,
$argsNum = null
) {
static::assertHookAdded('action', $hook, $callback, $priority, $argsNum);
} | php | public static function assertActionAdded(
$hook = '',
$callback = null,
$priority = null,
$argsNum = null
) {
static::assertHookAdded('action', $hook, $callback, $priority, $argsNum);
} | [
"public",
"static",
"function",
"assertActionAdded",
"(",
"$",
"hook",
"=",
"''",
",",
"$",
"callback",
"=",
"null",
",",
"$",
"priority",
"=",
"null",
",",
"$",
"argsNum",
"=",
"null",
")",
"{",
"static",
"::",
"assertHookAdded",
"(",
"'action'",
",",
... | Check if an action is added and throws a exceptions otherwise.
@param string $hook Action hook to check
@param callable $callback Callback to check
@param int $priority Priority to check
@param int $argsNum Number of accepted arguments to check | [
"Check",
"if",
"an",
"action",
"is",
"added",
"and",
"throws",
"a",
"exceptions",
"otherwise",
"."
] | b34b5819b96876f23daea9b7fde1b58925da6eab | https://github.com/gmazzap/HooksMock/blob/b34b5819b96876f23daea9b7fde1b58925da6eab/src/HooksMock.php#L228-L235 | train |
gmazzap/HooksMock | src/HooksMock.php | HooksMock.assertFilterAdded | public static function assertFilterAdded(
$hook = '',
callable $callback = null,
$priority = null,
$numArgs = null
) {
static::assertHookAdded('filter', $hook, $callback, $priority, $numArgs);
} | php | public static function assertFilterAdded(
$hook = '',
callable $callback = null,
$priority = null,
$numArgs = null
) {
static::assertHookAdded('filter', $hook, $callback, $priority, $numArgs);
} | [
"public",
"static",
"function",
"assertFilterAdded",
"(",
"$",
"hook",
"=",
"''",
",",
"callable",
"$",
"callback",
"=",
"null",
",",
"$",
"priority",
"=",
"null",
",",
"$",
"numArgs",
"=",
"null",
")",
"{",
"static",
"::",
"assertHookAdded",
"(",
"'filt... | Check if a filter is added and throws an exceptions otherwise.
@param string $hook Filter hook to check
@param callable $callback Callback to check
@param int $priority Priority to check
@param int $numArgs Number of accepted arguments to check | [
"Check",
"if",
"a",
"filter",
"is",
"added",
"and",
"throws",
"an",
"exceptions",
"otherwise",
"."
] | b34b5819b96876f23daea9b7fde1b58925da6eab | https://github.com/gmazzap/HooksMock/blob/b34b5819b96876f23daea9b7fde1b58925da6eab/src/HooksMock.php#L245-L252 | train |
wasinger/adaptimage | src/ResponsiveImages/ResponsiveImage.php | ResponsiveImage.getSrcsetAttributeValue | public function getSrcsetAttributeValue()
{
$srcset = [];
foreach ($this->versions as $id) {
$srcset[] = sprintf('%s %sw', $id->getUrl(), $id->getWidth());
}
return join(', ', $srcset);
} | php | public function getSrcsetAttributeValue()
{
$srcset = [];
foreach ($this->versions as $id) {
$srcset[] = sprintf('%s %sw', $id->getUrl(), $id->getWidth());
}
return join(', ', $srcset);
} | [
"public",
"function",
"getSrcsetAttributeValue",
"(",
")",
"{",
"$",
"srcset",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"versions",
"as",
"$",
"id",
")",
"{",
"$",
"srcset",
"[",
"]",
"=",
"sprintf",
"(",
"'%s %sw'",
",",
"$",
"id",
"... | Get the value for the "srcset" HTML attribute
@return string | [
"Get",
"the",
"value",
"for",
"the",
"srcset",
"HTML",
"attribute"
] | 7b529b25081b399451c8bbd56d0cef7daaa83ec4 | https://github.com/wasinger/adaptimage/blob/7b529b25081b399451c8bbd56d0cef7daaa83ec4/src/ResponsiveImages/ResponsiveImage.php#L87-L94 | train |
wasinger/adaptimage | src/ResponsiveImages/ResponsiveImage.php | ResponsiveImage.getDefaultImageInfo | public function getDefaultImageInfo()
{
if (isset($this->versions[$this->class->getDefaultWidth()])) {
return $this->versions[$this->class->getDefaultWidth()];
} else {
// if the image is smaller than the class default width,
// $this->versions[$this->class->getDe... | php | public function getDefaultImageInfo()
{
if (isset($this->versions[$this->class->getDefaultWidth()])) {
return $this->versions[$this->class->getDefaultWidth()];
} else {
// if the image is smaller than the class default width,
// $this->versions[$this->class->getDe... | [
"public",
"function",
"getDefaultImageInfo",
"(",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"versions",
"[",
"$",
"this",
"->",
"class",
"->",
"getDefaultWidth",
"(",
")",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"versions",
"[",
... | Get WebImageInfo object for the default image size
@return \Wa72\AdaptImage\WebImageInfo | [
"Get",
"WebImageInfo",
"object",
"for",
"the",
"default",
"image",
"size"
] | 7b529b25081b399451c8bbd56d0cef7daaa83ec4 | https://github.com/wasinger/adaptimage/blob/7b529b25081b399451c8bbd56d0cef7daaa83ec4/src/ResponsiveImages/ResponsiveImage.php#L121-L132 | train |
wasinger/adaptimage | src/ResponsiveImages/ResponsiveImage.php | ResponsiveImage.createResizedVersions | public function createResizedVersions(ImageResizer $resizer)
{
foreach ($this->class->getImageResizeDefinitions() as $ird) {
$resizer->resize($ird, $this->original_ifi, true);
}
} | php | public function createResizedVersions(ImageResizer $resizer)
{
foreach ($this->class->getImageResizeDefinitions() as $ird) {
$resizer->resize($ird, $this->original_ifi, true);
}
} | [
"public",
"function",
"createResizedVersions",
"(",
"ImageResizer",
"$",
"resizer",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"class",
"->",
"getImageResizeDefinitions",
"(",
")",
"as",
"$",
"ird",
")",
"{",
"$",
"resizer",
"->",
"resize",
"(",
"$",
"ir... | Really create all resized versions of this image
@param ImageResizer $resizer
@throws \Exception | [
"Really",
"create",
"all",
"resized",
"versions",
"of",
"this",
"image"
] | 7b529b25081b399451c8bbd56d0cef7daaa83ec4 | https://github.com/wasinger/adaptimage/blob/7b529b25081b399451c8bbd56d0cef7daaa83ec4/src/ResponsiveImages/ResponsiveImage.php#L140-L145 | train |
wasinger/adaptimage | src/ResponsiveImages/ResponsiveImage.php | ResponsiveImage.getResizedVersion | public function getResizedVersion(ImageResizer $resizer, $width)
{
if (!$this->class->hasWidth($width)) {
throw new WidthNotAllowedException($width);
}
return $resizer->resize(
$this->class->getImageResizeDefinitionByWidth($width),
$this->original_ifi,
... | php | public function getResizedVersion(ImageResizer $resizer, $width)
{
if (!$this->class->hasWidth($width)) {
throw new WidthNotAllowedException($width);
}
return $resizer->resize(
$this->class->getImageResizeDefinitionByWidth($width),
$this->original_ifi,
... | [
"public",
"function",
"getResizedVersion",
"(",
"ImageResizer",
"$",
"resizer",
",",
"$",
"width",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"class",
"->",
"hasWidth",
"(",
"$",
"width",
")",
")",
"{",
"throw",
"new",
"WidthNotAllowedException",
"(",
... | Resize the image to a defined width and return the corresponding ImageFileInfo object
@param ImageResizer $resizer
@param int $width The desired width; it must be a width that is availaible in the image class
@return ImageFileInfo The ImageFileInfo object pointing to the resized image file
@throws \Exception | [
"Resize",
"the",
"image",
"to",
"a",
"defined",
"width",
"and",
"return",
"the",
"corresponding",
"ImageFileInfo",
"object"
] | 7b529b25081b399451c8bbd56d0cef7daaa83ec4 | https://github.com/wasinger/adaptimage/blob/7b529b25081b399451c8bbd56d0cef7daaa83ec4/src/ResponsiveImages/ResponsiveImage.php#L155-L165 | train |
ezra-obiwale/dSCore | src/Core/ACore.php | ACore.className | protected function className($suffix = '') {
$exp = explode('\\', $this->getClass());
return (!empty($suffix) &&
substr($exp[count($exp) - 1], (strlen($exp[count($exp) - 1]) - strlen($suffix))) === $suffix) ?
substr($exp[count($exp) - 1], 0, (strlen($exp[count($exp) - 1]) - strlen($suffix))) :
$exp[count(... | php | protected function className($suffix = '') {
$exp = explode('\\', $this->getClass());
return (!empty($suffix) &&
substr($exp[count($exp) - 1], (strlen($exp[count($exp) - 1]) - strlen($suffix))) === $suffix) ?
substr($exp[count($exp) - 1], 0, (strlen($exp[count($exp) - 1]) - strlen($suffix))) :
$exp[count(... | [
"protected",
"function",
"className",
"(",
"$",
"suffix",
"=",
"''",
")",
"{",
"$",
"exp",
"=",
"explode",
"(",
"'\\\\'",
",",
"$",
"this",
"->",
"getClass",
"(",
")",
")",
";",
"return",
"(",
"!",
"empty",
"(",
"$",
"suffix",
")",
"&&",
"substr",
... | Fetches the class name
@param string $suffix
@access protected
@return string | [
"Fetches",
"the",
"class",
"name"
] | dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d | https://github.com/ezra-obiwale/dSCore/blob/dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d/src/Core/ACore.php#L21-L28 | train |
ezra-obiwale/dSCore | src/Core/ACore.php | ACore.getNamespace | protected function getNamespace() {
$np = explode('\\', $this->getClass());
unset($np[count($np) - 1]);
return join('\\', $np);
} | php | protected function getNamespace() {
$np = explode('\\', $this->getClass());
unset($np[count($np) - 1]);
return join('\\', $np);
} | [
"protected",
"function",
"getNamespace",
"(",
")",
"{",
"$",
"np",
"=",
"explode",
"(",
"'\\\\'",
",",
"$",
"this",
"->",
"getClass",
"(",
")",
")",
";",
"unset",
"(",
"$",
"np",
"[",
"count",
"(",
"$",
"np",
")",
"-",
"1",
"]",
")",
";",
"retu... | Fetches the namespace of the current class
@return string | [
"Fetches",
"the",
"namespace",
"of",
"the",
"current",
"class"
] | dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d | https://github.com/ezra-obiwale/dSCore/blob/dd51246e0dc2c64d4d44de7992d7ff1b5165ab2d/src/Core/ACore.php#L34-L38 | train |
shgysk8zer0/core_api | traits/xml_exception.php | XML_Exception.ExceptionAsXML | final protected function ExceptionAsXML(\Exception $e, \DOMNode &$par)
{
//echo $e . PHP_EOL . print_r($par, true);
$exc = $par->appendChild($this->createElement('Exception'));
$exc->appendChild($this->createElement('File', $e->getFile()));
$exc->appendChild($this->createElement('Line', $e->getLine()));
$ex... | php | final protected function ExceptionAsXML(\Exception $e, \DOMNode &$par)
{
//echo $e . PHP_EOL . print_r($par, true);
$exc = $par->appendChild($this->createElement('Exception'));
$exc->appendChild($this->createElement('File', $e->getFile()));
$exc->appendChild($this->createElement('Line', $e->getLine()));
$ex... | [
"final",
"protected",
"function",
"ExceptionAsXML",
"(",
"\\",
"Exception",
"$",
"e",
",",
"\\",
"DOMNode",
"&",
"$",
"par",
")",
"{",
"//echo $e . PHP_EOL . print_r($par, true);",
"$",
"exc",
"=",
"$",
"par",
"->",
"appendChild",
"(",
"$",
"this",
"->",
"c... | Converts a PHP Exception into a populated XML node
@param Exception $e The exception thrown & caught
@param DOMNode $par The parent node to be appending to
@return void $par is a pointer | [
"Converts",
"a",
"PHP",
"Exception",
"into",
"a",
"populated",
"XML",
"node"
] | 9e9b8baf761af874b95256ad2462e55fbb2b2e58 | https://github.com/shgysk8zer0/core_api/blob/9e9b8baf761af874b95256ad2462e55fbb2b2e58/traits/xml_exception.php#L32-L66 | train |
vainproject/vain-user | src/User/Auth/Access/Traits/PermissionTrait.php | PermissionTrait.boot | public static function boot()
{
parent::boot();
static::deleting(function ($permission) {
if (!method_exists(config('access.permission'), 'bootSoftDeletes')) {
$permission->roles()->sync([]);
}
return true;
});
} | php | public static function boot()
{
parent::boot();
static::deleting(function ($permission) {
if (!method_exists(config('access.permission'), 'bootSoftDeletes')) {
$permission->roles()->sync([]);
}
return true;
});
} | [
"public",
"static",
"function",
"boot",
"(",
")",
"{",
"parent",
"::",
"boot",
"(",
")",
";",
"static",
"::",
"deleting",
"(",
"function",
"(",
"$",
"permission",
")",
"{",
"if",
"(",
"!",
"method_exists",
"(",
"config",
"(",
"'access.permission'",
")",
... | Boot the permission model
Attach event listener to remove the many-to-many records when trying to delete
Will NOT delete any records if the permission model uses soft deletes.
@return void|bool | [
"Boot",
"the",
"permission",
"model",
"Attach",
"event",
"listener",
"to",
"remove",
"the",
"many",
"-",
"to",
"-",
"many",
"records",
"when",
"trying",
"to",
"delete",
"Will",
"NOT",
"delete",
"any",
"records",
"if",
"the",
"permission",
"model",
"uses",
... | 1c059faa61ebf289fcaea39a90b4523cfc9d6efc | https://github.com/vainproject/vain-user/blob/1c059faa61ebf289fcaea39a90b4523cfc9d6efc/src/User/Auth/Access/Traits/PermissionTrait.php#L24-L34 | train |
mwyatt/core | src/Pagination.php | Pagination.getLimit | public function getLimit($end = false)
{
$bottom = ($this->maxPerPage * ($this->pageCurrent - 1));
$top = $this->maxPerPage;
if ($end === false) {
return array($bottom, $top);
}
if ($end === 0) {
return $bottom;
}
if ($end === 1) {
... | php | public function getLimit($end = false)
{
$bottom = ($this->maxPerPage * ($this->pageCurrent - 1));
$top = $this->maxPerPage;
if ($end === false) {
return array($bottom, $top);
}
if ($end === 0) {
return $bottom;
}
if ($end === 1) {
... | [
"public",
"function",
"getLimit",
"(",
"$",
"end",
"=",
"false",
")",
"{",
"$",
"bottom",
"=",
"(",
"$",
"this",
"->",
"maxPerPage",
"*",
"(",
"$",
"this",
"->",
"pageCurrent",
"-",
"1",
")",
")",
";",
"$",
"top",
"=",
"$",
"this",
"->",
"maxPerP... | get a limit array usable in an sql query
@param boolean $end ?
@return array|int | [
"get",
"a",
"limit",
"array",
"usable",
"in",
"an",
"sql",
"query"
] | 8ea9d67cc84fe6aff17a469c703d5492dbcd93ed | https://github.com/mwyatt/core/blob/8ea9d67cc84fe6aff17a469c703d5492dbcd93ed/src/Pagination.php#L79-L92 | train |
mwyatt/core | src/Pagination.php | Pagination.generate | public function generate($pageCurrent, $totalRows)
{
$this->totalRows = $totalRows;
$this->setPossiblePages();
$this->setPageCurrent($pageCurrent);
if ($this->possiblePages < 2) {
return;
}
$pageCurrent = $this->pageCurrent;
$pagination = $this->... | php | public function generate($pageCurrent, $totalRows)
{
$this->totalRows = $totalRows;
$this->setPossiblePages();
$this->setPageCurrent($pageCurrent);
if ($this->possiblePages < 2) {
return;
}
$pageCurrent = $this->pageCurrent;
$pagination = $this->... | [
"public",
"function",
"generate",
"(",
"$",
"pageCurrent",
",",
"$",
"totalRows",
")",
"{",
"$",
"this",
"->",
"totalRows",
"=",
"$",
"totalRows",
";",
"$",
"this",
"->",
"setPossiblePages",
"(",
")",
";",
"$",
"this",
"->",
"setPageCurrent",
"(",
"$",
... | build the pagination array
@return array | [
"build",
"the",
"pagination",
"array"
] | 8ea9d67cc84fe6aff17a469c703d5492dbcd93ed | https://github.com/mwyatt/core/blob/8ea9d67cc84fe6aff17a469c703d5492dbcd93ed/src/Pagination.php#L99-L127 | train |
mwyatt/core | src/Pagination.php | Pagination.urlBuildPageLink | protected function urlBuildPageLink($page)
{
$url = $this->url;
$urlBase = $url->generate() . $url->getPath();
$queryParts = $url->getQueryArray();
$queryParts['page'] = $page;
return $urlBase . '?' . http_build_query($queryParts);
} | php | protected function urlBuildPageLink($page)
{
$url = $this->url;
$urlBase = $url->generate() . $url->getPath();
$queryParts = $url->getQueryArray();
$queryParts['page'] = $page;
return $urlBase . '?' . http_build_query($queryParts);
} | [
"protected",
"function",
"urlBuildPageLink",
"(",
"$",
"page",
")",
"{",
"$",
"url",
"=",
"$",
"this",
"->",
"url",
";",
"$",
"urlBase",
"=",
"$",
"url",
"->",
"generate",
"(",
")",
".",
"$",
"url",
"->",
"getPath",
"(",
")",
";",
"$",
"queryParts"... | add the page to the query string
create an absolute url
@param int $page
@return string absolute url | [
"add",
"the",
"page",
"to",
"the",
"query",
"string",
"create",
"an",
"absolute",
"url"
] | 8ea9d67cc84fe6aff17a469c703d5492dbcd93ed | https://github.com/mwyatt/core/blob/8ea9d67cc84fe6aff17a469c703d5492dbcd93ed/src/Pagination.php#L165-L172 | train |
mwyatt/core | src/Pagination.php | Pagination.setPageCurrent | protected function setPageCurrent($page)
{
// need both of these?
$page += 0;
$page = (int) $page;
// cant be below 1
$page = $page ? $page : 1;
// cant be above possible
if ($page > $this->possiblePages) {
$page = $this->possiblePages;
... | php | protected function setPageCurrent($page)
{
// need both of these?
$page += 0;
$page = (int) $page;
// cant be below 1
$page = $page ? $page : 1;
// cant be above possible
if ($page > $this->possiblePages) {
$page = $this->possiblePages;
... | [
"protected",
"function",
"setPageCurrent",
"(",
"$",
"page",
")",
"{",
"// need both of these?",
"$",
"page",
"+=",
"0",
";",
"$",
"page",
"=",
"(",
"int",
")",
"$",
"page",
";",
"// cant be below 1",
"$",
"page",
"=",
"$",
"page",
"?",
"$",
"page",
":... | page is set within the constraints of lowest and highest value
@param int $page | [
"page",
"is",
"set",
"within",
"the",
"constraints",
"of",
"lowest",
"and",
"highest",
"value"
] | 8ea9d67cc84fe6aff17a469c703d5492dbcd93ed | https://github.com/mwyatt/core/blob/8ea9d67cc84fe6aff17a469c703d5492dbcd93ed/src/Pagination.php#L179-L195 | train |
zapheus/zapheus | src/Routing/Route.php | Route.regex | public function regex()
{
// Turn "(/)" into "/?"
$uri = preg_replace('#\(/\)#', '/?', $this->uri);
// Create capture group for ":parameter", replaces ":parameter"
$uri = $this->capture($uri, '/:(' . self::ALLOWED_REGEX . ')/');
// Create capture group for '{parameter}', re... | php | public function regex()
{
// Turn "(/)" into "/?"
$uri = preg_replace('#\(/\)#', '/?', $this->uri);
// Create capture group for ":parameter", replaces ":parameter"
$uri = $this->capture($uri, '/:(' . self::ALLOWED_REGEX . ')/');
// Create capture group for '{parameter}', re... | [
"public",
"function",
"regex",
"(",
")",
"{",
"// Turn \"(/)\" into \"/?\"",
"$",
"uri",
"=",
"preg_replace",
"(",
"'#\\(/\\)#'",
",",
"'/?'",
",",
"$",
"this",
"->",
"uri",
")",
";",
"// Create capture group for \":parameter\", replaces \":parameter\"",
"$",
"uri",
... | Returns a regular expression pattern from the given URI.
@link https://stackoverflow.com/q/30130913
@return string | [
"Returns",
"a",
"regular",
"expression",
"pattern",
"from",
"the",
"given",
"URI",
"."
] | 96618b5cee7d20b6700d0475e4334ae4b5163a6b | https://github.com/zapheus/zapheus/blob/96618b5cee7d20b6700d0475e4334ae4b5163a6b/src/Routing/Route.php#L112-L125 | train |
zapheus/zapheus | src/Routing/Route.php | Route.capture | protected function capture($pattern, $search)
{
$replace = '(?<$1>' . self::ALLOWED_REGEX . ')';
return preg_replace($search, $replace, $pattern);
} | php | protected function capture($pattern, $search)
{
$replace = '(?<$1>' . self::ALLOWED_REGEX . ')';
return preg_replace($search, $replace, $pattern);
} | [
"protected",
"function",
"capture",
"(",
"$",
"pattern",
",",
"$",
"search",
")",
"{",
"$",
"replace",
"=",
"'(?<$1>'",
".",
"self",
"::",
"ALLOWED_REGEX",
".",
"')'",
";",
"return",
"preg_replace",
"(",
"$",
"search",
",",
"$",
"replace",
",",
"$",
"p... | Capture the specified regular expressions.
@param string $pattern
@param string $search
@return string | [
"Capture",
"the",
"specified",
"regular",
"expressions",
"."
] | 96618b5cee7d20b6700d0475e4334ae4b5163a6b | https://github.com/zapheus/zapheus/blob/96618b5cee7d20b6700d0475e4334ae4b5163a6b/src/Routing/Route.php#L144-L149 | train |
sndsgd/sndsgd-field | src/field/Collection.php | Collection.addField | public function addField(Field $field)
{
$name = $field->getName();
if (array_key_exists($name, $this->fields)) {
throw new DuplicateFieldNameException($name);
}
$this->fields[$name] = $field;
foreach ($field->getAliases() as $alias) {
if (array_key_ex... | php | public function addField(Field $field)
{
$name = $field->getName();
if (array_key_exists($name, $this->fields)) {
throw new DuplicateFieldNameException($name);
}
$this->fields[$name] = $field;
foreach ($field->getAliases() as $alias) {
if (array_key_ex... | [
"public",
"function",
"addField",
"(",
"Field",
"$",
"field",
")",
"{",
"$",
"name",
"=",
"$",
"field",
"->",
"getName",
"(",
")",
";",
"if",
"(",
"array_key_exists",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"fields",
")",
")",
"{",
"throw",
"new"... | Define a field
@param \sndsgd\Field $field The field to define
@return \sndsgd\field\Collection | [
"Define",
"a",
"field"
] | 34ac3aabfe031bd9b259b3b93e84964b04031334 | https://github.com/sndsgd/sndsgd-field/blob/34ac3aabfe031bd9b259b3b93e84964b04031334/src/field/Collection.php#L102-L117 | train |
sndsgd/sndsgd-field | src/field/Collection.php | Collection.removeField | public function removeField($name)
{
if (($field = $this->getField($name)) === null) {
return false;
}
foreach ($field->getAliases() as $alias) {
unset($this->fieldAliases[$alias]);
}
unset($this->fields[$name]);
return true;
} | php | public function removeField($name)
{
if (($field = $this->getField($name)) === null) {
return false;
}
foreach ($field->getAliases() as $alias) {
unset($this->fieldAliases[$alias]);
}
unset($this->fields[$name]);
return true;
} | [
"public",
"function",
"removeField",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"(",
"$",
"field",
"=",
"$",
"this",
"->",
"getField",
"(",
"$",
"name",
")",
")",
"===",
"null",
")",
"{",
"return",
"false",
";",
"}",
"foreach",
"(",
"$",
"field",
"->... | Remove a field from the collection
@param string $name A field name or alias
@return boolean Whether or not a field was removed | [
"Remove",
"a",
"field",
"from",
"the",
"collection"
] | 34ac3aabfe031bd9b259b3b93e84964b04031334 | https://github.com/sndsgd/sndsgd-field/blob/34ac3aabfe031bd9b259b3b93e84964b04031334/src/field/Collection.php#L139-L150 | train |
sndsgd/sndsgd-field | src/field/Collection.php | Collection.getField | public function getField($name)
{
if (array_key_exists($name, $this->fields)) {
return $this->fields[$name];
}
else if (array_key_exists($name, $this->fieldAliases)) {
$name = $this->fieldAliases[$name];
return $this->fields[$name];
}
retur... | php | public function getField($name)
{
if (array_key_exists($name, $this->fields)) {
return $this->fields[$name];
}
else if (array_key_exists($name, $this->fieldAliases)) {
$name = $this->fieldAliases[$name];
return $this->fields[$name];
}
retur... | [
"public",
"function",
"getField",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"fields",
")",
")",
"{",
"return",
"$",
"this",
"->",
"fields",
"[",
"$",
"name",
"]",
";",
"}",
"else",
"if",
... | Get a field instance
@param string $name An alias or name of the field to get
@return \sndsgd\Field|null
@return \sndsgd\Field The field was found
@return null The field was NOT found | [
"Get",
"a",
"field",
"instance"
] | 34ac3aabfe031bd9b259b3b93e84964b04031334 | https://github.com/sndsgd/sndsgd-field/blob/34ac3aabfe031bd9b259b3b93e84964b04031334/src/field/Collection.php#L160-L170 | train |
sndsgd/sndsgd-field | src/field/Collection.php | Collection.getFields | public function getFields($visibility = Field::VISIBILITY_PUBLIC)
{
$ret = [];
foreach ($this->fields as $name => $field) {
if ($field->getVisibility() & $visibility) {
$ret[$name] = $field;
}
}
return $ret;
} | php | public function getFields($visibility = Field::VISIBILITY_PUBLIC)
{
$ret = [];
foreach ($this->fields as $name => $field) {
if ($field->getVisibility() & $visibility) {
$ret[$name] = $field;
}
}
return $ret;
} | [
"public",
"function",
"getFields",
"(",
"$",
"visibility",
"=",
"Field",
"::",
"VISIBILITY_PUBLIC",
")",
"{",
"$",
"ret",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"fields",
"as",
"$",
"name",
"=>",
"$",
"field",
")",
"{",
"if",
"(",
"... | Get an associative array of the fields in this collection
@param integer $visibility A bitmask to filter fields by visibility
@return array<string,sndsgd\Field> | [
"Get",
"an",
"associative",
"array",
"of",
"the",
"fields",
"in",
"this",
"collection"
] | 34ac3aabfe031bd9b259b3b93e84964b04031334 | https://github.com/sndsgd/sndsgd-field/blob/34ac3aabfe031bd9b259b3b93e84964b04031334/src/field/Collection.php#L178-L187 | train |
sndsgd/sndsgd-field | src/field/Collection.php | Collection.addValues | public function addValues(array $fieldValues)
{
foreach ($fieldValues as $fieldName => $values) {
$values = Arr::cast($values);
if (null === ($field = $this->getField($fieldName))) {
$message = "unknown field";
$len = count($values);
if... | php | public function addValues(array $fieldValues)
{
foreach ($fieldValues as $fieldName => $values) {
$values = Arr::cast($values);
if (null === ($field = $this->getField($fieldName))) {
$message = "unknown field";
$len = count($values);
if... | [
"public",
"function",
"addValues",
"(",
"array",
"$",
"fieldValues",
")",
"{",
"foreach",
"(",
"$",
"fieldValues",
"as",
"$",
"fieldName",
"=>",
"$",
"values",
")",
"{",
"$",
"values",
"=",
"Arr",
"::",
"cast",
"(",
"$",
"values",
")",
";",
"if",
"("... | Add values to the fields in the collection
@param array<string,mixed> $fieldValues | [
"Add",
"values",
"to",
"the",
"fields",
"in",
"the",
"collection"
] | 34ac3aabfe031bd9b259b3b93e84964b04031334 | https://github.com/sndsgd/sndsgd-field/blob/34ac3aabfe031bd9b259b3b93e84964b04031334/src/field/Collection.php#L194-L214 | train |
sndsgd/sndsgd-field | src/field/Collection.php | Collection.validate | public function validate()
{
# addValues adds validation errors for unknown values
$errs = count($this->errors);
$dataKey = constant(get_called_class()."::EVENT_DATA_KEY");
if ($this->beforeValidate() !== true) {
return false;
}
foreach ($this->fields as... | php | public function validate()
{
# addValues adds validation errors for unknown values
$errs = count($this->errors);
$dataKey = constant(get_called_class()."::EVENT_DATA_KEY");
if ($this->beforeValidate() !== true) {
return false;
}
foreach ($this->fields as... | [
"public",
"function",
"validate",
"(",
")",
"{",
"# addValues adds validation errors for unknown values",
"$",
"errs",
"=",
"count",
"(",
"$",
"this",
"->",
"errors",
")",
";",
"$",
"dataKey",
"=",
"constant",
"(",
"get_called_class",
"(",
")",
".",
"\"::EVENT_D... | Validate the all the fields
@return boolean | [
"Validate",
"the",
"all",
"the",
"fields"
] | 34ac3aabfe031bd9b259b3b93e84964b04031334 | https://github.com/sndsgd/sndsgd-field/blob/34ac3aabfe031bd9b259b3b93e84964b04031334/src/field/Collection.php#L221-L244 | train |
sndsgd/sndsgd-field | src/field/Collection.php | Collection.addError | public function addError(Error $error, $prepend = false)
{
if ($prepend === true) {
array_unshift($this->errors, $error);
}
else {
$this->errors[] = $error;
}
return count($this->errors);
} | php | public function addError(Error $error, $prepend = false)
{
if ($prepend === true) {
array_unshift($this->errors, $error);
}
else {
$this->errors[] = $error;
}
return count($this->errors);
} | [
"public",
"function",
"addError",
"(",
"Error",
"$",
"error",
",",
"$",
"prepend",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"prepend",
"===",
"true",
")",
"{",
"array_unshift",
"(",
"$",
"this",
"->",
"errors",
",",
"$",
"error",
")",
";",
"}",
"els... | Add a validation error
@param \sndsgd\field\Error $error
@param boolean $prepend Add the error to the beginning
@return integer The total number of validation errors | [
"Add",
"a",
"validation",
"error"
] | 34ac3aabfe031bd9b259b3b93e84964b04031334 | https://github.com/sndsgd/sndsgd-field/blob/34ac3aabfe031bd9b259b3b93e84964b04031334/src/field/Collection.php#L253-L262 | train |
sndsgd/sndsgd-field | src/field/Collection.php | Collection.getErrors | public function getErrors($name = null)
{
if ($name === null) {
return $this->errors;
}
$ret = [];
foreach ($this->errors as $error) {
if ($error->getName() === $name) {
$ret[] = $error;
}
}
return $ret;
} | php | public function getErrors($name = null)
{
if ($name === null) {
return $this->errors;
}
$ret = [];
foreach ($this->errors as $error) {
if ($error->getName() === $name) {
$ret[] = $error;
}
}
return $ret;
} | [
"public",
"function",
"getErrors",
"(",
"$",
"name",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"name",
"===",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"errors",
";",
"}",
"$",
"ret",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"er... | Get validation errors for one or all fields
@param string|null $name The name of a field to get validation errors for
@return array<\sndsgd\field\Error> | [
"Get",
"validation",
"errors",
"for",
"one",
"or",
"all",
"fields"
] | 34ac3aabfe031bd9b259b3b93e84964b04031334 | https://github.com/sndsgd/sndsgd-field/blob/34ac3aabfe031bd9b259b3b93e84964b04031334/src/field/Collection.php#L280-L293 | train |
sndsgd/sndsgd-field | src/field/Collection.php | Collection.exportErrors | public function exportErrors()
{
$ret = [];
foreach ($this->errors as $error) {
$ret[] = $error->export();
}
return $ret;
} | php | public function exportErrors()
{
$ret = [];
foreach ($this->errors as $error) {
$ret[] = $error->export();
}
return $ret;
} | [
"public",
"function",
"exportErrors",
"(",
")",
"{",
"$",
"ret",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"errors",
"as",
"$",
"error",
")",
"{",
"$",
"ret",
"[",
"]",
"=",
"$",
"error",
"->",
"export",
"(",
")",
";",
"}",
"return... | Export validation errors for all fields
@return array<string,mixed> | [
"Export",
"validation",
"errors",
"for",
"all",
"fields"
] | 34ac3aabfe031bd9b259b3b93e84964b04031334 | https://github.com/sndsgd/sndsgd-field/blob/34ac3aabfe031bd9b259b3b93e84964b04031334/src/field/Collection.php#L300-L307 | train |
sndsgd/sndsgd-field | src/field/Collection.php | Collection.exportFieldValue | public function exportFieldValue($name, $exportHandler = null)
{
if (!is_string($name)) {
throw new InvalidArgumentException(
"invalid value provided for 'name'; ".
"expecting a field name as string"
);
}
else if (($field = $this->getFi... | php | public function exportFieldValue($name, $exportHandler = null)
{
if (!is_string($name)) {
throw new InvalidArgumentException(
"invalid value provided for 'name'; ".
"expecting a field name as string"
);
}
else if (($field = $this->getFi... | [
"public",
"function",
"exportFieldValue",
"(",
"$",
"name",
",",
"$",
"exportHandler",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"name",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"\"invalid value provided for 'name'; \""... | Convenience method to get a particular field value
@param string $name The field name
@param integer|null $exportHandler AN export handler
@return mixed
@throws \InvalidArgumentException If provided name does not exist | [
"Convenience",
"method",
"to",
"get",
"a",
"particular",
"field",
"value"
] | 34ac3aabfe031bd9b259b3b93e84964b04031334 | https://github.com/sndsgd/sndsgd-field/blob/34ac3aabfe031bd9b259b3b93e84964b04031334/src/field/Collection.php#L317-L329 | train |
sndsgd/sndsgd-field | src/field/Collection.php | Collection.exportValues | public function exportValues()
{
$ret = [];
foreach ($this->fields as $field) {
if ($field->getExportHandler() !== Field::EXPORT_SKIP) {
$ret[$field->getName()] = $field->exportValue();
}
}
return $ret;
} | php | public function exportValues()
{
$ret = [];
foreach ($this->fields as $field) {
if ($field->getExportHandler() !== Field::EXPORT_SKIP) {
$ret[$field->getName()] = $field->exportValue();
}
}
return $ret;
} | [
"public",
"function",
"exportValues",
"(",
")",
"{",
"$",
"ret",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"fields",
"as",
"$",
"field",
")",
"{",
"if",
"(",
"$",
"field",
"->",
"getExportHandler",
"(",
")",
"!==",
"Field",
"::",
"EXPO... | Get all field values using their respective export handlers
@return array<string,mixed> | [
"Get",
"all",
"field",
"values",
"using",
"their",
"respective",
"export",
"handlers"
] | 34ac3aabfe031bd9b259b3b93e84964b04031334 | https://github.com/sndsgd/sndsgd-field/blob/34ac3aabfe031bd9b259b3b93e84964b04031334/src/field/Collection.php#L336-L345 | train |
DreadLabs/VantomasWebsite | src/Twitter/AccessControl/Authorization/BearerToken.php | BearerToken.initializeCredentials | private function initializeCredentials()
{
$this->credentials = base64_encode(
sprintf(
'%s:%s',
urlencode($this->configuration->getConsumerKey()),
urlencode($this->configuration->getConsumerSecret())
)
);
} | php | private function initializeCredentials()
{
$this->credentials = base64_encode(
sprintf(
'%s:%s',
urlencode($this->configuration->getConsumerKey()),
urlencode($this->configuration->getConsumerSecret())
)
);
} | [
"private",
"function",
"initializeCredentials",
"(",
")",
"{",
"$",
"this",
"->",
"credentials",
"=",
"base64_encode",
"(",
"sprintf",
"(",
"'%s:%s'",
",",
"urlencode",
"(",
"$",
"this",
"->",
"configuration",
"->",
"getConsumerKey",
"(",
")",
")",
",",
"url... | Initializes the bearer token credentials in the expected format
@see https://dev.twitter.com/docs/auth/application-only-auth
@return void | [
"Initializes",
"the",
"bearer",
"token",
"credentials",
"in",
"the",
"expected",
"format"
] | 7f85f2b45bdf5ed9fa9d320c805c416bf99cd668 | https://github.com/DreadLabs/VantomasWebsite/blob/7f85f2b45bdf5ed9fa9d320c805c416bf99cd668/src/Twitter/AccessControl/Authorization/BearerToken.php#L86-L95 | train |
kambalabs/KmbPuppetDb | src/KmbPuppetDb/Service/FactNames.php | FactNames.getAll | public function getAll()
{
$request = new KmbPuppetDb\Request('/fact-names');
$response = $this->getPuppetDbClient()->send($request);
return (array) $response->getData();
} | php | public function getAll()
{
$request = new KmbPuppetDb\Request('/fact-names');
$response = $this->getPuppetDbClient()->send($request);
return (array) $response->getData();
} | [
"public",
"function",
"getAll",
"(",
")",
"{",
"$",
"request",
"=",
"new",
"KmbPuppetDb",
"\\",
"Request",
"(",
"'/fact-names'",
")",
";",
"$",
"response",
"=",
"$",
"this",
"->",
"getPuppetDbClient",
"(",
")",
"->",
"send",
"(",
"$",
"request",
")",
"... | Get all fact names.
@return array | [
"Get",
"all",
"fact",
"names",
"."
] | df56a275cf00f4402cf121a2e99149168f1f8b2d | https://github.com/kambalabs/KmbPuppetDb/blob/df56a275cf00f4402cf121a2e99149168f1f8b2d/src/KmbPuppetDb/Service/FactNames.php#L35-L40 | train |
phossa/phossa-di | src/Phossa/Di/Definition/DefinitionAwareTrait.php | DefinitionAwareTrait.getParameter | protected function getParameter(/*# string */ $name)
{
if ($this->hasResolver()) {
$found = $this->getResolver()->get($name);
} else {
// break into parts by '.'
$parts = explode('.', $name);
$found = $this->parameters;
while (null !== ($pa... | php | protected function getParameter(/*# string */ $name)
{
if ($this->hasResolver()) {
$found = $this->getResolver()->get($name);
} else {
// break into parts by '.'
$parts = explode('.', $name);
$found = $this->parameters;
while (null !== ($pa... | [
"protected",
"function",
"getParameter",
"(",
"/*# string */",
"$",
"name",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"hasResolver",
"(",
")",
")",
"{",
"$",
"found",
"=",
"$",
"this",
"->",
"getResolver",
"(",
")",
"->",
"get",
"(",
"$",
"name",
")",
... | Get this paramter's value either a string or an associate array
```php
$this->set('cache.dir', '/var/tmp');
// will return an array ['dir' => '/var/tmp'];
$result = $this->getParameter('cache');
// will return a string, 'var/tmp'
$result = $this->getParameter('cache.dir');
```
@param string $name parameter name
@r... | [
"Get",
"this",
"paramter",
"s",
"value",
"either",
"a",
"string",
"or",
"an",
"associate",
"array"
] | bbe1e95b081068e2bc49c6cd465f38aab0374be5 | https://github.com/phossa/phossa-di/blob/bbe1e95b081068e2bc49c6cd465f38aab0374be5/src/Phossa/Di/Definition/DefinitionAwareTrait.php#L350-L375 | train |
phossa/phossa-di | src/Phossa/Di/Definition/DefinitionAwareTrait.php | DefinitionAwareTrait.fixServices | protected function fixServices(array &$definitions)
{
foreach ($definitions as $id => $def) {
if (is_array($def)) {
if (!isset($def['class'])) {
$def = ['class' => $def];
} elseif (!is_array($def['class'])) {
$def['class'] =... | php | protected function fixServices(array &$definitions)
{
foreach ($definitions as $id => $def) {
if (is_array($def)) {
if (!isset($def['class'])) {
$def = ['class' => $def];
} elseif (!is_array($def['class'])) {
$def['class'] =... | [
"protected",
"function",
"fixServices",
"(",
"array",
"&",
"$",
"definitions",
")",
"{",
"foreach",
"(",
"$",
"definitions",
"as",
"$",
"id",
"=>",
"$",
"def",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"def",
")",
")",
"{",
"if",
"(",
"!",
"isset"... | Normalize service definitions
@param array &$definitions
@return void
@access protected | [
"Normalize",
"service",
"definitions"
] | bbe1e95b081068e2bc49c6cd465f38aab0374be5 | https://github.com/phossa/phossa-di/blob/bbe1e95b081068e2bc49c6cd465f38aab0374be5/src/Phossa/Di/Definition/DefinitionAwareTrait.php#L384-L398 | train |
danielgp/common-lib | source/MySQLiByDanielGPtypes.php | MySQLiByDanielGPtypes.getMySQLqueryType | protected function getMySQLqueryType($sQuery)
{
$queryPieces = explode(' ', $sQuery);
$statementTypes = $this->listOfMySQLqueryStatementType($queryPieces[0]);
if (in_array($queryPieces[0], $statementTypes['keys'])) {
$type = $statementTypes['value']['Type'];
$ar... | php | protected function getMySQLqueryType($sQuery)
{
$queryPieces = explode(' ', $sQuery);
$statementTypes = $this->listOfMySQLqueryStatementType($queryPieces[0]);
if (in_array($queryPieces[0], $statementTypes['keys'])) {
$type = $statementTypes['value']['Type'];
$ar... | [
"protected",
"function",
"getMySQLqueryType",
"(",
"$",
"sQuery",
")",
"{",
"$",
"queryPieces",
"=",
"explode",
"(",
"' '",
",",
"$",
"sQuery",
")",
";",
"$",
"statementTypes",
"=",
"$",
"this",
"->",
"listOfMySQLqueryStatementType",
"(",
"$",
"queryPieces",
... | Returns the Query language type by scanning the 1st keyword from a given query
@param string $sQuery | [
"Returns",
"the",
"Query",
"language",
"type",
"by",
"scanning",
"the",
"1st",
"keyword",
"from",
"a",
"given",
"query"
] | 627b99b4408414c7cd21a6c8016f6468dc9216b2 | https://github.com/danielgp/common-lib/blob/627b99b4408414c7cd21a6c8016f6468dc9216b2/source/MySQLiByDanielGPtypes.php#L44-L62 | train |
danielgp/common-lib | source/MySQLiByDanielGPtypes.php | MySQLiByDanielGPtypes.listOfMySQLqueryLanguageType | private function listOfMySQLqueryLanguageType($qType)
{
$keyForReturn = 'Type ' . $qType . ' stands for';
$vMap = ['DCL', 'DDL', 'DML', 'DQL', 'DTL'];
if (in_array($qType, $vMap)) {
$valForReturn = $this->readTypeFromJsonFile('MySQLiLanguageTypes')[$qType];
re... | php | private function listOfMySQLqueryLanguageType($qType)
{
$keyForReturn = 'Type ' . $qType . ' stands for';
$vMap = ['DCL', 'DDL', 'DML', 'DQL', 'DTL'];
if (in_array($qType, $vMap)) {
$valForReturn = $this->readTypeFromJsonFile('MySQLiLanguageTypes')[$qType];
re... | [
"private",
"function",
"listOfMySQLqueryLanguageType",
"(",
"$",
"qType",
")",
"{",
"$",
"keyForReturn",
"=",
"'Type '",
".",
"$",
"qType",
".",
"' stands for'",
";",
"$",
"vMap",
"=",
"[",
"'DCL'",
",",
"'DDL'",
",",
"'DML'",
",",
"'DQL'",
",",
"'DTL'",
... | Just to keep a list of type of language as array
@return array | [
"Just",
"to",
"keep",
"a",
"list",
"of",
"type",
"of",
"language",
"as",
"array"
] | 627b99b4408414c7cd21a6c8016f6468dc9216b2 | https://github.com/danielgp/common-lib/blob/627b99b4408414c7cd21a6c8016f6468dc9216b2/source/MySQLiByDanielGPtypes.php#L69-L78 | train |
danielgp/common-lib | source/MySQLiByDanielGPtypes.php | MySQLiByDanielGPtypes.listOfMySQLqueryStatementType | private function listOfMySQLqueryStatementType($firstKwordWQuery)
{
$statmentsArray = $this->readTypeFromJsonFile('MySQLiStatementTypes');
return [
'keys' => array_keys($statmentsArray),
'value' => [
'Description' => $statmentsArray[$firstKwordWQuery][1],
... | php | private function listOfMySQLqueryStatementType($firstKwordWQuery)
{
$statmentsArray = $this->readTypeFromJsonFile('MySQLiStatementTypes');
return [
'keys' => array_keys($statmentsArray),
'value' => [
'Description' => $statmentsArray[$firstKwordWQuery][1],
... | [
"private",
"function",
"listOfMySQLqueryStatementType",
"(",
"$",
"firstKwordWQuery",
")",
"{",
"$",
"statmentsArray",
"=",
"$",
"this",
"->",
"readTypeFromJsonFile",
"(",
"'MySQLiStatementTypes'",
")",
";",
"return",
"[",
"'keys'",
"=>",
"array_keys",
"(",
"$",
"... | Just to keep a list of statement types as array
@param string $firstKwordWQuery
@return array | [
"Just",
"to",
"keep",
"a",
"list",
"of",
"statement",
"types",
"as",
"array"
] | 627b99b4408414c7cd21a6c8016f6468dc9216b2 | https://github.com/danielgp/common-lib/blob/627b99b4408414c7cd21a6c8016f6468dc9216b2/source/MySQLiByDanielGPtypes.php#L86-L96 | train |
buflix/SimpleCollection | src/SimpleCollection/Entity/EntityAssocCollection.php | EntityAssocCollection.add | public function add($oEntity)
{
$this->checkClass($oEntity);
$this->values[$oEntity->getCollectionIndex()] = $oEntity;
return $this;
} | php | public function add($oEntity)
{
$this->checkClass($oEntity);
$this->values[$oEntity->getCollectionIndex()] = $oEntity;
return $this;
} | [
"public",
"function",
"add",
"(",
"$",
"oEntity",
")",
"{",
"$",
"this",
"->",
"checkClass",
"(",
"$",
"oEntity",
")",
";",
"$",
"this",
"->",
"values",
"[",
"$",
"oEntity",
"->",
"getCollectionIndex",
"(",
")",
"]",
"=",
"$",
"oEntity",
";",
"return... | Add Entity to collection
@param AssocEntityInterface $oEntity
@return $this | [
"Add",
"Entity",
"to",
"collection"
] | 405504d8be6415a872a5a49ce8223c22a932831a | https://github.com/buflix/SimpleCollection/blob/405504d8be6415a872a5a49ce8223c22a932831a/src/SimpleCollection/Entity/EntityAssocCollection.php#L56-L62 | train |
buflix/SimpleCollection | src/SimpleCollection/Entity/EntityAssocCollection.php | EntityAssocCollection.indexEntities | protected function indexEntities(array $aEntities)
{
$aIndexEntities = array();
foreach ($aEntities as $oEntity) {
$aIndexEntities[$oEntity->getCollectionIndex()] = $oEntity;
}
return $aIndexEntities;
} | php | protected function indexEntities(array $aEntities)
{
$aIndexEntities = array();
foreach ($aEntities as $oEntity) {
$aIndexEntities[$oEntity->getCollectionIndex()] = $oEntity;
}
return $aIndexEntities;
} | [
"protected",
"function",
"indexEntities",
"(",
"array",
"$",
"aEntities",
")",
"{",
"$",
"aIndexEntities",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"aEntities",
"as",
"$",
"oEntity",
")",
"{",
"$",
"aIndexEntities",
"[",
"$",
"oEntity",
"->",
"g... | Create index array
@param AssocEntityInterface[] $aEntities
@return array | [
"Create",
"index",
"array"
] | 405504d8be6415a872a5a49ce8223c22a932831a | https://github.com/buflix/SimpleCollection/blob/405504d8be6415a872a5a49ce8223c22a932831a/src/SimpleCollection/Entity/EntityAssocCollection.php#L71-L79 | train |
SlabPHP/controllers | src/Feed.php | Feed.determineFeedType | protected function determineFeedType()
{
$feedType = strtolower($this->getRoutedParameter('feedType', static::TYPE_JSON));
if ($feedType == static::TYPE_JSON) {
$this->displayResolver = static::RESOLVER_JSON;
if (empty($this->callback))
{
$this->c... | php | protected function determineFeedType()
{
$feedType = strtolower($this->getRoutedParameter('feedType', static::TYPE_JSON));
if ($feedType == static::TYPE_JSON) {
$this->displayResolver = static::RESOLVER_JSON;
if (empty($this->callback))
{
$this->c... | [
"protected",
"function",
"determineFeedType",
"(",
")",
"{",
"$",
"feedType",
"=",
"strtolower",
"(",
"$",
"this",
"->",
"getRoutedParameter",
"(",
"'feedType'",
",",
"static",
"::",
"TYPE_JSON",
")",
")",
";",
"if",
"(",
"$",
"feedType",
"==",
"static",
"... | Determine feed type | [
"Determine",
"feed",
"type"
] | a1c4fded0265100a85904dd664b972a7f8687652 | https://github.com/SlabPHP/controllers/blob/a1c4fded0265100a85904dd664b972a7f8687652/src/Feed.php#L59-L84 | train |
covex-nn/JooS | src/JooS/Log/Log.php | Log.getWriters | public static function getWriters()
{
if (is_null(self::$_writers)) {
$writers = Config::getInstance("JooS_Log")->writers;
/* @var $writers JooS_Config */
if (!is_null($writers)) {
foreach ($writers->valueOf() as $name) {
$name = ucfirst(strtolower($name));
$className... | php | public static function getWriters()
{
if (is_null(self::$_writers)) {
$writers = Config::getInstance("JooS_Log")->writers;
/* @var $writers JooS_Config */
if (!is_null($writers)) {
foreach ($writers->valueOf() as $name) {
$name = ucfirst(strtolower($name));
$className... | [
"public",
"static",
"function",
"getWriters",
"(",
")",
"{",
"if",
"(",
"is_null",
"(",
"self",
"::",
"$",
"_writers",
")",
")",
"{",
"$",
"writers",
"=",
"Config",
"::",
"getInstance",
"(",
"\"JooS_Log\"",
")",
"->",
"writers",
";",
"/* @var $writers JooS... | Return log writers
@return array | [
"Return",
"log",
"writers"
] | 8dfb94edccecaf307787d4091ba7f20a674b7792 | https://github.com/covex-nn/JooS/blob/8dfb94edccecaf307787d4091ba7f20a674b7792/src/JooS/Log/Log.php#L45-L66 | train |
covex-nn/JooS | src/JooS/Log/Log.php | Log.addWriter | public static function addWriter(Log_Interface $writer)
{
if (is_null(self::$_writers)) {
self::$_writers = array();
}
$key = get_class($writer);
if (!isset(self::$_writers[$key])) {
self::$_writers[$key] = $writer;
$result = true;
} else {
$result = false;
}
... | php | public static function addWriter(Log_Interface $writer)
{
if (is_null(self::$_writers)) {
self::$_writers = array();
}
$key = get_class($writer);
if (!isset(self::$_writers[$key])) {
self::$_writers[$key] = $writer;
$result = true;
} else {
$result = false;
}
... | [
"public",
"static",
"function",
"addWriter",
"(",
"Log_Interface",
"$",
"writer",
")",
"{",
"if",
"(",
"is_null",
"(",
"self",
"::",
"$",
"_writers",
")",
")",
"{",
"self",
"::",
"$",
"_writers",
"=",
"array",
"(",
")",
";",
"}",
"$",
"key",
"=",
"... | Add new writer
@param Log_Interface $writer Log writer
@return boolean | [
"Add",
"new",
"writer"
] | 8dfb94edccecaf307787d4091ba7f20a674b7792 | https://github.com/covex-nn/JooS/blob/8dfb94edccecaf307787d4091ba7f20a674b7792/src/JooS/Log/Log.php#L75-L90 | train |
linpax/microphp-framework | src/cli/Console.php | Console.action | public function action($name)
{
$command = '\\App\\Consoles\\'.ucfirst($name).'ConsoleCommand';
$command = class_exists($command) ? $command : '\\Micro\\Cli\\Consoles\\'.ucfirst($name).'ConsoleCommand';
if (!class_exists($command)) {
throw new Exception('Command `'.$name.'` not ... | php | public function action($name)
{
$command = '\\App\\Consoles\\'.ucfirst($name).'ConsoleCommand';
$command = class_exists($command) ? $command : '\\Micro\\Cli\\Consoles\\'.ucfirst($name).'ConsoleCommand';
if (!class_exists($command)) {
throw new Exception('Command `'.$name.'` not ... | [
"public",
"function",
"action",
"(",
"$",
"name",
")",
"{",
"$",
"command",
"=",
"'\\\\App\\\\Consoles\\\\'",
".",
"ucfirst",
"(",
"$",
"name",
")",
".",
"'ConsoleCommand'",
";",
"$",
"command",
"=",
"class_exists",
"(",
"$",
"command",
")",
"?",
"$",
"c... | Run action of console command by name
@access public
@param string $name Command name
@return ResponseInterface
@throws \RuntimeException|\InvalidArgumentException|Exception | [
"Run",
"action",
"of",
"console",
"command",
"by",
"name"
] | 11f3370f3f64c516cce9b84ecd8276c6e9ae8df9 | https://github.com/linpax/microphp-framework/blob/11f3370f3f64c516cce9b84ecd8276c6e9ae8df9/src/cli/Console.php#L48-L68 | train |
damianociarla/DCSSecurityCoreBundle | src/Event/AuthenticatedTokenEvent.php | AuthenticatedTokenEvent.regenerateUsernamePasswordTokenWithRoles | public function regenerateUsernamePasswordTokenWithRoles(array $roles, $mergeWithExistingRoles = true)
{
$user = $this->token->getUser();
$credentials = $this->token->getCredentials();
$providerKey = $this->token->getProviderKey();
if ($mergeWithExistingRoles) {
$roles =... | php | public function regenerateUsernamePasswordTokenWithRoles(array $roles, $mergeWithExistingRoles = true)
{
$user = $this->token->getUser();
$credentials = $this->token->getCredentials();
$providerKey = $this->token->getProviderKey();
if ($mergeWithExistingRoles) {
$roles =... | [
"public",
"function",
"regenerateUsernamePasswordTokenWithRoles",
"(",
"array",
"$",
"roles",
",",
"$",
"mergeWithExistingRoles",
"=",
"true",
")",
"{",
"$",
"user",
"=",
"$",
"this",
"->",
"token",
"->",
"getUser",
"(",
")",
";",
"$",
"credentials",
"=",
"$... | Regenerate same instance of this token with another roles
@param array $roles
@param bool $mergeWithExistingRoles | [
"Regenerate",
"same",
"instance",
"of",
"this",
"token",
"with",
"another",
"roles"
] | cf061017674e6add1cb5b79389be6018f8722733 | https://github.com/damianociarla/DCSSecurityCoreBundle/blob/cf061017674e6add1cb5b79389be6018f8722733/src/Event/AuthenticatedTokenEvent.php#L47-L58 | train |
praxigento/mobi_mod_pv | Helper/Customer.php | Customer.canSeePv | public function canSeePv($gid = null)
{
$result = false;
if (is_null($gid)) {
$gid = $this->session->getCustomerGroupId();
}
if (!isset($this->cacheCanSeeByGid[$gid])) {
$item = $this->daoPvCustGroup->getById($gid);
if ($item) $result = (bool)$item... | php | public function canSeePv($gid = null)
{
$result = false;
if (is_null($gid)) {
$gid = $this->session->getCustomerGroupId();
}
if (!isset($this->cacheCanSeeByGid[$gid])) {
$item = $this->daoPvCustGroup->getById($gid);
if ($item) $result = (bool)$item... | [
"public",
"function",
"canSeePv",
"(",
"$",
"gid",
"=",
"null",
")",
"{",
"$",
"result",
"=",
"false",
";",
"if",
"(",
"is_null",
"(",
"$",
"gid",
")",
")",
"{",
"$",
"gid",
"=",
"$",
"this",
"->",
"session",
"->",
"getCustomerGroupId",
"(",
")",
... | Cached accessor for 'Can See PV' flag.
@param int|null $gid customer group ID, if 'null' - group for current customer is used.
@return bool | [
"Cached",
"accessor",
"for",
"Can",
"See",
"PV",
"flag",
"."
] | d1540b7e94264527006e8b9fa68904a72a63928e | https://github.com/praxigento/mobi_mod_pv/blob/d1540b7e94264527006e8b9fa68904a72a63928e/Helper/Customer.php#L34-L48 | train |
taylornetwork/make-html | src/HTMLGenerator.php | HTMLGenerator.makeLinks | public function makeLinks($text)
{
$pattern = '~(?xi)
(?:
((ht|f)tps?://) # scheme://
| # or
www\d{0,3}\. # "www.", "www1.", "www2." ... "www999."
| ... | php | public function makeLinks($text)
{
$pattern = '~(?xi)
(?:
((ht|f)tps?://) # scheme://
| # or
www\d{0,3}\. # "www.", "www1.", "www2." ... "www999."
| ... | [
"public",
"function",
"makeLinks",
"(",
"$",
"text",
")",
"{",
"$",
"pattern",
"=",
"'~(?xi)\n (?:\n ((ht|f)tps?://) # scheme://\n | # or\n www\\d{0,3}\\. # \"w... | Make the links clickable.
@param $text
@return string | [
"Make",
"the",
"links",
"clickable",
"."
] | 216308d5ba8c9d2412dc787fb6db1a837c20b820 | https://github.com/taylornetwork/make-html/blob/216308d5ba8c9d2412dc787fb6db1a837c20b820/src/HTMLGenerator.php#L80-L135 | train |
taylornetwork/make-html | src/HTMLGenerator.php | HTMLGenerator.makeHTML | public function makeHTML($text)
{
$html = $text;
if ($this->defaultActions['makeLinks']) {
$html = $this->makeLinks($html);
}
if ($this->defaultActions['convertLineEndings']) {
$html = $this->convertLineEndings($html);
}
return $html;
} | php | public function makeHTML($text)
{
$html = $text;
if ($this->defaultActions['makeLinks']) {
$html = $this->makeLinks($html);
}
if ($this->defaultActions['convertLineEndings']) {
$html = $this->convertLineEndings($html);
}
return $html;
} | [
"public",
"function",
"makeHTML",
"(",
"$",
"text",
")",
"{",
"$",
"html",
"=",
"$",
"text",
";",
"if",
"(",
"$",
"this",
"->",
"defaultActions",
"[",
"'makeLinks'",
"]",
")",
"{",
"$",
"html",
"=",
"$",
"this",
"->",
"makeLinks",
"(",
"$",
"html",... | The main function to use instead of calling everything individually.
@param $text
@return string | [
"The",
"main",
"function",
"to",
"use",
"instead",
"of",
"calling",
"everything",
"individually",
"."
] | 216308d5ba8c9d2412dc787fb6db1a837c20b820 | https://github.com/taylornetwork/make-html/blob/216308d5ba8c9d2412dc787fb6db1a837c20b820/src/HTMLGenerator.php#L156-L169 | train |
taylornetwork/make-html | src/HTMLGenerator.php | HTMLGenerator.generateTag | public function generateTag($tag, $attributes, $closeTag = true)
{
$openPattern = replace_variables($this->openTagPattern, compact('tag'));
$external = '';
if (in_array($tag, $this->voidTags) && !empty($this->voidTagPattern) && $this->voidTagPattern != $this->openTagPattern) {
$... | php | public function generateTag($tag, $attributes, $closeTag = true)
{
$openPattern = replace_variables($this->openTagPattern, compact('tag'));
$external = '';
if (in_array($tag, $this->voidTags) && !empty($this->voidTagPattern) && $this->voidTagPattern != $this->openTagPattern) {
$... | [
"public",
"function",
"generateTag",
"(",
"$",
"tag",
",",
"$",
"attributes",
",",
"$",
"closeTag",
"=",
"true",
")",
"{",
"$",
"openPattern",
"=",
"replace_variables",
"(",
"$",
"this",
"->",
"openTagPattern",
",",
"compact",
"(",
"'tag'",
")",
")",
";"... | Generate an HTML tag.
@param $tag
@param $attributes
@param $closeTag
@return string | [
"Generate",
"an",
"HTML",
"tag",
"."
] | 216308d5ba8c9d2412dc787fb6db1a837c20b820 | https://github.com/taylornetwork/make-html/blob/216308d5ba8c9d2412dc787fb6db1a837c20b820/src/HTMLGenerator.php#L180-L205 | train |
taylornetwork/make-html | src/HTMLGenerator.php | HTMLGenerator.closeTag | public function closeTag($tag)
{
if (!in_array($tag, $this->voidTags)) {
return replace_variables($this->closeTagPattern, compact('tag'));
}
return '';
} | php | public function closeTag($tag)
{
if (!in_array($tag, $this->voidTags)) {
return replace_variables($this->closeTagPattern, compact('tag'));
}
return '';
} | [
"public",
"function",
"closeTag",
"(",
"$",
"tag",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"tag",
",",
"$",
"this",
"->",
"voidTags",
")",
")",
"{",
"return",
"replace_variables",
"(",
"$",
"this",
"->",
"closeTagPattern",
",",
"compact",
"(",
... | Close an HTML tag.
@param $tag
@return string | [
"Close",
"an",
"HTML",
"tag",
"."
] | 216308d5ba8c9d2412dc787fb6db1a837c20b820 | https://github.com/taylornetwork/make-html/blob/216308d5ba8c9d2412dc787fb6db1a837c20b820/src/HTMLGenerator.php#L214-L221 | train |
jenskooij/cloudcontrol | src/cc/application/ApplicationRenderer.php | ApplicationRenderer.setCachingHeaders | public function setCachingHeaders($intervalString = CachableBaseComponent::DEFAULT_MAXAGE)
{
$expires = new \DateTime();
$interval = new \DateInterval($intervalString);
$maxAge = date_create('@0')->add($interval)->getTimestamp();
$expires = $expires->add($interval);
ResponseH... | php | public function setCachingHeaders($intervalString = CachableBaseComponent::DEFAULT_MAXAGE)
{
$expires = new \DateTime();
$interval = new \DateInterval($intervalString);
$maxAge = date_create('@0')->add($interval)->getTimestamp();
$expires = $expires->add($interval);
ResponseH... | [
"public",
"function",
"setCachingHeaders",
"(",
"$",
"intervalString",
"=",
"CachableBaseComponent",
"::",
"DEFAULT_MAXAGE",
")",
"{",
"$",
"expires",
"=",
"new",
"\\",
"DateTime",
"(",
")",
";",
"$",
"interval",
"=",
"new",
"\\",
"DateInterval",
"(",
"$",
"... | Set the default caching of pages
@param string $intervalString
@throws \Exception | [
"Set",
"the",
"default",
"caching",
"of",
"pages"
] | 76e5d9ac8f9c50d06d39a995d13cc03742536548 | https://github.com/jenskooij/cloudcontrol/blob/76e5d9ac8f9c50d06d39a995d13cc03742536548/src/cc/application/ApplicationRenderer.php#L67-L76 | train |
jenskooij/cloudcontrol | src/cc/application/ApplicationRenderer.php | ApplicationRenderer.setNotCachingHeaders | public function setNotCachingHeaders()
{
ResponseHeaders::add(ResponseHeaders::HEADER_CACHE_CONTROL, ResponseHeaders::HEADER_CACHE_CONTROL_CONTENT_NO_STORE_NO_CACHE_MUST_REVALIDATE_MAX_AGE_0);
ResponseHeaders::add(ResponseHeaders::HEADER_PRAGMA, ResponseHeaders::HEADER_PRAGMA_CONTENT_NO_CACHE);
... | php | public function setNotCachingHeaders()
{
ResponseHeaders::add(ResponseHeaders::HEADER_CACHE_CONTROL, ResponseHeaders::HEADER_CACHE_CONTROL_CONTENT_NO_STORE_NO_CACHE_MUST_REVALIDATE_MAX_AGE_0);
ResponseHeaders::add(ResponseHeaders::HEADER_PRAGMA, ResponseHeaders::HEADER_PRAGMA_CONTENT_NO_CACHE);
... | [
"public",
"function",
"setNotCachingHeaders",
"(",
")",
"{",
"ResponseHeaders",
"::",
"add",
"(",
"ResponseHeaders",
"::",
"HEADER_CACHE_CONTROL",
",",
"ResponseHeaders",
"::",
"HEADER_CACHE_CONTROL_CONTENT_NO_STORE_NO_CACHE_MUST_REVALIDATE_MAX_AGE_0",
")",
";",
"ResponseHeader... | Set non caching
@throws \Exception | [
"Set",
"non",
"caching"
] | 76e5d9ac8f9c50d06d39a995d13cc03742536548 | https://github.com/jenskooij/cloudcontrol/blob/76e5d9ac8f9c50d06d39a995d13cc03742536548/src/cc/application/ApplicationRenderer.php#L82-L86 | train |
koolkode/meta | src/Annotation/AnnotationLexer.php | AnnotationLexer.tokenize | public function tokenize($input)
{
$tokens = [];
$exp = ltrim($input);
for($length = strlen($exp), $i = 0; $i < $length; $i++)
{
if(trim($exp[$i]) == '')
{
continue;
}
if(NULL !== ($token = $this->getTerminalToken($exp, $i)))
{
$tokens[] = $token;
continue;
}
if... | php | public function tokenize($input)
{
$tokens = [];
$exp = ltrim($input);
for($length = strlen($exp), $i = 0; $i < $length; $i++)
{
if(trim($exp[$i]) == '')
{
continue;
}
if(NULL !== ($token = $this->getTerminalToken($exp, $i)))
{
$tokens[] = $token;
continue;
}
if... | [
"public",
"function",
"tokenize",
"(",
"$",
"input",
")",
"{",
"$",
"tokens",
"=",
"[",
"]",
";",
"$",
"exp",
"=",
"ltrim",
"(",
"$",
"input",
")",
";",
"for",
"(",
"$",
"length",
"=",
"strlen",
"(",
"$",
"exp",
")",
",",
"$",
"i",
"=",
"0",
... | Tokenize the given source string into annotation tokens and returns
the created token sequence.
@param string $input
@return AnnotationTokenSequence | [
"Tokenize",
"the",
"given",
"source",
"string",
"into",
"annotation",
"tokens",
"and",
"returns",
"the",
"created",
"token",
"sequence",
"."
] | 339db24d3ce461190f552c96e243bca21010f360 | https://github.com/koolkode/meta/blob/339db24d3ce461190f552c96e243bca21010f360/src/Annotation/AnnotationLexer.php#L61-L116 | train |
koolkode/meta | src/Annotation/AnnotationLexer.php | AnnotationLexer.getStringToken | protected function getStringToken($exp, $length, & $i)
{
if($exp[$i] == '"' || $exp[$i] == "'")
{
$delim = $exp[$i++];
$buffer = '';
$terminated = false;
$escaped = false;
for(; $i < $length; $i++)
{
if($exp[$i] == '\\')
{
$escaped = !$escaped;
}
elseif($exp[$i] == $d... | php | protected function getStringToken($exp, $length, & $i)
{
if($exp[$i] == '"' || $exp[$i] == "'")
{
$delim = $exp[$i++];
$buffer = '';
$terminated = false;
$escaped = false;
for(; $i < $length; $i++)
{
if($exp[$i] == '\\')
{
$escaped = !$escaped;
}
elseif($exp[$i] == $d... | [
"protected",
"function",
"getStringToken",
"(",
"$",
"exp",
",",
"$",
"length",
",",
"&",
"$",
"i",
")",
"{",
"if",
"(",
"$",
"exp",
"[",
"$",
"i",
"]",
"==",
"'\"'",
"||",
"$",
"exp",
"[",
"$",
"i",
"]",
"==",
"\"'\"",
")",
"{",
"$",
"delim"... | Reads a string token from the source expression.
@param string $exp
@param integer $length
@param integer $i
@return AnnotationToken <code>NULL</code> if no string token was found. | [
"Reads",
"a",
"string",
"token",
"from",
"the",
"source",
"expression",
"."
] | 339db24d3ce461190f552c96e243bca21010f360 | https://github.com/koolkode/meta/blob/339db24d3ce461190f552c96e243bca21010f360/src/Annotation/AnnotationLexer.php#L164-L199 | train |
koolkode/meta | src/Annotation/AnnotationLexer.php | AnnotationLexer.getIntegerToken | protected function getIntegerToken(array $m)
{
$sign = (isset($m['sign']) && $m['sign'] == '-') ? -1 : 1;
if(isset($m['oct']) && $m['oct'] != '')
{
return new AnnotationToken(AnnotationToken::T_INTEGER, $sign * intval($m['oct'], 8));
}
if(isset($m['bin']) && $m['bin'] != '')
{
return new Annota... | php | protected function getIntegerToken(array $m)
{
$sign = (isset($m['sign']) && $m['sign'] == '-') ? -1 : 1;
if(isset($m['oct']) && $m['oct'] != '')
{
return new AnnotationToken(AnnotationToken::T_INTEGER, $sign * intval($m['oct'], 8));
}
if(isset($m['bin']) && $m['bin'] != '')
{
return new Annota... | [
"protected",
"function",
"getIntegerToken",
"(",
"array",
"$",
"m",
")",
"{",
"$",
"sign",
"=",
"(",
"isset",
"(",
"$",
"m",
"[",
"'sign'",
"]",
")",
"&&",
"$",
"m",
"[",
"'sign'",
"]",
"==",
"'-'",
")",
"?",
"-",
"1",
":",
"1",
";",
"if",
"(... | Builds an integer token from the given match of PATTERN_INTEGER.
@param array<string> $m
@return AnnotationToken | [
"Builds",
"an",
"integer",
"token",
"from",
"the",
"given",
"match",
"of",
"PATTERN_INTEGER",
"."
] | 339db24d3ce461190f552c96e243bca21010f360 | https://github.com/koolkode/meta/blob/339db24d3ce461190f552c96e243bca21010f360/src/Annotation/AnnotationLexer.php#L218-L238 | train |
Linkvalue-Interne/MajoraFrameworkExtraBundle | src/Majora/Framework/Log/LoggableTrait.php | LoggableTrait.registerLogger | public function registerLogger(LoggerInterface $logger = null, $debug = false)
{
$this->logger = $logger ?: new NullLogger();
$this->debug = $debug;
return $this;
} | php | public function registerLogger(LoggerInterface $logger = null, $debug = false)
{
$this->logger = $logger ?: new NullLogger();
$this->debug = $debug;
return $this;
} | [
"public",
"function",
"registerLogger",
"(",
"LoggerInterface",
"$",
"logger",
"=",
"null",
",",
"$",
"debug",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"logger",
"=",
"$",
"logger",
"?",
":",
"new",
"NullLogger",
"(",
")",
";",
"$",
"this",
"->",
"... | register a logger and eventually debug mode into Loggable class
@param LoggerInterface $logger
@param boolean $debug
@return self | [
"register",
"a",
"logger",
"and",
"eventually",
"debug",
"mode",
"into",
"Loggable",
"class"
] | 6f368380cfc39d27fafb0844e9a53b4d86d7c034 | https://github.com/Linkvalue-Interne/MajoraFrameworkExtraBundle/blob/6f368380cfc39d27fafb0844e9a53b4d86d7c034/src/Majora/Framework/Log/LoggableTrait.php#L31-L37 | train |
jabernardo/lollipop-php | Library/SQL/BuilderTrait.php | BuilderTrait.insert | public function insert($fields) {
// Create temporary variables for
// tokenized parameter
$_tmp_fields = [];
$_tmp_values = [];
if (is_array($fields)) {
foreach ($fields as $key => $value) {
array_push($_tmp_fields, $key);
... | php | public function insert($fields) {
// Create temporary variables for
// tokenized parameter
$_tmp_fields = [];
$_tmp_values = [];
if (is_array($fields)) {
foreach ($fields as $key => $value) {
array_push($_tmp_fields, $key);
... | [
"public",
"function",
"insert",
"(",
"$",
"fields",
")",
"{",
"// Create temporary variables for \r",
"// tokenized parameter\r",
"$",
"_tmp_fields",
"=",
"[",
"]",
";",
"$",
"_tmp_values",
"=",
"[",
"]",
";",
"if",
"(",
"is_array",
"(",
"$",
"fields",
")",
... | Insert data to table
@param array $fields Fields to put in data
@return mixed Returns $this when insert succeed and false on failure | [
"Insert",
"data",
"to",
"table"
] | 004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5 | https://github.com/jabernardo/lollipop-php/blob/004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5/Library/SQL/BuilderTrait.php#L333-L365 | train |
jabernardo/lollipop-php | Library/SQL/BuilderTrait.php | BuilderTrait.update | public function update($fields) {
if (is_array($fields)) {
foreach ($fields as $key => $value) {
if (is_string($value)) {
array_push($this->_updates, $key . ' = \'' . addslashes($value) . '\'');
} else {
array_push($this->... | php | public function update($fields) {
if (is_array($fields)) {
foreach ($fields as $key => $value) {
if (is_string($value)) {
array_push($this->_updates, $key . ' = \'' . addslashes($value) . '\'');
} else {
array_push($this->... | [
"public",
"function",
"update",
"(",
"$",
"fields",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"fields",
")",
")",
"{",
"foreach",
"(",
"$",
"fields",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"value",
")",... | Update data from table
@param array $fields Fields to put in data
@return mixed Returns $this when insert succeed and false on failure | [
"Update",
"data",
"from",
"table"
] | 004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5 | https://github.com/jabernardo/lollipop-php/blob/004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5/Library/SQL/BuilderTrait.php#L407-L439 | train |
jabernardo/lollipop-php | Library/SQL/BuilderTrait.php | BuilderTrait.asc | public function asc($fields) {
if (is_array($fields)) {
$this->_order = ' ORDER BY ' . implode($fields, ', ') . ' ASC';
} else {
$this->_order = ' ORDER BY ' . $fields . ' ASC';
}
return $this;
} | php | public function asc($fields) {
if (is_array($fields)) {
$this->_order = ' ORDER BY ' . implode($fields, ', ') . ' ASC';
} else {
$this->_order = ' ORDER BY ' . $fields . ' ASC';
}
return $this;
} | [
"public",
"function",
"asc",
"(",
"$",
"fields",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"fields",
")",
")",
"{",
"$",
"this",
"->",
"_order",
"=",
"' ORDER BY '",
".",
"implode",
"(",
"$",
"fields",
",",
"', '",
")",
".",
"' ASC'",
";",
"}",
... | Order by ascending
@param string/array $fields | [
"Order",
"by",
"ascending"
] | 004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5 | https://github.com/jabernardo/lollipop-php/blob/004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5/Library/SQL/BuilderTrait.php#L752-L760 | train |
jabernardo/lollipop-php | Library/SQL/BuilderTrait.php | BuilderTrait.desc | public function desc($fields) {
if (is_array($fields)) {
$this->_order = ' ORDER BY ' . implode($fields, ', ') . ' DESC';
} else {
$this->_order = ' ORDER BY ' . $fields . ' DESC';
}
return $this;
} | php | public function desc($fields) {
if (is_array($fields)) {
$this->_order = ' ORDER BY ' . implode($fields, ', ') . ' DESC';
} else {
$this->_order = ' ORDER BY ' . $fields . ' DESC';
}
return $this;
} | [
"public",
"function",
"desc",
"(",
"$",
"fields",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"fields",
")",
")",
"{",
"$",
"this",
"->",
"_order",
"=",
"' ORDER BY '",
".",
"implode",
"(",
"$",
"fields",
",",
"', '",
")",
".",
"' DESC'",
";",
"}",
... | Order by descending
@param string/array $fields | [
"Order",
"by",
"descending"
] | 004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5 | https://github.com/jabernardo/lollipop-php/blob/004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5/Library/SQL/BuilderTrait.php#L768-L776 | train |
jabernardo/lollipop-php | Library/SQL/BuilderTrait.php | BuilderTrait.leftJoin | public function leftJoin($table, $field1, $operator, $field2) {
array_push($this->_joins, ' LEFT JOIN ' . $table . ' ON ' . $field1 . ' ' . $operator . ' ' . $field2 . ' ');
return $this;
} | php | public function leftJoin($table, $field1, $operator, $field2) {
array_push($this->_joins, ' LEFT JOIN ' . $table . ' ON ' . $field1 . ' ' . $operator . ' ' . $field2 . ' ');
return $this;
} | [
"public",
"function",
"leftJoin",
"(",
"$",
"table",
",",
"$",
"field1",
",",
"$",
"operator",
",",
"$",
"field2",
")",
"{",
"array_push",
"(",
"$",
"this",
"->",
"_joins",
",",
"' LEFT JOIN '",
".",
"$",
"table",
".",
"' ON '",
".",
"$",
"field1",
"... | Left Join Tables
@param string $table Table name
@param string $field1 Table.Fieldname
@param string $operator Operator
@param string $field2 Table.Fieldname
@example leftJoin('users', 'users.id', '=', 'login.id') | [
"Left",
"Join",
"Tables"
] | 004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5 | https://github.com/jabernardo/lollipop-php/blob/004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5/Library/SQL/BuilderTrait.php#L822-L826 | train |
jabernardo/lollipop-php | Library/SQL/BuilderTrait.php | BuilderTrait.rightJoin | public function rightJoin($table, $field1, $operator, $field2) {
array_push($this->_joins, ' RIGHT JOIN ' . $table . ' ON ' . $field1 . ' ' . $operator . ' ' . $field2 . ' ');
return $this;
} | php | public function rightJoin($table, $field1, $operator, $field2) {
array_push($this->_joins, ' RIGHT JOIN ' . $table . ' ON ' . $field1 . ' ' . $operator . ' ' . $field2 . ' ');
return $this;
} | [
"public",
"function",
"rightJoin",
"(",
"$",
"table",
",",
"$",
"field1",
",",
"$",
"operator",
",",
"$",
"field2",
")",
"{",
"array_push",
"(",
"$",
"this",
"->",
"_joins",
",",
"' RIGHT JOIN '",
".",
"$",
"table",
".",
"' ON '",
".",
"$",
"field1",
... | Right Join Tables
@param string $table Table name
@param string $field1 Table.Fieldname
@param string $operator Operator
@param string $field2 Table.Fieldname
@example rightJoin('users', 'users.id', '=', 'login.id') | [
"Right",
"Join",
"Tables"
] | 004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5 | https://github.com/jabernardo/lollipop-php/blob/004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5/Library/SQL/BuilderTrait.php#L839-L843 | train |
agentmedia/phine-core | src/Core/Modules/Backend/SiteForm.php | SiteForm.AddSitemapActiveField | private function AddSitemapActiveField()
{
$name = 'SitemapActive';
$field = new Checkbox($name);
if (!$this->site->Exists() || $this->site->GetSitemapActive())
{
$field->SetChecked();
}
$this->AddField($field);
} | php | private function AddSitemapActiveField()
{
$name = 'SitemapActive';
$field = new Checkbox($name);
if (!$this->site->Exists() || $this->site->GetSitemapActive())
{
$field->SetChecked();
}
$this->AddField($field);
} | [
"private",
"function",
"AddSitemapActiveField",
"(",
")",
"{",
"$",
"name",
"=",
"'SitemapActive'",
";",
"$",
"field",
"=",
"new",
"Checkbox",
"(",
"$",
"name",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"site",
"->",
"Exists",
"(",
")",
"||",
"$",... | Adds the sitemap active checkbox | [
"Adds",
"the",
"sitemap",
"active",
"checkbox"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Modules/Backend/SiteForm.php#L92-L101 | train |
agentmedia/phine-core | src/Core/Modules/Backend/SiteForm.php | SiteForm.OnSuccess | protected function OnSuccess()
{
$action = Action::Update();
if (!$this->site->Exists())
{
$action = Action::Create();
$this->site->SetUser(self::Guard()->GetUser());
}
$this->site->SetName($this->Value('Name'));
$this->site->SetUrl($this->Valu... | php | protected function OnSuccess()
{
$action = Action::Update();
if (!$this->site->Exists())
{
$action = Action::Create();
$this->site->SetUser(self::Guard()->GetUser());
}
$this->site->SetName($this->Value('Name'));
$this->site->SetUrl($this->Valu... | [
"protected",
"function",
"OnSuccess",
"(",
")",
"{",
"$",
"action",
"=",
"Action",
"::",
"Update",
"(",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"site",
"->",
"Exists",
"(",
")",
")",
"{",
"$",
"action",
"=",
"Action",
"::",
"Create",
"(",
")... | Saves the site | [
"Saves",
"the",
"site"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Modules/Backend/SiteForm.php#L115-L137 | train |
phpffcms/ffcms-core | src/I18n/Translate.php | Translate.get | public function get(?string $index, string $text, ?array $params = null)
{
if (App::$Request->getLanguage() !== App::$Properties->get('baseLanguage')) {
if ($index && !Arr::in($index, $this->indexes)) {
$this->cached = Arr::merge($this->cached, $this->load($index));
... | php | public function get(?string $index, string $text, ?array $params = null)
{
if (App::$Request->getLanguage() !== App::$Properties->get('baseLanguage')) {
if ($index && !Arr::in($index, $this->indexes)) {
$this->cached = Arr::merge($this->cached, $this->load($index));
... | [
"public",
"function",
"get",
"(",
"?",
"string",
"$",
"index",
",",
"string",
"$",
"text",
",",
"?",
"array",
"$",
"params",
"=",
"null",
")",
"{",
"if",
"(",
"App",
"::",
"$",
"Request",
"->",
"getLanguage",
"(",
")",
"!==",
"App",
"::",
"$",
"P... | Get internalization of current text from i18n
@param string $index
@param string $text
@param array|null $params
@return string | [
"Get",
"internalization",
"of",
"current",
"text",
"from",
"i18n"
] | 44a309553ef9f115ccfcfd71f2ac6e381c612082 | https://github.com/phpffcms/ffcms-core/blob/44a309553ef9f115ccfcfd71f2ac6e381c612082/src/I18n/Translate.php#L43-L62 | train |
phpffcms/ffcms-core | src/I18n/Translate.php | Translate.translate | public function translate(string $text, array $params = null)
{
$index = null;
$namespace = 'Apps\Controller\\' . env_name . '\\';
foreach (@debug_backtrace() as $caller) {
if (isset($caller['class']) && Str::startsWith($namespace, $caller['class'])) {
$index = St... | php | public function translate(string $text, array $params = null)
{
$index = null;
$namespace = 'Apps\Controller\\' . env_name . '\\';
foreach (@debug_backtrace() as $caller) {
if (isset($caller['class']) && Str::startsWith($namespace, $caller['class'])) {
$index = St... | [
"public",
"function",
"translate",
"(",
"string",
"$",
"text",
",",
"array",
"$",
"params",
"=",
"null",
")",
"{",
"$",
"index",
"=",
"null",
";",
"$",
"namespace",
"=",
"'Apps\\Controller\\\\'",
".",
"env_name",
".",
"'\\\\'",
";",
"foreach",
"(",
"@",
... | Get internalization based on called controller
@param string $text
@param array $params
@return string | [
"Get",
"internalization",
"based",
"on",
"called",
"controller"
] | 44a309553ef9f115ccfcfd71f2ac6e381c612082 | https://github.com/phpffcms/ffcms-core/blob/44a309553ef9f115ccfcfd71f2ac6e381c612082/src/I18n/Translate.php#L70-L80 | train |
phpffcms/ffcms-core | src/I18n/Translate.php | Translate.load | protected function load(string $index): ?array
{
$file = root . '/I18n/' . env_name . '/' . App::$Request->getLanguage() . '/' . $index . '.php';
if (!File::exist($file)) {
return [];
}
return require($file);
} | php | protected function load(string $index): ?array
{
$file = root . '/I18n/' . env_name . '/' . App::$Request->getLanguage() . '/' . $index . '.php';
if (!File::exist($file)) {
return [];
}
return require($file);
} | [
"protected",
"function",
"load",
"(",
"string",
"$",
"index",
")",
":",
"?",
"array",
"{",
"$",
"file",
"=",
"root",
".",
"'/I18n/'",
".",
"env_name",
".",
"'/'",
".",
"App",
"::",
"$",
"Request",
"->",
"getLanguage",
"(",
")",
".",
"'/'",
".",
"$"... | Load locale file from local storage
@param string $index
@return array|null | [
"Load",
"locale",
"file",
"from",
"local",
"storage"
] | 44a309553ef9f115ccfcfd71f2ac6e381c612082 | https://github.com/phpffcms/ffcms-core/blob/44a309553ef9f115ccfcfd71f2ac6e381c612082/src/I18n/Translate.php#L87-L95 | train |
phpffcms/ffcms-core | src/I18n/Translate.php | Translate.append | public function append($path): bool
{
$path = Normalize::diskFullPath($path);
// check if file exist
if (!File::exist($path)) {
return false;
}
// load file translations
$addTranslation = require($path);
if (!Any::isArray($addTranslation)) {
... | php | public function append($path): bool
{
$path = Normalize::diskFullPath($path);
// check if file exist
if (!File::exist($path)) {
return false;
}
// load file translations
$addTranslation = require($path);
if (!Any::isArray($addTranslation)) {
... | [
"public",
"function",
"append",
"(",
"$",
"path",
")",
":",
"bool",
"{",
"$",
"path",
"=",
"Normalize",
"::",
"diskFullPath",
"(",
"$",
"path",
")",
";",
"// check if file exist",
"if",
"(",
"!",
"File",
"::",
"exist",
"(",
"$",
"path",
")",
")",
"{"... | Append translation data from exist full path
@param string $path
@return bool | [
"Append",
"translation",
"data",
"from",
"exist",
"full",
"path"
] | 44a309553ef9f115ccfcfd71f2ac6e381c612082 | https://github.com/phpffcms/ffcms-core/blob/44a309553ef9f115ccfcfd71f2ac6e381c612082/src/I18n/Translate.php#L102-L119 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.