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 |
|---|---|---|---|---|---|---|---|---|---|---|
codeages/beanstalk-client | src/Client.php | Client._statsRead | protected function _statsRead($decode = true)
{
$status = strtok($this->_read(), ' ');
switch ($status) {
case 'OK':
$data = $this->_read((integer) strtok(' '));
return $decode ? $this->_decode($data) : $data;
default:
throw n... | php | protected function _statsRead($decode = true)
{
$status = strtok($this->_read(), ' ');
switch ($status) {
case 'OK':
$data = $this->_read((integer) strtok(' '));
return $decode ? $this->_decode($data) : $data;
default:
throw n... | [
"protected",
"function",
"_statsRead",
"(",
"$",
"decode",
"=",
"true",
")",
"{",
"$",
"status",
"=",
"strtok",
"(",
"$",
"this",
"->",
"_read",
"(",
")",
",",
"' '",
")",
";",
"switch",
"(",
"$",
"status",
")",
"{",
"case",
"'OK'",
":",
"$",
"da... | Handles responses for all stat methods.
@param bool $decode Whether to decode data before returning it or not. Default is `true`.
@return array|string|bool `false` on error otherwise statistical data. | [
"Handles",
"responses",
"for",
"all",
"stat",
"methods",
"."
] | train | https://github.com/codeages/beanstalk-client/blob/097acad3cd9489413863f6cad86791216bc972e1/src/Client.php#L724-L736 |
antaresproject/notifications | src/Http/Datatables/Logs.php | Logs.ajax | public function ajax()
{
return $this->prepare()
->editColumn('lang_code', function ($row = null) {
$code = $row->lang_code;
$codeIcon = (($code == 'en') ? 'us' : $code);
return '<i data-tooltip-i... | php | public function ajax()
{
return $this->prepare()
->editColumn('lang_code', function ($row = null) {
$code = $row->lang_code;
$codeIcon = (($code == 'en') ? 'us' : $code);
return '<i data-tooltip-i... | [
"public",
"function",
"ajax",
"(",
")",
"{",
"return",
"$",
"this",
"->",
"prepare",
"(",
")",
"->",
"editColumn",
"(",
"'lang_code'",
",",
"function",
"(",
"$",
"row",
"=",
"null",
")",
"{",
"$",
"code",
"=",
"$",
"row",
"->",
"lang_code",
";",
"$... | {@inheritdoc} | [
"{"
] | train | https://github.com/antaresproject/notifications/blob/60de743477b7e9cbb51de66da5fd9461adc9dd8a/src/Http/Datatables/Logs.php#L67-L88 |
antaresproject/notifications | src/Http/Datatables/Logs.php | Logs.html | public function html()
{
publish('notifications', ['js/notification-logs.js']);
$html = app('html');
return $this->setName('Notifications List')
->addColumn(['data' => 'tbl_notifications_stack.id', 'name' => 'tbl_notifications_stack.id', 'data' => 'id', 'title' => 'Id... | php | public function html()
{
publish('notifications', ['js/notification-logs.js']);
$html = app('html');
return $this->setName('Notifications List')
->addColumn(['data' => 'tbl_notifications_stack.id', 'name' => 'tbl_notifications_stack.id', 'data' => 'id', 'title' => 'Id... | [
"public",
"function",
"html",
"(",
")",
"{",
"publish",
"(",
"'notifications'",
",",
"[",
"'js/notification-logs.js'",
"]",
")",
";",
"$",
"html",
"=",
"app",
"(",
"'html'",
")",
";",
"return",
"$",
"this",
"->",
"setName",
"(",
"'Notifications List'",
")"... | {@inheritdoc} | [
"{"
] | train | https://github.com/antaresproject/notifications/blob/60de743477b7e9cbb51de66da5fd9461adc9dd8a/src/Http/Datatables/Logs.php#L93-L124 |
antaresproject/notifications | src/Http/Datatables/Logs.php | Logs.getActionsColumn | protected function getActionsColumn()
{
return function ($row) {
$html = app('html');
$btns = [
$html->create('li', $html->link(handles("antares::notifications/logs/preview/" . $row->id), trans('antares/notifications::logs.actions.preview'), ['data-notification'... | php | protected function getActionsColumn()
{
return function ($row) {
$html = app('html');
$btns = [
$html->create('li', $html->link(handles("antares::notifications/logs/preview/" . $row->id), trans('antares/notifications::logs.actions.preview'), ['data-notification'... | [
"protected",
"function",
"getActionsColumn",
"(",
")",
"{",
"return",
"function",
"(",
"$",
"row",
")",
"{",
"$",
"html",
"=",
"app",
"(",
"'html'",
")",
";",
"$",
"btns",
"=",
"[",
"$",
"html",
"->",
"create",
"(",
"'li'",
",",
"$",
"html",
"->",
... | Get actions column for table builder.
@return callable | [
"Get",
"actions",
"column",
"for",
"table",
"builder",
"."
] | train | https://github.com/antaresproject/notifications/blob/60de743477b7e9cbb51de66da5fd9461adc9dd8a/src/Http/Datatables/Logs.php#L141-L153 |
jim-moser/zf2-validators-empty-or | src/EmptyValidator.php | EmptyValidator.setType | public function setType($type = null)
{
$type = $this->calculateTypeValue($type);
if (!is_int($type) || ($type < 0) || ($type > self::ALL)) {
throw new Exception\InvalidArgumentException('Unknown type');
}
$this->options['type'] = $type;
return $this;
} | php | public function setType($type = null)
{
$type = $this->calculateTypeValue($type);
if (!is_int($type) || ($type < 0) || ($type > self::ALL)) {
throw new Exception\InvalidArgumentException('Unknown type');
}
$this->options['type'] = $type;
return $this;
} | [
"public",
"function",
"setType",
"(",
"$",
"type",
"=",
"null",
")",
"{",
"$",
"type",
"=",
"$",
"this",
"->",
"calculateTypeValue",
"(",
"$",
"type",
")",
";",
"if",
"(",
"!",
"is_int",
"(",
"$",
"type",
")",
"||",
"(",
"$",
"type",
"<",
"0",
... | Sets types of values that are to be considered empty.
@param int|array|null $type
@throws Exception\InvalidArgumentException
@return NotEmpty | [
"Sets",
"types",
"of",
"values",
"that",
"are",
"to",
"be",
"considered",
"empty",
"."
] | train | https://github.com/jim-moser/zf2-validators-empty-or/blob/12f799e18ff59986c23ff3f934702834046438f2/src/EmptyValidator.php#L182-L193 |
jim-moser/zf2-validators-empty-or | src/EmptyValidator.php | EmptyValidator.isValid | public function isValid($value)
{
if ($value !== null && !is_string($value) && !is_int($value) &&
!is_float($value) && !is_bool($value) && !is_array($value) &&
!is_object($value)
) {
$this->error(self::INVALID);
return false;
}
... | php | public function isValid($value)
{
if ($value !== null && !is_string($value) && !is_int($value) &&
!is_float($value) && !is_bool($value) && !is_array($value) &&
!is_object($value)
) {
$this->error(self::INVALID);
return false;
}
... | [
"public",
"function",
"isValid",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"value",
"!==",
"null",
"&&",
"!",
"is_string",
"(",
"$",
"value",
")",
"&&",
"!",
"is_int",
"(",
"$",
"value",
")",
"&&",
"!",
"is_float",
"(",
"$",
"value",
")",
"&&"... | Returns true only if $value is empty value.
@param mixed $value
@return bool | [
"Returns",
"true",
"only",
"if",
"$value",
"is",
"empty",
"value",
"."
] | train | https://github.com/jim-moser/zf2-validators-empty-or/blob/12f799e18ff59986c23ff3f934702834046438f2/src/EmptyValidator.php#L201-L305 |
frdl/webfan | .ApplicationComposer/lib/webdof/wDate.php | wDate.month | function month($time = NULL)
{
if( !is_numeric($time) )$time = $this->n;
return date('n', $time);
} | php | function month($time = NULL)
{
if( !is_numeric($time) )$time = $this->n;
return date('n', $time);
} | [
"function",
"month",
"(",
"$",
"time",
"=",
"NULL",
")",
"{",
"if",
"(",
"!",
"is_numeric",
"(",
"$",
"time",
")",
")",
"$",
"time",
"=",
"$",
"this",
"->",
"n",
";",
"return",
"date",
"(",
"'n'",
",",
"$",
"time",
")",
";",
"}"
] | eof jahr | [
"eof",
"jahr"
] | train | https://github.com/frdl/webfan/blob/84d270377685224e891cd9d571b103b36f05b845/.ApplicationComposer/lib/webdof/wDate.php#L51-L55 |
frdl/webfan | .ApplicationComposer/lib/webdof/wDate.php | wDate.month0 | function month0($time = NULL)
{
if( !is_numeric($time) )$time = $this->n;
return date('m', $time);
} | php | function month0($time = NULL)
{
if( !is_numeric($time) )$time = $this->n;
return date('m', $time);
} | [
"function",
"month0",
"(",
"$",
"time",
"=",
"NULL",
")",
"{",
"if",
"(",
"!",
"is_numeric",
"(",
"$",
"time",
")",
")",
"$",
"time",
"=",
"$",
"this",
"->",
"n",
";",
"return",
"date",
"(",
"'m'",
",",
"$",
"time",
")",
";",
"}"
] | eof | [
"eof"
] | train | https://github.com/frdl/webfan/blob/84d270377685224e891cd9d571b103b36f05b845/.ApplicationComposer/lib/webdof/wDate.php#L59-L63 |
frdl/webfan | .ApplicationComposer/lib/webdof/wDate.php | wDate.monthS | function monthS($time = NULL)
{
if( !is_numeric($time) )$time = $this->n;
return date('M', $time);
} | php | function monthS($time = NULL)
{
if( !is_numeric($time) )$time = $this->n;
return date('M', $time);
} | [
"function",
"monthS",
"(",
"$",
"time",
"=",
"NULL",
")",
"{",
"if",
"(",
"!",
"is_numeric",
"(",
"$",
"time",
")",
")",
"$",
"time",
"=",
"$",
"this",
"->",
"n",
";",
"return",
"date",
"(",
"'M'",
",",
"$",
"time",
")",
";",
"}"
] | eof | [
"eof"
] | train | https://github.com/frdl/webfan/blob/84d270377685224e891cd9d571b103b36f05b845/.ApplicationComposer/lib/webdof/wDate.php#L66-L70 |
frdl/webfan | .ApplicationComposer/lib/webdof/wDate.php | wDate.day | function day($time = NULL)
{
if( !is_numeric($time) )$time = $this->n;
return date('j', $time);
} | php | function day($time = NULL)
{
if( !is_numeric($time) )$time = $this->n;
return date('j', $time);
} | [
"function",
"day",
"(",
"$",
"time",
"=",
"NULL",
")",
"{",
"if",
"(",
"!",
"is_numeric",
"(",
"$",
"time",
")",
")",
"$",
"time",
"=",
"$",
"this",
"->",
"n",
";",
"return",
"date",
"(",
"'j'",
",",
"$",
"time",
")",
";",
"}"
] | eof | [
"eof"
] | train | https://github.com/frdl/webfan/blob/84d270377685224e891cd9d571b103b36f05b845/.ApplicationComposer/lib/webdof/wDate.php#L73-L77 |
frdl/webfan | .ApplicationComposer/lib/webdof/wDate.php | wDate.weekday | function weekday($time = NULL)
{
if( !is_numeric($time) )$time = $this->n;
return date('D', $time);
} | php | function weekday($time = NULL)
{
if( !is_numeric($time) )$time = $this->n;
return date('D', $time);
} | [
"function",
"weekday",
"(",
"$",
"time",
"=",
"NULL",
")",
"{",
"if",
"(",
"!",
"is_numeric",
"(",
"$",
"time",
")",
")",
"$",
"time",
"=",
"$",
"this",
"->",
"n",
";",
"return",
"date",
"(",
"'D'",
",",
"$",
"time",
")",
";",
"}"
] | eof | [
"eof"
] | train | https://github.com/frdl/webfan/blob/84d270377685224e891cd9d571b103b36f05b845/.ApplicationComposer/lib/webdof/wDate.php#L80-L84 |
frdl/webfan | .ApplicationComposer/lib/webdof/wDate.php | wDate.week | function week($time = NULL)
{
if( !is_numeric($time) )$time = $this->n;
return date('W', $time);
} | php | function week($time = NULL)
{
if( !is_numeric($time) )$time = $this->n;
return date('W', $time);
} | [
"function",
"week",
"(",
"$",
"time",
"=",
"NULL",
")",
"{",
"if",
"(",
"!",
"is_numeric",
"(",
"$",
"time",
")",
")",
"$",
"time",
"=",
"$",
"this",
"->",
"n",
";",
"return",
"date",
"(",
"'W'",
",",
"$",
"time",
")",
";",
"}"
] | eof | [
"eof"
] | train | https://github.com/frdl/webfan/blob/84d270377685224e891cd9d571b103b36f05b845/.ApplicationComposer/lib/webdof/wDate.php#L87-L91 |
frdl/webfan | .ApplicationComposer/lib/webdof/wDate.php | wDate.hour | function hour($time = NULL)
{
if( !is_numeric($time) )$time = $this->n;
return date('H', $time);
} | php | function hour($time = NULL)
{
if( !is_numeric($time) )$time = $this->n;
return date('H', $time);
} | [
"function",
"hour",
"(",
"$",
"time",
"=",
"NULL",
")",
"{",
"if",
"(",
"!",
"is_numeric",
"(",
"$",
"time",
")",
")",
"$",
"time",
"=",
"$",
"this",
"->",
"n",
";",
"return",
"date",
"(",
"'H'",
",",
"$",
"time",
")",
";",
"}"
] | eof | [
"eof"
] | train | https://github.com/frdl/webfan/blob/84d270377685224e891cd9d571b103b36f05b845/.ApplicationComposer/lib/webdof/wDate.php#L96-L100 |
frdl/webfan | .ApplicationComposer/lib/webdof/wDate.php | wDate.minute | function minute($time = NULL)
{
if( !is_numeric($time) )$time = $this->n;
return date('i', $time);
} | php | function minute($time = NULL)
{
if( !is_numeric($time) )$time = $this->n;
return date('i', $time);
} | [
"function",
"minute",
"(",
"$",
"time",
"=",
"NULL",
")",
"{",
"if",
"(",
"!",
"is_numeric",
"(",
"$",
"time",
")",
")",
"$",
"time",
"=",
"$",
"this",
"->",
"n",
";",
"return",
"date",
"(",
"'i'",
",",
"$",
"time",
")",
";",
"}"
] | eof | [
"eof"
] | train | https://github.com/frdl/webfan/blob/84d270377685224e891cd9d571b103b36f05b845/.ApplicationComposer/lib/webdof/wDate.php#L104-L108 |
frdl/webfan | .ApplicationComposer/lib/webdof/wDate.php | wDate.sec | function sec($time = NULL)
{
if( !is_numeric($time) )$time = $this->n;
return date('s', $time);
} | php | function sec($time = NULL)
{
if( !is_numeric($time) )$time = $this->n;
return date('s', $time);
} | [
"function",
"sec",
"(",
"$",
"time",
"=",
"NULL",
")",
"{",
"if",
"(",
"!",
"is_numeric",
"(",
"$",
"time",
")",
")",
"$",
"time",
"=",
"$",
"this",
"->",
"n",
";",
"return",
"date",
"(",
"'s'",
",",
"$",
"time",
")",
";",
"}"
] | eof | [
"eof"
] | train | https://github.com/frdl/webfan/blob/84d270377685224e891cd9d571b103b36f05b845/.ApplicationComposer/lib/webdof/wDate.php#L112-L116 |
frdl/webfan | .ApplicationComposer/lib/webdof/wDate.php | wDate.now | function now($time = NULL)
{
if( !is_numeric($time) )$time = $this->n;
return $this->hour($time).':'.$this->minute($time).' '.$this->sec($time);
} | php | function now($time = NULL)
{
if( !is_numeric($time) )$time = $this->n;
return $this->hour($time).':'.$this->minute($time).' '.$this->sec($time);
} | [
"function",
"now",
"(",
"$",
"time",
"=",
"NULL",
")",
"{",
"if",
"(",
"!",
"is_numeric",
"(",
"$",
"time",
")",
")",
"$",
"time",
"=",
"$",
"this",
"->",
"n",
";",
"return",
"$",
"this",
"->",
"hour",
"(",
"$",
"time",
")",
".",
"':'",
".",
... | eof | [
"eof"
] | train | https://github.com/frdl/webfan/blob/84d270377685224e891cd9d571b103b36f05b845/.ApplicationComposer/lib/webdof/wDate.php#L120-L124 |
frdl/webfan | .ApplicationComposer/lib/webdof/wDate.php | wDate.date | function date($time = NULL)
{
if( !is_numeric($time) )$time = $this->n;
return $this->day($time).'.'.$this->month($time).'.'.$this->year($time);
} | php | function date($time = NULL)
{
if( !is_numeric($time) )$time = $this->n;
return $this->day($time).'.'.$this->month($time).'.'.$this->year($time);
} | [
"function",
"date",
"(",
"$",
"time",
"=",
"NULL",
")",
"{",
"if",
"(",
"!",
"is_numeric",
"(",
"$",
"time",
")",
")",
"$",
"time",
"=",
"$",
"this",
"->",
"n",
";",
"return",
"$",
"this",
"->",
"day",
"(",
"$",
"time",
")",
".",
"'.'",
".",
... | eof | [
"eof"
] | train | https://github.com/frdl/webfan/blob/84d270377685224e891cd9d571b103b36f05b845/.ApplicationComposer/lib/webdof/wDate.php#L128-L132 |
dotkernel/dot-rbac | src/Rbac.php | Rbac.isGranted | public function isGranted(string $permission, array $roles): bool
{
foreach ($this->flattenRoles($roles) as $role) {
if ($role->hasPermission($permission)) {
return true;
}
}
return false;
} | php | public function isGranted(string $permission, array $roles): bool
{
foreach ($this->flattenRoles($roles) as $role) {
if ($role->hasPermission($permission)) {
return true;
}
}
return false;
} | [
"public",
"function",
"isGranted",
"(",
"string",
"$",
"permission",
",",
"array",
"$",
"roles",
")",
":",
"bool",
"{",
"foreach",
"(",
"$",
"this",
"->",
"flattenRoles",
"(",
"$",
"roles",
")",
"as",
"$",
"role",
")",
"{",
"if",
"(",
"$",
"role",
... | @param RoleInterface|RoleInterface[]|\Traversable $roles
@param string $permission
@return bool | [
"@param",
"RoleInterface|RoleInterface",
"[]",
"|",
"\\",
"Traversable",
"$roles",
"@param",
"string",
"$permission"
] | train | https://github.com/dotkernel/dot-rbac/blob/747ffadf3cf28750bb7cf81be60eb4c93b830446/src/Rbac.php#L27-L36 |
bolt/codingstyle | src/Config.php | Config.addRules | public function addRules($rules)
{
if ($rules instanceof RiskyRulesAwareInterface && $rules->isRisky()) {
$this->setRiskyAllowed(true);
}
if ($rules instanceof \Traversable) {
$rules = iterator_to_array($rules);
}
if (!is_array($rules)) {
... | php | public function addRules($rules)
{
if ($rules instanceof RiskyRulesAwareInterface && $rules->isRisky()) {
$this->setRiskyAllowed(true);
}
if ($rules instanceof \Traversable) {
$rules = iterator_to_array($rules);
}
if (!is_array($rules)) {
... | [
"public",
"function",
"addRules",
"(",
"$",
"rules",
")",
"{",
"if",
"(",
"$",
"rules",
"instanceof",
"RiskyRulesAwareInterface",
"&&",
"$",
"rules",
"->",
"isRisky",
"(",
")",
")",
"{",
"$",
"this",
"->",
"setRiskyAllowed",
"(",
"true",
")",
";",
"}",
... | Add to the current rules. Overrides existing rules.
See {@see setRules} for the format of these rules.
@param iterable $rules
@return $this | [
"Add",
"to",
"the",
"current",
"rules",
".",
"Overrides",
"existing",
"rules",
"."
] | train | https://github.com/bolt/codingstyle/blob/df4d149430c66ce4d0ddca4d2469ca0da62a8cce/src/Config.php#L37-L56 |
Isset/pushnotification | src/PushNotification/Type/Apple/StreamSocket.php | StreamSocket.read | public function read()
{
if (!$this->connected()) {
throw new LogicException('No connection');
}
$streams = [$this->connection];
$write = $except = null;
$streamsReadyToRead = stream_select($streams, $write, $except, 0, self::READ_TIMEOUT);
if ($streamsRe... | php | public function read()
{
if (!$this->connected()) {
throw new LogicException('No connection');
}
$streams = [$this->connection];
$write = $except = null;
$streamsReadyToRead = stream_select($streams, $write, $except, 0, self::READ_TIMEOUT);
if ($streamsRe... | [
"public",
"function",
"read",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"connected",
"(",
")",
")",
"{",
"throw",
"new",
"LogicException",
"(",
"'No connection'",
")",
";",
"}",
"$",
"streams",
"=",
"[",
"$",
"this",
"->",
"connection",
"]",
... | @throws LogicException
@return string|null | [
"@throws",
"LogicException"
] | train | https://github.com/Isset/pushnotification/blob/5e7634dc6b1cf4f7c371d1890243a25252db0d85/src/PushNotification/Type/Apple/StreamSocket.php#L108-L120 |
Isset/pushnotification | src/PushNotification/Type/Apple/StreamSocket.php | StreamSocket.write | public function write(string $data): int
{
if (!$this->connected()) {
throw new LogicException('Not connected');
}
return (int) fwrite($this->connection, $data, strlen($data));
} | php | public function write(string $data): int
{
if (!$this->connected()) {
throw new LogicException('Not connected');
}
return (int) fwrite($this->connection, $data, strlen($data));
} | [
"public",
"function",
"write",
"(",
"string",
"$",
"data",
")",
":",
"int",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"connected",
"(",
")",
")",
"{",
"throw",
"new",
"LogicException",
"(",
"'Not connected'",
")",
";",
"}",
"return",
"(",
"int",
")",
... | @param string $data
@return int | [
"@param",
"string",
"$data"
] | train | https://github.com/Isset/pushnotification/blob/5e7634dc6b1cf4f7c371d1890243a25252db0d85/src/PushNotification/Type/Apple/StreamSocket.php#L135-L142 |
josegonzalez/cakephp-sanction | Controller/Component/PermitComponent.php | PermitComponent.initialize | public function initialize(Controller $controller) {
if ($this->settings['isTest']) {
return;
}
$this->user = $this->Session->read("{$this->settings['path']}");
$this->routes = Permit::$routes;
Permit::$user = $this->user;
$this->request = $controller->request;
foreach (array('controller', 'plugin'... | php | public function initialize(Controller $controller) {
if ($this->settings['isTest']) {
return;
}
$this->user = $this->Session->read("{$this->settings['path']}");
$this->routes = Permit::$routes;
Permit::$user = $this->user;
$this->request = $controller->request;
foreach (array('controller', 'plugin'... | [
"public",
"function",
"initialize",
"(",
"Controller",
"$",
"controller",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"settings",
"[",
"'isTest'",
"]",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"user",
"=",
"$",
"this",
"->",
"Session",
"->",
"rea... | Initializes SanctionComponent for use in the controller
@param object $controller A reference to the instantiating controller object
@return void | [
"Initializes",
"SanctionComponent",
"for",
"use",
"in",
"the",
"controller"
] | train | https://github.com/josegonzalez/cakephp-sanction/blob/df2a8f0c0602c0ace802773db2c2ca6c89555c47/Controller/Component/PermitComponent.php#L99-L116 |
josegonzalez/cakephp-sanction | Controller/Component/PermitComponent.php | PermitComponent.startup | public function startup(Controller $controller) {
if ($this->settings['isTest']) {
return;
}
foreach ($this->routes as $route) {
if (!$this->_parse($route['route'])) {
continue;
}
if (!$this->_execute($route)) {
break;
}
$this->Session->write('Sanction.referer', $this->request->here()... | php | public function startup(Controller $controller) {
if ($this->settings['isTest']) {
return;
}
foreach ($this->routes as $route) {
if (!$this->_parse($route['route'])) {
continue;
}
if (!$this->_execute($route)) {
break;
}
$this->Session->write('Sanction.referer', $this->request->here()... | [
"public",
"function",
"startup",
"(",
"Controller",
"$",
"controller",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"settings",
"[",
"'isTest'",
"]",
")",
"{",
"return",
";",
"}",
"foreach",
"(",
"$",
"this",
"->",
"routes",
"as",
"$",
"route",
")",
"{",
... | Main execution method. Handles redirecting of invalid users, and saving
of request url as Sanction.referer
@param object $controller A reference to the instantiating controller object
@return bool | [
"Main",
"execution",
"method",
".",
"Handles",
"redirecting",
"of",
"invalid",
"users",
"and",
"saving",
"of",
"request",
"url",
"as",
"Sanction",
".",
"referer"
] | train | https://github.com/josegonzalez/cakephp-sanction/blob/df2a8f0c0602c0ace802773db2c2ca6c89555c47/Controller/Component/PermitComponent.php#L125-L142 |
josegonzalez/cakephp-sanction | Controller/Component/PermitComponent.php | PermitComponent._ensureHere | protected function _ensureHere() {
if (empty($this->_here) || empty($this->_hereQuery)) {
$this->_here = rtrim(preg_replace(
'/^' . preg_quote($this->request->base, '/') . '/',
'',
$this->request->here,
1
), '/');
$this->_hereQuery = rtrim($this->request->here(false), '/');
}
} | php | protected function _ensureHere() {
if (empty($this->_here) || empty($this->_hereQuery)) {
$this->_here = rtrim(preg_replace(
'/^' . preg_quote($this->request->base, '/') . '/',
'',
$this->request->here,
1
), '/');
$this->_hereQuery = rtrim($this->request->here(false), '/');
}
} | [
"protected",
"function",
"_ensureHere",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"_here",
")",
"||",
"empty",
"(",
"$",
"this",
"->",
"_hereQuery",
")",
")",
"{",
"$",
"this",
"->",
"_here",
"=",
"rtrim",
"(",
"preg_replace",
"(",
... | Ensure both $this->_here and $this->_hereQuery are set
@return void | [
"Ensure",
"both",
"$this",
"-",
">",
"_here",
"and",
"$this",
"-",
">",
"_hereQuery",
"are",
"set"
] | train | https://github.com/josegonzalez/cakephp-sanction/blob/df2a8f0c0602c0ace802773db2c2ca6c89555c47/Controller/Component/PermitComponent.php#L149-L159 |
josegonzalez/cakephp-sanction | Controller/Component/PermitComponent.php | PermitComponent._parse | protected function _parse($route) {
if (is_string($route)) {
$this->_ensureHere();
$url = parse_url($route);
$_path = rtrim($url['path'], '/');
if ($_path . '?' . Hash::get($url, 'query') === $this->_hereQuery) {
return true;
}
if ($_path === $this->_here) {
return true;
}
return fa... | php | protected function _parse($route) {
if (is_string($route)) {
$this->_ensureHere();
$url = parse_url($route);
$_path = rtrim($url['path'], '/');
if ($_path . '?' . Hash::get($url, 'query') === $this->_hereQuery) {
return true;
}
if ($_path === $this->_here) {
return true;
}
return fa... | [
"protected",
"function",
"_parse",
"(",
"$",
"route",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"route",
")",
")",
"{",
"$",
"this",
"->",
"_ensureHere",
"(",
")",
";",
"$",
"url",
"=",
"parse_url",
"(",
"$",
"route",
")",
";",
"$",
"_path",
"=... | Parses a given Permit route to see if it matches the current request
@param array $route A Permit Route
@return bool true if current request matches Permit route, false otherwise | [
"Parses",
"a",
"given",
"Permit",
"route",
"to",
"see",
"if",
"it",
"matches",
"the",
"current",
"request"
] | train | https://github.com/josegonzalez/cakephp-sanction/blob/df2a8f0c0602c0ace802773db2c2ca6c89555c47/Controller/Component/PermitComponent.php#L167-L231 |
josegonzalez/cakephp-sanction | Controller/Component/PermitComponent.php | PermitComponent._execute | protected function _execute($route) {
Permit::$executed = $this->executed = $route;
if (empty($route['rules'])) {
return false;
}
if (isset($route['rules']['deny'])) {
return $route['rules']['deny'] == true;
}
if (!isset($route['rules']['auth'])) {
return false;
}
if (is_bool($route['rules'... | php | protected function _execute($route) {
Permit::$executed = $this->executed = $route;
if (empty($route['rules'])) {
return false;
}
if (isset($route['rules']['deny'])) {
return $route['rules']['deny'] == true;
}
if (!isset($route['rules']['auth'])) {
return false;
}
if (is_bool($route['rules'... | [
"protected",
"function",
"_execute",
"(",
"$",
"route",
")",
"{",
"Permit",
"::",
"$",
"executed",
"=",
"$",
"this",
"->",
"executed",
"=",
"$",
"route",
";",
"if",
"(",
"empty",
"(",
"$",
"route",
"[",
"'rules'",
"]",
")",
")",
"{",
"return",
"fal... | Determines whether the given user is authorized to perform an action. The result of
a failed request depends upon the options for the route
@param array $route A Permit Route
@return bool True if redirect should be executed, false otherwise | [
"Determines",
"whether",
"the",
"given",
"user",
"is",
"authorized",
"to",
"perform",
"an",
"action",
".",
"The",
"result",
"of",
"a",
"failed",
"request",
"depends",
"upon",
"the",
"options",
"for",
"the",
"route"
] | train | https://github.com/josegonzalez/cakephp-sanction/blob/df2a8f0c0602c0ace802773db2c2ca6c89555c47/Controller/Component/PermitComponent.php#L240-L320 |
josegonzalez/cakephp-sanction | Controller/Component/PermitComponent.php | PermitComponent.redirect | public function redirect(Controller $Controller, $route) {
if ($route['message'] != null) {
$message = $route['message'];
$element = $route['element'];
$params = $route['params'];
$this->Session->write("Message.{$route['key']}", compact('message', 'element', 'params'));
}
$Controller->redirect($route... | php | public function redirect(Controller $Controller, $route) {
if ($route['message'] != null) {
$message = $route['message'];
$element = $route['element'];
$params = $route['params'];
$this->Session->write("Message.{$route['key']}", compact('message', 'element', 'params'));
}
$Controller->redirect($route... | [
"public",
"function",
"redirect",
"(",
"Controller",
"$",
"Controller",
",",
"$",
"route",
")",
"{",
"if",
"(",
"$",
"route",
"[",
"'message'",
"]",
"!=",
"null",
")",
"{",
"$",
"message",
"=",
"$",
"route",
"[",
"'message'",
"]",
";",
"$",
"element"... | Performs a redirect based upon a given route
@param Controller|object $Controller A reference to the instantiating controller object
@param array $route A Permit Route
@return void | [
"Performs",
"a",
"redirect",
"based",
"upon",
"a",
"given",
"route"
] | train | https://github.com/josegonzalez/cakephp-sanction/blob/df2a8f0c0602c0ace802773db2c2ca6c89555c47/Controller/Component/PermitComponent.php#L329-L338 |
josegonzalez/cakephp-sanction | Controller/Component/PermitComponent.php | PermitComponent.access | public function access($route, $rules = array(), $redirect = array()) {
$this->routes[] = Permit::access($route, $rules, $redirect);
} | php | public function access($route, $rules = array(), $redirect = array()) {
$this->routes[] = Permit::access($route, $rules, $redirect);
} | [
"public",
"function",
"access",
"(",
"$",
"route",
",",
"$",
"rules",
"=",
"array",
"(",
")",
",",
"$",
"redirect",
"=",
"array",
"(",
")",
")",
"{",
"$",
"this",
"->",
"routes",
"[",
"]",
"=",
"Permit",
"::",
"access",
"(",
"$",
"route",
",",
... | Connects a route to a given ruleset
@param array $route array describing a route
@param array $rules array of rules regarding the route
@param array $redirect Array containing the url to redirect to on route fail
@return array Array of connected routes | [
"Connects",
"a",
"route",
"to",
"a",
"given",
"ruleset"
] | train | https://github.com/josegonzalez/cakephp-sanction/blob/df2a8f0c0602c0ace802773db2c2ca6c89555c47/Controller/Component/PermitComponent.php#L348-L350 |
josegonzalez/cakephp-sanction | Controller/Component/PermitComponent.php | PermitComponent.referer | public function referer($referer = null) {
if ($this->Session->check('Sanction.referer')) {
$referer = $this->Session->read('Sanction.referer');
$this->Session->delete('Sanction.referer');
}
if ($referer === null) {
return false;
}
return Router::normalize($referer);
} | php | public function referer($referer = null) {
if ($this->Session->check('Sanction.referer')) {
$referer = $this->Session->read('Sanction.referer');
$this->Session->delete('Sanction.referer');
}
if ($referer === null) {
return false;
}
return Router::normalize($referer);
} | [
"public",
"function",
"referer",
"(",
"$",
"referer",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"Session",
"->",
"check",
"(",
"'Sanction.referer'",
")",
")",
"{",
"$",
"referer",
"=",
"$",
"this",
"->",
"Session",
"->",
"read",
"(",
"'San... | Returns the referring URL for this request.
@param mixed $referer Default URL to use if Session cannot be read
@return string Referring URL | [
"Returns",
"the",
"referring",
"URL",
"for",
"this",
"request",
"."
] | train | https://github.com/josegonzalez/cakephp-sanction/blob/df2a8f0c0602c0ace802773db2c2ca6c89555c47/Controller/Component/PermitComponent.php#L358-L369 |
josegonzalez/cakephp-sanction | Controller/Component/PermitComponent.php | Permit.access | public static function access($route, $rules = array(), $redirect = array()) {
$redirect = array_merge(array(
'redirect' => '/',
'message' => __('Access denied', true),
'element' => 'default',
'params' => array(),
'key' => 'flash'
),
$redirect
);
if (is_array($route)) {
foreach (arra... | php | public static function access($route, $rules = array(), $redirect = array()) {
$redirect = array_merge(array(
'redirect' => '/',
'message' => __('Access denied', true),
'element' => 'default',
'params' => array(),
'key' => 'flash'
),
$redirect
);
if (is_array($route)) {
foreach (arra... | [
"public",
"static",
"function",
"access",
"(",
"$",
"route",
",",
"$",
"rules",
"=",
"array",
"(",
")",
",",
"$",
"redirect",
"=",
"array",
"(",
")",
")",
"{",
"$",
"redirect",
"=",
"array_merge",
"(",
"array",
"(",
"'redirect'",
"=>",
"'/'",
",",
... | Connects a route to a given ruleset
Also converts underscored names to camelCase as
additional way of accessing a controller
@param array $route array describing a route
@param array $rules array of rules regarding the route
@param array $redirect Array containing the url to redirect to on route fail
@return array Ar... | [
"Connects",
"a",
"route",
"to",
"a",
"given",
"ruleset"
] | train | https://github.com/josegonzalez/cakephp-sanction/blob/df2a8f0c0602c0ace802773db2c2ca6c89555c47/Controller/Component/PermitComponent.php#L402-L449 |
php-comp/lite-database | example/feat/Builder/PdoBuilder.php | PdoBuilder.quote | public function quote($value)
{
// If a PDO database connection is set, use it to quote the value using
// the underlying database. Otherwise, quote it manually.
if ($pdo = $this->getPdo()) {
return $pdo->quote($value);
}
if (\is_numeric($value)) {
re... | php | public function quote($value)
{
// If a PDO database connection is set, use it to quote the value using
// the underlying database. Otherwise, quote it manually.
if ($pdo = $this->getPdo()) {
return $pdo->quote($value);
}
if (\is_numeric($value)) {
re... | [
"public",
"function",
"quote",
"(",
"$",
"value",
")",
"{",
"// If a PDO database connection is set, use it to quote the value using",
"// the underlying database. Otherwise, quote it manually.",
"if",
"(",
"$",
"pdo",
"=",
"$",
"this",
"->",
"getPdo",
"(",
")",
")",
"{",... | Safely escape a value for use in a statement.
@param mixed $value value to escape
@return mixed|false escaped value or false if failed | [
"Safely",
"escape",
"a",
"value",
"for",
"use",
"in",
"a",
"statement",
"."
] | train | https://github.com/php-comp/lite-database/blob/af5f73cb89e0e6cd24dd464f7a48fb5088eaafca/example/feat/Builder/PdoBuilder.php#L179-L196 |
php-comp/lite-database | example/feat/Builder/PdoBuilder.php | PdoBuilder.select | public function select($column, string $alias = null): self
{
if (\is_string($column)) {
if (\strpos($column, ',')) {
$this->select = \array_merge($this->select, \array_filter(\explode(',', $column)));
} else {
$this->select[$column] = $alias;
... | php | public function select($column, string $alias = null): self
{
if (\is_string($column)) {
if (\strpos($column, ',')) {
$this->select = \array_merge($this->select, \array_filter(\explode(',', $column)));
} else {
$this->select[$column] = $alias;
... | [
"public",
"function",
"select",
"(",
"$",
"column",
",",
"string",
"$",
"alias",
"=",
"null",
")",
":",
"self",
"{",
"if",
"(",
"\\",
"is_string",
"(",
"$",
"column",
")",
")",
"{",
"if",
"(",
"\\",
"strpos",
"(",
"$",
"column",
",",
"','",
")",
... | Add a SELECT column, table, or expression with optional alias.
@param string|array $column column name, table name, or expression
@param string $alias optional alias
@return Miner | [
"Add",
"a",
"SELECT",
"column",
"table",
"or",
"expression",
"with",
"optional",
"alias",
"."
] | train | https://github.com/php-comp/lite-database/blob/af5f73cb89e0e6cd24dd464f7a48fb5088eaafca/example/feat/Builder/PdoBuilder.php#L208-L227 |
old-town/workflow-designer-server | Module.php | Module.onBootstrap | public function onBootstrap(EventInterface $e)
{
/** @var MvcEvent $e */
$eventManager = $e->getApplication()->getEventManager();
$moduleRouteListener = new ModuleRouteListener();
$moduleRouteListener->attach($eventManager);
$eventManager->attach(MvcEvent::EVENT_ROUTE... | php | public function onBootstrap(EventInterface $e)
{
/** @var MvcEvent $e */
$eventManager = $e->getApplication()->getEventManager();
$moduleRouteListener = new ModuleRouteListener();
$moduleRouteListener->attach($eventManager);
$eventManager->attach(MvcEvent::EVENT_ROUTE... | [
"public",
"function",
"onBootstrap",
"(",
"EventInterface",
"$",
"e",
")",
"{",
"/** @var MvcEvent $e */",
"$",
"eventManager",
"=",
"$",
"e",
"->",
"getApplication",
"(",
")",
"->",
"getEventManager",
"(",
")",
";",
"$",
"moduleRouteListener",
"=",
"new",
"Mo... | @param EventInterface $e
@return array|void
@throws \Zend\ServiceManager\Exception\ServiceNotFoundException | [
"@param",
"EventInterface",
"$e"
] | train | https://github.com/old-town/workflow-designer-server/blob/6389c5a515861cc8e0b769f1ca7be12c6b78c611/Module.php#L38-L60 |
surebert/surebert-framework | src/sb/REST/Client.php | Client.setDefaultArguments | public function setDefaultArguments($default_settings)
{
foreach ($default_settings as $setting => $val) {
if (property_exists(get_class(), $setting)) {
$this->$setting = $val;
}
}
} | php | public function setDefaultArguments($default_settings)
{
foreach ($default_settings as $setting => $val) {
if (property_exists(get_class(), $setting)) {
$this->$setting = $val;
}
}
} | [
"public",
"function",
"setDefaultArguments",
"(",
"$",
"default_settings",
")",
"{",
"foreach",
"(",
"$",
"default_settings",
"as",
"$",
"setting",
"=>",
"$",
"val",
")",
"{",
"if",
"(",
"property_exists",
"(",
"get_class",
"(",
")",
",",
"$",
"setting",
"... | Overrides the default settings for all requests
@param array $default_settings settings to override the default properties of
follow_location, verify_ssl, return_transfer, debug, cookie_file, user_agent, timeout, on_http_error, on_headers, on_body | [
"Overrides",
"the",
"default",
"settings",
"for",
"all",
"requests"
] | train | https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/REST/Client.php#L177-L184 |
surebert/surebert-framework | src/sb/REST/Client.php | Client.setAuthentication | public function setAuthentication($uname = '', $pass = '', $type = 'basic')
{
$this->authentication['uname'] = $uname;
$this->authentication['pass'] = $pass;
$this->authentication['type'] = $type;
} | php | public function setAuthentication($uname = '', $pass = '', $type = 'basic')
{
$this->authentication['uname'] = $uname;
$this->authentication['pass'] = $pass;
$this->authentication['type'] = $type;
} | [
"public",
"function",
"setAuthentication",
"(",
"$",
"uname",
"=",
"''",
",",
"$",
"pass",
"=",
"''",
",",
"$",
"type",
"=",
"'basic'",
")",
"{",
"$",
"this",
"->",
"authentication",
"[",
"'uname'",
"]",
"=",
"$",
"uname",
";",
"$",
"this",
"->",
"... | Sets the authentication type used
@param string $uname The username
@param string $pass The password
@param string $type The auth type basic, ntlm, digest | [
"Sets",
"the",
"authentication",
"type",
"used"
] | train | https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/REST/Client.php#L192-L197 |
surebert/surebert-framework | src/sb/REST/Client.php | Client.processCurl | protected function processCurl($method, $data, $override_settings = Array())
{
$settings = get_object_vars($this);
foreach ($override_settings as $setting => $val) {
$settings[$setting] = $val;
}
$url = $settings['url'];
if ($method == 'GET' && is_array($data))... | php | protected function processCurl($method, $data, $override_settings = Array())
{
$settings = get_object_vars($this);
foreach ($override_settings as $setting => $val) {
$settings[$setting] = $val;
}
$url = $settings['url'];
if ($method == 'GET' && is_array($data))... | [
"protected",
"function",
"processCurl",
"(",
"$",
"method",
",",
"$",
"data",
",",
"$",
"override_settings",
"=",
"Array",
"(",
")",
")",
"{",
"$",
"settings",
"=",
"get_object_vars",
"(",
"$",
"this",
")",
";",
"foreach",
"(",
"$",
"override_settings",
... | Passes the request of to CURL for processing
@param string $method The type of method to send it with, POST, GET, PUT, DELETE
@param array $data The data to send
@param array $override_settings settings to override the default properties of
follow_location, verify_ssl, return_transfer, debug, cookie_file, user_agent, ... | [
"Passes",
"the",
"request",
"of",
"to",
"CURL",
"for",
"processing"
] | train | https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/REST/Client.php#L271-L384 |
Smile-SA/CronBundle | Service/CronService.php | CronService.runQueued | public function runQueued(InputInterface $input, OutputInterface $output)
{
/** @var SmileCron[] $smileCrons */
$smileCrons = $this->listQueued();
/** @var CronInterface[] $crons */
$crons = $this->getCrons();
/** @var CronInterface[] $cronAlias */
$cronAlias = array... | php | public function runQueued(InputInterface $input, OutputInterface $output)
{
/** @var SmileCron[] $smileCrons */
$smileCrons = $this->listQueued();
/** @var CronInterface[] $crons */
$crons = $this->getCrons();
/** @var CronInterface[] $cronAlias */
$cronAlias = array... | [
"public",
"function",
"runQueued",
"(",
"InputInterface",
"$",
"input",
",",
"OutputInterface",
"$",
"output",
")",
"{",
"/** @var SmileCron[] $smileCrons */",
"$",
"smileCrons",
"=",
"$",
"this",
"->",
"listQueued",
"(",
")",
";",
"/** @var CronInterface[] $crons */"... | List cron commands identified as queued
@param InputInterface $input input interface
@param OutputInterface $output output interface | [
"List",
"cron",
"commands",
"identified",
"as",
"queued"
] | train | https://github.com/Smile-SA/CronBundle/blob/3e6d29112915fa957cc04386ba9c6d1fc134d31f/Service/CronService.php#L107-L130 |
Smile-SA/CronBundle | Service/CronService.php | CronService.listCronsStatus | public function listCronsStatus()
{
/** @var SmileCron[] $smileCrons */
$smileCrons = $this->repository->listCrons();
/** @var CronInterface[] $crons */
$crons = $this->getCrons();
$cronAlias = array();
foreach ($crons as $cron) {
$cronAlias[$cron->getAl... | php | public function listCronsStatus()
{
/** @var SmileCron[] $smileCrons */
$smileCrons = $this->repository->listCrons();
/** @var CronInterface[] $crons */
$crons = $this->getCrons();
$cronAlias = array();
foreach ($crons as $cron) {
$cronAlias[$cron->getAl... | [
"public",
"function",
"listCronsStatus",
"(",
")",
"{",
"/** @var SmileCron[] $smileCrons */",
"$",
"smileCrons",
"=",
"$",
"this",
"->",
"repository",
"->",
"listCrons",
"(",
")",
";",
"/** @var CronInterface[] $crons */",
"$",
"crons",
"=",
"$",
"this",
"->",
"g... | Return cron list and status
@return SmileCron[] cron list with status | [
"Return",
"cron",
"list",
"and",
"status"
] | train | https://github.com/Smile-SA/CronBundle/blob/3e6d29112915fa957cc04386ba9c6d1fc134d31f/Service/CronService.php#L137-L159 |
nabab/bbn | src/bbn/appui/i18n.php | i18n.analyze_php | public function analyze_php(string $file): array
{
$res = [];
$php = file_get_contents($file);
if ( $tmp = \Gettext\Translations::fromPhpCodeString($php, [
'functions' => ['_' => 'gettext'],
'file' => $file
]) ){
foreach ( $tmp->getIterator() as $r => $tr ){
$res[] = $tr->g... | php | public function analyze_php(string $file): array
{
$res = [];
$php = file_get_contents($file);
if ( $tmp = \Gettext\Translations::fromPhpCodeString($php, [
'functions' => ['_' => 'gettext'],
'file' => $file
]) ){
foreach ( $tmp->getIterator() as $r => $tr ){
$res[] = $tr->g... | [
"public",
"function",
"analyze_php",
"(",
"string",
"$",
"file",
")",
":",
"array",
"{",
"$",
"res",
"=",
"[",
"]",
";",
"$",
"php",
"=",
"file_get_contents",
"(",
"$",
"file",
")",
";",
"if",
"(",
"$",
"tmp",
"=",
"\\",
"Gettext",
"\\",
"Translati... | Returns the strings contained in the given php file
@param string $file
@return array | [
"Returns",
"the",
"strings",
"contained",
"in",
"the",
"given",
"php",
"file"
] | train | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/appui/i18n.php#L41-L55 |
nabab/bbn | src/bbn/appui/i18n.php | i18n.analyze_js | public function analyze_js(string $file): array
{
$res = [];
$js = file_get_contents($file);
if ( $tmp = \Gettext\Translations::fromJsCodeString($js, [
'functions' => [
'_' => 'gettext',
'bbn._' => 'gettext'
],
'file' => $file
]) ){
foreach ( $tmp->getIterator... | php | public function analyze_js(string $file): array
{
$res = [];
$js = file_get_contents($file);
if ( $tmp = \Gettext\Translations::fromJsCodeString($js, [
'functions' => [
'_' => 'gettext',
'bbn._' => 'gettext'
],
'file' => $file
]) ){
foreach ( $tmp->getIterator... | [
"public",
"function",
"analyze_js",
"(",
"string",
"$",
"file",
")",
":",
"array",
"{",
"$",
"res",
"=",
"[",
"]",
";",
"$",
"js",
"=",
"file_get_contents",
"(",
"$",
"file",
")",
";",
"if",
"(",
"$",
"tmp",
"=",
"\\",
"Gettext",
"\\",
"Translation... | Returns the strings contained in the given js file
@param string $file
@return array | [
"Returns",
"the",
"strings",
"contained",
"in",
"the",
"given",
"js",
"file"
] | train | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/appui/i18n.php#L63-L80 |
nabab/bbn | src/bbn/appui/i18n.php | i18n.analyze_file | public function analyze_file(string $file): array
{
$res = [];
$ext = bbn\str::file_ext($file);
if ( \in_array($ext, self::$extensions, true) && is_file($file) ){
switch ( $ext ){
case 'html':
$res = $this->analyze_php($file);
break;
case 'php':
$res = $... | php | public function analyze_file(string $file): array
{
$res = [];
$ext = bbn\str::file_ext($file);
if ( \in_array($ext, self::$extensions, true) && is_file($file) ){
switch ( $ext ){
case 'html':
$res = $this->analyze_php($file);
break;
case 'php':
$res = $... | [
"public",
"function",
"analyze_file",
"(",
"string",
"$",
"file",
")",
":",
"array",
"{",
"$",
"res",
"=",
"[",
"]",
";",
"$",
"ext",
"=",
"bbn",
"\\",
"str",
"::",
"file_ext",
"(",
"$",
"file",
")",
";",
"if",
"(",
"\\",
"in_array",
"(",
"$",
... | Returns the strings contained in the given file
@param string $file
@return array | [
"Returns",
"the",
"strings",
"contained",
"in",
"the",
"given",
"file"
] | train | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/appui/i18n.php#L129-L150 |
nabab/bbn | src/bbn/appui/i18n.php | i18n.analyze_folder | public function analyze_folder(string $folder = '.', bool $deep = false): array
{
$res = [];
if ( \is_dir($folder) ){
$files = $deep ? bbn\file\dir::scan($folder, 'file') : bbn\file\dir::get_files($folder);
foreach ( $files as $f ){
$words = $this->analyze_file($f);
foreach ( $words... | php | public function analyze_folder(string $folder = '.', bool $deep = false): array
{
$res = [];
if ( \is_dir($folder) ){
$files = $deep ? bbn\file\dir::scan($folder, 'file') : bbn\file\dir::get_files($folder);
foreach ( $files as $f ){
$words = $this->analyze_file($f);
foreach ( $words... | [
"public",
"function",
"analyze_folder",
"(",
"string",
"$",
"folder",
"=",
"'.'",
",",
"bool",
"$",
"deep",
"=",
"false",
")",
":",
"array",
"{",
"$",
"res",
"=",
"[",
"]",
";",
"if",
"(",
"\\",
"is_dir",
"(",
"$",
"folder",
")",
")",
"{",
"$",
... | Returns an array containing the strings found in the given folder
@param string $folder
@param boolean $deep
@return array | [
"Returns",
"an",
"array",
"containing",
"the",
"strings",
"found",
"in",
"the",
"given",
"folder"
] | train | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/appui/i18n.php#L159-L179 |
nabab/bbn | src/bbn/appui/i18n.php | i18n.get_id_project | public function get_id_project($id_option, $projects){
foreach( $projects as $i => $p ){
foreach ( $projects[$i]['path'] as $idx => $pa ){
if ( $projects[$i]['path'][$idx]['id_option'] === $id_option ){
return $projects[$i]['id'];
}
}
}
} | php | public function get_id_project($id_option, $projects){
foreach( $projects as $i => $p ){
foreach ( $projects[$i]['path'] as $idx => $pa ){
if ( $projects[$i]['path'][$idx]['id_option'] === $id_option ){
return $projects[$i]['id'];
}
}
}
} | [
"public",
"function",
"get_id_project",
"(",
"$",
"id_option",
",",
"$",
"projects",
")",
"{",
"foreach",
"(",
"$",
"projects",
"as",
"$",
"i",
"=>",
"$",
"p",
")",
"{",
"foreach",
"(",
"$",
"projects",
"[",
"$",
"i",
"]",
"[",
"'path'",
"]",
"as",... | get the id of the project from the id_option of a path
@param $id_option
@param $projects
@return void | [
"get",
"the",
"id",
"of",
"the",
"project",
"from",
"the",
"id_option",
"of",
"a",
"path"
] | train | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/appui/i18n.php#L204-L212 |
nabab/bbn | src/bbn/appui/i18n.php | i18n.get_primaries_langs | public function get_primaries_langs(){
$uid_languages = self::get_appui_option_id('languages');
$languages = options::get_instance()->full_tree($uid_languages);
$primaries = array_values(array_filter($languages['items'], function($v) {
return !empty($v['primary']);
}));
return $primaries;
} | php | public function get_primaries_langs(){
$uid_languages = self::get_appui_option_id('languages');
$languages = options::get_instance()->full_tree($uid_languages);
$primaries = array_values(array_filter($languages['items'], function($v) {
return !empty($v['primary']);
}));
return $primaries;
} | [
"public",
"function",
"get_primaries_langs",
"(",
")",
"{",
"$",
"uid_languages",
"=",
"self",
"::",
"get_appui_option_id",
"(",
"'languages'",
")",
";",
"$",
"languages",
"=",
"options",
"::",
"get_instance",
"(",
")",
"->",
"full_tree",
"(",
"$",
"uid_langua... | Gets primaries langs from option
@return void | [
"Gets",
"primaries",
"langs",
"from",
"option"
] | train | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/appui/i18n.php#L231-L238 |
nabab/bbn | src/bbn/appui/i18n.php | i18n.get_num_options | public function get_num_options(){
/** @var $paths takes all options with i18n property setted*/
$paths = options::get_instance()->find_i18n();
$data = [];
/**
* creates the property data_widget that will have just num of items found for the option + 1 (the text of the option parent), the * * numb... | php | public function get_num_options(){
/** @var $paths takes all options with i18n property setted*/
$paths = options::get_instance()->find_i18n();
$data = [];
/**
* creates the property data_widget that will have just num of items found for the option + 1 (the text of the option parent), the * * numb... | [
"public",
"function",
"get_num_options",
"(",
")",
"{",
"/** @var $paths takes all options with i18n property setted*/",
"$",
"paths",
"=",
"options",
"::",
"get_instance",
"(",
")",
"->",
"find_i18n",
"(",
")",
";",
"$",
"data",
"=",
"[",
"]",
";",
"/**\n * c... | get the num of items['text'] in original language and num translations foreach lang in configured langs (for this project uses all primaries as configured langs)
@return void | [
"get",
"the",
"num",
"of",
"items",
"[",
"text",
"]",
"in",
"original",
"language",
"and",
"num",
"translations",
"foreach",
"lang",
"in",
"configured",
"langs",
"(",
"for",
"this",
"project",
"uses",
"all",
"primaries",
"as",
"configured",
"langs",
")"
] | train | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/appui/i18n.php#L247-L298 |
nabab/bbn | src/bbn/appui/i18n.php | i18n.get_options | public function get_options(){
/** @var ( array) $paths get all options having i18n property setted and its items */
$paths = options::get_instance()->find_i18n();
$res = [];
foreach ( $paths as $p => $val ){
$res[$p] = [
'text'=> $paths[$p]['text'],
'opt_language' => $paths[$p]['l... | php | public function get_options(){
/** @var ( array) $paths get all options having i18n property setted and its items */
$paths = options::get_instance()->find_i18n();
$res = [];
foreach ( $paths as $p => $val ){
$res[$p] = [
'text'=> $paths[$p]['text'],
'opt_language' => $paths[$p]['l... | [
"public",
"function",
"get_options",
"(",
")",
"{",
"/** @var ( array) $paths get all options having i18n property setted and its items */",
"$",
"paths",
"=",
"options",
"::",
"get_instance",
"(",
")",
"->",
"find_i18n",
"(",
")",
";",
"$",
"res",
"=",
"[",
"]",
";... | Gets the option with the property i18n setted and its items
@return void | [
"Gets",
"the",
"option",
"with",
"the",
"property",
"i18n",
"setted",
"and",
"its",
"items"
] | train | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/appui/i18n.php#L307-L385 |
nabab/bbn | src/bbn/appui/i18n.php | i18n.get_translations_widget | public function get_translations_widget($id_project, $id_option)
{
$success = false;
$result = [];
$locale_dirs = [];
if ( $id_option &&
($o = options::get_instance()->option($id_option)) &&
!empty($o['language']) &&
($parent = options::get_instance()->parent($id_option)) &&
d... | php | public function get_translations_widget($id_project, $id_option)
{
$success = false;
$result = [];
$locale_dirs = [];
if ( $id_option &&
($o = options::get_instance()->option($id_option)) &&
!empty($o['language']) &&
($parent = options::get_instance()->parent($id_option)) &&
d... | [
"public",
"function",
"get_translations_widget",
"(",
"$",
"id_project",
",",
"$",
"id_option",
")",
"{",
"$",
"success",
"=",
"false",
";",
"$",
"result",
"=",
"[",
"]",
";",
"$",
"locale_dirs",
"=",
"[",
"]",
";",
"if",
"(",
"$",
"id_option",
"&&",
... | Gets the widgets initial data
@param [type] $id_project
@param [type] $id_option
@return void | [
"Gets",
"the",
"widgets",
"initial",
"data"
] | train | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/appui/i18n.php#L404-L498 |
nabab/bbn | src/bbn/appui/i18n.php | i18n.get_po_files | public function get_po_files($id_option){
if (!empty($id_option) && ($o = options::get_instance()->option($id_option)) &&
($parent = options::get_instance()->parent($id_option)) &&
defined($parent['code']) ){
$tmp = [];
// @var $to_explore the path to explore
$to_explore = constant($pare... | php | public function get_po_files($id_option){
if (!empty($id_option) && ($o = options::get_instance()->option($id_option)) &&
($parent = options::get_instance()->parent($id_option)) &&
defined($parent['code']) ){
$tmp = [];
// @var $to_explore the path to explore
$to_explore = constant($pare... | [
"public",
"function",
"get_po_files",
"(",
"$",
"id_option",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"id_option",
")",
"&&",
"(",
"$",
"o",
"=",
"options",
"::",
"get_instance",
"(",
")",
"->",
"option",
"(",
"$",
"id_option",
")",
")",
"&&",
... | Returns an array containing the po files found for the id_option
@param $id_option
@return void | [
"Returns",
"an",
"array",
"containing",
"the",
"po",
"files",
"found",
"for",
"the",
"id_option"
] | train | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/appui/i18n.php#L506-L534 |
nabab/bbn | src/bbn/appui/i18n.php | i18n.count_translations_db | public function count_translations_db($id_option){
$count = [];
$po = $this->get_po_files($id_option);
if (!empty($po)){
foreach ($po as $lang => $file) {
$fileHandler = new \Sepia\PoParser\SourceHandler\FileSystem($file);
$poParser = new \Sepia\PoParser\Parser($fileHandler);
$... | php | public function count_translations_db($id_option){
$count = [];
$po = $this->get_po_files($id_option);
if (!empty($po)){
foreach ($po as $lang => $file) {
$fileHandler = new \Sepia\PoParser\SourceHandler\FileSystem($file);
$poParser = new \Sepia\PoParser\Parser($fileHandler);
$... | [
"public",
"function",
"count_translations_db",
"(",
"$",
"id_option",
")",
"{",
"$",
"count",
"=",
"[",
"]",
";",
"$",
"po",
"=",
"$",
"this",
"->",
"get_po_files",
"(",
"$",
"id_option",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"po",
")",
")",... | Count how many of the strings contained in po files are already in database
@param [type] $id_option
@return void | [
"Count",
"how",
"many",
"of",
"the",
"strings",
"contained",
"in",
"po",
"files",
"are",
"already",
"in",
"database"
] | train | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/appui/i18n.php#L542-L572 |
nabab/bbn | src/bbn/appui/i18n.php | i18n.get_translations_strings | public function get_translations_strings($id_option, $source_language, $languages){
if (
!empty($id_option) &&
!empty($source_language) &&
($o = options::get_instance()->option($id_option)) &&
($parent = options::get_instance()->option($o['id_parent'])) &&
\defined($parent['code'])
... | php | public function get_translations_strings($id_option, $source_language, $languages){
if (
!empty($id_option) &&
!empty($source_language) &&
($o = options::get_instance()->option($id_option)) &&
($parent = options::get_instance()->option($o['id_parent'])) &&
\defined($parent['code'])
... | [
"public",
"function",
"get_translations_strings",
"(",
"$",
"id_option",
",",
"$",
"source_language",
",",
"$",
"languages",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"id_option",
")",
"&&",
"!",
"empty",
"(",
"$",
"source_language",
")",
"&&",
"(",
"... | Returns the strings contained in the given path
@param $id_option
@param $source_language
@param $languages
@return void | [
"Returns",
"the",
"strings",
"contained",
"in",
"the",
"given",
"path"
] | train | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/appui/i18n.php#L582-L730 |
nabab/bbn | src/bbn/appui/i18n.php | i18n.get_translations_table | public function get_translations_table($id_project, $id_option){
if ( !empty($id_option) &&
($o = options::get_instance()->option($id_option)) &&
($parent = options::get_instance()->parent($id_option)) &&
defined($parent['code']) ){
// @var $path_source_lang the property language of the id... | php | public function get_translations_table($id_project, $id_option){
if ( !empty($id_option) &&
($o = options::get_instance()->option($id_option)) &&
($parent = options::get_instance()->parent($id_option)) &&
defined($parent['code']) ){
// @var $path_source_lang the property language of the id... | [
"public",
"function",
"get_translations_table",
"(",
"$",
"id_project",
",",
"$",
"id_option",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"id_option",
")",
"&&",
"(",
"$",
"o",
"=",
"options",
"::",
"get_instance",
"(",
")",
"->",
"option",
"(",
"$",... | Returns the informations relative to traslation of the given $id_option of a $id_project. The data is formatted to be shown in a table
@param [type] $id_project
@param [type] $id_option
@return void | [
"Returns",
"the",
"informations",
"relative",
"to",
"traslation",
"of",
"the",
"given",
"$id_option",
"of",
"a",
"$id_project",
".",
"The",
"data",
"is",
"formatted",
"to",
"be",
"shown",
"in",
"a",
"table"
] | train | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/appui/i18n.php#L739-L833 |
graze/data-structure | src/Collection/Collection.php | Collection.filter | public function filter(callable $fn)
{
$this->items = array_values(array_filter($this->items, $fn));
return $this;
} | php | public function filter(callable $fn)
{
$this->items = array_values(array_filter($this->items, $fn));
return $this;
} | [
"public",
"function",
"filter",
"(",
"callable",
"$",
"fn",
")",
"{",
"$",
"this",
"->",
"items",
"=",
"array_values",
"(",
"array_filter",
"(",
"$",
"this",
"->",
"items",
",",
"$",
"fn",
")",
")",
";",
"return",
"$",
"this",
";",
"}"
] | @param callable $fn
@return $this | [
"@param",
"callable",
"$fn"
] | train | https://github.com/graze/data-structure/blob/24e0544b7828f65b1b93ce69ad702c9efb4a64d0/src/Collection/Collection.php#L72-L77 |
graze/data-structure | src/Collection/Collection.php | Collection.sortOn | public function sortOn(callable $fn, $order = Sort\ASC)
{
$this->items = Sort\comparison($this->items, $fn, $order);
return $this;
} | php | public function sortOn(callable $fn, $order = Sort\ASC)
{
$this->items = Sort\comparison($this->items, $fn, $order);
return $this;
} | [
"public",
"function",
"sortOn",
"(",
"callable",
"$",
"fn",
",",
"$",
"order",
"=",
"Sort",
"\\",
"ASC",
")",
"{",
"$",
"this",
"->",
"items",
"=",
"Sort",
"\\",
"comparison",
"(",
"$",
"this",
"->",
"items",
",",
"$",
"fn",
",",
"$",
"order",
")... | @param callable $fn
@param int $order
@return $this | [
"@param",
"callable",
"$fn",
"@param",
"int",
"$order"
] | train | https://github.com/graze/data-structure/blob/24e0544b7828f65b1b93ce69ad702c9efb4a64d0/src/Collection/Collection.php#L134-L139 |
dstuecken/notify | src/Handler/HipChatHandler.php | HipChatHandler.handle | public function handle(NotificationInterface $notification, $level)
{
if ($notification instanceof AttributeAwareInterface)
{
$notify = $notification->attribute('notify');
$format = $notification->attribute('format') ?: HipChat::FORMAT_HTML;
}
else
{
... | php | public function handle(NotificationInterface $notification, $level)
{
if ($notification instanceof AttributeAwareInterface)
{
$notify = $notification->attribute('notify');
$format = $notification->attribute('format') ?: HipChat::FORMAT_HTML;
}
else
{
... | [
"public",
"function",
"handle",
"(",
"NotificationInterface",
"$",
"notification",
",",
"$",
"level",
")",
"{",
"if",
"(",
"$",
"notification",
"instanceof",
"AttributeAwareInterface",
")",
"{",
"$",
"notify",
"=",
"$",
"notification",
"->",
"attribute",
"(",
... | Handle a notification
@return bool | [
"Handle",
"a",
"notification"
] | train | https://github.com/dstuecken/notify/blob/abccf0a6a272caf66baea74323f18e2212c6e11e/src/Handler/HipChatHandler.php#L59-L80 |
petrica/php-statsd-system | Gauge/CpuAverageGauge.php | CpuAverageGauge.getCollection | public function getCollection()
{
$collection = new ValuesCollection();
$load = $this->getLoadAverage();
$value = null;
if (!empty($load) && isset($load[0])) {
$value = $load[0];
}
return $collection->add('load.average', $value);
} | php | public function getCollection()
{
$collection = new ValuesCollection();
$load = $this->getLoadAverage();
$value = null;
if (!empty($load) && isset($load[0])) {
$value = $load[0];
}
return $collection->add('load.average', $value);
} | [
"public",
"function",
"getCollection",
"(",
")",
"{",
"$",
"collection",
"=",
"new",
"ValuesCollection",
"(",
")",
";",
"$",
"load",
"=",
"$",
"this",
"->",
"getLoadAverage",
"(",
")",
";",
"$",
"value",
"=",
"null",
";",
"if",
"(",
"!",
"empty",
"("... | {@inheritdoc} | [
"{"
] | train | https://github.com/petrica/php-statsd-system/blob/c476be3514a631a605737888bb8f6eb096789c9d/Gauge/CpuAverageGauge.php#L28-L40 |
eghojansu/moe | src/Log.php | Log.write | function write($text,$format='r') {
$fw=Base::instance();
$fw->write(
$this->file,
date($format).
(isset($_SERVER['REMOTE_ADDR'])?
(' ['.$_SERVER['REMOTE_ADDR'].']'):'').' '.
trim($text).PHP_EOL,
TRUE
);
} | php | function write($text,$format='r') {
$fw=Base::instance();
$fw->write(
$this->file,
date($format).
(isset($_SERVER['REMOTE_ADDR'])?
(' ['.$_SERVER['REMOTE_ADDR'].']'):'').' '.
trim($text).PHP_EOL,
TRUE
);
} | [
"function",
"write",
"(",
"$",
"text",
",",
"$",
"format",
"=",
"'r'",
")",
"{",
"$",
"fw",
"=",
"Base",
"::",
"instance",
"(",
")",
";",
"$",
"fw",
"->",
"write",
"(",
"$",
"this",
"->",
"file",
",",
"date",
"(",
"$",
"format",
")",
".",
"("... | Write specified text to log file
@return string
@param $text string
@param $format string | [
"Write",
"specified",
"text",
"to",
"log",
"file"
] | train | https://github.com/eghojansu/moe/blob/f58ec75a3116d1a572782256e2b38bb9aab95e3c/src/Log.php#L18-L28 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Mail/src/parser/shutdown_handler.php | ezcMailParserShutdownHandler.registerForRemoval | public static function registerForRemoval( $dir )
{
if ( self::$isRegistered === false )
{
register_shutdown_function( array( "ezcMailParserShutdownHandler", "shutdownCallback" ) );
self::$isRegistered = true;
}
self::$directories[] = $dir;
} | php | public static function registerForRemoval( $dir )
{
if ( self::$isRegistered === false )
{
register_shutdown_function( array( "ezcMailParserShutdownHandler", "shutdownCallback" ) );
self::$isRegistered = true;
}
self::$directories[] = $dir;
} | [
"public",
"static",
"function",
"registerForRemoval",
"(",
"$",
"dir",
")",
"{",
"if",
"(",
"self",
"::",
"$",
"isRegistered",
"===",
"false",
")",
"{",
"register_shutdown_function",
"(",
"array",
"(",
"\"ezcMailParserShutdownHandler\"",
",",
"\"shutdownCallback\"",... | Registers the directory $dir for removal when PHP shuts down.
The directory and all of its contents will be removed recursively.
@param string $dir | [
"Registers",
"the",
"directory",
"$dir",
"for",
"removal",
"when",
"PHP",
"shuts",
"down",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Mail/src/parser/shutdown_handler.php#L51-L59 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Mail/src/parser/shutdown_handler.php | ezcMailParserShutdownHandler.remove | public static function remove( $itemName )
{
$returnVar = true;
if ( !is_dir( $itemName ) && file_exists( $itemName ) )
{
unlink( $itemName );
return true;
}
if ( !file_exists( $itemName ) )
{
return true;
}
$dir =... | php | public static function remove( $itemName )
{
$returnVar = true;
if ( !is_dir( $itemName ) && file_exists( $itemName ) )
{
unlink( $itemName );
return true;
}
if ( !file_exists( $itemName ) )
{
return true;
}
$dir =... | [
"public",
"static",
"function",
"remove",
"(",
"$",
"itemName",
")",
"{",
"$",
"returnVar",
"=",
"true",
";",
"if",
"(",
"!",
"is_dir",
"(",
"$",
"itemName",
")",
"&&",
"file_exists",
"(",
"$",
"itemName",
")",
")",
"{",
"unlink",
"(",
"$",
"itemName... | Recursively removes a directory and its contents or a file.
Returns true on success and false on error.
@param string $itemName
@return bool | [
"Recursively",
"removes",
"a",
"directory",
"and",
"its",
"contents",
"or",
"a",
"file",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Mail/src/parser/shutdown_handler.php#L85-L114 |
shabbyrobe/amiss | src/Sql/Relator/Base.php | Base.createOn | protected function createOn($meta, $fromIndex, $relatedMeta, $toIndex)
{
if (!isset($meta->indexes[$fromIndex])) {
throw new Exception("Index $fromIndex does not exist on {$meta->id}");
}
if (!isset($relatedMeta->indexes[$toIndex])) {
throw new Exception("Index $toInd... | php | protected function createOn($meta, $fromIndex, $relatedMeta, $toIndex)
{
if (!isset($meta->indexes[$fromIndex])) {
throw new Exception("Index $fromIndex does not exist on {$meta->id}");
}
if (!isset($relatedMeta->indexes[$toIndex])) {
throw new Exception("Index $toInd... | [
"protected",
"function",
"createOn",
"(",
"$",
"meta",
",",
"$",
"fromIndex",
",",
"$",
"relatedMeta",
",",
"$",
"toIndex",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"meta",
"->",
"indexes",
"[",
"$",
"fromIndex",
"]",
")",
")",
"{",
"throw",
"n... | to be interfered with yet. | [
"to",
"be",
"interfered",
"with",
"yet",
"."
] | train | https://github.com/shabbyrobe/amiss/blob/ba261f0d1f985ed36e9fd2903ac0df86c5b9498d/src/Sql/Relator/Base.php#L96-L117 |
MrJuliuss/syntara-logviewer | src/Mrjuliuss/SyntaraLogviewer/SyntaraLogviewerServiceProvider.php | SyntaraLogviewerServiceProvider.register | public function register()
{
// load package config
$this->app['config']->package('kmd/logviewer', 'kmd/logviewer/config');
$this->app['config']->set('logviewer::base_url', Config::get('syntara::config.uri').'/logviewer');
$this->app['config']->set('logviewer::filters.global', array('before' => 'basicAuth|has... | php | public function register()
{
// load package config
$this->app['config']->package('kmd/logviewer', 'kmd/logviewer/config');
$this->app['config']->set('logviewer::base_url', Config::get('syntara::config.uri').'/logviewer');
$this->app['config']->set('logviewer::filters.global', array('before' => 'basicAuth|has... | [
"public",
"function",
"register",
"(",
")",
"{",
"// load package config",
"$",
"this",
"->",
"app",
"[",
"'config'",
"]",
"->",
"package",
"(",
"'kmd/logviewer'",
",",
"'kmd/logviewer/config'",
")",
";",
"$",
"this",
"->",
"app",
"[",
"'config'",
"]",
"->",... | Register the service provider.
@return void | [
"Register",
"the",
"service",
"provider",
"."
] | train | https://github.com/MrJuliuss/syntara-logviewer/blob/49ae6f855339013c8d3cf2b1581c1f59452898be/src/Mrjuliuss/SyntaraLogviewer/SyntaraLogviewerServiceProvider.php#L28-L54 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Cache/src/storage/file.php | ezcCacheStorageFile.store | public function store( $id, $data, $attributes = array() )
{
$filename = $this->properties['location']
. $this->generateIdentifier( $id, $attributes );
if ( file_exists( $filename ) )
{
if ( unlink( $filename ) === false )
{
throw new... | php | public function store( $id, $data, $attributes = array() )
{
$filename = $this->properties['location']
. $this->generateIdentifier( $id, $attributes );
if ( file_exists( $filename ) )
{
if ( unlink( $filename ) === false )
{
throw new... | [
"public",
"function",
"store",
"(",
"$",
"id",
",",
"$",
"data",
",",
"$",
"attributes",
"=",
"array",
"(",
")",
")",
"{",
"$",
"filename",
"=",
"$",
"this",
"->",
"properties",
"[",
"'location'",
"]",
".",
"$",
"this",
"->",
"generateIdentifier",
"(... | Store data to the cache storage.
This method stores the given cache data into the cache, assigning the
ID given to it.
The type of cache data which is expected by a ezcCacheStorage depends on
its implementation. In most cases strings and arrays will be accepted,
in some rare cases only strings might be accepted.
Usin... | [
"Store",
"data",
"to",
"the",
"cache",
"storage",
".",
"This",
"method",
"stores",
"the",
"given",
"cache",
"data",
"into",
"the",
"cache",
"assigning",
"the",
"ID",
"given",
"to",
"it",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Cache/src/storage/file.php#L183-L216 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Cache/src/storage/file.php | ezcCacheStorageFile.storeRawData | protected function storeRawData( $filename, $data )
{
if ( file_put_contents( $filename, $data ) !== strlen( $data ) )
{
throw new ezcBaseFileIoException(
$filename,
ezcBaseFileException::WRITE,
'Could not write data to cache file.'
... | php | protected function storeRawData( $filename, $data )
{
if ( file_put_contents( $filename, $data ) !== strlen( $data ) )
{
throw new ezcBaseFileIoException(
$filename,
ezcBaseFileException::WRITE,
'Could not write data to cache file.'
... | [
"protected",
"function",
"storeRawData",
"(",
"$",
"filename",
",",
"$",
"data",
")",
"{",
"if",
"(",
"file_put_contents",
"(",
"$",
"filename",
",",
"$",
"data",
")",
"!==",
"strlen",
"(",
"$",
"data",
")",
")",
"{",
"throw",
"new",
"ezcBaseFileIoExcept... | Actually stores the given data.
@param string $filename
@param string $data
@return void
@throws ezcBaseFileIoException
if the store fails. | [
"Actually",
"stores",
"the",
"given",
"data",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Cache/src/storage/file.php#L228-L238 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Cache/src/storage/file.php | ezcCacheStorageFile.restore | public function restore( $id, $attributes = array(), $search = false )
{
$filename = $this->properties['location']
. $this->generateIdentifier( $id, $attributes );
if ( file_exists( $filename ) === false )
{
if ( $search === true
&& count( $file... | php | public function restore( $id, $attributes = array(), $search = false )
{
$filename = $this->properties['location']
. $this->generateIdentifier( $id, $attributes );
if ( file_exists( $filename ) === false )
{
if ( $search === true
&& count( $file... | [
"public",
"function",
"restore",
"(",
"$",
"id",
",",
"$",
"attributes",
"=",
"array",
"(",
")",
",",
"$",
"search",
"=",
"false",
")",
"{",
"$",
"filename",
"=",
"$",
"this",
"->",
"properties",
"[",
"'location'",
"]",
".",
"$",
"this",
"->",
"gen... | Restore data from the cache.
Restores the data associated with the given cache and
returns it. Please see {@link ezcCacheStorage::store()}
for more detailed information of cachable datatypes.
During access to cached data the caches are automatically
expired. This means, that the ezcCacheStorage object checks
before re... | [
"Restore",
"data",
"from",
"the",
"cache",
".",
"Restores",
"the",
"data",
"associated",
"with",
"the",
"given",
"cache",
"and",
"returns",
"it",
".",
"Please",
"see",
"{",
"@link",
"ezcCacheStorage",
"::",
"store",
"()",
"}",
"for",
"more",
"detailed",
"i... | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Cache/src/storage/file.php#L274-L303 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Cache/src/storage/file.php | ezcCacheStorageFile.delete | public function delete( $id = null, $attributes = array(), $search = false )
{
$filename = $this->properties['location']
. $this->generateIdentifier( $id, $attributes );
$filesToDelete = array();
if ( file_exists( $filename ) )
{
$filesToDelete[] = $fil... | php | public function delete( $id = null, $attributes = array(), $search = false )
{
$filename = $this->properties['location']
. $this->generateIdentifier( $id, $attributes );
$filesToDelete = array();
if ( file_exists( $filename ) )
{
$filesToDelete[] = $fil... | [
"public",
"function",
"delete",
"(",
"$",
"id",
"=",
"null",
",",
"$",
"attributes",
"=",
"array",
"(",
")",
",",
"$",
"search",
"=",
"false",
")",
"{",
"$",
"filename",
"=",
"$",
"this",
"->",
"properties",
"[",
"'location'",
"]",
".",
"$",
"this"... | Delete data from the cache.
Purges the cached data for a given ID and or attributes. Using an ID
purges only the cache data for just this ID.
Additional attributes provided will matched additionally. This can give
you an immense speed improvement against just searching for ID ( see
{@link ezcCacheStorage::restore()} )... | [
"Delete",
"data",
"from",
"the",
"cache",
".",
"Purges",
"the",
"cached",
"data",
"for",
"a",
"given",
"ID",
"and",
"or",
"attributes",
".",
"Using",
"an",
"ID",
"purges",
"only",
"the",
"cache",
"data",
"for",
"just",
"this",
"ID",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Cache/src/storage/file.php#L330-L360 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Cache/src/storage/file.php | ezcCacheStorageFile.getRemainingLifetime | public function getRemainingLifetime( $id, $attributes = array() )
{
if ( count( $objects = $this->search( $id, $attributes ) ) > 0 )
{
return $this->calcLifetime( $objects[0] );
}
return 0;
} | php | public function getRemainingLifetime( $id, $attributes = array() )
{
if ( count( $objects = $this->search( $id, $attributes ) ) > 0 )
{
return $this->calcLifetime( $objects[0] );
}
return 0;
} | [
"public",
"function",
"getRemainingLifetime",
"(",
"$",
"id",
",",
"$",
"attributes",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"objects",
"=",
"$",
"this",
"->",
"search",
"(",
"$",
"id",
",",
"$",
"attributes",
")",
")",
">"... | Returns the time ( in seconds ) which remains for a cache object,
before it gets outdated. In case the cache object is already
outdated or does not exist, this method returns 0.
@param string $id The item ID.
@param array(string=>string) $attributes Attributes describing the
data to restore.
@... | [
"Returns",
"the",
"time",
"(",
"in",
"seconds",
")",
"which",
"remains",
"for",
"a",
"cache",
"object",
"before",
"it",
"gets",
"outdated",
".",
"In",
"case",
"the",
"cache",
"object",
"is",
"already",
"outdated",
"or",
"does",
"not",
"exist",
"this",
"m... | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Cache/src/storage/file.php#L388-L395 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Cache/src/storage/file.php | ezcCacheStorageFile.purge | public function purge( $limit = null )
{
$purgeCount = 0;
return $this->purgeRecursive( $this->properties['location'], $limit, $purgeCount );
} | php | public function purge( $limit = null )
{
$purgeCount = 0;
return $this->purgeRecursive( $this->properties['location'], $limit, $purgeCount );
} | [
"public",
"function",
"purge",
"(",
"$",
"limit",
"=",
"null",
")",
"{",
"$",
"purgeCount",
"=",
"0",
";",
"return",
"$",
"this",
"->",
"purgeRecursive",
"(",
"$",
"this",
"->",
"properties",
"[",
"'location'",
"]",
",",
"$",
"limit",
",",
"$",
"purg... | Purges the given number of cache items.
This method minimally purges the $limit number of outdated cache items
from the storage. If limit is left out, all outdated items are purged.
The purged item IDs are returned.
@param int $limit
@return array(string) | [
"Purges",
"the",
"given",
"number",
"of",
"cache",
"items",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Cache/src/storage/file.php#L407-L411 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Cache/src/storage/file.php | ezcCacheStorageFile.purgeRecursive | private function purgeRecursive( $dir, $limit, &$purgeCount )
{
$purgedIds = array();
// Deal with files in the directory
if ( ( $files = glob( "{$dir}*{$this->properties['options']->extension}" ) ) === false )
{
throw new ezcBaseFileNotFoundException(
$d... | php | private function purgeRecursive( $dir, $limit, &$purgeCount )
{
$purgedIds = array();
// Deal with files in the directory
if ( ( $files = glob( "{$dir}*{$this->properties['options']->extension}" ) ) === false )
{
throw new ezcBaseFileNotFoundException(
$d... | [
"private",
"function",
"purgeRecursive",
"(",
"$",
"dir",
",",
"$",
"limit",
",",
"&",
"$",
"purgeCount",
")",
"{",
"$",
"purgedIds",
"=",
"array",
"(",
")",
";",
"// Deal with files in the directory",
"if",
"(",
"(",
"$",
"files",
"=",
"glob",
"(",
"\"{... | Recursively purge cache items.
Recursively purges $dir until $limit is reached. $purgeCount is the
number of already purged items.
@param string $dir
@param int $limit
@param int $purgeCount | [
"Recursively",
"purge",
"cache",
"items",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Cache/src/storage/file.php#L423-L485 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Cache/src/storage/file.php | ezcCacheStorageFile.reset | public function reset()
{
$files = glob( "{$this->properties['location']}*" );
foreach ( $files as $file )
{
if ( is_dir( $file ) )
{
ezcBaseFile::removeRecursive( $file );
}
else
{
if ( @unlink( $fil... | php | public function reset()
{
$files = glob( "{$this->properties['location']}*" );
foreach ( $files as $file )
{
if ( is_dir( $file ) )
{
ezcBaseFile::removeRecursive( $file );
}
else
{
if ( @unlink( $fil... | [
"public",
"function",
"reset",
"(",
")",
"{",
"$",
"files",
"=",
"glob",
"(",
"\"{$this->properties['location']}*\"",
")",
";",
"foreach",
"(",
"$",
"files",
"as",
"$",
"file",
")",
"{",
"if",
"(",
"is_dir",
"(",
"$",
"file",
")",
")",
"{",
"ezcBaseFil... | Resets the whole storage.
Deletes all data in the storage including {@link ezcCacheStackMetaData}
that was stored using {@link storeMetaData()}. | [
"Resets",
"the",
"whole",
"storage",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Cache/src/storage/file.php#L493-L514 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Cache/src/storage/file.php | ezcCacheStorageFile.search | protected function search( $id = null, $attributes = array() )
{
$globArr = explode( "-", $this->generateIdentifier( $id, $attributes ), 2 );
if ( sizeof( $globArr ) > 1 )
{
$glob = $globArr[0] . "-" . strtr( $globArr[1], array( '-' => '*', '.' => '*' ) );
}
else... | php | protected function search( $id = null, $attributes = array() )
{
$globArr = explode( "-", $this->generateIdentifier( $id, $attributes ), 2 );
if ( sizeof( $globArr ) > 1 )
{
$glob = $globArr[0] . "-" . strtr( $globArr[1], array( '-' => '*', '.' => '*' ) );
}
else... | [
"protected",
"function",
"search",
"(",
"$",
"id",
"=",
"null",
",",
"$",
"attributes",
"=",
"array",
"(",
")",
")",
"{",
"$",
"globArr",
"=",
"explode",
"(",
"\"-\"",
",",
"$",
"this",
"->",
"generateIdentifier",
"(",
"$",
"id",
",",
"$",
"attribute... | Search the storage for data.
@param string $id An item ID.
@param array(string=>string) $attributes Attributes describing the
data to restore.
@return array(int=>string) Found cache items. | [
"Search",
"the",
"storage",
"for",
"data",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Cache/src/storage/file.php#L524-L537 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Cache/src/storage/file.php | ezcCacheStorageFile.searchRecursive | protected function searchRecursive( $pattern, $directory )
{
$itemArr = glob( $directory . $pattern );
$dirArr = glob( $directory . "*", GLOB_ONLYDIR );
foreach ( $dirArr as $dirEntry )
{
$result = $this->searchRecursive( $pattern, "$dirEntry/" );
$itemArr = a... | php | protected function searchRecursive( $pattern, $directory )
{
$itemArr = glob( $directory . $pattern );
$dirArr = glob( $directory . "*", GLOB_ONLYDIR );
foreach ( $dirArr as $dirEntry )
{
$result = $this->searchRecursive( $pattern, "$dirEntry/" );
$itemArr = a... | [
"protected",
"function",
"searchRecursive",
"(",
"$",
"pattern",
",",
"$",
"directory",
")",
"{",
"$",
"itemArr",
"=",
"glob",
"(",
"$",
"directory",
".",
"$",
"pattern",
")",
";",
"$",
"dirArr",
"=",
"glob",
"(",
"$",
"directory",
".",
"\"*\"",
",",
... | Search the storage for data recursively.
@param string $pattern Pattern used with {@link glob()}.
@param mixed $directory Directory to search in.
@return array(int=>string) Found cache items. | [
"Search",
"the",
"storage",
"for",
"data",
"recursively",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Cache/src/storage/file.php#L546-L556 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Cache/src/storage/file.php | ezcCacheStorageFile.generateIdentifier | public function generateIdentifier( $id, $attributes = null )
{
$filename = (string) $id;
$illegalFileNameChars = array(
' ' => '_',
'/' => DIRECTORY_SEPARATOR,
'\\' => DIRECTORY_SEPARATOR,
);
$filename = strtr( $filename, $illegalFileNameChars )... | php | public function generateIdentifier( $id, $attributes = null )
{
$filename = (string) $id;
$illegalFileNameChars = array(
' ' => '_',
'/' => DIRECTORY_SEPARATOR,
'\\' => DIRECTORY_SEPARATOR,
);
$filename = strtr( $filename, $illegalFileNameChars )... | [
"public",
"function",
"generateIdentifier",
"(",
"$",
"id",
",",
"$",
"attributes",
"=",
"null",
")",
"{",
"$",
"filename",
"=",
"(",
"string",
")",
"$",
"id",
";",
"$",
"illegalFileNameChars",
"=",
"array",
"(",
"' '",
"=>",
"'_'",
",",
"'/'",
"=>",
... | Generate the storage internal identifier from ID and attributes.
Generates the storage internal identifier out of the provided ID and the
attributes. This is the default implementation and can be overloaded if
necessary.
@param string $id The ID.
@param array(string=>string) $attributes Attri... | [
"Generate",
"the",
"storage",
"internal",
"identifier",
"from",
"ID",
"and",
"attributes",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Cache/src/storage/file.php#L622-L659 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Cache/src/storage/file.php | ezcCacheStorageFile.lock | public function lock()
{
$lockFile = $this->properties['location'] . $this->properties['options']->lockFile;
while ( $this->lockResource === false )
{
clearstatcache();
$this->lockResource = @fopen( $lockFile, 'x' );
// Wait for lock to get freed
... | php | public function lock()
{
$lockFile = $this->properties['location'] . $this->properties['options']->lockFile;
while ( $this->lockResource === false )
{
clearstatcache();
$this->lockResource = @fopen( $lockFile, 'x' );
// Wait for lock to get freed
... | [
"public",
"function",
"lock",
"(",
")",
"{",
"$",
"lockFile",
"=",
"$",
"this",
"->",
"properties",
"[",
"'location'",
"]",
".",
"$",
"this",
"->",
"properties",
"[",
"'options'",
"]",
"->",
"lockFile",
";",
"while",
"(",
"$",
"this",
"->",
"lockResour... | Acquire a lock on the storage.
This method acquires a lock on the storage. If locked, the storage must
block all other method calls until the lock is freed again using {@link
ezcCacheStackMetaDataStorage::unlock()}. Methods that are called within
the request that successfully acquired the lock must succeed as usual.
... | [
"Acquire",
"a",
"lock",
"on",
"the",
"storage",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Cache/src/storage/file.php#L720-L744 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Cache/src/storage/file.php | ezcCacheStorageFile.unlock | public function unlock()
{
// If the resource is already removed, nothing to do
if ( $this->lockResource !== false )
{
fclose( $this->lockResource );
@unlink(
$this->properties['location'] . $this->properties['options']->lockFile
);
... | php | public function unlock()
{
// If the resource is already removed, nothing to do
if ( $this->lockResource !== false )
{
fclose( $this->lockResource );
@unlink(
$this->properties['location'] . $this->properties['options']->lockFile
);
... | [
"public",
"function",
"unlock",
"(",
")",
"{",
"// If the resource is already removed, nothing to do",
"if",
"(",
"$",
"this",
"->",
"lockResource",
"!==",
"false",
")",
"{",
"fclose",
"(",
"$",
"this",
"->",
"lockResource",
")",
";",
"@",
"unlink",
"(",
"$",
... | Release a lock on the storage.
This method releases the lock of the storage, that has been acquired via
{@link ezcCacheStackMetaDataStorage::lock()}. After this method has been
called, blocked method calls (including calls to lock()) can suceed
again.
@return void | [
"Release",
"a",
"lock",
"on",
"the",
"storage",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Cache/src/storage/file.php#L756-L767 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Cache/src/storage/file.php | ezcCacheStorageFile.setOptions | public function setOptions( $options )
{
if ( is_array( $options ) )
{
$this->properties['options']->merge( $options );
}
else if ( $options instanceof ezcCacheStorageFileOptions )
{
$this->properties['options'] = $options;
}
else if ( ... | php | public function setOptions( $options )
{
if ( is_array( $options ) )
{
$this->properties['options']->merge( $options );
}
else if ( $options instanceof ezcCacheStorageFileOptions )
{
$this->properties['options'] = $options;
}
else if ( ... | [
"public",
"function",
"setOptions",
"(",
"$",
"options",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"options",
")",
")",
"{",
"$",
"this",
"->",
"properties",
"[",
"'options'",
"]",
"->",
"merge",
"(",
"$",
"options",
")",
";",
"}",
"else",
"if",
"... | Set new options.
This method allows you to change the options of a cache file storage. Change
of options take effect directly after this method has been called. The
available options depend on the ezcCacheStorageFile implementation. All
implementations have to offer the following options:
- ttl The time-to-lif... | [
"Set",
"new",
"options",
".",
"This",
"method",
"allows",
"you",
"to",
"change",
"the",
"options",
"of",
"a",
"cache",
"file",
"storage",
".",
"Change",
"of",
"options",
"take",
"effect",
"directly",
"after",
"this",
"method",
"has",
"been",
"called",
".",... | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Cache/src/storage/file.php#L804-L826 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Cache/src/storage/file.php | ezcCacheStorageFile.calcLifetime | protected function calcLifetime( $file )
{
$ttl = $this->options->ttl;
if ( file_exists( $file ) && ( $modTime = filemtime( $file ) ) !== false )
{
if ( $ttl === false )
{
return 1;
}
return (
( $lifeTime = time(... | php | protected function calcLifetime( $file )
{
$ttl = $this->options->ttl;
if ( file_exists( $file ) && ( $modTime = filemtime( $file ) ) !== false )
{
if ( $ttl === false )
{
return 1;
}
return (
( $lifeTime = time(... | [
"protected",
"function",
"calcLifetime",
"(",
"$",
"file",
")",
"{",
"$",
"ttl",
"=",
"$",
"this",
"->",
"options",
"->",
"ttl",
";",
"if",
"(",
"file_exists",
"(",
"$",
"file",
")",
"&&",
"(",
"$",
"modTime",
"=",
"filemtime",
"(",
"$",
"file",
")... | Calculates the lifetime remaining for a cache object.
This calculates the time a cached object stays valid and returns it. In
case the TTL is set to false, this method always returns a value of 1.
@param string $file The file to calculate the remaining lifetime for.
@return int The remaining lifetime in seconds (0 if... | [
"Calculates",
"the",
"lifetime",
"remaining",
"for",
"a",
"cache",
"object",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Cache/src/storage/file.php#L872-L888 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Cache/src/storage/file.php | ezcCacheStorageFile.extractIdentifier | private function extractIdentifier( $filename )
{
// Regex to split up the file name into id, attributes and extension
$regex = '(
(?:' . preg_quote( $this->properties['location'] ) . ')
(?P<id>.*)
(?P<attr>(?:-[^-=]+=[^-]+)*)
-? # This is added if no ... | php | private function extractIdentifier( $filename )
{
// Regex to split up the file name into id, attributes and extension
$regex = '(
(?:' . preg_quote( $this->properties['location'] ) . ')
(?P<id>.*)
(?P<attr>(?:-[^-=]+=[^-]+)*)
-? # This is added if no ... | [
"private",
"function",
"extractIdentifier",
"(",
"$",
"filename",
")",
"{",
"// Regex to split up the file name into id, attributes and extension",
"$",
"regex",
"=",
"'(\n (?:'",
".",
"preg_quote",
"(",
"$",
"this",
"->",
"properties",
"[",
"'location'",
"]",
... | Extracts ID, attributes and the file extension from a filename.
@param string $filename
@return array('id'=>string,'attributes'=>string,'ext'=>string) | [
"Extracts",
"ID",
"attributes",
"and",
"the",
"file",
"extension",
"from",
"a",
"filename",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Cache/src/storage/file.php#L896-L925 |
dreamfactorysoftware/df-cache | src/Models/RedisConfig.php | RedisConfig.fromJson | public function fromJson($value, $asObject = false)
{
$value = json_decode($value, !$asObject);
if (is_array($value) && isset($value['ssl'])) {
if (!is_array($value['ssl'])) {
$value['ssl'] = json_decode($value['ssl'], true);
}
}
return $valu... | php | public function fromJson($value, $asObject = false)
{
$value = json_decode($value, !$asObject);
if (is_array($value) && isset($value['ssl'])) {
if (!is_array($value['ssl'])) {
$value['ssl'] = json_decode($value['ssl'], true);
}
}
return $valu... | [
"public",
"function",
"fromJson",
"(",
"$",
"value",
",",
"$",
"asObject",
"=",
"false",
")",
"{",
"$",
"value",
"=",
"json_decode",
"(",
"$",
"value",
",",
"!",
"$",
"asObject",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"value",
")",
"&&",
"isset... | {@inheritdoc} | [
"{"
] | train | https://github.com/dreamfactorysoftware/df-cache/blob/6a2aa5dc2fc7963ce89fd7e8f3d51483d2499451/src/Models/RedisConfig.php#L26-L37 |
raideer/twitch-api | src/Resources/Blocks.php | Blocks.getBlockedUsers | public function getBlockedUsers($channel, $params = [])
{
$this->wrapper->checkScope('user_blocks_read');
$defaults = [
'limit' => 25,
'offset' => 0,
];
return $this->wrapper->request('GET', "users/$channel/blocks", ['query' => $this->resolveOptions($params, $defaults)], true);
... | php | public function getBlockedUsers($channel, $params = [])
{
$this->wrapper->checkScope('user_blocks_read');
$defaults = [
'limit' => 25,
'offset' => 0,
];
return $this->wrapper->request('GET', "users/$channel/blocks", ['query' => $this->resolveOptions($params, $defaults)], true);
... | [
"public",
"function",
"getBlockedUsers",
"(",
"$",
"channel",
",",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"$",
"this",
"->",
"wrapper",
"->",
"checkScope",
"(",
"'user_blocks_read'",
")",
";",
"$",
"defaults",
"=",
"[",
"'limit'",
"=>",
"25",
",",
"'o... | AUTHENTICATED REQUEST.
Returns a list of blocks objects on authenticated user's block list.
Sorted by recency, newest first.
Required scope: user_blocks_read
Learn more:
https://github.com/justintv/Twitch-API/blob/master/v3_resources/blocks.md#get-usersuserblocks
@param string $channel Target Channel name
@param ... | [
"AUTHENTICATED",
"REQUEST",
"."
] | train | https://github.com/raideer/twitch-api/blob/27ebf1dcb0315206300d507600b6a82ebe33d57e/src/Resources/Blocks.php#L36-L46 |
raideer/twitch-api | src/Resources/Blocks.php | Blocks.blockUser | public function blockUser($channel, $target)
{
$this->wrapper->checkScope('user_blocks_edit');
return $this->wrapper->request('PUT', "users/$channel/blocks/$target", [], true);
} | php | public function blockUser($channel, $target)
{
$this->wrapper->checkScope('user_blocks_edit');
return $this->wrapper->request('PUT', "users/$channel/blocks/$target", [], true);
} | [
"public",
"function",
"blockUser",
"(",
"$",
"channel",
",",
"$",
"target",
")",
"{",
"$",
"this",
"->",
"wrapper",
"->",
"checkScope",
"(",
"'user_blocks_edit'",
")",
";",
"return",
"$",
"this",
"->",
"wrapper",
"->",
"request",
"(",
"'PUT'",
",",
"\"us... | AUTHENTICATED REQUEST.
Adds $target to authenticated user's block list. Returns a blocks object.
Required scope: user_blocks_edit
Learn more:
https://github.com/justintv/Twitch-API/blob/master/v3_resources/blocks.md#put-usersuserblockstarget
@param string $channel Target Channel name
@param string $target Target ... | [
"AUTHENTICATED",
"REQUEST",
"."
] | train | https://github.com/raideer/twitch-api/blob/27ebf1dcb0315206300d507600b6a82ebe33d57e/src/Resources/Blocks.php#L63-L68 |
raideer/twitch-api | src/Resources/Blocks.php | Blocks.unblockUser | public function unblockUser($user, $target)
{
$this->wrapper->checkScope('user_blocks_edit');
return $this->wrapper->request('DELETE', "users/$user/blocks/$target", [], true);
} | php | public function unblockUser($user, $target)
{
$this->wrapper->checkScope('user_blocks_edit');
return $this->wrapper->request('DELETE', "users/$user/blocks/$target", [], true);
} | [
"public",
"function",
"unblockUser",
"(",
"$",
"user",
",",
"$",
"target",
")",
"{",
"$",
"this",
"->",
"wrapper",
"->",
"checkScope",
"(",
"'user_blocks_edit'",
")",
";",
"return",
"$",
"this",
"->",
"wrapper",
"->",
"request",
"(",
"'DELETE'",
",",
"\"... | AUTHENTICATED REQUEST.
Removes $target from $user's block list.
Required scope: user_blocks_edit
Learn more:
https://github.com/justintv/Twitch-API/blob/master/v3_resources/blocks.md#delete-usersuserblockstarget
@param string $user Target Channel name
@param string $target Target username
@return array | [
"AUTHENTICATED",
"REQUEST",
"."
] | train | https://github.com/raideer/twitch-api/blob/27ebf1dcb0315206300d507600b6a82ebe33d57e/src/Resources/Blocks.php#L85-L90 |
ouropencode/dachi | src/Kernel.php | Kernel.initialize | public static function initialize() {
if(defined('DACHI_KERNEL'))
return false;
define('DACHI_KERNEL', true);
require_once('Kernel.functions.php');
getExecutionTime();
date_default_timezone_set(Configuration::get('dachi.timezone'));
error_reporting(-1);
define('WORKING_DIRECTORY', getcwd());
Sess... | php | public static function initialize() {
if(defined('DACHI_KERNEL'))
return false;
define('DACHI_KERNEL', true);
require_once('Kernel.functions.php');
getExecutionTime();
date_default_timezone_set(Configuration::get('dachi.timezone'));
error_reporting(-1);
define('WORKING_DIRECTORY', getcwd());
Sess... | [
"public",
"static",
"function",
"initialize",
"(",
")",
"{",
"if",
"(",
"defined",
"(",
"'DACHI_KERNEL'",
")",
")",
"return",
"false",
";",
"define",
"(",
"'DACHI_KERNEL'",
",",
"true",
")",
";",
"require_once",
"(",
"'Kernel.functions.php'",
")",
";",
"getE... | Initialize the Dachi kernel.
@return null | [
"Initialize",
"the",
"Dachi",
"kernel",
"."
] | train | https://github.com/ouropencode/dachi/blob/a0e1daf269d0345afbb859ce20ef9da6decd7efe/src/Kernel.php#L26-L40 |
ouropencode/dachi | src/Kernel.php | Kernel.getEnvironment | public static function getEnvironment($forceCheck = false) {
if(self::$environment && !$forceCheck)
return self::$environment;
self::$environment = "local";
if(file_exists("dachi_environment"))
self::$environment = trim(file_get_contents("dachi_environment"));
return self::$environment;
} | php | public static function getEnvironment($forceCheck = false) {
if(self::$environment && !$forceCheck)
return self::$environment;
self::$environment = "local";
if(file_exists("dachi_environment"))
self::$environment = trim(file_get_contents("dachi_environment"));
return self::$environment;
} | [
"public",
"static",
"function",
"getEnvironment",
"(",
"$",
"forceCheck",
"=",
"false",
")",
"{",
"if",
"(",
"self",
"::",
"$",
"environment",
"&&",
"!",
"$",
"forceCheck",
")",
"return",
"self",
"::",
"$",
"environment",
";",
"self",
"::",
"$",
"environ... | Get the current environment we are executing in.
This is only available if running via the internal LemonDigits.com build toolkit, or if
your CI can be configured to output the environment to the 'dachi_environment' file.
(this could also be done manually by a developer during deployment)
@param bool $forceCheck Shou... | [
"Get",
"the",
"current",
"environment",
"we",
"are",
"executing",
"in",
"."
] | train | https://github.com/ouropencode/dachi/blob/a0e1daf269d0345afbb859ce20ef9da6decd7efe/src/Kernel.php#L52-L62 |
ouropencode/dachi | src/Kernel.php | Kernel.getGitHash | public static function getGitHash($forceCheck = false) {
if(self::$git_hash && !$forceCheck)
return self::$git_hash;
self::$git_hash = "ffffff";
if(file_exists("dachi_git_hash"))
self::$git_hash = trim(file_get_contents("dachi_git_hash"));
return self::$git_hash;
} | php | public static function getGitHash($forceCheck = false) {
if(self::$git_hash && !$forceCheck)
return self::$git_hash;
self::$git_hash = "ffffff";
if(file_exists("dachi_git_hash"))
self::$git_hash = trim(file_get_contents("dachi_git_hash"));
return self::$git_hash;
} | [
"public",
"static",
"function",
"getGitHash",
"(",
"$",
"forceCheck",
"=",
"false",
")",
"{",
"if",
"(",
"self",
"::",
"$",
"git_hash",
"&&",
"!",
"$",
"forceCheck",
")",
"return",
"self",
"::",
"$",
"git_hash",
";",
"self",
"::",
"$",
"git_hash",
"=",... | Get the current short git hash for the revision of code we are executing.
This is only available if running via the internal LemonDigits.com build toolkit, or if
your CI can be configured to output the short hash (6-chars) to the 'dachi_git_hash' file
(this could also be done manually by a developer during deployment)... | [
"Get",
"the",
"current",
"short",
"git",
"hash",
"for",
"the",
"revision",
"of",
"code",
"we",
"are",
"executing",
"."
] | train | https://github.com/ouropencode/dachi/blob/a0e1daf269d0345afbb859ce20ef9da6decd7efe/src/Kernel.php#L74-L84 |
ouropencode/dachi | src/Kernel.php | Kernel.getVersion | public static function getVersion($fullVersion = false) {
return ($fullVersion ? ("v" . self::$version . "." . self::$version_patch) : self::$version);
} | php | public static function getVersion($fullVersion = false) {
return ($fullVersion ? ("v" . self::$version . "." . self::$version_patch) : self::$version);
} | [
"public",
"static",
"function",
"getVersion",
"(",
"$",
"fullVersion",
"=",
"false",
")",
"{",
"return",
"(",
"$",
"fullVersion",
"?",
"(",
"\"v\"",
".",
"self",
"::",
"$",
"version",
".",
"\".\"",
".",
"self",
"::",
"$",
"version_patch",
")",
":",
"se... | Get the Dachi version.
@param bool $fullVersion If TRUE, outputs the whole version number (including patch). If FALSE, only outputs the major version.
@return string | [
"Get",
"the",
"Dachi",
"version",
"."
] | train | https://github.com/ouropencode/dachi/blob/a0e1daf269d0345afbb859ce20ef9da6decd7efe/src/Kernel.php#L91-L93 |
songshenzong/log | src/Bridge/PropelCollector.php | PropelCollector.convertLogLevel | protected function convertLogLevel($level)
{
$map = [
Propel::LOG_EMERG => LogLevel::EMERGENCY,
Propel::LOG_ALERT => LogLevel::ALERT,
Propel::LOG_CRIT => LogLevel::CRITICAL,
Propel::LOG_ERR => LogLevel::ERROR,
Propel::LOG_WARNING => LogL... | php | protected function convertLogLevel($level)
{
$map = [
Propel::LOG_EMERG => LogLevel::EMERGENCY,
Propel::LOG_ALERT => LogLevel::ALERT,
Propel::LOG_CRIT => LogLevel::CRITICAL,
Propel::LOG_ERR => LogLevel::ERROR,
Propel::LOG_WARNING => LogL... | [
"protected",
"function",
"convertLogLevel",
"(",
"$",
"level",
")",
"{",
"$",
"map",
"=",
"[",
"Propel",
"::",
"LOG_EMERG",
"=>",
"LogLevel",
"::",
"EMERGENCY",
",",
"Propel",
"::",
"LOG_ALERT",
"=>",
"LogLevel",
"::",
"ALERT",
",",
"Propel",
"::",
"LOG_CR... | Converts Propel log levels to PSR log levels
@param int $level
@return string | [
"Converts",
"Propel",
"log",
"levels",
"to",
"PSR",
"log",
"levels"
] | train | https://github.com/songshenzong/log/blob/b1e01f7994da47737866eabf82367490eab17c46/src/Bridge/PropelCollector.php#L207-L219 |
songshenzong/log | src/Bridge/PropelCollector.php | PropelCollector.parseAndLogSqlQuery | protected function parseAndLogSqlQuery($message)
{
$parts = explode('|', $message, 4);
$sql = trim($parts[3]);
$duration = 0;
if (preg_match('/([0-9]+\.[0-9]+)/', $parts[1], $matches)) {
$duration = (float) $matches[1];
}
$memory = 0;
if (preg_... | php | protected function parseAndLogSqlQuery($message)
{
$parts = explode('|', $message, 4);
$sql = trim($parts[3]);
$duration = 0;
if (preg_match('/([0-9]+\.[0-9]+)/', $parts[1], $matches)) {
$duration = (float) $matches[1];
}
$memory = 0;
if (preg_... | [
"protected",
"function",
"parseAndLogSqlQuery",
"(",
"$",
"message",
")",
"{",
"$",
"parts",
"=",
"explode",
"(",
"'|'",
",",
"$",
"message",
",",
"4",
")",
";",
"$",
"sql",
"=",
"trim",
"(",
"$",
"parts",
"[",
"3",
"]",
")",
";",
"$",
"duration",
... | Parse a log line to extract query information
@param string $message
@return array | [
"Parse",
"a",
"log",
"line",
"to",
"extract",
"query",
"information"
] | train | https://github.com/songshenzong/log/blob/b1e01f7994da47737866eabf82367490eab17c46/src/Bridge/PropelCollector.php#L228-L259 |
heidelpay/PhpDoc | src/phpDocumentor/Configuration/Loader.php | Loader.load | public function load($templatePath, $userConfigurationPath, $class = 'phpDocumentor\Configuration')
{
$userConfigFilePath = $this->fetchUserConfigFileFromCommandLineOptions();
if ($this->isValidFile($userConfigFilePath)) {
chdir(dirname($userConfigFilePath));
} else {
... | php | public function load($templatePath, $userConfigurationPath, $class = 'phpDocumentor\Configuration')
{
$userConfigFilePath = $this->fetchUserConfigFileFromCommandLineOptions();
if ($this->isValidFile($userConfigFilePath)) {
chdir(dirname($userConfigFilePath));
} else {
... | [
"public",
"function",
"load",
"(",
"$",
"templatePath",
",",
"$",
"userConfigurationPath",
",",
"$",
"class",
"=",
"'phpDocumentor\\Configuration'",
")",
"{",
"$",
"userConfigFilePath",
"=",
"$",
"this",
"->",
"fetchUserConfigFileFromCommandLineOptions",
"(",
")",
"... | Loads the configuration from the provided paths and returns a populated configuration object.
@param string $templatePath Path to configuration file containing default settings.
@param string $userConfigurationPath Path to a file containing user overrides.
@param string $class The class to ins... | [
"Loads",
"the",
"configuration",
"from",
"the",
"provided",
"paths",
"and",
"returns",
"a",
"populated",
"configuration",
"object",
"."
] | train | https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Configuration/Loader.php#L52-L63 |
heidelpay/PhpDoc | src/phpDocumentor/Configuration/Loader.php | Loader.fetchUserConfigFileFromCommandLineOptions | private function fetchUserConfigFileFromCommandLineOptions()
{
$input = new ArgvInput();
$userConfigFilePath = $input->getParameterOption('--config');
if (!$userConfigFilePath) {
$userConfigFilePath = $input->getParameterOption('-c');
}
if ($userConfigFilePath !... | php | private function fetchUserConfigFileFromCommandLineOptions()
{
$input = new ArgvInput();
$userConfigFilePath = $input->getParameterOption('--config');
if (!$userConfigFilePath) {
$userConfigFilePath = $input->getParameterOption('-c');
}
if ($userConfigFilePath !... | [
"private",
"function",
"fetchUserConfigFileFromCommandLineOptions",
"(",
")",
"{",
"$",
"input",
"=",
"new",
"ArgvInput",
"(",
")",
";",
"$",
"userConfigFilePath",
"=",
"$",
"input",
"->",
"getParameterOption",
"(",
"'--config'",
")",
";",
"if",
"(",
"!",
"$",... | Reads the `--config`, or `-c`, command line option and returns a path to the configuration file from those
options or false if no existing path was given.
@return bool|string | [
"Reads",
"the",
"--",
"config",
"or",
"-",
"c",
"command",
"line",
"option",
"and",
"returns",
"a",
"path",
"to",
"the",
"configuration",
"file",
"from",
"those",
"options",
"or",
"false",
"if",
"no",
"existing",
"path",
"was",
"given",
"."
] | train | https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Configuration/Loader.php#L71-L85 |
heidelpay/PhpDoc | src/phpDocumentor/Configuration/Loader.php | Loader.createConfigurationObject | private function createConfigurationObject($templatePath, $defaultUserConfigPath, $customUserConfigPath, $class)
{
$config = $this->serializer->deserialize(file_get_contents($templatePath), $class, 'xml');
$customUserConfigPath = $customUserConfigPath ? : $defaultUserConfigPath;
if ($custom... | php | private function createConfigurationObject($templatePath, $defaultUserConfigPath, $customUserConfigPath, $class)
{
$config = $this->serializer->deserialize(file_get_contents($templatePath), $class, 'xml');
$customUserConfigPath = $customUserConfigPath ? : $defaultUserConfigPath;
if ($custom... | [
"private",
"function",
"createConfigurationObject",
"(",
"$",
"templatePath",
",",
"$",
"defaultUserConfigPath",
",",
"$",
"customUserConfigPath",
",",
"$",
"class",
")",
"{",
"$",
"config",
"=",
"$",
"this",
"->",
"serializer",
"->",
"deserialize",
"(",
"file_g... | Combines the given configuration files and serializes a new Configuration object from them.
@param string $templatePath Path to the template configuration file.
@param string $defaultUserConfigPath Path to the phpdoc.xml or phpdoc,dist.xml in the current working
directory.
@param null|bool... | [
"Combines",
"the",
"given",
"configuration",
"files",
"and",
"serializes",
"a",
"new",
"Configuration",
"object",
"from",
"them",
"."
] | train | https://github.com/heidelpay/PhpDoc/blob/5ac9e842cbd4cbb70900533b240c131f3515ee02/src/phpDocumentor/Configuration/Loader.php#L110-L122 |
zhouyl/mellivora | Mellivora/Database/Schema/PostgresBuilder.php | PostgresBuilder.hasTable | public function hasTable($table)
{
if (is_array($schema = $this->connection->getConfig('schema'))) {
$schema = head($schema);
}
$table = $this->connection->getTablePrefix() . $table;
return count($this->connection->select(
$this->grammar->compileTableExists(... | php | public function hasTable($table)
{
if (is_array($schema = $this->connection->getConfig('schema'))) {
$schema = head($schema);
}
$table = $this->connection->getTablePrefix() . $table;
return count($this->connection->select(
$this->grammar->compileTableExists(... | [
"public",
"function",
"hasTable",
"(",
"$",
"table",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"schema",
"=",
"$",
"this",
"->",
"connection",
"->",
"getConfig",
"(",
"'schema'",
")",
")",
")",
"{",
"$",
"schema",
"=",
"head",
"(",
"$",
"schema",
... | Determine if the given table exists.
@param string $table
@return bool | [
"Determine",
"if",
"the",
"given",
"table",
"exists",
"."
] | train | https://github.com/zhouyl/mellivora/blob/79f844c5c9c25ffbe18d142062e9bc3df00b36a1/Mellivora/Database/Schema/PostgresBuilder.php#L14-L26 |
10quality/wp-file | src/File.php | File.authenticate | public function authenticate( $url = null )
{
if ( empty( $url ) )
$url = site_url() . '/wp-admin/';
if ( ! function_exists( 'get_filesystem_method' ) )
require_once( get_wp_home_path().'/wp-admin/includes/file.php' );
if ( ! function_exists( 'submit_button' ) )
... | php | public function authenticate( $url = null )
{
if ( empty( $url ) )
$url = site_url() . '/wp-admin/';
if ( ! function_exists( 'get_filesystem_method' ) )
require_once( get_wp_home_path().'/wp-admin/includes/file.php' );
if ( ! function_exists( 'submit_button' ) )
... | [
"public",
"function",
"authenticate",
"(",
"$",
"url",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"url",
")",
")",
"$",
"url",
"=",
"site_url",
"(",
")",
".",
"'/wp-admin/'",
";",
"if",
"(",
"!",
"function_exists",
"(",
"'get_filesystem_metho... | Authenticates with wordpress and validates filesystem credentials.
@since 0.9.0
@since 0.9.2 Bug fix for when functions are not loaded.
@since 0.9.4 Bug fix missing "submit_button".
@param string $url Url to authenticate with. | [
"Authenticates",
"with",
"wordpress",
"and",
"validates",
"filesystem",
"credentials",
".",
"@since",
"0",
".",
"9",
".",
"0",
"@since",
"0",
".",
"9",
".",
"2",
"Bug",
"fix",
"for",
"when",
"functions",
"are",
"not",
"loaded",
".",
"@since",
"0",
".",
... | train | https://github.com/10quality/wp-file/blob/282f0f6733a9e18b392a8b9999dcd8949275a77b/src/File.php#L57-L76 |
10quality/wp-file | src/File.php | File.write | public function write( $filename, $content )
{
if (!$this->authenticated) return false;
global $wp_filesystem;
return $wp_filesystem->put_contents(
$filename,
$content,
defined( FS_CHMOD_FILE ) ? FS_CHMOD_FILE : ( 0644 & ~ umask() )
);
} | php | public function write( $filename, $content )
{
if (!$this->authenticated) return false;
global $wp_filesystem;
return $wp_filesystem->put_contents(
$filename,
$content,
defined( FS_CHMOD_FILE ) ? FS_CHMOD_FILE : ( 0644 & ~ umask() )
);
} | [
"public",
"function",
"write",
"(",
"$",
"filename",
",",
"$",
"content",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"authenticated",
")",
"return",
"false",
";",
"global",
"$",
"wp_filesystem",
";",
"return",
"$",
"wp_filesystem",
"->",
"put_contents",
... | Writes content in a file.
@since 0.9.0
@since 0.9.3 Fixes undefined constant FS_CHMOD_FILE.
@global $wp_filesytem
@param string $filename File name.
@param mixed $content File content. | [
"Writes",
"content",
"in",
"a",
"file",
".",
"@since",
"0",
".",
"9",
".",
"0",
"@since",
"0",
".",
"9",
".",
"3",
"Fixes",
"undefined",
"constant",
"FS_CHMOD_FILE",
"."
] | train | https://github.com/10quality/wp-file/blob/282f0f6733a9e18b392a8b9999dcd8949275a77b/src/File.php#L106-L115 |
hametuha/wpametu | src/WPametu/UI/Field/Base.php | Base.render | public function render( \WP_Post $post = null ){
$required = $this->get_required($post);
$label = esc_html($this->label);
$desc_str = $this->description;
$desc = !empty($desc_str) ? sprintf('<p class="description">%s</p>', $this->description) : '';
$input = $this->get_field($post... | php | public function render( \WP_Post $post = null ){
$required = $this->get_required($post);
$label = esc_html($this->label);
$desc_str = $this->description;
$desc = !empty($desc_str) ? sprintf('<p class="description">%s</p>', $this->description) : '';
$input = $this->get_field($post... | [
"public",
"function",
"render",
"(",
"\\",
"WP_Post",
"$",
"post",
"=",
"null",
")",
"{",
"$",
"required",
"=",
"$",
"this",
"->",
"get_required",
"(",
"$",
"post",
")",
";",
"$",
"label",
"=",
"esc_html",
"(",
"$",
"this",
"->",
"label",
")",
";",... | Render input field
@param \WP_Post $post | [
"Render",
"input",
"field"
] | train | https://github.com/hametuha/wpametu/blob/0939373800815a8396291143d2a57967340da5aa/src/WPametu/UI/Field/Base.php#L74-L81 |
hametuha/wpametu | src/WPametu/UI/Field/Base.php | Base.get_data | protected function get_data( \WP_Post $post ){
switch( $this->name ){
case 'excerpt':
return $post->post_excerpt;
break;
default:
if( false !== array_search(Taxonomy::class, class_uses(get_called_class())) ){
// This is ... | php | protected function get_data( \WP_Post $post ){
switch( $this->name ){
case 'excerpt':
return $post->post_excerpt;
break;
default:
if( false !== array_search(Taxonomy::class, class_uses(get_called_class())) ){
// This is ... | [
"protected",
"function",
"get_data",
"(",
"\\",
"WP_Post",
"$",
"post",
")",
"{",
"switch",
"(",
"$",
"this",
"->",
"name",
")",
"{",
"case",
"'excerpt'",
":",
"return",
"$",
"post",
"->",
"post_excerpt",
";",
"break",
";",
"default",
":",
"if",
"(",
... | Get saved data
@param \WP_Post $post
@return mixed | [
"Get",
"saved",
"data"
] | train | https://github.com/hametuha/wpametu/blob/0939373800815a8396291143d2a57967340da5aa/src/WPametu/UI/Field/Base.php#L131-L154 |
hametuha/wpametu | src/WPametu/UI/Field/Base.php | Base.update | public function update($value, \WP_Post $post = null){
if( $this->validate($value) ){
$this->save($value, $post);
}
} | php | public function update($value, \WP_Post $post = null){
if( $this->validate($value) ){
$this->save($value, $post);
}
} | [
"public",
"function",
"update",
"(",
"$",
"value",
",",
"\\",
"WP_Post",
"$",
"post",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"validate",
"(",
"$",
"value",
")",
")",
"{",
"$",
"this",
"->",
"save",
"(",
"$",
"value",
",",
"$",
"po... | Save data as value
@param mixed $value
@param \WP_Post $post | [
"Save",
"data",
"as",
"value"
] | train | https://github.com/hametuha/wpametu/blob/0939373800815a8396291143d2a57967340da5aa/src/WPametu/UI/Field/Base.php#L162-L166 |
hametuha/wpametu | src/WPametu/UI/Field/Base.php | Base.save | protected function save($value, \WP_Post $post = null){
update_post_meta($post->ID, $this->name, $value);
} | php | protected function save($value, \WP_Post $post = null){
update_post_meta($post->ID, $this->name, $value);
} | [
"protected",
"function",
"save",
"(",
"$",
"value",
",",
"\\",
"WP_Post",
"$",
"post",
"=",
"null",
")",
"{",
"update_post_meta",
"(",
"$",
"post",
"->",
"ID",
",",
"$",
"this",
"->",
"name",
",",
"$",
"value",
")",
";",
"}"
] | Save post data
@param mixed $value
@param \WP_Post $post | [
"Save",
"post",
"data"
] | train | https://github.com/hametuha/wpametu/blob/0939373800815a8396291143d2a57967340da5aa/src/WPametu/UI/Field/Base.php#L174-L176 |
mauretto78/array-query | src/QueryBuilder.php | QueryBuilder.sortedBy | public function sortedBy($key, $operator = 'ASC', $format = null)
{
if (!$this->isAValidSortingOperator($operator)) {
throw new NotValidSortingOperatorException($operator.' is not a valid sorting operator.');
}
$this->sortedBy = [
'key' => $key,
'order' =... | php | public function sortedBy($key, $operator = 'ASC', $format = null)
{
if (!$this->isAValidSortingOperator($operator)) {
throw new NotValidSortingOperatorException($operator.' is not a valid sorting operator.');
}
$this->sortedBy = [
'key' => $key,
'order' =... | [
"public",
"function",
"sortedBy",
"(",
"$",
"key",
",",
"$",
"operator",
"=",
"'ASC'",
",",
"$",
"format",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isAValidSortingOperator",
"(",
"$",
"operator",
")",
")",
"{",
"throw",
"new",
"NotV... | @param $key
@param string $operator
@return $this
@throws NotValidSortingOperatorException | [
"@param",
"$key",
"@param",
"string",
"$operator"
] | train | https://github.com/mauretto78/array-query/blob/f6079258c8c6eea67e05a671a3f85dd28c4f5915/src/QueryBuilder.php#L159-L172 |
mauretto78/array-query | src/QueryBuilder.php | QueryBuilder.join | public function join($array, $arrayName, $parentKey, $foreignKey)
{
$this->join[] = [
'array' => $array,
'arrayName' => $arrayName,
'parentKey' => $parentKey,
'foreignKey' => $foreignKey,
];
return $this;
} | php | public function join($array, $arrayName, $parentKey, $foreignKey)
{
$this->join[] = [
'array' => $array,
'arrayName' => $arrayName,
'parentKey' => $parentKey,
'foreignKey' => $foreignKey,
];
return $this;
} | [
"public",
"function",
"join",
"(",
"$",
"array",
",",
"$",
"arrayName",
",",
"$",
"parentKey",
",",
"$",
"foreignKey",
")",
"{",
"$",
"this",
"->",
"join",
"[",
"]",
"=",
"[",
"'array'",
"=>",
"$",
"array",
",",
"'arrayName'",
"=>",
"$",
"arrayName",... | @param $array
@param $arrayName
@param $parentKey
@param $foreignKey
@return $this | [
"@param",
"$array",
"@param",
"$arrayName",
"@param",
"$parentKey",
"@param",
"$foreignKey"
] | train | https://github.com/mauretto78/array-query/blob/f6079258c8c6eea67e05a671a3f85dd28c4f5915/src/QueryBuilder.php#L223-L233 |
Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Database/src/sqlabstraction/implementations/utilities_pgsql.php | ezcDbUtilitiesPgsql.cleanup | public function cleanup()
{
$this->db->beginTransaction();
// drop tables
$rslt = $this->db->query( "SELECT tablename FROM pg_tables WHERE schemaname = 'public' AND tablename NOT LIKE 'pg_%'" );
$rslt->setFetchMode( PDO::FETCH_NUM );
$rows = $rslt->fetchAll();
unset(... | php | public function cleanup()
{
$this->db->beginTransaction();
// drop tables
$rslt = $this->db->query( "SELECT tablename FROM pg_tables WHERE schemaname = 'public' AND tablename NOT LIKE 'pg_%'" );
$rslt->setFetchMode( PDO::FETCH_NUM );
$rows = $rslt->fetchAll();
unset(... | [
"public",
"function",
"cleanup",
"(",
")",
"{",
"$",
"this",
"->",
"db",
"->",
"beginTransaction",
"(",
")",
";",
"// drop tables",
"$",
"rslt",
"=",
"$",
"this",
"->",
"db",
"->",
"query",
"(",
"\"SELECT tablename FROM pg_tables WHERE schemaname = 'public' AND ta... | Remove all tables from the database. | [
"Remove",
"all",
"tables",
"from",
"the",
"database",
"."
] | train | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Database/src/sqlabstraction/implementations/utilities_pgsql.php#L41-L69 |
alevilar/ristorantino-vendor | Printers/Lib/DriverView/Helper/HasarSMHP321fFiscalHelper.php | HasarSMHP321fFiscalHelper.printLineItem | public function printLineItem($descripcion_articulo, $cantidad, $monto, $porcentaje_iva = 21, $suma = true, $impuesto_interno = 0, $display = 0, $precio_total = true){
$fs = $this->cm('FS');
$descripcion_articulo = substr($descripcion_articulo,0,23);
if(!is_numeric($cantidad)) return false;
if(!is_numeric($m... | php | public function printLineItem($descripcion_articulo, $cantidad, $monto, $porcentaje_iva = 21, $suma = true, $impuesto_interno = 0, $display = 0, $precio_total = true){
$fs = $this->cm('FS');
$descripcion_articulo = substr($descripcion_articulo,0,23);
if(!is_numeric($cantidad)) return false;
if(!is_numeric($m... | [
"public",
"function",
"printLineItem",
"(",
"$",
"descripcion_articulo",
",",
"$",
"cantidad",
",",
"$",
"monto",
",",
"$",
"porcentaje_iva",
"=",
"21",
",",
"$",
"suma",
"=",
"true",
",",
"$",
"impuesto_interno",
"=",
"0",
",",
"$",
"display",
"=",
"0",... | Imprime un articulo, o sea una linea del articulo con su description y su precio, cantidad, etc
@param string $descripcion_articulo descripcion del articulo EJ: Coca-Cola hasta 23 caracteres
@param number $cantidad puede ser un entero o un float depende de la impresora
@param number $monto float o integer depende de l... | [
"Imprime",
"un",
"articulo",
"o",
"sea",
"una",
"linea",
"del",
"articulo",
"con",
"su",
"description",
"y",
"su",
"precio",
"cantidad",
"etc"
] | train | https://github.com/alevilar/ristorantino-vendor/blob/6b91a1e20cc0ba09a1968d77e3de6512cfa2d966/Printers/Lib/DriverView/Helper/HasarSMHP321fFiscalHelper.php#L77-L88 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.