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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
Programie/PHPCurl | src/main/php/com/selfcoders/phpcurl/CurlMulti.php | CurlMulti.addInstance | public function addInstance(Curl $curlInstance, $name = null)
{
if ($name) {
$this->curlInstances[$name] = $curlInstance;
} else {
$this->curlInstances[] = $curlInstance;
}
end($this->curlInstances);
return key($this->curlInstances);
} | php | public function addInstance(Curl $curlInstance, $name = null)
{
if ($name) {
$this->curlInstances[$name] = $curlInstance;
} else {
$this->curlInstances[] = $curlInstance;
}
end($this->curlInstances);
return key($this->curlInstances);
} | [
"public",
"function",
"addInstance",
"(",
"Curl",
"$",
"curlInstance",
",",
"$",
"name",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"name",
")",
"{",
"$",
"this",
"->",
"curlInstances",
"[",
"$",
"name",
"]",
"=",
"$",
"curlInstance",
";",
"}",
"else",
... | Add a Curl instance to this Curl Multi instance
@param Curl $curlInstance Instance of Curl
@param string|null $name An optional name which will be used as key in the instance array
@return mixed The name of the instance (same as $name or the index in array if name is not given) | [
"Add",
"a",
"Curl",
"instance",
"to",
"this",
"Curl",
"Multi",
"instance"
] | 54ef8bba19e87654906f74b14646c1f322ea7241 | https://github.com/Programie/PHPCurl/blob/54ef8bba19e87654906f74b14646c1f322ea7241/src/main/php/com/selfcoders/phpcurl/CurlMulti.php#L19-L29 | train |
Programie/PHPCurl | src/main/php/com/selfcoders/phpcurl/CurlMulti.php | CurlMulti.setOpt | public function setOpt($option, $value)
{
/**
* @var Curl $instance
*/
foreach ($this->curlInstances as $instance) {
$instance->setOpt($option, $value);
}
} | php | public function setOpt($option, $value)
{
/**
* @var Curl $instance
*/
foreach ($this->curlInstances as $instance) {
$instance->setOpt($option, $value);
}
} | [
"public",
"function",
"setOpt",
"(",
"$",
"option",
",",
"$",
"value",
")",
"{",
"/**\n * @var Curl $instance\n */",
"foreach",
"(",
"$",
"this",
"->",
"curlInstances",
"as",
"$",
"instance",
")",
"{",
"$",
"instance",
"->",
"setOpt",
"(",
"$",... | Set the given cURL option for all previously added cURL instances.
@param int $option The cURL option to set (CURLOPT_* constants)
@param mixed $value The new value for the option
@see curl_setopt | [
"Set",
"the",
"given",
"cURL",
"option",
"for",
"all",
"previously",
"added",
"cURL",
"instances",
"."
] | 54ef8bba19e87654906f74b14646c1f322ea7241 | https://github.com/Programie/PHPCurl/blob/54ef8bba19e87654906f74b14646c1f322ea7241/src/main/php/com/selfcoders/phpcurl/CurlMulti.php#L39-L47 | train |
Programie/PHPCurl | src/main/php/com/selfcoders/phpcurl/CurlMulti.php | CurlMulti.subExec | private function subExec($instances, $retryCount = 0, $retryWait = 0)
{
$curlMultiInstance = curl_multi_init();
foreach ($instances as $name => $curlInstance) {
curl_multi_add_handle($curlMultiInstance, $curlInstance->getHandle());
}
do {
curl_multi_exec($cu... | php | private function subExec($instances, $retryCount = 0, $retryWait = 0)
{
$curlMultiInstance = curl_multi_init();
foreach ($instances as $name => $curlInstance) {
curl_multi_add_handle($curlMultiInstance, $curlInstance->getHandle());
}
do {
curl_multi_exec($cu... | [
"private",
"function",
"subExec",
"(",
"$",
"instances",
",",
"$",
"retryCount",
"=",
"0",
",",
"$",
"retryWait",
"=",
"0",
")",
"{",
"$",
"curlMultiInstance",
"=",
"curl_multi_init",
"(",
")",
";",
"foreach",
"(",
"$",
"instances",
"as",
"$",
"name",
... | Execute the requests of all given Curl instances
@param Curl[] $instances An array of Curl instances (key = name of instance)
@param int $retryCount The maximum number of retries
@param int $retryWait Time in seconds to wait between each try | [
"Execute",
"the",
"requests",
"of",
"all",
"given",
"Curl",
"instances"
] | 54ef8bba19e87654906f74b14646c1f322ea7241 | https://github.com/Programie/PHPCurl/blob/54ef8bba19e87654906f74b14646c1f322ea7241/src/main/php/com/selfcoders/phpcurl/CurlMulti.php#L73-L110 | train |
Programie/PHPCurl | src/main/php/com/selfcoders/phpcurl/CurlMulti.php | CurlMulti.exec | public function exec($maxRequests = null, $retryCount = 0, $retryWait = 0, $waitBetweenChunks = 0)
{
if ($maxRequests == null or $maxRequests <= 0) {
$this->subExec($this->curlInstances, $retryCount, $retryWait);
return;
}
$instanceChunks = array_chunk($this->curlIns... | php | public function exec($maxRequests = null, $retryCount = 0, $retryWait = 0, $waitBetweenChunks = 0)
{
if ($maxRequests == null or $maxRequests <= 0) {
$this->subExec($this->curlInstances, $retryCount, $retryWait);
return;
}
$instanceChunks = array_chunk($this->curlIns... | [
"public",
"function",
"exec",
"(",
"$",
"maxRequests",
"=",
"null",
",",
"$",
"retryCount",
"=",
"0",
",",
"$",
"retryWait",
"=",
"0",
",",
"$",
"waitBetweenChunks",
"=",
"0",
")",
"{",
"if",
"(",
"$",
"maxRequests",
"==",
"null",
"or",
"$",
"maxRequ... | Execute the requests of all added Curl instances
@param int|null $maxRequests The maximum number of concurrent requests (null = infinite)
@param int $retryCount The maximum number of retries
@param int $retryWait Time in seconds to wait between each try
@param int $waitBetweenChunks Time in seconds to wait between eac... | [
"Execute",
"the",
"requests",
"of",
"all",
"added",
"Curl",
"instances"
] | 54ef8bba19e87654906f74b14646c1f322ea7241 | https://github.com/Programie/PHPCurl/blob/54ef8bba19e87654906f74b14646c1f322ea7241/src/main/php/com/selfcoders/phpcurl/CurlMulti.php#L120-L137 | train |
Programie/PHPCurl | src/main/php/com/selfcoders/phpcurl/CurlMulti.php | CurlMulti.removeInstance | public function removeInstance($instanceName)
{
$curlInstance = $this->curlInstances[$instanceName];
unset($this->curlInstances[$instanceName]);
return $curlInstance;
} | php | public function removeInstance($instanceName)
{
$curlInstance = $this->curlInstances[$instanceName];
unset($this->curlInstances[$instanceName]);
return $curlInstance;
} | [
"public",
"function",
"removeInstance",
"(",
"$",
"instanceName",
")",
"{",
"$",
"curlInstance",
"=",
"$",
"this",
"->",
"curlInstances",
"[",
"$",
"instanceName",
"]",
";",
"unset",
"(",
"$",
"this",
"->",
"curlInstances",
"[",
"$",
"instanceName",
"]",
"... | Remove the specified instance given by the name
@param mixed $instanceName The name of the instances as returned by addInstance
@return Curl The removed instance | [
"Remove",
"the",
"specified",
"instance",
"given",
"by",
"the",
"name"
] | 54ef8bba19e87654906f74b14646c1f322ea7241 | https://github.com/Programie/PHPCurl/blob/54ef8bba19e87654906f74b14646c1f322ea7241/src/main/php/com/selfcoders/phpcurl/CurlMulti.php#L194-L201 | train |
Programie/PHPCurl | src/main/php/com/selfcoders/phpcurl/CurlMulti.php | CurlMulti.retryFailed | public function retryFailed($curlInstances)
{
$failed = 0;
$curlMultiInstance = new CurlMulti();
/**
* @var $curlInstance Curl
*/
foreach ($curlInstances as $curlInstance) {
if ($curlInstance->isSuccessful()) {
continue;
}
... | php | public function retryFailed($curlInstances)
{
$failed = 0;
$curlMultiInstance = new CurlMulti();
/**
* @var $curlInstance Curl
*/
foreach ($curlInstances as $curlInstance) {
if ($curlInstance->isSuccessful()) {
continue;
}
... | [
"public",
"function",
"retryFailed",
"(",
"$",
"curlInstances",
")",
"{",
"$",
"failed",
"=",
"0",
";",
"$",
"curlMultiInstance",
"=",
"new",
"CurlMulti",
"(",
")",
";",
"/**\n * @var $curlInstance Curl\n */",
"foreach",
"(",
"$",
"curlInstances",
... | Retry all failed requests of the given array of Curl instances.
@param array $curlInstances An array of Curl instances of which failed ones should be retried
@return int The number of failed requests which were retried. | [
"Retry",
"all",
"failed",
"requests",
"of",
"the",
"given",
"array",
"of",
"Curl",
"instances",
"."
] | 54ef8bba19e87654906f74b14646c1f322ea7241 | https://github.com/Programie/PHPCurl/blob/54ef8bba19e87654906f74b14646c1f322ea7241/src/main/php/com/selfcoders/phpcurl/CurlMulti.php#L210-L234 | train |
guni12/comment | src/Comments/ShowOneService.php | ShowOneService.getDecode | public function getDecode(Comm $item, $lead = null)
{
$comt = json_decode($item->comment);
if ($comt->frontmatter->title) {
$til = $comt->frontmatter->title;
} else {
$til = $item->title;
}
$comt = $comt->text;
if ($lead) {
return '... | php | public function getDecode(Comm $item, $lead = null)
{
$comt = json_decode($item->comment);
if ($comt->frontmatter->title) {
$til = $comt->frontmatter->title;
} else {
$til = $item->title;
}
$comt = $comt->text;
if ($lead) {
return '... | [
"public",
"function",
"getDecode",
"(",
"Comm",
"$",
"item",
",",
"$",
"lead",
"=",
"null",
")",
"{",
"$",
"comt",
"=",
"json_decode",
"(",
"$",
"item",
"->",
"comment",
")",
";",
"if",
"(",
"$",
"comt",
"->",
"frontmatter",
"->",
"title",
")",
"{"... | Returns json_decoded title and text
If lead text, headline is larger font
@param object $item
@return string htmlcode | [
"Returns",
"json_decoded",
"title",
"and",
"text",
"If",
"lead",
"text",
"headline",
"is",
"larger",
"font"
] | f9c2f3e2093fea414867f548c5f5e07f96c55bfd | https://github.com/guni12/comment/blob/f9c2f3e2093fea414867f548c5f5e07f96c55bfd/src/Comments/ShowOneService.php#L107-L120 | train |
guni12/comment | src/Comments/ShowOneService.php | ShowOneService.getEdit | public function getEdit($isadmin, $userid, $commid, $htmlcomment)
{
$update = $this->setUrlCreator("comm/update");
if ($isadmin || $userid == $this->sess['id']) {
$edit = '<p><a href="' . $update . '/' . $commid . '">Redigera</a> | ';
$edit .= $htmlcomment;
} else {
... | php | public function getEdit($isadmin, $userid, $commid, $htmlcomment)
{
$update = $this->setUrlCreator("comm/update");
if ($isadmin || $userid == $this->sess['id']) {
$edit = '<p><a href="' . $update . '/' . $commid . '">Redigera</a> | ';
$edit .= $htmlcomment;
} else {
... | [
"public",
"function",
"getEdit",
"(",
"$",
"isadmin",
",",
"$",
"userid",
",",
"$",
"commid",
",",
"$",
"htmlcomment",
")",
"{",
"$",
"update",
"=",
"$",
"this",
"->",
"setUrlCreator",
"(",
"\"comm/update\"",
")",
";",
"if",
"(",
"$",
"isadmin",
"||",
... | If loggedin allowed to edit
@param boolean $isadmin
@param string $userid
@param string $commid
@param string $htmlcomment, link
@return string htmlcode | [
"If",
"loggedin",
"allowed",
"to",
"edit"
] | f9c2f3e2093fea414867f548c5f5e07f96c55bfd | https://github.com/guni12/comment/blob/f9c2f3e2093fea414867f548c5f5e07f96c55bfd/src/Comments/ShowOneService.php#L173-L183 | train |
SagittariusX/Beluga.Drawing | src/Beluga/Drawing/Image/ImageSizeReducerCollection.php | ImageSizeReducerCollection.writeXML | public function writeXML( \XMLWriter $w, string $elementName = 'ImageSizeReducers' )
{
if ( ! empty( $elementName ) )
{
$w->startElement( $elementName );
}
foreach ( $this as $reducer )
{
if ( \is_null( $reducer ) || ! ( $reducer instanceof ImageSizeReduc... | php | public function writeXML( \XMLWriter $w, string $elementName = 'ImageSizeReducers' )
{
if ( ! empty( $elementName ) )
{
$w->startElement( $elementName );
}
foreach ( $this as $reducer )
{
if ( \is_null( $reducer ) || ! ( $reducer instanceof ImageSizeReduc... | [
"public",
"function",
"writeXML",
"(",
"\\",
"XMLWriter",
"$",
"w",
",",
"string",
"$",
"elementName",
"=",
"'ImageSizeReducers'",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"elementName",
")",
")",
"{",
"$",
"w",
"->",
"startElement",
"(",
"$",
"ele... | Writes the current instance data to defined XMLWriter.
@param \XMLWriter $w
@param string $elementName | [
"Writes",
"the",
"current",
"instance",
"data",
"to",
"defined",
"XMLWriter",
"."
] | 9c82874cf4ec68cb0af78757b65f19783540004a | https://github.com/SagittariusX/Beluga.Drawing/blob/9c82874cf4ec68cb0af78757b65f19783540004a/src/Beluga/Drawing/Image/ImageSizeReducerCollection.php#L86-L108 | train |
story75/MultiEventDispatcher | src/ListenerState.php | ListenerState.dispatch | public function dispatch()
{
if ($this->isDispatchable()) {
$sorted = [];
foreach($this->attachedToEvents as $eventName)
{
$sorted[$eventName] = $this->dispatchedEvents[$eventName];
}
call_user_func($this->listener, $sorted);
... | php | public function dispatch()
{
if ($this->isDispatchable()) {
$sorted = [];
foreach($this->attachedToEvents as $eventName)
{
$sorted[$eventName] = $this->dispatchedEvents[$eventName];
}
call_user_func($this->listener, $sorted);
... | [
"public",
"function",
"dispatch",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isDispatchable",
"(",
")",
")",
"{",
"$",
"sorted",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"attachedToEvents",
"as",
"$",
"eventName",
")",
"{",
"$",
"s... | Try to dispatch the event and clear the event cache
@return void | [
"Try",
"to",
"dispatch",
"the",
"event",
"and",
"clear",
"the",
"event",
"cache"
] | 02d6821dbb4a1d05a356b97befb9e286e7c5fd19 | https://github.com/story75/MultiEventDispatcher/blob/02d6821dbb4a1d05a356b97befb9e286e7c5fd19/src/ListenerState.php#L132-L148 | train |
Dhii/config | src/NormalizePathCapableTrait.php | NormalizePathCapableTrait._normalizePath | protected function _normalizePath($path, $separator)
{
try {
return $this->_normalizeIterable($path);
} catch (InvalidArgumentException $e) {
return $this->_stringableSplit($path, $separator);
}
} | php | protected function _normalizePath($path, $separator)
{
try {
return $this->_normalizeIterable($path);
} catch (InvalidArgumentException $e) {
return $this->_stringableSplit($path, $separator);
}
} | [
"protected",
"function",
"_normalizePath",
"(",
"$",
"path",
",",
"$",
"separator",
")",
"{",
"try",
"{",
"return",
"$",
"this",
"->",
"_normalizeIterable",
"(",
"$",
"path",
")",
";",
"}",
"catch",
"(",
"InvalidArgumentException",
"$",
"e",
")",
"{",
"r... | Normalizes a path.
Will try to normalize to a list of path segments. If this is not possible, will try to normalize to a string,
and the split that string into segments using the specified separator.
@since [*next-version*]
@param array|stdClass|Traversable|string|Stringable $path The path to normalize.
@param ... | [
"Normalizes",
"a",
"path",
"."
] | 1ab9a7ccf9c0ebd7c6fcbce600b4c00b52b2fdcf | https://github.com/Dhii/config/blob/1ab9a7ccf9c0ebd7c6fcbce600b4c00b52b2fdcf/src/NormalizePathCapableTrait.php#L30-L37 | train |
miguelibero/meinhof | src/Meinhof/Command/Helper/DialogHelper.php | DialogHelper.askForArray | public function askForArray(OutputInterface $output, $question, $default)
{
$result = $this->ask($output, $question, $default);
if (is_string($result)) {
$result = explode(',', $result);
}
if (!is_array($result)) {
$result = array();
}
$result ... | php | public function askForArray(OutputInterface $output, $question, $default)
{
$result = $this->ask($output, $question, $default);
if (is_string($result)) {
$result = explode(',', $result);
}
if (!is_array($result)) {
$result = array();
}
$result ... | [
"public",
"function",
"askForArray",
"(",
"OutputInterface",
"$",
"output",
",",
"$",
"question",
",",
"$",
"default",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"ask",
"(",
"$",
"output",
",",
"$",
"question",
",",
"$",
"default",
")",
";",
"i... | Asks for a list of values, the response is split to return an array
@param OutputInterface $output the command line output
@param string $question the question to ask
@param string $default the default answer
@return array the array of resposne values | [
"Asks",
"for",
"a",
"list",
"of",
"values",
"the",
"response",
"is",
"split",
"to",
"return",
"an",
"array"
] | 3a090f08485dc0da3e27463cf349dba374201072 | https://github.com/miguelibero/meinhof/blob/3a090f08485dc0da3e27463cf349dba374201072/src/Meinhof/Command/Helper/DialogHelper.php#L78-L90 | train |
stubbles/stubbles-date | src/main/php/span/AbstractDatespan.php | AbstractDatespan.amountOfDays | public function amountOfDays(): int
{
return $this->end->handle()->diff($this->start->handle())->days + 1;
} | php | public function amountOfDays(): int
{
return $this->end->handle()->diff($this->start->handle())->days + 1;
} | [
"public",
"function",
"amountOfDays",
"(",
")",
":",
"int",
"{",
"return",
"$",
"this",
"->",
"end",
"->",
"handle",
"(",
")",
"->",
"diff",
"(",
"$",
"this",
"->",
"start",
"->",
"handle",
"(",
")",
")",
"->",
"days",
"+",
"1",
";",
"}"
] | returns amount of days in this datespan
@return int | [
"returns",
"amount",
"of",
"days",
"in",
"this",
"datespan"
] | 98553392bec03affc53a6e3eb7f88408c2720d1c | https://github.com/stubbles/stubbles-date/blob/98553392bec03affc53a6e3eb7f88408c2720d1c/src/main/php/span/AbstractDatespan.php#L144-L147 | train |
stubbles/stubbles-date | src/main/php/span/AbstractDatespan.php | AbstractDatespan.isInFuture | public function isInFuture(): bool
{
$today = mktime(23, 59, 59, (int) date('m'), (int) date('d'), (int) date('Y'));
if ($this->start->timestamp() > $today) {
return true;
}
return false;
} | php | public function isInFuture(): bool
{
$today = mktime(23, 59, 59, (int) date('m'), (int) date('d'), (int) date('Y'));
if ($this->start->timestamp() > $today) {
return true;
}
return false;
} | [
"public",
"function",
"isInFuture",
"(",
")",
":",
"bool",
"{",
"$",
"today",
"=",
"mktime",
"(",
"23",
",",
"59",
",",
"59",
",",
"(",
"int",
")",
"date",
"(",
"'m'",
")",
",",
"(",
"int",
")",
"date",
"(",
"'d'",
")",
",",
"(",
"int",
")",
... | checks whether the DateSpan is in the future compared to current date
@return bool | [
"checks",
"whether",
"the",
"DateSpan",
"is",
"in",
"the",
"future",
"compared",
"to",
"current",
"date"
] | 98553392bec03affc53a6e3eb7f88408c2720d1c | https://github.com/stubbles/stubbles-date/blob/98553392bec03affc53a6e3eb7f88408c2720d1c/src/main/php/span/AbstractDatespan.php#L154-L162 | train |
stubbles/stubbles-date | src/main/php/span/AbstractDatespan.php | AbstractDatespan.containsDate | public function containsDate($date): bool
{
$date = Date::castFrom($date);
if (!$this->start->isBefore($date) && !$this->start->equals($date)) {
return false;
}
if (!$this->end->isAfter($date) && !$this->end->equals($date)) {
return false;
}
... | php | public function containsDate($date): bool
{
$date = Date::castFrom($date);
if (!$this->start->isBefore($date) && !$this->start->equals($date)) {
return false;
}
if (!$this->end->isAfter($date) && !$this->end->equals($date)) {
return false;
}
... | [
"public",
"function",
"containsDate",
"(",
"$",
"date",
")",
":",
"bool",
"{",
"$",
"date",
"=",
"Date",
"::",
"castFrom",
"(",
"$",
"date",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"start",
"->",
"isBefore",
"(",
"$",
"date",
")",
"&&",
"!",... | checks whether the span contains the given date
@param int|string|\DateTime|\stubbles\date\Date $date
@return bool | [
"checks",
"whether",
"the",
"span",
"contains",
"the",
"given",
"date"
] | 98553392bec03affc53a6e3eb7f88408c2720d1c | https://github.com/stubbles/stubbles-date/blob/98553392bec03affc53a6e3eb7f88408c2720d1c/src/main/php/span/AbstractDatespan.php#L170-L182 | train |
cubicmushroom/hexagonal-components | src/Command/AbstractCommandHandler.php | AbstractCommandHandler.handle | final public function handle(CommandInterface $command)
{
$this->validateCommand($command);
try {
// @todo - Update this to return the succes event object, rather than using the getSuccessEvent() method
$this->_handle($command);
} catch (\Exception $exception) {
... | php | final public function handle(CommandInterface $command)
{
$this->validateCommand($command);
try {
// @todo - Update this to return the succes event object, rather than using the getSuccessEvent() method
$this->_handle($command);
} catch (\Exception $exception) {
... | [
"final",
"public",
"function",
"handle",
"(",
"CommandInterface",
"$",
"command",
")",
"{",
"$",
"this",
"->",
"validateCommand",
"(",
"$",
"command",
")",
";",
"try",
"{",
"// @todo - Update this to return the succes event object, rather than using the getSuccessEvent() me... | Processes the associated command
@param CommandInterface $command
@return void
@throws \Exception if _handler() throws an error | [
"Processes",
"the",
"associated",
"command"
] | bc622ad0efc9884ce584ffd84c785e7d51fba981 | https://github.com/cubicmushroom/hexagonal-components/blob/bc622ad0efc9884ce584ffd84c785e7d51fba981/src/Command/AbstractCommandHandler.php#L76-L100 | train |
cubicmushroom/hexagonal-components | src/Command/AbstractCommandHandler.php | AbstractCommandHandler.logError | function logError($errorMessage, \Exception $exception)
{
if ($this->logger instanceof LoggerInterface) {
$this->logger->error($errorMessage . "\n" . $exception->getTraceAsString());
}
} | php | function logError($errorMessage, \Exception $exception)
{
if ($this->logger instanceof LoggerInterface) {
$this->logger->error($errorMessage . "\n" . $exception->getTraceAsString());
}
} | [
"function",
"logError",
"(",
"$",
"errorMessage",
",",
"\\",
"Exception",
"$",
"exception",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"logger",
"instanceof",
"LoggerInterface",
")",
"{",
"$",
"this",
"->",
"logger",
"->",
"error",
"(",
"$",
"errorMessage",
... | Logs an error, if the error logger is available
@param string $errorMessage
@param \Exception $exception | [
"Logs",
"an",
"error",
"if",
"the",
"error",
"logger",
"is",
"available"
] | bc622ad0efc9884ce584ffd84c785e7d51fba981 | https://github.com/cubicmushroom/hexagonal-components/blob/bc622ad0efc9884ce584ffd84c785e7d51fba981/src/Command/AbstractCommandHandler.php#L131-L136 | train |
twohill/silverstripe-nestedcontrollers | code/NestedModelController.php | NestedModelController.Link | public function Link($action = null)
{
if ($this->currentRecord) {
return Controller::join_links($this->parentController->Link(), "/{$this->currentRecord->ID}/{$action}");
} else {
return $this->parentController->Link();
}
} | php | public function Link($action = null)
{
if ($this->currentRecord) {
return Controller::join_links($this->parentController->Link(), "/{$this->currentRecord->ID}/{$action}");
} else {
return $this->parentController->Link();
}
} | [
"public",
"function",
"Link",
"(",
"$",
"action",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"currentRecord",
")",
"{",
"return",
"Controller",
"::",
"join_links",
"(",
"$",
"this",
"->",
"parentController",
"->",
"Link",
"(",
")",
",",
"\"/{... | Link fragment - appends the current record ID to the URL.
@param string $action Optional action
@return string | [
"Link",
"fragment",
"-",
"appends",
"the",
"current",
"record",
"ID",
"to",
"the",
"URL",
"."
] | 2fc263c31b7e23e2f768dc56f4f0df2912b6b3b1 | https://github.com/twohill/silverstripe-nestedcontrollers/blob/2fc263c31b7e23e2f768dc56f4f0df2912b6b3b1/code/NestedModelController.php#L112-L120 | train |
twohill/silverstripe-nestedcontrollers | code/NestedModelController.php | NestedModelController.view | public function view($request)
{
if (!$this->currentRecord) {
return $this->httpError(404, "{$this->recordType} not found");
}
if (!$this->currentRecord->canView()) {
return $this->httpError(403, "You do not have permission to view this {$this->recordType}");
... | php | public function view($request)
{
if (!$this->currentRecord) {
return $this->httpError(404, "{$this->recordType} not found");
}
if (!$this->currentRecord->canView()) {
return $this->httpError(403, "You do not have permission to view this {$this->recordType}");
... | [
"public",
"function",
"view",
"(",
"$",
"request",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"currentRecord",
")",
"{",
"return",
"$",
"this",
"->",
"httpError",
"(",
"404",
",",
"\"{$this->recordType} not found\"",
")",
";",
"}",
"if",
"(",
"!",
"$... | Returns the view of the record | [
"Returns",
"the",
"view",
"of",
"the",
"record"
] | 2fc263c31b7e23e2f768dc56f4f0df2912b6b3b1 | https://github.com/twohill/silverstripe-nestedcontrollers/blob/2fc263c31b7e23e2f768dc56f4f0df2912b6b3b1/code/NestedModelController.php#L145-L157 | train |
twohill/silverstripe-nestedcontrollers | code/NestedModelController.php | NestedModelController.edit | public function edit($request)
{
if (!$this->currentRecord) {
return $this->httpError(404, "{$this->recordType} not found");
}
if (!$this->currentRecord->canEdit()) {
return $this->httpError(403, "You do not have permission to edit this {$this->recordType}");
... | php | public function edit($request)
{
if (!$this->currentRecord) {
return $this->httpError(404, "{$this->recordType} not found");
}
if (!$this->currentRecord->canEdit()) {
return $this->httpError(403, "You do not have permission to edit this {$this->recordType}");
... | [
"public",
"function",
"edit",
"(",
"$",
"request",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"currentRecord",
")",
"{",
"return",
"$",
"this",
"->",
"httpError",
"(",
"404",
",",
"\"{$this->recordType} not found\"",
")",
";",
"}",
"if",
"(",
"!",
"$... | Returns a form for editing the record | [
"Returns",
"a",
"form",
"for",
"editing",
"the",
"record"
] | 2fc263c31b7e23e2f768dc56f4f0df2912b6b3b1 | https://github.com/twohill/silverstripe-nestedcontrollers/blob/2fc263c31b7e23e2f768dc56f4f0df2912b6b3b1/code/NestedModelController.php#L162-L172 | train |
twohill/silverstripe-nestedcontrollers | code/NestedModelController.php | NestedModelController.getViewer | function getViewer($action)
{
if ($this->parentController) {
if (is_numeric($action)) {
$action = 'view';
}
$viewer = $this->parentController->getViewer($action);
$layoutTemplate = null;
// action-specific template with template ide... | php | function getViewer($action)
{
if ($this->parentController) {
if (is_numeric($action)) {
$action = 'view';
}
$viewer = $this->parentController->getViewer($action);
$layoutTemplate = null;
// action-specific template with template ide... | [
"function",
"getViewer",
"(",
"$",
"action",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"parentController",
")",
"{",
"if",
"(",
"is_numeric",
"(",
"$",
"action",
")",
")",
"{",
"$",
"action",
"=",
"'view'",
";",
"}",
"$",
"viewer",
"=",
"$",
"this",
... | If a parentcontroller exists, use its main template,
and mix in specific collectioncontroller subtemplates. | [
"If",
"a",
"parentcontroller",
"exists",
"use",
"its",
"main",
"template",
"and",
"mix",
"in",
"specific",
"collectioncontroller",
"subtemplates",
"."
] | 2fc263c31b7e23e2f768dc56f4f0df2912b6b3b1 | https://github.com/twohill/silverstripe-nestedcontrollers/blob/2fc263c31b7e23e2f768dc56f4f0df2912b6b3b1/code/NestedModelController.php#L194-L226 | train |
twohill/silverstripe-nestedcontrollers | code/NestedModelController.php | NestedModelController.Form | public function Form()
{
if ($this->currentRecord) {
$fields = $this->currentRecord->getFrontEndFields();
$required = $this->currentRecord->getRequiredFields();
} else {
$fields = singleton($this->recordType)->getFrontEndFields();
$required = singleton... | php | public function Form()
{
if ($this->currentRecord) {
$fields = $this->currentRecord->getFrontEndFields();
$required = $this->currentRecord->getRequiredFields();
} else {
$fields = singleton($this->recordType)->getFrontEndFields();
$required = singleton... | [
"public",
"function",
"Form",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"currentRecord",
")",
"{",
"$",
"fields",
"=",
"$",
"this",
"->",
"currentRecord",
"->",
"getFrontEndFields",
"(",
")",
";",
"$",
"required",
"=",
"$",
"this",
"->",
"currentRec... | Scaffolds the fields required for editing the record
@return Form | [
"Scaffolds",
"the",
"fields",
"required",
"for",
"editing",
"the",
"record"
] | 2fc263c31b7e23e2f768dc56f4f0df2912b6b3b1 | https://github.com/twohill/silverstripe-nestedcontrollers/blob/2fc263c31b7e23e2f768dc56f4f0df2912b6b3b1/code/NestedModelController.php#L233-L249 | train |
twohill/silverstripe-nestedcontrollers | code/NestedModelController.php | NestedModelController.doSave | public function doSave($data, $form)
{
if (!$this->currentRecord) {
$this->currentRecord = new $this->recordType();
}
$form->saveInto($this->currentRecord);
$this->currentRecord->write();
$this->redirect($this->Link());
} | php | public function doSave($data, $form)
{
if (!$this->currentRecord) {
$this->currentRecord = new $this->recordType();
}
$form->saveInto($this->currentRecord);
$this->currentRecord->write();
$this->redirect($this->Link());
} | [
"public",
"function",
"doSave",
"(",
"$",
"data",
",",
"$",
"form",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"currentRecord",
")",
"{",
"$",
"this",
"->",
"currentRecord",
"=",
"new",
"$",
"this",
"->",
"recordType",
"(",
")",
";",
"}",
"$",
... | Save the record | [
"Save",
"the",
"record"
] | 2fc263c31b7e23e2f768dc56f4f0df2912b6b3b1 | https://github.com/twohill/silverstripe-nestedcontrollers/blob/2fc263c31b7e23e2f768dc56f4f0df2912b6b3b1/code/NestedModelController.php#L254-L262 | train |
twohill/silverstripe-nestedcontrollers | code/NestedModelController.php | NestedModelController.httpError | public function httpError($code, $message = null)
{
if ($this->request->isMedia() || !$response = ErrorPage::response_for($code)) {
parent::httpError($code, $message);
} else {
throw new HTTPResponse_Exception($response);
}
} | php | public function httpError($code, $message = null)
{
if ($this->request->isMedia() || !$response = ErrorPage::response_for($code)) {
parent::httpError($code, $message);
} else {
throw new HTTPResponse_Exception($response);
}
} | [
"public",
"function",
"httpError",
"(",
"$",
"code",
",",
"$",
"message",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"request",
"->",
"isMedia",
"(",
")",
"||",
"!",
"$",
"response",
"=",
"ErrorPage",
"::",
"response_for",
"(",
"$",
"code",... | Show a pretty error, if possible
@uses ErrorPage::response_for() | [
"Show",
"a",
"pretty",
"error",
"if",
"possible"
] | 2fc263c31b7e23e2f768dc56f4f0df2912b6b3b1 | https://github.com/twohill/silverstripe-nestedcontrollers/blob/2fc263c31b7e23e2f768dc56f4f0df2912b6b3b1/code/NestedModelController.php#L277-L284 | train |
twohill/silverstripe-nestedcontrollers | code/NestedModelController.php | NestedModelController.addCrumb | public function addCrumb($title, $link = null)
{
$this->Title = $title;
if ($link) {
array_push($this->crumbs, "<a href=\"$link\">$title</a>");
} else {
array_push($this->crumbs, $title);
}
} | php | public function addCrumb($title, $link = null)
{
$this->Title = $title;
if ($link) {
array_push($this->crumbs, "<a href=\"$link\">$title</a>");
} else {
array_push($this->crumbs, $title);
}
} | [
"public",
"function",
"addCrumb",
"(",
"$",
"title",
",",
"$",
"link",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"Title",
"=",
"$",
"title",
";",
"if",
"(",
"$",
"link",
")",
"{",
"array_push",
"(",
"$",
"this",
"->",
"crumbs",
",",
"\"<a href=\\\"... | Adds a breadcrumb action | [
"Adds",
"a",
"breadcrumb",
"action"
] | 2fc263c31b7e23e2f768dc56f4f0df2912b6b3b1 | https://github.com/twohill/silverstripe-nestedcontrollers/blob/2fc263c31b7e23e2f768dc56f4f0df2912b6b3b1/code/NestedModelController.php#L289-L297 | train |
twohill/silverstripe-nestedcontrollers | code/NestedModelController.php | NestedModelController.Breadcrumbs | public function Breadcrumbs()
{
$parts = explode(self::$breadcrumbs_delimiter, $this->parentController->Breadcrumbs());
// The last part is never a link, need to recreate
array_pop($parts);
array_push($parts,
'<a href="' . $this->parentController->Link() . '">' . $this->p... | php | public function Breadcrumbs()
{
$parts = explode(self::$breadcrumbs_delimiter, $this->parentController->Breadcrumbs());
// The last part is never a link, need to recreate
array_pop($parts);
array_push($parts,
'<a href="' . $this->parentController->Link() . '">' . $this->p... | [
"public",
"function",
"Breadcrumbs",
"(",
")",
"{",
"$",
"parts",
"=",
"explode",
"(",
"self",
"::",
"$",
"breadcrumbs_delimiter",
",",
"$",
"this",
"->",
"parentController",
"->",
"Breadcrumbs",
"(",
")",
")",
";",
"// The last part is never a link, need to recre... | Build on the breadcrumbs to show the nested actions
@return array | [
"Build",
"on",
"the",
"breadcrumbs",
"to",
"show",
"the",
"nested",
"actions"
] | 2fc263c31b7e23e2f768dc56f4f0df2912b6b3b1 | https://github.com/twohill/silverstripe-nestedcontrollers/blob/2fc263c31b7e23e2f768dc56f4f0df2912b6b3b1/code/NestedModelController.php#L304-L319 | train |
bhrdn/Diactoros | src/Diactoros.php | DiactorosEngine.addReplacer | public function addReplacer(array $replacer)
{
foreach ($replacer as $key => $value) {
Unicode::$char[$key] = $value;
}
} | php | public function addReplacer(array $replacer)
{
foreach ($replacer as $key => $value) {
Unicode::$char[$key] = $value;
}
} | [
"public",
"function",
"addReplacer",
"(",
"array",
"$",
"replacer",
")",
"{",
"foreach",
"(",
"$",
"replacer",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"Unicode",
"::",
"$",
"char",
"[",
"$",
"key",
"]",
"=",
"$",
"value",
";",
"}",
"}"
] | Add array list for replacer
@param array $replacer | [
"Add",
"array",
"list",
"for",
"replacer"
] | 9b894241e4c502d1131ba3c90197f74bc70ffed8 | https://github.com/bhrdn/Diactoros/blob/9b894241e4c502d1131ba3c90197f74bc70ffed8/src/Diactoros.php#L34-L39 | train |
bhrdn/Diactoros | src/Diactoros.php | DiactorosEngine.replaceText | public function replaceText(string $str) : string
{
foreach (Unicode::$char as $key => $value) {
if ($key === $str) {
$result = ((count($value) > 1) ? Unicode::$char[$key][random_int(0, count($value)-1)] : Unicode::$char[$key][0]);
}
}
return $result ?? $str;
} | php | public function replaceText(string $str) : string
{
foreach (Unicode::$char as $key => $value) {
if ($key === $str) {
$result = ((count($value) > 1) ? Unicode::$char[$key][random_int(0, count($value)-1)] : Unicode::$char[$key][0]);
}
}
return $result ?? $str;
} | [
"public",
"function",
"replaceText",
"(",
"string",
"$",
"str",
")",
":",
"string",
"{",
"foreach",
"(",
"Unicode",
"::",
"$",
"char",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"key",
"===",
"$",
"str",
")",
"{",
"$",
"resul... | Replace text with unicode character
@param string $str
@return string | [
"Replace",
"text",
"with",
"unicode",
"character"
] | 9b894241e4c502d1131ba3c90197f74bc70ffed8 | https://github.com/bhrdn/Diactoros/blob/9b894241e4c502d1131ba3c90197f74bc70ffed8/src/Diactoros.php#L47-L56 | train |
bhrdn/Diactoros | src/Diactoros.php | Diactoros.encode | public function encode()
{
foreach ($this->body as $key => $value) {
$result[] = $this->replaceText($value);
}
return implode('', $result);
} | php | public function encode()
{
foreach ($this->body as $key => $value) {
$result[] = $this->replaceText($value);
}
return implode('', $result);
} | [
"public",
"function",
"encode",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"body",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"result",
"[",
"]",
"=",
"$",
"this",
"->",
"replaceText",
"(",
"$",
"value",
")",
";",
"}",
"return",
... | Replace character with new unicode character
@return unicode character | [
"Replace",
"character",
"with",
"new",
"unicode",
"character"
] | 9b894241e4c502d1131ba3c90197f74bc70ffed8 | https://github.com/bhrdn/Diactoros/blob/9b894241e4c502d1131ba3c90197f74bc70ffed8/src/Diactoros.php#L66-L73 | train |
wb-crowdfusion/crowdfusion | system/core/classes/libraries/database/Query.php | Query.build | public function build($sql='')
{
$sql .= "\n";
if (!empty($this->selectParams[self::SELECT])) {
$sql = "SELECT ".implode(",\n", $this->selectParams[self::SELECT]);
}
if (!empty($this->selectParams[self::FROM])) {
$sql .= "\nFROM ".implode(",\n", $this->select... | php | public function build($sql='')
{
$sql .= "\n";
if (!empty($this->selectParams[self::SELECT])) {
$sql = "SELECT ".implode(",\n", $this->selectParams[self::SELECT]);
}
if (!empty($this->selectParams[self::FROM])) {
$sql .= "\nFROM ".implode(",\n", $this->select... | [
"public",
"function",
"build",
"(",
"$",
"sql",
"=",
"''",
")",
"{",
"$",
"sql",
".=",
"\"\\n\"",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"selectParams",
"[",
"self",
"::",
"SELECT",
"]",
")",
")",
"{",
"$",
"sql",
"=",
"\"SELECT \"... | Creates the SQL query
@param string $sql A prefix, or string that will be pre-pended to the generated query.
@return string A SQL query string | [
"Creates",
"the",
"SQL",
"query"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/database/Query.php#L62-L109 | train |
wb-crowdfusion/crowdfusion | system/core/classes/libraries/database/Query.php | Query.limit | public function limit($limit)
{
if(!empty($limit))
$this->selectParams[self::LIMIT] = $limit;
else
unset($this->selectParams[self::LIMIT]);
return $this;
} | php | public function limit($limit)
{
if(!empty($limit))
$this->selectParams[self::LIMIT] = $limit;
else
unset($this->selectParams[self::LIMIT]);
return $this;
} | [
"public",
"function",
"limit",
"(",
"$",
"limit",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"limit",
")",
")",
"$",
"this",
"->",
"selectParams",
"[",
"self",
"::",
"LIMIT",
"]",
"=",
"$",
"limit",
";",
"else",
"unset",
"(",
"$",
"this",
"->",... | Sets the LIMIT clause for the query.
If a NULL value is specified, the limit is removed from the query.
@param string $limit The limit to use. If NULL, the limit is cleared.
@return this | [
"Sets",
"the",
"LIMIT",
"clause",
"for",
"the",
"query",
"."
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/database/Query.php#L248-L255 | train |
wb-crowdfusion/crowdfusion | system/core/classes/libraries/database/Query.php | Query.offset | public function offset($offset)
{
if(!empty($offset))
$this->selectParams[self::OFFSET] = $offset;
return $this;
} | php | public function offset($offset)
{
if(!empty($offset))
$this->selectParams[self::OFFSET] = $offset;
return $this;
} | [
"public",
"function",
"offset",
"(",
"$",
"offset",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"offset",
")",
")",
"$",
"this",
"->",
"selectParams",
"[",
"self",
"::",
"OFFSET",
"]",
"=",
"$",
"offset",
";",
"return",
"$",
"this",
";",
"}"
] | Sets or clears the offset for the query.
If null is specified, the offset is cleared.
@param string $offset The offset to use. If NULL, the offset is cleared.
@return this | [
"Sets",
"or",
"clears",
"the",
"offset",
"for",
"the",
"query",
".",
"If",
"null",
"is",
"specified",
"the",
"offset",
"is",
"cleared",
"."
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/database/Query.php#L265-L270 | train |
wb-crowdfusion/crowdfusion | system/core/classes/libraries/database/Query.php | Query.setClause | protected function setClause($section, $clause)
{
if(!isset($this->selectParams[$section]))
$this->selectParams[$section] = array();
if(empty($clause))
unset($this->selectParams[$section]);
else if(is_array($clause))
$this->selectParams[$section] = array_... | php | protected function setClause($section, $clause)
{
if(!isset($this->selectParams[$section]))
$this->selectParams[$section] = array();
if(empty($clause))
unset($this->selectParams[$section]);
else if(is_array($clause))
$this->selectParams[$section] = array_... | [
"protected",
"function",
"setClause",
"(",
"$",
"section",
",",
"$",
"clause",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"selectParams",
"[",
"$",
"section",
"]",
")",
")",
"$",
"this",
"->",
"selectParams",
"[",
"$",
"section",
"]",... | The setter used internally in this function to build each clause.
If {@link $clause} is an array, it uses the value of clause to set the section.
Otherwise, {@link $clause} is appended to the section.
@param string $section The section to update
@param mixed $clause The clause to use.
@return void | [
"The",
"setter",
"used",
"internally",
"in",
"this",
"function",
"to",
"build",
"each",
"clause",
"."
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/libraries/database/Query.php#L283-L295 | train |
lasallecms/lasallecms-l5-lasallecmsapi-pkg | src/Repositories/UserRepository.php | UserRepository.validatePasswordNotUseWordPassword | public function validatePasswordNotUseWordPassword($password) {
$washedPassword = trim($password);
$washedPassword = strtolower($password);
// if the word "password" resides within the password, then no good
if (strpos($washedPassword, "password") !== false) {
return false;
... | php | public function validatePasswordNotUseWordPassword($password) {
$washedPassword = trim($password);
$washedPassword = strtolower($password);
// if the word "password" resides within the password, then no good
if (strpos($washedPassword, "password") !== false) {
return false;
... | [
"public",
"function",
"validatePasswordNotUseWordPassword",
"(",
"$",
"password",
")",
"{",
"$",
"washedPassword",
"=",
"trim",
"(",
"$",
"password",
")",
";",
"$",
"washedPassword",
"=",
"strtolower",
"(",
"$",
"password",
")",
";",
"// if the word \"password\" r... | Password should not use the word "password"
I am countering a pet peeve!
@param text $password
@return bool | [
"Password",
"should",
"not",
"use",
"the",
"word",
"password"
] | 05083be19645d52be86d8ba4f322773db348a11d | https://github.com/lasallecms/lasallecms-l5-lasallecmsapi-pkg/blob/05083be19645d52be86d8ba4f322773db348a11d/src/Repositories/UserRepository.php#L271-L281 | train |
lasallecms/lasallecms-l5-lasallecmsapi-pkg | src/Repositories/UserRepository.php | UserRepository.validatePasswordNotUseUsername | public function validatePasswordNotUseUsername($username, $password) {
$washedPassword = trim($password);
$washedPassword = strtolower($password);
$washedUsername = trim($username);
$washedUsername = strtolower($username);
if ($washedPassword == $washedUsername) {
r... | php | public function validatePasswordNotUseUsername($username, $password) {
$washedPassword = trim($password);
$washedPassword = strtolower($password);
$washedUsername = trim($username);
$washedUsername = strtolower($username);
if ($washedPassword == $washedUsername) {
r... | [
"public",
"function",
"validatePasswordNotUseUsername",
"(",
"$",
"username",
",",
"$",
"password",
")",
"{",
"$",
"washedPassword",
"=",
"trim",
"(",
"$",
"password",
")",
";",
"$",
"washedPassword",
"=",
"strtolower",
"(",
"$",
"password",
")",
";",
"$",
... | Password should not be the username
In my experience, some bots use the username as the password
@param text $username
@param text $password
@return bool | [
"Password",
"should",
"not",
"be",
"the",
"username"
] | 05083be19645d52be86d8ba4f322773db348a11d | https://github.com/lasallecms/lasallecms-l5-lasallecmsapi-pkg/blob/05083be19645d52be86d8ba4f322773db348a11d/src/Repositories/UserRepository.php#L292-L325 | train |
lasallecms/lasallecms-l5-lasallecmsapi-pkg | src/Repositories/UserRepository.php | UserRepository.getPeopleIdForIndexListing | public function getPeopleIdForIndexListing($id) {
// Does the PEOPLES table exist?
if (Schema::hasTable('peoples')) {
$person = DB::table('peoples')->where('user_id', '=', $id)->first();
if (!$person) return "Not in LaSalleCRM";
$full_url = route('admin.crmpeoples.e... | php | public function getPeopleIdForIndexListing($id) {
// Does the PEOPLES table exist?
if (Schema::hasTable('peoples')) {
$person = DB::table('peoples')->where('user_id', '=', $id)->first();
if (!$person) return "Not in LaSalleCRM";
$full_url = route('admin.crmpeoples.e... | [
"public",
"function",
"getPeopleIdForIndexListing",
"(",
"$",
"id",
")",
"{",
"// Does the PEOPLES table exist?",
"if",
"(",
"Schema",
"::",
"hasTable",
"(",
"'peoples'",
")",
")",
"{",
"$",
"person",
"=",
"DB",
"::",
"table",
"(",
"'peoples'",
")",
"->",
"w... | Get the ID from the PEOPLES table
@param int $id Users table ID
@return mixed | [
"Get",
"the",
"ID",
"from",
"the",
"PEOPLES",
"table"
] | 05083be19645d52be86d8ba4f322773db348a11d | https://github.com/lasallecms/lasallecms-l5-lasallecmsapi-pkg/blob/05083be19645d52be86d8ba4f322773db348a11d/src/Repositories/UserRepository.php#L489-L508 | train |
sndsgd/sndsgd-event | src/event/Target.php | Target.on | public function on($event, $handler, $prepend = false)
{
if (!is_string($event)) {
throw new InvalidArgumentException(
"invalid value provided for 'event'; ".
"expecting an event name as string"
);
}
$handler = new Handler($event, $handler);
if ($pre... | php | public function on($event, $handler, $prepend = false)
{
if (!is_string($event)) {
throw new InvalidArgumentException(
"invalid value provided for 'event'; ".
"expecting an event name as string"
);
}
$handler = new Handler($event, $handler);
if ($pre... | [
"public",
"function",
"on",
"(",
"$",
"event",
",",
"$",
"handler",
",",
"$",
"prepend",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"is_string",
"(",
"$",
"event",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"\"invalid value provided for '... | Add an event handler
@param string $event The name of the event
@param string|callable $handler The function that handles the event
@param boolean $prepend Add the handler at the top of the stack
@return sndsgd\event\Target
@throws InvalidArgumentException If the event isn't a string | [
"Add",
"an",
"event",
"handler"
] | 531bd348fd77db6a27346aa6dfec43e99ecd3eef | https://github.com/sndsgd/sndsgd-event/blob/531bd348fd77db6a27346aa6dfec43e99ecd3eef/src/event/Target.php#L40-L58 | train |
sndsgd/sndsgd-event | src/event/Target.php | Target.off | public function off($event)
{
list($type, $namespace) = Event::split($event);
for ($i=count($this->eventHandlers)-1; $i>-1; $i--) {
$h = $this->eventHandlers[$i];
if ($type !== null && $h->getType() !== $type) {
continue;
}
else if ($namespace !== null && ... | php | public function off($event)
{
list($type, $namespace) = Event::split($event);
for ($i=count($this->eventHandlers)-1; $i>-1; $i--) {
$h = $this->eventHandlers[$i];
if ($type !== null && $h->getType() !== $type) {
continue;
}
else if ($namespace !== null && ... | [
"public",
"function",
"off",
"(",
"$",
"event",
")",
"{",
"list",
"(",
"$",
"type",
",",
"$",
"namespace",
")",
"=",
"Event",
"::",
"split",
"(",
"$",
"event",
")",
";",
"for",
"(",
"$",
"i",
"=",
"count",
"(",
"$",
"this",
"->",
"eventHandlers",... | Remove one or more event handlers
@param string $event An event type/namespace combo
@return sndsgd\event\Target | [
"Remove",
"one",
"or",
"more",
"event",
"handlers"
] | 531bd348fd77db6a27346aa6dfec43e99ecd3eef | https://github.com/sndsgd/sndsgd-event/blob/531bd348fd77db6a27346aa6dfec43e99ecd3eef/src/event/Target.php#L66-L83 | train |
sndsgd/sndsgd-event | src/event/Target.php | Target.fire | public function fire($event, array $data = [])
{
if (is_string($event)) {
$event = new Event($event);
$event->setData($data);
}
else if ($event instanceof Event) {
if ($data) {
$event->addData($data);
}
}
else {
throw new InvalidA... | php | public function fire($event, array $data = [])
{
if (is_string($event)) {
$event = new Event($event);
$event->setData($data);
}
else if ($event instanceof Event) {
if ($data) {
$event->addData($data);
}
}
else {
throw new InvalidA... | [
"public",
"function",
"fire",
"(",
"$",
"event",
",",
"array",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"event",
")",
")",
"{",
"$",
"event",
"=",
"new",
"Event",
"(",
"$",
"event",
")",
";",
"$",
"event",
"->",
... | Call all handlers for a given event
Note: if a handler returns boolean false, any remaining handlers are skipped
@param sndsgd\Event|string $event An event, or a type/namespace combo
@param array.<string,mixed> $data Data to add to the event
@return boolean
@return boolean:false A handler returned false
@return boolea... | [
"Call",
"all",
"handlers",
"for",
"a",
"given",
"event"
] | 531bd348fd77db6a27346aa6dfec43e99ecd3eef | https://github.com/sndsgd/sndsgd-event/blob/531bd348fd77db6a27346aa6dfec43e99ecd3eef/src/event/Target.php#L96-L125 | train |
agentmedia/phine-core | src/Core/Modules/Backend/TemplateList.php | TemplateList.BeforeInit | protected function BeforeInit()
{
if ($this->RemoveTemplate())
{
Response::Redirect(Request::Uri());
return true;
}
parent::BeforeInit();
} | php | protected function BeforeInit()
{
if ($this->RemoveTemplate())
{
Response::Redirect(Request::Uri());
return true;
}
parent::BeforeInit();
} | [
"protected",
"function",
"BeforeInit",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"RemoveTemplate",
"(",
")",
")",
"{",
"Response",
"::",
"Redirect",
"(",
"Request",
"::",
"Uri",
"(",
")",
")",
";",
"return",
"true",
";",
"}",
"parent",
"::",
"Befo... | Removes the template if necessary | [
"Removes",
"the",
"template",
"if",
"necessary"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Modules/Backend/TemplateList.php#L24-L32 | train |
agentmedia/phine-core | src/Core/Modules/Backend/TemplateList.php | TemplateList.InitBundles | protected function InitBundles()
{
$bundles = PathUtil::Bundles();
$this->bundles = array();
foreach ($bundles as $bundle)
{
if (count($this->BundleModules($bundle)) > 0)
{
$this->bundles[] = $bundle;
}
}
} | php | protected function InitBundles()
{
$bundles = PathUtil::Bundles();
$this->bundles = array();
foreach ($bundles as $bundle)
{
if (count($this->BundleModules($bundle)) > 0)
{
$this->bundles[] = $bundle;
}
}
} | [
"protected",
"function",
"InitBundles",
"(",
")",
"{",
"$",
"bundles",
"=",
"PathUtil",
"::",
"Bundles",
"(",
")",
";",
"$",
"this",
"->",
"bundles",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"bundles",
"as",
"$",
"bundle",
")",
"{",
"if",
... | Initializes the bundle names by fetching those containing modules with adjustable templates | [
"Initializes",
"the",
"bundle",
"names",
"by",
"fetching",
"those",
"containing",
"modules",
"with",
"adjustable",
"templates"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Modules/Backend/TemplateList.php#L45-L56 | train |
agentmedia/phine-core | src/Core/Modules/Backend/TemplateList.php | TemplateList.ModuleTemplates | protected function ModuleTemplates($module)
{
$folder = PathUtil::ModuleCustomTemplatesFolder($module);
if (!Folder::Exists($folder))
{
return array();
}
$templates = Folder::GetFiles($folder);
$result = array();
foreach ($templates as $template)
... | php | protected function ModuleTemplates($module)
{
$folder = PathUtil::ModuleCustomTemplatesFolder($module);
if (!Folder::Exists($folder))
{
return array();
}
$templates = Folder::GetFiles($folder);
$result = array();
foreach ($templates as $template)
... | [
"protected",
"function",
"ModuleTemplates",
"(",
"$",
"module",
")",
"{",
"$",
"folder",
"=",
"PathUtil",
"::",
"ModuleCustomTemplatesFolder",
"(",
"$",
"module",
")",
";",
"if",
"(",
"!",
"Folder",
"::",
"Exists",
"(",
"$",
"folder",
")",
")",
"{",
"ret... | Gets the module templates
@param FrontendModule $module The frontend module
@return string[] Returns the template files | [
"Gets",
"the",
"module",
"templates"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Modules/Backend/TemplateList.php#L85-L102 | train |
agentmedia/phine-core | src/Core/Modules/Backend/TemplateList.php | TemplateList.RemovalTemplateModule | protected function RemovalTemplateModule(array $idParts)
{
if (count($idParts) != 2)
{
return null;
}
$module = ClassFinder::CreateFrontendModule($idParts[0]);
return ($module instanceof FrontendModule && $module->AllowCustomTemplates()) ? $module : null;
} | php | protected function RemovalTemplateModule(array $idParts)
{
if (count($idParts) != 2)
{
return null;
}
$module = ClassFinder::CreateFrontendModule($idParts[0]);
return ($module instanceof FrontendModule && $module->AllowCustomTemplates()) ? $module : null;
} | [
"protected",
"function",
"RemovalTemplateModule",
"(",
"array",
"$",
"idParts",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"idParts",
")",
"!=",
"2",
")",
"{",
"return",
"null",
";",
"}",
"$",
"module",
"=",
"ClassFinder",
"::",
"CreateFrontendModule",
"(",
... | The removel template module
@param array $idParts
@return FrontendModule | [
"The",
"removel",
"template",
"module"
] | 38c1be8d03ebffae950d00a96da3c612aff67832 | https://github.com/agentmedia/phine-core/blob/38c1be8d03ebffae950d00a96da3c612aff67832/src/Core/Modules/Backend/TemplateList.php#L117-L125 | train |
Vectrex/vxPHP | src/Form/FormElement/FormElementWithOptions/MultipleSelectElement.php | MultipleSelectElement.setValue | public function setValue($value = null)
{
if(isset($value)) {
//ENT_QUOTES not set
$this->value = array_map('htmlspecialchars', (array) $value);
}
foreach($this->options as $o) {
$v = $this->getValue();
if(is_array($v) && in_array($o->getValue(), $v)) {
$o->select();
}
else {
$... | php | public function setValue($value = null)
{
if(isset($value)) {
//ENT_QUOTES not set
$this->value = array_map('htmlspecialchars', (array) $value);
}
foreach($this->options as $o) {
$v = $this->getValue();
if(is_array($v) && in_array($o->getValue(), $v)) {
$o->select();
}
else {
$... | [
"public",
"function",
"setValue",
"(",
"$",
"value",
"=",
"null",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"value",
")",
")",
"{",
"//ENT_QUOTES not set",
"$",
"this",
"->",
"value",
"=",
"array_map",
"(",
"'htmlspecialchars'",
",",
"(",
"array",
")",
"... | set value of select element
value can be either a primitive or an array
@param mixed $value
@return MultipleSelectElement | [
"set",
"value",
"of",
"select",
"element",
"value",
"can",
"be",
"either",
"a",
"primitive",
"or",
"an",
"array"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Form/FormElement/FormElementWithOptions/MultipleSelectElement.php#L66-L90 | train |
ScaraMVC/Framework | src/Scara/Http/Groups/Auth.php | Auth.init | public function init($options = [])
{
$auth = new Authentication();
if (!$auth->check()) {
$url = (isset($options['auth_login_url']))
? $options['auth_login_url']
: '/auth/login';
$this->redirect = $url;
}
} | php | public function init($options = [])
{
$auth = new Authentication();
if (!$auth->check()) {
$url = (isset($options['auth_login_url']))
? $options['auth_login_url']
: '/auth/login';
$this->redirect = $url;
}
} | [
"public",
"function",
"init",
"(",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"auth",
"=",
"new",
"Authentication",
"(",
")",
";",
"if",
"(",
"!",
"$",
"auth",
"->",
"check",
"(",
")",
")",
"{",
"$",
"url",
"=",
"(",
"isset",
"(",
"$",
"op... | Group init function.
@param array $options
@return void | [
"Group",
"init",
"function",
"."
] | 199b08b45fadf5dae14ac4732af03b36e15bbef2 | https://github.com/ScaraMVC/Framework/blob/199b08b45fadf5dae14ac4732af03b36e15bbef2/src/Scara/Http/Groups/Auth.php#L21-L32 | train |
ingro/Rest | src/Ingruz/Rest/Helpers/DBQueryHelper.php | DBQueryHelper.getData | public function getData()
{
/**
* Eloquent's built in "paginate" method does not work well when the query contains "join", "having", or "groupby"
* so to make things work more reliably we just create the paginator object by hand after running the query
* TODO: find a way to not us... | php | public function getData()
{
/**
* Eloquent's built in "paginate" method does not work well when the query contains "join", "having", or "groupby"
* so to make things work more reliably we just create the paginator object by hand after running the query
* TODO: find a way to not us... | [
"public",
"function",
"getData",
"(",
")",
"{",
"/**\n * Eloquent's built in \"paginate\" method does not work well when the query contains \"join\", \"having\", or \"groupby\"\n * so to make things work more reliably we just create the paginator object by hand after running the query\n ... | Return the data filter by the options
@return array | [
"Return",
"the",
"data",
"filter",
"by",
"the",
"options"
] | 922bed071b8ea41feb067d97a3e283f944a86cb8 | https://github.com/ingro/Rest/blob/922bed071b8ea41feb067d97a3e283f944a86cb8/src/Ingruz/Rest/Helpers/DBQueryHelper.php#L150-L170 | train |
cubicmushroom/valueobjects | src/Number/Integer.php | Integer.sameValueAs | public function sameValueAs(ValueObjectInterface $integer)
{
if (false === Util::classEquals($this, $integer)) {
return false;
}
return $this->toNative() === $integer->toNative();
} | php | public function sameValueAs(ValueObjectInterface $integer)
{
if (false === Util::classEquals($this, $integer)) {
return false;
}
return $this->toNative() === $integer->toNative();
} | [
"public",
"function",
"sameValueAs",
"(",
"ValueObjectInterface",
"$",
"integer",
")",
"{",
"if",
"(",
"false",
"===",
"Util",
"::",
"classEquals",
"(",
"$",
"this",
",",
"$",
"integer",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"$",
"this",
... | Tells whether two Integer are equal by comparing their values
@param ValueObjectInterface $integer
@return bool | [
"Tells",
"whether",
"two",
"Integer",
"are",
"equal",
"by",
"comparing",
"their",
"values"
] | 4554239ab75d65eeb9773219aa5b07e9fbfabb92 | https://github.com/cubicmushroom/valueobjects/blob/4554239ab75d65eeb9773219aa5b07e9fbfabb92/src/Number/Integer.php#L33-L40 | train |
rollerworks/search-core | Input/StringLexer.php | StringLexer.stringValue | public function stringValue(string $allowedNext = ',;)'): string
{
$value = '';
if ($this->isEnd()) {
throw $this->createSyntaxException('StringValue');
}
if ('"' === $this->data[$this->cursor]) {
$this->moveCursor('"');
while ("\n" !== $c = mb_... | php | public function stringValue(string $allowedNext = ',;)'): string
{
$value = '';
if ($this->isEnd()) {
throw $this->createSyntaxException('StringValue');
}
if ('"' === $this->data[$this->cursor]) {
$this->moveCursor('"');
while ("\n" !== $c = mb_... | [
"public",
"function",
"stringValue",
"(",
"string",
"$",
"allowedNext",
"=",
"',;)'",
")",
":",
"string",
"{",
"$",
"value",
"=",
"''",
";",
"if",
"(",
"$",
"this",
"->",
"isEnd",
"(",
")",
")",
"{",
"throw",
"$",
"this",
"->",
"createSyntaxException",... | Expect a StringValue.
A StringValue consists of non-special characters in any scripture (language)
or a QuotedValue. Trailing whitespace are skipped. | [
"Expect",
"a",
"StringValue",
"."
] | 6b5671b8c4d6298906ded768261b0a59845140fb | https://github.com/rollerworks/search-core/blob/6b5671b8c4d6298906ded768261b0a59845140fb/Input/StringLexer.php#L201-L274 | train |
pryley/castor-framework | src/Services/Email.php | Email.stripHtmlTags | protected function stripHtmlTags( $string )
{
$string = preg_replace( '@<(embed|head|noembed|noscript|object|script|style)[^>]*?>.*?</\\1>@siu', '', $string );
$string = preg_replace( '@</(div|h[1-9]|p|pre|tr)@iu', "\r\n\$0", $string );
$string = preg_replace( '@</(td|th)@iu', " \$0", $string );
$string = preg... | php | protected function stripHtmlTags( $string )
{
$string = preg_replace( '@<(embed|head|noembed|noscript|object|script|style)[^>]*?>.*?</\\1>@siu', '', $string );
$string = preg_replace( '@</(div|h[1-9]|p|pre|tr)@iu', "\r\n\$0", $string );
$string = preg_replace( '@</(td|th)@iu', " \$0", $string );
$string = preg... | [
"protected",
"function",
"stripHtmlTags",
"(",
"$",
"string",
")",
"{",
"$",
"string",
"=",
"preg_replace",
"(",
"'@<(embed|head|noembed|noscript|object|script|style)[^>]*?>.*?</\\\\1>@siu'",
",",
"''",
",",
"$",
"string",
")",
";",
"$",
"string",
"=",
"preg_replace",... | - remove invisible elements
- replace certain elements with a line-break
- replace certain table elements with a space
- add a placeholder for plain-text bullets to list elements
- strip all remaining HTML tags
@return string | [
"-",
"remove",
"invisible",
"elements",
"-",
"replace",
"certain",
"elements",
"with",
"a",
"line",
"-",
"break",
"-",
"replace",
"certain",
"table",
"elements",
"with",
"a",
"space",
"-",
"add",
"a",
"placeholder",
"for",
"plain",
"-",
"text",
"bullets",
... | cbc137d02625cd05f4cc96414d6f70e451cb821f | https://github.com/pryley/castor-framework/blob/cbc137d02625cd05f4cc96414d6f70e451cb821f/src/Services/Email.php#L254-L265 | train |
pluf/tenant | src/Tenant/SpaService.php | Tenant_SpaService.installFromFile | public static function installFromFile($path, $deleteFile = false)
{
// crate spa
$spa = new Tenant_SPA();
$spa->path = 'not/set';
$spa->name = 'spa-' . rand();
$spa->create();
try {
return self::updateFromFile($spa, $path, $deleteFile);
} catch (E... | php | public static function installFromFile($path, $deleteFile = false)
{
// crate spa
$spa = new Tenant_SPA();
$spa->path = 'not/set';
$spa->name = 'spa-' . rand();
$spa->create();
try {
return self::updateFromFile($spa, $path, $deleteFile);
} catch (E... | [
"public",
"static",
"function",
"installFromFile",
"(",
"$",
"path",
",",
"$",
"deleteFile",
"=",
"false",
")",
"{",
"// crate spa",
"$",
"spa",
"=",
"new",
"Tenant_SPA",
"(",
")",
";",
"$",
"spa",
"->",
"path",
"=",
"'not/set'",
";",
"$",
"spa",
"->",... | Install spa from file into the tenant.
@param String $path
@param string $deleteFile
@throws Pluf_Exception | [
"Install",
"spa",
"from",
"file",
"into",
"the",
"tenant",
"."
] | a06359c52b9a257b5a0a186264e8770acfc54b73 | https://github.com/pluf/tenant/blob/a06359c52b9a257b5a0a186264e8770acfc54b73/src/Tenant/SpaService.php#L47-L60 | train |
theias/infoblox | src/Infoblox.php | Infoblox.getAddressInfo | public function getAddressInfo($ipAddress)
{
// This test is a trick to determine if we have a valid IPv4 address, the
// only kind we can handle at the moment.
$long = ip2long($ipAddress);
if ($long == -1 || $long === false) {
return null;
}
$result = $th... | php | public function getAddressInfo($ipAddress)
{
// This test is a trick to determine if we have a valid IPv4 address, the
// only kind we can handle at the moment.
$long = ip2long($ipAddress);
if ($long == -1 || $long === false) {
return null;
}
$result = $th... | [
"public",
"function",
"getAddressInfo",
"(",
"$",
"ipAddress",
")",
"{",
"// This test is a trick to determine if we have a valid IPv4 address, the",
"// only kind we can handle at the moment.",
"$",
"long",
"=",
"ip2long",
"(",
"$",
"ipAddress",
")",
";",
"if",
"(",
"$",
... | Looks up an IP Address and returns whatever Infoblox knows about it.
@param string $ipAddress
@return array|null | [
"Looks",
"up",
"an",
"IP",
"Address",
"and",
"returns",
"whatever",
"Infoblox",
"knows",
"about",
"it",
"."
] | b1273225128a5cd491306dfadbe638bcc5b16036 | https://github.com/theias/infoblox/blob/b1273225128a5cd491306dfadbe638bcc5b16036/src/Infoblox.php#L37-L50 | train |
theias/infoblox | src/Infoblox.php | Infoblox.getMacFilterInfo | public function getMacFilterInfo($macAddress)
{
$result = $this->gateway->get(
'macfilteraddress',
[
'filter' => $this->filter,
'mac' => $macAddress,
'_max_results' => 1
]
);
return (isset($result[0])) ? $resul... | php | public function getMacFilterInfo($macAddress)
{
$result = $this->gateway->get(
'macfilteraddress',
[
'filter' => $this->filter,
'mac' => $macAddress,
'_max_results' => 1
]
);
return (isset($result[0])) ? $resul... | [
"public",
"function",
"getMacFilterInfo",
"(",
"$",
"macAddress",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"gateway",
"->",
"get",
"(",
"'macfilteraddress'",
",",
"[",
"'filter'",
"=>",
"$",
"this",
"->",
"filter",
",",
"'mac'",
"=>",
"$",
"macAd... | Returns whatever Infoblox knows about a MAC address filter address.
@param string $macAddress
@return array|null | [
"Returns",
"whatever",
"Infoblox",
"knows",
"about",
"a",
"MAC",
"address",
"filter",
"address",
"."
] | b1273225128a5cd491306dfadbe638bcc5b16036 | https://github.com/theias/infoblox/blob/b1273225128a5cd491306dfadbe638bcc5b16036/src/Infoblox.php#L59-L70 | train |
theias/infoblox | src/Infoblox.php | Infoblox.getRegistrations | public function getRegistrations($username)
{
$params = [];
$params['filter'] = $this->filter;
$params['username'] = $username;
$params['_return_fields+'] = 'fingerprint,extattrs';
return $this->gateway->get('macfilteraddress', $params);
} | php | public function getRegistrations($username)
{
$params = [];
$params['filter'] = $this->filter;
$params['username'] = $username;
$params['_return_fields+'] = 'fingerprint,extattrs';
return $this->gateway->get('macfilteraddress', $params);
} | [
"public",
"function",
"getRegistrations",
"(",
"$",
"username",
")",
"{",
"$",
"params",
"=",
"[",
"]",
";",
"$",
"params",
"[",
"'filter'",
"]",
"=",
"$",
"this",
"->",
"filter",
";",
"$",
"params",
"[",
"'username'",
"]",
"=",
"$",
"username",
";",... | Returns MAC address filter registrations for a given user.
@param string $username
@throws \Exception
@return array|null | [
"Returns",
"MAC",
"address",
"filter",
"registrations",
"for",
"a",
"given",
"user",
"."
] | b1273225128a5cd491306dfadbe638bcc5b16036 | https://github.com/theias/infoblox/blob/b1273225128a5cd491306dfadbe638bcc5b16036/src/Infoblox.php#L106-L113 | train |
theias/infoblox | src/Infoblox.php | Infoblox.formatMacAddress | public static function formatMacAddress($validAddress)
{
if (strlen($validAddress) == 12) {
$formattedAddress = substr($validAddress, 0, 2);
for ($i=2; $i<12; $i+=2) {
$formattedAddress .= ':'.substr($validAddress, $i, 2);
}
return $formattedAd... | php | public static function formatMacAddress($validAddress)
{
if (strlen($validAddress) == 12) {
$formattedAddress = substr($validAddress, 0, 2);
for ($i=2; $i<12; $i+=2) {
$formattedAddress .= ':'.substr($validAddress, $i, 2);
}
return $formattedAd... | [
"public",
"static",
"function",
"formatMacAddress",
"(",
"$",
"validAddress",
")",
"{",
"if",
"(",
"strlen",
"(",
"$",
"validAddress",
")",
"==",
"12",
")",
"{",
"$",
"formattedAddress",
"=",
"substr",
"(",
"$",
"validAddress",
",",
"0",
",",
"2",
")",
... | Formats a MAC Address.
This function accepts MAC addresses in one of the following valid
formats:
- aabbccddeeff
- aa-bb-cc-dd-ee-ff
- aa:bb:cc:dd:ee:ff
It returns the address formatted like this: aa:bb:cc:dd:ee:ff.
@param string $validAddress
@return string|null | [
"Formats",
"a",
"MAC",
"Address",
"."
] | b1273225128a5cd491306dfadbe638bcc5b16036 | https://github.com/theias/infoblox/blob/b1273225128a5cd491306dfadbe638bcc5b16036/src/Infoblox.php#L145-L158 | train |
Xiphe/Base | src/Xiphe/Base.php | Base.i | public static function i()
{
$class = get_called_class();
$initArgs = func_get_args();
if (count($initArgs) === 1) {
$initArgs = $initArgs[0];
}
if (!empty(self::$_baseInstances[$class])) {
$inst = self::$_baseInstances[$class];
if (!empty... | php | public static function i()
{
$class = get_called_class();
$initArgs = func_get_args();
if (count($initArgs) === 1) {
$initArgs = $initArgs[0];
}
if (!empty(self::$_baseInstances[$class])) {
$inst = self::$_baseInstances[$class];
if (!empty... | [
"public",
"static",
"function",
"i",
"(",
")",
"{",
"$",
"class",
"=",
"get_called_class",
"(",
")",
";",
"$",
"initArgs",
"=",
"func_get_args",
"(",
")",
";",
"if",
"(",
"count",
"(",
"$",
"initArgs",
")",
"===",
"1",
")",
"{",
"$",
"initArgs",
"=... | Direct static constructor and singleton getter.
@return object | [
"Direct",
"static",
"constructor",
"and",
"singleton",
"getter",
"."
] | 2c7be3a3cda6e881cd6ea5b3badc327a7e935f98 | https://github.com/Xiphe/Base/blob/2c7be3a3cda6e881cd6ea5b3badc327a7e935f98/src/Xiphe/Base.php#L123-L141 | train |
Xiphe/Base | src/Xiphe/Base.php | Base.initConfig | public function initConfig($config)
{
if (is_string($config)) {
if (file_exists(($configFile = $config)) ||
file_exists(($configFile = dirname(dirname(__FILE__)).self::DS.$config))
) {
$config = $this->loadConfig($configFile);
}
}... | php | public function initConfig($config)
{
if (is_string($config)) {
if (file_exists(($configFile = $config)) ||
file_exists(($configFile = dirname(dirname(__FILE__)).self::DS.$config))
) {
$config = $this->loadConfig($configFile);
}
}... | [
"public",
"function",
"initConfig",
"(",
"$",
"config",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"config",
")",
")",
"{",
"if",
"(",
"file_exists",
"(",
"(",
"$",
"configFile",
"=",
"$",
"config",
")",
")",
"||",
"file_exists",
"(",
"(",
"$",
"c... | Initiate class configuration
@param mixed $config a filename or array/object of config values
@return object | [
"Initiate",
"class",
"configuration"
] | 2c7be3a3cda6e881cd6ea5b3badc327a7e935f98 | https://github.com/Xiphe/Base/blob/2c7be3a3cda6e881cd6ea5b3badc327a7e935f98/src/Xiphe/Base.php#L180-L197 | train |
Xiphe/Base | src/Xiphe/Base.php | Base.mergeConfig | public function mergeConfig($new = array())
{
$config = (object) array_merge(
(array) $this->_defaultConfiguration,
(array) $this->_configuration,
(array) $new
);
foreach ($config as $key => $value) {
$this->setConfig($key, $value);
}
... | php | public function mergeConfig($new = array())
{
$config = (object) array_merge(
(array) $this->_defaultConfiguration,
(array) $this->_configuration,
(array) $new
);
foreach ($config as $key => $value) {
$this->setConfig($key, $value);
}
... | [
"public",
"function",
"mergeConfig",
"(",
"$",
"new",
"=",
"array",
"(",
")",
")",
"{",
"$",
"config",
"=",
"(",
"object",
")",
"array_merge",
"(",
"(",
"array",
")",
"$",
"this",
"->",
"_defaultConfiguration",
",",
"(",
"array",
")",
"$",
"this",
"-... | Merge new data into the current defaults and configuration
@param mixed $new new data for configuration
@return object | [
"Merge",
"new",
"data",
"into",
"the",
"current",
"defaults",
"and",
"configuration"
] | 2c7be3a3cda6e881cd6ea5b3badc327a7e935f98 | https://github.com/Xiphe/Base/blob/2c7be3a3cda6e881cd6ea5b3badc327a7e935f98/src/Xiphe/Base.php#L206-L219 | train |
Xiphe/Base | src/Xiphe/Base.php | Base.loadConfig | public function loadConfig($file)
{
$config;
switch (pathinfo($file, PATHINFO_EXTENSION)) {
case 'json':
$config = json_decode(file_get_contents($file));
break;
case 'php':
$config = include $file;
break;
default:
r... | php | public function loadConfig($file)
{
$config;
switch (pathinfo($file, PATHINFO_EXTENSION)) {
case 'json':
$config = json_decode(file_get_contents($file));
break;
case 'php':
$config = include $file;
break;
default:
r... | [
"public",
"function",
"loadConfig",
"(",
"$",
"file",
")",
"{",
"$",
"config",
";",
"switch",
"(",
"pathinfo",
"(",
"$",
"file",
",",
"PATHINFO_EXTENSION",
")",
")",
"{",
"case",
"'json'",
":",
"$",
"config",
"=",
"json_decode",
"(",
"file_get_contents",
... | Loads the configuration from a json or php file
@param string $file the full path to the configuration file
@return object | [
"Loads",
"the",
"configuration",
"from",
"a",
"json",
"or",
"php",
"file"
] | 2c7be3a3cda6e881cd6ea5b3badc327a7e935f98 | https://github.com/Xiphe/Base/blob/2c7be3a3cda6e881cd6ea5b3badc327a7e935f98/src/Xiphe/Base.php#L229-L247 | train |
Xiphe/Base | src/Xiphe/Base.php | Base.getCallbackKey | public function getCallbackKey($callback)
{
if (is_array($callback)) {
if (is_object($callback[0])) {
$callback[0] = spl_object_hash($callback[0]);
}
} elseif ((function(){} instanceof $callback)) {
$callback = spl_object_hash($callback);
}... | php | public function getCallbackKey($callback)
{
if (is_array($callback)) {
if (is_object($callback[0])) {
$callback[0] = spl_object_hash($callback[0]);
}
} elseif ((function(){} instanceof $callback)) {
$callback = spl_object_hash($callback);
}... | [
"public",
"function",
"getCallbackKey",
"(",
"$",
"callback",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"callback",
")",
")",
"{",
"if",
"(",
"is_object",
"(",
"$",
"callback",
"[",
"0",
"]",
")",
")",
"{",
"$",
"callback",
"[",
"0",
"]",
"=",
"... | Generates unique hashes for callback functions
@param mixed $callback
@return sting | [
"Generates",
"unique",
"hashes",
"for",
"callback",
"functions"
] | 2c7be3a3cda6e881cd6ea5b3badc327a7e935f98 | https://github.com/Xiphe/Base/blob/2c7be3a3cda6e881cd6ea5b3badc327a7e935f98/src/Xiphe/Base.php#L304-L315 | train |
Xiphe/Base | src/Xiphe/Base.php | Base.doCallback | public function doCallback($name, array $values = array(), $getResult = false)
{
$values = array_merge(
$values,
array($name, $this)
);
if ($getResult) {
$result = $values[0];
}
/*
* Hook into Wordpress if wanted.
*/
... | php | public function doCallback($name, array $values = array(), $getResult = false)
{
$values = array_merge(
$values,
array($name, $this)
);
if ($getResult) {
$result = $values[0];
}
/*
* Hook into Wordpress if wanted.
*/
... | [
"public",
"function",
"doCallback",
"(",
"$",
"name",
",",
"array",
"$",
"values",
"=",
"array",
"(",
")",
",",
"$",
"getResult",
"=",
"false",
")",
"{",
"$",
"values",
"=",
"array_merge",
"(",
"$",
"values",
",",
"array",
"(",
"$",
"name",
",",
"$... | Executes callbacks for a hook
@param string $name
@param array $values
@return object | [
"Executes",
"callbacks",
"for",
"a",
"hook"
] | 2c7be3a3cda6e881cd6ea5b3badc327a7e935f98 | https://github.com/Xiphe/Base/blob/2c7be3a3cda6e881cd6ea5b3badc327a7e935f98/src/Xiphe/Base.php#L325-L366 | train |
Xiphe/Base | src/Xiphe/Base.php | Base.addCallback | public function addCallback($name, $callback, $prio = 10)
{
if (!is_callable($callback)) {
throw new \Exception("Callback not callable.", 3);
return false;
}
$key = $this->getCallbackKey($callback);
if (!isset(self::$_baseRealCallbacks[$key])) {
se... | php | public function addCallback($name, $callback, $prio = 10)
{
if (!is_callable($callback)) {
throw new \Exception("Callback not callable.", 3);
return false;
}
$key = $this->getCallbackKey($callback);
if (!isset(self::$_baseRealCallbacks[$key])) {
se... | [
"public",
"function",
"addCallback",
"(",
"$",
"name",
",",
"$",
"callback",
",",
"$",
"prio",
"=",
"10",
")",
"{",
"if",
"(",
"!",
"is_callable",
"(",
"$",
"callback",
")",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"\"Callback not callable.\"",
... | Adds a callback listener
@param string $name the hook name
@param function $callback
@param integer $prio higher means later
return object | [
"Adds",
"a",
"callback",
"listener"
] | 2c7be3a3cda6e881cd6ea5b3badc327a7e935f98 | https://github.com/Xiphe/Base/blob/2c7be3a3cda6e881cd6ea5b3badc327a7e935f98/src/Xiphe/Base.php#L377-L392 | train |
Xiphe/Base | src/Xiphe/Base.php | Base.removeCallback | public function removeCallback($name, $callback, $prio = 10)
{
$key = $this->getCallbackKey($callback);
if (in_array($key, $this->_callbacks[$name][$prio])) {
while(false !== $k = array_search($key, $this->_callbacks[$name][$prio])) {
unset($this->_callbacks[$name][$prio... | php | public function removeCallback($name, $callback, $prio = 10)
{
$key = $this->getCallbackKey($callback);
if (in_array($key, $this->_callbacks[$name][$prio])) {
while(false !== $k = array_search($key, $this->_callbacks[$name][$prio])) {
unset($this->_callbacks[$name][$prio... | [
"public",
"function",
"removeCallback",
"(",
"$",
"name",
",",
"$",
"callback",
",",
"$",
"prio",
"=",
"10",
")",
"{",
"$",
"key",
"=",
"$",
"this",
"->",
"getCallbackKey",
"(",
"$",
"callback",
")",
";",
"if",
"(",
"in_array",
"(",
"$",
"key",
","... | Removes the callback from the specific hook at the specific priority
@param string $name the hook name
@param function $callback
@param integer $prio
@return object | [
"Removes",
"the",
"callback",
"from",
"the",
"specific",
"hook",
"at",
"the",
"specific",
"priority"
] | 2c7be3a3cda6e881cd6ea5b3badc327a7e935f98 | https://github.com/Xiphe/Base/blob/2c7be3a3cda6e881cd6ea5b3badc327a7e935f98/src/Xiphe/Base.php#L403-L420 | train |
Xiphe/Base | src/Xiphe/Base.php | Base.killCallback | public function killCallback($callback)
{
$key = $this->getCallbackKey($callback);
self::$_baseRealCallbacks[$key] = false;
return $this;
} | php | public function killCallback($callback)
{
$key = $this->getCallbackKey($callback);
self::$_baseRealCallbacks[$key] = false;
return $this;
} | [
"public",
"function",
"killCallback",
"(",
"$",
"callback",
")",
"{",
"$",
"key",
"=",
"$",
"this",
"->",
"getCallbackKey",
"(",
"$",
"callback",
")",
";",
"self",
"::",
"$",
"_baseRealCallbacks",
"[",
"$",
"key",
"]",
"=",
"false",
";",
"return",
"$",... | Globally disables the passed function from being called by any hook.
@param mixed $callback
@return object | [
"Globally",
"disables",
"the",
"passed",
"function",
"from",
"being",
"called",
"by",
"any",
"hook",
"."
] | 2c7be3a3cda6e881cd6ea5b3badc327a7e935f98 | https://github.com/Xiphe/Base/blob/2c7be3a3cda6e881cd6ea5b3badc327a7e935f98/src/Xiphe/Base.php#L429-L436 | train |
Xiphe/Base | src/Xiphe/Base.php | Base.reanimateCallback | public function reanimateCallback($callback)
{
$key = $this->getCallbackKey($callback);
self::$_baseRealCallbacks[$key] = $callback;
return $this;
} | php | public function reanimateCallback($callback)
{
$key = $this->getCallbackKey($callback);
self::$_baseRealCallbacks[$key] = $callback;
return $this;
} | [
"public",
"function",
"reanimateCallback",
"(",
"$",
"callback",
")",
"{",
"$",
"key",
"=",
"$",
"this",
"->",
"getCallbackKey",
"(",
"$",
"callback",
")",
";",
"self",
"::",
"$",
"_baseRealCallbacks",
"[",
"$",
"key",
"]",
"=",
"$",
"callback",
";",
"... | Globally enables the passed function to receive callback calls.
Happens automatically when using addCallback().
Use this to re enable callbacks disabled by detachCallbackFunction()
@param mixed $callback
@return object | [
"Globally",
"enables",
"the",
"passed",
"function",
"to",
"receive",
"callback",
"calls",
"."
] | 2c7be3a3cda6e881cd6ea5b3badc327a7e935f98 | https://github.com/Xiphe/Base/blob/2c7be3a3cda6e881cd6ea5b3badc327a7e935f98/src/Xiphe/Base.php#L448-L455 | train |
Xiphe/Base | src/Xiphe/Base.php | Base._exit | public function _exit($status = null, $msg = null, $errorCode = null)
{
foreach (array('status', 'msg', 'errorCode') as $k) {
if ($$k !== null) {
self::$_baseR[$k] = $$k;
}
}
echo serialize(self::$_baseR);
exit;
} | php | public function _exit($status = null, $msg = null, $errorCode = null)
{
foreach (array('status', 'msg', 'errorCode') as $k) {
if ($$k !== null) {
self::$_baseR[$k] = $$k;
}
}
echo serialize(self::$_baseR);
exit;
} | [
"public",
"function",
"_exit",
"(",
"$",
"status",
"=",
"null",
",",
"$",
"msg",
"=",
"null",
",",
"$",
"errorCode",
"=",
"null",
")",
"{",
"foreach",
"(",
"array",
"(",
"'status'",
",",
"'msg'",
",",
"'errorCode'",
")",
"as",
"$",
"k",
")",
"{",
... | Killer function stops the script and echoes the serialized response
@access public
@param string $status short string describing the status (error|ok|...)
@param string $msg longer description of the status, error msg etc.
@param int $errorCode unique number for the error.
@return void | [
"Killer",
"function",
"stops",
"the",
"script",
"and",
"echoes",
"the",
"serialized",
"response"
] | 2c7be3a3cda6e881cd6ea5b3badc327a7e935f98 | https://github.com/Xiphe/Base/blob/2c7be3a3cda6e881cd6ea5b3badc327a7e935f98/src/Xiphe/Base.php#L471-L481 | train |
cloudtek/dynamodm | lib/Cloudtek/DynamoDM/Iterator/SdkResultIterator.php | SdkResultIterator.search | public function search($expression)
{
// Apply JMESPath expression on each result, but as a flat sequence.
return \Aws\flatmap($this, function (\Aws\ResultInterface $result) use ($expression) {
return (array)$result->search($expression);
});
} | php | public function search($expression)
{
// Apply JMESPath expression on each result, but as a flat sequence.
return \Aws\flatmap($this, function (\Aws\ResultInterface $result) use ($expression) {
return (array)$result->search($expression);
});
} | [
"public",
"function",
"search",
"(",
"$",
"expression",
")",
"{",
"// Apply JMESPath expression on each result, but as a flat sequence.",
"return",
"\\",
"Aws",
"\\",
"flatmap",
"(",
"$",
"this",
",",
"function",
"(",
"\\",
"Aws",
"\\",
"ResultInterface",
"$",
"resu... | Returns an iterator that iterates over the values of applying a JMESPath
search to each wrapped \Aws\ResultInterface as a flat sequence.
@param string $expression JMESPath expression to apply to each result.
@return \Iterator | [
"Returns",
"an",
"iterator",
"that",
"iterates",
"over",
"the",
"values",
"of",
"applying",
"a",
"JMESPath",
"search",
"to",
"each",
"wrapped",
"\\",
"Aws",
"\\",
"ResultInterface",
"as",
"a",
"flat",
"sequence",
"."
] | 119d355e2c5cbaef1f867970349b4432f5704fcd | https://github.com/cloudtek/dynamodm/blob/119d355e2c5cbaef1f867970349b4432f5704fcd/lib/Cloudtek/DynamoDM/Iterator/SdkResultIterator.php#L18-L24 | train |
Vectrex/vxPHP | src/Debug/ExceptionHandler.php | ExceptionHandler.register | public static function register($debug = TRUE, $charset = 'UTF-8') {
if(self::$handler) {
throw new \RuntimeException('Exception handler already registered.');
}
self::$handler = new static($debug, $charset);
set_exception_handler(array(self::$handler, 'handle'));
return self::$handler;
} | php | public static function register($debug = TRUE, $charset = 'UTF-8') {
if(self::$handler) {
throw new \RuntimeException('Exception handler already registered.');
}
self::$handler = new static($debug, $charset);
set_exception_handler(array(self::$handler, 'handle'));
return self::$handler;
} | [
"public",
"static",
"function",
"register",
"(",
"$",
"debug",
"=",
"TRUE",
",",
"$",
"charset",
"=",
"'UTF-8'",
")",
"{",
"if",
"(",
"self",
"::",
"$",
"handler",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"'Exception handler already registere... | register custom exception handler
@param string $debug
@param string $charset
@throws \RuntimeException | [
"register",
"custom",
"exception",
"handler"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Debug/ExceptionHandler.php#L49-L61 | train |
Vectrex/vxPHP | src/Debug/ExceptionHandler.php | ExceptionHandler.decorateException | protected function decorateException(\Exception $e, $status) {
$headerTpl = '
<!DOCTYPE html>
<html>
<head>
<title>Error %d</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body>
<table>
<tr>
<th colspan="4">%s</th>
</tr>
<tr>
<t... | php | protected function decorateException(\Exception $e, $status) {
$headerTpl = '
<!DOCTYPE html>
<html>
<head>
<title>Error %d</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body>
<table>
<tr>
<th colspan="4">%s</th>
</tr>
<tr>
<t... | [
"protected",
"function",
"decorateException",
"(",
"\\",
"Exception",
"$",
"e",
",",
"$",
"status",
")",
"{",
"$",
"headerTpl",
"=",
"'\n\t\t<!DOCTYPE html>\n\t\t<html>\n\t\t\t<head>\n\t\t\t\t<title>Error %d</title>\n\t\t\t\t<meta http-equiv=\"content-type\" content=\"text/html; char... | generate simple formatted output of exception
@param \Exception $e
@param integer $status
@return string | [
"generate",
"simple",
"formatted",
"output",
"of",
"exception"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Debug/ExceptionHandler.php#L136-L186 | train |
Aviogram/Common | src/PHPClass/Element/DocBlock.php | DocBlock.createParamTag | public function createParamTag($type, $name, $description = null)
{
return $this->createVariableTag('param', $type, $name, $description);
} | php | public function createParamTag($type, $name, $description = null)
{
return $this->createVariableTag('param', $type, $name, $description);
} | [
"public",
"function",
"createParamTag",
"(",
"$",
"type",
",",
"$",
"name",
",",
"$",
"description",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"createVariableTag",
"(",
"'param'",
",",
"$",
"type",
",",
"$",
"name",
",",
"$",
"description",
"... | Create a param tag for describing method arguments
@param string $type The type of the argument (See FileClass::PHP_TYPE_*) or use class name
@param string $name The name of the parameters (method argument)
@param null|string $description The description with the argument
@return DocBlock
... | [
"Create",
"a",
"param",
"tag",
"for",
"describing",
"method",
"arguments"
] | bcff2e409cccd4791a3f9bca0b2cdd70c25ddec5 | https://github.com/Aviogram/Common/blob/bcff2e409cccd4791a3f9bca0b2cdd70c25ddec5/src/PHPClass/Element/DocBlock.php#L258-L261 | train |
Aviogram/Common | src/PHPClass/Element/DocBlock.php | DocBlock.createPropertyTag | public function createPropertyTag($type, $name, $description = null)
{
return $this->createVariableTag('property', $type, $name, $description);
} | php | public function createPropertyTag($type, $name, $description = null)
{
return $this->createVariableTag('property', $type, $name, $description);
} | [
"public",
"function",
"createPropertyTag",
"(",
"$",
"type",
",",
"$",
"name",
",",
"$",
"description",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"createVariableTag",
"(",
"'property'",
",",
"$",
"type",
",",
"$",
"name",
",",
"$",
"description... | Create a property tag for describing class properties
@param string $type The type of the property (See FileClass::PHP_TYPE_*) or use class name
@param string $name The name of the property
@param null|string $description The description with the property
@return DocBlock
@throws \Aviogram... | [
"Create",
"a",
"property",
"tag",
"for",
"describing",
"class",
"properties"
] | bcff2e409cccd4791a3f9bca0b2cdd70c25ddec5 | https://github.com/Aviogram/Common/blob/bcff2e409cccd4791a3f9bca0b2cdd70c25ddec5/src/PHPClass/Element/DocBlock.php#L274-L277 | train |
Aviogram/Common | src/PHPClass/Element/DocBlock.php | DocBlock.createReturnTag | public function createReturnTag($type, $description = null)
{
return $this->internalCreateTag(true, 'return', $this->classFile->getType($type), $description);
} | php | public function createReturnTag($type, $description = null)
{
return $this->internalCreateTag(true, 'return', $this->classFile->getType($type), $description);
} | [
"public",
"function",
"createReturnTag",
"(",
"$",
"type",
",",
"$",
"description",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"internalCreateTag",
"(",
"true",
",",
"'return'",
",",
"$",
"this",
"->",
"classFile",
"->",
"getType",
"(",
"$",
"ty... | Define the return type of a method
@param string $type
@param null|string $description
@return DocBlock
@throws \Aviogram\Common\PHPClass\Exception\ClassFile When the type does not exists or the class does not exists | [
"Define",
"the",
"return",
"type",
"of",
"a",
"method"
] | bcff2e409cccd4791a3f9bca0b2cdd70c25ddec5 | https://github.com/Aviogram/Common/blob/bcff2e409cccd4791a3f9bca0b2cdd70c25ddec5/src/PHPClass/Element/DocBlock.php#L321-L324 | train |
Aviogram/Common | src/PHPClass/Element/DocBlock.php | DocBlock.createThrowsTag | public function createThrowsTag($exceptionClass, $description = null)
{
return $this->internalCreateTag(false, 'throws', $this->classFile->getType($exceptionClass), $description);
} | php | public function createThrowsTag($exceptionClass, $description = null)
{
return $this->internalCreateTag(false, 'throws', $this->classFile->getType($exceptionClass), $description);
} | [
"public",
"function",
"createThrowsTag",
"(",
"$",
"exceptionClass",
",",
"$",
"description",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"internalCreateTag",
"(",
"false",
",",
"'throws'",
",",
"$",
"this",
"->",
"classFile",
"->",
"getType",
"(",
... | Indicates if the element throws partical exceptions
@param string $exceptionClass The classname of the exception
@param null|string $description
@return DocBlock
@throws \Aviogram\Common\PHPClass\Exception\ClassFile When the class does not exists | [
"Indicates",
"if",
"the",
"element",
"throws",
"partical",
"exceptions"
] | bcff2e409cccd4791a3f9bca0b2cdd70c25ddec5 | https://github.com/Aviogram/Common/blob/bcff2e409cccd4791a3f9bca0b2cdd70c25ddec5/src/PHPClass/Element/DocBlock.php#L361-L364 | train |
Aviogram/Common | src/PHPClass/Element/DocBlock.php | DocBlock.createVarTag | public function createVarTag($type, $name, $description = null)
{
return $this->createVariableTag('var', $type, $name, $description);
} | php | public function createVarTag($type, $name, $description = null)
{
return $this->createVariableTag('var', $type, $name, $description);
} | [
"public",
"function",
"createVarTag",
"(",
"$",
"type",
",",
"$",
"name",
",",
"$",
"description",
"=",
"null",
")",
"{",
"return",
"$",
"this",
"->",
"createVariableTag",
"(",
"'var'",
",",
"$",
"type",
",",
"$",
"name",
",",
"$",
"description",
")",
... | Create a var tag for describing class properties
@param string $type The type of the property (See FileClass::PHP_TYPE_*) or use class name
@param string $name The name of the property
@param null|string $description The description with the property
@return DocBlock
@throws \Aviogram\Comm... | [
"Create",
"a",
"var",
"tag",
"for",
"describing",
"class",
"properties"
] | bcff2e409cccd4791a3f9bca0b2cdd70c25ddec5 | https://github.com/Aviogram/Common/blob/bcff2e409cccd4791a3f9bca0b2cdd70c25ddec5/src/PHPClass/Element/DocBlock.php#L402-L405 | train |
Aviogram/Common | src/PHPClass/Element/DocBlock.php | DocBlock.internalCreateTag | protected function internalCreateTag($single = true, $name, $column1 = null, $column2 = null, $_ = null)
{
// Create constructor arguments
$arguments = func_get_args();
$single = array_shift($arguments);
array_unshift($arguments, $this->maxColumnLengths);
// Remove null ... | php | protected function internalCreateTag($single = true, $name, $column1 = null, $column2 = null, $_ = null)
{
// Create constructor arguments
$arguments = func_get_args();
$single = array_shift($arguments);
array_unshift($arguments, $this->maxColumnLengths);
// Remove null ... | [
"protected",
"function",
"internalCreateTag",
"(",
"$",
"single",
"=",
"true",
",",
"$",
"name",
",",
"$",
"column1",
"=",
"null",
",",
"$",
"column2",
"=",
"null",
",",
"$",
"_",
"=",
"null",
")",
"{",
"// Create constructor arguments",
"$",
"arguments",
... | Create tag with the given values
@param boolean $single Whether there can be one instance of the tag or not
@param string $name
@param null|string $column1
@param null|string $column2
@param null|string $_
@return DocBlock | [
"Create",
"tag",
"with",
"the",
"given",
"values"
] | bcff2e409cccd4791a3f9bca0b2cdd70c25ddec5 | https://github.com/Aviogram/Common/blob/bcff2e409cccd4791a3f9bca0b2cdd70c25ddec5/src/PHPClass/Element/DocBlock.php#L470-L496 | train |
story75/MultiEventDispatcher | src/EventDispatcherImpl.php | EventDispatcherImpl.addSubscriber | public function addSubscriber(EventSubscriber $eventSubscriber)
{
$listeners = $eventSubscriber->getEvents();
foreach($listeners as $listener => $data)
{
if (is_array($data)) {
$data = new SubscriberConfiguration($data[0], $data[1] ?? self::USE_ALL, $data[2] ?? 1... | php | public function addSubscriber(EventSubscriber $eventSubscriber)
{
$listeners = $eventSubscriber->getEvents();
foreach($listeners as $listener => $data)
{
if (is_array($data)) {
$data = new SubscriberConfiguration($data[0], $data[1] ?? self::USE_ALL, $data[2] ?? 1... | [
"public",
"function",
"addSubscriber",
"(",
"EventSubscriber",
"$",
"eventSubscriber",
")",
"{",
"$",
"listeners",
"=",
"$",
"eventSubscriber",
"->",
"getEvents",
"(",
")",
";",
"foreach",
"(",
"$",
"listeners",
"as",
"$",
"listener",
"=>",
"$",
"data",
")",... | Adds an event subscriber that listens on the specified events.
Internally this will convert all handlers to listeners.
@param EventSubscriber $eventSubscriber The subscriber
@throws \InvalidArgumentException
@api | [
"Adds",
"an",
"event",
"subscriber",
"that",
"listens",
"on",
"the",
"specified",
"events",
".",
"Internally",
"this",
"will",
"convert",
"all",
"handlers",
"to",
"listeners",
"."
] | 02d6821dbb4a1d05a356b97befb9e286e7c5fd19 | https://github.com/story75/MultiEventDispatcher/blob/02d6821dbb4a1d05a356b97befb9e286e7c5fd19/src/EventDispatcherImpl.php#L159-L187 | train |
story75/MultiEventDispatcher | src/EventDispatcherImpl.php | EventDispatcherImpl.getListeners | public function getListeners(string ...$eventNames) : array
{
if (empty($eventNames)) return [];
$key = implode('|', $eventNames);
return $this->combinationListeners[$key] ?? [];
} | php | public function getListeners(string ...$eventNames) : array
{
if (empty($eventNames)) return [];
$key = implode('|', $eventNames);
return $this->combinationListeners[$key] ?? [];
} | [
"public",
"function",
"getListeners",
"(",
"string",
"...",
"$",
"eventNames",
")",
":",
"array",
"{",
"if",
"(",
"empty",
"(",
"$",
"eventNames",
")",
")",
"return",
"[",
"]",
";",
"$",
"key",
"=",
"implode",
"(",
"'|'",
",",
"$",
"eventNames",
")",... | Gets the listeners of a specific event
@param string[] $eventNames The name of the events
@return array The event listeners for the specified event combination | [
"Gets",
"the",
"listeners",
"of",
"a",
"specific",
"event"
] | 02d6821dbb4a1d05a356b97befb9e286e7c5fd19 | https://github.com/story75/MultiEventDispatcher/blob/02d6821dbb4a1d05a356b97befb9e286e7c5fd19/src/EventDispatcherImpl.php#L197-L203 | train |
johnkrovitch/Sam | Filter/Filter.php | Filter.clean | public function clean()
{
$fileSystem = new Filesystem();
if ($fileSystem->exists($this->getCacheDir())) {
$fileSystem->remove($this->getCacheDir());
}
} | php | public function clean()
{
$fileSystem = new Filesystem();
if ($fileSystem->exists($this->getCacheDir())) {
$fileSystem->remove($this->getCacheDir());
}
} | [
"public",
"function",
"clean",
"(",
")",
"{",
"$",
"fileSystem",
"=",
"new",
"Filesystem",
"(",
")",
";",
"if",
"(",
"$",
"fileSystem",
"->",
"exists",
"(",
"$",
"this",
"->",
"getCacheDir",
"(",
")",
")",
")",
"{",
"$",
"fileSystem",
"->",
"remove",... | Remove the assets cache directory. | [
"Remove",
"the",
"assets",
"cache",
"directory",
"."
] | fbd3770c11eecc0a6d8070f439f149062316f606 | https://github.com/johnkrovitch/Sam/blob/fbd3770c11eecc0a6d8070f439f149062316f606/Filter/Filter.php#L73-L80 | train |
johnkrovitch/Sam | Filter/Filter.php | Filter.getCacheDir | public function getCacheDir()
{
$fileSystem = new Filesystem();
$path = 'var/cache/assets/'.$this->name.'/';
if (!$fileSystem->exists($path)) {
$fileSystem->mkdir($path);
}
return $path;
} | php | public function getCacheDir()
{
$fileSystem = new Filesystem();
$path = 'var/cache/assets/'.$this->name.'/';
if (!$fileSystem->exists($path)) {
$fileSystem->mkdir($path);
}
return $path;
} | [
"public",
"function",
"getCacheDir",
"(",
")",
"{",
"$",
"fileSystem",
"=",
"new",
"Filesystem",
"(",
")",
";",
"$",
"path",
"=",
"'var/cache/assets/'",
".",
"$",
"this",
"->",
"name",
".",
"'/'",
";",
"if",
"(",
"!",
"$",
"fileSystem",
"->",
"exists",... | Return the assets cache dir.
@return string | [
"Return",
"the",
"assets",
"cache",
"dir",
"."
] | fbd3770c11eecc0a6d8070f439f149062316f606 | https://github.com/johnkrovitch/Sam/blob/fbd3770c11eecc0a6d8070f439f149062316f606/Filter/Filter.php#L87-L97 | train |
johnkrovitch/Sam | Filter/Filter.php | Filter.addNotification | protected function addNotification($message)
{
$event = new NotificationEvent();
$event->setMessage($message);
$this
->eventDispatcher
->dispatch(NotificationEvent::NAME, $event)
;
} | php | protected function addNotification($message)
{
$event = new NotificationEvent();
$event->setMessage($message);
$this
->eventDispatcher
->dispatch(NotificationEvent::NAME, $event)
;
} | [
"protected",
"function",
"addNotification",
"(",
"$",
"message",
")",
"{",
"$",
"event",
"=",
"new",
"NotificationEvent",
"(",
")",
";",
"$",
"event",
"->",
"setMessage",
"(",
"$",
"message",
")",
";",
"$",
"this",
"->",
"eventDispatcher",
"->",
"dispatch"... | Add a notification to the subscriber.
@param $message | [
"Add",
"a",
"notification",
"to",
"the",
"subscriber",
"."
] | fbd3770c11eecc0a6d8070f439f149062316f606 | https://github.com/johnkrovitch/Sam/blob/fbd3770c11eecc0a6d8070f439f149062316f606/Filter/Filter.php#L129-L138 | train |
OxfordInfoLabs/kinikit-core | src/Util/Serialisation/JSON/JSONToObjectConverter.php | JSONToObjectConverter.convert | public function convert($jsonString, $mapToClass = null) {
// Decode the string using PHP JSON Decode routine
$converted = json_decode($jsonString, true);
if ($mapToClass) {
$converted = SerialisableArrayUtils::convertArrayToSerialisableObjects($converted, $mapToClass);
}
... | php | public function convert($jsonString, $mapToClass = null) {
// Decode the string using PHP JSON Decode routine
$converted = json_decode($jsonString, true);
if ($mapToClass) {
$converted = SerialisableArrayUtils::convertArrayToSerialisableObjects($converted, $mapToClass);
}
... | [
"public",
"function",
"convert",
"(",
"$",
"jsonString",
",",
"$",
"mapToClass",
"=",
"null",
")",
"{",
"// Decode the string using PHP JSON Decode routine",
"$",
"converted",
"=",
"json_decode",
"(",
"$",
"jsonString",
",",
"true",
")",
";",
"if",
"(",
"$",
"... | Convert a json string into objects. If the mapToClass member is passed
the converter will attempt to map the result to an instance of that class type or array.
@param string $jsonString
@param string $mapToClass | [
"Convert",
"a",
"json",
"string",
"into",
"objects",
".",
"If",
"the",
"mapToClass",
"member",
"is",
"passed",
"the",
"converter",
"will",
"attempt",
"to",
"map",
"the",
"result",
"to",
"an",
"instance",
"of",
"that",
"class",
"type",
"or",
"array",
"."
] | edc1b2e6ffabd595c4c7d322279b3dd1e59ef359 | https://github.com/OxfordInfoLabs/kinikit-core/blob/edc1b2e6ffabd595c4c7d322279b3dd1e59ef359/src/Util/Serialisation/JSON/JSONToObjectConverter.php#L20-L31 | train |
flaviovs/yii2-imagefilter | src/Component.php | Component.getToken | protected function getToken($src)
{
$full_path = \Yii::getAlias('@webroot') . "/$src";
try {
$token = hash('crc32b', '$full_path ' . filemtime($full_path));
} catch (\Exception $ex) {
\Yii::error($ex);
return null;
} catch (\Throwable $ex) {
... | php | protected function getToken($src)
{
$full_path = \Yii::getAlias('@webroot') . "/$src";
try {
$token = hash('crc32b', '$full_path ' . filemtime($full_path));
} catch (\Exception $ex) {
\Yii::error($ex);
return null;
} catch (\Throwable $ex) {
... | [
"protected",
"function",
"getToken",
"(",
"$",
"src",
")",
"{",
"$",
"full_path",
"=",
"\\",
"Yii",
"::",
"getAlias",
"(",
"'@webroot'",
")",
".",
"\"/$src\"",
";",
"try",
"{",
"$",
"token",
"=",
"hash",
"(",
"'crc32b'",
",",
"'$full_path '",
".",
"fil... | Get a file token, based on pipe configuration and source path. | [
"Get",
"a",
"file",
"token",
"based",
"on",
"pipe",
"configuration",
"and",
"source",
"path",
"."
] | e180ee33ca38b2fa74b1803178b251ad8b3838a1 | https://github.com/flaviovs/yii2-imagefilter/blob/e180ee33ca38b2fa74b1803178b251ad8b3838a1/src/Component.php#L30-L45 | train |
flaviovs/yii2-imagefilter | src/Component.php | Component.url | public function url($pipeline, $src, $scheme = false)
{
$src = ltrim(is_array($src) ? $src[0] : $src, '/');
$version = $this->getPipelineVersion($pipeline);
return Url::to("@web/$this->path/$pipeline/$version/$src", $scheme)
. '?'
. $this->getToken($src);
} | php | public function url($pipeline, $src, $scheme = false)
{
$src = ltrim(is_array($src) ? $src[0] : $src, '/');
$version = $this->getPipelineVersion($pipeline);
return Url::to("@web/$this->path/$pipeline/$version/$src", $scheme)
. '?'
. $this->getToken($src);
} | [
"public",
"function",
"url",
"(",
"$",
"pipeline",
",",
"$",
"src",
",",
"$",
"scheme",
"=",
"false",
")",
"{",
"$",
"src",
"=",
"ltrim",
"(",
"is_array",
"(",
"$",
"src",
")",
"?",
"$",
"src",
"[",
"0",
"]",
":",
"$",
"src",
",",
"'/'",
")",... | Return a URL to render a filtered version of an image. | [
"Return",
"a",
"URL",
"to",
"render",
"a",
"filtered",
"version",
"of",
"an",
"image",
"."
] | e180ee33ca38b2fa74b1803178b251ad8b3838a1 | https://github.com/flaviovs/yii2-imagefilter/blob/e180ee33ca38b2fa74b1803178b251ad8b3838a1/src/Component.php#L70-L77 | train |
flaviovs/yii2-imagefilter | src/Component.php | Component.img | public function img($pipeline, $src, array $options = [])
{
return \yii\helpers\Html::img($this->url($pipeline, $src), $options);
} | php | public function img($pipeline, $src, array $options = [])
{
return \yii\helpers\Html::img($this->url($pipeline, $src), $options);
} | [
"public",
"function",
"img",
"(",
"$",
"pipeline",
",",
"$",
"src",
",",
"array",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"return",
"\\",
"yii",
"\\",
"helpers",
"\\",
"Html",
"::",
"img",
"(",
"$",
"this",
"->",
"url",
"(",
"$",
"pipeline",
","... | Return an HTML IMG tag. | [
"Return",
"an",
"HTML",
"IMG",
"tag",
"."
] | e180ee33ca38b2fa74b1803178b251ad8b3838a1 | https://github.com/flaviovs/yii2-imagefilter/blob/e180ee33ca38b2fa74b1803178b251ad8b3838a1/src/Component.php#L83-L86 | train |
Facebook-Anonymous-Publisher/firewall | src/Utility.php | Utility.ip | public static function ip()
{
$whip = new Whip(
Whip::CLOUDFLARE_HEADERS | Whip::REMOTE_ADDR,
[
Whip::CLOUDFLARE_HEADERS => self::CLOUDFLARE_IP,
]
);
return $whip->getValidIpAddress();
} | php | public static function ip()
{
$whip = new Whip(
Whip::CLOUDFLARE_HEADERS | Whip::REMOTE_ADDR,
[
Whip::CLOUDFLARE_HEADERS => self::CLOUDFLARE_IP,
]
);
return $whip->getValidIpAddress();
} | [
"public",
"static",
"function",
"ip",
"(",
")",
"{",
"$",
"whip",
"=",
"new",
"Whip",
"(",
"Whip",
"::",
"CLOUDFLARE_HEADERS",
"|",
"Whip",
"::",
"REMOTE_ADDR",
",",
"[",
"Whip",
"::",
"CLOUDFLARE_HEADERS",
"=>",
"self",
"::",
"CLOUDFLARE_IP",
",",
"]",
... | Get real ip address.
@return false|string | [
"Get",
"real",
"ip",
"address",
"."
] | 3d78855cc828a1ebda37ac73c41fd64dc8dd0583 | https://github.com/Facebook-Anonymous-Publisher/firewall/blob/3d78855cc828a1ebda37ac73c41fd64dc8dd0583/src/Utility.php#L58-L68 | train |
Facebook-Anonymous-Publisher/firewall | src/Utility.php | Utility.contains | public static function contains($cidr, $ip)
{
$cidr = Range::parse($cidr);
$ip = new IP($ip);
if ($cidr->getFirstIP()->getVersion() !== $ip->getVersion()) {
return false;
}
return $cidr->contains($ip);
} | php | public static function contains($cidr, $ip)
{
$cidr = Range::parse($cidr);
$ip = new IP($ip);
if ($cidr->getFirstIP()->getVersion() !== $ip->getVersion()) {
return false;
}
return $cidr->contains($ip);
} | [
"public",
"static",
"function",
"contains",
"(",
"$",
"cidr",
",",
"$",
"ip",
")",
"{",
"$",
"cidr",
"=",
"Range",
"::",
"parse",
"(",
"$",
"cidr",
")",
";",
"$",
"ip",
"=",
"new",
"IP",
"(",
"$",
"ip",
")",
";",
"if",
"(",
"$",
"cidr",
"->",... | Check if ip is within range.
@param string $cidr
@param string $ip
@return bool | [
"Check",
"if",
"ip",
"is",
"within",
"range",
"."
] | 3d78855cc828a1ebda37ac73c41fd64dc8dd0583 | https://github.com/Facebook-Anonymous-Publisher/firewall/blob/3d78855cc828a1ebda37ac73c41fd64dc8dd0583/src/Utility.php#L105-L116 | train |
itkg/core | src/Itkg/Core/Cache/Adapter/RedisCluster.php | RedisCluster.getSlaveConnection | public function getSlaveConnection()
{
if (null === $this->slaveConnection) {
$this->slaveConnection = new \Redis();
$this->slaveConnection->pconnect(
$this->config['slave']['HOST'],
$this->config['slave']['PORT']
);
}
retur... | php | public function getSlaveConnection()
{
if (null === $this->slaveConnection) {
$this->slaveConnection = new \Redis();
$this->slaveConnection->pconnect(
$this->config['slave']['HOST'],
$this->config['slave']['PORT']
);
}
retur... | [
"public",
"function",
"getSlaveConnection",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"slaveConnection",
")",
"{",
"$",
"this",
"->",
"slaveConnection",
"=",
"new",
"\\",
"Redis",
"(",
")",
";",
"$",
"this",
"->",
"slaveConnection",
"->... | Get slave connection
If connection is not initialized, we create a new one
@return \Redis | [
"Get",
"slave",
"connection",
"If",
"connection",
"is",
"not",
"initialized",
"we",
"create",
"a",
"new",
"one"
] | e5e4efb05feb4d23b0df41f2b21fd095103e593b | https://github.com/itkg/core/blob/e5e4efb05feb4d23b0df41f2b21fd095103e593b/src/Itkg/Core/Cache/Adapter/RedisCluster.php#L90-L100 | train |
squareproton/Bond | src/Bond/Format.php | Format.getIndent | public function getIndent()
{
$leadingWhitespace = array();
$n = 0;
foreach( $this->lines as $line ) {
if( !empty( $line ) ) {
$leadingWhitespace[$n] = strlen( $line ) - strlen( ltrim( $line ) );
}
$n++;
}
return min( $leadi... | php | public function getIndent()
{
$leadingWhitespace = array();
$n = 0;
foreach( $this->lines as $line ) {
if( !empty( $line ) ) {
$leadingWhitespace[$n] = strlen( $line ) - strlen( ltrim( $line ) );
}
$n++;
}
return min( $leadi... | [
"public",
"function",
"getIndent",
"(",
")",
"{",
"$",
"leadingWhitespace",
"=",
"array",
"(",
")",
";",
"$",
"n",
"=",
"0",
";",
"foreach",
"(",
"$",
"this",
"->",
"lines",
"as",
"$",
"line",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"line",
... | Get the number of chars
@return int | [
"Get",
"the",
"number",
"of",
"chars"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Format.php#L64-L75 | train |
squareproton/Bond | src/Bond/Format.php | Format.deIndent | public function deIndent()
{
$ltrim = $this->getIndent();
if( $ltrim > 0 ) {
foreach( $this->lines as &$line ) {
$line = substr( $line, $ltrim );
}
}
return $this;
} | php | public function deIndent()
{
$ltrim = $this->getIndent();
if( $ltrim > 0 ) {
foreach( $this->lines as &$line ) {
$line = substr( $line, $ltrim );
}
}
return $this;
} | [
"public",
"function",
"deIndent",
"(",
")",
"{",
"$",
"ltrim",
"=",
"$",
"this",
"->",
"getIndent",
"(",
")",
";",
"if",
"(",
"$",
"ltrim",
">",
"0",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"lines",
"as",
"&",
"$",
"line",
")",
"{",
"$",
... | Completely deindent a string
@return Bond\Format | [
"Completely",
"deindent",
"a",
"string"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Format.php#L81-L90 | train |
squareproton/Bond | src/Bond/Format.php | Format.indent | public function indent( $indent = 4 )
{
$indent = $this->generateIndent( $indent );
foreach( $this->lines as &$line ) {
$line = $indent . $line;
}
return $this;
} | php | public function indent( $indent = 4 )
{
$indent = $this->generateIndent( $indent );
foreach( $this->lines as &$line ) {
$line = $indent . $line;
}
return $this;
} | [
"public",
"function",
"indent",
"(",
"$",
"indent",
"=",
"4",
")",
"{",
"$",
"indent",
"=",
"$",
"this",
"->",
"generateIndent",
"(",
"$",
"indent",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"lines",
"as",
"&",
"$",
"line",
")",
"{",
"$",
"lin... | Indent a string
@param int|string Either the length of the indentation in whitespace or the string to indent
@return Bond\Format | [
"Indent",
"a",
"string"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Format.php#L97-L104 | train |
squareproton/Bond | src/Bond/Format.php | Format.comment | public function comment( $comment = '#' )
{
foreach( $this->lines as &$line ) {
$line = $comment . $line;
}
return $this;
} | php | public function comment( $comment = '#' )
{
foreach( $this->lines as &$line ) {
$line = $comment . $line;
}
return $this;
} | [
"public",
"function",
"comment",
"(",
"$",
"comment",
"=",
"'#'",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"lines",
"as",
"&",
"$",
"line",
")",
"{",
"$",
"line",
"=",
"$",
"comment",
".",
"$",
"line",
";",
"}",
"return",
"$",
"this",
";",
... | Comment out a string
@param string $comment
@return Bond\Format | [
"Comment",
"out",
"a",
"string"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Format.php#L120-L126 | train |
squareproton/Bond | src/Bond/Format.php | Format.docblockify | public function docblockify()
{
foreach( $this->lines as &$line ) {
$line = ' * ' . $line;
}
array_unshift( $this->lines, '/**' );
array_push( $this->lines, ' */');
return $this;
} | php | public function docblockify()
{
foreach( $this->lines as &$line ) {
$line = ' * ' . $line;
}
array_unshift( $this->lines, '/**' );
array_push( $this->lines, ' */');
return $this;
} | [
"public",
"function",
"docblockify",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"lines",
"as",
"&",
"$",
"line",
")",
"{",
"$",
"line",
"=",
"' * '",
".",
"$",
"line",
";",
"}",
"array_unshift",
"(",
"$",
"this",
"->",
"lines",
",",
"'/**'",... | Make docblock this string
@return Bond\Format | [
"Make",
"docblock",
"this",
"string"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Format.php#L160-L168 | train |
squareproton/Bond | src/Bond/Format.php | Format.removeDuplicateEmptyLines | public function removeDuplicateEmptyLines()
{
$output = [];
$c = 0;
foreach( $this->lines as $key => $line ) {
if( strlen(rtrim($line)) === 0 ) {
$c++;
if( $c === 1 ) {
$output[] = $line;
}
} else {
... | php | public function removeDuplicateEmptyLines()
{
$output = [];
$c = 0;
foreach( $this->lines as $key => $line ) {
if( strlen(rtrim($line)) === 0 ) {
$c++;
if( $c === 1 ) {
$output[] = $line;
}
} else {
... | [
"public",
"function",
"removeDuplicateEmptyLines",
"(",
")",
"{",
"$",
"output",
"=",
"[",
"]",
";",
"$",
"c",
"=",
"0",
";",
"foreach",
"(",
"$",
"this",
"->",
"lines",
"as",
"$",
"key",
"=>",
"$",
"line",
")",
"{",
"if",
"(",
"strlen",
"(",
"rt... | Duplicate empty lines remove
@return Bond\Format | [
"Duplicate",
"empty",
"lines",
"remove"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Format.php#L174-L191 | train |
squareproton/Bond | src/Bond/Format.php | Format.addLineNumbers | public function addLineNumbers()
{
$lengthToPad = strlen(count($this->lines));
$c = 0;
foreach( $this->lines as &$line ) {
$c++;
$line = sprintf(
"%s %s",
str_pad( (string) $c, $lengthToPad, ' ', STR_PAD_LEFT ),
$line
... | php | public function addLineNumbers()
{
$lengthToPad = strlen(count($this->lines));
$c = 0;
foreach( $this->lines as &$line ) {
$c++;
$line = sprintf(
"%s %s",
str_pad( (string) $c, $lengthToPad, ' ', STR_PAD_LEFT ),
$line
... | [
"public",
"function",
"addLineNumbers",
"(",
")",
"{",
"$",
"lengthToPad",
"=",
"strlen",
"(",
"count",
"(",
"$",
"this",
"->",
"lines",
")",
")",
";",
"$",
"c",
"=",
"0",
";",
"foreach",
"(",
"$",
"this",
"->",
"lines",
"as",
"&",
"$",
"line",
"... | Add line numbers to output. Useful for debugging output. This is obviously destructive
@return Bond\Format | [
"Add",
"line",
"numbers",
"to",
"output",
".",
"Useful",
"for",
"debugging",
"output",
".",
"This",
"is",
"obviously",
"destructive"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Format.php#L197-L210 | train |
squareproton/Bond | src/Bond/Format.php | Format.generateIndent | private function generateIndent( $indent )
{
if( is_integer( $indent ) ) {
$indent = str_repeat( $this->indentChar, $indent );
} elseif( !is_string($indent) ) {
throw new BadTypeException( $indent, 'int|string' );
}
return $indent;
} | php | private function generateIndent( $indent )
{
if( is_integer( $indent ) ) {
$indent = str_repeat( $this->indentChar, $indent );
} elseif( !is_string($indent) ) {
throw new BadTypeException( $indent, 'int|string' );
}
return $indent;
} | [
"private",
"function",
"generateIndent",
"(",
"$",
"indent",
")",
"{",
"if",
"(",
"is_integer",
"(",
"$",
"indent",
")",
")",
"{",
"$",
"indent",
"=",
"str_repeat",
"(",
"$",
"this",
"->",
"indentChar",
",",
"$",
"indent",
")",
";",
"}",
"elseif",
"(... | Generate indention string from length.
@param int|string Either the length of the indentation in whitespace or the string to indent
@return string Indention string | [
"Generate",
"indention",
"string",
"from",
"length",
"."
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Format.php#L217-L225 | train |
attogram/shared-media-orm | src/Attogram/SharedMedia/Orm/Base/C2MQuery.php | C2MQuery.filterByCategoryId | public function filterByCategoryId($categoryId = null, $comparison = null)
{
if (is_array($categoryId)) {
$useMinMax = false;
if (isset($categoryId['min'])) {
$this->addUsingAlias(C2MTableMap::COL_CATEGORY_ID, $categoryId['min'], Criteria::GREATER_EQUAL);
... | php | public function filterByCategoryId($categoryId = null, $comparison = null)
{
if (is_array($categoryId)) {
$useMinMax = false;
if (isset($categoryId['min'])) {
$this->addUsingAlias(C2MTableMap::COL_CATEGORY_ID, $categoryId['min'], Criteria::GREATER_EQUAL);
... | [
"public",
"function",
"filterByCategoryId",
"(",
"$",
"categoryId",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"categoryId",
")",
")",
"{",
"$",
"useMinMax",
"=",
"false",
";",
"if",
"(",
"isset",
"(",
... | Filter the query on the category_id column
Example usage:
<code>
$query->filterByCategoryId(1234); // WHERE category_id = 1234
$query->filterByCategoryId(array(12, 34)); // WHERE category_id IN (12, 34)
$query->filterByCategoryId(array('min' => 12)); // WHERE category_id > 12
</code>
@see filterByCategory()
@p... | [
"Filter",
"the",
"query",
"on",
"the",
"category_id",
"column"
] | 81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8 | https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/C2MQuery.php#L294-L315 | train |
attogram/shared-media-orm | src/Attogram/SharedMedia/Orm/Base/C2MQuery.php | C2MQuery.filterByMediaId | public function filterByMediaId($mediaId = null, $comparison = null)
{
if (is_array($mediaId)) {
$useMinMax = false;
if (isset($mediaId['min'])) {
$this->addUsingAlias(C2MTableMap::COL_MEDIA_ID, $mediaId['min'], Criteria::GREATER_EQUAL);
$useMinMax = t... | php | public function filterByMediaId($mediaId = null, $comparison = null)
{
if (is_array($mediaId)) {
$useMinMax = false;
if (isset($mediaId['min'])) {
$this->addUsingAlias(C2MTableMap::COL_MEDIA_ID, $mediaId['min'], Criteria::GREATER_EQUAL);
$useMinMax = t... | [
"public",
"function",
"filterByMediaId",
"(",
"$",
"mediaId",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"mediaId",
")",
")",
"{",
"$",
"useMinMax",
"=",
"false",
";",
"if",
"(",
"isset",
"(",
"$",
... | Filter the query on the media_id column
Example usage:
<code>
$query->filterByMediaId(1234); // WHERE media_id = 1234
$query->filterByMediaId(array(12, 34)); // WHERE media_id IN (12, 34)
$query->filterByMediaId(array('min' => 12)); // WHERE media_id > 12
</code>
@see filterByMedia()
@param mixed $mediaId ... | [
"Filter",
"the",
"query",
"on",
"the",
"media_id",
"column"
] | 81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8 | https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/C2MQuery.php#L337-L358 | train |
attogram/shared-media-orm | src/Attogram/SharedMedia/Orm/Base/C2MQuery.php | C2MQuery.useCategoryQuery | public function useCategoryQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinCategory($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Category', '\Attogram\SharedMedia\Orm\CategoryQuery');
} | php | public function useCategoryQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinCategory($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Category', '\Attogram\SharedMedia\Orm\CategoryQuery');
} | [
"public",
"function",
"useCategoryQuery",
"(",
"$",
"relationAlias",
"=",
"null",
",",
"$",
"joinType",
"=",
"Criteria",
"::",
"INNER_JOIN",
")",
"{",
"return",
"$",
"this",
"->",
"joinCategory",
"(",
"$",
"relationAlias",
",",
"$",
"joinType",
")",
"->",
... | Use the Category relation Category object
@see useQuery()
@param string $relationAlias optional alias for the relation,
to be used as main alias in the secondary query
@param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
@return \Attogram\SharedMedia\Orm\CategoryQuery A s... | [
"Use",
"the",
"Category",
"relation",
"Category",
"object"
] | 81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8 | https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/C2MQuery.php#L430-L435 | train |
attogram/shared-media-orm | src/Attogram/SharedMedia/Orm/Base/C2MQuery.php | C2MQuery.useMediaQuery | public function useMediaQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinMedia($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Media', '\Attogram\SharedMedia\Orm\MediaQuery');
} | php | public function useMediaQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinMedia($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'Media', '\Attogram\SharedMedia\Orm\MediaQuery');
} | [
"public",
"function",
"useMediaQuery",
"(",
"$",
"relationAlias",
"=",
"null",
",",
"$",
"joinType",
"=",
"Criteria",
"::",
"INNER_JOIN",
")",
"{",
"return",
"$",
"this",
"->",
"joinMedia",
"(",
"$",
"relationAlias",
",",
"$",
"joinType",
")",
"->",
"useQu... | Use the Media relation Media object
@see useQuery()
@param string $relationAlias optional alias for the relation,
to be used as main alias in the secondary query
@param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
@return \Attogram\SharedMedia\Orm\MediaQuery A secondary ... | [
"Use",
"the",
"Media",
"relation",
"Media",
"object"
] | 81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8 | https://github.com/attogram/shared-media-orm/blob/81b5ef7d749b1e50f51e95747ce24cf8ce6f21d8/src/Attogram/SharedMedia/Orm/Base/C2MQuery.php#L507-L512 | train |
Dhii/exception | src/CreateNativeInvalidArgumentExceptionCapableTrait.php | CreateNativeInvalidArgumentExceptionCapableTrait._createInvalidArgumentException | protected function _createInvalidArgumentException(
$message = '',
$code = 0,
RootException $previous = null,
$argument = null
) {
return new RootInvalidArgumentException($message, $code, $previous);
} | php | protected function _createInvalidArgumentException(
$message = '',
$code = 0,
RootException $previous = null,
$argument = null
) {
return new RootInvalidArgumentException($message, $code, $previous);
} | [
"protected",
"function",
"_createInvalidArgumentException",
"(",
"$",
"message",
"=",
"''",
",",
"$",
"code",
"=",
"0",
",",
"RootException",
"$",
"previous",
"=",
"null",
",",
"$",
"argument",
"=",
"null",
")",
"{",
"return",
"new",
"RootInvalidArgumentExcept... | Creates a new invalid argument exception.
@since [*next-version*]
@param string $message The error message, if any.
@param int $code The error code, if any.
@param RootException|null $previous The inner exception for chaining, if any.
@param mixed|null $argument The invalid arg... | [
"Creates",
"a",
"new",
"invalid",
"argument",
"exception",
"."
] | d42828984c85a509af3f7fde709561a1e520b9e4 | https://github.com/Dhii/exception/blob/d42828984c85a509af3f7fde709561a1e520b9e4/src/CreateNativeInvalidArgumentExceptionCapableTrait.php#L22-L29 | train |
geoffroy-aubry/Helpers | src/GAubry/Helpers/Debug.php | Debug.getVarName | private static function getVarName ($sFunction, $sFile, $iLine)
{
$sContent = file($sFile);
$sLine = $sContent[$iLine - 1];
preg_match("#$sFunction\s*\((.+)\)#", $sLine, $aMatches);
// Let's count brackets to see how many of them actually belongs to the var name.
// e.g.: ... | php | private static function getVarName ($sFunction, $sFile, $iLine)
{
$sContent = file($sFile);
$sLine = $sContent[$iLine - 1];
preg_match("#$sFunction\s*\((.+)\)#", $sLine, $aMatches);
// Let's count brackets to see how many of them actually belongs to the var name.
// e.g.: ... | [
"private",
"static",
"function",
"getVarName",
"(",
"$",
"sFunction",
",",
"$",
"sFile",
",",
"$",
"iLine",
")",
"{",
"$",
"sContent",
"=",
"file",
"(",
"$",
"sFile",
")",
";",
"$",
"sLine",
"=",
"$",
"sContent",
"[",
"$",
"iLine",
"-",
"1",
"]",
... | Return the name of the first parameter of the penultimate function call.
TODO bug if multiple calls in the same line…
@see http://stackoverflow.com/a/6837836
@author Sebastián Grignoli
@author Geoffroy Aubry
@param string $sFunction function called
@param string $sFile file containing a call to $sFunction
@param int... | [
"Return",
"the",
"name",
"of",
"the",
"first",
"parameter",
"of",
"the",
"penultimate",
"function",
"call",
"."
] | 09e787e554158d7c2233a27107d2949824cd5602 | https://github.com/geoffroy-aubry/Helpers/blob/09e787e554158d7c2233a27107d2949824cd5602/src/GAubry/Helpers/Debug.php#L124-L156 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.