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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
cyberspectrum/i18n-contao | src/ContaoTableDictionary.php | ContaoTableDictionary.createValueWriter | protected function createValueWriter(
int $sourceId,
int $targetId,
ExtractorInterface $extractor,
string $trail
): WritableTranslationValueInterface {
return new WritableTranslationValue($this, $sourceId, $targetId, $extractor, $trail);
} | php | protected function createValueWriter(
int $sourceId,
int $targetId,
ExtractorInterface $extractor,
string $trail
): WritableTranslationValueInterface {
return new WritableTranslationValue($this, $sourceId, $targetId, $extractor, $trail);
} | [
"protected",
"function",
"createValueWriter",
"(",
"int",
"$",
"sourceId",
",",
"int",
"$",
"targetId",
",",
"ExtractorInterface",
"$",
"extractor",
",",
"string",
"$",
"trail",
")",
":",
"WritableTranslationValueInterface",
"{",
"return",
"new",
"WritableTranslatio... | Create a value writer instance.
@param int $sourceId The source id.
@param int $targetId The target id.
@param ExtractorInterface $extractor The extractor to use.
@param string $trail The trailing sub path.
@return WritableTranslationValueInterface | [
"Create",
"a",
"value",
"writer",
"instance",
"."
] | 038cf6ea9c609a734d7476fba256bc4b0db236b7 | https://github.com/cyberspectrum/i18n-contao/blob/038cf6ea9c609a734d7476fba256bc4b0db236b7/src/ContaoTableDictionary.php#L359-L366 | train |
atelierspierrot/internationalization | src/I18n/Loader.php | Loader.addPath | public function addPath($db_filename = null, $db_directory = null, $file = null)
{
if (!empty($db_filename) && !in_array($db_filename, $this->_paths['language_strings_db_filename'])) {
$this->_paths['language_strings_db_filename'][] = $db_filename;
}
if (!empty($db_directory) && ... | php | public function addPath($db_filename = null, $db_directory = null, $file = null)
{
if (!empty($db_filename) && !in_array($db_filename, $this->_paths['language_strings_db_filename'])) {
$this->_paths['language_strings_db_filename'][] = $db_filename;
}
if (!empty($db_directory) && ... | [
"public",
"function",
"addPath",
"(",
"$",
"db_filename",
"=",
"null",
",",
"$",
"db_directory",
"=",
"null",
",",
"$",
"file",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"empty",
"(",
"$",
"db_filename",
")",
"&&",
"!",
"in_array",
"(",
"$",
"db_filenam... | Add a path to the registry
@param null|string $db_filename
@param null|string $db_directory
@param null|string $file
@return $this | [
"Add",
"a",
"path",
"to",
"the",
"registry"
] | 334ebf75020d9e66b4b38a1eeab7b411f1ffe198 | https://github.com/atelierspierrot/internationalization/blob/334ebf75020d9e66b4b38a1eeab7b411f1ffe198/src/I18n/Loader.php#L88-L100 | train |
atelierspierrot/internationalization | src/I18n/Loader.php | Loader.getParsedOption | public function getParsedOption($name, $lang = null, $default = null)
{
$val = $this->getOption($name, $default);
if (false!==strpos($val, '%s')) {
if (is_null($lang)) {
$i18n = I18n::getInstance();
$lang = $i18n->getLanguage();
}
i... | php | public function getParsedOption($name, $lang = null, $default = null)
{
$val = $this->getOption($name, $default);
if (false!==strpos($val, '%s')) {
if (is_null($lang)) {
$i18n = I18n::getInstance();
$lang = $i18n->getLanguage();
}
i... | [
"public",
"function",
"getParsedOption",
"(",
"$",
"name",
",",
"$",
"lang",
"=",
"null",
",",
"$",
"default",
"=",
"null",
")",
"{",
"$",
"val",
"=",
"$",
"this",
"->",
"getOption",
"(",
"$",
"name",
",",
"$",
"default",
")",
";",
"if",
"(",
"fa... | Parse an option value replacing `%s` by the actual language code
@param string $name The option name
@param string|array $lang The language code to use or an array to pass to
the 'sprintf()' method
@param mixed $default The value to return if the option can't be found
@return mixed The value of the option if fo... | [
"Parse",
"an",
"option",
"value",
"replacing",
"%s",
"by",
"the",
"actual",
"language",
"code"
] | 334ebf75020d9e66b4b38a1eeab7b411f1ffe198 | https://github.com/atelierspierrot/internationalization/blob/334ebf75020d9e66b4b38a1eeab7b411f1ffe198/src/I18n/Loader.php#L111-L127 | train |
atelierspierrot/internationalization | src/I18n/Loader.php | Loader.buildLanguageFileName | public function buildLanguageFileName($lang, $db_filename = null)
{
if (empty($db_filename)) {
$db_filename = $this->getParsedOption('language_strings_db_filename');
}
$filename = pathinfo($db_filename, PATHINFO_FILENAME);
return $this->getParsedOption('language_filename... | php | public function buildLanguageFileName($lang, $db_filename = null)
{
if (empty($db_filename)) {
$db_filename = $this->getParsedOption('language_strings_db_filename');
}
$filename = pathinfo($db_filename, PATHINFO_FILENAME);
return $this->getParsedOption('language_filename... | [
"public",
"function",
"buildLanguageFileName",
"(",
"$",
"lang",
",",
"$",
"db_filename",
"=",
"null",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"db_filename",
")",
")",
"{",
"$",
"db_filename",
"=",
"$",
"this",
"->",
"getParsedOption",
"(",
"'language_stri... | Build the file name for the language database
@param string $lang The language code to use
@param string $db_filename A base filename to use
@return string The file name for the concerned language | [
"Build",
"the",
"file",
"name",
"for",
"the",
"language",
"database"
] | 334ebf75020d9e66b4b38a1eeab7b411f1ffe198 | https://github.com/atelierspierrot/internationalization/blob/334ebf75020d9e66b4b38a1eeab7b411f1ffe198/src/I18n/Loader.php#L140-L147 | train |
armazon/armazon | src/Armazon/Http/Respuesta.php | Respuesta.agregarCabecera | public function agregarCabecera($nombre, $valor)
{
if (isset($this->cabeceras[$nombre])) {
$this->cabeceras[$nombre][] = $valor;
} else {
$this->cabeceras[$nombre] = [$valor];
}
} | php | public function agregarCabecera($nombre, $valor)
{
if (isset($this->cabeceras[$nombre])) {
$this->cabeceras[$nombre][] = $valor;
} else {
$this->cabeceras[$nombre] = [$valor];
}
} | [
"public",
"function",
"agregarCabecera",
"(",
"$",
"nombre",
",",
"$",
"valor",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"cabeceras",
"[",
"$",
"nombre",
"]",
")",
")",
"{",
"$",
"this",
"->",
"cabeceras",
"[",
"$",
"nombre",
"]",
"[",... | Agrega una cabecera a la respuesta.
@param string $nombre
@param string $valor | [
"Agrega",
"una",
"cabecera",
"a",
"la",
"respuesta",
"."
] | ec76385ff80ce1659d81bc4050ef9483ab0ebe52 | https://github.com/armazon/armazon/blob/ec76385ff80ce1659d81bc4050ef9483ab0ebe52/src/Armazon/Http/Respuesta.php#L65-L73 | train |
armazon/armazon | src/Armazon/Http/Respuesta.php | Respuesta.agregarGalleta | public function agregarGalleta($nombre, $valor, $expira = 0, $camino = '/', $dominio = null, $seguro = false, $soloHttp = false)
{
$extras = '';
if ($expira) {
$extras .= ';Expires=' . gmdate('D, d M Y H:i:s \G\M\T', $expira);
}
if ($camino) {
$extras .= ';Pat... | php | public function agregarGalleta($nombre, $valor, $expira = 0, $camino = '/', $dominio = null, $seguro = false, $soloHttp = false)
{
$extras = '';
if ($expira) {
$extras .= ';Expires=' . gmdate('D, d M Y H:i:s \G\M\T', $expira);
}
if ($camino) {
$extras .= ';Pat... | [
"public",
"function",
"agregarGalleta",
"(",
"$",
"nombre",
",",
"$",
"valor",
",",
"$",
"expira",
"=",
"0",
",",
"$",
"camino",
"=",
"'/'",
",",
"$",
"dominio",
"=",
"null",
",",
"$",
"seguro",
"=",
"false",
",",
"$",
"soloHttp",
"=",
"false",
")"... | Agrega una galleta a la respuesta.
@param $nombre
@param $valor
@param int $expira
@param string $camino
@param string $dominio
@param bool $seguro
@param bool $soloHttp | [
"Agrega",
"una",
"galleta",
"a",
"la",
"respuesta",
"."
] | ec76385ff80ce1659d81bc4050ef9483ab0ebe52 | https://github.com/armazon/armazon/blob/ec76385ff80ce1659d81bc4050ef9483ab0ebe52/src/Armazon/Http/Respuesta.php#L86-L106 | train |
armazon/armazon | src/Armazon/Http/Respuesta.php | Respuesta.enviarArchivo | public function enviarArchivo($nombre)
{
$this->definirCabecera('Pragma', 'public');
$this->definirCabecera('Expires', '0');
$this->definirCabecera('Cache-Control', 'must-revalidate, post-check=0, pre-check=0');
$this->definirCabecera('Content-Length', (function_exists('mb_strlen') ?... | php | public function enviarArchivo($nombre)
{
$this->definirCabecera('Pragma', 'public');
$this->definirCabecera('Expires', '0');
$this->definirCabecera('Cache-Control', 'must-revalidate, post-check=0, pre-check=0');
$this->definirCabecera('Content-Length', (function_exists('mb_strlen') ?... | [
"public",
"function",
"enviarArchivo",
"(",
"$",
"nombre",
")",
"{",
"$",
"this",
"->",
"definirCabecera",
"(",
"'Pragma'",
",",
"'public'",
")",
";",
"$",
"this",
"->",
"definirCabecera",
"(",
"'Expires'",
",",
"'0'",
")",
";",
"$",
"this",
"->",
"defin... | Envia un archivo al navegador.
@param string $nombre | [
"Envia",
"un",
"archivo",
"al",
"navegador",
"."
] | ec76385ff80ce1659d81bc4050ef9483ab0ebe52 | https://github.com/armazon/armazon/blob/ec76385ff80ce1659d81bc4050ef9483ab0ebe52/src/Armazon/Http/Respuesta.php#L214-L224 | train |
armazon/armazon | src/Armazon/Http/Respuesta.php | Respuesta.redirigir | public function redirigir($url, $estadoHttp = 302)
{
$this->definirCabecera('Location', $url);
$this->definirEstadoHttp($estadoHttp);
$this->definirContenido(null);
return $this;
} | php | public function redirigir($url, $estadoHttp = 302)
{
$this->definirCabecera('Location', $url);
$this->definirEstadoHttp($estadoHttp);
$this->definirContenido(null);
return $this;
} | [
"public",
"function",
"redirigir",
"(",
"$",
"url",
",",
"$",
"estadoHttp",
"=",
"302",
")",
"{",
"$",
"this",
"->",
"definirCabecera",
"(",
"'Location'",
",",
"$",
"url",
")",
";",
"$",
"this",
"->",
"definirEstadoHttp",
"(",
"$",
"estadoHttp",
")",
"... | Redirige el navegador a la URL especificada.
@param string $url
@param int $estadoHttp
@return self | [
"Redirige",
"el",
"navegador",
"a",
"la",
"URL",
"especificada",
"."
] | ec76385ff80ce1659d81bc4050ef9483ab0ebe52 | https://github.com/armazon/armazon/blob/ec76385ff80ce1659d81bc4050ef9483ab0ebe52/src/Armazon/Http/Respuesta.php#L233-L239 | train |
bruno-barros/w.eloquent-framework | src/weloquent/Core/Application.php | Application.run | public function run(SymfonyRequest $request = null)
{
/**
* On testing environment the WordPress helpers
* will not have context. So we stop here.
*/
if(defined('WELOQUENT_TEST_ENV') && WELOQUENT_TEST_ENV)
{
return;
}
$request = $request ?: $this['request'];
$response = with($stack = $this->g... | php | public function run(SymfonyRequest $request = null)
{
/**
* On testing environment the WordPress helpers
* will not have context. So we stop here.
*/
if(defined('WELOQUENT_TEST_ENV') && WELOQUENT_TEST_ENV)
{
return;
}
$request = $request ?: $this['request'];
$response = with($stack = $this->g... | [
"public",
"function",
"run",
"(",
"SymfonyRequest",
"$",
"request",
"=",
"null",
")",
"{",
"/**\n\t\t * On testing environment the WordPress helpers\n\t\t * will not have context. So we stop here.\n\t\t */",
"if",
"(",
"defined",
"(",
"'WELOQUENT_TEST_ENV'",
")",
"&&",
"WELOQUE... | Run the application and save headers.
The response is up to WordPress
@param \Symfony\Component\HttpFoundation\Request $request
@return void | [
"Run",
"the",
"application",
"and",
"save",
"headers",
".",
"The",
"response",
"is",
"up",
"to",
"WordPress"
] | d252dcb1ba1b6b1cecf67877d7d6d3ba57ebedbd | https://github.com/bruno-barros/w.eloquent-framework/blob/d252dcb1ba1b6b1cecf67877d7d6d3ba57ebedbd/src/weloquent/Core/Application.php#L44-L82 | train |
gregorybesson/PlaygroundFlow | src/Form/Admin/StoryMapping.php | StoryMapping.getLeaderboardTypes | public function getLeaderboardTypes()
{
$leaderboardTypesArray = array();
$leaderboardTypesService = $this->getServiceManager()->get('playgroundreward_leaderboardtype_service');
$leaderboardTypes = $leaderboardTypesService->getLeaderboardTypeMapper()->findAll();
foreach ($leader... | php | public function getLeaderboardTypes()
{
$leaderboardTypesArray = array();
$leaderboardTypesService = $this->getServiceManager()->get('playgroundreward_leaderboardtype_service');
$leaderboardTypes = $leaderboardTypesService->getLeaderboardTypeMapper()->findAll();
foreach ($leader... | [
"public",
"function",
"getLeaderboardTypes",
"(",
")",
"{",
"$",
"leaderboardTypesArray",
"=",
"array",
"(",
")",
";",
"$",
"leaderboardTypesService",
"=",
"$",
"this",
"->",
"getServiceManager",
"(",
")",
"->",
"get",
"(",
"'playgroundreward_leaderboardtype_service... | retrieve all leaderboard type for associate to storyMapping
@return array $leaderboardTypesArray | [
"retrieve",
"all",
"leaderboard",
"type",
"for",
"associate",
"to",
"storyMapping"
] | f97493f8527e425d46223ac7b5c41331ab8b3022 | https://github.com/gregorybesson/PlaygroundFlow/blob/f97493f8527e425d46223ac7b5c41331ab8b3022/src/Form/Admin/StoryMapping.php#L317-L328 | train |
schpill/thin | src/Inflector.php | Inflector.rules | public static function rules($type, $config = array())
{
$var = '_' . $type;
if (!isset(static::${$var})) {
return null;
}
if (empty($config)) {
return static::${$var};
}
switch ($type) {
c... | php | public static function rules($type, $config = array())
{
$var = '_' . $type;
if (!isset(static::${$var})) {
return null;
}
if (empty($config)) {
return static::${$var};
}
switch ($type) {
c... | [
"public",
"static",
"function",
"rules",
"(",
"$",
"type",
",",
"$",
"config",
"=",
"array",
"(",
")",
")",
"{",
"$",
"var",
"=",
"'_'",
".",
"$",
"type",
";",
"if",
"(",
"!",
"isset",
"(",
"static",
"::",
"$",
"{",
"$",
"var",
"}",
")",
")",... | Gets or adds inflection and transliteration rules.
@param string $type Either `'transliteration'`, `'uninflected'`, `'singular'` or `'plural'`.
@param array $config
@return mixed If `$config` is empty, returns the rules list specified
by `$type`, otherwise returns `null`. | [
"Gets",
"or",
"adds",
"inflection",
"and",
"transliteration",
"rules",
"."
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Inflector.php#L221-L275 | train |
schpill/thin | src/Inflector.php | Inflector.pluralize | public static function pluralize($word)
{
if (isset(static::$_pluralized[$word])) {
return static::$_pluralized[$word];
}
extract(static::$_plural);
if (!isset($regexUninflected) || !isset($regexIrregular)) {
$regexUninflected = s... | php | public static function pluralize($word)
{
if (isset(static::$_pluralized[$word])) {
return static::$_pluralized[$word];
}
extract(static::$_plural);
if (!isset($regexUninflected) || !isset($regexIrregular)) {
$regexUninflected = s... | [
"public",
"static",
"function",
"pluralize",
"(",
"$",
"word",
")",
"{",
"if",
"(",
"isset",
"(",
"static",
"::",
"$",
"_pluralized",
"[",
"$",
"word",
"]",
")",
")",
"{",
"return",
"static",
"::",
"$",
"_pluralized",
"[",
"$",
"word",
"]",
";",
"}... | Changes the form of a word from singular to plural.
@param string $word Word in singular form.
@return string Word in plural form. | [
"Changes",
"the",
"form",
"of",
"a",
"word",
"from",
"singular",
"to",
"plural",
"."
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Inflector.php#L283-L315 | train |
schpill/thin | src/Inflector.php | Inflector.limitExact | public static function limitExact($value, $limit = 100, $end = '...')
{
if (static::length($value) <= $limit) {
return $value;
}
$limit -= static::length($end);
return static::limit($value, $limit, $end);
} | php | public static function limitExact($value, $limit = 100, $end = '...')
{
if (static::length($value) <= $limit) {
return $value;
}
$limit -= static::length($end);
return static::limit($value, $limit, $end);
} | [
"public",
"static",
"function",
"limitExact",
"(",
"$",
"value",
",",
"$",
"limit",
"=",
"100",
",",
"$",
"end",
"=",
"'...'",
")",
"{",
"if",
"(",
"static",
"::",
"length",
"(",
"$",
"value",
")",
"<=",
"$",
"limit",
")",
"{",
"return",
"$",
"va... | Limit the number of chracters in a string including custom ending
<code>
// Returns "hello..."
echo Inflector::limitExact('hello word', 9);
// Limit the number of characters and append a custom ending
echo Inflector::limitExact('hello word', 9, '---');
</code>
@param string $value
@param int $limit
@param st... | [
"Limit",
"the",
"number",
"of",
"chracters",
"in",
"a",
"string",
"including",
"custom",
"ending"
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Inflector.php#L985-L994 | train |
Phpillip/phpillip | src/Console/Model/Logger.php | Logger.getProgress | public function getProgress($total = null)
{
if (!$this->progress || $this->progress->getMaxSteps() === $this->progress->getProgress()) {
$this->progress = new ProgressBar($this->output, $total);
}
return $this->progress;
} | php | public function getProgress($total = null)
{
if (!$this->progress || $this->progress->getMaxSteps() === $this->progress->getProgress()) {
$this->progress = new ProgressBar($this->output, $total);
}
return $this->progress;
} | [
"public",
"function",
"getProgress",
"(",
"$",
"total",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"progress",
"||",
"$",
"this",
"->",
"progress",
"->",
"getMaxSteps",
"(",
")",
"===",
"$",
"this",
"->",
"progress",
"->",
"getProgress",... | Get progress bar instance
@param integer $total
@return ProgressBar | [
"Get",
"progress",
"bar",
"instance"
] | c37afaafb536361e7e0b564659f1cd5b80b98be9 | https://github.com/Phpillip/phpillip/blob/c37afaafb536361e7e0b564659f1cd5b80b98be9/src/Console/Model/Logger.php#L67-L74 | train |
Phpillip/phpillip | src/Console/Model/Logger.php | Logger.flush | public function flush()
{
if (!$this->progress) {
$this->log('');
foreach ($this->logs as $message) {
$this->log($message);
}
$this->logs = [];
}
} | php | public function flush()
{
if (!$this->progress) {
$this->log('');
foreach ($this->logs as $message) {
$this->log($message);
}
$this->logs = [];
}
} | [
"public",
"function",
"flush",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"progress",
")",
"{",
"$",
"this",
"->",
"log",
"(",
"''",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"logs",
"as",
"$",
"message",
")",
"{",
"$",
"this",
"->",
... | Flush message queue | [
"Flush",
"message",
"queue"
] | c37afaafb536361e7e0b564659f1cd5b80b98be9 | https://github.com/Phpillip/phpillip/blob/c37afaafb536361e7e0b564659f1cd5b80b98be9/src/Console/Model/Logger.php#L111-L122 | train |
phramework/phramework | src/Authentication/Manager.php | Manager.register | public static function register($implementation)
{
$object = new $implementation();
if (!($object instanceof \Phramework\Authentication\IAuthentication)) {
throw new \Exception(
'Class is not implementing \Phramework\Authentication\IAuthentication'
);
... | php | public static function register($implementation)
{
$object = new $implementation();
if (!($object instanceof \Phramework\Authentication\IAuthentication)) {
throw new \Exception(
'Class is not implementing \Phramework\Authentication\IAuthentication'
);
... | [
"public",
"static",
"function",
"register",
"(",
"$",
"implementation",
")",
"{",
"$",
"object",
"=",
"new",
"$",
"implementation",
"(",
")",
";",
"if",
"(",
"!",
"(",
"$",
"object",
"instanceof",
"\\",
"Phramework",
"\\",
"Authentication",
"\\",
"IAuthent... | Register an authentication implementation.
Implementation must implement
`\Phramework\Authentication\IAuthentication` interface
@param string $implementation implementation class
@throws Exception | [
"Register",
"an",
"authentication",
"implementation",
".",
"Implementation",
"must",
"implement",
"\\",
"Phramework",
"\\",
"Authentication",
"\\",
"IAuthentication",
"interface"
] | 40041d1ef23b1f8cdbd26fb112448d6a3dbef012 | https://github.com/phramework/phramework/blob/40041d1ef23b1f8cdbd26fb112448d6a3dbef012/src/Authentication/Manager.php#L31-L41 | train |
phramework/phramework | src/Authentication/Manager.php | Manager.check | public static function check($params, $method, $headers)
{
if (count(self::$implementations) !== 0 && !self::$userGetByEmailMethod) {
throw new \Phramework\Exceptions\ServerException(
'getUserByEmail method is not set'
);
}
foreach (self::$implementat... | php | public static function check($params, $method, $headers)
{
if (count(self::$implementations) !== 0 && !self::$userGetByEmailMethod) {
throw new \Phramework\Exceptions\ServerException(
'getUserByEmail method is not set'
);
}
foreach (self::$implementat... | [
"public",
"static",
"function",
"check",
"(",
"$",
"params",
",",
"$",
"method",
",",
"$",
"headers",
")",
"{",
"if",
"(",
"count",
"(",
"self",
"::",
"$",
"implementations",
")",
"!==",
"0",
"&&",
"!",
"self",
"::",
"$",
"userGetByEmailMethod",
")",
... | Check user's authentication
This method iterates through all available authentication implementations
tests in priorioty order which of them might be provided and executes
@param array $params Request parameters
@param string $method Request method
@param array $headers Request headers
@return array|false Retur... | [
"Check",
"user",
"s",
"authentication",
"This",
"method",
"iterates",
"through",
"all",
"available",
"authentication",
"implementations",
"tests",
"in",
"priorioty",
"order",
"which",
"of",
"them",
"might",
"be",
"provided",
"and",
"executes"
] | 40041d1ef23b1f8cdbd26fb112448d6a3dbef012 | https://github.com/phramework/phramework/blob/40041d1ef23b1f8cdbd26fb112448d6a3dbef012/src/Authentication/Manager.php#L61-L76 | train |
lechimp-p/flightcontrol | src/Recursor.php | Recursor.filter | public function filter(\Closure $predicate) {
$filter = array();
$filter[0] = function(FixedFDirectory $obj) use ($predicate, &$filter) {
return $obj
->filter($predicate)
->map(function(FSObject $obj) use ($predicate, &$filter) {
if ($obj->... | php | public function filter(\Closure $predicate) {
$filter = array();
$filter[0] = function(FixedFDirectory $obj) use ($predicate, &$filter) {
return $obj
->filter($predicate)
->map(function(FSObject $obj) use ($predicate, &$filter) {
if ($obj->... | [
"public",
"function",
"filter",
"(",
"\\",
"Closure",
"$",
"predicate",
")",
"{",
"$",
"filter",
"=",
"array",
"(",
")",
";",
"$",
"filter",
"[",
"0",
"]",
"=",
"function",
"(",
"FixedFDirectory",
"$",
"obj",
")",
"use",
"(",
"$",
"predicate",
",",
... | Get a recursor that folds all files in this recursor that match the
provided predicate and the objects below that match the predicate as
well.
Won't recurse over directories that do not match the predicate!
@param \Closure $predicate (FSObject -> Bool)
@return Recursor | [
"Get",
"a",
"recursor",
"that",
"folds",
"all",
"files",
"in",
"this",
"recursor",
"that",
"match",
"the",
"provided",
"predicate",
"and",
"the",
"objects",
"below",
"that",
"match",
"the",
"predicate",
"as",
"well",
"."
] | be7698183b44787f1b3d4a16d739655388e569ae | https://github.com/lechimp-p/flightcontrol/blob/be7698183b44787f1b3d4a16d739655388e569ae/src/Recursor.php#L39-L52 | train |
lechimp-p/flightcontrol | src/Recursor.php | Recursor.cata | public function cata(\Closure $trans) {
return $trans( $this->directory->unfix()->fmap(function(FSObject $obj) use ($trans) {
if ($obj->isFile()) {
return $trans($obj);
}
assert($obj instanceof FixedFDirectory);
return $obj->cata($trans);
}... | php | public function cata(\Closure $trans) {
return $trans( $this->directory->unfix()->fmap(function(FSObject $obj) use ($trans) {
if ($obj->isFile()) {
return $trans($obj);
}
assert($obj instanceof FixedFDirectory);
return $obj->cata($trans);
}... | [
"public",
"function",
"cata",
"(",
"\\",
"Closure",
"$",
"trans",
")",
"{",
"return",
"$",
"trans",
"(",
"$",
"this",
"->",
"directory",
"->",
"unfix",
"(",
")",
"->",
"fmap",
"(",
"function",
"(",
"FSObject",
"$",
"obj",
")",
"use",
"(",
"$",
"tra... | We could also use the catamorphism on this to do recursion, as we
have an unfix and an underlying fmap from the FDirectory.
Supply a function $trans from File|FDirectory a to a that flattens
(folds) a directory. Will start the directories where only files are
included, folds them and then proceeds upwards.
The return... | [
"We",
"could",
"also",
"use",
"the",
"catamorphism",
"on",
"this",
"to",
"do",
"recursion",
"as",
"we",
"have",
"an",
"unfix",
"and",
"an",
"underlying",
"fmap",
"from",
"the",
"FDirectory",
"."
] | be7698183b44787f1b3d4a16d739655388e569ae | https://github.com/lechimp-p/flightcontrol/blob/be7698183b44787f1b3d4a16d739655388e569ae/src/Recursor.php#L69-L77 | train |
lechimp-p/flightcontrol | src/Recursor.php | Recursor.foldFiles | public function foldFiles($start_value, \Closure $fold_with) {
foreach ($this->allFiles() as $file) {
$start_value = $fold_with($start_value, $file);
}
return $start_value;
} | php | public function foldFiles($start_value, \Closure $fold_with) {
foreach ($this->allFiles() as $file) {
$start_value = $fold_with($start_value, $file);
}
return $start_value;
} | [
"public",
"function",
"foldFiles",
"(",
"$",
"start_value",
",",
"\\",
"Closure",
"$",
"fold_with",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"allFiles",
"(",
")",
"as",
"$",
"file",
")",
"{",
"$",
"start_value",
"=",
"$",
"fold_with",
"(",
"$",
"... | Fold over all files in this directory and subjacent directories.
Start with an initial value of some type and a function from that type
and File to a new value of the type. Will successively feed all files
and the resulting values to that function.
@param mixed $start_value
@param \Closure $fold_with ... | [
"Fold",
"over",
"all",
"files",
"in",
"this",
"directory",
"and",
"subjacent",
"directories",
"."
] | be7698183b44787f1b3d4a16d739655388e569ae | https://github.com/lechimp-p/flightcontrol/blob/be7698183b44787f1b3d4a16d739655388e569ae/src/Recursor.php#L100-L105 | train |
lechimp-p/flightcontrol | src/Recursor.php | Recursor.allFiles | public function allFiles() {
return $this->cata(function(FSObject $obj) {
if ($obj->isFile()) {
return array($obj);
}
assert($obj instanceof FDirectory);
$fcontents = $obj->fcontents();
if (empty($fcontents)) {
return $... | php | public function allFiles() {
return $this->cata(function(FSObject $obj) {
if ($obj->isFile()) {
return array($obj);
}
assert($obj instanceof FDirectory);
$fcontents = $obj->fcontents();
if (empty($fcontents)) {
return $... | [
"public",
"function",
"allFiles",
"(",
")",
"{",
"return",
"$",
"this",
"->",
"cata",
"(",
"function",
"(",
"FSObject",
"$",
"obj",
")",
"{",
"if",
"(",
"$",
"obj",
"->",
"isFile",
"(",
")",
")",
"{",
"return",
"array",
"(",
"$",
"obj",
")",
";",... | Get a list of all files in the directory and subjacent directories.
@return File[] | [
"Get",
"a",
"list",
"of",
"all",
"files",
"in",
"the",
"directory",
"and",
"subjacent",
"directories",
"."
] | be7698183b44787f1b3d4a16d739655388e569ae | https://github.com/lechimp-p/flightcontrol/blob/be7698183b44787f1b3d4a16d739655388e569ae/src/Recursor.php#L112-L125 | train |
Ekstazi/yii2-crud-actions | src/actions/Action.php | Action.ensureAccess | protected function ensureAccess($params = [])
{
if (!isset($this->checkAccess))
return;
$params['action'] = $this;
if (call_user_func($this->checkAccess, $params))
return;
$user = \Yii::$app->user;
if ($user->getIsGuest())
$user->loginR... | php | protected function ensureAccess($params = [])
{
if (!isset($this->checkAccess))
return;
$params['action'] = $this;
if (call_user_func($this->checkAccess, $params))
return;
$user = \Yii::$app->user;
if ($user->getIsGuest())
$user->loginR... | [
"protected",
"function",
"ensureAccess",
"(",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"checkAccess",
")",
")",
"return",
";",
"$",
"params",
"[",
"'action'",
"]",
"=",
"$",
"this",
";",
"if",
"(",
... | Ensure this action is allowed for current user
@param array $params Params to be passed to {$this->checkAccess}
@throws ForbiddenHttpException | [
"Ensure",
"this",
"action",
"is",
"allowed",
"for",
"current",
"user"
] | 38029fcfc1fac662604b3cabc08ec6ccacb94c57 | https://github.com/Ekstazi/yii2-crud-actions/blob/38029fcfc1fac662604b3cabc08ec6ccacb94c57/src/actions/Action.php#L66-L86 | train |
tigron/skeleton-error | lib/Skeleton/Error/Detector/Whoops.php | Whoops.detect | public static function detect($html, &$error = '') {
if (!class_exists('Whoops\Run')) {
return false;
}
if (strpos($html, 'class="Whoops container"') != false) {
// temporarily disables libxml warnings
libxml_use_internal_errors(true);
$dom = new \DOMDocument();
$dom->loadHTML($html);
$xpath = ... | php | public static function detect($html, &$error = '') {
if (!class_exists('Whoops\Run')) {
return false;
}
if (strpos($html, 'class="Whoops container"') != false) {
// temporarily disables libxml warnings
libxml_use_internal_errors(true);
$dom = new \DOMDocument();
$dom->loadHTML($html);
$xpath = ... | [
"public",
"static",
"function",
"detect",
"(",
"$",
"html",
",",
"&",
"$",
"error",
"=",
"''",
")",
"{",
"if",
"(",
"!",
"class_exists",
"(",
"'Whoops\\Run'",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"strpos",
"(",
"$",
"html",
",",
... | Function detect
Takes care of detecting if a Whoops error was passed and if true
extracting the error code to return it by reference
@access public
@param string $html code of the page to be analyzed
@param string $error the error code found (if any)
@return bool does the page contain an error | [
"Function",
"detect",
"Takes",
"care",
"of",
"detecting",
"if",
"a",
"Whoops",
"error",
"was",
"passed",
"and",
"if",
"true",
"extracting",
"the",
"error",
"code",
"to",
"return",
"it",
"by",
"reference"
] | c0671ad52a4386d95179f1c47bedfdf754ee3611 | https://github.com/tigron/skeleton-error/blob/c0671ad52a4386d95179f1c47bedfdf754ee3611/lib/Skeleton/Error/Detector/Whoops.php#L25-L47 | train |
pmdevelopment/tool-bundle | Framework/Model/SendMailFormModel.php | SendMailFormModel.getSwiftMessage | public function getSwiftMessage()
{
$message = \Swift_Message::newInstance();
if (true === is_array($this->getRecipient())) {
$recipient = $this->getRecipient();
} else {
$recipient = [
$this->getRecipient(),
];
};
$messag... | php | public function getSwiftMessage()
{
$message = \Swift_Message::newInstance();
if (true === is_array($this->getRecipient())) {
$recipient = $this->getRecipient();
} else {
$recipient = [
$this->getRecipient(),
];
};
$messag... | [
"public",
"function",
"getSwiftMessage",
"(",
")",
"{",
"$",
"message",
"=",
"\\",
"Swift_Message",
"::",
"newInstance",
"(",
")",
";",
"if",
"(",
"true",
"===",
"is_array",
"(",
"$",
"this",
"->",
"getRecipient",
"(",
")",
")",
")",
"{",
"$",
"recipie... | Get Swift Message
@return Swift_Mime_Message | [
"Get",
"Swift",
"Message"
] | 2cbc9f82c5b33fd7a9d389edd3676e9f70ea8129 | https://github.com/pmdevelopment/tool-bundle/blob/2cbc9f82c5b33fd7a9d389edd3676e9f70ea8129/Framework/Model/SendMailFormModel.php#L161-L190 | train |
zbox/UnifiedPush | src/Zbox/UnifiedPush/NotificationService/GCM/Response.php | Response.checkMessageStatus | private function checkMessageStatus($message)
{
if (!$message || $message->success == 0 || $message->failure > 0) {
throw new DispatchMessageException(
sprintf("%d messages could not be processed", $message->failure)
);
}
} | php | private function checkMessageStatus($message)
{
if (!$message || $message->success == 0 || $message->failure > 0) {
throw new DispatchMessageException(
sprintf("%d messages could not be processed", $message->failure)
);
}
} | [
"private",
"function",
"checkMessageStatus",
"(",
"$",
"message",
")",
"{",
"if",
"(",
"!",
"$",
"message",
"||",
"$",
"message",
"->",
"success",
"==",
"0",
"||",
"$",
"message",
"->",
"failure",
">",
"0",
")",
"{",
"throw",
"new",
"DispatchMessageExcep... | Checks message status
@param \stdClass $message | [
"Checks",
"message",
"status"
] | 47da2d0577b18ac709cd947c68541014001e1866 | https://github.com/zbox/UnifiedPush/blob/47da2d0577b18ac709cd947c68541014001e1866/src/Zbox/UnifiedPush/NotificationService/GCM/Response.php#L119-L126 | train |
zbox/UnifiedPush | src/Zbox/UnifiedPush/NotificationService/GCM/Response.php | Response.checkMessageResult | private function checkMessageResult($message, \ArrayIterator $recipients)
{
$hasDeviceError = false;
$recipientCount = $recipients->count();
for ($i = 0; $i <= $recipientCount; $i++) {
if (isset($message->results[$i]['registration_id'])) {
$hasDeviceError = true... | php | private function checkMessageResult($message, \ArrayIterator $recipients)
{
$hasDeviceError = false;
$recipientCount = $recipients->count();
for ($i = 0; $i <= $recipientCount; $i++) {
if (isset($message->results[$i]['registration_id'])) {
$hasDeviceError = true... | [
"private",
"function",
"checkMessageResult",
"(",
"$",
"message",
",",
"\\",
"ArrayIterator",
"$",
"recipients",
")",
"{",
"$",
"hasDeviceError",
"=",
"false",
";",
"$",
"recipientCount",
"=",
"$",
"recipients",
"->",
"count",
"(",
")",
";",
"for",
"(",
"$... | Check message result
@param \stdClass $message
@param \ArrayIterator $recipients | [
"Check",
"message",
"result"
] | 47da2d0577b18ac709cd947c68541014001e1866 | https://github.com/zbox/UnifiedPush/blob/47da2d0577b18ac709cd947c68541014001e1866/src/Zbox/UnifiedPush/NotificationService/GCM/Response.php#L134-L156 | train |
diasbruno/stc | lib/stc/Config.php | Config.getOptional | public function getOptional($key, $defaultValue = null)
{
if (array_key_exists($key, $this->data)) {
return $this->data[$key];
}
return $defaultValue;
} | php | public function getOptional($key, $defaultValue = null)
{
if (array_key_exists($key, $this->data)) {
return $this->data[$key];
}
return $defaultValue;
} | [
"public",
"function",
"getOptional",
"(",
"$",
"key",
",",
"$",
"defaultValue",
"=",
"null",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"data",
")",
")",
"{",
"return",
"$",
"this",
"->",
"data",
"[",
"$",
"ke... | Use this method for optional values.
@param $key string | The key name.
@return object | [
"Use",
"this",
"method",
"for",
"optional",
"values",
"."
] | 43f62c3b28167bff76274f954e235413a9e9c707 | https://github.com/diasbruno/stc/blob/43f62c3b28167bff76274f954e235413a9e9c707/lib/stc/Config.php#L82-L88 | train |
bruno-barros/w.eloquent-framework | src/weloquent/Providers/OptimizeServiceProvider.php | OptimizeServiceProvider.registerOptimizeCommand | protected function registerOptimizeCommand()
{
$this->app->bindShared('command.optimize', function($app)
{
return new \Weloquent\Core\Console\OptimizeCommand($app['composer']);
});
} | php | protected function registerOptimizeCommand()
{
$this->app->bindShared('command.optimize', function($app)
{
return new \Weloquent\Core\Console\OptimizeCommand($app['composer']);
});
} | [
"protected",
"function",
"registerOptimizeCommand",
"(",
")",
"{",
"$",
"this",
"->",
"app",
"->",
"bindShared",
"(",
"'command.optimize'",
",",
"function",
"(",
"$",
"app",
")",
"{",
"return",
"new",
"\\",
"Weloquent",
"\\",
"Core",
"\\",
"Console",
"\\",
... | Register the optimize command.
@return void | [
"Register",
"the",
"optimize",
"command",
"."
] | d252dcb1ba1b6b1cecf67877d7d6d3ba57ebedbd | https://github.com/bruno-barros/w.eloquent-framework/blob/d252dcb1ba1b6b1cecf67877d7d6d3ba57ebedbd/src/weloquent/Providers/OptimizeServiceProvider.php#L35-L41 | train |
PhoxPHP/Glider | src/Events/EventManager.php | EventManager.listenTo | public static function listenTo(String $eventId, $callback)
{
if (!in_array(gettype($callback), ['array', 'object', 'closure'])) {
return false;
}
EventManager::$listeners[$eventId][] = $callback;
} | php | public static function listenTo(String $eventId, $callback)
{
if (!in_array(gettype($callback), ['array', 'object', 'closure'])) {
return false;
}
EventManager::$listeners[$eventId][] = $callback;
} | [
"public",
"static",
"function",
"listenTo",
"(",
"String",
"$",
"eventId",
",",
"$",
"callback",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"gettype",
"(",
"$",
"callback",
")",
",",
"[",
"'array'",
",",
"'object'",
",",
"'closure'",
"]",
")",
")",
"... | Creates a new listener. Two parameters are required. The eventId that will be used
to track the current event and the callback which can be either an array or a closure.
@param $eventId <String>
@param $callback <Mixed>
@access public
@static
@return <void> | [
"Creates",
"a",
"new",
"listener",
".",
"Two",
"parameters",
"are",
"required",
".",
"The",
"eventId",
"that",
"will",
"be",
"used",
"to",
"track",
"the",
"current",
"event",
"and",
"the",
"callback",
"which",
"can",
"be",
"either",
"an",
"array",
"or",
... | 17aaf3b7bb6e70ea3ae1f04e30a7690e884bf042 | https://github.com/PhoxPHP/Glider/blob/17aaf3b7bb6e70ea3ae1f04e30a7690e884bf042/src/Events/EventManager.php#L75-L82 | train |
PhoxPHP/Glider | src/Events/EventManager.php | EventManager.attachSubscriber | public function attachSubscriber(Subscriber $subscriber)
{
$listeners = $subscriber->getRegisteredEvents();
foreach($listeners as $id => $listener) {
EventManager::listenTo($id, array($subscriber, $listener));
}
} | php | public function attachSubscriber(Subscriber $subscriber)
{
$listeners = $subscriber->getRegisteredEvents();
foreach($listeners as $id => $listener) {
EventManager::listenTo($id, array($subscriber, $listener));
}
} | [
"public",
"function",
"attachSubscriber",
"(",
"Subscriber",
"$",
"subscriber",
")",
"{",
"$",
"listeners",
"=",
"$",
"subscriber",
"->",
"getRegisteredEvents",
"(",
")",
";",
"foreach",
"(",
"$",
"listeners",
"as",
"$",
"id",
"=>",
"$",
"listener",
")",
"... | This method attaches an event through it's subscribe object. List of events
are loaded from the subscriber and added to the listeners.
@param $subscriber <Kit\Glider\Events\Contract\Subcriber>
@access public
@return <void> | [
"This",
"method",
"attaches",
"an",
"event",
"through",
"it",
"s",
"subscribe",
"object",
".",
"List",
"of",
"events",
"are",
"loaded",
"from",
"the",
"subscriber",
"and",
"added",
"to",
"the",
"listeners",
"."
] | 17aaf3b7bb6e70ea3ae1f04e30a7690e884bf042 | https://github.com/PhoxPHP/Glider/blob/17aaf3b7bb6e70ea3ae1f04e30a7690e884bf042/src/Events/EventManager.php#L109-L115 | train |
eloquent/endec | src/Endec.php | Endec.registerFilters | public static function registerFilters(Isolator $isolator = null)
{
$isolator = Isolator::get($isolator);
$isolator->stream_filter_register(
'endec.base16-encode',
'Eloquent\Endec\Base16\Base16EncodeNativeStreamFilter'
);
$isolator->stream_filter_register(
... | php | public static function registerFilters(Isolator $isolator = null)
{
$isolator = Isolator::get($isolator);
$isolator->stream_filter_register(
'endec.base16-encode',
'Eloquent\Endec\Base16\Base16EncodeNativeStreamFilter'
);
$isolator->stream_filter_register(
... | [
"public",
"static",
"function",
"registerFilters",
"(",
"Isolator",
"$",
"isolator",
"=",
"null",
")",
"{",
"$",
"isolator",
"=",
"Isolator",
"::",
"get",
"(",
"$",
"isolator",
")",
";",
"$",
"isolator",
"->",
"stream_filter_register",
"(",
"'endec.base16-enco... | Register Endec's native stream filters.
@param Isolator|null $isolator The isolator to use. | [
"Register",
"Endec",
"s",
"native",
"stream",
"filters",
"."
] | 90043a26439739d6bac631cc57dab3ecf5cafdc3 | https://github.com/eloquent/endec/blob/90043a26439739d6bac631cc57dab3ecf5cafdc3/src/Endec.php#L26-L86 | train |
kmfk/slowdb | src/Collection.php | Collection.get | public function get($key)
{
$position = $this->getPosition($key);
if (false !== $position) {
return [$key => $this->file->read($position)];
}
return false;
} | php | public function get($key)
{
$position = $this->getPosition($key);
if (false !== $position) {
return [$key => $this->file->read($position)];
}
return false;
} | [
"public",
"function",
"get",
"(",
"$",
"key",
")",
"{",
"$",
"position",
"=",
"$",
"this",
"->",
"getPosition",
"(",
"$",
"key",
")",
";",
"if",
"(",
"false",
"!==",
"$",
"position",
")",
"{",
"return",
"[",
"$",
"key",
"=>",
"$",
"this",
"->",
... | Retrieves the value based on the key
@param mixed $key The key to fetch data for
@return array | [
"Retrieves",
"the",
"value",
"based",
"on",
"the",
"key"
] | 7461771b8ddc0c9887e2ee69a76ff5ffc763974c | https://github.com/kmfk/slowdb/blob/7461771b8ddc0c9887e2ee69a76ff5ffc763974c/src/Collection.php#L83-L91 | train |
kmfk/slowdb | src/Collection.php | Collection.query | public function query($match)
{
$keys = $this->index->getKeys();
$matches = array_filter($keys, function($key) use ($match) {
return preg_match("/{$match}/i", $key);
});
$results = [];
foreach ($matches as $match) {
$result = $this->get($match);
... | php | public function query($match)
{
$keys = $this->index->getKeys();
$matches = array_filter($keys, function($key) use ($match) {
return preg_match("/{$match}/i", $key);
});
$results = [];
foreach ($matches as $match) {
$result = $this->get($match);
... | [
"public",
"function",
"query",
"(",
"$",
"match",
")",
"{",
"$",
"keys",
"=",
"$",
"this",
"->",
"index",
"->",
"getKeys",
"(",
")",
";",
"$",
"matches",
"=",
"array_filter",
"(",
"$",
"keys",
",",
"function",
"(",
"$",
"key",
")",
"use",
"(",
"$... | Queries for Keys matching a case insensitive expression
@param string $match The expression to match against
@return array | [
"Queries",
"for",
"Keys",
"matching",
"a",
"case",
"insensitive",
"expression"
] | 7461771b8ddc0c9887e2ee69a76ff5ffc763974c | https://github.com/kmfk/slowdb/blob/7461771b8ddc0c9887e2ee69a76ff5ffc763974c/src/Collection.php#L130-L144 | train |
kmfk/slowdb | src/Collection.php | Collection.remove | public function remove($key)
{
$position = $this->getPosition($key);
if (false !== $position) {
$this->file->remove($position);
$this->rebuildIndex();
return true;
}
return false;
} | php | public function remove($key)
{
$position = $this->getPosition($key);
if (false !== $position) {
$this->file->remove($position);
$this->rebuildIndex();
return true;
}
return false;
} | [
"public",
"function",
"remove",
"(",
"$",
"key",
")",
"{",
"$",
"position",
"=",
"$",
"this",
"->",
"getPosition",
"(",
"$",
"key",
")",
";",
"if",
"(",
"false",
"!==",
"$",
"position",
")",
"{",
"$",
"this",
"->",
"file",
"->",
"remove",
"(",
"$... | Remove a Value based on its Key
@param mixed $key The key to remove
@return bool | [
"Remove",
"a",
"Value",
"based",
"on",
"its",
"Key"
] | 7461771b8ddc0c9887e2ee69a76ff5ffc763974c | https://github.com/kmfk/slowdb/blob/7461771b8ddc0c9887e2ee69a76ff5ffc763974c/src/Collection.php#L175-L186 | train |
kmfk/slowdb | src/Collection.php | Collection.drop | public function drop()
{
$filepath = $this->file->getFilePath();
unset($this->file);
if (!file_exists($filepath)) {
unlink($filepath);
}
return true;
} | php | public function drop()
{
$filepath = $this->file->getFilePath();
unset($this->file);
if (!file_exists($filepath)) {
unlink($filepath);
}
return true;
} | [
"public",
"function",
"drop",
"(",
")",
"{",
"$",
"filepath",
"=",
"$",
"this",
"->",
"file",
"->",
"getFilePath",
"(",
")",
";",
"unset",
"(",
"$",
"this",
"->",
"file",
")",
";",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"filepath",
")",
")",
"{... | Removes the Collection database file
@return bool | [
"Removes",
"the",
"Collection",
"database",
"file"
] | 7461771b8ddc0c9887e2ee69a76ff5ffc763974c | https://github.com/kmfk/slowdb/blob/7461771b8ddc0c9887e2ee69a76ff5ffc763974c/src/Collection.php#L206-L217 | train |
wdbo/webdocbook | src/WebDocBook/FrontController.php | FrontController.boot | protected function boot()
{
try {
Kernel::boot();
// Kernel::debug();
// the actual manifest
if (true===file_exists(Kernel::getPath('app_manifest_filepath'))) {
$manifest_data = FilesystemHelper::parseJson(Kernel::getPath('app_manifest_filepath... | php | protected function boot()
{
try {
Kernel::boot();
// Kernel::debug();
// the actual manifest
if (true===file_exists(Kernel::getPath('app_manifest_filepath'))) {
$manifest_data = FilesystemHelper::parseJson(Kernel::getPath('app_manifest_filepath... | [
"protected",
"function",
"boot",
"(",
")",
"{",
"try",
"{",
"Kernel",
"::",
"boot",
"(",
")",
";",
"// Kernel::debug();",
"// the actual manifest",
"if",
"(",
"true",
"===",
"file_exists",
"(",
"Kernel",
"::",
"getPath",
"(",
"'app_manifest_filepath'",
... | This must boot the system
If an error occurred, a message is written "as is" on screen
and the run stops here.
@return void
@see \WebDocBook\Kernel::boot() | [
"This",
"must",
"boot",
"the",
"system"
] | 7d4e806f674b6222c9a3e85bfed34e72bc9d584e | https://github.com/wdbo/webdocbook/blob/7d4e806f674b6222c9a3e85bfed34e72bc9d584e/src/WebDocBook/FrontController.php#L94-L125 | train |
wdbo/webdocbook | src/WebDocBook/FrontController.php | FrontController.distribute | public function distribute($return = false)
{
$this->processSessionValues();
try {
$routing = $this->request
->parseWDBRequest()
->getWDBRouting();
} catch (NotFoundException $e) {
throw $e;
}
$this->processQueryArgume... | php | public function distribute($return = false)
{
$this->processSessionValues();
try {
$routing = $this->request
->parseWDBRequest()
->getWDBRouting();
} catch (NotFoundException $e) {
throw $e;
}
$this->processQueryArgume... | [
"public",
"function",
"distribute",
"(",
"$",
"return",
"=",
"false",
")",
"{",
"$",
"this",
"->",
"processSessionValues",
"(",
")",
";",
"try",
"{",
"$",
"routing",
"=",
"$",
"this",
"->",
"request",
"->",
"parseWDBRequest",
"(",
")",
"->",
"getWDBRouti... | This will distribute the request and return the response
@param bool $return
@throws \WebDocBook\Exception\NotFoundException
@throws \WebDocBook\Exception\RuntimeException if the controller action does not return a valid array
@return void | [
"This",
"will",
"distribute",
"the",
"request",
"and",
"return",
"the",
"response"
] | 7d4e806f674b6222c9a3e85bfed34e72bc9d584e | https://github.com/wdbo/webdocbook/blob/7d4e806f674b6222c9a3e85bfed34e72bc9d584e/src/WebDocBook/FrontController.php#L238-L290 | train |
stonedz/pff2 | src/modules/encryption/Encryption.php | Encryption.decrypt | public function decrypt($crypttext, $key = null) {
if(null !== $key) {
$this->_key = md5($key);
}
$crypttext = base64_decode($crypttext);
$plaintext = '';
$td = mcrypt_module_open($this->_cypher, '', self::MODE, '');
$ivsize = mcrypt_enc_get_iv_size... | php | public function decrypt($crypttext, $key = null) {
if(null !== $key) {
$this->_key = md5($key);
}
$crypttext = base64_decode($crypttext);
$plaintext = '';
$td = mcrypt_module_open($this->_cypher, '', self::MODE, '');
$ivsize = mcrypt_enc_get_iv_size... | [
"public",
"function",
"decrypt",
"(",
"$",
"crypttext",
",",
"$",
"key",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"!==",
"$",
"key",
")",
"{",
"$",
"this",
"->",
"_key",
"=",
"md5",
"(",
"$",
"key",
")",
";",
"}",
"$",
"crypttext",
"=",
"base6... | Decrypt a previously encrypted text
@param string $crypttext
@param null|string $key User specified key
@return string | [
"Decrypt",
"a",
"previously",
"encrypted",
"text"
] | ec3b087d4d4732816f61ac487f0cb25511e0da88 | https://github.com/stonedz/pff2/blob/ec3b087d4d4732816f61ac487f0cb25511e0da88/src/modules/encryption/Encryption.php#L70-L86 | train |
zbox/UnifiedPush | src/Zbox/UnifiedPush/NotificationService/ServiceClientFactory.php | ServiceClientFactory.getServiceURL | public function getServiceURL($serviceName, $isFeedback = false)
{
$serviceName = NotificationServices::validateServiceName($serviceName);
$serviceType = $isFeedback ? self::FEEDBACK_SERVICE : self::PUSH_SERVICE;
$environment = $this->getEnvironment();
$serviceConfig = $this->getSer... | php | public function getServiceURL($serviceName, $isFeedback = false)
{
$serviceName = NotificationServices::validateServiceName($serviceName);
$serviceType = $isFeedback ? self::FEEDBACK_SERVICE : self::PUSH_SERVICE;
$environment = $this->getEnvironment();
$serviceConfig = $this->getSer... | [
"public",
"function",
"getServiceURL",
"(",
"$",
"serviceName",
",",
"$",
"isFeedback",
"=",
"false",
")",
"{",
"$",
"serviceName",
"=",
"NotificationServices",
"::",
"validateServiceName",
"(",
"$",
"serviceName",
")",
";",
"$",
"serviceType",
"=",
"$",
"isFe... | Gets notification service url by service name
@param string $serviceName
@param bool $isFeedback
@return array | [
"Gets",
"notification",
"service",
"url",
"by",
"service",
"name"
] | 47da2d0577b18ac709cd947c68541014001e1866 | https://github.com/zbox/UnifiedPush/blob/47da2d0577b18ac709cd947c68541014001e1866/src/Zbox/UnifiedPush/NotificationService/ServiceClientFactory.php#L148-L165 | train |
zbox/UnifiedPush | src/Zbox/UnifiedPush/NotificationService/ServiceClientFactory.php | ServiceClientFactory.createServiceClient | public function createServiceClient($serviceName, $isFeedback = false)
{
$serviceUrl = $this->getServiceURL($serviceName, $isFeedback);
$clientClass = sprintf(
'Zbox\UnifiedPush\NotificationService\%s\%s',
$serviceName,
$isFeedback ? 'ServiceFeedbackClient' : 'Se... | php | public function createServiceClient($serviceName, $isFeedback = false)
{
$serviceUrl = $this->getServiceURL($serviceName, $isFeedback);
$clientClass = sprintf(
'Zbox\UnifiedPush\NotificationService\%s\%s',
$serviceName,
$isFeedback ? 'ServiceFeedbackClient' : 'Se... | [
"public",
"function",
"createServiceClient",
"(",
"$",
"serviceName",
",",
"$",
"isFeedback",
"=",
"false",
")",
"{",
"$",
"serviceUrl",
"=",
"$",
"this",
"->",
"getServiceURL",
"(",
"$",
"serviceName",
",",
"$",
"isFeedback",
")",
";",
"$",
"clientClass",
... | Creates client server connection by service name and sender credentials
@param string $serviceName
@param bool $isFeedback
@return ServiceClientInterface | [
"Creates",
"client",
"server",
"connection",
"by",
"service",
"name",
"and",
"sender",
"credentials"
] | 47da2d0577b18ac709cd947c68541014001e1866 | https://github.com/zbox/UnifiedPush/blob/47da2d0577b18ac709cd947c68541014001e1866/src/Zbox/UnifiedPush/NotificationService/ServiceClientFactory.php#L174-L188 | train |
zbox/UnifiedPush | src/Zbox/UnifiedPush/NotificationService/ServiceClientFactory.php | ServiceClientFactory.loadServicesConfig | public function loadServicesConfig()
{
$configPath = $this->serviceConfigPath;
if (!file_exists($configPath)) {
throw new InvalidArgumentException(
sprintf(
"Service config file '%s' doesn`t exists",
$configPath
)
... | php | public function loadServicesConfig()
{
$configPath = $this->serviceConfigPath;
if (!file_exists($configPath)) {
throw new InvalidArgumentException(
sprintf(
"Service config file '%s' doesn`t exists",
$configPath
)
... | [
"public",
"function",
"loadServicesConfig",
"(",
")",
"{",
"$",
"configPath",
"=",
"$",
"this",
"->",
"serviceConfigPath",
";",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"configPath",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"sprintf",
... | Load notification services connection data
@return $this | [
"Load",
"notification",
"services",
"connection",
"data"
] | 47da2d0577b18ac709cd947c68541014001e1866 | https://github.com/zbox/UnifiedPush/blob/47da2d0577b18ac709cd947c68541014001e1866/src/Zbox/UnifiedPush/NotificationService/ServiceClientFactory.php#L195-L217 | train |
newestindustry/ginger-rest | src/Ginger/Format.php | Format.getFormatByAcceptHeader | public static function getFormatByAcceptHeader($header)
{
if(isset(self::$mimeMapper[$header])) {
return self::$mimeMapper[$header];
} else {
return self::$format;
}
} | php | public static function getFormatByAcceptHeader($header)
{
if(isset(self::$mimeMapper[$header])) {
return self::$mimeMapper[$header];
} else {
return self::$format;
}
} | [
"public",
"static",
"function",
"getFormatByAcceptHeader",
"(",
"$",
"header",
")",
"{",
"if",
"(",
"isset",
"(",
"self",
"::",
"$",
"mimeMapper",
"[",
"$",
"header",
"]",
")",
")",
"{",
"return",
"self",
"::",
"$",
"mimeMapper",
"[",
"$",
"header",
"]... | getFormatByAcceptHeader function.
@access public
@static
@param mixed $header
@return void | [
"getFormatByAcceptHeader",
"function",
"."
] | 482b77dc122a60ab0bf143a3c4a1e67168985c83 | https://github.com/newestindustry/ginger-rest/blob/482b77dc122a60ab0bf143a3c4a1e67168985c83/src/Ginger/Format.php#L89-L96 | train |
hermajan/dobine | src/Connections/Environment.php | Environment.load | public static function load(string $filename) {
if(class_exists(Dotenv::class)) {
$dotenv = new Dotenv($filename);
$dotenv->load();
}
} | php | public static function load(string $filename) {
if(class_exists(Dotenv::class)) {
$dotenv = new Dotenv($filename);
$dotenv->load();
}
} | [
"public",
"static",
"function",
"load",
"(",
"string",
"$",
"filename",
")",
"{",
"if",
"(",
"class_exists",
"(",
"Dotenv",
"::",
"class",
")",
")",
"{",
"$",
"dotenv",
"=",
"new",
"Dotenv",
"(",
"$",
"filename",
")",
";",
"$",
"dotenv",
"->",
"load"... | Loads environment variables.
@param string $filename Path to the .env file. | [
"Loads",
"environment",
"variables",
"."
] | 0f18727923cfe06abbbfcd1d39b897633586ad05 | https://github.com/hermajan/dobine/blob/0f18727923cfe06abbbfcd1d39b897633586ad05/src/Connections/Environment.php#L15-L20 | train |
hermajan/dobine | src/Connections/Environment.php | Environment.choose | public static function choose($environment = null) {
if (!isset($environment)) {
if(isset($_ENV["APP_ENV"])) {
switch($_ENV["APP_ENV"]) {
case "dev": case "development": default:
$environment = Environment::DEVELOPMENT; break;
case "stage":
$environment = Environment::STAGE; break;
c... | php | public static function choose($environment = null) {
if (!isset($environment)) {
if(isset($_ENV["APP_ENV"])) {
switch($_ENV["APP_ENV"]) {
case "dev": case "development": default:
$environment = Environment::DEVELOPMENT; break;
case "stage":
$environment = Environment::STAGE; break;
c... | [
"public",
"static",
"function",
"choose",
"(",
"$",
"environment",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"environment",
")",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"_ENV",
"[",
"\"APP_ENV\"",
"]",
")",
")",
"{",
"switch",
"(",
... | Chooses environment.
@param null|string $environment
@return string | [
"Chooses",
"environment",
"."
] | 0f18727923cfe06abbbfcd1d39b897633586ad05 | https://github.com/hermajan/dobine/blob/0f18727923cfe06abbbfcd1d39b897633586ad05/src/Connections/Environment.php#L27-L51 | train |
villermen/runescape-lookup-commons | src/ActivityFeed/ActivityFeed.php | ActivityFeed.getItemsAfter | public function getItemsAfter(ActivityFeedItem $targetItem): array
{
$newerItems = [];
foreach($this->getItems() as $item) {
if ($item->equals($targetItem)) {
break;
}
$newerItems[] = $item;
}
return $newerItems;
} | php | public function getItemsAfter(ActivityFeedItem $targetItem): array
{
$newerItems = [];
foreach($this->getItems() as $item) {
if ($item->equals($targetItem)) {
break;
}
$newerItems[] = $item;
}
return $newerItems;
} | [
"public",
"function",
"getItemsAfter",
"(",
"ActivityFeedItem",
"$",
"targetItem",
")",
":",
"array",
"{",
"$",
"newerItems",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"getItems",
"(",
")",
"as",
"$",
"item",
")",
"{",
"if",
"(",
"$",
"i... | Returns all feed items in this feed that occur after the given item.
@param ActivityFeedItem $targetItem
@return ActivityFeedItem[] | [
"Returns",
"all",
"feed",
"items",
"in",
"this",
"feed",
"that",
"occur",
"after",
"the",
"given",
"item",
"."
] | 3e24dadbdc5e20b755280e5110f4ca0a1758b04c | https://github.com/villermen/runescape-lookup-commons/blob/3e24dadbdc5e20b755280e5110f4ca0a1758b04c/src/ActivityFeed/ActivityFeed.php#L32-L45 | train |
villermen/runescape-lookup-commons | src/ActivityFeed/ActivityFeed.php | ActivityFeed.merge | public function merge(ActivityFeed $newerFeed): ActivityFeed
{
if (count($this->getItems()) > 0) {
$prepend = $newerFeed->getItemsAfter($this->getItems()[0]);
} else {
$prepend = $newerFeed->getItems();
}
return new ActivityFeed(array_merge($prepend, $this->g... | php | public function merge(ActivityFeed $newerFeed): ActivityFeed
{
if (count($this->getItems()) > 0) {
$prepend = $newerFeed->getItemsAfter($this->getItems()[0]);
} else {
$prepend = $newerFeed->getItems();
}
return new ActivityFeed(array_merge($prepend, $this->g... | [
"public",
"function",
"merge",
"(",
"ActivityFeed",
"$",
"newerFeed",
")",
":",
"ActivityFeed",
"{",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"getItems",
"(",
")",
")",
">",
"0",
")",
"{",
"$",
"prepend",
"=",
"$",
"newerFeed",
"->",
"getItemsAfter"... | Merges this ActivityFeed with a newer feed.
Returns a new feed with all new items from the newerFeed prepended to it.
@param ActivityFeed $newerFeed
@return ActivityFeed | [
"Merges",
"this",
"ActivityFeed",
"with",
"a",
"newer",
"feed",
".",
"Returns",
"a",
"new",
"feed",
"with",
"all",
"new",
"items",
"from",
"the",
"newerFeed",
"prepended",
"to",
"it",
"."
] | 3e24dadbdc5e20b755280e5110f4ca0a1758b04c | https://github.com/villermen/runescape-lookup-commons/blob/3e24dadbdc5e20b755280e5110f4ca0a1758b04c/src/ActivityFeed/ActivityFeed.php#L54-L63 | train |
apishka/easy-extend | source/Broker.php | Broker.getRouter | public function getRouter(string $router): RouterAbstract
{
if (!array_key_exists($router, $this->_routers))
$this->_routers[$router] = $this->getItem($router);
return $this->_routers[$router];
} | php | public function getRouter(string $router): RouterAbstract
{
if (!array_key_exists($router, $this->_routers))
$this->_routers[$router] = $this->getItem($router);
return $this->_routers[$router];
} | [
"public",
"function",
"getRouter",
"(",
"string",
"$",
"router",
")",
":",
"RouterAbstract",
"{",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"router",
",",
"$",
"this",
"->",
"_routers",
")",
")",
"$",
"this",
"->",
"_routers",
"[",
"$",
"router",
"... | Get router instance
@param string $router
@return RouterAbstract | [
"Get",
"router",
"instance"
] | 5e5c63c2509377abc3db6956e353623683703e09 | https://github.com/apishka/easy-extend/blob/5e5c63c2509377abc3db6956e353623683703e09/source/Broker.php#L60-L66 | train |
apishka/easy-extend | source/Broker.php | Broker.isCorrectItem | protected function isCorrectItem(\ReflectionClass $reflector): bool
{
if ($reflector->isInstance($this))
return false;
if (!$reflector->isSubclassOf(RouterAbstract::class))
return false;
return true;
} | php | protected function isCorrectItem(\ReflectionClass $reflector): bool
{
if ($reflector->isInstance($this))
return false;
if (!$reflector->isSubclassOf(RouterAbstract::class))
return false;
return true;
} | [
"protected",
"function",
"isCorrectItem",
"(",
"\\",
"ReflectionClass",
"$",
"reflector",
")",
":",
"bool",
"{",
"if",
"(",
"$",
"reflector",
"->",
"isInstance",
"(",
"$",
"this",
")",
")",
"return",
"false",
";",
"if",
"(",
"!",
"$",
"reflector",
"->",
... | Is correct item
@param \ReflectionClass $reflector
@return bool | [
"Is",
"correct",
"item"
] | 5e5c63c2509377abc3db6956e353623683703e09 | https://github.com/apishka/easy-extend/blob/5e5c63c2509377abc3db6956e353623683703e09/source/Broker.php#L97-L106 | train |
tasoftch/php-service-manager | src/ServiceManager.php | ServiceManager.generalServiceManager | public static function generalServiceManager(Iterable $serviceConfig = NULL, $selfRefNames= []) {
if(!static::$serviceManager) {
if(is_null($serviceConfig))
throw new ServiceException(sprintf("First call of %s must pass a service configuration", __METHOD__), 13);
/** @va... | php | public static function generalServiceManager(Iterable $serviceConfig = NULL, $selfRefNames= []) {
if(!static::$serviceManager) {
if(is_null($serviceConfig))
throw new ServiceException(sprintf("First call of %s must pass a service configuration", __METHOD__), 13);
/** @va... | [
"public",
"static",
"function",
"generalServiceManager",
"(",
"Iterable",
"$",
"serviceConfig",
"=",
"NULL",
",",
"$",
"selfRefNames",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"static",
"::",
"$",
"serviceManager",
")",
"{",
"if",
"(",
"is_null",
"(",
"$... | Returns the service manager. The first call of this method should pass a service config info.
@param iterable|NULL $serviceConfig
@return ServiceManager | [
"Returns",
"the",
"service",
"manager",
".",
"The",
"first",
"call",
"of",
"this",
"method",
"should",
"pass",
"a",
"service",
"config",
"info",
"."
] | 5f627d81457356f6c087398cd1e8f8e4f9d14822 | https://github.com/tasoftch/php-service-manager/blob/5f627d81457356f6c087398cd1e8f8e4f9d14822/src/ServiceManager.php#L72-L85 | train |
tasoftch/php-service-manager | src/ServiceManager.php | ServiceManager.get | public function get($serviceName) {
$container = $this->serviceData[$serviceName] ?? NULL;
if($container) {
return $container->getInstance();
}
if(in_array($serviceName, $this->getSelfReferenceNames()))
return $this;
$e = new UnknownServiceException("Ser... | php | public function get($serviceName) {
$container = $this->serviceData[$serviceName] ?? NULL;
if($container) {
return $container->getInstance();
}
if(in_array($serviceName, $this->getSelfReferenceNames()))
return $this;
$e = new UnknownServiceException("Ser... | [
"public",
"function",
"get",
"(",
"$",
"serviceName",
")",
"{",
"$",
"container",
"=",
"$",
"this",
"->",
"serviceData",
"[",
"$",
"serviceName",
"]",
"??",
"NULL",
";",
"if",
"(",
"$",
"container",
")",
"{",
"return",
"$",
"container",
"->",
"getInsta... | Returns the instance of a requested service
This method call fails if the service does not exist or something else went wrong during creating the service instance.
@param string $serviceName
@return object|null
@throws UnknownServiceException | [
"Returns",
"the",
"instance",
"of",
"a",
"requested",
"service",
"This",
"method",
"call",
"fails",
"if",
"the",
"service",
"does",
"not",
"exist",
"or",
"something",
"else",
"went",
"wrong",
"during",
"creating",
"the",
"service",
"instance",
"."
] | 5f627d81457356f6c087398cd1e8f8e4f9d14822 | https://github.com/tasoftch/php-service-manager/blob/5f627d81457356f6c087398cd1e8f8e4f9d14822/src/ServiceManager.php#L187-L199 | train |
tasoftch/php-service-manager | src/ServiceManager.php | ServiceManager.set | public function set(string $serviceName, $object) {
if(isset($this->serviceData[$serviceName]) || in_array($serviceName, $this->getSelfReferenceNames())) {
if($this->replaceExistingServices()) {
trigger_error("Service $serviceName is already registered", E_USER_NOTICE);
}... | php | public function set(string $serviceName, $object) {
if(isset($this->serviceData[$serviceName]) || in_array($serviceName, $this->getSelfReferenceNames())) {
if($this->replaceExistingServices()) {
trigger_error("Service $serviceName is already registered", E_USER_NOTICE);
}... | [
"public",
"function",
"set",
"(",
"string",
"$",
"serviceName",
",",
"$",
"object",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"serviceData",
"[",
"$",
"serviceName",
"]",
")",
"||",
"in_array",
"(",
"$",
"serviceName",
",",
"$",
"this",
"... | Sets a service
Accepted are:
- Objects that implement ContainerInterface, their getInstance method call will be the service instance
- A callback (note! Objects implementing __invoke are also callbacks!) to obtain the service instance
- An array to load configured service
- Any other object directly as service
If rep... | [
"Sets",
"a",
"service"
] | 5f627d81457356f6c087398cd1e8f8e4f9d14822 | https://github.com/tasoftch/php-service-manager/blob/5f627d81457356f6c087398cd1e8f8e4f9d14822/src/ServiceManager.php#L231-L254 | train |
tasoftch/php-service-manager | src/ServiceManager.php | ServiceManager.serviceExists | public function serviceExists(string $serviceName): bool {
return isset($this->serviceData[$serviceName]) || in_array($serviceName, $this->getSelfReferenceNames()) ? true : false;
} | php | public function serviceExists(string $serviceName): bool {
return isset($this->serviceData[$serviceName]) || in_array($serviceName, $this->getSelfReferenceNames()) ? true : false;
} | [
"public",
"function",
"serviceExists",
"(",
"string",
"$",
"serviceName",
")",
":",
"bool",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"serviceData",
"[",
"$",
"serviceName",
"]",
")",
"||",
"in_array",
"(",
"$",
"serviceName",
",",
"$",
"this",
"->... | Looks, if a service with the given name is available
@param string $serviceName
@return bool | [
"Looks",
"if",
"a",
"service",
"with",
"the",
"given",
"name",
"is",
"available"
] | 5f627d81457356f6c087398cd1e8f8e4f9d14822 | https://github.com/tasoftch/php-service-manager/blob/5f627d81457356f6c087398cd1e8f8e4f9d14822/src/ServiceManager.php#L261-L263 | train |
tasoftch/php-service-manager | src/ServiceManager.php | ServiceManager.isServiceLoaded | public function isServiceLoaded(string $serviceName): bool {
if($this->serviceExists($serviceName)) {
if(in_array($serviceName, $this->getSelfReferenceNames()))
return true;
/** @var ContainerInterface $container */
$container = $this->serviceData[$serviceNam... | php | public function isServiceLoaded(string $serviceName): bool {
if($this->serviceExists($serviceName)) {
if(in_array($serviceName, $this->getSelfReferenceNames()))
return true;
/** @var ContainerInterface $container */
$container = $this->serviceData[$serviceNam... | [
"public",
"function",
"isServiceLoaded",
"(",
"string",
"$",
"serviceName",
")",
":",
"bool",
"{",
"if",
"(",
"$",
"this",
"->",
"serviceExists",
"(",
"$",
"serviceName",
")",
")",
"{",
"if",
"(",
"in_array",
"(",
"$",
"serviceName",
",",
"$",
"this",
... | Looks, if a service with the given name is available and already is loaded.
@param string $serviceName
@return bool
@see ServiceManager::serviceExists() | [
"Looks",
"if",
"a",
"service",
"with",
"the",
"given",
"name",
"is",
"available",
"and",
"already",
"is",
"loaded",
"."
] | 5f627d81457356f6c087398cd1e8f8e4f9d14822 | https://github.com/tasoftch/php-service-manager/blob/5f627d81457356f6c087398cd1e8f8e4f9d14822/src/ServiceManager.php#L271-L281 | train |
tasoftch/php-service-manager | src/ServiceManager.php | ServiceManager._getMapValueHandler | private function _getMapValueHandler() {
return function($key, $value) {
foreach($this->customArgumentHandler as $name => $callable) {
if(is_callable($callable)) {
$value = $callable($key, $value);
} else
trigger_error("Custom a... | php | private function _getMapValueHandler() {
return function($key, $value) {
foreach($this->customArgumentHandler as $name => $callable) {
if(is_callable($callable)) {
$value = $callable($key, $value);
} else
trigger_error("Custom a... | [
"private",
"function",
"_getMapValueHandler",
"(",
")",
"{",
"return",
"function",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"customArgumentHandler",
"as",
"$",
"name",
"=>",
"$",
"callable",
")",
"{",
"if",
"(",
... | Creates the replacement handler for parameters and service instances
@return \Closure | [
"Creates",
"the",
"replacement",
"handler",
"for",
"parameters",
"and",
"service",
"instances"
] | 5f627d81457356f6c087398cd1e8f8e4f9d14822 | https://github.com/tasoftch/php-service-manager/blob/5f627d81457356f6c087398cd1e8f8e4f9d14822/src/ServiceManager.php#L403-L413 | train |
tasoftch/php-service-manager | src/ServiceManager.php | ServiceManager.makeServiceInstance | public function makeServiceInstance(string $className, $arguments = NULL, $configuration = NULL) {
$instance = NULL;
$implInterfaces = class_implements($className);
if(in_array(ConstructorAwareServiceInterface::class, $implInterfaces)) {
/** @var ConstructorAwareServiceInterface $cl... | php | public function makeServiceInstance(string $className, $arguments = NULL, $configuration = NULL) {
$instance = NULL;
$implInterfaces = class_implements($className);
if(in_array(ConstructorAwareServiceInterface::class, $implInterfaces)) {
/** @var ConstructorAwareServiceInterface $cl... | [
"public",
"function",
"makeServiceInstance",
"(",
"string",
"$",
"className",
",",
"$",
"arguments",
"=",
"NULL",
",",
"$",
"configuration",
"=",
"NULL",
")",
"{",
"$",
"instance",
"=",
"NULL",
";",
"$",
"implInterfaces",
"=",
"class_implements",
"(",
"$",
... | This method should be used to create service instances. It will check implementations and create it the requested manner.
@param string $className
@param array|iterable|null $arguments
@param array|iterable|null $configuration
@return object|null | [
"This",
"method",
"should",
"be",
"used",
"to",
"create",
"service",
"instances",
".",
"It",
"will",
"check",
"implementations",
"and",
"create",
"it",
"the",
"requested",
"manner",
"."
] | 5f627d81457356f6c087398cd1e8f8e4f9d14822 | https://github.com/tasoftch/php-service-manager/blob/5f627d81457356f6c087398cd1e8f8e4f9d14822/src/ServiceManager.php#L423-L462 | train |
tasoftch/php-service-manager | src/ServiceManager.php | ServiceManager.getServiceClass | public function getServiceClass(string $serviceName, bool $forced = true): ?string {
if(!isset($this->serviceClassNames[$serviceName])) {
if($this->serviceExists($serviceName)) {
/** @var ContainerInterface $container */
$container = $this->serviceData[$serviceName];
... | php | public function getServiceClass(string $serviceName, bool $forced = true): ?string {
if(!isset($this->serviceClassNames[$serviceName])) {
if($this->serviceExists($serviceName)) {
/** @var ContainerInterface $container */
$container = $this->serviceData[$serviceName];
... | [
"public",
"function",
"getServiceClass",
"(",
"string",
"$",
"serviceName",
",",
"bool",
"$",
"forced",
"=",
"true",
")",
":",
"?",
"string",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"serviceClassNames",
"[",
"$",
"serviceName",
"]",
")",
... | Gets the class of a service instance
@param string $serviceName
@param bool $forced // If set, it will until load the service to get its class name
@return string|null | [
"Gets",
"the",
"class",
"of",
"a",
"service",
"instance"
] | 5f627d81457356f6c087398cd1e8f8e4f9d14822 | https://github.com/tasoftch/php-service-manager/blob/5f627d81457356f6c087398cd1e8f8e4f9d14822/src/ServiceManager.php#L487-L526 | train |
tasoftch/php-service-manager | src/ServiceManager.php | ServiceManager.yieldServices | public function yieldServices(array $serviceNames, array $classNames, bool $includeSubclasses = true, bool $forceClassDetection = true) {
$matchClass = function($className) use ($includeSubclasses, $classNames) {
if(in_array($className, $classNames))
return true;
if($inc... | php | public function yieldServices(array $serviceNames, array $classNames, bool $includeSubclasses = true, bool $forceClassDetection = true) {
$matchClass = function($className) use ($includeSubclasses, $classNames) {
if(in_array($className, $classNames))
return true;
if($inc... | [
"public",
"function",
"yieldServices",
"(",
"array",
"$",
"serviceNames",
",",
"array",
"$",
"classNames",
",",
"bool",
"$",
"includeSubclasses",
"=",
"true",
",",
"bool",
"$",
"forceClassDetection",
"=",
"true",
")",
"{",
"$",
"matchClass",
"=",
"function",
... | Yields all services that match required service names or required class names.
@param array $serviceNames
@param array $classNames
@param bool $includeSubclasses
@param bool $forceClassDetection
@return \Generator | [
"Yields",
"all",
"services",
"that",
"match",
"required",
"service",
"names",
"or",
"required",
"class",
"names",
"."
] | 5f627d81457356f6c087398cd1e8f8e4f9d14822 | https://github.com/tasoftch/php-service-manager/blob/5f627d81457356f6c087398cd1e8f8e4f9d14822/src/ServiceManager.php#L538-L561 | train |
UnionOfRAD/li3_quality | extensions/command/Syntax.php | Syntax._subjects | protected function _subjects($path) {
if (is_file($path)) {
$current = new SplFileInfo($path);
return $current->getExtension() === 'php' ? array($current) : array();
}
$files = new RecursiveCallbackFilterIterator(
new RecursiveDirectoryIterator($path),
function($current, $key, $iterator) {
$noDesc... | php | protected function _subjects($path) {
if (is_file($path)) {
$current = new SplFileInfo($path);
return $current->getExtension() === 'php' ? array($current) : array();
}
$files = new RecursiveCallbackFilterIterator(
new RecursiveDirectoryIterator($path),
function($current, $key, $iterator) {
$noDesc... | [
"protected",
"function",
"_subjects",
"(",
"$",
"path",
")",
"{",
"if",
"(",
"is_file",
"(",
"$",
"path",
")",
")",
"{",
"$",
"current",
"=",
"new",
"SplFileInfo",
"(",
"$",
"path",
")",
";",
"return",
"$",
"current",
"->",
"getExtension",
"(",
")",
... | Retrieves subjects. Will return only PHP files.
@param string $path
@return array Returns an array of SplFieldInfo objects. | [
"Retrieves",
"subjects",
".",
"Will",
"return",
"only",
"PHP",
"files",
"."
] | acb72a43ae835e6d200bc0eba1a61aee610e36bf | https://github.com/UnionOfRAD/li3_quality/blob/acb72a43ae835e6d200bc0eba1a61aee610e36bf/extensions/command/Syntax.php#L150-L176 | train |
UnionOfRAD/li3_quality | extensions/command/Syntax.php | Syntax._rules | protected function _rules() {
$rules = new Rules();
$files = array(
$this->config,
Libraries::get('li3_quality', 'path') . '/config/syntax.json'
);
foreach ($files as $file) {
if (file_exists($file)) {
$this->out("Loading configuration file `{$file}`...");
$config = json_decode(file_get_conten... | php | protected function _rules() {
$rules = new Rules();
$files = array(
$this->config,
Libraries::get('li3_quality', 'path') . '/config/syntax.json'
);
foreach ($files as $file) {
if (file_exists($file)) {
$this->out("Loading configuration file `{$file}`...");
$config = json_decode(file_get_conten... | [
"protected",
"function",
"_rules",
"(",
")",
"{",
"$",
"rules",
"=",
"new",
"Rules",
"(",
")",
";",
"$",
"files",
"=",
"array",
"(",
"$",
"this",
"->",
"config",
",",
"Libraries",
"::",
"get",
"(",
"'li3_quality'",
",",
"'path'",
")",
".",
"'/config/... | Loads rules configuration.
@return object | [
"Loads",
"rules",
"configuration",
"."
] | acb72a43ae835e6d200bc0eba1a61aee610e36bf | https://github.com/UnionOfRAD/li3_quality/blob/acb72a43ae835e6d200bc0eba1a61aee610e36bf/extensions/command/Syntax.php#L183-L210 | train |
sulu/SuluSalesOrderBundle | Order/OrderDependencyManager.php | OrderDependencyManager.getWorkflows | public function getWorkflows($order)
{
$workflows = array();
$actions = array(
'confirm' => array(
'section' => $this->getName(),
'title' => 'salesorder.orders.confirm',
'event' => 'sulu.salesorder.order.confirm.clicked'
),
... | php | public function getWorkflows($order)
{
$workflows = array();
$actions = array(
'confirm' => array(
'section' => $this->getName(),
'title' => 'salesorder.orders.confirm',
'event' => 'sulu.salesorder.order.confirm.clicked'
),
... | [
"public",
"function",
"getWorkflows",
"(",
"$",
"order",
")",
"{",
"$",
"workflows",
"=",
"array",
"(",
")",
";",
"$",
"actions",
"=",
"array",
"(",
"'confirm'",
"=>",
"array",
"(",
"'section'",
"=>",
"$",
"this",
"->",
"getName",
"(",
")",
",",
"'ti... | returns all possible workflows for the current entity
@param Order $order
@return array | [
"returns",
"all",
"possible",
"workflows",
"for",
"the",
"current",
"entity"
] | 1de6d43e8e6d0cc1e703b687085445f50f97ecdc | https://github.com/sulu/SuluSalesOrderBundle/blob/1de6d43e8e6d0cc1e703b687085445f50f97ecdc/Order/OrderDependencyManager.php#L95-L139 | train |
ben-gibson/foursquare-venue-client | src/Factory/Venue/DetailFactory.php | DetailFactory.getCreatedAt | private function getCreatedAt(Description $description)
{
$createdAt = $description->getOptionalProperty('createdAt');
return ($createdAt !== null) ? (new \DateTimeImmutable())->setTimestamp($createdAt) : null;
} | php | private function getCreatedAt(Description $description)
{
$createdAt = $description->getOptionalProperty('createdAt');
return ($createdAt !== null) ? (new \DateTimeImmutable())->setTimestamp($createdAt) : null;
} | [
"private",
"function",
"getCreatedAt",
"(",
"Description",
"$",
"description",
")",
"{",
"$",
"createdAt",
"=",
"$",
"description",
"->",
"getOptionalProperty",
"(",
"'createdAt'",
")",
";",
"return",
"(",
"$",
"createdAt",
"!==",
"null",
")",
"?",
"(",
"new... | Get created at.
@param Description $description The venue details description.
@return \DateTimeImmutable|null | [
"Get",
"created",
"at",
"."
] | ce5e7c308f87d5ccc28ab8d27a9cb51bd106d969 | https://github.com/ben-gibson/foursquare-venue-client/blob/ce5e7c308f87d5ccc28ab8d27a9cb51bd106d969/src/Factory/Venue/DetailFactory.php#L60-L65 | train |
ben-gibson/foursquare-venue-client | src/Factory/Venue/DetailFactory.php | DetailFactory.getBestPhoto | private function getBestPhoto(Description $description)
{
$bestPhotoDescription = $description->getOptionalProperty('bestPhoto');
if ($bestPhotoDescription instanceof Description) {
return $this->photoFactory->create($bestPhotoDescription);
}
return null;
} | php | private function getBestPhoto(Description $description)
{
$bestPhotoDescription = $description->getOptionalProperty('bestPhoto');
if ($bestPhotoDescription instanceof Description) {
return $this->photoFactory->create($bestPhotoDescription);
}
return null;
} | [
"private",
"function",
"getBestPhoto",
"(",
"Description",
"$",
"description",
")",
"{",
"$",
"bestPhotoDescription",
"=",
"$",
"description",
"->",
"getOptionalProperty",
"(",
"'bestPhoto'",
")",
";",
"if",
"(",
"$",
"bestPhotoDescription",
"instanceof",
"Descripti... | Get best photo.
@param Description $description The venue details description.
@return Photo|null | [
"Get",
"best",
"photo",
"."
] | ce5e7c308f87d5ccc28ab8d27a9cb51bd106d969 | https://github.com/ben-gibson/foursquare-venue-client/blob/ce5e7c308f87d5ccc28ab8d27a9cb51bd106d969/src/Factory/Venue/DetailFactory.php#L74-L83 | train |
Clevis/Se34 | Se34/ElementComponent.php | ElementComponent.getRoot | private function getRoot()
{
if ($this->root === NULL)
{
$selector = reset($this->parameters);
$strategy = key($this->parameters);
if ($selector instanceof Element)
{
$this->root = $selector;
}
else
{
$this->root = $this->parent->findElement($strategy, $selector);
}
$expectedTagN... | php | private function getRoot()
{
if ($this->root === NULL)
{
$selector = reset($this->parameters);
$strategy = key($this->parameters);
if ($selector instanceof Element)
{
$this->root = $selector;
}
else
{
$this->root = $this->parent->findElement($strategy, $selector);
}
$expectedTagN... | [
"private",
"function",
"getRoot",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"root",
"===",
"NULL",
")",
"{",
"$",
"selector",
"=",
"reset",
"(",
"$",
"this",
"->",
"parameters",
")",
";",
"$",
"strategy",
"=",
"key",
"(",
"$",
"this",
"->",
"p... | Get root element of this component.
@return Element | [
"Get",
"root",
"element",
"of",
"this",
"component",
"."
] | c52d579a831ba5642dae464882da012b0409ae46 | https://github.com/Clevis/Se34/blob/c52d579a831ba5642dae464882da012b0409ae46/Se34/ElementComponent.php#L15-L52 | train |
ScreamingDev/phpsemver | lib/PHPSemVer/Config/RuleSet/Trigger.php | Trigger.getInstances | public function getInstances()
{
if (null === $this->instances) {
$this->instances = [];
foreach ($this->getAll() as $className) {
$className = '\\PHPSemVer\\Trigger\\' . str_replace('/', '\\', $className);
$this->instances[] = new $className();
... | php | public function getInstances()
{
if (null === $this->instances) {
$this->instances = [];
foreach ($this->getAll() as $className) {
$className = '\\PHPSemVer\\Trigger\\' . str_replace('/', '\\', $className);
$this->instances[] = new $className();
... | [
"public",
"function",
"getInstances",
"(",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"instances",
")",
"{",
"$",
"this",
"->",
"instances",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"getAll",
"(",
")",
"as",
"$",
"classNam... | Get all trigger instances from the config.
@return AbstractTrigger[] | [
"Get",
"all",
"trigger",
"instances",
"from",
"the",
"config",
"."
] | 11a4bc508f71dee73d4f5fee2e9d39e7984d3e15 | https://github.com/ScreamingDev/phpsemver/blob/11a4bc508f71dee73d4f5fee2e9d39e7984d3e15/lib/PHPSemVer/Config/RuleSet/Trigger.php#L44-L57 | train |
DBRisinajumi/d2company | controllers/CcmpCompanyController.php | CcmpCompanyController.actionResetPersonPassword | public function actionResetPersonPassword($ccmp_id,$person_id)
{
//only for validation acces
$model = $this->loadModel($ccmp_id);
yii::import('vendor.dbrisinajumi.person.PersonModule');
//if do not have user, create
$m = Person::model();
$m->resetPassword($pe... | php | public function actionResetPersonPassword($ccmp_id,$person_id)
{
//only for validation acces
$model = $this->loadModel($ccmp_id);
yii::import('vendor.dbrisinajumi.person.PersonModule');
//if do not have user, create
$m = Person::model();
$m->resetPassword($pe... | [
"public",
"function",
"actionResetPersonPassword",
"(",
"$",
"ccmp_id",
",",
"$",
"person_id",
")",
"{",
"//only for validation acces",
"$",
"model",
"=",
"$",
"this",
"->",
"loadModel",
"(",
"$",
"ccmp_id",
")",
";",
"yii",
"::",
"import",
"(",
"'vendor.dbris... | send to user new password
@return type | [
"send",
"to",
"user",
"new",
"password"
] | 20df0db96ac2c8e73471c4bab7d487b67ef4ed0a | https://github.com/DBRisinajumi/d2company/blob/20df0db96ac2c8e73471c4bab7d487b67ef4ed0a/controllers/CcmpCompanyController.php#L759-L771 | train |
garyr/memento | lib/Memento/Client.php | Client.getKeys | private function getKeys($argv)
{
$groupKey = null;
$key = null;
if (isset($argv[0])) {
if ($argv[0] instanceof Group\Key) {
$groupKey = $argv[0];
if (isset($argv[1])) {
if ($argv[1] instanceof Key) {
$... | php | private function getKeys($argv)
{
$groupKey = null;
$key = null;
if (isset($argv[0])) {
if ($argv[0] instanceof Group\Key) {
$groupKey = $argv[0];
if (isset($argv[1])) {
if ($argv[1] instanceof Key) {
$... | [
"private",
"function",
"getKeys",
"(",
"$",
"argv",
")",
"{",
"$",
"groupKey",
"=",
"null",
";",
"$",
"key",
"=",
"null",
";",
"if",
"(",
"isset",
"(",
"$",
"argv",
"[",
"0",
"]",
")",
")",
"{",
"if",
"(",
"$",
"argv",
"[",
"0",
"]",
"instanc... | Returns an array to serve as a callable param
for call_user_func_array
@param array $argv Function argument array
@param string $source Method name from which the call was made
@return arrray Returns the method target callable array | [
"Returns",
"an",
"array",
"to",
"serve",
"as",
"a",
"callable",
"param",
"for",
"call_user_func_array"
] | d6cfa9ffec040f96b8361f822f11dcf6d5ff60b4 | https://github.com/garyr/memento/blob/d6cfa9ffec040f96b8361f822f11dcf6d5ff60b4/lib/Memento/Client.php#L32-L56 | train |
Laralum/Routes | src/RoutesServiceProvider.php | RoutesServiceProvider.registerPolicies | public function registerPolicies()
{
foreach ($this->policies as $key => $value) {
Gate::policy($key, $value);
}
} | php | public function registerPolicies()
{
foreach ($this->policies as $key => $value) {
Gate::policy($key, $value);
}
} | [
"public",
"function",
"registerPolicies",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"policies",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"Gate",
"::",
"policy",
"(",
"$",
"key",
",",
"$",
"value",
")",
";",
"}",
"}"
] | I cheated this comes from the AuthServiceProvider extended by the App\Providers\AuthServiceProvider.
Register the application's policies.
@return void | [
"I",
"cheated",
"this",
"comes",
"from",
"the",
"AuthServiceProvider",
"extended",
"by",
"the",
"App",
"\\",
"Providers",
"\\",
"AuthServiceProvider",
"."
] | 10db617db456839c5753294d268198aa65f0a3f0 | https://github.com/Laralum/Routes/blob/10db617db456839c5753294d268198aa65f0a3f0/src/RoutesServiceProvider.php#L62-L67 | train |
ntentan/atiaa | src/Descriptor.php | Descriptor.describe | public function describe()
{
$defaultSchema = $this->driver->getDefaultSchema();
$description = [
'schemata' => [],
];
$schemata = $this->getSchemata();
foreach ($schemata as $schema) {
if ($schema['name'] == $defaultSchema) {
$descri... | php | public function describe()
{
$defaultSchema = $this->driver->getDefaultSchema();
$description = [
'schemata' => [],
];
$schemata = $this->getSchemata();
foreach ($schemata as $schema) {
if ($schema['name'] == $defaultSchema) {
$descri... | [
"public",
"function",
"describe",
"(",
")",
"{",
"$",
"defaultSchema",
"=",
"$",
"this",
"->",
"driver",
"->",
"getDefaultSchema",
"(",
")",
";",
"$",
"description",
"=",
"[",
"'schemata'",
"=>",
"[",
"]",
",",
"]",
";",
"$",
"schemata",
"=",
"$",
"t... | Returns the description of the database as an array.
@return array | [
"Returns",
"the",
"description",
"of",
"the",
"database",
"as",
"an",
"array",
"."
] | 2604fea83e9643adaa8d1fb65443fb214cfa60e6 | https://github.com/ntentan/atiaa/blob/2604fea83e9643adaa8d1fb65443fb214cfa60e6/src/Descriptor.php#L235-L256 | train |
ntentan/atiaa | src/Descriptor.php | Descriptor.throwTableExceptions | private function throwTableExceptions($tables, $requestedTables)
{
$foundTables = [];
foreach ($tables as $table) {
$foundTables[] = $table['name'];
}
foreach ($requestedTables as $requestedTable) {
if (array_search($requestedTable, $foundTables) === false) {... | php | private function throwTableExceptions($tables, $requestedTables)
{
$foundTables = [];
foreach ($tables as $table) {
$foundTables[] = $table['name'];
}
foreach ($requestedTables as $requestedTable) {
if (array_search($requestedTable, $foundTables) === false) {... | [
"private",
"function",
"throwTableExceptions",
"(",
"$",
"tables",
",",
"$",
"requestedTables",
")",
"{",
"$",
"foundTables",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"tables",
"as",
"$",
"table",
")",
"{",
"$",
"foundTables",
"[",
"]",
"=",
"$",
"tabl... | Throws exceptions for which are found in the list of requested tables
but not found in the list of found tables.
@param array $tables
@param array $requestedTables
@throws exceptions\TableNotFoundException | [
"Throws",
"exceptions",
"for",
"which",
"are",
"found",
"in",
"the",
"list",
"of",
"requested",
"tables",
"but",
"not",
"found",
"in",
"the",
"list",
"of",
"found",
"tables",
"."
] | 2604fea83e9643adaa8d1fb65443fb214cfa60e6 | https://github.com/ntentan/atiaa/blob/2604fea83e9643adaa8d1fb65443fb214cfa60e6/src/Descriptor.php#L272-L287 | train |
rnijveld/pgt | lib/Pgettext/Po.php | Po.toFile | public static function toFile(Stringset $set, $filename)
{
try {
$str = self::toString($set, $options);
if (!file_exists($filename) || is_writable($filename)) {
file_put_contents($filename, $str);
} else {
throw new Exception("Cannot write ... | php | public static function toFile(Stringset $set, $filename)
{
try {
$str = self::toString($set, $options);
if (!file_exists($filename) || is_writable($filename)) {
file_put_contents($filename, $str);
} else {
throw new Exception("Cannot write ... | [
"public",
"static",
"function",
"toFile",
"(",
"Stringset",
"$",
"set",
",",
"$",
"filename",
")",
"{",
"try",
"{",
"$",
"str",
"=",
"self",
"::",
"toString",
"(",
"$",
"set",
",",
"$",
"options",
")",
";",
"if",
"(",
"!",
"file_exists",
"(",
"$",
... | Takes a Stringset and a filename and writes a po formatted file.
@param Stringset $set
@param string $filename
@return void | [
"Takes",
"a",
"Stringset",
"and",
"a",
"filename",
"and",
"writes",
"a",
"po",
"formatted",
"file",
"."
] | 9d64b4858438a9833065265c2e6d2db94b7e6fcd | https://github.com/rnijveld/pgt/blob/9d64b4858438a9833065265c2e6d2db94b7e6fcd/lib/Pgettext/Po.php#L34-L46 | train |
rnijveld/pgt | lib/Pgettext/Po.php | Po.toString | public static function toString(Stringset $set)
{
$str = '';
for ($i = 0; $i < $set->size(); $i += 1) {
$item = $set->item($i);
if (count($item['flags']) > 0) {
$str .= "#, " . implode(", ", $item['flags']) . "\n";
}
if ($item['context... | php | public static function toString(Stringset $set)
{
$str = '';
for ($i = 0; $i < $set->size(); $i += 1) {
$item = $set->item($i);
if (count($item['flags']) > 0) {
$str .= "#, " . implode(", ", $item['flags']) . "\n";
}
if ($item['context... | [
"public",
"static",
"function",
"toString",
"(",
"Stringset",
"$",
"set",
")",
"{",
"$",
"str",
"=",
"''",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
"<",
"$",
"set",
"->",
"size",
"(",
")",
";",
"$",
"i",
"+=",
"1",
")",
"{",
"$",... | Takes a Stringset and an array of options and creates a po formatted string.
@param Stringset $set
@return string | [
"Takes",
"a",
"Stringset",
"and",
"an",
"array",
"of",
"options",
"and",
"creates",
"a",
"po",
"formatted",
"string",
"."
] | 9d64b4858438a9833065265c2e6d2db94b7e6fcd | https://github.com/rnijveld/pgt/blob/9d64b4858438a9833065265c2e6d2db94b7e6fcd/lib/Pgettext/Po.php#L53-L82 | train |
rnijveld/pgt | lib/Pgettext/Po.php | Po.escapeString | private static function escapeString($str)
{
if (strlen($str) === 0) {
return $str;
}
$str = str_replace(array(
"\r",
"\t",
"\\",
"\$",
"\v",
"\e",
"\f",
"\""
), array(
... | php | private static function escapeString($str)
{
if (strlen($str) === 0) {
return $str;
}
$str = str_replace(array(
"\r",
"\t",
"\\",
"\$",
"\v",
"\e",
"\f",
"\""
), array(
... | [
"private",
"static",
"function",
"escapeString",
"(",
"$",
"str",
")",
"{",
"if",
"(",
"strlen",
"(",
"$",
"str",
")",
"===",
"0",
")",
"{",
"return",
"$",
"str",
";",
"}",
"$",
"str",
"=",
"str_replace",
"(",
"array",
"(",
"\"\\r\"",
",",
"\"\\t\"... | Adds escapes to characters that are in some way special.
@param string $str
@return string | [
"Adds",
"escapes",
"to",
"characters",
"that",
"are",
"in",
"some",
"way",
"special",
"."
] | 9d64b4858438a9833065265c2e6d2db94b7e6fcd | https://github.com/rnijveld/pgt/blob/9d64b4858438a9833065265c2e6d2db94b7e6fcd/lib/Pgettext/Po.php#L89-L130 | train |
rnijveld/pgt | lib/Pgettext/Po.php | Po.fromString | public static function fromString($str)
{
$stringset = new Stringset();
$entry = array();
$state = null;
$line = 1;
foreach (explode("\n", $str) as $line) {
$line = trim($line);
if (strlen($line) === 0) {
if (count($entry) > 0) {
... | php | public static function fromString($str)
{
$stringset = new Stringset();
$entry = array();
$state = null;
$line = 1;
foreach (explode("\n", $str) as $line) {
$line = trim($line);
if (strlen($line) === 0) {
if (count($entry) > 0) {
... | [
"public",
"static",
"function",
"fromString",
"(",
"$",
"str",
")",
"{",
"$",
"stringset",
"=",
"new",
"Stringset",
"(",
")",
";",
"$",
"entry",
"=",
"array",
"(",
")",
";",
"$",
"state",
"=",
"null",
";",
"$",
"line",
"=",
"1",
";",
"foreach",
"... | Takes a string in the format of a po file and returns a Stringset
@param string $str
@return Stringset | [
"Takes",
"a",
"string",
"in",
"the",
"format",
"of",
"a",
"po",
"file",
"and",
"returns",
"a",
"Stringset"
] | 9d64b4858438a9833065265c2e6d2db94b7e6fcd | https://github.com/rnijveld/pgt/blob/9d64b4858438a9833065265c2e6d2db94b7e6fcd/lib/Pgettext/Po.php#L137-L185 | train |
rnijveld/pgt | lib/Pgettext/Po.php | Po.parseString | private static function parseString($str)
{
if ($str[0] !== '"' || $str[strlen($str) - 1] !== '"') {
throw new Exception("Invalid string delimiters");
}
$result = '';
$start = str_split(substr($str, 1, -1), 1);
$escaped = false;
$data = null;
for... | php | private static function parseString($str)
{
if ($str[0] !== '"' || $str[strlen($str) - 1] !== '"') {
throw new Exception("Invalid string delimiters");
}
$result = '';
$start = str_split(substr($str, 1, -1), 1);
$escaped = false;
$data = null;
for... | [
"private",
"static",
"function",
"parseString",
"(",
"$",
"str",
")",
"{",
"if",
"(",
"$",
"str",
"[",
"0",
"]",
"!==",
"'\"'",
"||",
"$",
"str",
"[",
"strlen",
"(",
"$",
"str",
")",
"-",
"1",
"]",
"!==",
"'\"'",
")",
"{",
"throw",
"new",
"Exce... | PHP String parsing without using eval.
@param string $str Unparsed double-quoted string with escape sequences.
@return string | [
"PHP",
"String",
"parsing",
"without",
"using",
"eval",
"."
] | 9d64b4858438a9833065265c2e6d2db94b7e6fcd | https://github.com/rnijveld/pgt/blob/9d64b4858438a9833065265c2e6d2db94b7e6fcd/lib/Pgettext/Po.php#L192-L266 | train |
newestindustry/ginger-rest | src/Ginger/Request.php | Request.go | public function go() {
if ($this->action == "options") {
$file = "options" . $this->getExtension();
} else {
// Check if handler file exists
if ($this->route->route == "/") {
$file = $this->getAction() . $this->getExtension();
} else {
$file = $this->route->resource . "/" . $this->getAction() . ... | php | public function go() {
if ($this->action == "options") {
$file = "options" . $this->getExtension();
} else {
// Check if handler file exists
if ($this->route->route == "/") {
$file = $this->getAction() . $this->getExtension();
} else {
$file = $this->route->resource . "/" . $this->getAction() . ... | [
"public",
"function",
"go",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"action",
"==",
"\"options\"",
")",
"{",
"$",
"file",
"=",
"\"options\"",
".",
"$",
"this",
"->",
"getExtension",
"(",
")",
";",
"}",
"else",
"{",
"// Check if handler file exists",... | Load file and dispatch to response | [
"Load",
"file",
"and",
"dispatch",
"to",
"response"
] | 482b77dc122a60ab0bf143a3c4a1e67168985c83 | https://github.com/newestindustry/ginger-rest/blob/482b77dc122a60ab0bf143a3c4a1e67168985c83/src/Ginger/Request.php#L101-L121 | train |
newestindustry/ginger-rest | src/Ginger/Request.php | Request.getAction | public function getAction() {
if ($this->action) {
return $this->action;
} else {
$action = "index";
switch ($_SERVER['REQUEST_METHOD']) {
case "GET":
if (count($this->getFilterParameters()) == 0) {
$action = "index";
} else {
$action = "get";
}
break;
case "POST":
... | php | public function getAction() {
if ($this->action) {
return $this->action;
} else {
$action = "index";
switch ($_SERVER['REQUEST_METHOD']) {
case "GET":
if (count($this->getFilterParameters()) == 0) {
$action = "index";
} else {
$action = "get";
}
break;
case "POST":
... | [
"public",
"function",
"getAction",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"action",
")",
"{",
"return",
"$",
"this",
"->",
"action",
";",
"}",
"else",
"{",
"$",
"action",
"=",
"\"index\"",
";",
"switch",
"(",
"$",
"_SERVER",
"[",
"'REQUEST_METH... | Return current action
@return string | [
"Return",
"current",
"action"
] | 482b77dc122a60ab0bf143a3c4a1e67168985c83 | https://github.com/newestindustry/ginger-rest/blob/482b77dc122a60ab0bf143a3c4a1e67168985c83/src/Ginger/Request.php#L195-L230 | train |
amarcinkowski/hospitalplugin | src/Twig/GetPropertiesExtension.php | GetPropertiesExtension.getProps | private static function getProps($class)
{
if ($class == NULL) {
return array();
}
$class = new \ReflectionClass($class);
$properties = array_filter($class->getProperties(), function ($prop) use($class)
{
return $prop->getDeclaringClass()->name == $cla... | php | private static function getProps($class)
{
if ($class == NULL) {
return array();
}
$class = new \ReflectionClass($class);
$properties = array_filter($class->getProperties(), function ($prop) use($class)
{
return $prop->getDeclaringClass()->name == $cla... | [
"private",
"static",
"function",
"getProps",
"(",
"$",
"class",
")",
"{",
"if",
"(",
"$",
"class",
"==",
"NULL",
")",
"{",
"return",
"array",
"(",
")",
";",
"}",
"$",
"class",
"=",
"new",
"\\",
"ReflectionClass",
"(",
"$",
"class",
")",
";",
"$",
... | return props of a class
@param unknown $class
@return boolean|multitype: | [
"return",
"props",
"of",
"a",
"class"
] | acdc2be5157abfbdcafb4dcf6c6ba505e291263f | https://github.com/amarcinkowski/hospitalplugin/blob/acdc2be5157abfbdcafb4dcf6c6ba505e291263f/src/Twig/GetPropertiesExtension.php#L22-L33 | train |
interactivesolutions/honeycomb-scripts | src/app/commands/HCNewService.php | HCNewService.createService | private function createService(stdClass $serviceData)
{
$this->comment('');
$this->comment('*************************************');
$this->comment('* Service creation *');
$this->comment('*************************************');
$this->comment($serviceData->... | php | private function createService(stdClass $serviceData)
{
$this->comment('');
$this->comment('*************************************');
$this->comment('* Service creation *');
$this->comment('*************************************');
$this->comment($serviceData->... | [
"private",
"function",
"createService",
"(",
"stdClass",
"$",
"serviceData",
")",
"{",
"$",
"this",
"->",
"comment",
"(",
"''",
")",
";",
"$",
"this",
"->",
"comment",
"(",
"'*************************************'",
")",
";",
"$",
"this",
"->",
"comment",
"(... | Generating service information
@param $serviceData | [
"Generating",
"service",
"information"
] | be2428ded5219dc612ecc51f43aa4dedff3d034d | https://github.com/interactivesolutions/honeycomb-scripts/blob/be2428ded5219dc612ecc51f43aa4dedff3d034d/src/app/commands/HCNewService.php#L79-L121 | train |
interactivesolutions/honeycomb-scripts | src/app/commands/HCNewService.php | HCNewService.loadConfiguration | private function loadConfiguration()
{
$allFiles = File::allFiles('_automate');
foreach ( $allFiles as $file )
if( strpos((string)$file, '.done') === false )
$this->configurationData[] = $this->optimizeData($file);
} | php | private function loadConfiguration()
{
$allFiles = File::allFiles('_automate');
foreach ( $allFiles as $file )
if( strpos((string)$file, '.done') === false )
$this->configurationData[] = $this->optimizeData($file);
} | [
"private",
"function",
"loadConfiguration",
"(",
")",
"{",
"$",
"allFiles",
"=",
"File",
"::",
"allFiles",
"(",
"'_automate'",
")",
";",
"foreach",
"(",
"$",
"allFiles",
"as",
"$",
"file",
")",
"if",
"(",
"strpos",
"(",
"(",
"string",
")",
"$",
"file",... | Loading configuration files
@return this | [
"Loading",
"configuration",
"files"
] | be2428ded5219dc612ecc51f43aa4dedff3d034d | https://github.com/interactivesolutions/honeycomb-scripts/blob/be2428ded5219dc612ecc51f43aa4dedff3d034d/src/app/commands/HCNewService.php#L128-L136 | train |
interactivesolutions/honeycomb-scripts | src/app/commands/HCNewService.php | HCNewService.checkPackage | private function checkPackage(stdClass $item)
{
if( ! file_exists($item->rootDirectory) )
$this->abort('Package ' . $item->directory . ' not existing, please create a repository and launch "php artisan hc:new-package" command');
} | php | private function checkPackage(stdClass $item)
{
if( ! file_exists($item->rootDirectory) )
$this->abort('Package ' . $item->directory . ' not existing, please create a repository and launch "php artisan hc:new-package" command');
} | [
"private",
"function",
"checkPackage",
"(",
"stdClass",
"$",
"item",
")",
"{",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"item",
"->",
"rootDirectory",
")",
")",
"$",
"this",
"->",
"abort",
"(",
"'Package '",
".",
"$",
"item",
"->",
"directory",
".",
"'... | Checking package existence
@param $item | [
"Checking",
"package",
"existence"
] | be2428ded5219dc612ecc51f43aa4dedff3d034d | https://github.com/interactivesolutions/honeycomb-scripts/blob/be2428ded5219dc612ecc51f43aa4dedff3d034d/src/app/commands/HCNewService.php#L169-L173 | train |
interactivesolutions/honeycomb-scripts | src/app/commands/HCNewService.php | HCNewService.executeAfterAbort | protected function executeAfterAbort()
{
/*foreach ($this->originalFiles as $value)
{
$this->file->put($value['path'], $value['content']);
$this->comment('Restored: ' . $value['path']);
}*/
foreach ( $this->createdFiles as $value ) {
File::delete(... | php | protected function executeAfterAbort()
{
/*foreach ($this->originalFiles as $value)
{
$this->file->put($value['path'], $value['content']);
$this->comment('Restored: ' . $value['path']);
}*/
foreach ( $this->createdFiles as $value ) {
File::delete(... | [
"protected",
"function",
"executeAfterAbort",
"(",
")",
"{",
"/*foreach ($this->originalFiles as $value)\n {\n $this->file->put($value['path'], $value['content']);\n $this->comment('Restored: ' . $value['path']);\n }*/",
"foreach",
"(",
"$",
"this",
"->",
... | Restoring changed files after the abort
Deleting create files
@return this | [
"Restoring",
"changed",
"files",
"after",
"the",
"abort",
"Deleting",
"create",
"files"
] | be2428ded5219dc612ecc51f43aa4dedff3d034d | https://github.com/interactivesolutions/honeycomb-scripts/blob/be2428ded5219dc612ecc51f43aa4dedff3d034d/src/app/commands/HCNewService.php#L181-L193 | train |
interactivesolutions/honeycomb-scripts | src/app/commands/HCNewService.php | HCNewService.updateActions | private function updateActions(stdClass $config, stdClass $serviceData)
{
$servicePermissions = [
"name" => "admin." . $serviceData->serviceRouteName,
"controller" => $serviceData->controllerNamespace . '\\' . $serviceData->controllerName,
"actions" => [
... | php | private function updateActions(stdClass $config, stdClass $serviceData)
{
$servicePermissions = [
"name" => "admin." . $serviceData->serviceRouteName,
"controller" => $serviceData->controllerNamespace . '\\' . $serviceData->controllerName,
"actions" => [
... | [
"private",
"function",
"updateActions",
"(",
"stdClass",
"$",
"config",
",",
"stdClass",
"$",
"serviceData",
")",
"{",
"$",
"servicePermissions",
"=",
"[",
"\"name\"",
"=>",
"\"admin.\"",
".",
"$",
"serviceData",
"->",
"serviceRouteName",
",",
"\"controller\"",
... | Updating service actions
@param $config
@param $serviceData
@return null | [
"Updating",
"service",
"actions"
] | be2428ded5219dc612ecc51f43aa4dedff3d034d | https://github.com/interactivesolutions/honeycomb-scripts/blob/be2428ded5219dc612ecc51f43aa4dedff3d034d/src/app/commands/HCNewService.php#L221-L255 | train |
interactivesolutions/honeycomb-scripts | src/app/commands/HCNewService.php | HCNewService.updateRolesActions | private function updateRolesActions(stdClass $config, stdClass $serviceData)
{
$rolesActions = [
"project-admin" =>
[$serviceData->aclPrefix . "_list",
$serviceData->aclPrefix . "_create",
$serviceData->aclPrefix . "_update",
... | php | private function updateRolesActions(stdClass $config, stdClass $serviceData)
{
$rolesActions = [
"project-admin" =>
[$serviceData->aclPrefix . "_list",
$serviceData->aclPrefix . "_create",
$serviceData->aclPrefix . "_update",
... | [
"private",
"function",
"updateRolesActions",
"(",
"stdClass",
"$",
"config",
",",
"stdClass",
"$",
"serviceData",
")",
"{",
"$",
"rolesActions",
"=",
"[",
"\"project-admin\"",
"=>",
"[",
"$",
"serviceData",
"->",
"aclPrefix",
".",
"\"_list\"",
",",
"$",
"servi... | Updating roles actions
@param $config
@param $serviceData
@return stdClass | [
"Updating",
"roles",
"actions"
] | be2428ded5219dc612ecc51f43aa4dedff3d034d | https://github.com/interactivesolutions/honeycomb-scripts/blob/be2428ded5219dc612ecc51f43aa4dedff3d034d/src/app/commands/HCNewService.php#L264-L281 | train |
interactivesolutions/honeycomb-scripts | src/app/commands/HCNewService.php | HCNewService.updateMenu | private function updateMenu(stdClass $config, stdClass $serviceData)
{
$menuItem = [
"route" => 'admin.' . $serviceData->serviceRouteName . '.index',
"translation" => $serviceData->translationsLocation . '.page_title',
"icon" => $serviceData->serviceIco... | php | private function updateMenu(stdClass $config, stdClass $serviceData)
{
$menuItem = [
"route" => 'admin.' . $serviceData->serviceRouteName . '.index',
"translation" => $serviceData->translationsLocation . '.page_title',
"icon" => $serviceData->serviceIco... | [
"private",
"function",
"updateMenu",
"(",
"stdClass",
"$",
"config",
",",
"stdClass",
"$",
"serviceData",
")",
"{",
"$",
"menuItem",
"=",
"[",
"\"route\"",
"=>",
"'admin.'",
".",
"$",
"serviceData",
"->",
"serviceRouteName",
".",
"'.index'",
",",
"\"translatio... | Updating menu parameter
@param $config
@param $serviceData
@return null | [
"Updating",
"menu",
"parameter"
] | be2428ded5219dc612ecc51f43aa4dedff3d034d | https://github.com/interactivesolutions/honeycomb-scripts/blob/be2428ded5219dc612ecc51f43aa4dedff3d034d/src/app/commands/HCNewService.php#L300-L331 | train |
interactivesolutions/honeycomb-scripts | src/app/commands/HCNewService.php | HCNewService.updateFormManager | private function updateFormManager(stdClass $config, stdClass $serviceData)
{
$config->formData = json_decode(json_encode($config->formData), true);
if( ! isset($config->formData[$serviceData->formID]) )
$config->formData[$serviceData->formID] = $serviceData->formNameSpace . '\\' . $ser... | php | private function updateFormManager(stdClass $config, stdClass $serviceData)
{
$config->formData = json_decode(json_encode($config->formData), true);
if( ! isset($config->formData[$serviceData->formID]) )
$config->formData[$serviceData->formID] = $serviceData->formNameSpace . '\\' . $ser... | [
"private",
"function",
"updateFormManager",
"(",
"stdClass",
"$",
"config",
",",
"stdClass",
"$",
"serviceData",
")",
"{",
"$",
"config",
"->",
"formData",
"=",
"json_decode",
"(",
"json_encode",
"(",
"$",
"config",
"->",
"formData",
")",
",",
"true",
")",
... | Updating form manager
@param $config
@param $serviceData
@return mixed | [
"Updating",
"form",
"manager"
] | be2428ded5219dc612ecc51f43aa4dedff3d034d | https://github.com/interactivesolutions/honeycomb-scripts/blob/be2428ded5219dc612ecc51f43aa4dedff3d034d/src/app/commands/HCNewService.php#L341-L349 | train |
Synapse-Cmf/synapse-cmf | src/Synapse/Cmf/Framework/Theme/Variation/Entity/Variation.php | Variation.getConfiguration | public function getConfiguration($namespace, $element, $key, $default = null)
{
$propertyPath = sprintf('[%s][%s][%s]', $namespace, $element, $key);
if ($value = $this->propertyAccessor->getValue($this->configurations, $propertyPath)) {
return $value;
}
return $default;... | php | public function getConfiguration($namespace, $element, $key, $default = null)
{
$propertyPath = sprintf('[%s][%s][%s]', $namespace, $element, $key);
if ($value = $this->propertyAccessor->getValue($this->configurations, $propertyPath)) {
return $value;
}
return $default;... | [
"public",
"function",
"getConfiguration",
"(",
"$",
"namespace",
",",
"$",
"element",
",",
"$",
"key",
",",
"$",
"default",
"=",
"null",
")",
"{",
"$",
"propertyPath",
"=",
"sprintf",
"(",
"'[%s][%s][%s]'",
",",
"$",
"namespace",
",",
"$",
"element",
","... | Return configuration value under given property path into given namespace or default if not readable.
@see PropertyAccessorInterface::getValue()
@param sgring $namespace
@param string $path
@param string $element
@param mixed $default
@return mixed | [
"Return",
"configuration",
"value",
"under",
"given",
"property",
"path",
"into",
"given",
"namespace",
"or",
"default",
"if",
"not",
"readable",
"."
] | d8122a4150a83d5607289724425cf35c56a5e880 | https://github.com/Synapse-Cmf/synapse-cmf/blob/d8122a4150a83d5607289724425cf35c56a5e880/src/Synapse/Cmf/Framework/Theme/Variation/Entity/Variation.php#L46-L55 | train |
IftekherSunny/Planet-Framework | src/Sun/Session/Session.php | Session.startSession | protected function startSession()
{
if (session_status() == PHP_SESSION_NONE) {
session_start();
if(!$this->expireOnClose) {
setcookie('planet_session', session_id(), time() + ($this->expireTime * 60 ), '/', null, false, false);
}
}
... | php | protected function startSession()
{
if (session_status() == PHP_SESSION_NONE) {
session_start();
if(!$this->expireOnClose) {
setcookie('planet_session', session_id(), time() + ($this->expireTime * 60 ), '/', null, false, false);
}
}
... | [
"protected",
"function",
"startSession",
"(",
")",
"{",
"if",
"(",
"session_status",
"(",
")",
"==",
"PHP_SESSION_NONE",
")",
"{",
"session_start",
"(",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"expireOnClose",
")",
"{",
"setcookie",
"(",
"'planet_sess... | To start session | [
"To",
"start",
"session"
] | 530e772fb97695c1c4e1af73f81675f189474d9f | https://github.com/IftekherSunny/Planet-Framework/blob/530e772fb97695c1c4e1af73f81675f189474d9f/src/Sun/Session/Session.php#L54-L64 | train |
IftekherSunny/Planet-Framework | src/Sun/Session/Session.php | Session.pull | public function pull($name, $value = '')
{
$value = $this->get($name, $value);
$this->delete($name);
return $value;
} | php | public function pull($name, $value = '')
{
$value = $this->get($name, $value);
$this->delete($name);
return $value;
} | [
"public",
"function",
"pull",
"(",
"$",
"name",
",",
"$",
"value",
"=",
"''",
")",
"{",
"$",
"value",
"=",
"$",
"this",
"->",
"get",
"(",
"$",
"name",
",",
"$",
"value",
")",
";",
"$",
"this",
"->",
"delete",
"(",
"$",
"name",
")",
";",
"retu... | To pull session data
@param string $name
@param string $value
@return mixed | [
"To",
"pull",
"session",
"data"
] | 530e772fb97695c1c4e1af73f81675f189474d9f | https://github.com/IftekherSunny/Planet-Framework/blob/530e772fb97695c1c4e1af73f81675f189474d9f/src/Sun/Session/Session.php#L156-L162 | train |
IftekherSunny/Planet-Framework | src/Sun/Session/Session.php | Session.pop | public function pop($name)
{
$previousValue = $this->get($name);
$value = array_pop($previousValue);
$this->create($name, $previousValue);
return $value;
} | php | public function pop($name)
{
$previousValue = $this->get($name);
$value = array_pop($previousValue);
$this->create($name, $previousValue);
return $value;
} | [
"public",
"function",
"pop",
"(",
"$",
"name",
")",
"{",
"$",
"previousValue",
"=",
"$",
"this",
"->",
"get",
"(",
"$",
"name",
")",
";",
"$",
"value",
"=",
"array_pop",
"(",
"$",
"previousValue",
")",
";",
"$",
"this",
"->",
"create",
"(",
"$",
... | To pop session data from session array
@param string $name
@return string | [
"To",
"pop",
"session",
"data",
"from",
"session",
"array"
] | 530e772fb97695c1c4e1af73f81675f189474d9f | https://github.com/IftekherSunny/Planet-Framework/blob/530e772fb97695c1c4e1af73f81675f189474d9f/src/Sun/Session/Session.php#L188-L197 | train |
IftekherSunny/Planet-Framework | src/Sun/Session/Session.php | Session.shift | public function shift($name)
{
$previousValue = $this->get($name);
$value = array_shift($previousValue);
$this->create($name, $previousValue);
return $value;
} | php | public function shift($name)
{
$previousValue = $this->get($name);
$value = array_shift($previousValue);
$this->create($name, $previousValue);
return $value;
} | [
"public",
"function",
"shift",
"(",
"$",
"name",
")",
"{",
"$",
"previousValue",
"=",
"$",
"this",
"->",
"get",
"(",
"$",
"name",
")",
";",
"$",
"value",
"=",
"array_shift",
"(",
"$",
"previousValue",
")",
";",
"$",
"this",
"->",
"create",
"(",
"$"... | To shift session data from session array
@param string $name
@return string | [
"To",
"shift",
"session",
"data",
"from",
"session",
"array"
] | 530e772fb97695c1c4e1af73f81675f189474d9f | https://github.com/IftekherSunny/Planet-Framework/blob/530e772fb97695c1c4e1af73f81675f189474d9f/src/Sun/Session/Session.php#L206-L215 | train |
Elephant418/Staq | src/Staq/Autoloader.php | Autoloader.getRealClass | protected function getRealClass($stack, $extensionNamespace)
{
$stackPath = \Staq\Util::convertNamespaceToPath($stack);
$absolutePath = realpath($this->extensions[$extensionNamespace] . '/Stack/' . $stackPath . '.php');
if (is_file($absolutePath)) {
$realClass = $extensionNamespa... | php | protected function getRealClass($stack, $extensionNamespace)
{
$stackPath = \Staq\Util::convertNamespaceToPath($stack);
$absolutePath = realpath($this->extensions[$extensionNamespace] . '/Stack/' . $stackPath . '.php');
if (is_file($absolutePath)) {
$realClass = $extensionNamespa... | [
"protected",
"function",
"getRealClass",
"(",
"$",
"stack",
",",
"$",
"extensionNamespace",
")",
"{",
"$",
"stackPath",
"=",
"\\",
"Staq",
"\\",
"Util",
"::",
"convertNamespaceToPath",
"(",
"$",
"stack",
")",
";",
"$",
"absolutePath",
"=",
"realpath",
"(",
... | "stack" is now a part of the namespace, there is no burgers left at my bakery | [
"stack",
"is",
"now",
"a",
"part",
"of",
"the",
"namespace",
"there",
"is",
"no",
"burgers",
"left",
"at",
"my",
"bakery"
] | b96110eb069a2b3fd992d3e56327a54a308b68b2 | https://github.com/Elephant418/Staq/blob/b96110eb069a2b3fd992d3e56327a54a308b68b2/src/Staq/Autoloader.php#L76-L84 | train |
schpill/thin | src/Filter/Striptags.php | Striptags.filter | public function filter($value)
{
// start by stripping the comments, if necessary
if(!$this->allowComments) {
$value = preg_replace('/<!\-\-.*\-\->/U', '', $value);
}
// strip unallowed tags
$allowed = '';
foreach($this->al... | php | public function filter($value)
{
// start by stripping the comments, if necessary
if(!$this->allowComments) {
$value = preg_replace('/<!\-\-.*\-\->/U', '', $value);
}
// strip unallowed tags
$allowed = '';
foreach($this->al... | [
"public",
"function",
"filter",
"(",
"$",
"value",
")",
"{",
"// start by stripping the comments, if necessary",
"if",
"(",
"!",
"$",
"this",
"->",
"allowComments",
")",
"{",
"$",
"value",
"=",
"preg_replace",
"(",
"'/<!\\-\\-.*\\-\\->/U'",
",",
"''",
",",
"$",
... | Strip the undesired HTML markup
@param string $value The input string with HTML markup
@return string Filtered string | [
"Strip",
"the",
"undesired",
"HTML",
"markup"
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Filter/Striptags.php#L33-L65 | train |
schpill/thin | src/Filter/Striptags.php | Striptags.setAllowedTags | public function setAllowedTags($tags)
{
if(!is_array($tags)) {
$tags = [$tags];
}
$this->allowedTags = $tags;
return $this;
} | php | public function setAllowedTags($tags)
{
if(!is_array($tags)) {
$tags = [$tags];
}
$this->allowedTags = $tags;
return $this;
} | [
"public",
"function",
"setAllowedTags",
"(",
"$",
"tags",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"tags",
")",
")",
"{",
"$",
"tags",
"=",
"[",
"$",
"tags",
"]",
";",
"}",
"$",
"this",
"->",
"allowedTags",
"=",
"$",
"tags",
";",
"return",... | Set the HTML tags that should be left in the input string
@param array|string $tags The allowed tags: either an array or a string with a single tag.
@return \Thin\Filter\StripTags Provides a fluent interface | [
"Set",
"the",
"HTML",
"tags",
"that",
"should",
"be",
"left",
"in",
"the",
"input",
"string"
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Filter/Striptags.php#L76-L83 | train |
schpill/thin | src/Filter/Striptags.php | Striptags.setAllowedAttributes | public function setAllowedAttributes($attributes)
{
if(!is_array($attributes)) {
$attributes = [$attributes];
}
$this->allowedAttributes = $attributes;
return $this;
} | php | public function setAllowedAttributes($attributes)
{
if(!is_array($attributes)) {
$attributes = [$attributes];
}
$this->allowedAttributes = $attributes;
return $this;
} | [
"public",
"function",
"setAllowedAttributes",
"(",
"$",
"attributes",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"attributes",
")",
")",
"{",
"$",
"attributes",
"=",
"[",
"$",
"attributes",
"]",
";",
"}",
"$",
"this",
"->",
"allowedAttributes",
"=",... | Set the HTML attributes that should be left in the unstripped tags in the input string
@param array $attributes The allowed attributes: either an array or a string with a single attribute.
@return \Thin\Filter\StripTags Provides a fluent interface | [
"Set",
"the",
"HTML",
"attributes",
"that",
"should",
"be",
"left",
"in",
"the",
"unstripped",
"tags",
"in",
"the",
"input",
"string"
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Filter/Striptags.php#L94-L101 | train |
phPoirot/Stream | Streamable.php | Streamable.write | function write($content, $inByte = null)
{
$this->_assertWritable();
$stream = $this->resource()->getRHandler();
$inByte = ($inByte === null)
? $this->getBuffer()
: $inByte;
$content = (string) $content;
if (null === $inByte)
$ret = fwr... | php | function write($content, $inByte = null)
{
$this->_assertWritable();
$stream = $this->resource()->getRHandler();
$inByte = ($inByte === null)
? $this->getBuffer()
: $inByte;
$content = (string) $content;
if (null === $inByte)
$ret = fwr... | [
"function",
"write",
"(",
"$",
"content",
",",
"$",
"inByte",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"_assertWritable",
"(",
")",
";",
"$",
"stream",
"=",
"$",
"this",
"->",
"resource",
"(",
")",
"->",
"getRHandler",
"(",
")",
";",
"$",
"inByte"... | Writes the contents of string to the file stream
@param string $content The string that is to be written
@param int $inByte Writing will stop after length bytes
have been written or the end of string
is reached
@return $this | [
"Writes",
"the",
"contents",
"of",
"string",
"to",
"the",
"file",
"stream"
] | db448ee0528c2a5b07c594b8a30e2543fbc15f57 | https://github.com/phPoirot/Stream/blob/db448ee0528c2a5b07c594b8a30e2543fbc15f57/Streamable.php#L244-L274 | train |
phPoirot/Stream | Streamable.php | Streamable.sendData | function sendData($data, $flags = null)
{
$rHandler = $this->resource()->getRHandler();
if ($flags === null) {
if ($this->resource()->meta()->getStreamType() == 'udp_socket')
// STREAM_OOB data not provided on udp sockets
$flags = STREAM_PEEK;
... | php | function sendData($data, $flags = null)
{
$rHandler = $this->resource()->getRHandler();
if ($flags === null) {
if ($this->resource()->meta()->getStreamType() == 'udp_socket')
// STREAM_OOB data not provided on udp sockets
$flags = STREAM_PEEK;
... | [
"function",
"sendData",
"(",
"$",
"data",
",",
"$",
"flags",
"=",
"null",
")",
"{",
"$",
"rHandler",
"=",
"$",
"this",
"->",
"resource",
"(",
")",
"->",
"getRHandler",
"(",
")",
";",
"if",
"(",
"$",
"flags",
"===",
"null",
")",
"{",
"if",
"(",
... | Sends the specified data through the socket,
whether it is connected or not
@param string $data The data to be sent
@param int|null $flags Provides a RDM (Reliably-delivered messages) socket
The value of flags can be any combination of the following:
- STREAM_SOCK_RDM
- STREAM_PEEK
- STREAM_OOB process OOB (o... | [
"Sends",
"the",
"specified",
"data",
"through",
"the",
"socket",
"whether",
"it",
"is",
"connected",
"or",
"not"
] | db448ee0528c2a5b07c594b8a30e2543fbc15f57 | https://github.com/phPoirot/Stream/blob/db448ee0528c2a5b07c594b8a30e2543fbc15f57/Streamable.php#L305-L331 | train |
phPoirot/Stream | Streamable.php | Streamable.rewind | function rewind()
{
$this->_assertSeekable();
$stream = $this->resource()->getRHandler();
if (false === rewind($stream))
throw new \RuntimeException('Cannot rewind stream');
return $this;
} | php | function rewind()
{
$this->_assertSeekable();
$stream = $this->resource()->getRHandler();
if (false === rewind($stream))
throw new \RuntimeException('Cannot rewind stream');
return $this;
} | [
"function",
"rewind",
"(",
")",
"{",
"$",
"this",
"->",
"_assertSeekable",
"(",
")",
";",
"$",
"stream",
"=",
"$",
"this",
"->",
"resource",
"(",
")",
"->",
"getRHandler",
"(",
")",
";",
"if",
"(",
"false",
"===",
"rewind",
"(",
"$",
"stream",
")",... | Move the file pointer to the beginning of the stream
! php doesn't support seek/rewind on non-local streams
we can using temp/cache piped stream.
! If you have opened the file in append ("a" or "a+") mode,
any data you write to the file will always be appended,
regardless of the file position.
@return $this | [
"Move",
"the",
"file",
"pointer",
"to",
"the",
"beginning",
"of",
"the",
"stream"
] | db448ee0528c2a5b07c594b8a30e2543fbc15f57 | https://github.com/phPoirot/Stream/blob/db448ee0528c2a5b07c594b8a30e2543fbc15f57/Streamable.php#L429-L439 | train |
hal-platform/hal-core | src/Repository/System/VersionControlProviderRepository.php | VersionControlProviderRepository.getPagedResults | public function getPagedResults($limit = 50, $page = 0)
{
$dql = sprintf(self::DQL_GET_VCSS, VersionControlProvider::class);
return $this->getPaginator($dql, $limit, $page);
} | php | public function getPagedResults($limit = 50, $page = 0)
{
$dql = sprintf(self::DQL_GET_VCSS, VersionControlProvider::class);
return $this->getPaginator($dql, $limit, $page);
} | [
"public",
"function",
"getPagedResults",
"(",
"$",
"limit",
"=",
"50",
",",
"$",
"page",
"=",
"0",
")",
"{",
"$",
"dql",
"=",
"sprintf",
"(",
"self",
"::",
"DQL_GET_VCSS",
",",
"VersionControlProvider",
"::",
"class",
")",
";",
"return",
"$",
"this",
"... | Get all VCSs, paged.
@param int $limit
@param int $page
@return Paginator | [
"Get",
"all",
"VCSs",
"paged",
"."
] | 30d456f8392fc873301ad4217d2ae90436c67090 | https://github.com/hal-platform/hal-core/blob/30d456f8392fc873301ad4217d2ae90436c67090/src/Repository/System/VersionControlProviderRepository.php#L60-L65 | train |
iron-bound-designs/wp-notifications | src/Template/Listener.php | Listener.get_callback_reflection | public function get_callback_reflection() {
if ( is_array( $this->callback ) ) {
return new \ReflectionMethod( $this->callback[0], $this->callback[1] );
} else {
return new \ReflectionFunction( $this->callback );
}
} | php | public function get_callback_reflection() {
if ( is_array( $this->callback ) ) {
return new \ReflectionMethod( $this->callback[0], $this->callback[1] );
} else {
return new \ReflectionFunction( $this->callback );
}
} | [
"public",
"function",
"get_callback_reflection",
"(",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"this",
"->",
"callback",
")",
")",
"{",
"return",
"new",
"\\",
"ReflectionMethod",
"(",
"$",
"this",
"->",
"callback",
"[",
"0",
"]",
",",
"$",
"this",
"-... | Get a reflection object for the callback function.
@since 1.0
@return \ReflectionFunctionAbstract | [
"Get",
"a",
"reflection",
"object",
"for",
"the",
"callback",
"function",
"."
] | 4fdf67d28d194576d35f86245b2f539c4815cde2 | https://github.com/iron-bound-designs/wp-notifications/blob/4fdf67d28d194576d35f86245b2f539c4815cde2/src/Template/Listener.php#L50-L56 | train |
apishka/easy-extend | source/RouterAbstract.php | RouterAbstract.pushClassData | protected function pushClassData(array $data, \ReflectionClass $reflector): array
{
return $this->collectClassData(
$reflector->newInstanceWithoutConstructor(),
$data,
$reflector
);
} | php | protected function pushClassData(array $data, \ReflectionClass $reflector): array
{
return $this->collectClassData(
$reflector->newInstanceWithoutConstructor(),
$data,
$reflector
);
} | [
"protected",
"function",
"pushClassData",
"(",
"array",
"$",
"data",
",",
"\\",
"ReflectionClass",
"$",
"reflector",
")",
":",
"array",
"{",
"return",
"$",
"this",
"->",
"collectClassData",
"(",
"$",
"reflector",
"->",
"newInstanceWithoutConstructor",
"(",
")",
... | Push class data
@param array $data
@param \ReflectionClass $reflector
@return array | [
"Push",
"class",
"data"
] | 5e5c63c2509377abc3db6956e353623683703e09 | https://github.com/apishka/easy-extend/blob/5e5c63c2509377abc3db6956e353623683703e09/source/RouterAbstract.php#L73-L80 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.