repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1 value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 | partition stringclasses 1 value |
|---|---|---|---|---|---|---|---|---|---|---|---|
eXpansionPluginPack/eXpansion2 | src/eXpansion/Framework/Core/Services/SymfonyEventAdapter.php | SymfonyEventAdapter.dispatch | public function dispatch($eventName, $params)
{
$event = new DedicatedEvent();
$event->setParameters($params);
$this->symfonyEventDispatcher->dispatch("maniaplanet.game.".$eventName, $event);
} | php | public function dispatch($eventName, $params)
{
$event = new DedicatedEvent();
$event->setParameters($params);
$this->symfonyEventDispatcher->dispatch("maniaplanet.game.".$eventName, $event);
} | [
"public",
"function",
"dispatch",
"(",
"$",
"eventName",
",",
"$",
"params",
")",
"{",
"$",
"event",
"=",
"new",
"DedicatedEvent",
"(",
")",
";",
"$",
"event",
"->",
"setParameters",
"(",
"$",
"params",
")",
";",
"$",
"this",
"->",
"symfonyEventDispatche... | Dispatch event as it needs to be.
@param string $eventName Name of the event.
@param array $params Parameters | [
"Dispatch",
"event",
"as",
"it",
"needs",
"to",
"be",
"."
] | e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31 | https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/Core/Services/SymfonyEventAdapter.php#L42-L47 | train |
anklimsk/cakephp-theme | Controller/FlashController.php | FlashController.flashcfg | public function flashcfg() {
Configure::write('debug', 0);
if (!$this->request->is('ajax') || !$this->request->is('post') ||
!$this->RequestHandler->prefers('json')) {
throw new BadRequestException();
}
$data = $this->ConfigTheme->getConfigAjaxFlash();
$this->set(compact('data'));
$this->set('_serialize', 'data');
} | php | public function flashcfg() {
Configure::write('debug', 0);
if (!$this->request->is('ajax') || !$this->request->is('post') ||
!$this->RequestHandler->prefers('json')) {
throw new BadRequestException();
}
$data = $this->ConfigTheme->getConfigAjaxFlash();
$this->set(compact('data'));
$this->set('_serialize', 'data');
} | [
"public",
"function",
"flashcfg",
"(",
")",
"{",
"Configure",
"::",
"write",
"(",
"'debug'",
",",
"0",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"request",
"->",
"is",
"(",
"'ajax'",
")",
"||",
"!",
"$",
"this",
"->",
"request",
"->",
"is",
"(... | Action `flashcfg`. Is used to get configuration for plugin
@throws BadRequestException if request is not `AJAX`, or not `POST`
or not `JSON`
@return void | [
"Action",
"flashcfg",
".",
"Is",
"used",
"to",
"get",
"configuration",
"for",
"plugin"
] | b815a4aaabaaf03ef1df3d547200f73f332f38a7 | https://github.com/anklimsk/cakephp-theme/blob/b815a4aaabaaf03ef1df3d547200f73f332f38a7/Controller/FlashController.php#L63-L73 | train |
anklimsk/cakephp-theme | Controller/FlashController.php | FlashController.flashmsg | public function flashmsg() {
Configure::write('debug', 0);
if (!$this->request->is('ajax') || !$this->request->is('post') ||
!$this->RequestHandler->prefers('json')) {
throw new BadRequestException();
}
$data = [];
$dataDefault = [
'result' => false,
'key' => null,
'messages' => [],
];
$keys = $this->request->data('keys');
$delete = (bool)$this->request->data('delete');
if (empty($keys)) {
$data[] = $dataDefault;
$this->set(compact('data'));
$this->set('_serialize', 'data');
return;
}
$keys = (array)$keys;
foreach ($keys as $key) {
if (empty($key)) {
$key = 'flash';
}
$dataItem = $dataDefault;
$dataItem['key'] = $key;
if ($delete) {
$dataItem['result'] = $this->FlashMessage->deleteMessage($key);
} else {
$messages = $this->FlashMessage->getMessage($key);
$dataItem['messages'] = $messages;
$dataItem['result'] = !empty($messages);
}
$data[] = $dataItem;
}
$this->set(compact('data'));
$this->set('_serialize', 'data');
} | php | public function flashmsg() {
Configure::write('debug', 0);
if (!$this->request->is('ajax') || !$this->request->is('post') ||
!$this->RequestHandler->prefers('json')) {
throw new BadRequestException();
}
$data = [];
$dataDefault = [
'result' => false,
'key' => null,
'messages' => [],
];
$keys = $this->request->data('keys');
$delete = (bool)$this->request->data('delete');
if (empty($keys)) {
$data[] = $dataDefault;
$this->set(compact('data'));
$this->set('_serialize', 'data');
return;
}
$keys = (array)$keys;
foreach ($keys as $key) {
if (empty($key)) {
$key = 'flash';
}
$dataItem = $dataDefault;
$dataItem['key'] = $key;
if ($delete) {
$dataItem['result'] = $this->FlashMessage->deleteMessage($key);
} else {
$messages = $this->FlashMessage->getMessage($key);
$dataItem['messages'] = $messages;
$dataItem['result'] = !empty($messages);
}
$data[] = $dataItem;
}
$this->set(compact('data'));
$this->set('_serialize', 'data');
} | [
"public",
"function",
"flashmsg",
"(",
")",
"{",
"Configure",
"::",
"write",
"(",
"'debug'",
",",
"0",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"request",
"->",
"is",
"(",
"'ajax'",
")",
"||",
"!",
"$",
"this",
"->",
"request",
"->",
"is",
"(... | Action `flashmsg`. Is used to get message from session data
POST Data array:
- `keys` The name of the session key for reading messages.
- `delete` If True, delete message from session.
@throws BadRequestException if request is not `AJAX`, or not `POST`
or not `JSON`
@return void | [
"Action",
"flashmsg",
".",
"Is",
"used",
"to",
"get",
"message",
"from",
"session",
"data"
] | b815a4aaabaaf03ef1df3d547200f73f332f38a7 | https://github.com/anklimsk/cakephp-theme/blob/b815a4aaabaaf03ef1df3d547200f73f332f38a7/Controller/FlashController.php#L86-L128 | train |
d8ahazard/Radarr | src/Radarr.php | Radarr.postCommand | public function postCommand($name, array $params = null)
{
$uri = 'command';
$uriData = [
'name' => $name
];
if ($params != null) {
foreach ($params as $key=>$value) {
$uriData[$key]= $value;
}
}
try {
$response = $this->_request(
[
'uri' => $uri,
'type' => 'post',
'data' => $uriData
]
);
} catch ( \Exception $e ) {
throw new InvalidException($e->getMessage());
}
return $response->getBody()->getContents();
} | php | public function postCommand($name, array $params = null)
{
$uri = 'command';
$uriData = [
'name' => $name
];
if ($params != null) {
foreach ($params as $key=>$value) {
$uriData[$key]= $value;
}
}
try {
$response = $this->_request(
[
'uri' => $uri,
'type' => 'post',
'data' => $uriData
]
);
} catch ( \Exception $e ) {
throw new InvalidException($e->getMessage());
}
return $response->getBody()->getContents();
} | [
"public",
"function",
"postCommand",
"(",
"$",
"name",
",",
"array",
"$",
"params",
"=",
"null",
")",
"{",
"$",
"uri",
"=",
"'command'",
";",
"$",
"uriData",
"=",
"[",
"'name'",
"=>",
"$",
"name",
"]",
";",
"if",
"(",
"$",
"params",
"!=",
"null",
... | Publish a new command for Radarr to run.
These commands are executed asynchronously; use GET to retrieve the current status.
Commands and their parameters can be found here:
https://github.com/Radarr/Radarr/wiki
@param $name
@param array|null $params
@return string
@throws InvalidException | [
"Publish",
"a",
"new",
"command",
"for",
"Radarr",
"to",
"run",
".",
"These",
"commands",
"are",
"executed",
"asynchronously",
";",
"use",
"GET",
"to",
"retrieve",
"the",
"current",
"status",
"."
] | 9cb3350e53ee207efa013bab3bdef9a24133c5ca | https://github.com/d8ahazard/Radarr/blob/9cb3350e53ee207efa013bab3bdef9a24133c5ca/src/Radarr.php#L106-L132 | train |
d8ahazard/Radarr | src/Radarr.php | Radarr.postMovie | public function postMovie(array $data)
{
$uri = 'movie';
try {
$response = $this->_request(
[
'uri' => $uri,
'type' => 'post',
'data' => $data
]
);
} catch ( \Exception $e ) {
return $e->getMessage();
}
return $response->getBody()->getContents();
} | php | public function postMovie(array $data)
{
$uri = 'movie';
try {
$response = $this->_request(
[
'uri' => $uri,
'type' => 'post',
'data' => $data
]
);
} catch ( \Exception $e ) {
return $e->getMessage();
}
return $response->getBody()->getContents();
} | [
"public",
"function",
"postMovie",
"(",
"array",
"$",
"data",
")",
"{",
"$",
"uri",
"=",
"'movie'",
";",
"try",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"_request",
"(",
"[",
"'uri'",
"=>",
"$",
"uri",
",",
"'type'",
"=>",
"'post'",
",",
"'dat... | Adds a new movie to your collection
NOTE: if you do not add the required params, then the movie wont function.
Some of these without the others can indeed make a "movie". But it wont function properly in Radarr.
Required: tmdbId (int) title (string) qualityProfileId (int) titleSlug (string) seasons (array)
See GET output for format
path (string) - full path to the movie on disk or rootFolderPath (string)
Full path will be created by combining the rootFolderPath with the movie title
Optional: tvRageId (int) seasonFolder (bool) monitored (bool)
@param array $data
@param bool|true $onlyFutureMovies It can be used to control which episodes Radarr monitors
after adding the movie, setting to true (default) will only monitor future episodes.
@return array|object|string | [
"Adds",
"a",
"new",
"movie",
"to",
"your",
"collection"
] | 9cb3350e53ee207efa013bab3bdef9a24133c5ca | https://github.com/d8ahazard/Radarr/blob/9cb3350e53ee207efa013bab3bdef9a24133c5ca/src/Radarr.php#L231-L248 | train |
d8ahazard/Radarr | src/Radarr.php | Radarr.updateMovie | public function updateMovie(array $data)
{
$uri = 'movie';
try {
$response = $this->_request(
[
'uri' => $uri,
'type' => 'put',
'data' => $data
]
);
} catch ( \Exception $e ) {
throw new InvalidException($e->getMessage());
}
return $response->getBody()->getContents();
} | php | public function updateMovie(array $data)
{
$uri = 'movie';
try {
$response = $this->_request(
[
'uri' => $uri,
'type' => 'put',
'data' => $data
]
);
} catch ( \Exception $e ) {
throw new InvalidException($e->getMessage());
}
return $response->getBody()->getContents();
} | [
"public",
"function",
"updateMovie",
"(",
"array",
"$",
"data",
")",
"{",
"$",
"uri",
"=",
"'movie'",
";",
"try",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"_request",
"(",
"[",
"'uri'",
"=>",
"$",
"uri",
",",
"'type'",
"=>",
"'put'",
",",
"'da... | Update the given movies, currently only monitored is changed, all other modifications are ignored.
Required: All parameters (you should perform a GET/{id} and submit the full body with the changes
and submit the full body with the changes, as other values may be editable in the future.
@param array $data
@return string
@throws InvalidException | [
"Update",
"the",
"given",
"movies",
"currently",
"only",
"monitored",
"is",
"changed",
"all",
"other",
"modifications",
"are",
"ignored",
"."
] | 9cb3350e53ee207efa013bab3bdef9a24133c5ca | https://github.com/d8ahazard/Radarr/blob/9cb3350e53ee207efa013bab3bdef9a24133c5ca/src/Radarr.php#L260-L277 | train |
d8ahazard/Radarr | src/Radarr.php | Radarr.deleteMovie | public function deleteMovie($id,$deleteFiles=false)
{
$uri = 'movie';
try {
$response = $this->_request(
[
'uri' => $uri . '/' . $id,
'type' => 'delete',
'deleteFiles' => $deleteFiles
]
);
} catch ( \Exception $e ) {
throw new InvalidException($e->getMessage());
}
return $response->getBody()->getContents();
} | php | public function deleteMovie($id,$deleteFiles=false)
{
$uri = 'movie';
try {
$response = $this->_request(
[
'uri' => $uri . '/' . $id,
'type' => 'delete',
'deleteFiles' => $deleteFiles
]
);
} catch ( \Exception $e ) {
throw new InvalidException($e->getMessage());
}
return $response->getBody()->getContents();
} | [
"public",
"function",
"deleteMovie",
"(",
"$",
"id",
",",
"$",
"deleteFiles",
"=",
"false",
")",
"{",
"$",
"uri",
"=",
"'movie'",
";",
"try",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"_request",
"(",
"[",
"'uri'",
"=>",
"$",
"uri",
".",
"'/'",... | Delete the given movie file
@param $id - TMDB ID of the movie to remove
@param bool $deleteFiles - Optional, delete files along with remove from Radarr.
@return string
@throws InvalidException | [
"Delete",
"the",
"given",
"movie",
"file"
] | 9cb3350e53ee207efa013bab3bdef9a24133c5ca | https://github.com/d8ahazard/Radarr/blob/9cb3350e53ee207efa013bab3bdef9a24133c5ca/src/Radarr.php#L287-L304 | train |
video-games-records/CoreBundle | Tools/Ranking.php | Ranking.order | public static function order(array $array, array $columns)
{
$arrayMultisortParameters = [];
foreach ($columns as $column => $order) {
$arrayMultisortParameters[] = array_column($array, $column);
$arrayMultisortParameters[] = $order;
}
$arrayMultisortParameters[] = &$array;
array_multisort(...$arrayMultisortParameters);
return $array;
} | php | public static function order(array $array, array $columns)
{
$arrayMultisortParameters = [];
foreach ($columns as $column => $order) {
$arrayMultisortParameters[] = array_column($array, $column);
$arrayMultisortParameters[] = $order;
}
$arrayMultisortParameters[] = &$array;
array_multisort(...$arrayMultisortParameters);
return $array;
} | [
"public",
"static",
"function",
"order",
"(",
"array",
"$",
"array",
",",
"array",
"$",
"columns",
")",
"{",
"$",
"arrayMultisortParameters",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"columns",
"as",
"$",
"column",
"=>",
"$",
"order",
")",
"{",
"$",
... | Order an array
@param array $array
@param array $columns array of 'column' => SORT_*
@return array | [
"Order",
"an",
"array"
] | 64fc8fbc8217f4593b26223168463bfbe8f3fd61 | https://github.com/video-games-records/CoreBundle/blob/64fc8fbc8217f4593b26223168463bfbe8f3fd61/Tools/Ranking.php#L15-L26 | train |
video-games-records/CoreBundle | Tools/Ranking.php | Ranking.addRank | public static function addRank($array, $key = 'rank', $columns = ['pointChart'], $boolEqual = false)
{
$rank = 1;
$compteur = 0;
$nbEqual = 1;
$nb = count($array);
for ($i = 0; $i <= $nb - 1; $i++) {
if ($i >= 1) {
$row1 = $array[$i - 1];
$row2 = $array[$i];
$isEqual = true;
foreach ($columns as $column) {
if ($row1[$column] != $row2[$column]) {
$isEqual = false;
break;
}
}
if ($isEqual) {
$compteur++;
++$nbEqual;
} else {
$rank = $rank + $compteur + 1;
$compteur = 0;
unset($nbEqual);
$nbEqual = 1;
}
}
$row = $array[$i];
$row[$key] = $rank;
if ($boolEqual) {
$row['nbEqual'] = &$nbEqual;
}
$array[$i] = $row;
}
unset($nbEqual);
return $array;
} | php | public static function addRank($array, $key = 'rank', $columns = ['pointChart'], $boolEqual = false)
{
$rank = 1;
$compteur = 0;
$nbEqual = 1;
$nb = count($array);
for ($i = 0; $i <= $nb - 1; $i++) {
if ($i >= 1) {
$row1 = $array[$i - 1];
$row2 = $array[$i];
$isEqual = true;
foreach ($columns as $column) {
if ($row1[$column] != $row2[$column]) {
$isEqual = false;
break;
}
}
if ($isEqual) {
$compteur++;
++$nbEqual;
} else {
$rank = $rank + $compteur + 1;
$compteur = 0;
unset($nbEqual);
$nbEqual = 1;
}
}
$row = $array[$i];
$row[$key] = $rank;
if ($boolEqual) {
$row['nbEqual'] = &$nbEqual;
}
$array[$i] = $row;
}
unset($nbEqual);
return $array;
} | [
"public",
"static",
"function",
"addRank",
"(",
"$",
"array",
",",
"$",
"key",
"=",
"'rank'",
",",
"$",
"columns",
"=",
"[",
"'pointChart'",
"]",
",",
"$",
"boolEqual",
"=",
"false",
")",
"{",
"$",
"rank",
"=",
"1",
";",
"$",
"compteur",
"=",
"0",
... | Add a rank column checking one or more columns to a sorted array
@param array $array
@param string $key
@param array $columns
@param bool $boolEqual
@return array | [
"Add",
"a",
"rank",
"column",
"checking",
"one",
"or",
"more",
"columns",
"to",
"a",
"sorted",
"array"
] | 64fc8fbc8217f4593b26223168463bfbe8f3fd61 | https://github.com/video-games-records/CoreBundle/blob/64fc8fbc8217f4593b26223168463bfbe8f3fd61/Tools/Ranking.php#L38-L77 | train |
video-games-records/CoreBundle | Tools/Ranking.php | Ranking.chartPointProvider | public static function chartPointProvider($iNbPartcipant)
{
$liste = [];
$pointRecord = 100 * $iNbPartcipant;
$nb = 80;// % différence entre deux positions
$compteur = 0;// compteur de position
// 1er
$liste[1] = $pointRecord;
for ($i = 2; $i <= $iNbPartcipant; $i++) {
$pointRecord = (int)($pointRecord * $nb / 100);
$liste[$i] = $pointRecord;
$compteur++;
if ($nb < 85) {
if ($compteur === 2) {
$nb++;// le % augmente donc la différence diminue
$compteur = 0;
}
} elseif ($nb < 99) {
$nb++;
}
}
return $liste;
} | php | public static function chartPointProvider($iNbPartcipant)
{
$liste = [];
$pointRecord = 100 * $iNbPartcipant;
$nb = 80;// % différence entre deux positions
$compteur = 0;// compteur de position
// 1er
$liste[1] = $pointRecord;
for ($i = 2; $i <= $iNbPartcipant; $i++) {
$pointRecord = (int)($pointRecord * $nb / 100);
$liste[$i] = $pointRecord;
$compteur++;
if ($nb < 85) {
if ($compteur === 2) {
$nb++;// le % augmente donc la différence diminue
$compteur = 0;
}
} elseif ($nb < 99) {
$nb++;
}
}
return $liste;
} | [
"public",
"static",
"function",
"chartPointProvider",
"(",
"$",
"iNbPartcipant",
")",
"{",
"$",
"liste",
"=",
"[",
"]",
";",
"$",
"pointRecord",
"=",
"100",
"*",
"$",
"iNbPartcipant",
";",
"$",
"nb",
"=",
"80",
";",
"// % différence entre deux positions",
"$... | Renvoie le tableau des pointsVGR
@param $iNbPartcipant
@return mixed | [
"Renvoie",
"le",
"tableau",
"des",
"pointsVGR"
] | 64fc8fbc8217f4593b26223168463bfbe8f3fd61 | https://github.com/video-games-records/CoreBundle/blob/64fc8fbc8217f4593b26223168463bfbe8f3fd61/Tools/Ranking.php#L136-L162 | train |
phug-php/renderer | src/Phug/Renderer/Partial/Debug/DebuggerTrait.php | DebuggerTrait.reInitOptions | public function reInitOptions($options)
{
/* @var Renderer $this */
$this->setOptions([
'memory_limit' => null,
'execution_max_time' => null,
'enable_profiler' => false,
'profiler' => [
'display' => false,
'log' => false,
],
]);
$this->setOptions($options);
$this->initDebugOptions($this);
} | php | public function reInitOptions($options)
{
/* @var Renderer $this */
$this->setOptions([
'memory_limit' => null,
'execution_max_time' => null,
'enable_profiler' => false,
'profiler' => [
'display' => false,
'log' => false,
],
]);
$this->setOptions($options);
$this->initDebugOptions($this);
} | [
"public",
"function",
"reInitOptions",
"(",
"$",
"options",
")",
"{",
"/* @var Renderer $this */",
"$",
"this",
"->",
"setOptions",
"(",
"[",
"'memory_limit'",
"=>",
"null",
",",
"'execution_max_time'",
"=>",
"null",
",",
"'enable_profiler'",
"=>",
"false",
",",
... | Reinitialize debug options then set new options.
@param $options | [
"Reinitialize",
"debug",
"options",
"then",
"set",
"new",
"options",
"."
] | ada6f713b6d614d215d62b36e64d2162e7f2569c | https://github.com/phug-php/renderer/blob/ada6f713b6d614d215d62b36e64d2162e7f2569c/src/Phug/Renderer/Partial/Debug/DebuggerTrait.php#L314-L329 | train |
phug-php/renderer | src/Phug/Renderer/Partial/Debug/DebuggerTrait.php | DebuggerTrait.handleError | public function handleError($error, $code, $path, $source, $parameters, $options)
{
/* @var \Throwable $error */
$exception = $options['debug']
? $this->getDebuggedException($error, $code, $source, $path, $parameters, $options)
: $error;
$handler = $options['error_handler'];
if (!$handler) {
// @codeCoverageIgnoreStart
if ($options['debug'] && $options['exit_on_error']) {
if ($options['html_error']) {
echo $exception->getMessage();
exit(1);
}
if (!function_exists('xdebug_is_enabled') || !xdebug_is_enabled()) {
echo $exception->getMessage()."\n".$exception->getTraceAsString();
exit(1);
}
}
// @codeCoverageIgnoreEnd
throw $exception;
}
$handler($exception);
} | php | public function handleError($error, $code, $path, $source, $parameters, $options)
{
/* @var \Throwable $error */
$exception = $options['debug']
? $this->getDebuggedException($error, $code, $source, $path, $parameters, $options)
: $error;
$handler = $options['error_handler'];
if (!$handler) {
// @codeCoverageIgnoreStart
if ($options['debug'] && $options['exit_on_error']) {
if ($options['html_error']) {
echo $exception->getMessage();
exit(1);
}
if (!function_exists('xdebug_is_enabled') || !xdebug_is_enabled()) {
echo $exception->getMessage()."\n".$exception->getTraceAsString();
exit(1);
}
}
// @codeCoverageIgnoreEnd
throw $exception;
}
$handler($exception);
} | [
"public",
"function",
"handleError",
"(",
"$",
"error",
",",
"$",
"code",
",",
"$",
"path",
",",
"$",
"source",
",",
"$",
"parameters",
",",
"$",
"options",
")",
"{",
"/* @var \\Throwable $error */",
"$",
"exception",
"=",
"$",
"options",
"[",
"'debug'",
... | Handle error occurred in compiled PHP.
@param \Throwable $error
@param int $code
@param string $path
@param string $source
@param array $parameters
@param array $options
@throws RendererException
@throws \Throwable | [
"Handle",
"error",
"occurred",
"in",
"compiled",
"PHP",
"."
] | ada6f713b6d614d215d62b36e64d2162e7f2569c | https://github.com/phug-php/renderer/blob/ada6f713b6d614d215d62b36e64d2162e7f2569c/src/Phug/Renderer/Partial/Debug/DebuggerTrait.php#L344-L369 | train |
Malwarebytes/Altamira | src/Altamira/ChartDatum/Bubble.php | Bubble.getRenderData | public function getRenderData( $useLabel = false )
{
$radius = ( $this->jsWriter instanceof \Altamira\JsWriter\Flot ) ? $this['radius'] * 10 : $this['radius'];
$data = array( $this['x'], $this['y'], $radius );
if ( $useLabel ) {
$data[] = $this['label'];
}
return $data;
} | php | public function getRenderData( $useLabel = false )
{
$radius = ( $this->jsWriter instanceof \Altamira\JsWriter\Flot ) ? $this['radius'] * 10 : $this['radius'];
$data = array( $this['x'], $this['y'], $radius );
if ( $useLabel ) {
$data[] = $this['label'];
}
return $data;
} | [
"public",
"function",
"getRenderData",
"(",
"$",
"useLabel",
"=",
"false",
")",
"{",
"$",
"radius",
"=",
"(",
"$",
"this",
"->",
"jsWriter",
"instanceof",
"\\",
"Altamira",
"\\",
"JsWriter",
"\\",
"Flot",
")",
"?",
"$",
"this",
"[",
"'radius'",
"]",
"*... | Returns an array that corresponds with the ultimate JSON data needed for this datum
@see Altamira\ChartDatum.ChartDatumAbstract::getRenderData()
@param bool $useLabel | [
"Returns",
"an",
"array",
"that",
"corresponds",
"with",
"the",
"ultimate",
"JSON",
"data",
"needed",
"for",
"this",
"datum"
] | 38e320f68070d7a0b6902c6c3f904995d4a8cdfc | https://github.com/Malwarebytes/Altamira/blob/38e320f68070d7a0b6902c6c3f904995d4a8cdfc/src/Altamira/ChartDatum/Bubble.php#L43-L54 | train |
eXpansionPluginPack/eXpansion2 | src/eXpansion/Framework/Core/Helpers/Translations.php | Translations.getTranslation | public function getTranslation($id, $parameters = [], $locale = null)
{
$parameters = array_merge($this->replacementPatterns, $parameters);
return $this->translator->trans($id, $parameters, null, $locale);
} | php | public function getTranslation($id, $parameters = [], $locale = null)
{
$parameters = array_merge($this->replacementPatterns, $parameters);
return $this->translator->trans($id, $parameters, null, $locale);
} | [
"public",
"function",
"getTranslation",
"(",
"$",
"id",
",",
"$",
"parameters",
"=",
"[",
"]",
",",
"$",
"locale",
"=",
"null",
")",
"{",
"$",
"parameters",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"replacementPatterns",
",",
"$",
"parameters",
")",
... | Get translated message.
@param string $id
@param array $parameters
@param $locale
@return mixed | [
"Get",
"translated",
"message",
"."
] | e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31 | https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/Core/Helpers/Translations.php#L63-L68 | train |
eXpansionPluginPack/eXpansion2 | src/eXpansion/Framework/Core/Helpers/Translations.php | Translations.getTranslations | public function getTranslations($id, $parameters = [])
{
$messages = [];
foreach ($this->supportedLocales as $locale) {
$message = $this->getTranslation($id, $parameters, $locale);
$messages[] = [
"Lang" => lcfirst($locale),
"Text" => $message,
];
}
return $messages;
} | php | public function getTranslations($id, $parameters = [])
{
$messages = [];
foreach ($this->supportedLocales as $locale) {
$message = $this->getTranslation($id, $parameters, $locale);
$messages[] = [
"Lang" => lcfirst($locale),
"Text" => $message,
];
}
return $messages;
} | [
"public",
"function",
"getTranslations",
"(",
"$",
"id",
",",
"$",
"parameters",
"=",
"[",
"]",
")",
"{",
"$",
"messages",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"supportedLocales",
"as",
"$",
"locale",
")",
"{",
"$",
"message",
"=",
... | Get list of translations.
@TODO optimize by preparing the messages before.
@param $id
@param $parameters
@return array | [
"Get",
"list",
"of",
"translations",
"."
] | e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31 | https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/Core/Helpers/Translations.php#L80-L93 | train |
VitexSoftware/FlexiPeeHP-Bricks | src/FlexiPeeHP/Bricks/WebHookHandler.php | WebHookHandler.setUp | public function setUp($options = [])
{
parent::setUp($options);
if (isset($options['changeid'])) {
$this->changeid = $options['changeid'];
}
if (isset($options['operation'])) {
$this->setOperation($options['operation']);
if ($options['operation'] == 'delete') {
$this->ignore404(true);
}
}
if (isset($options['external-ids'])) {
$this->extids = $options['external-ids'];
}
} | php | public function setUp($options = [])
{
parent::setUp($options);
if (isset($options['changeid'])) {
$this->changeid = $options['changeid'];
}
if (isset($options['operation'])) {
$this->setOperation($options['operation']);
if ($options['operation'] == 'delete') {
$this->ignore404(true);
}
}
if (isset($options['external-ids'])) {
$this->extids = $options['external-ids'];
}
} | [
"public",
"function",
"setUp",
"(",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"parent",
"::",
"setUp",
"(",
"$",
"options",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"options",
"[",
"'changeid'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"changeid",
"=... | SetUp Object to be ready for connect
@param array $options Object Options (company,url,user,password,evidence,
prefix,defaultUrlParams,debug) | [
"SetUp",
"Object",
"to",
"be",
"ready",
"for",
"connect"
] | e6d6d9b6cb6ceffe31b35e0f8f396f614473047b | https://github.com/VitexSoftware/FlexiPeeHP-Bricks/blob/e6d6d9b6cb6ceffe31b35e0f8f396f614473047b/src/FlexiPeeHP/Bricks/WebHookHandler.php#L62-L77 | train |
anklimsk/cakephp-theme | Vendor/PhpUnoconv/monolog/monolog/src/Monolog/Handler/BrowserConsoleHandler.php | BrowserConsoleHandler.getResponseFormat | protected static function getResponseFormat()
{
// Check content type
foreach (headers_list() as $header) {
if (stripos($header, 'content-type:') === 0) {
// This handler only works with HTML and javascript outputs
// text/javascript is obsolete in favour of application/javascript, but still used
if (stripos($header, 'application/javascript') !== false || stripos($header, 'text/javascript') !== false) {
return 'js';
}
if (stripos($header, 'text/html') === false) {
return 'unknown';
}
break;
}
}
return 'html';
} | php | protected static function getResponseFormat()
{
// Check content type
foreach (headers_list() as $header) {
if (stripos($header, 'content-type:') === 0) {
// This handler only works with HTML and javascript outputs
// text/javascript is obsolete in favour of application/javascript, but still used
if (stripos($header, 'application/javascript') !== false || stripos($header, 'text/javascript') !== false) {
return 'js';
}
if (stripos($header, 'text/html') === false) {
return 'unknown';
}
break;
}
}
return 'html';
} | [
"protected",
"static",
"function",
"getResponseFormat",
"(",
")",
"{",
"// Check content type",
"foreach",
"(",
"headers_list",
"(",
")",
"as",
"$",
"header",
")",
"{",
"if",
"(",
"stripos",
"(",
"$",
"header",
",",
"'content-type:'",
")",
"===",
"0",
")",
... | Checks the format of the response
If Content-Type is set to application/javascript or text/javascript -> js
If Content-Type is set to text/html, or is unset -> html
If Content-Type is anything else -> unknown
@return string One of 'js', 'html' or 'unknown' | [
"Checks",
"the",
"format",
"of",
"the",
"response"
] | b815a4aaabaaf03ef1df3d547200f73f332f38a7 | https://github.com/anklimsk/cakephp-theme/blob/b815a4aaabaaf03ef1df3d547200f73f332f38a7/Vendor/PhpUnoconv/monolog/monolog/src/Monolog/Handler/BrowserConsoleHandler.php#L113-L131 | train |
eXpansionPluginPack/eXpansion2 | src/eXpansion/Framework/Core/Helpers/CompatibleFetcher.php | CompatibleFetcher.getCompatibleData | public function getCompatibleData($haystack, $title, $mode, $script)
{
// List of choices order by importance.
$choices = $this->getChoicesByPriority($title, $mode, $script);
foreach ($choices as $choice) {
$data = AssociativeArray::getFromKey($haystack, $choice);
if (!is_null($data)) {
return $data;
}
}
return null;
} | php | public function getCompatibleData($haystack, $title, $mode, $script)
{
// List of choices order by importance.
$choices = $this->getChoicesByPriority($title, $mode, $script);
foreach ($choices as $choice) {
$data = AssociativeArray::getFromKey($haystack, $choice);
if (!is_null($data)) {
return $data;
}
}
return null;
} | [
"public",
"function",
"getCompatibleData",
"(",
"$",
"haystack",
",",
"$",
"title",
",",
"$",
"mode",
",",
"$",
"script",
")",
"{",
"// List of choices order by importance.",
"$",
"choices",
"=",
"$",
"this",
"->",
"getChoicesByPriority",
"(",
"$",
"title",
",... | Get a compatible data.
@param $haystack
@param $title
@param $mode
@param $script
@return mixed|null | [
"Get",
"a",
"compatible",
"data",
"."
] | e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31 | https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/Core/Helpers/CompatibleFetcher.php#L49-L63 | train |
eXpansionPluginPack/eXpansion2 | src/eXpansion/Framework/Core/Helpers/CompatibleFetcher.php | CompatibleFetcher.getChoicesByPriority | public function getChoicesByPriority($titleId, $mode, $script)
{
$game = $this->getTitleGame($titleId);
return [
[$titleId, $mode, $script],
[$titleId, $mode, self::COMPATIBLE_ALL],
[$titleId, self::COMPATIBLE_ALL, self::COMPATIBLE_ALL],
// If perfect title is not found then fallback on game.
[$game, $mode, $script],
[$game, $mode, self::COMPATIBLE_ALL],
[$game, self::COMPATIBLE_ALL, self::COMPATIBLE_ALL],
// For modes that are common to all titles.
[self::COMPATIBLE_ALL, $mode, $script],
[self::COMPATIBLE_ALL, $mode, self::COMPATIBLE_ALL],
// For data providers compatible with every title/gamemode/script.
[self::COMPATIBLE_ALL, self::COMPATIBLE_ALL, self::COMPATIBLE_ALL],
];
} | php | public function getChoicesByPriority($titleId, $mode, $script)
{
$game = $this->getTitleGame($titleId);
return [
[$titleId, $mode, $script],
[$titleId, $mode, self::COMPATIBLE_ALL],
[$titleId, self::COMPATIBLE_ALL, self::COMPATIBLE_ALL],
// If perfect title is not found then fallback on game.
[$game, $mode, $script],
[$game, $mode, self::COMPATIBLE_ALL],
[$game, self::COMPATIBLE_ALL, self::COMPATIBLE_ALL],
// For modes that are common to all titles.
[self::COMPATIBLE_ALL, $mode, $script],
[self::COMPATIBLE_ALL, $mode, self::COMPATIBLE_ALL],
// For data providers compatible with every title/gamemode/script.
[self::COMPATIBLE_ALL, self::COMPATIBLE_ALL, self::COMPATIBLE_ALL],
];
} | [
"public",
"function",
"getChoicesByPriority",
"(",
"$",
"titleId",
",",
"$",
"mode",
",",
"$",
"script",
")",
"{",
"$",
"game",
"=",
"$",
"this",
"->",
"getTitleGame",
"(",
"$",
"titleId",
")",
";",
"return",
"[",
"[",
"$",
"titleId",
",",
"$",
"mode... | Get list of choices to test by priority.
@param string $titleId
@param string $mode
@param string $script
@return array | [
"Get",
"list",
"of",
"choices",
"to",
"test",
"by",
"priority",
"."
] | e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31 | https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/Core/Helpers/CompatibleFetcher.php#L74-L94 | train |
eXpansionPluginPack/eXpansion2 | src/eXpansion/Framework/Core/Helpers/CompatibleFetcher.php | CompatibleFetcher.getTitleGame | public function getTitleGame($titleId)
{
$game = $this->titles->get($titleId, self::GAME_UNKNOWN);
return $game;
} | php | public function getTitleGame($titleId)
{
$game = $this->titles->get($titleId, self::GAME_UNKNOWN);
return $game;
} | [
"public",
"function",
"getTitleGame",
"(",
"$",
"titleId",
")",
"{",
"$",
"game",
"=",
"$",
"this",
"->",
"titles",
"->",
"get",
"(",
"$",
"titleId",
",",
"self",
"::",
"GAME_UNKNOWN",
")",
";",
"return",
"$",
"game",
";",
"}"
] | Get the game of the title.
@param string $titleId
@return string | [
"Get",
"the",
"game",
"of",
"the",
"title",
"."
] | e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31 | https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/Core/Helpers/CompatibleFetcher.php#L103-L107 | train |
eXpansionPluginPack/eXpansion2 | src/eXpansion/Framework/Config/Model/PlayerListConfig.php | PlayerListConfig.get | public function get()
{
$players = [];
foreach (parent::get() as $login) {
$player = $this->playerDb->get($login);
if (is_null($player)) {
$player = new Player();
$player->setLogin($login);
}
$players[] = $player;
}
return $players;
} | php | public function get()
{
$players = [];
foreach (parent::get() as $login) {
$player = $this->playerDb->get($login);
if (is_null($player)) {
$player = new Player();
$player->setLogin($login);
}
$players[] = $player;
}
return $players;
} | [
"public",
"function",
"get",
"(",
")",
"{",
"$",
"players",
"=",
"[",
"]",
";",
"foreach",
"(",
"parent",
"::",
"get",
"(",
")",
"as",
"$",
"login",
")",
"{",
"$",
"player",
"=",
"$",
"this",
"->",
"playerDb",
"->",
"get",
"(",
"$",
"login",
")... | Get list of configured players.
@return Player[] | [
"Get",
"list",
"of",
"configured",
"players",
"."
] | e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31 | https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/Config/Model/PlayerListConfig.php#L64-L79 | train |
byjg/xmlnuke | xmlnuke-php5/src/Xmlnuke/Core/Classes/XmlnukeTabView.php | XmlnukeTabView.addTabItem | public function addTabItem($title, $docobj, $tabdefault = false)
{
if (is_null($docobj) || !($docobj instanceof IXmlnukeDocumentObject))
{
throw new InvalidArgumentException("Object is null or not is IXmlnukeDocumentObject. Found object type: " . get_class($docobj), 853);
}
$this->_tabs[] = array($title, "OBJ", $docobj);
if ($tabdefault)
{
$this->_tabDefault = count($this->_tabs)-1;
}
} | php | public function addTabItem($title, $docobj, $tabdefault = false)
{
if (is_null($docobj) || !($docobj instanceof IXmlnukeDocumentObject))
{
throw new InvalidArgumentException("Object is null or not is IXmlnukeDocumentObject. Found object type: " . get_class($docobj), 853);
}
$this->_tabs[] = array($title, "OBJ", $docobj);
if ($tabdefault)
{
$this->_tabDefault = count($this->_tabs)-1;
}
} | [
"public",
"function",
"addTabItem",
"(",
"$",
"title",
",",
"$",
"docobj",
",",
"$",
"tabdefault",
"=",
"false",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"docobj",
")",
"||",
"!",
"(",
"$",
"docobj",
"instanceof",
"IXmlnukeDocumentObject",
")",
")",
"... | Add a Tab with content.
@param string $title
@param IXmlnukeDocumentObject $docobj
@param bool $tabdefault | [
"Add",
"a",
"Tab",
"with",
"content",
"."
] | aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7 | https://github.com/byjg/xmlnuke/blob/aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7/xmlnuke-php5/src/Xmlnuke/Core/Classes/XmlnukeTabView.php#L61-L72 | train |
TheBnl/event-tickets | code/fields/TicketsField.php | TicketsField.validate | public function validate($validator)
{
// Throw an error when there are no tickets selected
if (empty($this->value)) {
$validator->validationError($this->name, _t(
'TicketsField.VALIDATION_EMPTY',
'Select at least one ticket'
), 'validation');
return false;
}
// Get the availability
$available = $this->getForm()->event->getAvailability();
// get the sum of selected tickets
$ticketCount = array_sum(array_map(function ($item) {
return $item['Amount'];
}, $this->value));
// If the sum of tickets is 0 trow the same error as empty
if ($ticketCount === 0) {
$validator->validationError($this->name, _t(
'TicketsField.VALIDATION_EMPTY',
'Select at least one ticket'
), 'validation');
return false;
}
// Throw an error when there are more tickets selected than available
if ($ticketCount > $available) {
$validator->validationError($this->name, _t(
'TicketsField.VALIDATION_TO_MUCH',
'There are {ticketCount} tickets left',
null,
array(
'ticketCount' => $available
)
), 'validation');
return false;
}
return false;
} | php | public function validate($validator)
{
// Throw an error when there are no tickets selected
if (empty($this->value)) {
$validator->validationError($this->name, _t(
'TicketsField.VALIDATION_EMPTY',
'Select at least one ticket'
), 'validation');
return false;
}
// Get the availability
$available = $this->getForm()->event->getAvailability();
// get the sum of selected tickets
$ticketCount = array_sum(array_map(function ($item) {
return $item['Amount'];
}, $this->value));
// If the sum of tickets is 0 trow the same error as empty
if ($ticketCount === 0) {
$validator->validationError($this->name, _t(
'TicketsField.VALIDATION_EMPTY',
'Select at least one ticket'
), 'validation');
return false;
}
// Throw an error when there are more tickets selected than available
if ($ticketCount > $available) {
$validator->validationError($this->name, _t(
'TicketsField.VALIDATION_TO_MUCH',
'There are {ticketCount} tickets left',
null,
array(
'ticketCount' => $available
)
), 'validation');
return false;
}
return false;
} | [
"public",
"function",
"validate",
"(",
"$",
"validator",
")",
"{",
"// Throw an error when there are no tickets selected",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"value",
")",
")",
"{",
"$",
"validator",
"->",
"validationError",
"(",
"$",
"this",
"->",
"n... | Make sure a ticket is selected and that the selected amount is available
@param Validator $validator
@return bool | [
"Make",
"sure",
"a",
"ticket",
"is",
"selected",
"and",
"that",
"the",
"selected",
"amount",
"is",
"available"
] | d18db4146a141795fd50689057130a6fd41ac397 | https://github.com/TheBnl/event-tickets/blob/d18db4146a141795fd50689057130a6fd41ac397/code/fields/TicketsField.php#L133-L177 | train |
mgallegos/decima-accounting | src/Mgallegos/DecimaAccounting/System/Repositories/AccountChartType/EloquentAccountChartType.php | EloquentAccountChartType.accountsChartsTypesByCountry | public function accountsChartsTypesByCountry($id)
{
return $this->AccountChartType->where(function($query) use ($id)
{
$query->orWhere('country_id', '=', $id);
$query->orWhereNull('country_id');
})->get();
} | php | public function accountsChartsTypesByCountry($id)
{
return $this->AccountChartType->where(function($query) use ($id)
{
$query->orWhere('country_id', '=', $id);
$query->orWhereNull('country_id');
})->get();
} | [
"public",
"function",
"accountsChartsTypesByCountry",
"(",
"$",
"id",
")",
"{",
"return",
"$",
"this",
"->",
"AccountChartType",
"->",
"where",
"(",
"function",
"(",
"$",
"query",
")",
"use",
"(",
"$",
"id",
")",
"{",
"$",
"query",
"->",
"orWhere",
"(",
... | Retrieve accounts charts types by country
@param array $id countries id
@return Illuminate\Database\Eloquent\Collection | [
"Retrieve",
"accounts",
"charts",
"types",
"by",
"country"
] | 6410585303a13892e64e9dfeacbae0ca212b458b | https://github.com/mgallegos/decima-accounting/blob/6410585303a13892e64e9dfeacbae0ca212b458b/src/Mgallegos/DecimaAccounting/System/Repositories/AccountChartType/EloquentAccountChartType.php#L59-L66 | train |
eXpansionPluginPack/eXpansion2 | src/eXpansion/Bundle/ImmersiveWindows/Model/Gui/Factory/WindowFrameFactory.php | WindowFrameFactory.callbackItemClick | public function callbackItemClick(ManialinkInterface $manialink, $login, $params, $args)
{
$this->menuContentFactory->create($login);
/** @var ItemInterface $item */
$item = $args['item'];
$item->execute($this->menuContentFactory, $manialink, $login, $params, $args);
} | php | public function callbackItemClick(ManialinkInterface $manialink, $login, $params, $args)
{
$this->menuContentFactory->create($login);
/** @var ItemInterface $item */
$item = $args['item'];
$item->execute($this->menuContentFactory, $manialink, $login, $params, $args);
} | [
"public",
"function",
"callbackItemClick",
"(",
"ManialinkInterface",
"$",
"manialink",
",",
"$",
"login",
",",
"$",
"params",
",",
"$",
"args",
")",
"{",
"$",
"this",
"->",
"menuContentFactory",
"->",
"create",
"(",
"$",
"login",
")",
";",
"/** @var ItemInt... | Callback when an item of the menu is clicked on.
@param ManialinkInterface $manialink
@param $login
@param $params
@param $args | [
"Callback",
"when",
"an",
"item",
"of",
"the",
"menu",
"is",
"clicked",
"on",
"."
] | e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31 | https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Bundle/ImmersiveWindows/Model/Gui/Factory/WindowFrameFactory.php#L159-L166 | train |
Rundiz/pagination | Rundiz/Pagination/Pagination.php | Pagination.clear | public function clear()
{
if (is_array($this->temp_properties)) {
foreach ($this->temp_properties as $key => $value) {
if (property_exists($this, $key)) {
$this->$key = $value;
}
}
unset($key, $value);
$this->temp_properties = null;
}
} | php | public function clear()
{
if (is_array($this->temp_properties)) {
foreach ($this->temp_properties as $key => $value) {
if (property_exists($this, $key)) {
$this->$key = $value;
}
}
unset($key, $value);
$this->temp_properties = null;
}
} | [
"public",
"function",
"clear",
"(",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"this",
"->",
"temp_properties",
")",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"temp_properties",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"property_... | Clear and reset properties to the default values. | [
"Clear",
"and",
"reset",
"properties",
"to",
"the",
"default",
"values",
"."
] | d86bdc890f665eda1437e4659829e21fb0df1f60 | https://github.com/Rundiz/pagination/blob/d86bdc890f665eda1437e4659829e21fb0df1f60/Rundiz/Pagination/Pagination.php#L232-L244 | train |
Rundiz/pagination | Rundiz/Pagination/Pagination.php | Pagination.createLinks | public function createLinks($result_string = 'Displaying page :current_page_number_displaying of :total_pages<br>:pagination')
{
$pagination_data = $this->getPaginationData();
if (!is_array($pagination_data)) {
return null;
}
if ($result_string == null) {
$result_string = 'Displaying page :current_page_number_displaying of :total_pages<br>:pagination';
}
// render the pagination. --------------------------------------------------------------------------------------------
$pagination_rendered = "\n";
if (array_key_exists('overall_tag_open', $pagination_data)) {
$pagination_rendered .= $pagination_data['overall_tag_open'];
}
if (array_key_exists('generated_pages', $pagination_data) && is_array($pagination_data['generated_pages'])) {
foreach ($pagination_data['generated_pages'] as $page_key => $page_item) {
if (is_array($page_item)) {
if (array_key_exists('tag_open', $page_item)) {
$pagination_rendered .= $page_item['tag_open'];
}
if (array_key_exists('link', $page_item) && $page_item['link'] != null) {
$pagination_rendered .= '<a href="' . $page_item['link'] . '">';
}
if (array_key_exists('text', $page_item)) {
$pagination_rendered .= $page_item['text'];
}
if (array_key_exists('link', $page_item) && $page_item['link'] != null) {
$pagination_rendered .= '</a>';
}
if (array_key_exists('tag_close', $page_item)) {
$pagination_rendered .= $page_item['tag_close'];
}
}
}
unset($page_item, $page_key);
}
if (array_key_exists('overall_tag_close', $pagination_data)) {
$pagination_rendered .= $pagination_data['overall_tag_close'];
}
$pagination_rendered .= "\n";
// end render the pagination ----------------------------------------------------------------------------------------
$output = $result_string;
if (array_key_exists('total_pages', $pagination_data)) {
$output = str_replace(':total_pages', $pagination_data['total_pages'], $output);
}
if (array_key_exists('page_number_type', $pagination_data)) {
$output = str_replace(':page_number_type', $pagination_data['total_pages'], $output);
}
if (array_key_exists('current_page_number_displaying', $pagination_data)) {
$output = str_replace(':current_page_number_displaying', $pagination_data['current_page_number_displaying'], $output);
}
if (isset($pagination_rendered)) {
$output = str_replace(':pagination', $pagination_rendered, $output);
}
unset($pagination_data, $pagination_rendered);
return $output;
} | php | public function createLinks($result_string = 'Displaying page :current_page_number_displaying of :total_pages<br>:pagination')
{
$pagination_data = $this->getPaginationData();
if (!is_array($pagination_data)) {
return null;
}
if ($result_string == null) {
$result_string = 'Displaying page :current_page_number_displaying of :total_pages<br>:pagination';
}
// render the pagination. --------------------------------------------------------------------------------------------
$pagination_rendered = "\n";
if (array_key_exists('overall_tag_open', $pagination_data)) {
$pagination_rendered .= $pagination_data['overall_tag_open'];
}
if (array_key_exists('generated_pages', $pagination_data) && is_array($pagination_data['generated_pages'])) {
foreach ($pagination_data['generated_pages'] as $page_key => $page_item) {
if (is_array($page_item)) {
if (array_key_exists('tag_open', $page_item)) {
$pagination_rendered .= $page_item['tag_open'];
}
if (array_key_exists('link', $page_item) && $page_item['link'] != null) {
$pagination_rendered .= '<a href="' . $page_item['link'] . '">';
}
if (array_key_exists('text', $page_item)) {
$pagination_rendered .= $page_item['text'];
}
if (array_key_exists('link', $page_item) && $page_item['link'] != null) {
$pagination_rendered .= '</a>';
}
if (array_key_exists('tag_close', $page_item)) {
$pagination_rendered .= $page_item['tag_close'];
}
}
}
unset($page_item, $page_key);
}
if (array_key_exists('overall_tag_close', $pagination_data)) {
$pagination_rendered .= $pagination_data['overall_tag_close'];
}
$pagination_rendered .= "\n";
// end render the pagination ----------------------------------------------------------------------------------------
$output = $result_string;
if (array_key_exists('total_pages', $pagination_data)) {
$output = str_replace(':total_pages', $pagination_data['total_pages'], $output);
}
if (array_key_exists('page_number_type', $pagination_data)) {
$output = str_replace(':page_number_type', $pagination_data['total_pages'], $output);
}
if (array_key_exists('current_page_number_displaying', $pagination_data)) {
$output = str_replace(':current_page_number_displaying', $pagination_data['current_page_number_displaying'], $output);
}
if (isset($pagination_rendered)) {
$output = str_replace(':pagination', $pagination_rendered, $output);
}
unset($pagination_data, $pagination_rendered);
return $output;
} | [
"public",
"function",
"createLinks",
"(",
"$",
"result_string",
"=",
"'Displaying page :current_page_number_displaying of :total_pages<br>:pagination'",
")",
"{",
"$",
"pagination_data",
"=",
"$",
"this",
"->",
"getPaginationData",
"(",
")",
";",
"if",
"(",
"!",
"is_arr... | Create pagination links and return the html data.
@param string $result_string The pagination results. Add these place holders for replace with content while generating pages. (:total_pages, :page_number_type, :current_page_number_displaying, :pagination).
@return string Return created pagination links in HTML format. | [
"Create",
"pagination",
"links",
"and",
"return",
"the",
"html",
"data",
"."
] | d86bdc890f665eda1437e4659829e21fb0df1f60 | https://github.com/Rundiz/pagination/blob/d86bdc890f665eda1437e4659829e21fb0df1f60/Rundiz/Pagination/Pagination.php#L253-L314 | train |
Rundiz/pagination | Rundiz/Pagination/Pagination.php | Pagination.generateUrl | private function generateUrl($page_value, $direction = '', $return_value_only = false)
{
switch ($direction) {
case 'first':
if ($this->page_number_type == 'start_num') {
$page_value = 0;
} elseif ($this->page_number_type == 'page_num') {
$page_value = 1;
}
break;
case 'previous':
if ($this->page_number_type == 'start_num') {
$page_value = ($page_value - $this->items_per_page);
if ($page_value < 0) {
$page_value = 0;
}
} elseif ($this->page_number_type == 'page_num') {
$page_value = ($page_value - 1);
if ($page_value <= 0) {
$page_value = 1;
}
}
break;
case 'next':
if ($this->page_number_type == 'start_num') {
$page_value = ($page_value + $this->items_per_page);
if ($page_value > (($this->total_pages*$this->items_per_page) - $this->items_per_page)) {
$page_value = (($this->total_pages*$this->items_per_page) - $this->items_per_page);
}
} elseif ($this->page_number_type == 'page_num') {
$page_value = ($page_value + 1);
if ($page_value > (($this->total_pages*$this->items_per_page) / $this->items_per_page)) {
$page_value = (($this->total_pages*$this->items_per_page) / $this->items_per_page);
}
}
break;
case 'last':
if ($this->page_number_type == 'start_num') {
$page_value = ($page_value - $this->items_per_page);
} elseif ($this->page_number_type == 'page_num') {
$page_value = ($page_value / $this->items_per_page);
}
break;
default:
// calculate page querystring number from generated before and after current pages. example 1 2 [3] 4 5 current is 3, generated is 1 2 and 4 5
if ($this->page_number_type == 'start_num') {
$page_value = (($page_value * $this->items_per_page) - $this->items_per_page);
}
break;
}
if ($return_value_only === true) {
return $page_value;
} else {
return str_replace('%PAGENUMBER%', $page_value, $this->base_url);
}
} | php | private function generateUrl($page_value, $direction = '', $return_value_only = false)
{
switch ($direction) {
case 'first':
if ($this->page_number_type == 'start_num') {
$page_value = 0;
} elseif ($this->page_number_type == 'page_num') {
$page_value = 1;
}
break;
case 'previous':
if ($this->page_number_type == 'start_num') {
$page_value = ($page_value - $this->items_per_page);
if ($page_value < 0) {
$page_value = 0;
}
} elseif ($this->page_number_type == 'page_num') {
$page_value = ($page_value - 1);
if ($page_value <= 0) {
$page_value = 1;
}
}
break;
case 'next':
if ($this->page_number_type == 'start_num') {
$page_value = ($page_value + $this->items_per_page);
if ($page_value > (($this->total_pages*$this->items_per_page) - $this->items_per_page)) {
$page_value = (($this->total_pages*$this->items_per_page) - $this->items_per_page);
}
} elseif ($this->page_number_type == 'page_num') {
$page_value = ($page_value + 1);
if ($page_value > (($this->total_pages*$this->items_per_page) / $this->items_per_page)) {
$page_value = (($this->total_pages*$this->items_per_page) / $this->items_per_page);
}
}
break;
case 'last':
if ($this->page_number_type == 'start_num') {
$page_value = ($page_value - $this->items_per_page);
} elseif ($this->page_number_type == 'page_num') {
$page_value = ($page_value / $this->items_per_page);
}
break;
default:
// calculate page querystring number from generated before and after current pages. example 1 2 [3] 4 5 current is 3, generated is 1 2 and 4 5
if ($this->page_number_type == 'start_num') {
$page_value = (($page_value * $this->items_per_page) - $this->items_per_page);
}
break;
}
if ($return_value_only === true) {
return $page_value;
} else {
return str_replace('%PAGENUMBER%', $page_value, $this->base_url);
}
} | [
"private",
"function",
"generateUrl",
"(",
"$",
"page_value",
",",
"$",
"direction",
"=",
"''",
",",
"$",
"return_value_only",
"=",
"false",
")",
"{",
"switch",
"(",
"$",
"direction",
")",
"{",
"case",
"'first'",
":",
"if",
"(",
"$",
"this",
"->",
"pag... | Generate pagination URL.
@param integer $page_value Page number value.
@param string $direction The direction can be first, previous, next, last, number.
@param boolean $return_value_ony Set to true to return the page value only. Set to false to return as URL.
@return string Return generated URL. | [
"Generate",
"pagination",
"URL",
"."
] | d86bdc890f665eda1437e4659829e21fb0df1f60 | https://github.com/Rundiz/pagination/blob/d86bdc890f665eda1437e4659829e21fb0df1f60/Rundiz/Pagination/Pagination.php#L325-L381 | train |
Rundiz/pagination | Rundiz/Pagination/Pagination.php | Pagination.isCurrentlyFirstPage | private function isCurrentlyFirstPage()
{
if ($this->page_number_type === 'start_num') {
if ($this->page_number_value === 0) {
return true;
}
return false;
} elseif ($this->page_number_type === 'page_num') {
if ($this->page_number_value === 1) {
return true;
}
return false;
}
return false;
} | php | private function isCurrentlyFirstPage()
{
if ($this->page_number_type === 'start_num') {
if ($this->page_number_value === 0) {
return true;
}
return false;
} elseif ($this->page_number_type === 'page_num') {
if ($this->page_number_value === 1) {
return true;
}
return false;
}
return false;
} | [
"private",
"function",
"isCurrentlyFirstPage",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"page_number_type",
"===",
"'start_num'",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"page_number_value",
"===",
"0",
")",
"{",
"return",
"true",
";",
"}",
"return",
... | Is it currently in the first page?
@return boolean Return true if the page that is displaying is first page, return false if otherwise. | [
"Is",
"it",
"currently",
"in",
"the",
"first",
"page?"
] | d86bdc890f665eda1437e4659829e21fb0df1f60 | https://github.com/Rundiz/pagination/blob/d86bdc890f665eda1437e4659829e21fb0df1f60/Rundiz/Pagination/Pagination.php#L598-L612 | train |
Rundiz/pagination | Rundiz/Pagination/Pagination.php | Pagination.isCurrentlyLastPage | private function isCurrentlyLastPage()
{
if ($this->page_number_type === 'start_num') {
if ($this->page_number_value >= ($this->total_pages*$this->items_per_page)-$this->items_per_page) {
return true;
}
return false;
} elseif ($this->page_number_type === 'page_num') {
if ($this->page_number_value >= $this->total_pages) {
return true;
}
return false;
}
return false;
} | php | private function isCurrentlyLastPage()
{
if ($this->page_number_type === 'start_num') {
if ($this->page_number_value >= ($this->total_pages*$this->items_per_page)-$this->items_per_page) {
return true;
}
return false;
} elseif ($this->page_number_type === 'page_num') {
if ($this->page_number_value >= $this->total_pages) {
return true;
}
return false;
}
return false;
} | [
"private",
"function",
"isCurrentlyLastPage",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"page_number_type",
"===",
"'start_num'",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"page_number_value",
">=",
"(",
"$",
"this",
"->",
"total_pages",
"*",
"$",
"this",... | Is it currently in the last page?
@return boolean Return true if the page that is displaying is last page, return false if otherwise. | [
"Is",
"it",
"currently",
"in",
"the",
"last",
"page?"
] | d86bdc890f665eda1437e4659829e21fb0df1f60 | https://github.com/Rundiz/pagination/blob/d86bdc890f665eda1437e4659829e21fb0df1f60/Rundiz/Pagination/Pagination.php#L620-L634 | train |
Rundiz/pagination | Rundiz/Pagination/Pagination.php | Pagination.validateCorrectProperties | private function validateCorrectProperties()
{
if (!is_bool($this->current_page_link)) {
$this->current_page_link = false;
}
if (!is_bool($this->first_page_always_show)) {
$this->first_page_always_show = false;
}
if (is_numeric($this->items_per_page)) {
$this->items_per_page = intval($this->items_per_page);
if ($this->items_per_page <= 0) {
$this->items_per_page = 10;
}
} elseif (!is_numeric($this->items_per_page)) {
$this->items_per_page = 10;
}
if (!is_bool($this->last_page_always_show)) {
$this->last_page_always_show = false;
}
if (!is_bool($this->next_page_always_show)) {
$this->next_page_always_show = false;
}
if (is_numeric($this->number_adjacent_pages)) {
$this->number_adjacent_pages = intval($this->number_adjacent_pages);
if ($this->number_adjacent_pages < 0) {
$this->number_adjacent_pages = 5;
}
} else {
$this->number_adjacent_pages = 5;
}
if (!is_bool($this->number_display)) {
$this->number_display = false;
}
if ($this->page_number_type != 'start_num' && $this->page_number_type != 'page_num') {
$this->page_number_type = 'start_num';
}
if (!is_bool($this->previous_page_always_show)) {
$this->previous_page_always_show = false;
}
if (is_numeric($this->unavailable_after)) {
$this->unavailable_after = intval($this->unavailable_after);
if ($this->unavailable_after <= 0) {
$this->unavailable_after = 2;
}
} else {
$this->unavailable_after = false;
}
if (is_numeric($this->unavailable_before)) {
$this->unavailable_before = intval($this->unavailable_before);
if ($this->unavailable_before <= 0) {
$this->unavailable_before = 2;
}
} else {
$this->unavailable_before = false;
}
if (!is_bool($this->unavailable_display)) {
$this->unavailable_display = false;
}
} | php | private function validateCorrectProperties()
{
if (!is_bool($this->current_page_link)) {
$this->current_page_link = false;
}
if (!is_bool($this->first_page_always_show)) {
$this->first_page_always_show = false;
}
if (is_numeric($this->items_per_page)) {
$this->items_per_page = intval($this->items_per_page);
if ($this->items_per_page <= 0) {
$this->items_per_page = 10;
}
} elseif (!is_numeric($this->items_per_page)) {
$this->items_per_page = 10;
}
if (!is_bool($this->last_page_always_show)) {
$this->last_page_always_show = false;
}
if (!is_bool($this->next_page_always_show)) {
$this->next_page_always_show = false;
}
if (is_numeric($this->number_adjacent_pages)) {
$this->number_adjacent_pages = intval($this->number_adjacent_pages);
if ($this->number_adjacent_pages < 0) {
$this->number_adjacent_pages = 5;
}
} else {
$this->number_adjacent_pages = 5;
}
if (!is_bool($this->number_display)) {
$this->number_display = false;
}
if ($this->page_number_type != 'start_num' && $this->page_number_type != 'page_num') {
$this->page_number_type = 'start_num';
}
if (!is_bool($this->previous_page_always_show)) {
$this->previous_page_always_show = false;
}
if (is_numeric($this->unavailable_after)) {
$this->unavailable_after = intval($this->unavailable_after);
if ($this->unavailable_after <= 0) {
$this->unavailable_after = 2;
}
} else {
$this->unavailable_after = false;
}
if (is_numeric($this->unavailable_before)) {
$this->unavailable_before = intval($this->unavailable_before);
if ($this->unavailable_before <= 0) {
$this->unavailable_before = 2;
}
} else {
$this->unavailable_before = false;
}
if (!is_bool($this->unavailable_display)) {
$this->unavailable_display = false;
}
} | [
"private",
"function",
"validateCorrectProperties",
"(",
")",
"{",
"if",
"(",
"!",
"is_bool",
"(",
"$",
"this",
"->",
"current_page_link",
")",
")",
"{",
"$",
"this",
"->",
"current_page_link",
"=",
"false",
";",
"}",
"if",
"(",
"!",
"is_bool",
"(",
"$",... | Validate that properties values have correct data and type.
It will be set to default if the values are incorrect. | [
"Validate",
"that",
"properties",
"values",
"have",
"correct",
"data",
"and",
"type",
".",
"It",
"will",
"be",
"set",
"to",
"default",
"if",
"the",
"values",
"are",
"incorrect",
"."
] | d86bdc890f665eda1437e4659829e21fb0df1f60 | https://github.com/Rundiz/pagination/blob/d86bdc890f665eda1437e4659829e21fb0df1f60/Rundiz/Pagination/Pagination.php#L641-L710 | train |
Rundiz/pagination | Rundiz/Pagination/Pagination.php | Pagination.validateRequiredProperties | private function validateRequiredProperties()
{
if ($this->base_url == null) {
throw new \Exception('The base_url property was not set.');
}
if (is_numeric($this->total_records)) {
$this->total_records = intval($this->total_records);
} else {
throw new \Exception('The total_records property was not set.');
}
if (!is_numeric($this->page_number_value)) {
throw new \Exception('The page_number_value property was not set.');
}
} | php | private function validateRequiredProperties()
{
if ($this->base_url == null) {
throw new \Exception('The base_url property was not set.');
}
if (is_numeric($this->total_records)) {
$this->total_records = intval($this->total_records);
} else {
throw new \Exception('The total_records property was not set.');
}
if (!is_numeric($this->page_number_value)) {
throw new \Exception('The page_number_value property was not set.');
}
} | [
"private",
"function",
"validateRequiredProperties",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"base_url",
"==",
"null",
")",
"{",
"throw",
"new",
"\\",
"Exception",
"(",
"'The base_url property was not set.'",
")",
";",
"}",
"if",
"(",
"is_numeric",
"(",
... | Validate required properties values.
@throws \Exception Throw the errors on failure such as some required property is missing. | [
"Validate",
"required",
"properties",
"values",
"."
] | d86bdc890f665eda1437e4659829e21fb0df1f60 | https://github.com/Rundiz/pagination/blob/d86bdc890f665eda1437e4659829e21fb0df1f60/Rundiz/Pagination/Pagination.php#L718-L733 | train |
orchestral/messages | src/MessageBag.php | MessageBag.setSessionStore | public function setSessionStore(Session $session)
{
$this->session = $session;
$this->instance = null;
return $this;
} | php | public function setSessionStore(Session $session)
{
$this->session = $session;
$this->instance = null;
return $this;
} | [
"public",
"function",
"setSessionStore",
"(",
"Session",
"$",
"session",
")",
"{",
"$",
"this",
"->",
"session",
"=",
"$",
"session",
";",
"$",
"this",
"->",
"instance",
"=",
"null",
";",
"return",
"$",
"this",
";",
"}"
] | Set the session store.
@param \Illuminate\Contracts\Session\Session $session
@return $this | [
"Set",
"the",
"session",
"store",
"."
] | e09600a53690aac6108e54d999e7943d41e72800 | https://github.com/orchestral/messages/blob/e09600a53690aac6108e54d999e7943d41e72800/src/MessageBag.php#L33-L39 | train |
orchestral/messages | src/MessageBag.php | MessageBag.retrieve | public function retrieve()
{
$messages = null;
if (\is_null($this->instance)) {
$this->instance = new static();
$this->instance->setSessionStore($this->session);
if ($this->session->has('message')) {
$messages = \unserialize($this->session->pull('message'), ['allowed_classes' => false]);
}
if (\is_array($messages)) {
$this->instance->merge($messages);
}
}
return $this->instance;
} | php | public function retrieve()
{
$messages = null;
if (\is_null($this->instance)) {
$this->instance = new static();
$this->instance->setSessionStore($this->session);
if ($this->session->has('message')) {
$messages = \unserialize($this->session->pull('message'), ['allowed_classes' => false]);
}
if (\is_array($messages)) {
$this->instance->merge($messages);
}
}
return $this->instance;
} | [
"public",
"function",
"retrieve",
"(",
")",
"{",
"$",
"messages",
"=",
"null",
";",
"if",
"(",
"\\",
"is_null",
"(",
"$",
"this",
"->",
"instance",
")",
")",
"{",
"$",
"this",
"->",
"instance",
"=",
"new",
"static",
"(",
")",
";",
"$",
"this",
"-... | Retrieve Message instance from Session, the data should be in
serialize, so we need to unserialize it first.
@return static | [
"Retrieve",
"Message",
"instance",
"from",
"Session",
"the",
"data",
"should",
"be",
"in",
"serialize",
"so",
"we",
"need",
"to",
"unserialize",
"it",
"first",
"."
] | e09600a53690aac6108e54d999e7943d41e72800 | https://github.com/orchestral/messages/blob/e09600a53690aac6108e54d999e7943d41e72800/src/MessageBag.php#L73-L91 | train |
orchestral/messages | src/MessageBag.php | MessageBag.save | public function save(): void
{
$this->session->flash('message', $this->serialize());
$this->instance = null;
} | php | public function save(): void
{
$this->session->flash('message', $this->serialize());
$this->instance = null;
} | [
"public",
"function",
"save",
"(",
")",
":",
"void",
"{",
"$",
"this",
"->",
"session",
"->",
"flash",
"(",
"'message'",
",",
"$",
"this",
"->",
"serialize",
"(",
")",
")",
";",
"$",
"this",
"->",
"instance",
"=",
"null",
";",
"}"
] | Store current instance.
@return void | [
"Store",
"current",
"instance",
"."
] | e09600a53690aac6108e54d999e7943d41e72800 | https://github.com/orchestral/messages/blob/e09600a53690aac6108e54d999e7943d41e72800/src/MessageBag.php#L98-L102 | train |
k-gun/oppa | src/ActiveRecord/Entity.php | Entity.addMethod | public function addMethod(string $methodName, callable $methodClosure): void
{
$this->methods[strtolower($methodName)] = $methodClosure->bindTo($this);
} | php | public function addMethod(string $methodName, callable $methodClosure): void
{
$this->methods[strtolower($methodName)] = $methodClosure->bindTo($this);
} | [
"public",
"function",
"addMethod",
"(",
"string",
"$",
"methodName",
",",
"callable",
"$",
"methodClosure",
")",
":",
"void",
"{",
"$",
"this",
"->",
"methods",
"[",
"strtolower",
"(",
"$",
"methodName",
")",
"]",
"=",
"$",
"methodClosure",
"->",
"bindTo",... | Add method.
@param string $methodName
@param callable $methodClosure
@return void | [
"Add",
"method",
"."
] | 3a20b5cc85cb3899c41737678798ec3de73a3836 | https://github.com/k-gun/oppa/blob/3a20b5cc85cb3899c41737678798ec3de73a3836/src/ActiveRecord/Entity.php#L220-L223 | train |
Lekarna/DoctrineFilters | src/DI/FiltersExtension.php | FiltersExtension.passFilterManagerToListener | private function passFilterManagerToListener()
{
$enableFiltersSubscriberDefinition = $this->definitionFinder->getDefinitionByType(
EnableFiltersSubscriber::class
);
$filterManagerServiceName = $this->definitionFinder->getServiceNameByType(FilterManagerInterface::class);
$enableFiltersSubscriberDefinition->addSetup(
'setFilterManager',
['@' . $filterManagerServiceName]
);
} | php | private function passFilterManagerToListener()
{
$enableFiltersSubscriberDefinition = $this->definitionFinder->getDefinitionByType(
EnableFiltersSubscriber::class
);
$filterManagerServiceName = $this->definitionFinder->getServiceNameByType(FilterManagerInterface::class);
$enableFiltersSubscriberDefinition->addSetup(
'setFilterManager',
['@' . $filterManagerServiceName]
);
} | [
"private",
"function",
"passFilterManagerToListener",
"(",
")",
"{",
"$",
"enableFiltersSubscriberDefinition",
"=",
"$",
"this",
"->",
"definitionFinder",
"->",
"getDefinitionByType",
"(",
"EnableFiltersSubscriber",
"::",
"class",
")",
";",
"$",
"filterManagerServiceName"... | Prevents circular reference. | [
"Prevents",
"circular",
"reference",
"."
] | 1cd5ac8495450e05bc2362149559ab500b015874 | https://github.com/Lekarna/DoctrineFilters/blob/1cd5ac8495450e05bc2362149559ab500b015874/src/DI/FiltersExtension.php#L60-L71 | train |
BenGorUser/UserBundle | src/BenGorUser/UserBundle/DependencyInjection/Compiler/SecurityServicesPass.php | SecurityServicesPass.formLoginAuthenticator | private function formLoginAuthenticator(ContainerBuilder $container, $routes, $user)
{
$container->setDefinition(
'bengor.user_bundle.security.authenticator.form_login_' . $user . '_authenticator',
new Definition(
FormLoginAuthenticator::class, [
$container->getDefinition('router.default'),
$container->getDefinition('bengor_user.' . $user . '.command_bus'),
[
'login' => $routes[$user]['login']['name'],
'login_check' => $routes[$user]['login_check']['name'],
'success_redirection_route' => $routes[$user]['success_redirection_route'],
],
]
)
)->setPublic(false);
$container->setAlias(
'bengor_user.' . $user . '.form_login_authenticator',
'bengor.user_bundle.security.authenticator.form_login_' . $user . '_authenticator'
);
} | php | private function formLoginAuthenticator(ContainerBuilder $container, $routes, $user)
{
$container->setDefinition(
'bengor.user_bundle.security.authenticator.form_login_' . $user . '_authenticator',
new Definition(
FormLoginAuthenticator::class, [
$container->getDefinition('router.default'),
$container->getDefinition('bengor_user.' . $user . '.command_bus'),
[
'login' => $routes[$user]['login']['name'],
'login_check' => $routes[$user]['login_check']['name'],
'success_redirection_route' => $routes[$user]['success_redirection_route'],
],
]
)
)->setPublic(false);
$container->setAlias(
'bengor_user.' . $user . '.form_login_authenticator',
'bengor.user_bundle.security.authenticator.form_login_' . $user . '_authenticator'
);
} | [
"private",
"function",
"formLoginAuthenticator",
"(",
"ContainerBuilder",
"$",
"container",
",",
"$",
"routes",
",",
"$",
"user",
")",
"{",
"$",
"container",
"->",
"setDefinition",
"(",
"'bengor.user_bundle.security.authenticator.form_login_'",
".",
"$",
"user",
".",
... | Registers service of the form login authenticator and its alias.
@param ContainerBuilder $container The container builder
@param array $routes Array which contains security routes
@param string $user The user name | [
"Registers",
"service",
"of",
"the",
"form",
"login",
"authenticator",
"and",
"its",
"alias",
"."
] | a6d0173496c269a6c80e1319d42eaed4b3bbbd4a | https://github.com/BenGorUser/UserBundle/blob/a6d0173496c269a6c80e1319d42eaed4b3bbbd4a/src/BenGorUser/UserBundle/DependencyInjection/Compiler/SecurityServicesPass.php#L59-L80 | train |
BenGorUser/UserBundle | src/BenGorUser/UserBundle/DependencyInjection/Compiler/SecurityServicesPass.php | SecurityServicesPass.userSymfonyDataTransformer | private function userSymfonyDataTransformer(ContainerBuilder $container, $user)
{
$container->setDefinition(
'bengor.user_bundle.security.' . $user . '_symfony_data_transformer',
new Definition(
UserSymfonyDataTransformer::class
)
)->setPublic(false);
$container->setAlias(
'bengor_user.' . $user . '.symfony_data_transformer',
'bengor.user_bundle.security.' . $user . '_symfony_data_transformer'
);
} | php | private function userSymfonyDataTransformer(ContainerBuilder $container, $user)
{
$container->setDefinition(
'bengor.user_bundle.security.' . $user . '_symfony_data_transformer',
new Definition(
UserSymfonyDataTransformer::class
)
)->setPublic(false);
$container->setAlias(
'bengor_user.' . $user . '.symfony_data_transformer',
'bengor.user_bundle.security.' . $user . '_symfony_data_transformer'
);
} | [
"private",
"function",
"userSymfonyDataTransformer",
"(",
"ContainerBuilder",
"$",
"container",
",",
"$",
"user",
")",
"{",
"$",
"container",
"->",
"setDefinition",
"(",
"'bengor.user_bundle.security.'",
".",
"$",
"user",
".",
"'_symfony_data_transformer'",
",",
"new"... | Registers service of the user Symfony data transformer and its alias.
@param ContainerBuilder $container The container builder
@param string $user The user name | [
"Registers",
"service",
"of",
"the",
"user",
"Symfony",
"data",
"transformer",
"and",
"its",
"alias",
"."
] | a6d0173496c269a6c80e1319d42eaed4b3bbbd4a | https://github.com/BenGorUser/UserBundle/blob/a6d0173496c269a6c80e1319d42eaed4b3bbbd4a/src/BenGorUser/UserBundle/DependencyInjection/Compiler/SecurityServicesPass.php#L88-L101 | train |
BenGorUser/UserBundle | src/BenGorUser/UserBundle/DependencyInjection/Compiler/SecurityServicesPass.php | SecurityServicesPass.userProvider | private function userProvider(ContainerBuilder $container, $user)
{
$container->setDefinition(
'bengor.user_bundle.security.' . $user . '_provider',
new Definition(
UserProvider::class, [
$container->getDefinition(
'bengor.user.application.query.' . $user . '_of_email'
),
$container->getDefinition(
'bengor.user_bundle.security.' . $user . '_symfony_data_transformer'
),
]
)
)->setPublic(false);
$container->setAlias(
'bengor_user.' . $user . '.provider',
'bengor.user_bundle.security.' . $user . '_provider'
);
} | php | private function userProvider(ContainerBuilder $container, $user)
{
$container->setDefinition(
'bengor.user_bundle.security.' . $user . '_provider',
new Definition(
UserProvider::class, [
$container->getDefinition(
'bengor.user.application.query.' . $user . '_of_email'
),
$container->getDefinition(
'bengor.user_bundle.security.' . $user . '_symfony_data_transformer'
),
]
)
)->setPublic(false);
$container->setAlias(
'bengor_user.' . $user . '.provider',
'bengor.user_bundle.security.' . $user . '_provider'
);
} | [
"private",
"function",
"userProvider",
"(",
"ContainerBuilder",
"$",
"container",
",",
"$",
"user",
")",
"{",
"$",
"container",
"->",
"setDefinition",
"(",
"'bengor.user_bundle.security.'",
".",
"$",
"user",
".",
"'_provider'",
",",
"new",
"Definition",
"(",
"Us... | Registers service of the user provider and its alias.
@param ContainerBuilder $container The container builder
@param string $user The user name | [
"Registers",
"service",
"of",
"the",
"user",
"provider",
"and",
"its",
"alias",
"."
] | a6d0173496c269a6c80e1319d42eaed4b3bbbd4a | https://github.com/BenGorUser/UserBundle/blob/a6d0173496c269a6c80e1319d42eaed4b3bbbd4a/src/BenGorUser/UserBundle/DependencyInjection/Compiler/SecurityServicesPass.php#L109-L129 | train |
smartboxgroup/core-bundle | Utils/Helper/DateTimeCreator.php | DateTimeCreator.getNowDateTime | public static function getNowDateTime()
{
if (PHP_VERSION_ID < 70100) {
$now = \DateTime::createFromFormat('U.u', \sprintf('%.6F', microtime(true)));
} else {
$now = new \DateTime(null);
}
return $now;
} | php | public static function getNowDateTime()
{
if (PHP_VERSION_ID < 70100) {
$now = \DateTime::createFromFormat('U.u', \sprintf('%.6F', microtime(true)));
} else {
$now = new \DateTime(null);
}
return $now;
} | [
"public",
"static",
"function",
"getNowDateTime",
"(",
")",
"{",
"if",
"(",
"PHP_VERSION_ID",
"<",
"70100",
")",
"{",
"$",
"now",
"=",
"\\",
"DateTime",
"::",
"createFromFormat",
"(",
"'U.u'",
",",
"\\",
"sprintf",
"(",
"'%.6F'",
",",
"microtime",
"(",
"... | Using the same strategy as Monolog does for creating time stamps with micro seconds.
microtime without \ is used as it we need to be able to ClockMock it.
@return \DateTime | [
"Using",
"the",
"same",
"strategy",
"as",
"Monolog",
"does",
"for",
"creating",
"time",
"stamps",
"with",
"micro",
"seconds",
"."
] | 88ffc0af6631efbea90425454ce0bce0c753504e | https://github.com/smartboxgroup/core-bundle/blob/88ffc0af6631efbea90425454ce0bce0c753504e/Utils/Helper/DateTimeCreator.php#L14-L23 | train |
eXpansionPluginPack/eXpansion2 | src/eXpansion/Framework/Core/Storage/PlayerStorage.php | PlayerStorage.getPlayerInfo | public function getPlayerInfo($login, $forceNew = false)
{
if (!isset($this->online[$login]) || $forceNew) {
// to make sure even if an exception happens, player has login and basic nickname
$playerInformation = new PlayerInfo();
$playerInformation->login = $login;
$playerDetails = new PlayerDetailedInfo();
$playerDetails->nickName = $login;
try {
//fetch additional informations
$playerInformation = $this->factory->getConnection()->getPlayerInfo($login);
$playerDetails = $this->factory->getConnection()->getDetailedPlayerInfo($login);
} catch (InvalidArgumentException $e) {
$this->logger->error("Login unknown: $login", ["exception" => $e]);
$this->console->writeln('$f00Login Unknown: '.$login.' dedicated server said: $fff'.$e->getMessage());
} catch (FaultException $ex) {
$this->logger->error("Login unknown: $login", ["exception" => $ex]);
$this->console->writeln('$f00Login Unknown: '.$login.' dedicated server said: $fff'.$ex->getMessage());
}
return $this->playerFactory->createPlayer($playerInformation, $playerDetails);
}
return $this->online[$login];
} | php | public function getPlayerInfo($login, $forceNew = false)
{
if (!isset($this->online[$login]) || $forceNew) {
// to make sure even if an exception happens, player has login and basic nickname
$playerInformation = new PlayerInfo();
$playerInformation->login = $login;
$playerDetails = new PlayerDetailedInfo();
$playerDetails->nickName = $login;
try {
//fetch additional informations
$playerInformation = $this->factory->getConnection()->getPlayerInfo($login);
$playerDetails = $this->factory->getConnection()->getDetailedPlayerInfo($login);
} catch (InvalidArgumentException $e) {
$this->logger->error("Login unknown: $login", ["exception" => $e]);
$this->console->writeln('$f00Login Unknown: '.$login.' dedicated server said: $fff'.$e->getMessage());
} catch (FaultException $ex) {
$this->logger->error("Login unknown: $login", ["exception" => $ex]);
$this->console->writeln('$f00Login Unknown: '.$login.' dedicated server said: $fff'.$ex->getMessage());
}
return $this->playerFactory->createPlayer($playerInformation, $playerDetails);
}
return $this->online[$login];
} | [
"public",
"function",
"getPlayerInfo",
"(",
"$",
"login",
",",
"$",
"forceNew",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"online",
"[",
"$",
"login",
"]",
")",
"||",
"$",
"forceNew",
")",
"{",
"// to make sure even if an... | Get information about a player.
@param string $login
@param bool $forceNew
@return Player | [
"Get",
"information",
"about",
"a",
"player",
"."
] | e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31 | https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/Core/Storage/PlayerStorage.php#L79-L103 | train |
eXpansionPluginPack/eXpansion2 | src/eXpansion/Framework/Core/Storage/PlayerStorage.php | PlayerStorage.onPlayerConnect | public function onPlayerConnect(Player $playerData)
{
$login = $playerData->getLogin();
$this->online[$login] = $playerData;
if ($playerData->isSpectator()) {
$this->spectators[$login] = $playerData;
} else {
$this->players[$login] = $playerData;
}
} | php | public function onPlayerConnect(Player $playerData)
{
$login = $playerData->getLogin();
$this->online[$login] = $playerData;
if ($playerData->isSpectator()) {
$this->spectators[$login] = $playerData;
} else {
$this->players[$login] = $playerData;
}
} | [
"public",
"function",
"onPlayerConnect",
"(",
"Player",
"$",
"playerData",
")",
"{",
"$",
"login",
"=",
"$",
"playerData",
"->",
"getLogin",
"(",
")",
";",
"$",
"this",
"->",
"online",
"[",
"$",
"login",
"]",
"=",
"$",
"playerData",
";",
"if",
"(",
"... | Fetch player data & store it when player connects.
@inheritdoc | [
"Fetch",
"player",
"data",
"&",
"store",
"it",
"when",
"player",
"connects",
"."
] | e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31 | https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/Core/Storage/PlayerStorage.php#L110-L121 | train |
eXpansionPluginPack/eXpansion2 | src/eXpansion/Framework/Core/Storage/PlayerStorage.php | PlayerStorage.onPlayerInfoChanged | public function onPlayerInfoChanged(Player $oldPlayer, Player $player)
{
unset($this->players[$player->getLogin()]);
unset($this->spectators[$player->getLogin()]);
$this->onPlayerConnect($player);
} | php | public function onPlayerInfoChanged(Player $oldPlayer, Player $player)
{
unset($this->players[$player->getLogin()]);
unset($this->spectators[$player->getLogin()]);
$this->onPlayerConnect($player);
} | [
"public",
"function",
"onPlayerInfoChanged",
"(",
"Player",
"$",
"oldPlayer",
",",
"Player",
"$",
"player",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"players",
"[",
"$",
"player",
"->",
"getLogin",
"(",
")",
"]",
")",
";",
"unset",
"(",
"$",
"this",
... | Change the status of the players.
@inheritdoc | [
"Change",
"the",
"status",
"of",
"the",
"players",
"."
] | e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31 | https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/Core/Storage/PlayerStorage.php#L138-L144 | train |
vube/php-filesystem | src/Vube/FileSystem/Installer.php | Installer.installFile | public function installFile($sSourcePath, $sInstallPath)
{
// If the temp file doesn't exist, we cannot install it
if(! file_exists($sSourcePath))
throw new NoSuchFileException($sSourcePath, 1);
try
{
// Create the install directory if needed
$sInstallDir = dirname($sInstallPath);
$this->installDir($sInstallDir);
}
catch(Exception $e)
{
throw new Exception("Cannot install file, no such directory no perms to create it: $sInstallPath", 11, $e);
}
// First move temp path up to a temporary filename on the install drive
$sTempInstallPath = $this->findTempSafeInstallPath($sInstallPath);
// @silence copy() PHP warnings, we check for failure and throw our own exception
$success = true;
$originalUmask = umask(0377); // set secure copy() permissions (read-only by current user, nobody else has ANY perms on it at all)
if(! @copy($sSourcePath, $sTempInstallPath))
$success = false;
umask($originalUmask); // reinstate original umask
if(! $success)
throw new Exception("Unable to copy file to temp install path: $sTempInstallPath", 17);
// Explicitly set the file owner and permissions of the newly copied file to be the same
// as the source path. PHP copy() seems to disregard the settings of the source file and
// instead use the current proc's umask() and user identity.
clearstatcache(); // We don't care what the cache says, we want to know the current stat info
$hSrcStat = stat($sSourcePath);
$sSrcOwner = $hSrcStat['uid'];
$sSrcGroup = $hSrcStat['gid'];
$sSrcMode = $hSrcStat['mode'];
$hDstStat = stat($sTempInstallPath);
$sDstOwner = $hDstStat['uid'];
$sDstGroup = $hDstStat['gid'];
$sDstMode = $hDstStat['mode'];
if($sSrcOwner !== $sDstOwner)
@chown($sTempInstallPath, $sSrcOwner);
if($sSrcGroup !== $sDstGroup)
@chgrp($sTempInstallPath, $sSrcGroup);
if($sSrcMode !== $sDstMode)
@chmod($sTempInstallPath, $sSrcMode);
// Now rename the temp path to the final location
// @silence rename() PHP warnings, we check for failure and throw our own exception
if(! @rename($sTempInstallPath, $sInstallPath))
throw new Exception("Unable to rename temp file to $sInstallPath", 21);
} | php | public function installFile($sSourcePath, $sInstallPath)
{
// If the temp file doesn't exist, we cannot install it
if(! file_exists($sSourcePath))
throw new NoSuchFileException($sSourcePath, 1);
try
{
// Create the install directory if needed
$sInstallDir = dirname($sInstallPath);
$this->installDir($sInstallDir);
}
catch(Exception $e)
{
throw new Exception("Cannot install file, no such directory no perms to create it: $sInstallPath", 11, $e);
}
// First move temp path up to a temporary filename on the install drive
$sTempInstallPath = $this->findTempSafeInstallPath($sInstallPath);
// @silence copy() PHP warnings, we check for failure and throw our own exception
$success = true;
$originalUmask = umask(0377); // set secure copy() permissions (read-only by current user, nobody else has ANY perms on it at all)
if(! @copy($sSourcePath, $sTempInstallPath))
$success = false;
umask($originalUmask); // reinstate original umask
if(! $success)
throw new Exception("Unable to copy file to temp install path: $sTempInstallPath", 17);
// Explicitly set the file owner and permissions of the newly copied file to be the same
// as the source path. PHP copy() seems to disregard the settings of the source file and
// instead use the current proc's umask() and user identity.
clearstatcache(); // We don't care what the cache says, we want to know the current stat info
$hSrcStat = stat($sSourcePath);
$sSrcOwner = $hSrcStat['uid'];
$sSrcGroup = $hSrcStat['gid'];
$sSrcMode = $hSrcStat['mode'];
$hDstStat = stat($sTempInstallPath);
$sDstOwner = $hDstStat['uid'];
$sDstGroup = $hDstStat['gid'];
$sDstMode = $hDstStat['mode'];
if($sSrcOwner !== $sDstOwner)
@chown($sTempInstallPath, $sSrcOwner);
if($sSrcGroup !== $sDstGroup)
@chgrp($sTempInstallPath, $sSrcGroup);
if($sSrcMode !== $sDstMode)
@chmod($sTempInstallPath, $sSrcMode);
// Now rename the temp path to the final location
// @silence rename() PHP warnings, we check for failure and throw our own exception
if(! @rename($sTempInstallPath, $sInstallPath))
throw new Exception("Unable to rename temp file to $sInstallPath", 21);
} | [
"public",
"function",
"installFile",
"(",
"$",
"sSourcePath",
",",
"$",
"sInstallPath",
")",
"{",
"// If the temp file doesn't exist, we cannot install it",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"sSourcePath",
")",
")",
"throw",
"new",
"NoSuchFileException",
"(",
... | Safely install a file
This will first make a temporary copy of the file in the same directory as the
new $sInstallPath. Thus if there are any problems or delay associated with NFS
or other remote-mounted/virtual file systems, the production file will not be
affected during the copy. Once the file has been totally copied, an atomic
rename will put it into place.
@param string $sSourcePath
@param string $sInstallPath
@throws NoSuchFileException If $sSourcePath does not exist
@throws Exception if unable to create parent directories of $sInstallPath
@throws Exception if unable to install temp file and/or unable to rename it to the $sInstallPath | [
"Safely",
"install",
"a",
"file"
] | 147513e8c3809a1d9d947d2753780c0671cc3194 | https://github.com/vube/php-filesystem/blob/147513e8c3809a1d9d947d2753780c0671cc3194/src/Vube/FileSystem/Installer.php#L123-L183 | train |
vube/php-filesystem | src/Vube/FileSystem/Installer.php | Installer.findTempSafeInstallPath | public function findTempSafeInstallPath($sInstallPath)
{
try
{
$sTemp = $this->appendTempExtension($sInstallPath);
while(file_exists($sTemp))
{
$sTemp = $this->appendTempExtension($sTemp);
}
}
catch(Exception $e)
{
throw new Exception("No available temp file found for: $sInstallPath", 0, $e);
}
return $sTemp;
} | php | public function findTempSafeInstallPath($sInstallPath)
{
try
{
$sTemp = $this->appendTempExtension($sInstallPath);
while(file_exists($sTemp))
{
$sTemp = $this->appendTempExtension($sTemp);
}
}
catch(Exception $e)
{
throw new Exception("No available temp file found for: $sInstallPath", 0, $e);
}
return $sTemp;
} | [
"public",
"function",
"findTempSafeInstallPath",
"(",
"$",
"sInstallPath",
")",
"{",
"try",
"{",
"$",
"sTemp",
"=",
"$",
"this",
"->",
"appendTempExtension",
"(",
"$",
"sInstallPath",
")",
";",
"while",
"(",
"file_exists",
"(",
"$",
"sTemp",
")",
")",
"{",... | Find an unused temporary safe install path
@param string $sInstallPath The path where we really want to install this file
@return string A temp filename in the same directory as $sInstallPath | [
"Find",
"an",
"unused",
"temporary",
"safe",
"install",
"path"
] | 147513e8c3809a1d9d947d2753780c0671cc3194 | https://github.com/vube/php-filesystem/blob/147513e8c3809a1d9d947d2753780c0671cc3194/src/Vube/FileSystem/Installer.php#L217-L234 | train |
rokka-io/rokka-client-php-cli | src/Command/StackCreateCommand.php | StackCreateCommand.displayResume | protected function displayResume(OutputInterface $output)
{
$output->write("Creation of a new stack [<info>{$this->collectedData['name']}</info>]", true);
foreach ($this->collectedData['operations'] as $name => $operation) {
$output->write(" * Operation [<info>$name</info>] with ".json_encode($operation->options), true);
}
} | php | protected function displayResume(OutputInterface $output)
{
$output->write("Creation of a new stack [<info>{$this->collectedData['name']}</info>]", true);
foreach ($this->collectedData['operations'] as $name => $operation) {
$output->write(" * Operation [<info>$name</info>] with ".json_encode($operation->options), true);
}
} | [
"protected",
"function",
"displayResume",
"(",
"OutputInterface",
"$",
"output",
")",
"{",
"$",
"output",
"->",
"write",
"(",
"\"Creation of a new stack [<info>{$this->collectedData['name']}</info>]\"",
",",
"true",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"collec... | Display a summary of the stack that will be created.
@param $output OutputInterface | [
"Display",
"a",
"summary",
"of",
"the",
"stack",
"that",
"will",
"be",
"created",
"."
] | ef22af122af65579a8607a0df976a9ce5248dbbb | https://github.com/rokka-io/rokka-client-php-cli/blob/ef22af122af65579a8607a0df976a9ce5248dbbb/src/Command/StackCreateCommand.php#L65-L71 | train |
eXpansionPluginPack/eXpansion2 | src/eXpansion/Bundle/Maps/Services/JukeboxService.php | JukeboxService.addMapFirst | public function addMapFirst(Map $map, $login = null, $force = false)
{
return $this->addMap($map, $login, $force, true);
} | php | public function addMapFirst(Map $map, $login = null, $force = false)
{
return $this->addMap($map, $login, $force, true);
} | [
"public",
"function",
"addMapFirst",
"(",
"Map",
"$",
"map",
",",
"$",
"login",
"=",
"null",
",",
"$",
"force",
"=",
"false",
")",
"{",
"return",
"$",
"this",
"->",
"addMap",
"(",
"$",
"map",
",",
"$",
"login",
",",
"$",
"force",
",",
"true",
")"... | Adds map as first item
@param Map $map
@param null $login
@param bool $force
@return bool | [
"Adds",
"map",
"as",
"first",
"item"
] | e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31 | https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Bundle/Maps/Services/JukeboxService.php#L63-L66 | train |
eXpansionPluginPack/eXpansion2 | src/eXpansion/Bundle/Maps/Services/JukeboxService.php | JukeboxService.addMapLast | public function addMapLast(Map $map, $login = null, $force = false)
{
return $this->addMap($map, $login, $force, false);
} | php | public function addMapLast(Map $map, $login = null, $force = false)
{
return $this->addMap($map, $login, $force, false);
} | [
"public",
"function",
"addMapLast",
"(",
"Map",
"$",
"map",
",",
"$",
"login",
"=",
"null",
",",
"$",
"force",
"=",
"false",
")",
"{",
"return",
"$",
"this",
"->",
"addMap",
"(",
"$",
"map",
",",
"$",
"login",
",",
"$",
"force",
",",
"false",
")"... | Adds map as last item
@param Map $map
@param null $login
@param bool $force
@return bool | [
"Adds",
"map",
"as",
"last",
"item"
] | e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31 | https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Bundle/Maps/Services/JukeboxService.php#L77-L80 | train |
eXpansionPluginPack/eXpansion2 | src/eXpansion/Bundle/Maps/Services/JukeboxService.php | JukeboxService.addMap | public function addMap(Map $map, $login = null, $force = false, $addFirst = false)
{
if (!$login) {
return false;
}
$player = $this->playerStorage->getPlayerInfo($login);
$jbMap = new JukeboxMap($map, $player);
if ($force) {
$this->add($jbMap, $addFirst);
return true;
}
// no some restrictions for admin
if ($this->adminGroups->hasPermission($login, "jukebox")) {
if ($this->checkMap($map) === false) {
$this->add($jbMap, $addFirst);
return true;
}
} else {
// restrict 1 map per 1 login
if ($this->checkLogin($login) === false && $this->checkMap($map) === false) {
$this->add($jbMap, $addFirst);
return true;
}
}
return false;
} | php | public function addMap(Map $map, $login = null, $force = false, $addFirst = false)
{
if (!$login) {
return false;
}
$player = $this->playerStorage->getPlayerInfo($login);
$jbMap = new JukeboxMap($map, $player);
if ($force) {
$this->add($jbMap, $addFirst);
return true;
}
// no some restrictions for admin
if ($this->adminGroups->hasPermission($login, "jukebox")) {
if ($this->checkMap($map) === false) {
$this->add($jbMap, $addFirst);
return true;
}
} else {
// restrict 1 map per 1 login
if ($this->checkLogin($login) === false && $this->checkMap($map) === false) {
$this->add($jbMap, $addFirst);
return true;
}
}
return false;
} | [
"public",
"function",
"addMap",
"(",
"Map",
"$",
"map",
",",
"$",
"login",
"=",
"null",
",",
"$",
"force",
"=",
"false",
",",
"$",
"addFirst",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"$",
"login",
")",
"{",
"return",
"false",
";",
"}",
"$",
"pl... | Adds map as last or first item
@param Map $map
@param null $login
@param bool $force
@param bool $addFirst
@return bool | [
"Adds",
"map",
"as",
"last",
"or",
"first",
"item"
] | e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31 | https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Bundle/Maps/Services/JukeboxService.php#L92-L125 | train |
eXpansionPluginPack/eXpansion2 | src/eXpansion/Bundle/Maps/Services/JukeboxService.php | JukeboxService.checkLogin | private function checkLogin($login)
{
foreach ($this->mapQueue as $jukeboxMap) {
if ($jukeboxMap->getPlayer()->getLogin() == $login) {
return true;
}
}
return false;
} | php | private function checkLogin($login)
{
foreach ($this->mapQueue as $jukeboxMap) {
if ($jukeboxMap->getPlayer()->getLogin() == $login) {
return true;
}
}
return false;
} | [
"private",
"function",
"checkLogin",
"(",
"$",
"login",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"mapQueue",
"as",
"$",
"jukeboxMap",
")",
"{",
"if",
"(",
"$",
"jukeboxMap",
"->",
"getPlayer",
"(",
")",
"->",
"getLogin",
"(",
")",
"==",
"$",
"log... | checks if login exists on queue
@param string $login
@return bool | [
"checks",
"if",
"login",
"exists",
"on",
"queue"
] | e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31 | https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Bundle/Maps/Services/JukeboxService.php#L216-L225 | train |
anklimsk/cakephp-theme | Vendor/PhpUnoconv/symfony/process/Pipes/WindowsPipes.php | WindowsPipes.removeFiles | private function removeFiles()
{
foreach ($this->files as $filename) {
if (file_exists($filename)) {
@unlink($filename);
}
}
$this->files = array();
} | php | private function removeFiles()
{
foreach ($this->files as $filename) {
if (file_exists($filename)) {
@unlink($filename);
}
}
$this->files = array();
} | [
"private",
"function",
"removeFiles",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"files",
"as",
"$",
"filename",
")",
"{",
"if",
"(",
"file_exists",
"(",
"$",
"filename",
")",
")",
"{",
"@",
"unlink",
"(",
"$",
"filename",
")",
";",
"}",
"}"... | Removes temporary files. | [
"Removes",
"temporary",
"files",
"."
] | b815a4aaabaaf03ef1df3d547200f73f332f38a7 | https://github.com/anklimsk/cakephp-theme/blob/b815a4aaabaaf03ef1df3d547200f73f332f38a7/Vendor/PhpUnoconv/symfony/process/Pipes/WindowsPipes.php#L191-L199 | train |
anklimsk/cakephp-theme | View/Helper/FilterHelper.php | FilterHelper._getSchemaCache | protected function _getSchemaCache($model = null) {
if (empty($model) || !isset($this->_schemaCache[$model])) {
return null;
}
return $this->_schemaCache[$model];
} | php | protected function _getSchemaCache($model = null) {
if (empty($model) || !isset($this->_schemaCache[$model])) {
return null;
}
return $this->_schemaCache[$model];
} | [
"protected",
"function",
"_getSchemaCache",
"(",
"$",
"model",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"model",
")",
"||",
"!",
"isset",
"(",
"$",
"this",
"->",
"_schemaCache",
"[",
"$",
"model",
"]",
")",
")",
"{",
"return",
"null",
"... | Return schema for model from cache.
@param string $model Name of model for return schema.
@return array|null Array of schema, or null on failure. | [
"Return",
"schema",
"for",
"model",
"from",
"cache",
"."
] | b815a4aaabaaf03ef1df3d547200f73f332f38a7 | https://github.com/anklimsk/cakephp-theme/blob/b815a4aaabaaf03ef1df3d547200f73f332f38a7/View/Helper/FilterHelper.php#L320-L326 | train |
anklimsk/cakephp-theme | View/Helper/FilterHelper.php | FilterHelper._setSchemaCache | protected function _setSchemaCache($model = null, $schema = null) {
if (empty($model)) {
return;
}
$this->_schemaCache[$model] = $schema;
} | php | protected function _setSchemaCache($model = null, $schema = null) {
if (empty($model)) {
return;
}
$this->_schemaCache[$model] = $schema;
} | [
"protected",
"function",
"_setSchemaCache",
"(",
"$",
"model",
"=",
"null",
",",
"$",
"schema",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"model",
")",
")",
"{",
"return",
";",
"}",
"$",
"this",
"->",
"_schemaCache",
"[",
"$",
"model",
"... | Add schema for model to cache.
@param string $model Name of model for return schema.
@param array|null $schema Schema of model.
@return void; | [
"Add",
"schema",
"for",
"model",
"to",
"cache",
"."
] | b815a4aaabaaf03ef1df3d547200f73f332f38a7 | https://github.com/anklimsk/cakephp-theme/blob/b815a4aaabaaf03ef1df3d547200f73f332f38a7/View/Helper/FilterHelper.php#L335-L341 | train |
anklimsk/cakephp-theme | View/Helper/FilterHelper.php | FilterHelper._getSchema | protected function _getSchema($model = null) {
$result = null;
if (empty($model)) {
return $result;
}
$modelObj = ClassRegistry::init($model, true);
if ($modelObj === false) {
return $result;
}
$result = $modelObj->schema();
if (empty($modelObj->virtualFields)) {
return $result;
}
foreach ($modelObj->virtualFields as $virtualFieldName => $virtualFieldVal) {
$result[$virtualFieldName] = ['type' => 'string'];
}
return $result;
} | php | protected function _getSchema($model = null) {
$result = null;
if (empty($model)) {
return $result;
}
$modelObj = ClassRegistry::init($model, true);
if ($modelObj === false) {
return $result;
}
$result = $modelObj->schema();
if (empty($modelObj->virtualFields)) {
return $result;
}
foreach ($modelObj->virtualFields as $virtualFieldName => $virtualFieldVal) {
$result[$virtualFieldName] = ['type' => 'string'];
}
return $result;
} | [
"protected",
"function",
"_getSchema",
"(",
"$",
"model",
"=",
"null",
")",
"{",
"$",
"result",
"=",
"null",
";",
"if",
"(",
"empty",
"(",
"$",
"model",
")",
")",
"{",
"return",
"$",
"result",
";",
"}",
"$",
"modelObj",
"=",
"ClassRegistry",
"::",
... | Return schema for model.
@param string $model Name of model for return schema.
@return array|null Array of schema, or null on failure. | [
"Return",
"schema",
"for",
"model",
"."
] | b815a4aaabaaf03ef1df3d547200f73f332f38a7 | https://github.com/anklimsk/cakephp-theme/blob/b815a4aaabaaf03ef1df3d547200f73f332f38a7/View/Helper/FilterHelper.php#L349-L370 | train |
anklimsk/cakephp-theme | View/Helper/FilterHelper.php | FilterHelper.openFilterForm | public function openFilterForm($usePost = false) {
$this->_setFlagUsePost($usePost);
$type = 'get';
$dataToggle = 'pjax-form';
if ($this->_getFlagUsePost()) {
$type = 'post';
$dataToggle = 'ajax-form';
} else {
$filterData = $this->getFilterData();
if (!empty($filterData)) {
$this->setFilterInputData($filterData);
}
$conditions = $this->getFilterConditions();
if (!empty($conditions)) {
$this->setFilterInputConditions($conditions);
}
}
$options = [
'data-toggle' => $dataToggle,
'type' => $type,
];
$optionsDefault = $this->_getOptionsForElem('openFilterForm');
$result = $this->ExtBs3Form->create(null, $options + $optionsDefault);
return $result;
} | php | public function openFilterForm($usePost = false) {
$this->_setFlagUsePost($usePost);
$type = 'get';
$dataToggle = 'pjax-form';
if ($this->_getFlagUsePost()) {
$type = 'post';
$dataToggle = 'ajax-form';
} else {
$filterData = $this->getFilterData();
if (!empty($filterData)) {
$this->setFilterInputData($filterData);
}
$conditions = $this->getFilterConditions();
if (!empty($conditions)) {
$this->setFilterInputConditions($conditions);
}
}
$options = [
'data-toggle' => $dataToggle,
'type' => $type,
];
$optionsDefault = $this->_getOptionsForElem('openFilterForm');
$result = $this->ExtBs3Form->create(null, $options + $optionsDefault);
return $result;
} | [
"public",
"function",
"openFilterForm",
"(",
"$",
"usePost",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"_setFlagUsePost",
"(",
"$",
"usePost",
")",
";",
"$",
"type",
"=",
"'get'",
";",
"$",
"dataToggle",
"=",
"'pjax-form'",
";",
"if",
"(",
"$",
"this"... | Return HTML open tag of filter form.
@param bool $usePost If True, using POST request.
GET otherwise.
@return string HTML open tag of form. | [
"Return",
"HTML",
"open",
"tag",
"of",
"filter",
"form",
"."
] | b815a4aaabaaf03ef1df3d547200f73f332f38a7 | https://github.com/anklimsk/cakephp-theme/blob/b815a4aaabaaf03ef1df3d547200f73f332f38a7/View/Helper/FilterHelper.php#L379-L405 | train |
anklimsk/cakephp-theme | View/Helper/FilterHelper.php | FilterHelper.closeFilterForm | public function closeFilterForm() {
$type = 'get';
if ($this->_getFlagUsePost()) {
$type = 'post';
}
$this->ExtBs3Form->requestType = $type;
$result = $this->ExtBs3Form->end();
return $result;
} | php | public function closeFilterForm() {
$type = 'get';
if ($this->_getFlagUsePost()) {
$type = 'post';
}
$this->ExtBs3Form->requestType = $type;
$result = $this->ExtBs3Form->end();
return $result;
} | [
"public",
"function",
"closeFilterForm",
"(",
")",
"{",
"$",
"type",
"=",
"'get'",
";",
"if",
"(",
"$",
"this",
"->",
"_getFlagUsePost",
"(",
")",
")",
"{",
"$",
"type",
"=",
"'post'",
";",
"}",
"$",
"this",
"->",
"ExtBs3Form",
"->",
"requestType",
"... | Return HTML close tag of filter form.
@return string HTML close tag of form. | [
"Return",
"HTML",
"close",
"tag",
"of",
"filter",
"form",
"."
] | b815a4aaabaaf03ef1df3d547200f73f332f38a7 | https://github.com/anklimsk/cakephp-theme/blob/b815a4aaabaaf03ef1df3d547200f73f332f38a7/View/Helper/FilterHelper.php#L412-L422 | train |
anklimsk/cakephp-theme | View/Helper/FilterHelper.php | FilterHelper._createPaginationTableRow | protected function _createPaginationTableRow($paginationFields = null) {
$result = '';
if (empty($paginationFields) || !is_array($paginationFields)) {
return $result;
}
$tableHeader = [];
$includeOptions = [
'class' => null,
'escape' => null,
];
foreach ($paginationFields as $paginationField => $paginationOptions) {
if (is_int($paginationField)) {
if (!is_string($paginationOptions)) {
continue;
}
$paginationField = $paginationOptions;
$paginationOptions = [];
}
if (strpos($paginationField, '.') === false) {
continue;
}
if (!is_array($paginationOptions)) {
$paginationOptions = [$paginationOptions];
}
$paginationFieldUse = $paginationField;
if (isset($paginationOptions['pagination-field']) && !empty($paginationOptions['pagination-field'])) {
$paginationFieldUse = $paginationOptions['pagination-field'];
}
$label = $paginationFieldUse;
if (isset($paginationOptions['label']) && !empty($paginationOptions['label'])) {
$label = $paginationOptions['label'];
}
$paginationSortLink = $label;
$paginationOptionsUse = array_intersect_key($paginationOptions, $includeOptions);
if (!isset($paginationOptions['disabled']) || !$paginationOptions['disabled']) {
$paginationSortLink = $this->ViewExtension->paginationSortPjax($paginationFieldUse, $label, $paginationOptionsUse);
}
if (isset($paginationOptions['class-header']) && !empty($paginationOptions['class-header'])) {
$paginationSortLink = [$paginationSortLink => ['class' => $paginationOptions['class-header']]];
}
$tableHeader[] = $paginationSortLink;
}
$tableHeader[] = [$this->_getOptionsForElem('paginTableRowHeaderActTitle') => ['class' => 'action hide-popup']];
$result = $this->Html->tableHeaders($tableHeader);
return $result;
} | php | protected function _createPaginationTableRow($paginationFields = null) {
$result = '';
if (empty($paginationFields) || !is_array($paginationFields)) {
return $result;
}
$tableHeader = [];
$includeOptions = [
'class' => null,
'escape' => null,
];
foreach ($paginationFields as $paginationField => $paginationOptions) {
if (is_int($paginationField)) {
if (!is_string($paginationOptions)) {
continue;
}
$paginationField = $paginationOptions;
$paginationOptions = [];
}
if (strpos($paginationField, '.') === false) {
continue;
}
if (!is_array($paginationOptions)) {
$paginationOptions = [$paginationOptions];
}
$paginationFieldUse = $paginationField;
if (isset($paginationOptions['pagination-field']) && !empty($paginationOptions['pagination-field'])) {
$paginationFieldUse = $paginationOptions['pagination-field'];
}
$label = $paginationFieldUse;
if (isset($paginationOptions['label']) && !empty($paginationOptions['label'])) {
$label = $paginationOptions['label'];
}
$paginationSortLink = $label;
$paginationOptionsUse = array_intersect_key($paginationOptions, $includeOptions);
if (!isset($paginationOptions['disabled']) || !$paginationOptions['disabled']) {
$paginationSortLink = $this->ViewExtension->paginationSortPjax($paginationFieldUse, $label, $paginationOptionsUse);
}
if (isset($paginationOptions['class-header']) && !empty($paginationOptions['class-header'])) {
$paginationSortLink = [$paginationSortLink => ['class' => $paginationOptions['class-header']]];
}
$tableHeader[] = $paginationSortLink;
}
$tableHeader[] = [$this->_getOptionsForElem('paginTableRowHeaderActTitle') => ['class' => 'action hide-popup']];
$result = $this->Html->tableHeaders($tableHeader);
return $result;
} | [
"protected",
"function",
"_createPaginationTableRow",
"(",
"$",
"paginationFields",
"=",
"null",
")",
"{",
"$",
"result",
"=",
"''",
";",
"if",
"(",
"empty",
"(",
"$",
"paginationFields",
")",
"||",
"!",
"is_array",
"(",
"$",
"paginationFields",
")",
")",
... | Returns a row of table headers with pagination links
@param array $paginationFields Array of fields for pagination in format:
- `key`: field of filter in format `model.field`;
- `value`: HTML options for pagination link.
If pagination field is not equal filter form input field, use
option: `pagination-field` => `model.field`.
For disable pagination, use option: `disabled` => true.
For setting class of header cell, use option `class-header` => `class-name`.
@return string Row of table headers with pagination links. | [
"Returns",
"a",
"row",
"of",
"table",
"headers",
"with",
"pagination",
"links"
] | b815a4aaabaaf03ef1df3d547200f73f332f38a7 | https://github.com/anklimsk/cakephp-theme/blob/b815a4aaabaaf03ef1df3d547200f73f332f38a7/View/Helper/FilterHelper.php#L437-L489 | train |
anklimsk/cakephp-theme | View/Helper/FilterHelper.php | FilterHelper.createFilterForm | public function createFilterForm($formInputs = null, $plugin = null, $usePrint = true, $exportType = null) {
$result = '';
if (empty($formInputs) || !is_array($formInputs)) {
return $result;
}
if ($usePrint) {
$urlOptions = $this->_getExtendOptionsPaginationUrl();
if (!isset($this->Paginator->options['url'])) {
$this->Paginator->options['url'] = [];
}
$this->Paginator->options['url'] = Hash::merge($this->Paginator->options['url'], $urlOptions);
}
$result .= $this->_createPaginationTableRow($formInputs);
$result .= $this->_createFilterTableRow($formInputs, $plugin, $usePrint, $exportType);
return $result;
} | php | public function createFilterForm($formInputs = null, $plugin = null, $usePrint = true, $exportType = null) {
$result = '';
if (empty($formInputs) || !is_array($formInputs)) {
return $result;
}
if ($usePrint) {
$urlOptions = $this->_getExtendOptionsPaginationUrl();
if (!isset($this->Paginator->options['url'])) {
$this->Paginator->options['url'] = [];
}
$this->Paginator->options['url'] = Hash::merge($this->Paginator->options['url'], $urlOptions);
}
$result .= $this->_createPaginationTableRow($formInputs);
$result .= $this->_createFilterTableRow($formInputs, $plugin, $usePrint, $exportType);
return $result;
} | [
"public",
"function",
"createFilterForm",
"(",
"$",
"formInputs",
"=",
"null",
",",
"$",
"plugin",
"=",
"null",
",",
"$",
"usePrint",
"=",
"true",
",",
"$",
"exportType",
"=",
"null",
")",
"{",
"$",
"result",
"=",
"''",
";",
"if",
"(",
"empty",
"(",
... | Returns a row of table header with pagination links and
filter form.
@param array $formInputs Array of inputs for filter form in format:
- `key`: field of filter in format `model.field`;
- `value`: HTML options for pagination link and filter input.
If pagination field is not equal filter form input field, use
option: `pagination-field` => `model.field`.
For disable pagination and filter form input, use option: `disabled` => true.
For setting class of header cell, use option `class-header` => `class-name`.
For setting class of pagination link, use option `class` => `class-name`.
For exclude form input, use option: `not-use-input` => true.
For escaping of title and attributes set escape to false to disable: `escape` => false.
@param string $plugin Name of plugin for target model of filter.
@param bool $usePrint If True, display Print button (default True).
@param string $exportType Extension of exported file, for display Export button.
@return string Row of table header. | [
"Returns",
"a",
"row",
"of",
"table",
"header",
"with",
"pagination",
"links",
"and",
"filter",
"form",
"."
] | b815a4aaabaaf03ef1df3d547200f73f332f38a7 | https://github.com/anklimsk/cakephp-theme/blob/b815a4aaabaaf03ef1df3d547200f73f332f38a7/View/Helper/FilterHelper.php#L664-L683 | train |
anklimsk/cakephp-theme | View/Helper/FilterHelper.php | FilterHelper.createGroupActionControls | public function createGroupActionControls($formInputs = null, $groupActions = null, $useSelectAll = false) {
$result = '';
if (empty($formInputs) || !is_array($formInputs) ||
(!empty($groupActions) && !is_array($groupActions)) ||
(empty($groupActions) && !$useSelectAll)) {
return $result;
}
if (empty($groupActions)) {
$groupActions = [];
}
$colspan = null;
$countFormInputs = count($formInputs);
if ($countFormInputs > 2) {
$colspan = $countFormInputs;
}
$selectOptions = [];
foreach ($groupActions as $value => $text) {
$selectOptions[] = compact('text', 'value');
}
$tableFoother = [];
if ($useSelectAll) {
if (!empty($colspan)) {
$colspan--;
}
$tableFoother[] = $this->_getOptionsForElem('createGroupActionControls.selectAllBtn');
}
$inputField = '';
if (!empty($selectOptions)) {
$this->ExtBs3Form->unlockField('FilterGroup.action');
$tableFoother[] = [
$this->ExtBs3Form->hidden('FilterGroup.action') . $this->_getOptionsForElem('createGroupActionControls.groupDataProcTitle'),
['colspan' => $colspan, 'class' => 'text-center']
];
$btnOptions = ['data-dialog-sel-options' => htmlentities(json_encode($selectOptions))];
$optionsDefault = $this->_getOptionsForElem('createGroupActionControls.performActionBtn');
$tableFoother[] = [
$this->ViewExtension->button(
'fas fa-cog',
'btn-warning',
$btnOptions + $optionsDefault
),
['class' => 'action text-center']];
} else {
if (!empty($colspan)) {
$colspan++;
}
$tableFoother[] = ['',
['colspan' => $colspan]];
}
$result = $this->Html->tableCells([$tableFoother], ['class' => 'active'], ['class' => 'active']);
return $result;
} | php | public function createGroupActionControls($formInputs = null, $groupActions = null, $useSelectAll = false) {
$result = '';
if (empty($formInputs) || !is_array($formInputs) ||
(!empty($groupActions) && !is_array($groupActions)) ||
(empty($groupActions) && !$useSelectAll)) {
return $result;
}
if (empty($groupActions)) {
$groupActions = [];
}
$colspan = null;
$countFormInputs = count($formInputs);
if ($countFormInputs > 2) {
$colspan = $countFormInputs;
}
$selectOptions = [];
foreach ($groupActions as $value => $text) {
$selectOptions[] = compact('text', 'value');
}
$tableFoother = [];
if ($useSelectAll) {
if (!empty($colspan)) {
$colspan--;
}
$tableFoother[] = $this->_getOptionsForElem('createGroupActionControls.selectAllBtn');
}
$inputField = '';
if (!empty($selectOptions)) {
$this->ExtBs3Form->unlockField('FilterGroup.action');
$tableFoother[] = [
$this->ExtBs3Form->hidden('FilterGroup.action') . $this->_getOptionsForElem('createGroupActionControls.groupDataProcTitle'),
['colspan' => $colspan, 'class' => 'text-center']
];
$btnOptions = ['data-dialog-sel-options' => htmlentities(json_encode($selectOptions))];
$optionsDefault = $this->_getOptionsForElem('createGroupActionControls.performActionBtn');
$tableFoother[] = [
$this->ViewExtension->button(
'fas fa-cog',
'btn-warning',
$btnOptions + $optionsDefault
),
['class' => 'action text-center']];
} else {
if (!empty($colspan)) {
$colspan++;
}
$tableFoother[] = ['',
['colspan' => $colspan]];
}
$result = $this->Html->tableCells([$tableFoother], ['class' => 'active'], ['class' => 'active']);
return $result;
} | [
"public",
"function",
"createGroupActionControls",
"(",
"$",
"formInputs",
"=",
"null",
",",
"$",
"groupActions",
"=",
"null",
",",
"$",
"useSelectAll",
"=",
"false",
")",
"{",
"$",
"result",
"=",
"''",
";",
"if",
"(",
"empty",
"(",
"$",
"formInputs",
")... | Returns a row of table foother with group actions controls.
@param array $formInputs Array of inputs for filter form
@param array $groupActions List of group actions.
@param bool $useSelectAll If True, display `Select all` button.
@return string Row of table foother. | [
"Returns",
"a",
"row",
"of",
"table",
"foother",
"with",
"group",
"actions",
"controls",
"."
] | b815a4aaabaaf03ef1df3d547200f73f332f38a7 | https://github.com/anklimsk/cakephp-theme/blob/b815a4aaabaaf03ef1df3d547200f73f332f38a7/View/Helper/FilterHelper.php#L694-L749 | train |
anklimsk/cakephp-theme | View/Helper/FilterHelper.php | FilterHelper.createFilterRowCheckbox | public function createFilterRowCheckbox($inputField = null, $value = null) {
$result = '';
if (is_array($inputField)) {
$inputField = array_keys($inputField);
$inputField = (string)array_shift($inputField);
}
if (empty($inputField) || (strpos($inputField, '.') === false)) {
return $result;
}
$uniqid = uniqid();
$dataPath = 'FilterData.0.' . $inputField;
$inputFieldName = $dataPath . '.';
$data = (array)$this->request->data($dataPath);
$options = [
'value' => $value,
'checked ' => in_array($value, $data),
'hiddenField' => false,
'required' => false,
'secure' => false,
];
$this->setEntity($inputFieldName . $uniqid);
$options = $this->domId($options);
$options = $this->_initInputField($inputFieldName, $options);
$result = $this->ExtBs3Form->checkbox($inputFieldName, $options) .
$this->ExtBs3Form->label($inputFieldName . $uniqid, '');
$result = $this->Html->div('checkbox', $result);
return $result;
} | php | public function createFilterRowCheckbox($inputField = null, $value = null) {
$result = '';
if (is_array($inputField)) {
$inputField = array_keys($inputField);
$inputField = (string)array_shift($inputField);
}
if (empty($inputField) || (strpos($inputField, '.') === false)) {
return $result;
}
$uniqid = uniqid();
$dataPath = 'FilterData.0.' . $inputField;
$inputFieldName = $dataPath . '.';
$data = (array)$this->request->data($dataPath);
$options = [
'value' => $value,
'checked ' => in_array($value, $data),
'hiddenField' => false,
'required' => false,
'secure' => false,
];
$this->setEntity($inputFieldName . $uniqid);
$options = $this->domId($options);
$options = $this->_initInputField($inputFieldName, $options);
$result = $this->ExtBs3Form->checkbox($inputFieldName, $options) .
$this->ExtBs3Form->label($inputFieldName . $uniqid, '');
$result = $this->Html->div('checkbox', $result);
return $result;
} | [
"public",
"function",
"createFilterRowCheckbox",
"(",
"$",
"inputField",
"=",
"null",
",",
"$",
"value",
"=",
"null",
")",
"{",
"$",
"result",
"=",
"''",
";",
"if",
"(",
"is_array",
"(",
"$",
"inputField",
")",
")",
"{",
"$",
"inputField",
"=",
"array_... | Returns control checkbox for select row of table.
@param strind $inputField Field of filter in format `model.field`;
@param int $value Value of checkbox.
@return string Form input checkbox for select row of table | [
"Returns",
"control",
"checkbox",
"for",
"select",
"row",
"of",
"table",
"."
] | b815a4aaabaaf03ef1df3d547200f73f332f38a7 | https://github.com/anklimsk/cakephp-theme/blob/b815a4aaabaaf03ef1df3d547200f73f332f38a7/View/Helper/FilterHelper.php#L759-L788 | train |
anklimsk/cakephp-theme | View/Helper/FilterHelper.php | FilterHelper.getBtnConditionGroup | public function getBtnConditionGroup($inputCondField = null) {
$options = $this->_getOptionsForElem('getBtnConditionGroup.options');
$title = $this->_getOptionsForElem('getBtnConditionGroup.title');
return $this->_getBtnCondition($inputCondField, $options, $title, false);
} | php | public function getBtnConditionGroup($inputCondField = null) {
$options = $this->_getOptionsForElem('getBtnConditionGroup.options');
$title = $this->_getOptionsForElem('getBtnConditionGroup.title');
return $this->_getBtnCondition($inputCondField, $options, $title, false);
} | [
"public",
"function",
"getBtnConditionGroup",
"(",
"$",
"inputCondField",
"=",
"null",
")",
"{",
"$",
"options",
"=",
"$",
"this",
"->",
"_getOptionsForElem",
"(",
"'getBtnConditionGroup.options'",
")",
";",
"$",
"title",
"=",
"$",
"this",
"->",
"_getOptionsForE... | Return button with dropdown list of group conditions for form filter input field.
@param string $inputCondField Field name for creation button with condition.
@return string Button with dropdown list of conditions. | [
"Return",
"button",
"with",
"dropdown",
"list",
"of",
"group",
"conditions",
"for",
"form",
"filter",
"input",
"field",
"."
] | b815a4aaabaaf03ef1df3d547200f73f332f38a7 | https://github.com/anklimsk/cakephp-theme/blob/b815a4aaabaaf03ef1df3d547200f73f332f38a7/View/Helper/FilterHelper.php#L812-L817 | train |
anklimsk/cakephp-theme | View/Helper/FilterHelper.php | FilterHelper._getFilterRequestData | protected function _getFilterRequestData($baseKey = null, $key = null) {
$filterData = [];
if (empty($baseKey)) {
return $filterData;
}
if ($this->_getFlagUsePost()) {
$requestData = $this->request->data($baseKey);
if (!empty($requestData)) {
$filterData = $requestData;
}
} else {
$requestData = $this->request->query('data.' . $baseKey);
if (!empty($requestData)) {
$filterData = array_map('unserialize', array_unique(array_map('serialize', $requestData)));
}
}
if (!empty($key)) {
return Hash::get($filterData, $key);
}
return $filterData;
} | php | protected function _getFilterRequestData($baseKey = null, $key = null) {
$filterData = [];
if (empty($baseKey)) {
return $filterData;
}
if ($this->_getFlagUsePost()) {
$requestData = $this->request->data($baseKey);
if (!empty($requestData)) {
$filterData = $requestData;
}
} else {
$requestData = $this->request->query('data.' . $baseKey);
if (!empty($requestData)) {
$filterData = array_map('unserialize', array_unique(array_map('serialize', $requestData)));
}
}
if (!empty($key)) {
return Hash::get($filterData, $key);
}
return $filterData;
} | [
"protected",
"function",
"_getFilterRequestData",
"(",
"$",
"baseKey",
"=",
"null",
",",
"$",
"key",
"=",
"null",
")",
"{",
"$",
"filterData",
"=",
"[",
"]",
";",
"if",
"(",
"empty",
"(",
"$",
"baseKey",
")",
")",
"{",
"return",
"$",
"filterData",
";... | Return request data for filter from GET or POST request.
@param string $baseKey The name of the base parameter to retrieve the configurations.
@param string $key The name of the parameter to retrieve the configurations.
@return array|mixed On success array data from request if its not empty or null on failure. | [
"Return",
"request",
"data",
"for",
"filter",
"from",
"GET",
"or",
"POST",
"request",
"."
] | b815a4aaabaaf03ef1df3d547200f73f332f38a7 | https://github.com/anklimsk/cakephp-theme/blob/b815a4aaabaaf03ef1df3d547200f73f332f38a7/View/Helper/FilterHelper.php#L855-L877 | train |
anklimsk/cakephp-theme | View/Helper/FilterHelper.php | FilterHelper._getExtendOptionsPaginationUrl | protected function _getExtendOptionsPaginationUrl() {
$options = [];
$ext = (string)$this->request->param('ext');
$ext = mb_strtolower($ext);
if (empty($ext) || ($ext !== 'prt')) {
return $options;
}
$options = compact('ext');
return $options;
} | php | protected function _getExtendOptionsPaginationUrl() {
$options = [];
$ext = (string)$this->request->param('ext');
$ext = mb_strtolower($ext);
if (empty($ext) || ($ext !== 'prt')) {
return $options;
}
$options = compact('ext');
return $options;
} | [
"protected",
"function",
"_getExtendOptionsPaginationUrl",
"(",
")",
"{",
"$",
"options",
"=",
"[",
"]",
";",
"$",
"ext",
"=",
"(",
"string",
")",
"$",
"this",
"->",
"request",
"->",
"param",
"(",
"'ext'",
")",
";",
"$",
"ext",
"=",
"mb_strtolower",
"(... | Return extended options for pagination URL.
If request extension equal `prt`, return `ext` option.
@return array Array of options for pagination URL. | [
"Return",
"extended",
"options",
"for",
"pagination",
"URL",
".",
"If",
"request",
"extension",
"equal",
"prt",
"return",
"ext",
"option",
"."
] | b815a4aaabaaf03ef1df3d547200f73f332f38a7 | https://github.com/anklimsk/cakephp-theme/blob/b815a4aaabaaf03ef1df3d547200f73f332f38a7/View/Helper/FilterHelper.php#L1060-L1071 | train |
eXpansionPluginPack/eXpansion2 | src/eXpansion/Framework/Core/Model/Gui/Manialink.php | Manialink.destroy | public function destroy()
{
// This is not mandatory as GC will free the memory eventually but allows memory to be freed faster
// by removing circular dependencies.
if (!empty($this->data)) {
foreach ($this->data as $data) {
if ($data instanceof DestroyableObject) {
$data->destroy();
}
}
}
$this->data = [];
$this->manialinkFactory = null;
} | php | public function destroy()
{
// This is not mandatory as GC will free the memory eventually but allows memory to be freed faster
// by removing circular dependencies.
if (!empty($this->data)) {
foreach ($this->data as $data) {
if ($data instanceof DestroyableObject) {
$data->destroy();
}
}
}
$this->data = [];
$this->manialinkFactory = null;
} | [
"public",
"function",
"destroy",
"(",
")",
"{",
"// This is not mandatory as GC will free the memory eventually but allows memory to be freed faster",
"// by removing circular dependencies.",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"data",
")",
")",
"{",
"foreach",
... | Destroys a manialink.
@return mixed | [
"Destroys",
"a",
"manialink",
"."
] | e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31 | https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/Core/Model/Gui/Manialink.php#L176-L189 | train |
YouweGit/data-dictionary | src/Graph/Presenters/GraphViz.php | GraphViz.getView | private function getView(string $name, array $data = [])
{
$filesystemLoader = new FilesystemLoader(__DIR__.'/views/%name%');
$templating = new PhpEngine(new TemplateNameParser(), $filesystemLoader);
return $templating->render($name . '.phtml', $data);
} | php | private function getView(string $name, array $data = [])
{
$filesystemLoader = new FilesystemLoader(__DIR__.'/views/%name%');
$templating = new PhpEngine(new TemplateNameParser(), $filesystemLoader);
return $templating->render($name . '.phtml', $data);
} | [
"private",
"function",
"getView",
"(",
"string",
"$",
"name",
",",
"array",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"$",
"filesystemLoader",
"=",
"new",
"FilesystemLoader",
"(",
"__DIR__",
".",
"'/views/%name%'",
")",
";",
"$",
"templating",
"=",
"new",
"P... | Get a view from the views directory
@param string $name
@param array $data
@return false|string | [
"Get",
"a",
"view",
"from",
"the",
"views",
"directory"
] | 4d34e49cb957e901715ba50aa5a773deda53b73e | https://github.com/YouweGit/data-dictionary/blob/4d34e49cb957e901715ba50aa5a773deda53b73e/src/Graph/Presenters/GraphViz.php#L187-L192 | train |
Malwarebytes/Altamira | src/Altamira/JsWriter/JsWriterAbstract.php | JsWriterAbstract.getFiles | public function getFiles()
{
$files = $this->files;
foreach ($this->types as $type) {
$files = array_merge($files, $type->getFiles());
}
$path = \Altamira\Config::getInstance()->getPluginPath( $this->getLibrary() );
array_walk( $files, function( &$val ) use ( $path ) { $val = $path . $val; } );
return $files;
} | php | public function getFiles()
{
$files = $this->files;
foreach ($this->types as $type) {
$files = array_merge($files, $type->getFiles());
}
$path = \Altamira\Config::getInstance()->getPluginPath( $this->getLibrary() );
array_walk( $files, function( &$val ) use ( $path ) { $val = $path . $val; } );
return $files;
} | [
"public",
"function",
"getFiles",
"(",
")",
"{",
"$",
"files",
"=",
"$",
"this",
"->",
"files",
";",
"foreach",
"(",
"$",
"this",
"->",
"types",
"as",
"$",
"type",
")",
"{",
"$",
"files",
"=",
"array_merge",
"(",
"$",
"files",
",",
"$",
"type",
"... | Returns an array of files required to render the chart
Includes the default files, as well as any files registered by type
It's important to note that some methods in concrete classes will add additional files to this instance
@return array | [
"Returns",
"an",
"array",
"of",
"files",
"required",
"to",
"render",
"the",
"chart",
"Includes",
"the",
"default",
"files",
"as",
"well",
"as",
"any",
"files",
"registered",
"by",
"type",
"It",
"s",
"important",
"to",
"note",
"that",
"some",
"methods",
"in... | 38e320f68070d7a0b6902c6c3f904995d4a8cdfc | https://github.com/Malwarebytes/Altamira/blob/38e320f68070d7a0b6902c6c3f904995d4a8cdfc/src/Altamira/JsWriter/JsWriterAbstract.php#L117-L130 | train |
Malwarebytes/Altamira | src/Altamira/JsWriter/JsWriterAbstract.php | JsWriterAbstract.getOptionsForSeries | public function getOptionsForSeries( $series )
{
$seriesTitle = $this->getSeriesTitle( $series );
if (! isset( $this->options['seriesStorage'][$seriesTitle] ) ) {
throw new \Exception( 'Series not registered with JsWriter' );
}
return $this->options['seriesStorage'][$seriesTitle];
} | php | public function getOptionsForSeries( $series )
{
$seriesTitle = $this->getSeriesTitle( $series );
if (! isset( $this->options['seriesStorage'][$seriesTitle] ) ) {
throw new \Exception( 'Series not registered with JsWriter' );
}
return $this->options['seriesStorage'][$seriesTitle];
} | [
"public",
"function",
"getOptionsForSeries",
"(",
"$",
"series",
")",
"{",
"$",
"seriesTitle",
"=",
"$",
"this",
"->",
"getSeriesTitle",
"(",
"$",
"series",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"options",
"[",
"'seriesStorage'",
"]"... | Returns the options for a series
@param \Altamira\Series|string $series
@throws \Exception
@return mixed | [
"Returns",
"the",
"options",
"for",
"a",
"series"
] | 38e320f68070d7a0b6902c6c3f904995d4a8cdfc | https://github.com/Malwarebytes/Altamira/blob/38e320f68070d7a0b6902c6c3f904995d4a8cdfc/src/Altamira/JsWriter/JsWriterAbstract.php#L138-L145 | train |
Malwarebytes/Altamira | src/Altamira/JsWriter/JsWriterAbstract.php | JsWriterAbstract.getSeriesOption | public function getSeriesOption( $series, $option, $default = null )
{
$seriesTitle = $this->getSeriesTitle( $series );
return ( isset( $this->options['seriesStorage'][$seriesTitle] ) && isset( $this->options['seriesStorage'][$seriesTitle][$option] ) )
? $this->options['seriesStorage'][$seriesTitle][$option]
: $default;
} | php | public function getSeriesOption( $series, $option, $default = null )
{
$seriesTitle = $this->getSeriesTitle( $series );
return ( isset( $this->options['seriesStorage'][$seriesTitle] ) && isset( $this->options['seriesStorage'][$seriesTitle][$option] ) )
? $this->options['seriesStorage'][$seriesTitle][$option]
: $default;
} | [
"public",
"function",
"getSeriesOption",
"(",
"$",
"series",
",",
"$",
"option",
",",
"$",
"default",
"=",
"null",
")",
"{",
"$",
"seriesTitle",
"=",
"$",
"this",
"->",
"getSeriesTitle",
"(",
"$",
"series",
")",
";",
"return",
"(",
"isset",
"(",
"$",
... | Returns an option for a specific series. Accepts title or instance.
@param \Altamira\Series|string $series
@param string $option
@param mixed $default
@return mixed | [
"Returns",
"an",
"option",
"for",
"a",
"specific",
"series",
".",
"Accepts",
"title",
"or",
"instance",
"."
] | 38e320f68070d7a0b6902c6c3f904995d4a8cdfc | https://github.com/Malwarebytes/Altamira/blob/38e320f68070d7a0b6902c6c3f904995d4a8cdfc/src/Altamira/JsWriter/JsWriterAbstract.php#L164-L171 | train |
Malwarebytes/Altamira | src/Altamira/JsWriter/JsWriterAbstract.php | JsWriterAbstract.setSeriesOption | public function setSeriesOption( $series, $name, $value )
{
$this->setNestedOptVal( $this->options, 'seriesStorage', $this->getSeriesTitle( $series ), $name, $value );
return $this;
} | php | public function setSeriesOption( $series, $name, $value )
{
$this->setNestedOptVal( $this->options, 'seriesStorage', $this->getSeriesTitle( $series ), $name, $value );
return $this;
} | [
"public",
"function",
"setSeriesOption",
"(",
"$",
"series",
",",
"$",
"name",
",",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"setNestedOptVal",
"(",
"$",
"this",
"->",
"options",
",",
"'seriesStorage'",
",",
"$",
"this",
"->",
"getSeriesTitle",
"(",
"$... | Set a series-specific value for rendering JS
@param string|\Altamira\Series $series
@param string $name
@param mixed $value
@return \Altamira\JsWriter\JsWriterAbstract | [
"Set",
"a",
"series",
"-",
"specific",
"value",
"for",
"rendering",
"JS"
] | 38e320f68070d7a0b6902c6c3f904995d4a8cdfc | https://github.com/Malwarebytes/Altamira/blob/38e320f68070d7a0b6902c6c3f904995d4a8cdfc/src/Altamira/JsWriter/JsWriterAbstract.php#L180-L184 | train |
Malwarebytes/Altamira | src/Altamira/JsWriter/JsWriterAbstract.php | JsWriterAbstract.setType | public function setType( $type, $options = array(), $series = 'default' )
{
$options = $options ?: array(); // i shouldn't have to do this
$className = $this->typeNamespace . ucwords( $type );
if( class_exists( $className ) ) {
$type = new $className( $this );
} else {
throw new \Exception( "Type {$type} does not exist" );
}
$type->setOptions( $options );
$series = $this->getSeriesTitle( $series );
$this->types[$series] = $type;
if ( isset( $this->options['seriesStorage'][$series] ) ) {
$this->options['seriesStorage'][$series] = array_merge_recursive( $this->options['seriesStorage'][$series], $type->getSeriesOptions() );
if ( $renderer = $type->getRenderer() ) {
$this->options['seriesStorage'][$series]['renderer'] = $renderer;
}
}
$this->options = array_merge_recursive( $this->options, $type->getOptions() );
return $this;
} | php | public function setType( $type, $options = array(), $series = 'default' )
{
$options = $options ?: array(); // i shouldn't have to do this
$className = $this->typeNamespace . ucwords( $type );
if( class_exists( $className ) ) {
$type = new $className( $this );
} else {
throw new \Exception( "Type {$type} does not exist" );
}
$type->setOptions( $options );
$series = $this->getSeriesTitle( $series );
$this->types[$series] = $type;
if ( isset( $this->options['seriesStorage'][$series] ) ) {
$this->options['seriesStorage'][$series] = array_merge_recursive( $this->options['seriesStorage'][$series], $type->getSeriesOptions() );
if ( $renderer = $type->getRenderer() ) {
$this->options['seriesStorage'][$series]['renderer'] = $renderer;
}
}
$this->options = array_merge_recursive( $this->options, $type->getOptions() );
return $this;
} | [
"public",
"function",
"setType",
"(",
"$",
"type",
",",
"$",
"options",
"=",
"array",
"(",
")",
",",
"$",
"series",
"=",
"'default'",
")",
"{",
"$",
"options",
"=",
"$",
"options",
"?",
":",
"array",
"(",
")",
";",
"// i shouldn't have to do this",
"$"... | Returns an type that has not yet been registered.
@param \Altamira\Type\TypeAbstract $type
@param array $options
@param string|\Altamira\Series $series | [
"Returns",
"an",
"type",
"that",
"has",
"not",
"yet",
"been",
"registered",
"."
] | 38e320f68070d7a0b6902c6c3f904995d4a8cdfc | https://github.com/Malwarebytes/Altamira/blob/38e320f68070d7a0b6902c6c3f904995d4a8cdfc/src/Altamira/JsWriter/JsWriterAbstract.php#L236-L260 | train |
Malwarebytes/Altamira | src/Altamira/JsWriter/JsWriterAbstract.php | JsWriterAbstract.getType | public function getType( $series = null )
{
$series = $series ?: 'default';
$seriesTitle = $this->getSeriesTitle( $series );
return isset( $this->types[$seriesTitle] ) ? $this->types[$seriesTitle] : null;
} | php | public function getType( $series = null )
{
$series = $series ?: 'default';
$seriesTitle = $this->getSeriesTitle( $series );
return isset( $this->types[$seriesTitle] ) ? $this->types[$seriesTitle] : null;
} | [
"public",
"function",
"getType",
"(",
"$",
"series",
"=",
"null",
")",
"{",
"$",
"series",
"=",
"$",
"series",
"?",
":",
"'default'",
";",
"$",
"seriesTitle",
"=",
"$",
"this",
"->",
"getSeriesTitle",
"(",
"$",
"series",
")",
";",
"return",
"isset",
... | Returns the type instance for the provided key
@param string|\Altamira\Series $series
@return multitype:|NULL | [
"Returns",
"the",
"type",
"instance",
"for",
"the",
"provided",
"key"
] | 38e320f68070d7a0b6902c6c3f904995d4a8cdfc | https://github.com/Malwarebytes/Altamira/blob/38e320f68070d7a0b6902c6c3f904995d4a8cdfc/src/Altamira/JsWriter/JsWriterAbstract.php#L267-L273 | train |
Malwarebytes/Altamira | src/Altamira/JsWriter/JsWriterAbstract.php | JsWriterAbstract.setNestedOptVal | protected function setNestedOptVal( array &$options, $arg )
{
//@codeCoverageIgnoreStart
$args = func_get_args();
if ( count( $args ) == 2 && is_array( $args[1] ) ) {
$args = $args[1];
} else if ( count( $args ) < 3 ) {
throw new \BadMethodCallException( '\Altamira\JsWriterAbstract::setNestedOptVal requires at least three arguments' );
} else {
array_shift( $args );
}
do {
$arg = array_shift( $args );
if (! isset( $options[$arg] ) ) {
$options[$arg] = array();
}
$options = &$options[$arg];
} while ( count( $args ) > 2 );
$options[array_shift( $args )] = array_shift( $args );
return $this;
//@codeCoverageIgnoreEnd
} | php | protected function setNestedOptVal( array &$options, $arg )
{
//@codeCoverageIgnoreStart
$args = func_get_args();
if ( count( $args ) == 2 && is_array( $args[1] ) ) {
$args = $args[1];
} else if ( count( $args ) < 3 ) {
throw new \BadMethodCallException( '\Altamira\JsWriterAbstract::setNestedOptVal requires at least three arguments' );
} else {
array_shift( $args );
}
do {
$arg = array_shift( $args );
if (! isset( $options[$arg] ) ) {
$options[$arg] = array();
}
$options = &$options[$arg];
} while ( count( $args ) > 2 );
$options[array_shift( $args )] = array_shift( $args );
return $this;
//@codeCoverageIgnoreEnd
} | [
"protected",
"function",
"setNestedOptVal",
"(",
"array",
"&",
"$",
"options",
",",
"$",
"arg",
")",
"{",
"//@codeCoverageIgnoreStart",
"$",
"args",
"=",
"func_get_args",
"(",
")",
";",
"if",
"(",
"count",
"(",
"$",
"args",
")",
"==",
"2",
"&&",
"is_arra... | Allows you to set discretely infinite nesting without notices
by creating an empty array for key values that don't already exist
@param array $options the option array to operate against
@param mixed $arg the first any number of arguments to nest through an array, the final of which being the value to set
@return \Altamira\JsWriter\JsWriterAbstract | [
"Allows",
"you",
"to",
"set",
"discretely",
"infinite",
"nesting",
"without",
"notices",
"by",
"creating",
"an",
"empty",
"array",
"for",
"key",
"values",
"that",
"don",
"t",
"already",
"exist"
] | 38e320f68070d7a0b6902c6c3f904995d4a8cdfc | https://github.com/Malwarebytes/Altamira/blob/38e320f68070d7a0b6902c6c3f904995d4a8cdfc/src/Altamira/JsWriter/JsWriterAbstract.php#L282-L309 | train |
Malwarebytes/Altamira | src/Altamira/JsWriter/JsWriterAbstract.php | JsWriterAbstract.getNestedOptVal | protected function getNestedOptVal( array $options, $arg )
{
//@codeCoverageIgnoreStart
$args = func_get_args();
if ( count( $args ) == 2 && is_array( $args[1] ) ) {
$args = $args[1];
} else if ( count( $args ) < 3 ) {
throw new \BadMethodCallException( '\Altamira\JsWriterAbstract::getNestedOptVal requires at least three arguments' );
} else {
array_shift( $args );
}
do {
$arg = array_shift( $args );
if (! isset( $options[$arg] ) ) {
return null;
}
$options = &$options[$arg];
} while ( count( $args ) > 1 );
$finalArg = array_shift( $args );
return isset( $options[$finalArg] ) ? $options[$finalArg] : null;
//@codeCoverageIgnoreEnd
} | php | protected function getNestedOptVal( array $options, $arg )
{
//@codeCoverageIgnoreStart
$args = func_get_args();
if ( count( $args ) == 2 && is_array( $args[1] ) ) {
$args = $args[1];
} else if ( count( $args ) < 3 ) {
throw new \BadMethodCallException( '\Altamira\JsWriterAbstract::getNestedOptVal requires at least three arguments' );
} else {
array_shift( $args );
}
do {
$arg = array_shift( $args );
if (! isset( $options[$arg] ) ) {
return null;
}
$options = &$options[$arg];
} while ( count( $args ) > 1 );
$finalArg = array_shift( $args );
return isset( $options[$finalArg] ) ? $options[$finalArg] : null;
//@codeCoverageIgnoreEnd
} | [
"protected",
"function",
"getNestedOptVal",
"(",
"array",
"$",
"options",
",",
"$",
"arg",
")",
"{",
"//@codeCoverageIgnoreStart",
"$",
"args",
"=",
"func_get_args",
"(",
")",
";",
"if",
"(",
"count",
"(",
"$",
"args",
")",
"==",
"2",
"&&",
"is_array",
"... | Allows you to get the value for discretely infinite nesting without notices
by returning null without a warning if it doesn't exist
@param array $options
@param mixed $arg the first of any number of arguments to nest through an array, the final of which being the value to return
@return mixed | [
"Allows",
"you",
"to",
"get",
"the",
"value",
"for",
"discretely",
"infinite",
"nesting",
"without",
"notices",
"by",
"returning",
"null",
"without",
"a",
"warning",
"if",
"it",
"doesn",
"t",
"exist"
] | 38e320f68070d7a0b6902c6c3f904995d4a8cdfc | https://github.com/Malwarebytes/Altamira/blob/38e320f68070d7a0b6902c6c3f904995d4a8cdfc/src/Altamira/JsWriter/JsWriterAbstract.php#L318-L344 | train |
netgen-layouts/layouts-sylius | bundle/EventListener/Admin/MainMenuBuilderListener.php | MainMenuBuilderListener.onMainMenuBuild | public function onMainMenuBuild(MenuBuilderEvent $event): void
{
if (!$this->authorizationChecker->isGranted('ROLE_NGBM_ADMIN')) {
return;
}
$this->addLayoutsSubMenu($event->getMenu());
} | php | public function onMainMenuBuild(MenuBuilderEvent $event): void
{
if (!$this->authorizationChecker->isGranted('ROLE_NGBM_ADMIN')) {
return;
}
$this->addLayoutsSubMenu($event->getMenu());
} | [
"public",
"function",
"onMainMenuBuild",
"(",
"MenuBuilderEvent",
"$",
"event",
")",
":",
"void",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"authorizationChecker",
"->",
"isGranted",
"(",
"'ROLE_NGBM_ADMIN'",
")",
")",
"{",
"return",
";",
"}",
"$",
"this",
"... | This method adds Netgen Layouts menu items to Sylius admin interface. | [
"This",
"method",
"adds",
"Netgen",
"Layouts",
"menu",
"items",
"to",
"Sylius",
"admin",
"interface",
"."
] | a261f1b312cc7e18ac48e2c5ff19775672f60947 | https://github.com/netgen-layouts/layouts-sylius/blob/a261f1b312cc7e18ac48e2c5ff19775672f60947/bundle/EventListener/Admin/MainMenuBuilderListener.php#L33-L40 | train |
Malwarebytes/Altamira | src/Altamira/Type/Flot/Bar.php | Bar.setOption | public function setOption($name, $value)
{
switch ($name) {
case 'horizontal':
$this->options['bars']['horizontal'] = $value;
break;
case 'stackSeries':
$this->pluginFiles[] = 'jquery.flot.stack.js';
$this->options['series']['stack'] = true;
break;
case 'fillColor':
$this->options['series']['bars']['fillColor']['colors'] = $value;
break;
default:
parent::setOption($name, $value);
}
return $this;
} | php | public function setOption($name, $value)
{
switch ($name) {
case 'horizontal':
$this->options['bars']['horizontal'] = $value;
break;
case 'stackSeries':
$this->pluginFiles[] = 'jquery.flot.stack.js';
$this->options['series']['stack'] = true;
break;
case 'fillColor':
$this->options['series']['bars']['fillColor']['colors'] = $value;
break;
default:
parent::setOption($name, $value);
}
return $this;
} | [
"public",
"function",
"setOption",
"(",
"$",
"name",
",",
"$",
"value",
")",
"{",
"switch",
"(",
"$",
"name",
")",
"{",
"case",
"'horizontal'",
":",
"$",
"this",
"->",
"options",
"[",
"'bars'",
"]",
"[",
"'horizontal'",
"]",
"=",
"$",
"value",
";",
... | Abstracts out option setting and registers the required options based on what's provided.
@see \Altamira\Type\TypeAbstract::setOption()
@param string $name
@param mixed $value
@return \Altamira\Type\Flot\Bar | [
"Abstracts",
"out",
"option",
"setting",
"and",
"registers",
"the",
"required",
"options",
"based",
"on",
"what",
"s",
"provided",
"."
] | 38e320f68070d7a0b6902c6c3f904995d4a8cdfc | https://github.com/Malwarebytes/Altamira/blob/38e320f68070d7a0b6902c6c3f904995d4a8cdfc/src/Altamira/Type/Flot/Bar.php#L34-L52 | train |
anklimsk/cakephp-theme | Vendor/PhpUnoconv/monolog/monolog/src/Monolog/Handler/SlackHandler.php | SlackHandler.prepareContentData | protected function prepareContentData($record)
{
$dataArray = array(
'token' => $this->token,
'channel' => $this->channel,
'username' => $this->username,
'text' => '',
'attachments' => array(),
);
if ($this->formatter) {
$message = $this->formatter->format($record);
} else {
$message = $record['message'];
}
if ($this->useAttachment) {
$attachment = array(
'fallback' => $message,
'color' => $this->getAttachmentColor($record['level']),
'fields' => array(),
);
if ($this->useShortAttachment) {
$attachment['title'] = $record['level_name'];
$attachment['text'] = $message;
} else {
$attachment['title'] = 'Message';
$attachment['text'] = $message;
$attachment['fields'][] = array(
'title' => 'Level',
'value' => $record['level_name'],
'short' => true,
);
}
if ($this->includeContextAndExtra) {
if (!empty($record['extra'])) {
if ($this->useShortAttachment) {
$attachment['fields'][] = array(
'title' => "Extra",
'value' => $this->stringify($record['extra']),
'short' => $this->useShortAttachment,
);
} else {
// Add all extra fields as individual fields in attachment
foreach ($record['extra'] as $var => $val) {
$attachment['fields'][] = array(
'title' => $var,
'value' => $val,
'short' => $this->useShortAttachment,
);
}
}
}
if (!empty($record['context'])) {
if ($this->useShortAttachment) {
$attachment['fields'][] = array(
'title' => "Context",
'value' => $this->stringify($record['context']),
'short' => $this->useShortAttachment,
);
} else {
// Add all context fields as individual fields in attachment
foreach ($record['context'] as $var => $val) {
$attachment['fields'][] = array(
'title' => $var,
'value' => $val,
'short' => $this->useShortAttachment,
);
}
}
}
}
$dataArray['attachments'] = json_encode(array($attachment));
} else {
$dataArray['text'] = $message;
}
if ($this->iconEmoji) {
$dataArray['icon_emoji'] = ":{$this->iconEmoji}:";
}
return $dataArray;
} | php | protected function prepareContentData($record)
{
$dataArray = array(
'token' => $this->token,
'channel' => $this->channel,
'username' => $this->username,
'text' => '',
'attachments' => array(),
);
if ($this->formatter) {
$message = $this->formatter->format($record);
} else {
$message = $record['message'];
}
if ($this->useAttachment) {
$attachment = array(
'fallback' => $message,
'color' => $this->getAttachmentColor($record['level']),
'fields' => array(),
);
if ($this->useShortAttachment) {
$attachment['title'] = $record['level_name'];
$attachment['text'] = $message;
} else {
$attachment['title'] = 'Message';
$attachment['text'] = $message;
$attachment['fields'][] = array(
'title' => 'Level',
'value' => $record['level_name'],
'short' => true,
);
}
if ($this->includeContextAndExtra) {
if (!empty($record['extra'])) {
if ($this->useShortAttachment) {
$attachment['fields'][] = array(
'title' => "Extra",
'value' => $this->stringify($record['extra']),
'short' => $this->useShortAttachment,
);
} else {
// Add all extra fields as individual fields in attachment
foreach ($record['extra'] as $var => $val) {
$attachment['fields'][] = array(
'title' => $var,
'value' => $val,
'short' => $this->useShortAttachment,
);
}
}
}
if (!empty($record['context'])) {
if ($this->useShortAttachment) {
$attachment['fields'][] = array(
'title' => "Context",
'value' => $this->stringify($record['context']),
'short' => $this->useShortAttachment,
);
} else {
// Add all context fields as individual fields in attachment
foreach ($record['context'] as $var => $val) {
$attachment['fields'][] = array(
'title' => $var,
'value' => $val,
'short' => $this->useShortAttachment,
);
}
}
}
}
$dataArray['attachments'] = json_encode(array($attachment));
} else {
$dataArray['text'] = $message;
}
if ($this->iconEmoji) {
$dataArray['icon_emoji'] = ":{$this->iconEmoji}:";
}
return $dataArray;
} | [
"protected",
"function",
"prepareContentData",
"(",
"$",
"record",
")",
"{",
"$",
"dataArray",
"=",
"array",
"(",
"'token'",
"=>",
"$",
"this",
"->",
"token",
",",
"'channel'",
"=>",
"$",
"this",
"->",
"channel",
",",
"'username'",
"=>",
"$",
"this",
"->... | Prepares content data
@param array $record
@return array | [
"Prepares",
"content",
"data"
] | b815a4aaabaaf03ef1df3d547200f73f332f38a7 | https://github.com/anklimsk/cakephp-theme/blob/b815a4aaabaaf03ef1df3d547200f73f332f38a7/Vendor/PhpUnoconv/monolog/monolog/src/Monolog/Handler/SlackHandler.php#L137-L223 | train |
Celarius/spin-framework | src/Core/CacheManager.php | CacheManager.getCache | public function getCache(string $name='')
{
# Find the cache (if we already have it created)
$cache = $this->findCache($name);
if (\is_null($cache)) {
# Attempt to create the cache
$cache = $this->createCache($name);
if (!\is_null($cache)) {
$this->addCache($cache);
}
}
return $cache;
} | php | public function getCache(string $name='')
{
# Find the cache (if we already have it created)
$cache = $this->findCache($name);
if (\is_null($cache)) {
# Attempt to create the cache
$cache = $this->createCache($name);
if (!\is_null($cache)) {
$this->addCache($cache);
}
}
return $cache;
} | [
"public",
"function",
"getCache",
"(",
"string",
"$",
"name",
"=",
"''",
")",
"{",
"# Find the cache (if we already have it created)",
"$",
"cache",
"=",
"$",
"this",
"->",
"findCache",
"(",
"$",
"name",
")",
";",
"if",
"(",
"\\",
"is_null",
"(",
"$",
"cac... | Get or Create a Cache
@param string $name Name of the Cache (from Config)
@return null | object | [
"Get",
"or",
"Create",
"a",
"Cache"
] | 2c0d1dfc3c2ed556632dfe5ff9113600a72a93d0 | https://github.com/Celarius/spin-framework/blob/2c0d1dfc3c2ed556632dfe5ff9113600a72a93d0/src/Core/CacheManager.php#L39-L54 | train |
Celarius/spin-framework | src/Core/CacheManager.php | CacheManager.findCache | public function findCache(string $name='')
{
if ( empty($name) ) {
# Take first available
$cache = \reset($this->caches);
if ($cache === false)
return null;
} else {
# Attempt to find the cache from the list
$cache = ( $this->caches[\strtolower($name)] ?? null);
}
return $cache;
} | php | public function findCache(string $name='')
{
if ( empty($name) ) {
# Take first available
$cache = \reset($this->caches);
if ($cache === false)
return null;
} else {
# Attempt to find the cache from the list
$cache = ( $this->caches[\strtolower($name)] ?? null);
}
return $cache;
} | [
"public",
"function",
"findCache",
"(",
"string",
"$",
"name",
"=",
"''",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"name",
")",
")",
"{",
"# Take first available",
"$",
"cache",
"=",
"\\",
"reset",
"(",
"$",
"this",
"->",
"caches",
")",
";",
"if",
"... | Find a Cache based on name
If the $name is empty/null we'll return the 1st cache in the internal list
(if there is one)
@param string $name Name of the cache (from Config)
@return null | PdoConnection | [
"Find",
"a",
"Cache",
"based",
"on",
"name"
] | 2c0d1dfc3c2ed556632dfe5ff9113600a72a93d0 | https://github.com/Celarius/spin-framework/blob/2c0d1dfc3c2ed556632dfe5ff9113600a72a93d0/src/Core/CacheManager.php#L66-L79 | train |
Celarius/spin-framework | src/Core/CacheManager.php | CacheManager.addCache | public function addCache(AbstractCacheAdapterInterface $cache)
{
$this->caches[\strtolower($cache->getDriver())] = $cache;
return $this;
} | php | public function addCache(AbstractCacheAdapterInterface $cache)
{
$this->caches[\strtolower($cache->getDriver())] = $cache;
return $this;
} | [
"public",
"function",
"addCache",
"(",
"AbstractCacheAdapterInterface",
"$",
"cache",
")",
"{",
"$",
"this",
"->",
"caches",
"[",
"\\",
"strtolower",
"(",
"$",
"cache",
"->",
"getDriver",
"(",
")",
")",
"]",
"=",
"$",
"cache",
";",
"return",
"$",
"this",... | Adds the Cache to the Pool
@param AbstractCacheAdapterInterface $cache [description]
@return Self | [
"Adds",
"the",
"Cache",
"to",
"the",
"Pool"
] | 2c0d1dfc3c2ed556632dfe5ff9113600a72a93d0 | https://github.com/Celarius/spin-framework/blob/2c0d1dfc3c2ed556632dfe5ff9113600a72a93d0/src/Core/CacheManager.php#L88-L93 | train |
Celarius/spin-framework | src/Core/CacheManager.php | CacheManager.removeCache | public function removeCache(string $name)
{
# Sanity check
if (empty($name)) return false;
$cache = $this->findCache($name);
if ($cache) {
unset( $this->caches[\strtolower($cache->getDriver())] );
unset($cache);
$cache = null;
}
return $this;
} | php | public function removeCache(string $name)
{
# Sanity check
if (empty($name)) return false;
$cache = $this->findCache($name);
if ($cache) {
unset( $this->caches[\strtolower($cache->getDriver())] );
unset($cache);
$cache = null;
}
return $this;
} | [
"public",
"function",
"removeCache",
"(",
"string",
"$",
"name",
")",
"{",
"# Sanity check",
"if",
"(",
"empty",
"(",
"$",
"name",
")",
")",
"return",
"false",
";",
"$",
"cache",
"=",
"$",
"this",
"->",
"findCache",
"(",
"$",
"name",
")",
";",
"if",
... | Remove a cache from the pool
@param string $name The name of cache to remove
@return Self | [
"Remove",
"a",
"cache",
"from",
"the",
"pool"
] | 2c0d1dfc3c2ed556632dfe5ff9113600a72a93d0 | https://github.com/Celarius/spin-framework/blob/2c0d1dfc3c2ed556632dfe5ff9113600a72a93d0/src/Core/CacheManager.php#L102-L116 | train |
eXpansionPluginPack/eXpansion2 | src/eXpansion/Framework/Config/Plugins/MenuItems.php | MenuItems.registerConfigItems | protected function registerConfigItems(ParentItem $root, $parentId, $configItems)
{
foreach ($configItems as $configId => $configItem) {
$subItems = reset($configItem);
$path = $parentId . '/' . $configId;
$configPath = str_replace("admin/server/config/",'', $path);
$translationKey = 'expansion_config.menu.' . implode('.', explode('/', $configPath)) . '.label';
if (is_array($subItems)) {
$root->addChild(
ParentItem::class,
$path,
$translationKey,
null
);
$this->registerConfigItems($root, $path, $configItem);
} else {
$root->addChild(
ChatCommandItem::class,
$path,
$translationKey,
'admin_config', // Default config on each element.
['cmd' => '/admin config "' . $configPath . '"']
);
}
}
} | php | protected function registerConfigItems(ParentItem $root, $parentId, $configItems)
{
foreach ($configItems as $configId => $configItem) {
$subItems = reset($configItem);
$path = $parentId . '/' . $configId;
$configPath = str_replace("admin/server/config/",'', $path);
$translationKey = 'expansion_config.menu.' . implode('.', explode('/', $configPath)) . '.label';
if (is_array($subItems)) {
$root->addChild(
ParentItem::class,
$path,
$translationKey,
null
);
$this->registerConfigItems($root, $path, $configItem);
} else {
$root->addChild(
ChatCommandItem::class,
$path,
$translationKey,
'admin_config', // Default config on each element.
['cmd' => '/admin config "' . $configPath . '"']
);
}
}
} | [
"protected",
"function",
"registerConfigItems",
"(",
"ParentItem",
"$",
"root",
",",
"$",
"parentId",
",",
"$",
"configItems",
")",
"{",
"foreach",
"(",
"$",
"configItems",
"as",
"$",
"configId",
"=>",
"$",
"configItem",
")",
"{",
"$",
"subItems",
"=",
"re... | Register config items
@param ParentItem $root
@param $parentId
@param $configItems | [
"Register",
"config",
"items"
] | e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31 | https://github.com/eXpansionPluginPack/eXpansion2/blob/e82ffcfa7bcbcb8e354d2fde0eb64bb5695b4a31/src/eXpansion/Framework/Config/Plugins/MenuItems.php#L72-L99 | train |
Celarius/spin-framework | src/Factories/Http/StreamFactory.php | StreamFactory.createStreamFromFile | public function createStreamFromFile(string $filename, string $mode = 'r'): StreamInterface
{
# Open the file
$resource = \fopen($filename, $mode);
return \GuzzleHttp\Psr7\stream_for($resource);
} | php | public function createStreamFromFile(string $filename, string $mode = 'r'): StreamInterface
{
# Open the file
$resource = \fopen($filename, $mode);
return \GuzzleHttp\Psr7\stream_for($resource);
} | [
"public",
"function",
"createStreamFromFile",
"(",
"string",
"$",
"filename",
",",
"string",
"$",
"mode",
"=",
"'r'",
")",
":",
"StreamInterface",
"{",
"# Open the file",
"$",
"resource",
"=",
"\\",
"fopen",
"(",
"$",
"filename",
",",
"$",
"mode",
")",
";"... | Create a stream from an existing file.
The file MUST be opened using the given mode, which may be any mode
supported by the `fopen` function.
The `$filename` MAY be any string supported by `fopen()`.
@param string $filename
@param string $mode
@return StreamInterface | [
"Create",
"a",
"stream",
"from",
"an",
"existing",
"file",
"."
] | 2c0d1dfc3c2ed556632dfe5ff9113600a72a93d0 | https://github.com/Celarius/spin-framework/blob/2c0d1dfc3c2ed556632dfe5ff9113600a72a93d0/src/Factories/Http/StreamFactory.php#L54-L60 | train |
northwoods/container | src/Zend/Config.php | Config.apply | public function apply(Injector $injector): void
{
$dependencies = $this->config['dependencies'] ?? [];
// Define the "config" service, accounting for the fact that Auryn
// requires all returns are objects.
$dependencies['services']['config'] = new ArrayObject($this->config, ArrayObject::ARRAY_AS_PROPS);
$this->injectServices($injector, $dependencies);
$this->injectFactories($injector, $dependencies);
$this->injectInvokables($injector, $dependencies);
$this->injectAliases($injector, $dependencies);
} | php | public function apply(Injector $injector): void
{
$dependencies = $this->config['dependencies'] ?? [];
// Define the "config" service, accounting for the fact that Auryn
// requires all returns are objects.
$dependencies['services']['config'] = new ArrayObject($this->config, ArrayObject::ARRAY_AS_PROPS);
$this->injectServices($injector, $dependencies);
$this->injectFactories($injector, $dependencies);
$this->injectInvokables($injector, $dependencies);
$this->injectAliases($injector, $dependencies);
} | [
"public",
"function",
"apply",
"(",
"Injector",
"$",
"injector",
")",
":",
"void",
"{",
"$",
"dependencies",
"=",
"$",
"this",
"->",
"config",
"[",
"'dependencies'",
"]",
"??",
"[",
"]",
";",
"// Define the \"config\" service, accounting for the fact that Auryn",
... | Configure the injector using Zend Service Manager format | [
"Configure",
"the",
"injector",
"using",
"Zend",
"Service",
"Manager",
"format"
] | 52a9db4450d7a7c883290d6c4990116185a9b6e3 | https://github.com/northwoods/container/blob/52a9db4450d7a7c883290d6c4990116185a9b6e3/src/Zend/Config.php#L25-L37 | train |
byjg/xmlnuke | xmlnuke-common/3rdparty/tiny_mce/plugins/spellchecker/classes/EnchantSpell.php | EnchantSpell.& | function &getSuggestions($lang, $word) {
$r = enchant_broker_init();
$suggs = array();
if (enchant_broker_dict_exists($r,$lang)) {
$d = enchant_broker_request_dict($r, $lang);
$suggs = enchant_dict_suggest($d, $word);
enchant_broker_free_dict($d);
} else {
}
enchant_broker_free($r);
return $suggs;
} | php | function &getSuggestions($lang, $word) {
$r = enchant_broker_init();
$suggs = array();
if (enchant_broker_dict_exists($r,$lang)) {
$d = enchant_broker_request_dict($r, $lang);
$suggs = enchant_dict_suggest($d, $word);
enchant_broker_free_dict($d);
} else {
}
enchant_broker_free($r);
return $suggs;
} | [
"function",
"&",
"getSuggestions",
"(",
"$",
"lang",
",",
"$",
"word",
")",
"{",
"$",
"r",
"=",
"enchant_broker_init",
"(",
")",
";",
"$",
"suggs",
"=",
"array",
"(",
")",
";",
"if",
"(",
"enchant_broker_dict_exists",
"(",
"$",
"r",
",",
"$",
"lang",... | Returns suggestions for a specific word.
@param String $lang Selected language code (like en_US or de_DE). Shortcodes like "en" and "de" work with enchant >= 1.4.1
@param String $word Specific word to get suggestions for.
@return Array of suggestions for the specified word. | [
"Returns",
"suggestions",
"for",
"a",
"specific",
"word",
"."
] | aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7 | https://github.com/byjg/xmlnuke/blob/aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7/xmlnuke-common/3rdparty/tiny_mce/plugins/spellchecker/classes/EnchantSpell.php#L49-L64 | train |
orkestra/OrkestraPdfBundle | Generator/AbstractPdfGenerator.php | AbstractPdfGenerator.generate | public function generate(array $parameters = array(), array $options = array())
{
$parametersResolver = new OptionsResolver();
$this->setDefaultParameters($parametersResolver);
$parameters = $parametersResolver->resolve($parameters);
$optionsResolver = new OptionsResolver();
$this->setDefaultOptions($optionsResolver);
$options = $optionsResolver->resolve($options);
return $this->doGenerate($parameters, $options);
} | php | public function generate(array $parameters = array(), array $options = array())
{
$parametersResolver = new OptionsResolver();
$this->setDefaultParameters($parametersResolver);
$parameters = $parametersResolver->resolve($parameters);
$optionsResolver = new OptionsResolver();
$this->setDefaultOptions($optionsResolver);
$options = $optionsResolver->resolve($options);
return $this->doGenerate($parameters, $options);
} | [
"public",
"function",
"generate",
"(",
"array",
"$",
"parameters",
"=",
"array",
"(",
")",
",",
"array",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"$",
"parametersResolver",
"=",
"new",
"OptionsResolver",
"(",
")",
";",
"$",
"this",
"->",
"setD... | Generates a new PDF
@param array $parameters An array of parameters to be used to render the PDF
@param array $options An array of options to configure the generator
@return \Orkestra\Bundle\PdfBundle\Pdf\PdfInterface | [
"Generates",
"a",
"new",
"PDF"
] | 45979a93b662e81787116f26b53362911878c685 | https://github.com/orkestra/OrkestraPdfBundle/blob/45979a93b662e81787116f26b53362911878c685/Generator/AbstractPdfGenerator.php#L66-L79 | train |
stanislav-web/PhalconSonar | src/Sonar/System/Profiler.php | Profiler.finish | public static function finish() {
if(empty(self::$profiler) === false) {
self::$profiler = array_merge([
'elapsed' => self::getTime(time() - self::$profiler['start']),
'memory' => self::getMemoryUsage(),
'cpu' => self::getUsageCPU(),
'stack' => self::getStackCalls()
], self::$profiler);
unset(self::$profiler['start']);
}
} | php | public static function finish() {
if(empty(self::$profiler) === false) {
self::$profiler = array_merge([
'elapsed' => self::getTime(time() - self::$profiler['start']),
'memory' => self::getMemoryUsage(),
'cpu' => self::getUsageCPU(),
'stack' => self::getStackCalls()
], self::$profiler);
unset(self::$profiler['start']);
}
} | [
"public",
"static",
"function",
"finish",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"self",
"::",
"$",
"profiler",
")",
"===",
"false",
")",
"{",
"self",
"::",
"$",
"profiler",
"=",
"array_merge",
"(",
"[",
"'elapsed'",
"=>",
"self",
"::",
"getTime",
"... | Finish collect profiling data | [
"Finish",
"collect",
"profiling",
"data"
] | 4ebf59428fccfd7c7dfb100e0de00e5dd0efe1fa | https://github.com/stanislav-web/PhalconSonar/blob/4ebf59428fccfd7c7dfb100e0de00e5dd0efe1fa/src/Sonar/System/Profiler.php#L59-L72 | train |
stanislav-web/PhalconSonar | src/Sonar/System/Profiler.php | Profiler.getTime | public function getTime($seconds) {
$dtF = new \DateTime("@0");
$dtT = new \DateTime("@$seconds");
return $dtF->diff($dtT)->format('%h hours, %i minutes %s sec.');
} | php | public function getTime($seconds) {
$dtF = new \DateTime("@0");
$dtT = new \DateTime("@$seconds");
return $dtF->diff($dtT)->format('%h hours, %i minutes %s sec.');
} | [
"public",
"function",
"getTime",
"(",
"$",
"seconds",
")",
"{",
"$",
"dtF",
"=",
"new",
"\\",
"DateTime",
"(",
"\"@0\"",
")",
";",
"$",
"dtT",
"=",
"new",
"\\",
"DateTime",
"(",
"\"@$seconds\"",
")",
";",
"return",
"$",
"dtF",
"->",
"diff",
"(",
"$... | Get elapsled time
@param int $seconds
@return string | [
"Get",
"elapsled",
"time"
] | 4ebf59428fccfd7c7dfb100e0de00e5dd0efe1fa | https://github.com/stanislav-web/PhalconSonar/blob/4ebf59428fccfd7c7dfb100e0de00e5dd0efe1fa/src/Sonar/System/Profiler.php#L90-L96 | train |
stanislav-web/PhalconSonar | src/Sonar/System/Profiler.php | Profiler.getStackCalls | private static function getStackCalls() {
$i = 1;
$result = [];
foreach(xdebug_get_function_stack() as $node) {
if(isset($node['line']) === true) {
$result[] = "$i. ".basename($node['file']) .":" .$node['function'] ."(" .$node['line'].")";
}
$i++;
}
return $result;
} | php | private static function getStackCalls() {
$i = 1;
$result = [];
foreach(xdebug_get_function_stack() as $node) {
if(isset($node['line']) === true) {
$result[] = "$i. ".basename($node['file']) .":" .$node['function'] ."(" .$node['line'].")";
}
$i++;
}
return $result;
} | [
"private",
"static",
"function",
"getStackCalls",
"(",
")",
"{",
"$",
"i",
"=",
"1",
";",
"$",
"result",
"=",
"[",
"]",
";",
"foreach",
"(",
"xdebug_get_function_stack",
"(",
")",
"as",
"$",
"node",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"node",
"... | Get stack calls
@return array | [
"Get",
"stack",
"calls"
] | 4ebf59428fccfd7c7dfb100e0de00e5dd0efe1fa | https://github.com/stanislav-web/PhalconSonar/blob/4ebf59428fccfd7c7dfb100e0de00e5dd0efe1fa/src/Sonar/System/Profiler.php#L112-L123 | train |
stanislav-web/PhalconSonar | src/Sonar/System/Profiler.php | Profiler.getMemoryUsage | private static function getMemoryUsage() {
$memory = memory_get_peak_usage();
$floor = floor((strlen($memory) - 1) / 3);
return sprintf("%.2f", $memory/pow(1024, $floor)).' '.@'BKMGTPEZY'[$floor].'B';
} | php | private static function getMemoryUsage() {
$memory = memory_get_peak_usage();
$floor = floor((strlen($memory) - 1) / 3);
return sprintf("%.2f", $memory/pow(1024, $floor)).' '.@'BKMGTPEZY'[$floor].'B';
} | [
"private",
"static",
"function",
"getMemoryUsage",
"(",
")",
"{",
"$",
"memory",
"=",
"memory_get_peak_usage",
"(",
")",
";",
"$",
"floor",
"=",
"floor",
"(",
"(",
"strlen",
"(",
"$",
"memory",
")",
"-",
"1",
")",
"/",
"3",
")",
";",
"return",
"sprin... | Get stack of memory usage
@return string | [
"Get",
"stack",
"of",
"memory",
"usage"
] | 4ebf59428fccfd7c7dfb100e0de00e5dd0efe1fa | https://github.com/stanislav-web/PhalconSonar/blob/4ebf59428fccfd7c7dfb100e0de00e5dd0efe1fa/src/Sonar/System/Profiler.php#L139-L144 | train |
stanislav-web/PhalconSonar | src/Sonar/System/Profiler.php | Profiler.pretty | private static function pretty(array $data) {
$color = new Color();
$output = $color->getColoredString(self::VERBOSE_TITLE, 'blue', 'light-gray').PHP_EOL;
foreach($data as $key => $value) {
if(is_array($value) === false) {
$output .= $color->getColoredString(sprintf(self::VERBOSE_ROW, $key, $value), 'dark_gray').PHP_EOL;
}
else {
$output .= $color->getColoredString(sprintf(self::VERBOSE_ROW, $key, ''), 'dark_gray').PHP_EOL;
foreach($value as $line => $string) {
$output .= $color->getColoredString(sprintf("\t".self::VERBOSE_ROW, '', $string), 'dark_gray').PHP_EOL;
}
}
}
$output .= $color->getColoredString('-----------------', 'blue', 'light-gray').PHP_EOL;
return $output;
} | php | private static function pretty(array $data) {
$color = new Color();
$output = $color->getColoredString(self::VERBOSE_TITLE, 'blue', 'light-gray').PHP_EOL;
foreach($data as $key => $value) {
if(is_array($value) === false) {
$output .= $color->getColoredString(sprintf(self::VERBOSE_ROW, $key, $value), 'dark_gray').PHP_EOL;
}
else {
$output .= $color->getColoredString(sprintf(self::VERBOSE_ROW, $key, ''), 'dark_gray').PHP_EOL;
foreach($value as $line => $string) {
$output .= $color->getColoredString(sprintf("\t".self::VERBOSE_ROW, '', $string), 'dark_gray').PHP_EOL;
}
}
}
$output .= $color->getColoredString('-----------------', 'blue', 'light-gray').PHP_EOL;
return $output;
} | [
"private",
"static",
"function",
"pretty",
"(",
"array",
"$",
"data",
")",
"{",
"$",
"color",
"=",
"new",
"Color",
"(",
")",
";",
"$",
"output",
"=",
"$",
"color",
"->",
"getColoredString",
"(",
"self",
"::",
"VERBOSE_TITLE",
",",
"'blue'",
",",
"'ligh... | Pretty print profile data
@param array $data
@return string | [
"Pretty",
"print",
"profile",
"data"
] | 4ebf59428fccfd7c7dfb100e0de00e5dd0efe1fa | https://github.com/stanislav-web/PhalconSonar/blob/4ebf59428fccfd7c7dfb100e0de00e5dd0efe1fa/src/Sonar/System/Profiler.php#L153-L172 | train |
inc2734/wp-oembed-blog-card | src/Bootstrap.php | Bootstrap._block_filter_oembed_result | public function _block_filter_oembed_result( $response, $handler, $request ) {
if ( 'GET' !== $request->get_method() ) {
return $response;
}
if ( is_wp_error( $response ) && 'oembed_invalid_url' !== $response->get_error_code() ) {
return $response;
}
if ( '/oembed/1.0/proxy' !== $request->get_route() ) {
return $response;
}
$provider_name = 'wp-oembed-blog-card handler';
if ( isset( $response->provider_name ) && $response->provider_name === $provider_name ) {
return $response;
}
global $wp_embed;
$html = $wp_embed->shortcode( [], $request->get_param( 'url' ) );
if ( ! $html ) {
return $response;
}
return [
'provider_name' => $provider_name,
'html' => $html,
];
} | php | public function _block_filter_oembed_result( $response, $handler, $request ) {
if ( 'GET' !== $request->get_method() ) {
return $response;
}
if ( is_wp_error( $response ) && 'oembed_invalid_url' !== $response->get_error_code() ) {
return $response;
}
if ( '/oembed/1.0/proxy' !== $request->get_route() ) {
return $response;
}
$provider_name = 'wp-oembed-blog-card handler';
if ( isset( $response->provider_name ) && $response->provider_name === $provider_name ) {
return $response;
}
global $wp_embed;
$html = $wp_embed->shortcode( [], $request->get_param( 'url' ) );
if ( ! $html ) {
return $response;
}
return [
'provider_name' => $provider_name,
'html' => $html,
];
} | [
"public",
"function",
"_block_filter_oembed_result",
"(",
"$",
"response",
",",
"$",
"handler",
",",
"$",
"request",
")",
"{",
"if",
"(",
"'GET'",
"!==",
"$",
"request",
"->",
"get_method",
"(",
")",
")",
"{",
"return",
"$",
"response",
";",
"}",
"if",
... | Make sure oEmbed REST Requests apply the WP Embed security mechanism for WordPress embeds.
@see https://core.trac.wordpress.org/ticket/32522
@see https://github.com/WordPress/gutenberg/blob/master/lib/rest-api.php
@copyright https://github.com/WordPress/gutenberg
@param WP_HTTP_Response|WP_Error $response The REST Request response.
@param WP_REST_Server $handler ResponseHandler instance (usually WP_REST_Server).
@param WP_REST_Request $request Request used to generate the response.
@return WP_HTTP_Response|object|WP_Error The REST Request response. | [
"Make",
"sure",
"oEmbed",
"REST",
"Requests",
"apply",
"the",
"WP",
"Embed",
"security",
"mechanism",
"for",
"WordPress",
"embeds",
"."
] | 4882994152f9003db9c68517a53090cbef13ff4d | https://github.com/inc2734/wp-oembed-blog-card/blob/4882994152f9003db9c68517a53090cbef13ff4d/src/Bootstrap.php#L73-L102 | train |
inc2734/wp-oembed-blog-card | src/Bootstrap.php | Bootstrap._maybe_refresh_cache | protected function _maybe_refresh_cache( $url ) {
$cache = Cache::get( $url );
if ( ! $cache || is_admin() ) {
Cache::refresh( $url );
}
} | php | protected function _maybe_refresh_cache( $url ) {
$cache = Cache::get( $url );
if ( ! $cache || is_admin() ) {
Cache::refresh( $url );
}
} | [
"protected",
"function",
"_maybe_refresh_cache",
"(",
"$",
"url",
")",
"{",
"$",
"cache",
"=",
"Cache",
"::",
"get",
"(",
"$",
"url",
")",
";",
"if",
"(",
"!",
"$",
"cache",
"||",
"is_admin",
"(",
")",
")",
"{",
"Cache",
"::",
"refresh",
"(",
"$",
... | Refresh cache if the cache is expired or is_admin
@param string $url
@return void | [
"Refresh",
"cache",
"if",
"the",
"cache",
"is",
"expired",
"or",
"is_admin"
] | 4882994152f9003db9c68517a53090cbef13ff4d | https://github.com/inc2734/wp-oembed-blog-card/blob/4882994152f9003db9c68517a53090cbef13ff4d/src/Bootstrap.php#L110-L116 | train |
inc2734/wp-oembed-blog-card | src/Bootstrap.php | Bootstrap._render | protected function _render( $url ) {
$this->_maybe_refresh_cache( $url );
if ( ! is_admin() ) {
return $this->_is_block_embed_rendering_request()
? View::get_block_template( $url )
: View::get_pre_blog_card_template( $url );
}
return View::get_template( $url );
} | php | protected function _render( $url ) {
$this->_maybe_refresh_cache( $url );
if ( ! is_admin() ) {
return $this->_is_block_embed_rendering_request()
? View::get_block_template( $url )
: View::get_pre_blog_card_template( $url );
}
return View::get_template( $url );
} | [
"protected",
"function",
"_render",
"(",
"$",
"url",
")",
"{",
"$",
"this",
"->",
"_maybe_refresh_cache",
"(",
"$",
"url",
")",
";",
"if",
"(",
"!",
"is_admin",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"_is_block_embed_rendering_request",
"(",
")... | Rendering bloc card on editor
@param string $url
@return string | [
"Rendering",
"bloc",
"card",
"on",
"editor"
] | 4882994152f9003db9c68517a53090cbef13ff4d | https://github.com/inc2734/wp-oembed-blog-card/blob/4882994152f9003db9c68517a53090cbef13ff4d/src/Bootstrap.php#L124-L134 | train |
inc2734/wp-oembed-blog-card | src/Bootstrap.php | Bootstrap._is_admin_request | protected function _is_admin_request() {
if ( ! isset( $_SERVER['REQUEST_URI'] ) ) {
return false;
}
$request_uri = wp_unslash( $_SERVER['REQUEST_URI'] ); // WPCS: sanitization ok.
if ( false !== strpos( $request_uri, '/wp-admin/admin-ajax.php' ) ) {
return false === strpos( $request_uri, 'action=wp_oembed_blog_card_render' );
}
if ( false !== strpos( $request_uri, '/wp-json/' ) ) {
return false === strpos( $request_uri, '/wp-json/oembed/' );
}
if ( false !== strpos( $request_uri, '/wp-cron.php' ) ) {
return true;
}
return false;
} | php | protected function _is_admin_request() {
if ( ! isset( $_SERVER['REQUEST_URI'] ) ) {
return false;
}
$request_uri = wp_unslash( $_SERVER['REQUEST_URI'] ); // WPCS: sanitization ok.
if ( false !== strpos( $request_uri, '/wp-admin/admin-ajax.php' ) ) {
return false === strpos( $request_uri, 'action=wp_oembed_blog_card_render' );
}
if ( false !== strpos( $request_uri, '/wp-json/' ) ) {
return false === strpos( $request_uri, '/wp-json/oembed/' );
}
if ( false !== strpos( $request_uri, '/wp-cron.php' ) ) {
return true;
}
return false;
} | [
"protected",
"function",
"_is_admin_request",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"_SERVER",
"[",
"'REQUEST_URI'",
"]",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"request_uri",
"=",
"wp_unslash",
"(",
"$",
"_SERVER",
"[",
"'REQUEST_U... | Return true when requested from admin-ajax.php, wp-cron.php, wp-json
@return boolean | [
"Return",
"true",
"when",
"requested",
"from",
"admin",
"-",
"ajax",
".",
"php",
"wp",
"-",
"cron",
".",
"php",
"wp",
"-",
"json"
] | 4882994152f9003db9c68517a53090cbef13ff4d | https://github.com/inc2734/wp-oembed-blog-card/blob/4882994152f9003db9c68517a53090cbef13ff4d/src/Bootstrap.php#L156-L176 | train |
byjg/xmlnuke | xmlnuke-php5/src/Xmlnuke/Core/Classes/XmlInputTextBox.php | XmlInputTextBox.setAutosuggest | public function setAutosuggest($context, $url, $paramReq, $jsCallback="", $jsonArray = "select.option", $jsonObjKey = "value", $jsonObjValue = "_text", $jsonObjInfo = "_text")
{
$this->_context = $context;
$this->_autosuggestUrl = $url;
$this->_autosuggestParamReq = $paramReq;
$this->_autosuggestCallback = $jsCallback;
$this->_autosuggestJsonArray = $jsonArray;
$this->_autosuggestJsonObjKey = $jsonObjKey;
$this->_autosuggestJsonObjValue = $jsonObjValue;
$this->_autosuggestJsonObjInfo = $jsonObjInfo;
} | php | public function setAutosuggest($context, $url, $paramReq, $jsCallback="", $jsonArray = "select.option", $jsonObjKey = "value", $jsonObjValue = "_text", $jsonObjInfo = "_text")
{
$this->_context = $context;
$this->_autosuggestUrl = $url;
$this->_autosuggestParamReq = $paramReq;
$this->_autosuggestCallback = $jsCallback;
$this->_autosuggestJsonArray = $jsonArray;
$this->_autosuggestJsonObjKey = $jsonObjKey;
$this->_autosuggestJsonObjValue = $jsonObjValue;
$this->_autosuggestJsonObjInfo = $jsonObjInfo;
} | [
"public",
"function",
"setAutosuggest",
"(",
"$",
"context",
",",
"$",
"url",
",",
"$",
"paramReq",
",",
"$",
"jsCallback",
"=",
"\"\"",
",",
"$",
"jsonArray",
"=",
"\"select.option\"",
",",
"$",
"jsonObjKey",
"=",
"\"value\"",
",",
"$",
"jsonObjValue",
"=... | Configure an basic Autosuggest based on a JSON request.
The Default parameters expected a json from XMLNuke "select" tag (xpath = //select). The Json looks like to:
{"select":
{"caption":"Foto","name":"foto1",
"option":[
{"value":"13","#text":"Flamengo"},
{"value":"2626","#text":"Flamengo (Basquete)"},
{"value":"2597","#text":"Flavio Canto"},
{"value":"332","#text":"Flavio Venturini"},
{"value":"333","#text":"Flea"},
{"value":"334","#text":"Fleetwood Mac"},
{"value":"2441","#text":"Floresta"},
{"value":"12","#text":"Fluminense"}
]
}
}
The parameter $jsonArray will be "select.option" and the key "@value" and the value "#text";
@param string $url
@param string $attrInfo
@param string $attrId
@param string $attrCallback
@param string $jsonArray
@param string $jsonObjKey
@param string $jsonObjValue
@param string $jsonObjInfo | [
"Configure",
"an",
"basic",
"Autosuggest",
"based",
"on",
"a",
"JSON",
"request",
"."
] | aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7 | https://github.com/byjg/xmlnuke/blob/aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7/xmlnuke-php5/src/Xmlnuke/Core/Classes/XmlInputTextBox.php#L248-L258 | train |
ansas/php-component | src/Component/File/CsvBase.php | CsvBase.getEncoding | public function getEncoding($direction)
{
if (!isset($this->encoding[$direction])) {
throw new Exception("Encoding direction invalid");
}
return $this->encoding[$direction];
} | php | public function getEncoding($direction)
{
if (!isset($this->encoding[$direction])) {
throw new Exception("Encoding direction invalid");
}
return $this->encoding[$direction];
} | [
"public",
"function",
"getEncoding",
"(",
"$",
"direction",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"encoding",
"[",
"$",
"direction",
"]",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"\"Encoding direction invalid\"",
")",
";",
"}... | Get decoding for CSV.
@param string $direction
@return string
@throws Exception | [
"Get",
"decoding",
"for",
"CSV",
"."
] | 24574a1e32d5f1355a6e2b6f20f49b1eda7250ba | https://github.com/ansas/php-component/blob/24574a1e32d5f1355a6e2b6f20f49b1eda7250ba/src/Component/File/CsvBase.php#L70-L77 | train |
ansas/php-component | src/Component/File/CsvBase.php | CsvBase.setEncoding | public function setEncoding($direction, $encoding)
{
if (!isset($this->encoding[$direction])) {
throw new Exception("Encoding direction invalid");
}
if (!$encoding) {
throw new Exception("Encoding value invalid");
} elseif (preg_match('/utf.?8/ui', $encoding)) {
$encoding = 'UTF-8';
} else {
$encoding = mb_strtoupper($encoding);
}
$this->encoding[$direction] = $encoding;
return $this;
} | php | public function setEncoding($direction, $encoding)
{
if (!isset($this->encoding[$direction])) {
throw new Exception("Encoding direction invalid");
}
if (!$encoding) {
throw new Exception("Encoding value invalid");
} elseif (preg_match('/utf.?8/ui', $encoding)) {
$encoding = 'UTF-8';
} else {
$encoding = mb_strtoupper($encoding);
}
$this->encoding[$direction] = $encoding;
return $this;
} | [
"public",
"function",
"setEncoding",
"(",
"$",
"direction",
",",
"$",
"encoding",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"encoding",
"[",
"$",
"direction",
"]",
")",
")",
"{",
"throw",
"new",
"Exception",
"(",
"\"Encoding direction in... | Set encoding for CSV.
@param string $direction
@param string $encoding
@return $this
@throws Exception | [
"Set",
"encoding",
"for",
"CSV",
"."
] | 24574a1e32d5f1355a6e2b6f20f49b1eda7250ba | https://github.com/ansas/php-component/blob/24574a1e32d5f1355a6e2b6f20f49b1eda7250ba/src/Component/File/CsvBase.php#L144-L161 | train |
byjg/xmlnuke | xmlnuke-php5/src/Xmlnuke/Core/Processor/BaseProcessResult.php | BaseProcessResult.SearchAndReplace | public function SearchAndReplace($buffer)
{
$context = Context::getInstance();
$posi = 0;
$i = strpos($buffer, "<param-", $posi);
while ($i !== false)
{
echo substr($buffer, $posi, $i-$posi);
$if = strpos($buffer, "</param-", $i);
$tamparam = $if-$i-8;
$var = substr($buffer, $i+7, $tamparam);
echo $context->get($var);
$posi = $if + $tamparam + 9;
$i = strpos($buffer, "<param-", $posi);
}
echo substr($buffer, $posi);
} | php | public function SearchAndReplace($buffer)
{
$context = Context::getInstance();
$posi = 0;
$i = strpos($buffer, "<param-", $posi);
while ($i !== false)
{
echo substr($buffer, $posi, $i-$posi);
$if = strpos($buffer, "</param-", $i);
$tamparam = $if-$i-8;
$var = substr($buffer, $i+7, $tamparam);
echo $context->get($var);
$posi = $if + $tamparam + 9;
$i = strpos($buffer, "<param-", $posi);
}
echo substr($buffer, $posi);
} | [
"public",
"function",
"SearchAndReplace",
"(",
"$",
"buffer",
")",
"{",
"$",
"context",
"=",
"Context",
"::",
"getInstance",
"(",
")",
";",
"$",
"posi",
"=",
"0",
";",
"$",
"i",
"=",
"strpos",
"(",
"$",
"buffer",
",",
"\"<param-\"",
",",
"$",
"posi",... | This method is used only in the Wrappers
So, it can echo string directly
@param type $buffer | [
"This",
"method",
"is",
"used",
"only",
"in",
"the",
"Wrappers",
"So",
"it",
"can",
"echo",
"string",
"directly"
] | aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7 | https://github.com/byjg/xmlnuke/blob/aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7/xmlnuke-php5/src/Xmlnuke/Core/Processor/BaseProcessResult.php#L42-L63 | train |
byjg/xmlnuke | xmlnuke-php5/src/Xmlnuke/Core/Classes/PageXml.php | PageXml.addJavaScript | public function addJavaScript($javascript, $location = 'up')
{
$nodeWorking = XmlUtil::CreateChild($this->_nodePage, "script", "");
XmlUtil::AddAttribute($nodeWorking, "language", "javascript");
XmlUtil::AddAttribute($nodeWorking, "location", $location);
XmlUtil::AddTextNode($nodeWorking, $javascript);
} | php | public function addJavaScript($javascript, $location = 'up')
{
$nodeWorking = XmlUtil::CreateChild($this->_nodePage, "script", "");
XmlUtil::AddAttribute($nodeWorking, "language", "javascript");
XmlUtil::AddAttribute($nodeWorking, "location", $location);
XmlUtil::AddTextNode($nodeWorking, $javascript);
} | [
"public",
"function",
"addJavaScript",
"(",
"$",
"javascript",
",",
"$",
"location",
"=",
"'up'",
")",
"{",
"$",
"nodeWorking",
"=",
"XmlUtil",
"::",
"CreateChild",
"(",
"$",
"this",
"->",
"_nodePage",
",",
"\"script\"",
",",
"\"\"",
")",
";",
"XmlUtil",
... | =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- | [
"=",
"-",
"=",
"-",
"=",
"-",
"=",
"-",
"=",
"-",
"=",
"-",
"=",
"-",
"=",
"-",
"=",
"-",
"=",
"-",
"=",
"-",
"=",
"-",
"=",
"-",
"=",
"-",
"=",
"-",
"=",
"-",
"=",
"-",
"=",
"-",
"=",
"-",
"=",
"-",
"=",
"-",
"=",
"-",
"=",
"... | aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7 | https://github.com/byjg/xmlnuke/blob/aeb458e4b7e0f6df1d900202f3c1c2a7ad7384f7/xmlnuke-php5/src/Xmlnuke/Core/Classes/PageXml.php#L1065-L1071 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.