repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_code_tokens listlengths 15 672k | func_documentation_string stringlengths 1 47.2k | func_documentation_tokens listlengths 1 3.92k | split_name stringclasses 1
value | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|---|---|---|
MissAllSunday/Ohara | src/Suki/Ohara.php | Ohara.addActions | public function addActions(&$actions)
{
// This needs to be set and extended by someone else!
$hooks = $this['config']->get('availableHooks');
$oActions = $this['config']->get('actions');
$counter = 0;
if (empty($hooks['actions']))
return;
// An array?
if (is_array($oActions))
foreach ($oActions ... | php | public function addActions(&$actions)
{
// This needs to be set and extended by someone else!
$hooks = $this['config']->get('availableHooks');
$oActions = $this['config']->get('actions');
$counter = 0;
if (empty($hooks['actions']))
return;
// An array?
if (is_array($oActions))
foreach ($oActions ... | [
"public",
"function",
"addActions",
"(",
"&",
"$",
"actions",
")",
"{",
"// This needs to be set and extended by someone else!",
"$",
"hooks",
"=",
"$",
"this",
"[",
"'config'",
"]",
"->",
"get",
"(",
"'availableHooks'",
")",
";",
"$",
"oActions",
"=",
"$",
"t... | Creates a new SMF action.
Uses config('actions') to determinate the name and file for the action, if no data is given, {@link $name} will be used
@access public
@param array $actions An array containing all current registered SMF actions at the moment of this method execution
@return void | [
"Creates",
"a",
"new",
"SMF",
"action",
".",
"Uses",
"config",
"(",
"actions",
")",
"to",
"determinate",
"the",
"name",
"and",
"file",
"for",
"the",
"action",
"if",
"no",
"data",
"is",
"given",
"{"
] | train | https://github.com/MissAllSunday/Ohara/blob/7753500cde1d51a0d7b37593aeaf2fc05fefd903/src/Suki/Ohara.php#L291-L323 |
MissAllSunday/Ohara | src/Suki/Ohara.php | Ohara.addCredits | public function addCredits()
{
global $context;
// This needs to be set and extended by someone else!
$hooks = $this['config']->get('availableHooks');
if (!$hooks['credits'])
return;
$context['copyrights']['mods'][] = is_string($hooks['credits']) ? $this->text($hooks['credits']) : $this->text('modCredi... | php | public function addCredits()
{
global $context;
// This needs to be set and extended by someone else!
$hooks = $this['config']->get('availableHooks');
if (!$hooks['credits'])
return;
$context['copyrights']['mods'][] = is_string($hooks['credits']) ? $this->text($hooks['credits']) : $this->text('modCredi... | [
"public",
"function",
"addCredits",
"(",
")",
"{",
"global",
"$",
"context",
";",
"// This needs to be set and extended by someone else!",
"$",
"hooks",
"=",
"$",
"this",
"[",
"'config'",
"]",
"->",
"get",
"(",
"'availableHooks'",
")",
";",
"if",
"(",
"!",
"$"... | Creates a copyright link on the credits page.
Uses {@link $_modHooks} to determinate if a link should be added
Uses a predefined $txt string $this->text('modCredits')
@access public
@return void | [
"Creates",
"a",
"copyright",
"link",
"on",
"the",
"credits",
"page",
".",
"Uses",
"{"
] | train | https://github.com/MissAllSunday/Ohara/blob/7753500cde1d51a0d7b37593aeaf2fc05fefd903/src/Suki/Ohara.php#L332-L343 |
MissAllSunday/Ohara | src/Suki/Ohara.php | Ohara.addSimpleSettings | public function addSimpleSettings(&$config_vars)
{
// This needs to be set and extended by someone else!
$hooks = $this['config']->get('availableHooks');
if (!$hooks['simpleSettings'])
return;
$sSettings = $this['config']->get('simpleSettings');
if (!empty($sSettings) && is_array($sSettings))
foreac... | php | public function addSimpleSettings(&$config_vars)
{
// This needs to be set and extended by someone else!
$hooks = $this['config']->get('availableHooks');
if (!$hooks['simpleSettings'])
return;
$sSettings = $this['config']->get('simpleSettings');
if (!empty($sSettings) && is_array($sSettings))
foreac... | [
"public",
"function",
"addSimpleSettings",
"(",
"&",
"$",
"config_vars",
")",
"{",
"// This needs to be set and extended by someone else!",
"$",
"hooks",
"=",
"$",
"this",
"[",
"'config'",
"]",
"->",
"get",
"(",
"'availableHooks'",
")",
";",
"if",
"(",
"!",
"$",... | Add a set of config vars.
This is a much smaller approach than addAdminArea, its designed to use the integrate_general_mod_settings hook and adds a very simple set of config vars. Useful for small mods that doesn't have a lot of settings.
Uses $config['simpleSettings'] to determinate the number of settings to add.
Mods... | [
"Add",
"a",
"set",
"of",
"config",
"vars",
".",
"This",
"is",
"a",
"much",
"smaller",
"approach",
"than",
"addAdminArea",
"its",
"designed",
"to",
"use",
"the",
"integrate_general_mod_settings",
"hook",
"and",
"adds",
"a",
"very",
"simple",
"set",
"of",
"con... | train | https://github.com/MissAllSunday/Ohara/blob/7753500cde1d51a0d7b37593aeaf2fc05fefd903/src/Suki/Ohara.php#L353-L378 |
MissAllSunday/Ohara | src/Suki/Ohara.php | Ohara.addHelpAdmin | public function addHelpAdmin()
{
// This needs to be set and extended by someone else!
$hooks = $this['config']->get('availableHooks');
if (!$hooks['helpAdmin'])
return;
// You may or may not want to load a different language file.
$loadLang = is_string($hooks['helpAdmin']) ? $hooks['helpAdmin'] : $this... | php | public function addHelpAdmin()
{
// This needs to be set and extended by someone else!
$hooks = $this['config']->get('availableHooks');
if (!$hooks['helpAdmin'])
return;
// You may or may not want to load a different language file.
$loadLang = is_string($hooks['helpAdmin']) ? $hooks['helpAdmin'] : $this... | [
"public",
"function",
"addHelpAdmin",
"(",
")",
"{",
"// This needs to be set and extended by someone else!",
"$",
"hooks",
"=",
"$",
"this",
"[",
"'config'",
"]",
"->",
"get",
"(",
"'availableHooks'",
")",
";",
"if",
"(",
"!",
"$",
"hooks",
"[",
"'helpAdmin'",
... | Loads a language file.
Used to load a language to properly display any help txt strings from mods that adds new permissions via hooks
Uses {@link $_modHooks} if the mod author wants to specify a custom file name, if not, it defaults to {@link $name}
@access public
@return void | [
"Loads",
"a",
"language",
"file",
".",
"Used",
"to",
"load",
"a",
"language",
"to",
"properly",
"display",
"any",
"help",
"txt",
"strings",
"from",
"mods",
"that",
"adds",
"new",
"permissions",
"via",
"hooks",
"Uses",
"{"
] | train | https://github.com/MissAllSunday/Ohara/blob/7753500cde1d51a0d7b37593aeaf2fc05fefd903/src/Suki/Ohara.php#L413-L426 |
andylolz/everypolitician-popolo-php | src/Popolo.php | Popolo.fromFilename | public static function fromFilename($filename)
{
$contents = file_get_contents($filename);
$jsonData = json_decode($contents, true);
$instance = new self($jsonData);
return $instance;
} | php | public static function fromFilename($filename)
{
$contents = file_get_contents($filename);
$jsonData = json_decode($contents, true);
$instance = new self($jsonData);
return $instance;
} | [
"public",
"static",
"function",
"fromFilename",
"(",
"$",
"filename",
")",
"{",
"$",
"contents",
"=",
"file_get_contents",
"(",
"$",
"filename",
")",
";",
"$",
"jsonData",
"=",
"json_decode",
"(",
"$",
"contents",
",",
"true",
")",
";",
"$",
"instance",
... | Construct from filename
@param string $filename name of Popolo json file
@return $this | [
"Construct",
"from",
"filename"
] | train | https://github.com/andylolz/everypolitician-popolo-php/blob/701fca91b782871d463cfb56f3c1c7afb121eb9f/src/Popolo.php#L48-L54 |
andylolz/everypolitician-popolo-php | src/Popolo.php | Popolo.fromUrl | public static function fromUrl($url)
{
$client = new GuzzleHttp\Client();
$response = $client->get($url);
$jsonData = json_decode($response->getBody(), true);
$instance = new self($jsonData);
return $instance;
} | php | public static function fromUrl($url)
{
$client = new GuzzleHttp\Client();
$response = $client->get($url);
$jsonData = json_decode($response->getBody(), true);
$instance = new self($jsonData);
return $instance;
} | [
"public",
"static",
"function",
"fromUrl",
"(",
"$",
"url",
")",
"{",
"$",
"client",
"=",
"new",
"GuzzleHttp",
"\\",
"Client",
"(",
")",
";",
"$",
"response",
"=",
"$",
"client",
"->",
"get",
"(",
"$",
"url",
")",
";",
"$",
"jsonData",
"=",
"json_d... | Construct from URL
@param string $url location of Popolo json file
@return $this | [
"Construct",
"from",
"URL"
] | train | https://github.com/andylolz/everypolitician-popolo-php/blob/701fca91b782871d463cfb56f3c1c7afb121eb9f/src/Popolo.php#L63-L70 |
hfcorriez/php-childprocess | lib/Pagon/Process.php | Process.init | public function init($pid = null)
{
// Check init, init only can be called once.
if ($this->_init) {
throw new \RuntimeException('Process has been initialized');
}
// Check pid
if (!$pid && !$this->pid) {
throw new \RuntimeException('Process has not p... | php | public function init($pid = null)
{
// Check init, init only can be called once.
if ($this->_init) {
throw new \RuntimeException('Process has been initialized');
}
// Check pid
if (!$pid && !$this->pid) {
throw new \RuntimeException('Process has not p... | [
"public",
"function",
"init",
"(",
"$",
"pid",
"=",
"null",
")",
"{",
"// Check init, init only can be called once.",
"if",
"(",
"$",
"this",
"->",
"_init",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"'Process has been initialized'",
")",
";",
"}",... | Init | [
"Init"
] | train | https://github.com/hfcorriez/php-childprocess/blob/92481a85783cf2a24fef1760930f1252bb83fa5d/lib/Pagon/Process.php#L81-L136 |
hfcorriez/php-childprocess | lib/Pagon/Process.php | Process.register | public function register(\Closure $runner, $options = array())
{
$this->runner = $runner;
$this->options = $options;
return $this;
} | php | public function register(\Closure $runner, $options = array())
{
$this->runner = $runner;
$this->options = $options;
return $this;
} | [
"public",
"function",
"register",
"(",
"\\",
"Closure",
"$",
"runner",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"$",
"this",
"->",
"runner",
"=",
"$",
"runner",
";",
"$",
"this",
"->",
"options",
"=",
"$",
"options",
";",
"return",
"$... | Register the runner and options for delay run
@param \Closure $runner
@param array $options
@return $this | [
"Register",
"the",
"runner",
"and",
"options",
"for",
"delay",
"run"
] | train | https://github.com/hfcorriez/php-childprocess/blob/92481a85783cf2a24fef1760930f1252bb83fa5d/lib/Pagon/Process.php#L154-L159 |
hfcorriez/php-childprocess | lib/Pagon/Process.php | Process.run | public function run()
{
if ($this->_init) throw new \RuntimeException("Process has been initialized, can not run.");
$this->emit('run');
$this->manager->parallel($this);
} | php | public function run()
{
if ($this->_init) throw new \RuntimeException("Process has been initialized, can not run.");
$this->emit('run');
$this->manager->parallel($this);
} | [
"public",
"function",
"run",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"_init",
")",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"\"Process has been initialized, can not run.\"",
")",
";",
"$",
"this",
"->",
"emit",
"(",
"'run'",
")",
";",
"$",
"this... | Run | [
"Run"
] | train | https://github.com/hfcorriez/php-childprocess/blob/92481a85783cf2a24fef1760930f1252bb83fa5d/lib/Pagon/Process.php#L164-L171 |
hfcorriez/php-childprocess | lib/Pagon/Process.php | Process.send | public function send($msg)
{
// Check queue and send messages
if ($this->queue && is_resource($this->queue) && msg_stat_queue($this->queue)) {
return msg_send($this->queue, 1, array(
'from' => $this->isMaster() ? $this->ppid : $this->pid,
'to' => $this->... | php | public function send($msg)
{
// Check queue and send messages
if ($this->queue && is_resource($this->queue) && msg_stat_queue($this->queue)) {
return msg_send($this->queue, 1, array(
'from' => $this->isMaster() ? $this->ppid : $this->pid,
'to' => $this->... | [
"public",
"function",
"send",
"(",
"$",
"msg",
")",
"{",
"// Check queue and send messages",
"if",
"(",
"$",
"this",
"->",
"queue",
"&&",
"is_resource",
"(",
"$",
"this",
"->",
"queue",
")",
"&&",
"msg_stat_queue",
"(",
"$",
"this",
"->",
"queue",
")",
"... | Send msg to child process
@param mixed $msg
@return bool | [
"Send",
"msg",
"to",
"child",
"process"
] | train | https://github.com/hfcorriez/php-childprocess/blob/92481a85783cf2a24fef1760930f1252bb83fa5d/lib/Pagon/Process.php#L187-L198 |
hfcorriez/php-childprocess | lib/Pagon/Process.php | Process.shutdown | public function shutdown($status = 0)
{
if ($this->status === null) {
$this->status = $status;
$this->emit('exit', $status);
}
} | php | public function shutdown($status = 0)
{
if ($this->status === null) {
$this->status = $status;
$this->emit('exit', $status);
}
} | [
"public",
"function",
"shutdown",
"(",
"$",
"status",
"=",
"0",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"status",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"status",
"=",
"$",
"status",
";",
"$",
"this",
"->",
"emit",
"(",
"'exit'",
",",
"$",
... | Shutdown
@param int $status | [
"Shutdown"
] | train | https://github.com/hfcorriez/php-childprocess/blob/92481a85783cf2a24fef1760930f1252bb83fa5d/lib/Pagon/Process.php#L216-L222 |
astronati/php-fantasy-football-quotations-parser | src/Map/MapAbstract.php | MapAbstract.getStartingRow | private function getStartingRow($sheet): int
{
$row = null;
for ($i = 1; $i <= 4 && !$row; $i++) {
if ($sheet->getCellByColumnAndRow(1, $i) == "Cod.") {
$row = $i + 1;
}
}
return $row;
} | php | private function getStartingRow($sheet): int
{
$row = null;
for ($i = 1; $i <= 4 && !$row; $i++) {
if ($sheet->getCellByColumnAndRow(1, $i) == "Cod.") {
$row = $i + 1;
}
}
return $row;
} | [
"private",
"function",
"getStartingRow",
"(",
"$",
"sheet",
")",
":",
"int",
"{",
"$",
"row",
"=",
"null",
";",
"for",
"(",
"$",
"i",
"=",
"1",
";",
"$",
"i",
"<=",
"4",
"&&",
"!",
"$",
"row",
";",
"$",
"i",
"++",
")",
"{",
"if",
"(",
"$",
... | Returns the spreadsheet row number for which the extractor should start extracting row data.
@param Worksheet $sheet
@return int | [
"Returns",
"the",
"spreadsheet",
"row",
"number",
"for",
"which",
"the",
"extractor",
"should",
"start",
"extracting",
"row",
"data",
"."
] | train | https://github.com/astronati/php-fantasy-football-quotations-parser/blob/1214f313c325ac7e9fc4d5218b85b3d7234f7bf3/src/Map/MapAbstract.php#L53-L63 |
ronan-gloo/jade-php | src/Jade/Filter/AbstractFilter.php | AbstractFilter.getNodeString | protected function getNodeString(Filter $node, Compiler $compiler = null)
{
return array_reduce($node->block->nodes, function(&$result, $line) use($compiler) {
$val = $compiler ? $compiler->interpolate($line->value) : $line->value;
return $result .= $val."\n";
});
} | php | protected function getNodeString(Filter $node, Compiler $compiler = null)
{
return array_reduce($node->block->nodes, function(&$result, $line) use($compiler) {
$val = $compiler ? $compiler->interpolate($line->value) : $line->value;
return $result .= $val."\n";
});
} | [
"protected",
"function",
"getNodeString",
"(",
"Filter",
"$",
"node",
",",
"Compiler",
"$",
"compiler",
"=",
"null",
")",
"{",
"return",
"array_reduce",
"(",
"$",
"node",
"->",
"block",
"->",
"nodes",
",",
"function",
"(",
"&",
"$",
"result",
",",
"$",
... | Returns the node string value, line by line.
If the compiler is present, that means we need
to interpolate line contents
@param Filter $node
@param Compiler $compiler
@return mixed | [
"Returns",
"the",
"node",
"string",
"value",
"line",
"by",
"line",
".",
"If",
"the",
"compiler",
"is",
"present",
"that",
"means",
"we",
"need",
"to",
"interpolate",
"line",
"contents"
] | train | https://github.com/ronan-gloo/jade-php/blob/77230d2eef2f0d4f045292a5906162f0c0499421/src/Jade/Filter/AbstractFilter.php#L21-L27 |
guillaumemonet/Rad | src/Rad/Cache/MemcacheCacheHandler.php | MemcacheCacheHandler.read | public function read(array $keys) {
$res = $this->memcache->getMulti($keys);
$_res = [];
if (is_array($res) && sizeof($res) > 0) {
foreach ($res as $k => $v) {
$_res[$k] = $v;
}
}
return $_res;
} | php | public function read(array $keys) {
$res = $this->memcache->getMulti($keys);
$_res = [];
if (is_array($res) && sizeof($res) > 0) {
foreach ($res as $k => $v) {
$_res[$k] = $v;
}
}
return $_res;
} | [
"public",
"function",
"read",
"(",
"array",
"$",
"keys",
")",
"{",
"$",
"res",
"=",
"$",
"this",
"->",
"memcache",
"->",
"getMulti",
"(",
"$",
"keys",
")",
";",
"$",
"_res",
"=",
"[",
"]",
";",
"if",
"(",
"is_array",
"(",
"$",
"res",
")",
"&&",... | Read values for a set of keys from cache
@param array $keys list of keys to fetch
@return array list of values with the given keys used as indexes
@return boolean true on success, false on failure | [
"Read",
"values",
"for",
"a",
"set",
"of",
"keys",
"from",
"cache"
] | train | https://github.com/guillaumemonet/Rad/blob/cb9932f570cf3c2a7197f81e1d959c2729989e59/src/Rad/Cache/MemcacheCacheHandler.php#L56-L65 |
ssheduardo/didimo | src/Sms.php | Sms.createSend | public function createSend($sender='', $messages=array(), $scheduledate='')
{
$message_sender = array();
$index = 0;
$url = $this->_setEnvironment.'wcf/Service.svc/rest/CreateSend';
if(is_array($messages)) {
foreach($messages as $mobile => $message){
$me... | php | public function createSend($sender='', $messages=array(), $scheduledate='')
{
$message_sender = array();
$index = 0;
$url = $this->_setEnvironment.'wcf/Service.svc/rest/CreateSend';
if(is_array($messages)) {
foreach($messages as $mobile => $message){
$me... | [
"public",
"function",
"createSend",
"(",
"$",
"sender",
"=",
"''",
",",
"$",
"messages",
"=",
"array",
"(",
")",
",",
"$",
"scheduledate",
"=",
"''",
")",
"{",
"$",
"message_sender",
"=",
"array",
"(",
")",
";",
"$",
"index",
"=",
"0",
";",
"$",
... | This operation allows you to send 1 or more messages in a single call.
@param string $sender Message sender. If informed, it must be a maximum of 11 characters. If not reported, the API will use the user-defined sender.
@param array $messages With the messages to send.
@param string $scheduledate Optional. Date and tim... | [
"This",
"operation",
"allows",
"you",
"to",
"send",
"1",
"or",
"more",
"messages",
"in",
"a",
"single",
"call",
"."
] | train | https://github.com/ssheduardo/didimo/blob/6c5bd8b03000f40b13661c3fd6ffa1e44f4da945/src/Sms.php#L70-L108 |
ssheduardo/didimo | src/Sms.php | Sms.createMessage | public function createMessage($sender='',$mobile='', $message='', $scheduledate='')
{
$url = $this->_setEnvironment.'wcf/Service.svc/rest/CreateMessage';
$json = array(
'UserName' => $this->user,
'Password' => $this->password,
'Sender' => $sender... | php | public function createMessage($sender='',$mobile='', $message='', $scheduledate='')
{
$url = $this->_setEnvironment.'wcf/Service.svc/rest/CreateMessage';
$json = array(
'UserName' => $this->user,
'Password' => $this->password,
'Sender' => $sender... | [
"public",
"function",
"createMessage",
"(",
"$",
"sender",
"=",
"''",
",",
"$",
"mobile",
"=",
"''",
",",
"$",
"message",
"=",
"''",
",",
"$",
"scheduledate",
"=",
"''",
")",
"{",
"$",
"url",
"=",
"$",
"this",
"->",
"_setEnvironment",
".",
"'wcf/Serv... | This operation allows you to send 1 message on a single call.
@param string $sender Message sender. If informed, it must be a maximum of 11 characters. If not reported, the API will use the user-defined sender.
@param string $mobile Recipient of the message. Information is available in international (+34699999999,0034... | [
"This",
"operation",
"allows",
"you",
"to",
"send",
"1",
"message",
"on",
"a",
"single",
"call",
"."
] | train | https://github.com/ssheduardo/didimo/blob/6c5bd8b03000f40b13661c3fd6ffa1e44f4da945/src/Sms.php#L119-L148 |
ssheduardo/didimo | src/Sms.php | Sms.statusCodeHandling | protected function statusCodeHandling($e)
{
$response =(object)array(
"Status" => $e->getResponse()->getStatusCode(),
"Error" => json_decode($e->getResponse()->getBody(true)->getContents())
);
return $response;
} | php | protected function statusCodeHandling($e)
{
$response =(object)array(
"Status" => $e->getResponse()->getStatusCode(),
"Error" => json_decode($e->getResponse()->getBody(true)->getContents())
);
return $response;
} | [
"protected",
"function",
"statusCodeHandling",
"(",
"$",
"e",
")",
"{",
"$",
"response",
"=",
"(",
"object",
")",
"array",
"(",
"\"Status\"",
"=>",
"$",
"e",
"->",
"getResponse",
"(",
")",
"->",
"getStatusCode",
"(",
")",
",",
"\"Error\"",
"=>",
"json_de... | Return message error
@param $e
@return array | [
"Return",
"message",
"error"
] | train | https://github.com/ssheduardo/didimo/blob/6c5bd8b03000f40b13661c3fd6ffa1e44f4da945/src/Sms.php#L257-L264 |
yosmanyga/validation | src/Yosmanyga/Validation/Validator/ExpressionScalarValidator.php | ExpressionScalarValidator.validate | public function validate($value)
{
$errors = [];
$this->addVariable('value', $value);
// Sometime ExpressionScalarValidator is constructed without the
// ExpressionLanguage object, so it can be cached. ExpressionLanguage
// can't be cached because of closures.
$this... | php | public function validate($value)
{
$errors = [];
$this->addVariable('value', $value);
// Sometime ExpressionScalarValidator is constructed without the
// ExpressionLanguage object, so it can be cached. ExpressionLanguage
// can't be cached because of closures.
$this... | [
"public",
"function",
"validate",
"(",
"$",
"value",
")",
"{",
"$",
"errors",
"=",
"[",
"]",
";",
"$",
"this",
"->",
"addVariable",
"(",
"'value'",
",",
"$",
"value",
")",
";",
"// Sometime ExpressionScalarValidator is constructed without the",
"// ExpressionLangu... | {@inheritdoc} | [
"{"
] | train | https://github.com/yosmanyga/validation/blob/dded99a6e24b79f808250791ba1db632fd44c5c4/src/Yosmanyga/Validation/Validator/ExpressionScalarValidator.php#L47-L62 |
cpliakas/search-framework | src/Search/Framework/Collector.php | Collector.queue | public function queue()
{
$log = $this->getLogger();
$log->info('Queueing operation started', array('collections' => count($this)));
$event = new CollectorEvent($this);
$this->dispatchEvent(SearchEvents::COLLECTOR_PRE_QUEUE, $event);
$num_queued = 0;
foreach ($this-... | php | public function queue()
{
$log = $this->getLogger();
$log->info('Queueing operation started', array('collections' => count($this)));
$event = new CollectorEvent($this);
$this->dispatchEvent(SearchEvents::COLLECTOR_PRE_QUEUE, $event);
$num_queued = 0;
foreach ($this-... | [
"public",
"function",
"queue",
"(",
")",
"{",
"$",
"log",
"=",
"$",
"this",
"->",
"getLogger",
"(",
")",
";",
"$",
"log",
"->",
"info",
"(",
"'Queueing operation started'",
",",
"array",
"(",
"'collections'",
"=>",
"count",
"(",
"$",
"this",
")",
")",
... | Queues the items scheduled for indexing for all collections attached to
the collector.
@return int
The number of items sent to the queue. | [
"Queues",
"the",
"items",
"scheduled",
"for",
"indexing",
"for",
"all",
"collections",
"attached",
"to",
"the",
"collector",
"."
] | train | https://github.com/cpliakas/search-framework/blob/7c5832d38ed998e04837c26e0daef59115563b98/src/Search/Framework/Collector.php#L50-L67 |
cpliakas/search-framework | src/Search/Framework/Collector.php | Collector.queueCollection | public function queueCollection(CollectionAbstract $collection)
{
$log = $this->getLogger();
$context = array('collection' => $collection->getId());
$log->info('Begin fetching items that are scheduled for indexing', $context);
$event = new CollectionEvent($this, $collection);
... | php | public function queueCollection(CollectionAbstract $collection)
{
$log = $this->getLogger();
$context = array('collection' => $collection->getId());
$log->info('Begin fetching items that are scheduled for indexing', $context);
$event = new CollectionEvent($this, $collection);
... | [
"public",
"function",
"queueCollection",
"(",
"CollectionAbstract",
"$",
"collection",
")",
"{",
"$",
"log",
"=",
"$",
"this",
"->",
"getLogger",
"(",
")",
";",
"$",
"context",
"=",
"array",
"(",
"'collection'",
"=>",
"$",
"collection",
"->",
"getId",
"(",... | Queues the items scheduled for indexing for the collection.
@param CollectionAbstract $collection
The collection that fetches the items scheduled for indexing.
@return int
The number of items sent to the queue. | [
"Queues",
"the",
"items",
"scheduled",
"for",
"indexing",
"for",
"the",
"collection",
"."
] | train | https://github.com/cpliakas/search-framework/blob/7c5832d38ed998e04837c26e0daef59115563b98/src/Search/Framework/Collector.php#L78-L108 |
antarestupin/Accessible | lib/Accessible/Reader/AutoConstructReader.php | AutoConstructReader.getConstructArguments | public static function getConstructArguments($objectClasses, $annotationReader)
{
$constructArguments = null;
array_reverse($objectClasses);
foreach ($objectClasses as $class) {
$annotation = $annotationReader->getClassAnnotation($class, self::$constructAnnotationClass);
... | php | public static function getConstructArguments($objectClasses, $annotationReader)
{
$constructArguments = null;
array_reverse($objectClasses);
foreach ($objectClasses as $class) {
$annotation = $annotationReader->getClassAnnotation($class, self::$constructAnnotationClass);
... | [
"public",
"static",
"function",
"getConstructArguments",
"(",
"$",
"objectClasses",
",",
"$",
"annotationReader",
")",
"{",
"$",
"constructArguments",
"=",
"null",
";",
"array_reverse",
"(",
"$",
"objectClasses",
")",
";",
"foreach",
"(",
"$",
"objectClasses",
"... | Get the list of needed arguments for given object's constructor.
@param array $objectClasses The classes of the object to read.
@param \Doctrine\Common\Annotations\Reader $annotationReader The annotation reader to use.
@return array The list of arguments. | [
"Get",
"the",
"list",
"of",
"needed",
"arguments",
"for",
"given",
"object",
"s",
"constructor",
"."
] | train | https://github.com/antarestupin/Accessible/blob/d12ce93d72f74c099dfd2109371fcd6ddfffdca4/lib/Accessible/Reader/AutoConstructReader.php#L36-L50 |
antarestupin/Accessible | lib/Accessible/Reader/AutoConstructReader.php | AutoConstructReader.getPropertiesToInitialize | public static function getPropertiesToInitialize($properties, $annotationReader)
{
$propertiesValues = array();
foreach ($properties as $propertyName => $property) {
$initializeAnnotation = $annotationReader->getPropertyAnnotation($property, self::$initializeAnnotationClass);
... | php | public static function getPropertiesToInitialize($properties, $annotationReader)
{
$propertiesValues = array();
foreach ($properties as $propertyName => $property) {
$initializeAnnotation = $annotationReader->getPropertyAnnotation($property, self::$initializeAnnotationClass);
... | [
"public",
"static",
"function",
"getPropertiesToInitialize",
"(",
"$",
"properties",
",",
"$",
"annotationReader",
")",
"{",
"$",
"propertiesValues",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"properties",
"as",
"$",
"propertyName",
"=>",
"$",
"propert... | Get the list of properties that have to be initialized automatically
during the object construction, plus their value.
@param array $properties The properties of the object to read.
@param \Doctrine\Common\Annotations\Reader $annotationReader The annotation reader to use.
@return array The list of properties and val... | [
"Get",
"the",
"list",
"of",
"properties",
"that",
"have",
"to",
"be",
"initialized",
"automatically",
"during",
"the",
"object",
"construction",
"plus",
"their",
"value",
"."
] | train | https://github.com/antarestupin/Accessible/blob/d12ce93d72f74c099dfd2109371fcd6ddfffdca4/lib/Accessible/Reader/AutoConstructReader.php#L62-L88 |
vi-kon/laravel-parser | src/ViKon/Parser/lexer/Lexer.php | Lexer.addSinglePattern | public function addSinglePattern($pattern, $ruleName, $childRuleName) {
return $this->addPattern($pattern, $ruleName, self::SINGLE_RULE_PREFIX . $childRuleName);
} | php | public function addSinglePattern($pattern, $ruleName, $childRuleName) {
return $this->addPattern($pattern, $ruleName, self::SINGLE_RULE_PREFIX . $childRuleName);
} | [
"public",
"function",
"addSinglePattern",
"(",
"$",
"pattern",
",",
"$",
"ruleName",
",",
"$",
"childRuleName",
")",
"{",
"return",
"$",
"this",
"->",
"addPattern",
"(",
"$",
"pattern",
",",
"$",
"ruleName",
",",
"self",
"::",
"SINGLE_RULE_PREFIX",
".",
"$... | Add single pattern. If pattern match change to provided rule and immediately back
@param string $pattern regexp pattern
@param string $ruleName rule name
@param string $childRuleName child rule name (next rule)
@return \ViKon\Parser\Lexer\Lexer | [
"Add",
"single",
"pattern",
".",
"If",
"pattern",
"match",
"change",
"to",
"provided",
"rule",
"and",
"immediately",
"back"
] | train | https://github.com/vi-kon/laravel-parser/blob/070f0bb9120cb9ca6ff836d4f418e78ee33ee182/src/ViKon/Parser/lexer/Lexer.php#L83-L85 |
vi-kon/laravel-parser | src/ViKon/Parser/lexer/Lexer.php | Lexer.tokenize | public function tokenize($text, $startRuleName, TokenList $tokenList = null) {
if ($tokenList === null) {
$tokenList = new TokenList();
}
$currentPosition = 0;
$initialLength = strlen($text);
$this->stack = new LexerStack($startRuleName);
while (is_array($p... | php | public function tokenize($text, $startRuleName, TokenList $tokenList = null) {
if ($tokenList === null) {
$tokenList = new TokenList();
}
$currentPosition = 0;
$initialLength = strlen($text);
$this->stack = new LexerStack($startRuleName);
while (is_array($p... | [
"public",
"function",
"tokenize",
"(",
"$",
"text",
",",
"$",
"startRuleName",
",",
"TokenList",
"$",
"tokenList",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"tokenList",
"===",
"null",
")",
"{",
"$",
"tokenList",
"=",
"new",
"TokenList",
"(",
")",
";",
... | @param string $text input text
@param string $startRuleName start rule name for tokenization
@param \ViKon\Parser\TokenList $tokenList already initialized token list
@throws \ViKon\Parser\LexerException
@return \ViKon\Parser\TokenList | [
"@param",
"string",
"$text",
"input",
"text",
"@param",
"string",
"$startRuleName",
"start",
"rule",
"name",
"for",
"tokenization",
"@param",
"\\",
"ViKon",
"\\",
"Parser",
"\\",
"TokenList",
"$tokenList",
"already",
"initialized",
"token",
"list"
] | train | https://github.com/vi-kon/laravel-parser/blob/070f0bb9120cb9ca6ff836d4f418e78ee33ee182/src/ViKon/Parser/lexer/Lexer.php#L107-L150 |
vi-kon/laravel-parser | src/ViKon/Parser/lexer/Lexer.php | Lexer.addPattern | protected function addPattern($pattern, $ruleName, $childRuleName = null) {
if (!isset($this->patterns[$ruleName])) {
$this->patterns[$ruleName] = new LexerPattern($ruleName);
}
$this->patterns[$ruleName]->addPattern($pattern, $childRuleName);
return $this;
} | php | protected function addPattern($pattern, $ruleName, $childRuleName = null) {
if (!isset($this->patterns[$ruleName])) {
$this->patterns[$ruleName] = new LexerPattern($ruleName);
}
$this->patterns[$ruleName]->addPattern($pattern, $childRuleName);
return $this;
} | [
"protected",
"function",
"addPattern",
"(",
"$",
"pattern",
",",
"$",
"ruleName",
",",
"$",
"childRuleName",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"patterns",
"[",
"$",
"ruleName",
"]",
")",
")",
"{",
"$",
"this",
... | Add pattern to rule patterns
@param string $pattern regex pattern
@param string $ruleName rule name
@param string|null $childRuleName child rule name
@return $this | [
"Add",
"pattern",
"to",
"rule",
"patterns"
] | train | https://github.com/vi-kon/laravel-parser/blob/070f0bb9120cb9ca6ff836d4f418e78ee33ee182/src/ViKon/Parser/lexer/Lexer.php#L161-L168 |
vi-kon/laravel-parser | src/ViKon/Parser/lexer/Lexer.php | Lexer.reduce | protected function reduce(&$text) {
if (!array_key_exists($this->stack->top(), $this->patterns)) {
return false;
}
if ($text !== '' && ($data = $this->patterns[$this->stack->top()]->split($text)) !== false) {
list($unmatched, $matched, $text, $childRuleName) = $data;
... | php | protected function reduce(&$text) {
if (!array_key_exists($this->stack->top(), $this->patterns)) {
return false;
}
if ($text !== '' && ($data = $this->patterns[$this->stack->top()]->split($text)) !== false) {
list($unmatched, $matched, $text, $childRuleName) = $data;
... | [
"protected",
"function",
"reduce",
"(",
"&",
"$",
"text",
")",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"this",
"->",
"stack",
"->",
"top",
"(",
")",
",",
"$",
"this",
"->",
"patterns",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
... | Reduce input text length by patterns match
@param string $text
@return array|bool FALSE if no valid pattern found, TRUE if input text is empty or split is not succeed,
otherwise array with unmatched, matched part of text and used patterns rule name | [
"Reduce",
"input",
"text",
"length",
"by",
"patterns",
"match"
] | train | https://github.com/vi-kon/laravel-parser/blob/070f0bb9120cb9ca6ff836d4f418e78ee33ee182/src/ViKon/Parser/lexer/Lexer.php#L178-L189 |
antarestupin/Accessible | lib/Accessible/Reader/AccessReader.php | AccessReader.getAccessProperties | public static function getAccessProperties($properties, $annotationReader)
{
$objectAccessProperties = array();
foreach ($properties as $propertyName => $property) {
if (empty($objectAccessProperties[$propertyName])) {
$objectAccessProperties[$propertyName] = array();
... | php | public static function getAccessProperties($properties, $annotationReader)
{
$objectAccessProperties = array();
foreach ($properties as $propertyName => $property) {
if (empty($objectAccessProperties[$propertyName])) {
$objectAccessProperties[$propertyName] = array();
... | [
"public",
"static",
"function",
"getAccessProperties",
"(",
"$",
"properties",
",",
"$",
"annotationReader",
")",
"{",
"$",
"objectAccessProperties",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"properties",
"as",
"$",
"propertyName",
"=>",
"$",
"propert... | Get a list of properties and the access that are given to them for given object.
@param array $properties The properties of the object to read.
@param Reader $annotationReader The annotation reader to use.
@return array The list of properties and their access. | [
"Get",
"a",
"list",
"of",
"properties",
"and",
"the",
"access",
"that",
"are",
"given",
"to",
"them",
"for",
"given",
"object",
"."
] | train | https://github.com/antarestupin/Accessible/blob/d12ce93d72f74c099dfd2109371fcd6ddfffdca4/lib/Accessible/Reader/AccessReader.php#L22-L58 |
Laralum/Dashboard | src/Widgets.php | Widgets.get | public static function get()
{
$widgets = [];
foreach (Packages::all() as $package) {
$dir = __DIR__.'/../../'.$package.'/src';
$files = is_dir($dir) ? scandir($dir) : [];
foreach ($files as $file) {
if ($file == 'Widgets.json') {
... | php | public static function get()
{
$widgets = [];
foreach (Packages::all() as $package) {
$dir = __DIR__.'/../../'.$package.'/src';
$files = is_dir($dir) ? scandir($dir) : [];
foreach ($files as $file) {
if ($file == 'Widgets.json') {
... | [
"public",
"static",
"function",
"get",
"(",
")",
"{",
"$",
"widgets",
"=",
"[",
"]",
";",
"foreach",
"(",
"Packages",
"::",
"all",
"(",
")",
"as",
"$",
"package",
")",
"{",
"$",
"dir",
"=",
"__DIR__",
".",
"'/../../'",
".",
"$",
"package",
".",
"... | Returns all the widgets. | [
"Returns",
"all",
"the",
"widgets",
"."
] | train | https://github.com/Laralum/Dashboard/blob/2acbef188bdd2d19ed1ac48e28fd74ec2df6ee4b/src/Widgets.php#L27-L49 |
Laralum/Dashboard | src/Widgets.php | Widgets.orderByPreference | public static function orderByPreference($widgets)
{
$preference = collect(['laralum', 'dashboard', 'users', 'roles', 'permissions']);
$ordered_widgets = [];
$final_ordered_widgets = [];
$widgets = collect($widgets)->groupBy('package')->toArray();
foreach (Packages::all() ... | php | public static function orderByPreference($widgets)
{
$preference = collect(['laralum', 'dashboard', 'users', 'roles', 'permissions']);
$ordered_widgets = [];
$final_ordered_widgets = [];
$widgets = collect($widgets)->groupBy('package')->toArray();
foreach (Packages::all() ... | [
"public",
"static",
"function",
"orderByPreference",
"(",
"$",
"widgets",
")",
"{",
"$",
"preference",
"=",
"collect",
"(",
"[",
"'laralum'",
",",
"'dashboard'",
",",
"'users'",
",",
"'roles'",
",",
"'permissions'",
"]",
")",
";",
"$",
"ordered_widgets",
"="... | Order the widgets by preference. | [
"Order",
"the",
"widgets",
"by",
"preference",
"."
] | train | https://github.com/Laralum/Dashboard/blob/2acbef188bdd2d19ed1ac48e28fd74ec2df6ee4b/src/Widgets.php#L54-L80 |
ptlis/conneg | src/Preference/Builder/MimePreferenceBuilder.php | MimePreferenceBuilder.getQualityFactor | private function getQualityFactor()
{
$qFactor = 0.0;
if (2 === count(explode('/', $this->variant))) {
$qFactor = $this->qFactor;
}
return $qFactor;
} | php | private function getQualityFactor()
{
$qFactor = 0.0;
if (2 === count(explode('/', $this->variant))) {
$qFactor = $this->qFactor;
}
return $qFactor;
} | [
"private",
"function",
"getQualityFactor",
"(",
")",
"{",
"$",
"qFactor",
"=",
"0.0",
";",
"if",
"(",
"2",
"===",
"count",
"(",
"explode",
"(",
"'/'",
",",
"$",
"this",
"->",
"variant",
")",
")",
")",
"{",
"$",
"qFactor",
"=",
"$",
"this",
"->",
... | Get the variants's quality factor, defaulting to 0 on absent variant.
@return float | [
"Get",
"the",
"variants",
"s",
"quality",
"factor",
"defaulting",
"to",
"0",
"on",
"absent",
"variant",
"."
] | train | https://github.com/ptlis/conneg/blob/04afb568f368ecdd81c13277006c4be041ccb58b/src/Preference/Builder/MimePreferenceBuilder.php#L86-L95 |
ptlis/conneg | src/Preference/Builder/MimePreferenceBuilder.php | MimePreferenceBuilder.getPrecedence | private function getPrecedence()
{
$precedence = Preference::ABSENT;
// A variant is present
$variantParts = explode('/', $this->variant);
if (2 === count($variantParts)) {
list($mimeType, $subType) = $variantParts;
$precedence = Preference::COMPLETE;
... | php | private function getPrecedence()
{
$precedence = Preference::ABSENT;
// A variant is present
$variantParts = explode('/', $this->variant);
if (2 === count($variantParts)) {
list($mimeType, $subType) = $variantParts;
$precedence = Preference::COMPLETE;
... | [
"private",
"function",
"getPrecedence",
"(",
")",
"{",
"$",
"precedence",
"=",
"Preference",
"::",
"ABSENT",
";",
"// A variant is present",
"$",
"variantParts",
"=",
"explode",
"(",
"'/'",
",",
"$",
"this",
"->",
"variant",
")",
";",
"if",
"(",
"2",
"==="... | Determine the precedence from the variant.
@return int | [
"Determine",
"the",
"precedence",
"from",
"the",
"variant",
"."
] | train | https://github.com/ptlis/conneg/blob/04afb568f368ecdd81c13277006c4be041ccb58b/src/Preference/Builder/MimePreferenceBuilder.php#L102-L122 |
christophe-brachet/aspi-framework | src/Framework/Form/Element/AbstractElement.php | AbstractElement.setLabelAttributes | public function setLabelAttributes(array $attribs)
{
foreach ($attribs as $a => $v) {
$this->setLabelAttribute($a, $v);
}
return $this;
} | php | public function setLabelAttributes(array $attribs)
{
foreach ($attribs as $a => $v) {
$this->setLabelAttribute($a, $v);
}
return $this;
} | [
"public",
"function",
"setLabelAttributes",
"(",
"array",
"$",
"attribs",
")",
"{",
"foreach",
"(",
"$",
"attribs",
"as",
"$",
"a",
"=>",
"$",
"v",
")",
"{",
"$",
"this",
"->",
"setLabelAttribute",
"(",
"$",
"a",
",",
"$",
"v",
")",
";",
"}",
"retu... | Set the attributes of the label of the form element object
@param array $attribs
@return AbstractElement | [
"Set",
"the",
"attributes",
"of",
"the",
"label",
"of",
"the",
"form",
"element",
"object"
] | train | https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/Element/AbstractElement.php#L152-L158 |
christophe-brachet/aspi-framework | src/Framework/Form/Element/AbstractElement.php | AbstractElement.setHintAttributes | public function setHintAttributes(array $attribs)
{
foreach ($attribs as $a => $v) {
$this->setHintAttribute($a, $v);
}
return $this;
} | php | public function setHintAttributes(array $attribs)
{
foreach ($attribs as $a => $v) {
$this->setHintAttribute($a, $v);
}
return $this;
} | [
"public",
"function",
"setHintAttributes",
"(",
"array",
"$",
"attribs",
")",
"{",
"foreach",
"(",
"$",
"attribs",
"as",
"$",
"a",
"=>",
"$",
"v",
")",
"{",
"$",
"this",
"->",
"setHintAttribute",
"(",
"$",
"a",
",",
"$",
"v",
")",
";",
"}",
"return... | Set the attributes of the hint of the form element object
@param array $attribs
@return AbstractElement | [
"Set",
"the",
"attributes",
"of",
"the",
"hint",
"of",
"the",
"form",
"element",
"object"
] | train | https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/Element/AbstractElement.php#L177-L183 |
christophe-brachet/aspi-framework | src/Framework/Form/Element/AbstractElement.php | AbstractElement.addValidator | public function addValidator($validator)
{
if (!($validator instanceof \Pop\Validator\AbstractValidator) && !is_callable($validator)) {
throw new Exception('Error: The validator must be an instance of Pop\Validator\AbstractValidator or a callable object.');
}
$this->validators[] ... | php | public function addValidator($validator)
{
if (!($validator instanceof \Pop\Validator\AbstractValidator) && !is_callable($validator)) {
throw new Exception('Error: The validator must be an instance of Pop\Validator\AbstractValidator or a callable object.');
}
$this->validators[] ... | [
"public",
"function",
"addValidator",
"(",
"$",
"validator",
")",
"{",
"if",
"(",
"!",
"(",
"$",
"validator",
"instanceof",
"\\",
"Pop",
"\\",
"Validator",
"\\",
"AbstractValidator",
")",
"&&",
"!",
"is_callable",
"(",
"$",
"validator",
")",
")",
"{",
"t... | Add a validator the form element
@param mixed $validator
@throws Exception
@return AbstractElement | [
"Add",
"a",
"validator",
"the",
"form",
"element"
] | train | https://github.com/christophe-brachet/aspi-framework/blob/17a36c8a8582e0b8d8bff7087590c09a9bd4af1e/src/Framework/Form/Element/AbstractElement.php#L376-L383 |
DASPRiD/Pikkuleipa | src/Cookie.php | Cookie.fromJson | public static function fromJson(
string $name,
bool $endsWithSession,
DateTimeImmutable $issuedAt,
string $json
) : self {
$cookie = new self($name, $endsWithSession, $issuedAt);
$cookie->data = json_decode($json, true);
if (! is_array($cookie->data)) {
... | php | public static function fromJson(
string $name,
bool $endsWithSession,
DateTimeImmutable $issuedAt,
string $json
) : self {
$cookie = new self($name, $endsWithSession, $issuedAt);
$cookie->data = json_decode($json, true);
if (! is_array($cookie->data)) {
... | [
"public",
"static",
"function",
"fromJson",
"(",
"string",
"$",
"name",
",",
"bool",
"$",
"endsWithSession",
",",
"DateTimeImmutable",
"$",
"issuedAt",
",",
"string",
"$",
"json",
")",
":",
"self",
"{",
"$",
"cookie",
"=",
"new",
"self",
"(",
"$",
"name"... | Creates a new cookie instance from JSON encoded data.
This is primarily used by the `TokenManager` to unserialize a cookie from a JWT token.
@throws JsonException When an error occurs during decoding | [
"Creates",
"a",
"new",
"cookie",
"instance",
"from",
"JSON",
"encoded",
"data",
"."
] | train | https://github.com/DASPRiD/Pikkuleipa/blob/e80c6ad7354069d49c18ca3bae0d1ae7f3912bfb/src/Cookie.php#L45-L59 |
DASPRiD/Pikkuleipa | src/Cookie.php | Cookie.toJson | public function toJson() : string
{
$json = json_encode($this->data);
if (false === $json) {
throw JsonException::fromJsonEncodeError(json_last_error_msg());
}
return $json;
} | php | public function toJson() : string
{
$json = json_encode($this->data);
if (false === $json) {
throw JsonException::fromJsonEncodeError(json_last_error_msg());
}
return $json;
} | [
"public",
"function",
"toJson",
"(",
")",
":",
"string",
"{",
"$",
"json",
"=",
"json_encode",
"(",
"$",
"this",
"->",
"data",
")",
";",
"if",
"(",
"false",
"===",
"$",
"json",
")",
"{",
"throw",
"JsonException",
"::",
"fromJsonEncodeError",
"(",
"json... | Serializes the cookie data as JSON.
@throws JsonException When an error occurs during encoding | [
"Serializes",
"the",
"cookie",
"data",
"as",
"JSON",
"."
] | train | https://github.com/DASPRiD/Pikkuleipa/blob/e80c6ad7354069d49c18ca3bae0d1ae7f3912bfb/src/Cookie.php#L66-L75 |
ssnepenthe/soter | src/class-plugin-provider.php | Plugin_Provider.boot | public function boot( Container $container ) {
add_action( 'admin_init', [ $this->proxy( $container, 'options_page' ), 'admin_init' ] );
add_action( 'admin_menu', [ $this->proxy( $container, 'options_page' ), 'admin_menu' ] );
add_action(
'admin_notices',
[ $this->proxy( $container, 'options_page' ), 'print... | php | public function boot( Container $container ) {
add_action( 'admin_init', [ $this->proxy( $container, 'options_page' ), 'admin_init' ] );
add_action( 'admin_menu', [ $this->proxy( $container, 'options_page' ), 'admin_menu' ] );
add_action(
'admin_notices',
[ $this->proxy( $container, 'options_page' ), 'print... | [
"public",
"function",
"boot",
"(",
"Container",
"$",
"container",
")",
"{",
"add_action",
"(",
"'admin_init'",
",",
"[",
"$",
"this",
"->",
"proxy",
"(",
"$",
"container",
",",
"'options_page'",
")",
",",
"'admin_init'",
"]",
")",
";",
"add_action",
"(",
... | Provider-specific boot logic.
@param Container $container Plugin container instance.
@return void | [
"Provider",
"-",
"specific",
"boot",
"logic",
"."
] | train | https://github.com/ssnepenthe/soter/blob/f6d7032f8562e23c2ee8dbf9d60ef1114c8cdce7/src/class-plugin-provider.php#L48-L66 |
ssnepenthe/soter | src/class-plugin-provider.php | Plugin_Provider.register | public function register( Container $container ) {
$container['check_site_job'] = function( Container $c ) {
return new Check_Site_Job( $c['checker'], $c['options_manager'] );
};
$container['checker'] = function( Container $c ) {
$checker = new Checker( new Api_Client( $c['http'] ), new WP_Package_Manager(... | php | public function register( Container $container ) {
$container['check_site_job'] = function( Container $c ) {
return new Check_Site_Job( $c['checker'], $c['options_manager'] );
};
$container['checker'] = function( Container $c ) {
$checker = new Checker( new Api_Client( $c['http'] ), new WP_Package_Manager(... | [
"public",
"function",
"register",
"(",
"Container",
"$",
"container",
")",
"{",
"$",
"container",
"[",
"'check_site_job'",
"]",
"=",
"function",
"(",
"Container",
"$",
"c",
")",
"{",
"return",
"new",
"Check_Site_Job",
"(",
"$",
"c",
"[",
"'checker'",
"]",
... | Provider-specific registration logic.
@param Container $container Plugin container instance.
@return void | [
"Provider",
"-",
"specific",
"registration",
"logic",
"."
] | train | https://github.com/ssnepenthe/soter/blob/f6d7032f8562e23c2ee8dbf9d60ef1114c8cdce7/src/class-plugin-provider.php#L86-L160 |
ssnepenthe/soter | src/class-plugin-provider.php | Plugin_Provider.boot_upgrader | protected function boot_upgrader( Container $container ) {
if ( ! $this->doing_cron() && ! is_admin() ) {
return;
}
$upgrader = new Upgrader( $container['options_manager'] );
add_action( 'init', [ $upgrader, 'perform_upgrade' ] );
} | php | protected function boot_upgrader( Container $container ) {
if ( ! $this->doing_cron() && ! is_admin() ) {
return;
}
$upgrader = new Upgrader( $container['options_manager'] );
add_action( 'init', [ $upgrader, 'perform_upgrade' ] );
} | [
"protected",
"function",
"boot_upgrader",
"(",
"Container",
"$",
"container",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"doing_cron",
"(",
")",
"&&",
"!",
"is_admin",
"(",
")",
")",
"{",
"return",
";",
"}",
"$",
"upgrader",
"=",
"new",
"Upgrader",
... | Boots the upgrader object on cron or admin requests.
@param Container $container Plugin container instance.
@return void | [
"Boots",
"the",
"upgrader",
"object",
"on",
"cron",
"or",
"admin",
"requests",
"."
] | train | https://github.com/ssnepenthe/soter/blob/f6d7032f8562e23c2ee8dbf9d60ef1114c8cdce7/src/class-plugin-provider.php#L169-L177 |
granulephp/util | lib/Collection/ArrayCollection.php | ArrayCollection.contains | public function contains($element): bool {
$this->validateElement($element);
return in_array($element, $this->elements);
} | php | public function contains($element): bool {
$this->validateElement($element);
return in_array($element, $this->elements);
} | [
"public",
"function",
"contains",
"(",
"$",
"element",
")",
":",
"bool",
"{",
"$",
"this",
"->",
"validateElement",
"(",
"$",
"element",
")",
";",
"return",
"in_array",
"(",
"$",
"element",
",",
"$",
"this",
"->",
"elements",
")",
";",
"}"
] | {@inheritdoc} | [
"{"
] | train | https://github.com/granulephp/util/blob/8dcac627fbf9cf5e4219b6dec8ba8ad7c0a3186e/lib/Collection/ArrayCollection.php#L82-L86 |
granulephp/util | lib/Collection/ArrayCollection.php | ArrayCollection.containsAll | public function containsAll(Collection $collection): bool {
return $collection->toArray()
== array_uintersect($collection->toArray(), $this->elements, function ($e1, $e2) {
if ($e1 == $e2) {
return 0;
}
return -1;
});
... | php | public function containsAll(Collection $collection): bool {
return $collection->toArray()
== array_uintersect($collection->toArray(), $this->elements, function ($e1, $e2) {
if ($e1 == $e2) {
return 0;
}
return -1;
});
... | [
"public",
"function",
"containsAll",
"(",
"Collection",
"$",
"collection",
")",
":",
"bool",
"{",
"return",
"$",
"collection",
"->",
"toArray",
"(",
")",
"==",
"array_uintersect",
"(",
"$",
"collection",
"->",
"toArray",
"(",
")",
",",
"$",
"this",
"->",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/granulephp/util/blob/8dcac627fbf9cf5e4219b6dec8ba8ad7c0a3186e/lib/Collection/ArrayCollection.php#L89-L98 |
granulephp/util | lib/Collection/ArrayCollection.php | ArrayCollection.equals | public function equals(Collection $collection): bool {
if ($this instanceof StrictTypedValue && $collection instanceof StrictTypedValue) {
if ($this->getValueType() !== $collection->getValueType()) {
return false;
}
}
return $this->toArray() == $collectio... | php | public function equals(Collection $collection): bool {
if ($this instanceof StrictTypedValue && $collection instanceof StrictTypedValue) {
if ($this->getValueType() !== $collection->getValueType()) {
return false;
}
}
return $this->toArray() == $collectio... | [
"public",
"function",
"equals",
"(",
"Collection",
"$",
"collection",
")",
":",
"bool",
"{",
"if",
"(",
"$",
"this",
"instanceof",
"StrictTypedValue",
"&&",
"$",
"collection",
"instanceof",
"StrictTypedValue",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getValu... | {@inheritdoc} | [
"{"
] | train | https://github.com/granulephp/util/blob/8dcac627fbf9cf5e4219b6dec8ba8ad7c0a3186e/lib/Collection/ArrayCollection.php#L101-L109 |
granulephp/util | lib/Collection/ArrayCollection.php | ArrayCollection.get | public function get(int $index) {
if ($this->offsetExists($index)) {
return $this->elements[$index];
}
throw new \OutOfRangeException(sprintf('Undefined element by index: %d', $index));
} | php | public function get(int $index) {
if ($this->offsetExists($index)) {
return $this->elements[$index];
}
throw new \OutOfRangeException(sprintf('Undefined element by index: %d', $index));
} | [
"public",
"function",
"get",
"(",
"int",
"$",
"index",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"offsetExists",
"(",
"$",
"index",
")",
")",
"{",
"return",
"$",
"this",
"->",
"elements",
"[",
"$",
"index",
"]",
";",
"}",
"throw",
"new",
"\\",
"Out... | {@inheritdoc} | [
"{"
] | train | https://github.com/granulephp/util/blob/8dcac627fbf9cf5e4219b6dec8ba8ad7c0a3186e/lib/Collection/ArrayCollection.php#L127-L133 |
granulephp/util | lib/Collection/ArrayCollection.php | ArrayCollection.indexOf | public function indexOf($element): ?int {
$this->validateElement($element);
$value = array_search($element, $this->elements, true);
return $value !== false ? $value : null;
} | php | public function indexOf($element): ?int {
$this->validateElement($element);
$value = array_search($element, $this->elements, true);
return $value !== false ? $value : null;
} | [
"public",
"function",
"indexOf",
"(",
"$",
"element",
")",
":",
"?",
"int",
"{",
"$",
"this",
"->",
"validateElement",
"(",
"$",
"element",
")",
";",
"$",
"value",
"=",
"array_search",
"(",
"$",
"element",
",",
"$",
"this",
"->",
"elements",
",",
"tr... | {@inheritdoc} | [
"{"
] | train | https://github.com/granulephp/util/blob/8dcac627fbf9cf5e4219b6dec8ba8ad7c0a3186e/lib/Collection/ArrayCollection.php#L136-L141 |
granulephp/util | lib/Collection/ArrayCollection.php | ArrayCollection.offsetExists | public function offsetExists($offset): bool {
if (!is_integer($offset)) {
throw new \TypeError(
sprintf('Expected integer type, provided: %s', gettype($offset))
);
}
return array_key_exists($offset, $this->elements);
} | php | public function offsetExists($offset): bool {
if (!is_integer($offset)) {
throw new \TypeError(
sprintf('Expected integer type, provided: %s', gettype($offset))
);
}
return array_key_exists($offset, $this->elements);
} | [
"public",
"function",
"offsetExists",
"(",
"$",
"offset",
")",
":",
"bool",
"{",
"if",
"(",
"!",
"is_integer",
"(",
"$",
"offset",
")",
")",
"{",
"throw",
"new",
"\\",
"TypeError",
"(",
"sprintf",
"(",
"'Expected integer type, provided: %s'",
",",
"gettype",... | {@inheritdoc} | [
"{"
] | train | https://github.com/granulephp/util/blob/8dcac627fbf9cf5e4219b6dec8ba8ad7c0a3186e/lib/Collection/ArrayCollection.php#L144-L152 |
spryker/category-data-import | src/Spryker/Zed/CategoryDataImport/Business/Model/Reader/CategoryReader.php | CategoryReader.addCategory | public function addCategory(SpyCategory $categoryEntity, SpyCategoryNode $categoryNodeEntity)
{
$this->categoryKeys[$categoryEntity->getCategoryKey()] = [
static::ID_CATEGORY => $categoryEntity->getIdCategory(),
static::ID_CATEGORY_NODE => $categoryNodeEntity->getIdCategoryNode(),
... | php | public function addCategory(SpyCategory $categoryEntity, SpyCategoryNode $categoryNodeEntity)
{
$this->categoryKeys[$categoryEntity->getCategoryKey()] = [
static::ID_CATEGORY => $categoryEntity->getIdCategory(),
static::ID_CATEGORY_NODE => $categoryNodeEntity->getIdCategoryNode(),
... | [
"public",
"function",
"addCategory",
"(",
"SpyCategory",
"$",
"categoryEntity",
",",
"SpyCategoryNode",
"$",
"categoryNodeEntity",
")",
"{",
"$",
"this",
"->",
"categoryKeys",
"[",
"$",
"categoryEntity",
"->",
"getCategoryKey",
"(",
")",
"]",
"=",
"[",
"static",... | @param \Orm\Zed\Category\Persistence\SpyCategory $categoryEntity
@param \Orm\Zed\Category\Persistence\SpyCategoryNode $categoryNodeEntity
@return void | [
"@param",
"\\",
"Orm",
"\\",
"Zed",
"\\",
"Category",
"\\",
"Persistence",
"\\",
"SpyCategory",
"$categoryEntity",
"@param",
"\\",
"Orm",
"\\",
"Zed",
"\\",
"Category",
"\\",
"Persistence",
"\\",
"SpyCategoryNode",
"$categoryNodeEntity"
] | train | https://github.com/spryker/category-data-import/blob/8ecf0fe61264d1e9d66af20dd6c3f15e4c8405e5/src/Spryker/Zed/CategoryDataImport/Business/Model/Reader/CategoryReader.php#L47-L66 |
spryker/category-data-import | src/Spryker/Zed/CategoryDataImport/Business/Model/Reader/CategoryReader.php | CategoryReader.getIdCategoryNodeByCategoryKey | public function getIdCategoryNodeByCategoryKey($categoryKey)
{
if ($this->categoryKeys->count() === 0) {
$this->loadCategoryKeys();
}
if (!$this->categoryKeys->offsetExists($categoryKey)) {
throw new CategoryByKeyNotFoundException(sprintf(
'Category b... | php | public function getIdCategoryNodeByCategoryKey($categoryKey)
{
if ($this->categoryKeys->count() === 0) {
$this->loadCategoryKeys();
}
if (!$this->categoryKeys->offsetExists($categoryKey)) {
throw new CategoryByKeyNotFoundException(sprintf(
'Category b... | [
"public",
"function",
"getIdCategoryNodeByCategoryKey",
"(",
"$",
"categoryKey",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"categoryKeys",
"->",
"count",
"(",
")",
"===",
"0",
")",
"{",
"$",
"this",
"->",
"loadCategoryKeys",
"(",
")",
";",
"}",
"if",
"(",
... | @param string $categoryKey
@throws \Spryker\Zed\CategoryDataImport\Business\Exception\CategoryByKeyNotFoundException
@return int | [
"@param",
"string",
"$categoryKey"
] | train | https://github.com/spryker/category-data-import/blob/8ecf0fe61264d1e9d66af20dd6c3f15e4c8405e5/src/Spryker/Zed/CategoryDataImport/Business/Model/Reader/CategoryReader.php#L75-L89 |
spryker/category-data-import | src/Spryker/Zed/CategoryDataImport/Business/Model/Reader/CategoryReader.php | CategoryReader.getParentUrl | public function getParentUrl($categoryKey, $idLocale)
{
if ($this->categoryUrls->count() === 0) {
$this->loadCategoryUrls();
}
if (!$this->categoryUrls->offsetExists($categoryKey)) {
throw new CategoryByKeyNotFoundException(sprintf(
'Category url key ... | php | public function getParentUrl($categoryKey, $idLocale)
{
if ($this->categoryUrls->count() === 0) {
$this->loadCategoryUrls();
}
if (!$this->categoryUrls->offsetExists($categoryKey)) {
throw new CategoryByKeyNotFoundException(sprintf(
'Category url key ... | [
"public",
"function",
"getParentUrl",
"(",
"$",
"categoryKey",
",",
"$",
"idLocale",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"categoryUrls",
"->",
"count",
"(",
")",
"===",
"0",
")",
"{",
"$",
"this",
"->",
"loadCategoryUrls",
"(",
")",
";",
"}",
"if... | @param string $categoryKey
@param int $idLocale
@throws \Spryker\Zed\CategoryDataImport\Business\Exception\CategoryByKeyNotFoundException
@return string | [
"@param",
"string",
"$categoryKey",
"@param",
"int",
"$idLocale"
] | train | https://github.com/spryker/category-data-import/blob/8ecf0fe61264d1e9d66af20dd6c3f15e4c8405e5/src/Spryker/Zed/CategoryDataImport/Business/Model/Reader/CategoryReader.php#L116-L140 |
markwatkinson/luminous | src/Luminous/Core/Scanners/StringScanner.php | StringScanner.rest | public function rest()
{
$rest = substr($this->src, $this->index);
if ($rest === false) {
$rest = '';
}
return $rest;
} | php | public function rest()
{
$rest = substr($this->src, $this->index);
if ($rest === false) {
$rest = '';
}
return $rest;
} | [
"public",
"function",
"rest",
"(",
")",
"{",
"$",
"rest",
"=",
"substr",
"(",
"$",
"this",
"->",
"src",
",",
"$",
"this",
"->",
"index",
")",
";",
"if",
"(",
"$",
"rest",
"===",
"false",
")",
"{",
"$",
"rest",
"=",
"''",
";",
"}",
"return",
"... | @brief Gets the remaining string
@return The rest of the string, which has not yet been consumed | [
"@brief",
"Gets",
"the",
"remaining",
"string"
] | train | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Core/Scanners/StringScanner.php#L83-L90 |
markwatkinson/luminous | src/Luminous/Core/Scanners/StringScanner.php | StringScanner.pos | public function pos($newPos = null)
{
if ($newPos !== null) {
$newPos = max(min((int)$newPos, $this->srcLen), 0);
$this->index = $newPos;
}
return $this->index;
} | php | public function pos($newPos = null)
{
if ($newPos !== null) {
$newPos = max(min((int)$newPos, $this->srcLen), 0);
$this->index = $newPos;
}
return $this->index;
} | [
"public",
"function",
"pos",
"(",
"$",
"newPos",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"newPos",
"!==",
"null",
")",
"{",
"$",
"newPos",
"=",
"max",
"(",
"min",
"(",
"(",
"int",
")",
"$",
"newPos",
",",
"$",
"this",
"->",
"srcLen",
")",
",",
... | @brief Getter and setter for the current position (string pointer).
@param $new_pos The new position (leave \c NULL to use as a getter), note
that this will be clipped to a legal string index if you specify a
negative number or an index greater than the string's length.
@return the current string pointer | [
"@brief",
"Getter",
"and",
"setter",
"for",
"the",
"current",
"position",
"(",
"string",
"pointer",
")",
"."
] | train | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Core/Scanners/StringScanner.php#L100-L107 |
markwatkinson/luminous | src/Luminous/Core/Scanners/StringScanner.php | StringScanner.reset | public function reset()
{
$this->pos(0);
$this->matchHistory = array(null, null);
$this->ss = new StringSearch($this->src);
} | php | public function reset()
{
$this->pos(0);
$this->matchHistory = array(null, null);
$this->ss = new StringSearch($this->src);
} | [
"public",
"function",
"reset",
"(",
")",
"{",
"$",
"this",
"->",
"pos",
"(",
"0",
")",
";",
"$",
"this",
"->",
"matchHistory",
"=",
"array",
"(",
"null",
",",
"null",
")",
";",
"$",
"this",
"->",
"ss",
"=",
"new",
"StringSearch",
"(",
"$",
"this"... | @brief Reset the scanner
Resets the scanner: sets the scan pointer to 0 and clears the match
history. | [
"@brief",
"Reset",
"the",
"scanner"
] | train | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Core/Scanners/StringScanner.php#L164-L169 |
markwatkinson/luminous | src/Luminous/Core/Scanners/StringScanner.php | StringScanner.string | public function string($s = null)
{
if ($s !== null) {
$s = str_replace("\r\n", "\n", $s);
$s = str_replace("\r", "\n", $s);
$this->src = $s;
$this->srcLen = strlen($s);
$this->reset();
}
return $this->src;
} | php | public function string($s = null)
{
if ($s !== null) {
$s = str_replace("\r\n", "\n", $s);
$s = str_replace("\r", "\n", $s);
$this->src = $s;
$this->srcLen = strlen($s);
$this->reset();
}
return $this->src;
} | [
"public",
"function",
"string",
"(",
"$",
"s",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"s",
"!==",
"null",
")",
"{",
"$",
"s",
"=",
"str_replace",
"(",
"\"\\r\\n\"",
",",
"\"\\n\"",
",",
"$",
"s",
")",
";",
"$",
"s",
"=",
"str_replace",
"(",
"\"... | @brief Getter and setter for the source string
@param $s The new source string (leave as @c NULL to use this method as a
getter)
@return The current source string
@note This method triggers a reset()
@note Any strings passed into this method are converted to Unix line
endings, i.e. @c \\n | [
"@brief",
"Getter",
"and",
"setter",
"for",
"the",
"source",
"string"
] | train | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Core/Scanners/StringScanner.php#L182-L192 |
markwatkinson/luminous | src/Luminous/Core/Scanners/StringScanner.php | StringScanner.peek | public function peek($n = 1)
{
if ($n === 0 || $this->eos()) {
return '';
}
if ($n === 1) {
return $this->src[$this->index];
}
return substr($this->src, $this->index, $n);
} | php | public function peek($n = 1)
{
if ($n === 0 || $this->eos()) {
return '';
}
if ($n === 1) {
return $this->src[$this->index];
}
return substr($this->src, $this->index, $n);
} | [
"public",
"function",
"peek",
"(",
"$",
"n",
"=",
"1",
")",
"{",
"if",
"(",
"$",
"n",
"===",
"0",
"||",
"$",
"this",
"->",
"eos",
"(",
")",
")",
"{",
"return",
"''",
";",
"}",
"if",
"(",
"$",
"n",
"===",
"1",
")",
"{",
"return",
"$",
"thi... | @brief Lookahead into the string a given number of bytes
@param $n The number of bytes.
@return The given number of bytes from the string from the current scan
pointer onwards. The returned string will be at most n bytes long, it may
be shorter or the empty string if the scanner is in the termination
position.
@note ... | [
"@brief",
"Lookahead",
"into",
"the",
"string",
"a",
"given",
"number",
"of",
"bytes"
] | train | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Core/Scanners/StringScanner.php#L219-L228 |
markwatkinson/luminous | src/Luminous/Core/Scanners/StringScanner.php | StringScanner.get | public function get($n = 1)
{
$p = $this->peek($n);
$this->index += strlen($p);
return $p;
} | php | public function get($n = 1)
{
$p = $this->peek($n);
$this->index += strlen($p);
return $p;
} | [
"public",
"function",
"get",
"(",
"$",
"n",
"=",
"1",
")",
"{",
"$",
"p",
"=",
"$",
"this",
"->",
"peek",
"(",
"$",
"n",
")",
";",
"$",
"this",
"->",
"index",
"+=",
"strlen",
"(",
"$",
"p",
")",
";",
"return",
"$",
"p",
";",
"}"
] | @brief Consume a given number of bytes
@param $n The number of bytes.
@return The given number of bytes from the string from the current scan
pointer onwards. The returned string will be at most n bytes long, it may
be shorter or the empty string if the scanner is in the termination
position.
@note This method is ide... | [
"@brief",
"Consume",
"a",
"given",
"number",
"of",
"bytes"
] | train | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Core/Scanners/StringScanner.php#L243-L248 |
markwatkinson/luminous | src/Luminous/Core/Scanners/StringScanner.php | StringScanner.matchGroup | public function matchGroup($g = 0)
{
if (isset($this->matchHistory[0])) {
if (isset($this->matchHistory[0][2])) {
if (isset($this->matchHistory[0][2][$g])) {
return $this->matchHistory[0][2][$g];
}
throw new Exception("No such g... | php | public function matchGroup($g = 0)
{
if (isset($this->matchHistory[0])) {
if (isset($this->matchHistory[0][2])) {
if (isset($this->matchHistory[0][2][$g])) {
return $this->matchHistory[0][2][$g];
}
throw new Exception("No such g... | [
"public",
"function",
"matchGroup",
"(",
"$",
"g",
"=",
"0",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"matchHistory",
"[",
"0",
"]",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"matchHistory",
"[",
"0",
"]",
"[",
"2"... | @brief Get a group from the most recent match operation
@param $g the group's numerical index or name, in the case of named
subpatterns.
@return A string represeting the group's contents.
@see match_groups()
@throw Exception if no matches have been recorded.
@throw Exception if matches have been recorded, but the gr... | [
"@brief",
"Get",
"a",
"group",
"from",
"the",
"most",
"recent",
"match",
"operation"
] | train | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Core/Scanners/StringScanner.php#L298-L309 |
markwatkinson/luminous | src/Luminous/Core/Scanners/StringScanner.php | StringScanner.logMatch | private function logMatch($index, $matchPos, $matchData)
{
if (isset($this->matchHistory[0])) {
$this->matchHistory[1] = $this->matchHistory[0];
}
$m = &$this->matchHistory[0];
$m[0] = $index;
$m[1] = $matchPos;
$m[2] = $matchData;
} | php | private function logMatch($index, $matchPos, $matchData)
{
if (isset($this->matchHistory[0])) {
$this->matchHistory[1] = $this->matchHistory[0];
}
$m = &$this->matchHistory[0];
$m[0] = $index;
$m[1] = $matchPos;
$m[2] = $matchData;
} | [
"private",
"function",
"logMatch",
"(",
"$",
"index",
",",
"$",
"matchPos",
",",
"$",
"matchData",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"matchHistory",
"[",
"0",
"]",
")",
")",
"{",
"$",
"this",
"->",
"matchHistory",
"[",
"1",
"]",... | @brief Helper function to log a match into the history
@internal | [
"@brief",
"Helper",
"function",
"to",
"log",
"a",
"match",
"into",
"the",
"history"
] | train | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Core/Scanners/StringScanner.php#L332-L341 |
markwatkinson/luminous | src/Luminous/Core/Scanners/StringScanner.php | StringScanner.consume | private function consume($pos, $consumeMatch, $matchData)
{
$this->index = $pos;
if ($consumeMatch) {
$this->index += strlen($matchData[0]);
}
} | php | private function consume($pos, $consumeMatch, $matchData)
{
$this->index = $pos;
if ($consumeMatch) {
$this->index += strlen($matchData[0]);
}
} | [
"private",
"function",
"consume",
"(",
"$",
"pos",
",",
"$",
"consumeMatch",
",",
"$",
"matchData",
")",
"{",
"$",
"this",
"->",
"index",
"=",
"$",
"pos",
";",
"if",
"(",
"$",
"consumeMatch",
")",
"{",
"$",
"this",
"->",
"index",
"+=",
"strlen",
"(... | @brief Helper function to consume a match
@param $pos (int) The match position
@param $consume_match (bool) Whether or not to consume the actual matched
text
@param $match_data The matching groups, as returned by PCRE.
@internal | [
"@brief",
"Helper",
"function",
"to",
"consume",
"a",
"match"
] | train | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Core/Scanners/StringScanner.php#L380-L386 |
markwatkinson/luminous | src/Luminous/Core/Scanners/StringScanner.php | StringScanner.checkInternal | private function checkInternal(
$pattern,
$instant = true,
$consume = true,
$consumeMatch = true,
$log = true
) {
$matches = null;
$index = $this->index;
$pos = null;
if (($pos = $this->ss->match($pattern, $this->index, $matches)) !== false) {
... | php | private function checkInternal(
$pattern,
$instant = true,
$consume = true,
$consumeMatch = true,
$log = true
) {
$matches = null;
$index = $this->index;
$pos = null;
if (($pos = $this->ss->match($pattern, $this->index, $matches)) !== false) {
... | [
"private",
"function",
"checkInternal",
"(",
"$",
"pattern",
",",
"$",
"instant",
"=",
"true",
",",
"$",
"consume",
"=",
"true",
",",
"$",
"consumeMatch",
"=",
"true",
",",
"$",
"log",
"=",
"true",
")",
"{",
"$",
"matches",
"=",
"null",
";",
"$",
"... | @brief The real scanning function
@internal
@param $pattern The pattern to scan for
@param $instant Whether or not the only legal match is at the
current scan pointer or whether one beyond the scan pointer is also
legal.
@param $consume Whether or not to consume string as a result of matching
@param $consume_match Whe... | [
"@brief",
"The",
"real",
"scanning",
"function"
] | train | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Core/Scanners/StringScanner.php#L406-L437 |
markwatkinson/luminous | src/Luminous/Core/Scanners/StringScanner.php | StringScanner.index | public function index($pattern)
{
$ret = $this->ss->match($pattern, $this->index, $dontcareRef);
return ($ret !== false) ? $ret : -1;
} | php | public function index($pattern)
{
$ret = $this->ss->match($pattern, $this->index, $dontcareRef);
return ($ret !== false) ? $ret : -1;
} | [
"public",
"function",
"index",
"(",
"$",
"pattern",
")",
"{",
"$",
"ret",
"=",
"$",
"this",
"->",
"ss",
"->",
"match",
"(",
"$",
"pattern",
",",
"$",
"this",
"->",
"index",
",",
"$",
"dontcareRef",
")",
";",
"return",
"(",
"$",
"ret",
"!==",
"fal... | @brief Find the index of the next occurrence of a pattern
@param $pattern the pattern to search for
@return The next index of the pattern, or -1 if it is not found | [
"@brief",
"Find",
"the",
"index",
"of",
"the",
"next",
"occurrence",
"of",
"a",
"pattern"
] | train | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Core/Scanners/StringScanner.php#L489-L493 |
markwatkinson/luminous | src/Luminous/Core/Scanners/StringScanner.php | StringScanner.getNextNamed | public function getNextNamed($patterns)
{
$next = -1;
$matches = null;
$name = null;
$m;
foreach ($patterns as $name_ => $p) {
$index = $this->ss->match($p, $this->index, $m);
if ($index === false) {
continue;
}
... | php | public function getNextNamed($patterns)
{
$next = -1;
$matches = null;
$name = null;
$m;
foreach ($patterns as $name_ => $p) {
$index = $this->ss->match($p, $this->index, $m);
if ($index === false) {
continue;
}
... | [
"public",
"function",
"getNextNamed",
"(",
"$",
"patterns",
")",
"{",
"$",
"next",
"=",
"-",
"1",
";",
"$",
"matches",
"=",
"null",
";",
"$",
"name",
"=",
"null",
";",
"$",
"m",
";",
"foreach",
"(",
"$",
"patterns",
"as",
"$",
"name_",
"=>",
"$",... | @brief Find the index of the next occurrence of a named pattern
@param $patterns A map of $name=>$pattern
@return An array: ($name, $index, $matches). If there is no next match,
name will be null, index will be -1 and matches will be null.
@note consider using this method to build a transition table | [
"@brief",
"Find",
"the",
"index",
"of",
"the",
"next",
"occurrence",
"of",
"a",
"named",
"pattern",
"@param",
"$patterns",
"A",
"map",
"of",
"$name",
"=",
">",
"$pattern",
"@return",
"An",
"array",
":",
"(",
"$name",
"$index",
"$matches",
")",
".",
"If",... | train | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Core/Scanners/StringScanner.php#L503-L525 |
markwatkinson/luminous | src/Luminous/Core/Scanners/StringScanner.php | StringScanner.getNext | public function getNext($patterns)
{
$next = -1;
$matches = null;
foreach ($patterns as $p) {
$m;
$index = $this->ss->match($p, $this->index, $m);
if ($index === false) {
continue;
}
if ($next === -1 || $index < $nex... | php | public function getNext($patterns)
{
$next = -1;
$matches = null;
foreach ($patterns as $p) {
$m;
$index = $this->ss->match($p, $this->index, $m);
if ($index === false) {
continue;
}
if ($next === -1 || $index < $nex... | [
"public",
"function",
"getNext",
"(",
"$",
"patterns",
")",
"{",
"$",
"next",
"=",
"-",
"1",
";",
"$",
"matches",
"=",
"null",
";",
"foreach",
"(",
"$",
"patterns",
"as",
"$",
"p",
")",
"{",
"$",
"m",
";",
"$",
"index",
"=",
"$",
"this",
"->",
... | @brief Look for the next occurrence of a set of patterns
Finds the next match of the given patterns and returns it. The
string is not consumed or logged.
Convenience function.
@param $patterns an array of regular expressions
@return an array of (0=>index, 1=>match_groups). The index may be -1 if
no pattern is found. | [
"@brief",
"Look",
"for",
"the",
"next",
"occurrence",
"of",
"a",
"set",
"of",
"patterns"
] | train | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Core/Scanners/StringScanner.php#L537-L554 |
markwatkinson/luminous | src/Luminous/Core/Scanners/StringScanner.php | StringScanner.getNextStrpos | public function getNextStrpos($patterns)
{
$next = -1;
$match = null;
foreach ($patterns as $p) {
$index = strpos($this->src, $p, $this->index);
if ($index === false) {
continue;
}
if ($next === -1 || $index < $next) {
... | php | public function getNextStrpos($patterns)
{
$next = -1;
$match = null;
foreach ($patterns as $p) {
$index = strpos($this->src, $p, $this->index);
if ($index === false) {
continue;
}
if ($next === -1 || $index < $next) {
... | [
"public",
"function",
"getNextStrpos",
"(",
"$",
"patterns",
")",
"{",
"$",
"next",
"=",
"-",
"1",
";",
"$",
"match",
"=",
"null",
";",
"foreach",
"(",
"$",
"patterns",
"as",
"$",
"p",
")",
"{",
"$",
"index",
"=",
"strpos",
"(",
"$",
"this",
"->"... | @brief Look for the next occurrence of a set of substrings
Like get_next() but uses strpos instead of preg_*
@return An array: 0 => index 1 => substring. If the substring is not found,
index is -1 and substring is null
@see get_next() | [
"@brief",
"Look",
"for",
"the",
"next",
"occurrence",
"of",
"a",
"set",
"of",
"substrings"
] | train | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Core/Scanners/StringScanner.php#L564-L579 |
markwatkinson/luminous | src/Luminous/Core/Scanners/StringScanner.php | StringScanner.removePattern | public function removePattern($name)
{
foreach ($this->patterns as $k => $p) {
if ($p[0] === $name) {
unset($this->patterns[$k]);
}
}
} | php | public function removePattern($name)
{
foreach ($this->patterns as $k => $p) {
if ($p[0] === $name) {
unset($this->patterns[$k]);
}
}
} | [
"public",
"function",
"removePattern",
"(",
"$",
"name",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"patterns",
"as",
"$",
"k",
"=>",
"$",
"p",
")",
"{",
"if",
"(",
"$",
"p",
"[",
"0",
"]",
"===",
"$",
"name",
")",
"{",
"unset",
"(",
"$",
"... | @brief Allows the caller to remove a named pattern
@param $name the name of the pattern to remove, this should be as it was
supplied to add_pattern().
@warning If there are multiple patterns with the same name, they will all
be removed. | [
"@brief",
"Allows",
"the",
"caller",
"to",
"remove",
"a",
"named",
"pattern"
] | train | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Core/Scanners/StringScanner.php#L602-L609 |
markwatkinson/luminous | src/Luminous/Core/Scanners/StringScanner.php | StringScanner.nextMatch | public function nextMatch($consumeAndLog = true)
{
$target = $this->index;
$nearestIndex = -1;
$nearestKey = -1;
$nearestName = null;
$nearestMatchData = null;
foreach ($this->patterns as &$pData) {
$name = $pData[0];
$pattern = $pData[1];
... | php | public function nextMatch($consumeAndLog = true)
{
$target = $this->index;
$nearestIndex = -1;
$nearestKey = -1;
$nearestName = null;
$nearestMatchData = null;
foreach ($this->patterns as &$pData) {
$name = $pData[0];
$pattern = $pData[1];
... | [
"public",
"function",
"nextMatch",
"(",
"$",
"consumeAndLog",
"=",
"true",
")",
"{",
"$",
"target",
"=",
"$",
"this",
"->",
"index",
";",
"$",
"nearestIndex",
"=",
"-",
"1",
";",
"$",
"nearestKey",
"=",
"-",
"1",
";",
"$",
"nearestName",
"=",
"null",... | @brief Automation function: returns the next occurrence of any known patterns.
Iterates over the predefined patterns array (add_pattern) and consumes/logs
the nearest match, skipping unrecognised segments of string.
@return An array:
0 => pattern name (as given to add_pattern)
1 => match index (although the scan poin... | [
"@brief",
"Automation",
"function",
":",
"returns",
"the",
"next",
"occurrence",
"of",
"any",
"known",
"patterns",
"."
] | train | https://github.com/markwatkinson/luminous/blob/4adc18f414534abe986133d6d38e8e9787d32e69/src/Luminous/Core/Scanners/StringScanner.php#L630-L672 |
vardius/crud-bundle | Command/GenerateCommand.php | GenerateCommand.execute | protected function execute(InputInterface $input, OutputInterface $output)
{
$bundle = $this->getApplication()->getKernel()->getBundle($input->getArgument('bundle'));
$output->writeln(sprintf('Vardius Crud generating for bundle "<info>%s</info>"', $bundle->getName()));
$generator = new Crud... | php | protected function execute(InputInterface $input, OutputInterface $output)
{
$bundle = $this->getApplication()->getKernel()->getBundle($input->getArgument('bundle'));
$output->writeln(sprintf('Vardius Crud generating for bundle "<info>%s</info>"', $bundle->getName()));
$generator = new Crud... | [
"protected",
"function",
"execute",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"bundle",
"=",
"$",
"this",
"->",
"getApplication",
"(",
")",
"->",
"getKernel",
"(",
")",
"->",
"getBundle",
"(",
"$",
"input",
... | @see Command
@throws \InvalidArgumentException When the target directory does not exist | [
"@see",
"Command"
] | train | https://github.com/vardius/crud-bundle/blob/dda957e3f8516c3b0d6270ea5a6eb50d98e71444/Command/GenerateCommand.php#L64-L87 |
ahmad-sa3d/saad-image | src/Traits/CopyrightTrait.php | CopyrightTrait.addCopyright | public function addCopyright( Array $info_array = array() )
{
// Overwrite Default Settings
$this->_copyright = array_merge( Config::get( static::PACKAGE_NAME . 'image.copyright' ), $info_array );
// Set Font File
$this->_copyright[ 'font' ] = !empty( $this->_copyright[ 'font' ] ) ?
$this->getFontF... | php | public function addCopyright( Array $info_array = array() )
{
// Overwrite Default Settings
$this->_copyright = array_merge( Config::get( static::PACKAGE_NAME . 'image.copyright' ), $info_array );
// Set Font File
$this->_copyright[ 'font' ] = !empty( $this->_copyright[ 'font' ] ) ?
$this->getFontF... | [
"public",
"function",
"addCopyright",
"(",
"Array",
"$",
"info_array",
"=",
"array",
"(",
")",
")",
"{",
"// Overwrite Default Settings",
"$",
"this",
"->",
"_copyright",
"=",
"array_merge",
"(",
"Config",
"::",
"get",
"(",
"static",
"::",
"PACKAGE_NAME",
".",... | -----------------------------------------
Write Text To Image
-----------------------------------------
@param array $info_array Method Information array like text to write and who to write
@return Image $this Current Image instance | [
"-----------------------------------------",
"Write",
"Text",
"To",
"Image",
"-----------------------------------------"
] | train | https://github.com/ahmad-sa3d/saad-image/blob/2485e585e0c2ae2b8f0afeb3d513f2df3e369939/src/Traits/CopyrightTrait.php#L19-L245 |
ahmad-sa3d/saad-image | src/Traits/CopyrightTrait.php | CopyrightTrait.setYPosition | private function setYPosition()
{
# Calculate Y position on Image
# Height Difference Between Image and CopyRight text box
$heights_difference = $this->_image_info[1] - $this->_copyright['text_box_dimensions']['height'];
if( $heights_difference > 0 )
{
if( $this->_copyright['vertical_location'] < $th... | php | private function setYPosition()
{
# Calculate Y position on Image
# Height Difference Between Image and CopyRight text box
$heights_difference = $this->_image_info[1] - $this->_copyright['text_box_dimensions']['height'];
if( $heights_difference > 0 )
{
if( $this->_copyright['vertical_location'] < $th... | [
"private",
"function",
"setYPosition",
"(",
")",
"{",
"#\tCalculate Y position on Image",
"# Height Difference Between Image and CopyRight text box",
"$",
"heights_difference",
"=",
"$",
"this",
"->",
"_image_info",
"[",
"1",
"]",
"-",
"$",
"this",
"->",
"_copyright",
"... | -----------------------------------------
setYPosition
-----------------------------------------
Set Y Position Where Text Will be Written | [
"-----------------------------------------",
"setYPosition",
"-----------------------------------------"
] | train | https://github.com/ahmad-sa3d/saad-image/blob/2485e585e0c2ae2b8f0afeb3d513f2df3e369939/src/Traits/CopyrightTrait.php#L256-L310 |
ahmad-sa3d/saad-image | src/Traits/CopyrightTrait.php | CopyrightTrait.setXPosition | private function setXPosition( $margins = 0 )
{
// Set to the first start if it hasnot been set
if( !isset( $this->_copyright['x_position'] ) )
$this->_copyright['x_position'] = 0;
// Fix Offset Values
$this->_copyright['x_position'] += $margins / 2 +
$this->_copyright['text_box_dimensions']['offse... | php | private function setXPosition( $margins = 0 )
{
// Set to the first start if it hasnot been set
if( !isset( $this->_copyright['x_position'] ) )
$this->_copyright['x_position'] = 0;
// Fix Offset Values
$this->_copyright['x_position'] += $margins / 2 +
$this->_copyright['text_box_dimensions']['offse... | [
"private",
"function",
"setXPosition",
"(",
"$",
"margins",
"=",
"0",
")",
"{",
"// Set to the first start if it hasnot been set",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"_copyright",
"[",
"'x_position'",
"]",
")",
")",
"$",
"this",
"->",
"_copyright... | -----------------------------------------
setXPosition
-----------------------------------------
Set X Position Where Text Will be Written | [
"-----------------------------------------",
"setXPosition",
"-----------------------------------------"
] | train | https://github.com/ahmad-sa3d/saad-image/blob/2485e585e0c2ae2b8f0afeb3d513f2df3e369939/src/Traits/CopyrightTrait.php#L321-L334 |
ahmad-sa3d/saad-image | src/Traits/CopyrightTrait.php | CopyrightTrait.CheckTextSize | private function CheckTextSize( $for = 'both' )
{
// Check For What ?
if( $for == 'width' || $for == 'both' )
{
// By Default Start With Width
$key = 'width';
$index = 0;
}
else if( $for == 'height' )
{
// Check For Height
$key = 'height';
$index = 1;
}
else
// Not Valid Check ... | php | private function CheckTextSize( $for = 'both' )
{
// Check For What ?
if( $for == 'width' || $for == 'both' )
{
// By Default Start With Width
$key = 'width';
$index = 0;
}
else if( $for == 'height' )
{
// Check For Height
$key = 'height';
$index = 1;
}
else
// Not Valid Check ... | [
"private",
"function",
"CheckTextSize",
"(",
"$",
"for",
"=",
"'both'",
")",
"{",
"// Check For What ? ",
"if",
"(",
"$",
"for",
"==",
"'width'",
"||",
"$",
"for",
"==",
"'both'",
")",
"{",
"// By Default Start With Width",
"$",
"key",
"=",
"'width'",
";",
... | -----------------------------------------
CheckTextSize
-----------------------------------------
Fix text overflow if text box size is greater than image
@param String $for text represents check for 'width' Or 'height' Or 'both' | [
"-----------------------------------------",
"CheckTextSize",
"-----------------------------------------"
] | train | https://github.com/ahmad-sa3d/saad-image/blob/2485e585e0c2ae2b8f0afeb3d513f2df3e369939/src/Traits/CopyrightTrait.php#L347-L394 |
jordij/sweet-captcha | src/Jordij/SweetCaptcha/SweetCaptchaServiceProvider.php | SweetCaptchaServiceProvider.boot | public function boot()
{
$this->package('jordij/sweet-captcha');
include __DIR__.'/../../routes.php';
app()->singleton('SweetCaptcha', function()
{
return new SweetCaptcha();
});
app('validator')->resolver(function($translator, $data, $rules, $messages) {
$messages['sweetcaptcha'] = Lang::get... | php | public function boot()
{
$this->package('jordij/sweet-captcha');
include __DIR__.'/../../routes.php';
app()->singleton('SweetCaptcha', function()
{
return new SweetCaptcha();
});
app('validator')->resolver(function($translator, $data, $rules, $messages) {
$messages['sweetcaptcha'] = Lang::get... | [
"public",
"function",
"boot",
"(",
")",
"{",
"$",
"this",
"->",
"package",
"(",
"'jordij/sweet-captcha'",
")",
";",
"include",
"__DIR__",
".",
"'/../../routes.php'",
";",
"app",
"(",
")",
"->",
"singleton",
"(",
"'SweetCaptcha'",
",",
"function",
"(",
")",
... | Bootstrap the application events.
@return void | [
"Bootstrap",
"the",
"application",
"events",
"."
] | train | https://github.com/jordij/sweet-captcha/blob/7c98724bcf84a8727c99dc577e893225ee8c0eed/src/Jordij/SweetCaptcha/SweetCaptchaServiceProvider.php#L20-L40 |
crysalead/net | src/Headers.php | Headers.push | public function push($headers, $value = '')
{
if (is_string($headers) && func_num_args() === 2) {
$headers = [$headers => $value];
}
return $this->_set($headers);
} | php | public function push($headers, $value = '')
{
if (is_string($headers) && func_num_args() === 2) {
$headers = [$headers => $value];
}
return $this->_set($headers);
} | [
"public",
"function",
"push",
"(",
"$",
"headers",
",",
"$",
"value",
"=",
"''",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"headers",
")",
"&&",
"func_num_args",
"(",
")",
"===",
"2",
")",
"{",
"$",
"headers",
"=",
"[",
"$",
"headers",
"=>",
"$... | Sets some headers.
@param string|array $headers A header name, string content or an array of headers.
@param string|array $value The header value. I set, `$headers` must be an header string name.
@return self | [
"Sets",
"some",
"headers",
"."
] | train | https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Headers.php#L87-L93 |
crysalead/net | src/Headers.php | Headers.prepend | public function prepend($headers, $value = '')
{
if (is_string($headers) && func_num_args() === 2) {
$headers = [$headers => $value];
}
return $this->_set($headers, true);
} | php | public function prepend($headers, $value = '')
{
if (is_string($headers) && func_num_args() === 2) {
$headers = [$headers => $value];
}
return $this->_set($headers, true);
} | [
"public",
"function",
"prepend",
"(",
"$",
"headers",
",",
"$",
"value",
"=",
"''",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"headers",
")",
"&&",
"func_num_args",
"(",
")",
"===",
"2",
")",
"{",
"$",
"headers",
"=",
"[",
"$",
"headers",
"=>",
... | Prepends some headers.
@param string|array $headers A header name, string content or an array of headers.
@param string|array $value The header value. I set, `$headers` must be an header string name.
@return self | [
"Prepends",
"some",
"headers",
"."
] | train | https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Headers.php#L102-L108 |
crysalead/net | src/Headers.php | Headers.offsetExists | public function offsetExists($name)
{
$name = strtolower($name);
if (!array_key_exists($name, $this->_data)) {
return false;
}
return !empty($this->_data[$name]->value());
} | php | public function offsetExists($name)
{
$name = strtolower($name);
if (!array_key_exists($name, $this->_data)) {
return false;
}
return !empty($this->_data[$name]->value());
} | [
"public",
"function",
"offsetExists",
"(",
"$",
"name",
")",
"{",
"$",
"name",
"=",
"strtolower",
"(",
"$",
"name",
")",
";",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"_data",
")",
")",
"{",
"return",
"false",
"... | Checks whether or not an header exists.
@param string $name The header name.
@return boolean Returns `true` if the header exists, `false` otherwise. | [
"Checks",
"whether",
"or",
"not",
"an",
"header",
"exists",
"."
] | train | https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Headers.php#L128-L135 |
crysalead/net | src/Headers.php | Headers.offsetGet | public function offsetGet($name)
{
if (!isset($this->_data[strtolower($name)])) {
$header = $this->_classes['header'];
return $this->_data[strtolower($name)] = new $header($name, '');
}
return $this->_data[strtolower($name)];
} | php | public function offsetGet($name)
{
if (!isset($this->_data[strtolower($name)])) {
$header = $this->_classes['header'];
return $this->_data[strtolower($name)] = new $header($name, '');
}
return $this->_data[strtolower($name)];
} | [
"public",
"function",
"offsetGet",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"_data",
"[",
"strtolower",
"(",
"$",
"name",
")",
"]",
")",
")",
"{",
"$",
"header",
"=",
"$",
"this",
"->",
"_classes",
"[",
"'heade... | Returns the value of a specific header.
@param string $name The header name.
@return string The header value. | [
"Returns",
"the",
"value",
"of",
"a",
"specific",
"header",
"."
] | train | https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Headers.php#L143-L150 |
crysalead/net | src/Headers.php | Headers._set | protected function _set($values, $prepend = false)
{
$header = $this->_classes['header'];
$headers = is_string($values) ? explode("\n", $values) : $values;
$headers = $headers ? $headers : [];
foreach ($headers as $key => $value) {
if (!is_numeric($key)) {
... | php | protected function _set($values, $prepend = false)
{
$header = $this->_classes['header'];
$headers = is_string($values) ? explode("\n", $values) : $values;
$headers = $headers ? $headers : [];
foreach ($headers as $key => $value) {
if (!is_numeric($key)) {
... | [
"protected",
"function",
"_set",
"(",
"$",
"values",
",",
"$",
"prepend",
"=",
"false",
")",
"{",
"$",
"header",
"=",
"$",
"this",
"->",
"_classes",
"[",
"'header'",
"]",
";",
"$",
"headers",
"=",
"is_string",
"(",
"$",
"values",
")",
"?",
"explode",... | Sets one or some plain string headers.
@param string|array $headers A header string or an array of headers.
@param boolean $prepend If true, prepend headers to the beginning.
@return self | [
"Sets",
"one",
"or",
"some",
"plain",
"string",
"headers",
"."
] | train | https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Headers.php#L181-L229 |
crysalead/net | src/Headers.php | Headers.valid | public function valid()
{
if (key($this->_data) === null) {
return false;
}
$current = current($this->_data);
while (!$current->value()) {
$current = $this->next();
if (key($this->_data) === null) {
return false;
}
... | php | public function valid()
{
if (key($this->_data) === null) {
return false;
}
$current = current($this->_data);
while (!$current->value()) {
$current = $this->next();
if (key($this->_data) === null) {
return false;
}
... | [
"public",
"function",
"valid",
"(",
")",
"{",
"if",
"(",
"key",
"(",
"$",
"this",
"->",
"_data",
")",
"===",
"null",
")",
"{",
"return",
"false",
";",
"}",
"$",
"current",
"=",
"current",
"(",
"$",
"this",
"->",
"_data",
")",
";",
"while",
"(",
... | Returns the current item.
@return mixed The current item or `false` on failure. | [
"Returns",
"the",
"current",
"item",
"."
] | train | https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Headers.php#L236-L250 |
crysalead/net | src/Headers.php | Headers.toArray | public static function toArray($headers, $options = [])
{
$data = [];
foreach ($headers as $name => $header) {
if (strtolower($name) === 'set-cookie') {
foreach ($header->data() as $value) {
$data[] = $name . ': ' . $value;
}
... | php | public static function toArray($headers, $options = [])
{
$data = [];
foreach ($headers as $name => $header) {
if (strtolower($name) === 'set-cookie') {
foreach ($header->data() as $value) {
$data[] = $name . ': ' . $value;
}
... | [
"public",
"static",
"function",
"toArray",
"(",
"$",
"headers",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"data",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"headers",
"as",
"$",
"name",
"=>",
"$",
"header",
")",
"{",
"if",
"(",
"strtolowe... | Gets the headers as an array.
@return array Returns the headers. | [
"Gets",
"the",
"headers",
"as",
"an",
"array",
"."
] | train | https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Headers.php#L257-L270 |
crysalead/net | src/Headers.php | Headers.toHeader | public static function toHeader($headers, $options = [])
{
$data = [];
foreach ($headers as $key => $header) {
$data[] = $header->to('header', $options);
}
return $data ? join(self::EOL, $data) : '';
} | php | public static function toHeader($headers, $options = [])
{
$data = [];
foreach ($headers as $key => $header) {
$data[] = $header->to('header', $options);
}
return $data ? join(self::EOL, $data) : '';
} | [
"public",
"static",
"function",
"toHeader",
"(",
"$",
"headers",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"data",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"headers",
"as",
"$",
"key",
"=>",
"$",
"header",
")",
"{",
"$",
"data",
"[",
"... | Returns the headers as a string.
@return string | [
"Returns",
"the",
"headers",
"as",
"a",
"string",
"."
] | train | https://github.com/crysalead/net/blob/4d75abead39e954529b56cbffa3841a9cd3044bb/src/Headers.php#L277-L284 |
iP1SMS/ip1-php-sdk | src/SMS/LoggedOutGoingSMS.php | LoggedOutGoingSMS.jsonSerialize | public function jsonSerialize(): array
{
$returnObject = parent::jsonSerialize();
$returnObject['UpdatedDate'] = $this->updated;
$returnObject['CreatedDate'] = $this->created;
return $returnObject;
} | php | public function jsonSerialize(): array
{
$returnObject = parent::jsonSerialize();
$returnObject['UpdatedDate'] = $this->updated;
$returnObject['CreatedDate'] = $this->created;
return $returnObject;
} | [
"public",
"function",
"jsonSerialize",
"(",
")",
":",
"array",
"{",
"$",
"returnObject",
"=",
"parent",
"::",
"jsonSerialize",
"(",
")",
";",
"$",
"returnObject",
"[",
"'UpdatedDate'",
"]",
"=",
"$",
"this",
"->",
"updated",
";",
"$",
"returnObject",
"[",
... | Serializes the object to a value that can be serialized natively by json_encode().
@return array Associative .
@link http://php.net/manual/en/jsonserializable.jsonserialize.php | [
"Serializes",
"the",
"object",
"to",
"a",
"value",
"that",
"can",
"be",
"serialized",
"natively",
"by",
"json_encode",
"()",
"."
] | train | https://github.com/iP1SMS/ip1-php-sdk/blob/348e6572a279363ba689c9e0f5689b83a25930f5/src/SMS/LoggedOutGoingSMS.php#L77-L83 |
eddiriarte/console-select | src/Handlers/SelectHandler.php | SelectHandler.handle | public function handle(): array
{
$this->firstRun = true;
$this->output->writeln(
'<info>' . $this->question->getMessage() . '</info> [<comment>SPACE=select</>, <comment>ENTER=submit</>]'
);
$this->repaint();
$sttyMode = shell_exec('stty -g');
// Disable... | php | public function handle(): array
{
$this->firstRun = true;
$this->output->writeln(
'<info>' . $this->question->getMessage() . '</info> [<comment>SPACE=select</>, <comment>ENTER=submit</>]'
);
$this->repaint();
$sttyMode = shell_exec('stty -g');
// Disable... | [
"public",
"function",
"handle",
"(",
")",
":",
"array",
"{",
"$",
"this",
"->",
"firstRun",
"=",
"true",
";",
"$",
"this",
"->",
"output",
"->",
"writeln",
"(",
"'<info>'",
".",
"$",
"this",
"->",
"question",
"->",
"getMessage",
"(",
")",
".",
"'</in... | Navigates through option items.
@return array | [
"Navigates",
"through",
"option",
"items",
"."
] | train | https://github.com/eddiriarte/console-select/blob/76a6818c128571dfed8f0546a6ac5dd15e64f1ad/src/Handlers/SelectHandler.php#L70-L106 |
guillaumemonet/Rad | src/Rad/Utils/Time.php | Time.get_microtime | public static function get_microtime() {
list($tps_usec, $tps_sec) = explode(' ', microtime());
return (float) $tps_usec + (float) $tps_sec;
} | php | public static function get_microtime() {
list($tps_usec, $tps_sec) = explode(' ', microtime());
return (float) $tps_usec + (float) $tps_sec;
} | [
"public",
"static",
"function",
"get_microtime",
"(",
")",
"{",
"list",
"(",
"$",
"tps_usec",
",",
"$",
"tps_sec",
")",
"=",
"explode",
"(",
"' '",
",",
"microtime",
"(",
")",
")",
";",
"return",
"(",
"float",
")",
"$",
"tps_usec",
"+",
"(",
"float",... | Return current microtime.
@return int | [
"Return",
"current",
"microtime",
"."
] | train | https://github.com/guillaumemonet/Rad/blob/cb9932f570cf3c2a7197f81e1d959c2729989e59/src/Rad/Utils/Time.php#L53-L56 |
guillaumemonet/Rad | src/Rad/Utils/Time.php | Time.isFrenchHoliday | public static function isFrenchHoliday($unixTimeStamp = null) {
$date = strtotime(date('m/d/Y', $unixTimeStamp == null ? time() : $unixTimeStamp));
$year = date('Y', $date);
$holidays = Cache::getHandler('quick')->get('holiday' . $year);
if ($holidays == null) {
$easterDate =... | php | public static function isFrenchHoliday($unixTimeStamp = null) {
$date = strtotime(date('m/d/Y', $unixTimeStamp == null ? time() : $unixTimeStamp));
$year = date('Y', $date);
$holidays = Cache::getHandler('quick')->get('holiday' . $year);
if ($holidays == null) {
$easterDate =... | [
"public",
"static",
"function",
"isFrenchHoliday",
"(",
"$",
"unixTimeStamp",
"=",
"null",
")",
"{",
"$",
"date",
"=",
"strtotime",
"(",
"date",
"(",
"'m/d/Y'",
",",
"$",
"unixTimeStamp",
"==",
"null",
"?",
"time",
"(",
")",
":",
"$",
"unixTimeStamp",
")... | Return french holiday
@param int $unixTimeStamp
@return bool | [
"Return",
"french",
"holiday"
] | train | https://github.com/guillaumemonet/Rad/blob/cb9932f570cf3c2a7197f81e1d959c2729989e59/src/Rad/Utils/Time.php#L79-L109 |
transfer-framework/transfer | src/Transfer/Storage/ChainStorage.php | ChainStorage.add | public function add($object, $id = null)
{
/** @var StorageInterface $storage */
foreach ($this->storageCollection as $storage) {
if ($storage->add($object, $id)) {
return true;
}
}
return false;
} | php | public function add($object, $id = null)
{
/** @var StorageInterface $storage */
foreach ($this->storageCollection as $storage) {
if ($storage->add($object, $id)) {
return true;
}
}
return false;
} | [
"public",
"function",
"add",
"(",
"$",
"object",
",",
"$",
"id",
"=",
"null",
")",
"{",
"/** @var StorageInterface $storage */",
"foreach",
"(",
"$",
"this",
"->",
"storageCollection",
"as",
"$",
"storage",
")",
"{",
"if",
"(",
"$",
"storage",
"->",
"add",... | {@inheritdoc} | [
"{"
] | train | https://github.com/transfer-framework/transfer/blob/9225ae068d5924982f14ad4446b15f75384a058a/src/Transfer/Storage/ChainStorage.php#L42-L52 |
transfer-framework/transfer | src/Transfer/Storage/ChainStorage.php | ChainStorage.contains | public function contains($object)
{
/** @var StorageInterface $storage */
foreach ($this->storageCollection as $storage) {
if ($storage->contains($object)) {
return true;
}
}
return false;
} | php | public function contains($object)
{
/** @var StorageInterface $storage */
foreach ($this->storageCollection as $storage) {
if ($storage->contains($object)) {
return true;
}
}
return false;
} | [
"public",
"function",
"contains",
"(",
"$",
"object",
")",
"{",
"/** @var StorageInterface $storage */",
"foreach",
"(",
"$",
"this",
"->",
"storageCollection",
"as",
"$",
"storage",
")",
"{",
"if",
"(",
"$",
"storage",
"->",
"contains",
"(",
"$",
"object",
... | {@inheritdoc} | [
"{"
] | train | https://github.com/transfer-framework/transfer/blob/9225ae068d5924982f14ad4446b15f75384a058a/src/Transfer/Storage/ChainStorage.php#L57-L67 |
transfer-framework/transfer | src/Transfer/Storage/ChainStorage.php | ChainStorage.containsId | public function containsId($id)
{
/** @var StorageInterface $storage */
foreach ($this->storageCollection as $storage) {
if ($storage->containsId($id)) {
return true;
}
}
return false;
} | php | public function containsId($id)
{
/** @var StorageInterface $storage */
foreach ($this->storageCollection as $storage) {
if ($storage->containsId($id)) {
return true;
}
}
return false;
} | [
"public",
"function",
"containsId",
"(",
"$",
"id",
")",
"{",
"/** @var StorageInterface $storage */",
"foreach",
"(",
"$",
"this",
"->",
"storageCollection",
"as",
"$",
"storage",
")",
"{",
"if",
"(",
"$",
"storage",
"->",
"containsId",
"(",
"$",
"id",
")",... | {@inheritdoc} | [
"{"
] | train | https://github.com/transfer-framework/transfer/blob/9225ae068d5924982f14ad4446b15f75384a058a/src/Transfer/Storage/ChainStorage.php#L72-L82 |
transfer-framework/transfer | src/Transfer/Storage/ChainStorage.php | ChainStorage.findById | public function findById($id)
{
/** @var StorageInterface $storage */
foreach ($this->storageCollection as $storage) {
try {
return $storage->findById($id);
} catch (ObjectNotFoundException $e) {
// Go to next storage instance
}
... | php | public function findById($id)
{
/** @var StorageInterface $storage */
foreach ($this->storageCollection as $storage) {
try {
return $storage->findById($id);
} catch (ObjectNotFoundException $e) {
// Go to next storage instance
}
... | [
"public",
"function",
"findById",
"(",
"$",
"id",
")",
"{",
"/** @var StorageInterface $storage */",
"foreach",
"(",
"$",
"this",
"->",
"storageCollection",
"as",
"$",
"storage",
")",
"{",
"try",
"{",
"return",
"$",
"storage",
"->",
"findById",
"(",
"$",
"id... | {@inheritdoc} | [
"{"
] | train | https://github.com/transfer-framework/transfer/blob/9225ae068d5924982f14ad4446b15f75384a058a/src/Transfer/Storage/ChainStorage.php#L87-L99 |
transfer-framework/transfer | src/Transfer/Storage/ChainStorage.php | ChainStorage.remove | public function remove($object)
{
/** @var StorageInterface $storage */
foreach ($this->storageCollection as $storage) {
if ($storage->remove($object)) {
return true;
}
}
return false;
} | php | public function remove($object)
{
/** @var StorageInterface $storage */
foreach ($this->storageCollection as $storage) {
if ($storage->remove($object)) {
return true;
}
}
return false;
} | [
"public",
"function",
"remove",
"(",
"$",
"object",
")",
"{",
"/** @var StorageInterface $storage */",
"foreach",
"(",
"$",
"this",
"->",
"storageCollection",
"as",
"$",
"storage",
")",
"{",
"if",
"(",
"$",
"storage",
"->",
"remove",
"(",
"$",
"object",
")",... | {@inheritdoc} | [
"{"
] | train | https://github.com/transfer-framework/transfer/blob/9225ae068d5924982f14ad4446b15f75384a058a/src/Transfer/Storage/ChainStorage.php#L104-L114 |
transfer-framework/transfer | src/Transfer/Storage/ChainStorage.php | ChainStorage.removeById | public function removeById($id)
{
/** @var StorageInterface $storage */
foreach ($this->storageCollection as $storage) {
if ($storage->removeById($id)) {
return true;
}
}
return false;
} | php | public function removeById($id)
{
/** @var StorageInterface $storage */
foreach ($this->storageCollection as $storage) {
if ($storage->removeById($id)) {
return true;
}
}
return false;
} | [
"public",
"function",
"removeById",
"(",
"$",
"id",
")",
"{",
"/** @var StorageInterface $storage */",
"foreach",
"(",
"$",
"this",
"->",
"storageCollection",
"as",
"$",
"storage",
")",
"{",
"if",
"(",
"$",
"storage",
"->",
"removeById",
"(",
"$",
"id",
")",... | {@inheritdoc} | [
"{"
] | train | https://github.com/transfer-framework/transfer/blob/9225ae068d5924982f14ad4446b15f75384a058a/src/Transfer/Storage/ChainStorage.php#L119-L129 |
transfer-framework/transfer | src/Transfer/Storage/ChainStorage.php | ChainStorage.all | public function all()
{
$iterator = new \AppendIterator();
/** @var StorageInterface $storage */
foreach ($this->storageCollection as $storage) {
if (is_array($storage->all())) {
$iterator->append(new \ArrayIterator($storage->all()));
} elseif ($stora... | php | public function all()
{
$iterator = new \AppendIterator();
/** @var StorageInterface $storage */
foreach ($this->storageCollection as $storage) {
if (is_array($storage->all())) {
$iterator->append(new \ArrayIterator($storage->all()));
} elseif ($stora... | [
"public",
"function",
"all",
"(",
")",
"{",
"$",
"iterator",
"=",
"new",
"\\",
"AppendIterator",
"(",
")",
";",
"/** @var StorageInterface $storage */",
"foreach",
"(",
"$",
"this",
"->",
"storageCollection",
"as",
"$",
"storage",
")",
"{",
"if",
"(",
"is_ar... | {@inheritdoc} | [
"{"
] | train | https://github.com/transfer-framework/transfer/blob/9225ae068d5924982f14ad4446b15f75384a058a/src/Transfer/Storage/ChainStorage.php#L134-L150 |
nyeholt/silverstripe-simplewiki | thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/ErrorCollector.php | HTMLPurifier_ErrorCollector.send | public function send($severity, $msg) {
$args = array();
if (func_num_args() > 2) {
$args = func_get_args();
array_shift($args);
unset($args[0]);
}
$token = $this->context->get('CurrentToken', true);
$line = $token ? $token->line : $this->co... | php | public function send($severity, $msg) {
$args = array();
if (func_num_args() > 2) {
$args = func_get_args();
array_shift($args);
unset($args[0]);
}
$token = $this->context->get('CurrentToken', true);
$line = $token ? $token->line : $this->co... | [
"public",
"function",
"send",
"(",
"$",
"severity",
",",
"$",
"msg",
")",
"{",
"$",
"args",
"=",
"array",
"(",
")",
";",
"if",
"(",
"func_num_args",
"(",
")",
">",
"2",
")",
"{",
"$",
"args",
"=",
"func_get_args",
"(",
")",
";",
"array_shift",
"(... | Sends an error message to the collector for later use
@param $severity int Error severity, PHP error style (don't use E_USER_)
@param $msg string Error message text
@param $subst1 string First substitution for $msg
@param $subst2 string ... | [
"Sends",
"an",
"error",
"message",
"to",
"the",
"collector",
"for",
"later",
"use"
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/ErrorCollector.php#L42-L127 |
nyeholt/silverstripe-simplewiki | thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/ErrorCollector.php | HTMLPurifier_ErrorCollector.getHTMLFormatted | public function getHTMLFormatted($config, $errors = null) {
$ret = array();
$this->generator = new HTMLPurifier_Generator($config, $this->context);
if ($errors === null) $errors = $this->errors;
// 'At line' message needs to be removed
// generation code for new structure goes... | php | public function getHTMLFormatted($config, $errors = null) {
$ret = array();
$this->generator = new HTMLPurifier_Generator($config, $this->context);
if ($errors === null) $errors = $this->errors;
// 'At line' message needs to be removed
// generation code for new structure goes... | [
"public",
"function",
"getHTMLFormatted",
"(",
"$",
"config",
",",
"$",
"errors",
"=",
"null",
")",
"{",
"$",
"ret",
"=",
"array",
"(",
")",
";",
"$",
"this",
"->",
"generator",
"=",
"new",
"HTMLPurifier_Generator",
"(",
"$",
"config",
",",
"$",
"this"... | Default HTML formatting implementation for error messages
@param $config Configuration array, vital for HTML output nature
@param $errors Errors array to display; used for recursion. | [
"Default",
"HTML",
"formatting",
"implementation",
"for",
"error",
"messages"
] | train | https://github.com/nyeholt/silverstripe-simplewiki/blob/ecffed0d75be1454901e1cb24633472b8f67c967/thirdparty/htmlpurifier-4.0.0-lite/library/HTMLPurifier/ErrorCollector.php#L144-L169 |
reinvanoyen/aegis | lib/Aegis/Cache/Filesystem.php | Filesystem.load | public static function load($id, $subId = null) : CacheEntryInterface
{
$storageId = $id;
if ($subId) {
$storageId .= '[' . $subId . ']';
}
if (!isset(self::$files[$storageId])) {
$filename = static::CACHE_DIR . ($subId ? $subId . '/' : null) . urlencode($id... | php | public static function load($id, $subId = null) : CacheEntryInterface
{
$storageId = $id;
if ($subId) {
$storageId .= '[' . $subId . ']';
}
if (!isset(self::$files[$storageId])) {
$filename = static::CACHE_DIR . ($subId ? $subId . '/' : null) . urlencode($id... | [
"public",
"static",
"function",
"load",
"(",
"$",
"id",
",",
"$",
"subId",
"=",
"null",
")",
":",
"CacheEntryInterface",
"{",
"$",
"storageId",
"=",
"$",
"id",
";",
"if",
"(",
"$",
"subId",
")",
"{",
"$",
"storageId",
".=",
"'['",
".",
"$",
"subId"... | Gets the cache file from the filesystem
@param $id
@param null $subId
@return CacheEntryInterface | [
"Gets",
"the",
"cache",
"file",
"from",
"the",
"filesystem"
] | train | https://github.com/reinvanoyen/aegis/blob/ecd831fd6f3ceb4fb20fb5af83483d73cad8e323/lib/Aegis/Cache/Filesystem.php#L27-L41 |
thienhungho/yii2-employee-management | src/modules/EmployeeManage/controllers/EmployeeController.php | EmployeeController.actionUpdate | public function actionUpdate($id)
{
if (Yii::$app->request->post('_asnew') == '1') {
$model = new Employee();
} else {
$model = $this->findModel($id);
}
if ($model->loadAll(request()->post())) {
if ($model->saveAll()) {
set... | php | public function actionUpdate($id)
{
if (Yii::$app->request->post('_asnew') == '1') {
$model = new Employee();
} else {
$model = $this->findModel($id);
}
if ($model->loadAll(request()->post())) {
if ($model->saveAll()) {
set... | [
"public",
"function",
"actionUpdate",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"Yii",
"::",
"$",
"app",
"->",
"request",
"->",
"post",
"(",
"'_asnew'",
")",
"==",
"'1'",
")",
"{",
"$",
"model",
"=",
"new",
"Employee",
"(",
")",
";",
"}",
"else",
"{",... | @param $id
@return string|\yii\web\Response
@throws NotFoundHttpException
@throws \yii\db\Exception | [
"@param",
"$id"
] | train | https://github.com/thienhungho/yii2-employee-management/blob/f7f8b917eed1af7908fa539ef23dad8a226210cc/src/modules/EmployeeManage/controllers/EmployeeController.php#L100-L123 |
thienhungho/yii2-employee-management | src/modules/EmployeeManage/controllers/EmployeeController.php | EmployeeController.actionPdf | public function actionPdf($id)
{
$model = $this->findModel($id);
$content = $this->renderAjax('_pdf', [
'model' => $model,
]);
$pdf = new \kartik\mpdf\Pdf([
'mode' => \kartik\mpdf\Pdf::MODE_UTF8,
'format' => \kartik\mpdf\Pdf::FO... | php | public function actionPdf($id)
{
$model = $this->findModel($id);
$content = $this->renderAjax('_pdf', [
'model' => $model,
]);
$pdf = new \kartik\mpdf\Pdf([
'mode' => \kartik\mpdf\Pdf::MODE_UTF8,
'format' => \kartik\mpdf\Pdf::FO... | [
"public",
"function",
"actionPdf",
"(",
"$",
"id",
")",
"{",
"$",
"model",
"=",
"$",
"this",
"->",
"findModel",
"(",
"$",
"id",
")",
";",
"$",
"content",
"=",
"$",
"this",
"->",
"renderAjax",
"(",
"'_pdf'",
",",
"[",
"'model'",
"=>",
"$",
"model",
... | @param $id
@return mixed
@throws NotFoundHttpException | [
"@param",
"$id"
] | train | https://github.com/thienhungho/yii2-employee-management/blob/f7f8b917eed1af7908fa539ef23dad8a226210cc/src/modules/EmployeeManage/controllers/EmployeeController.php#L150-L172 |
flagrow/flarum-ext-latex | src/Listeners/FindLatexExpressions.php | FindLatexExpressions.findExpressions | public function findExpressions(PostWillBeSaved $event)
{
// get the text from the post, comment or answer
$text = $event->post->content;
// this is the regular expresssion used. To check what it does use regex101.com
$regex = '/(?<!\\\\)(?: ((?<!\\$)(?<!\\`)(?<!\\`\\n)\\${1,2}(?!\\n... | php | public function findExpressions(PostWillBeSaved $event)
{
// get the text from the post, comment or answer
$text = $event->post->content;
// this is the regular expresssion used. To check what it does use regex101.com
$regex = '/(?<!\\\\)(?: ((?<!\\$)(?<!\\`)(?<!\\`\\n)\\${1,2}(?!\\n... | [
"public",
"function",
"findExpressions",
"(",
"PostWillBeSaved",
"$",
"event",
")",
"{",
"// get the text from the post, comment or answer",
"$",
"text",
"=",
"$",
"event",
"->",
"post",
"->",
"content",
";",
"// this is the regular expresssion used. To check what it does use... | This function searches for LaTeX expressions, delimited by $ and $$.
It then adds backticks (``) around the expression, so that is does not
get modifed by Markdown or BBcode.
@param PostWillBeSaved $event | [
"This",
"function",
"searches",
"for",
"LaTeX",
"expressions",
"delimited",
"by",
"$",
"and",
"$$",
".",
"It",
"then",
"adds",
"backticks",
"(",
")",
"around",
"the",
"expression",
"so",
"that",
"is",
"does",
"not",
"get",
"modifed",
"by",
"Markdown",
"or"... | train | https://github.com/flagrow/flarum-ext-latex/blob/4db38817d26cb5e3a7e8a0b53f042c61d14af606/src/Listeners/FindLatexExpressions.php#L37-L45 |
cpliakas/search-framework | src/Search/Framework/Schema.php | Schema.build | public function build(array $options)
{
if (isset($options['fields'])) {
if (!is_array($options['fields'])) {
$message = 'Argument 1 passed to ' . __METHOD__ . ' must be an array.';
throw new \InvalidArgumentException($message);
}
foreach (... | php | public function build(array $options)
{
if (isset($options['fields'])) {
if (!is_array($options['fields'])) {
$message = 'Argument 1 passed to ' . __METHOD__ . ' must be an array.';
throw new \InvalidArgumentException($message);
}
foreach (... | [
"public",
"function",
"build",
"(",
"array",
"$",
"options",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"options",
"[",
"'fields'",
"]",
")",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"options",
"[",
"'fields'",
"]",
")",
")",
"{",
"$",
"messa... | Builds the schema from an array of options.
@param array $options
The raw options parsed form the configuration file related to the
schema.
@throws \InvalidArgumentException | [
"Builds",
"the",
"schema",
"from",
"an",
"array",
"of",
"options",
"."
] | train | https://github.com/cpliakas/search-framework/blob/7c5832d38ed998e04837c26e0daef59115563b98/src/Search/Framework/Schema.php#L65-L80 |
cpliakas/search-framework | src/Search/Framework/Schema.php | Schema.attachField | public function attachField(SchemaField $field)
{
$id = $field->getId();
$name = $field->getName();
$this->_fields[$id] = $field;
$this->_fieldNameMap[$name] = $id;
return $this;
} | php | public function attachField(SchemaField $field)
{
$id = $field->getId();
$name = $field->getName();
$this->_fields[$id] = $field;
$this->_fieldNameMap[$name] = $id;
return $this;
} | [
"public",
"function",
"attachField",
"(",
"SchemaField",
"$",
"field",
")",
"{",
"$",
"id",
"=",
"$",
"field",
"->",
"getId",
"(",
")",
";",
"$",
"name",
"=",
"$",
"field",
"->",
"getName",
"(",
")",
";",
"$",
"this",
"->",
"_fields",
"[",
"$",
"... | Associates a field with this schema.
@param SchemaField $field
The field being associated with the schema.
@return Schema | [
"Associates",
"a",
"field",
"with",
"this",
"schema",
"."
] | train | https://github.com/cpliakas/search-framework/blob/7c5832d38ed998e04837c26e0daef59115563b98/src/Search/Framework/Schema.php#L90-L97 |
cpliakas/search-framework | src/Search/Framework/Schema.php | Schema.getField | public function getField($id)
{
if (!isset($this->_fields[$id])) {
$message = 'Field "' . $id . '" not associated with this schema.';
throw new \InvalidArgumentException($message);
}
return $this->_fields[$id];
} | php | public function getField($id)
{
if (!isset($this->_fields[$id])) {
$message = 'Field "' . $id . '" not associated with this schema.';
throw new \InvalidArgumentException($message);
}
return $this->_fields[$id];
} | [
"public",
"function",
"getField",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"_fields",
"[",
"$",
"id",
"]",
")",
")",
"{",
"$",
"message",
"=",
"'Field \"'",
".",
"$",
"id",
".",
"'\" not associated with this schema.'",... | Returns a field by its unique identifier.
@param string $id
The unique identifier of the field.
@return SchemaField
@throw \InvalidArgumentException() | [
"Returns",
"a",
"field",
"by",
"its",
"unique",
"identifier",
"."
] | train | https://github.com/cpliakas/search-framework/blob/7c5832d38ed998e04837c26e0daef59115563b98/src/Search/Framework/Schema.php#L109-L116 |
cpliakas/search-framework | src/Search/Framework/Schema.php | Schema.getFieldByName | public function getFieldByName($name)
{
if (!isset($this->_fieldNameMap[$name])) {
$message = 'Field name "' . $name . '" not associated to this schema.';
throw new \InvalidArgumentException($message);
}
return $this->getField($this->_fieldNameMap[$name]);
} | php | public function getFieldByName($name)
{
if (!isset($this->_fieldNameMap[$name])) {
$message = 'Field name "' . $name . '" not associated to this schema.';
throw new \InvalidArgumentException($message);
}
return $this->getField($this->_fieldNameMap[$name]);
} | [
"public",
"function",
"getFieldByName",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"_fieldNameMap",
"[",
"$",
"name",
"]",
")",
")",
"{",
"$",
"message",
"=",
"'Field name \"'",
".",
"$",
"name",
".",
"'\" not associat... | Returns a field by its name as stored in the index.
@param string $name
The name of the field as stored in the index.
@return SchemaField
@throws \InvalidArgumentException() | [
"Returns",
"a",
"field",
"by",
"its",
"name",
"as",
"stored",
"in",
"the",
"index",
"."
] | train | https://github.com/cpliakas/search-framework/blob/7c5832d38ed998e04837c26e0daef59115563b98/src/Search/Framework/Schema.php#L138-L145 |
cpliakas/search-framework | src/Search/Framework/Schema.php | Schema.removeField | public function removeField($id)
{
if (isset($this->_fields[$id])) {
$name = $this->_fields[$id]->getName();
unset($this->_fields[$id], $this->_fieldNameMap[$name]);
}
return $this;
} | php | public function removeField($id)
{
if (isset($this->_fields[$id])) {
$name = $this->_fields[$id]->getName();
unset($this->_fields[$id], $this->_fieldNameMap[$name]);
}
return $this;
} | [
"public",
"function",
"removeField",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_fields",
"[",
"$",
"id",
"]",
")",
")",
"{",
"$",
"name",
"=",
"$",
"this",
"->",
"_fields",
"[",
"$",
"id",
"]",
"->",
"getName",
"(",... | De-references a field from the schema.
@param string $id
The unique identifier of the field.
@return Schema | [
"De",
"-",
"references",
"a",
"field",
"from",
"the",
"schema",
"."
] | train | https://github.com/cpliakas/search-framework/blob/7c5832d38ed998e04837c26e0daef59115563b98/src/Search/Framework/Schema.php#L168-L175 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.