id int32 0 241k | 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
202,100 | covex-nn/JooS | src/JooS/Event/Event.php | Event.detach | final public function detach($observer)
{
$key = array_search($observer, $this->_observers);
if ($key !== false) {
unset($this->_observers[$key]);
}
return $this;
} | php | final public function detach($observer)
{
$key = array_search($observer, $this->_observers);
if ($key !== false) {
unset($this->_observers[$key]);
}
return $this;
} | [
"final",
"public",
"function",
"detach",
"(",
"$",
"observer",
")",
"{",
"$",
"key",
"=",
"array_search",
"(",
"$",
"observer",
",",
"$",
"this",
"->",
"_observers",
")",
";",
"if",
"(",
"$",
"key",
"!==",
"false",
")",
"{",
"unset",
"(",
"$",
"thi... | Detach observer.
@param callback $observer Observer
@return Event | [
"Detach",
"observer",
"."
] | 8dfb94edccecaf307787d4091ba7f20a674b7792 | https://github.com/covex-nn/JooS/blob/8dfb94edccecaf307787d4091ba7f20a674b7792/src/JooS/Event/Event.php#L158-L165 |
202,101 | covex-nn/JooS | src/JooS/Event/Event.php | Event._loadObservers | private function _loadObservers()
{
$class = $this->name();
$name = self::_configName($class);
$config = Config::getInstance($name);
$this->_observers = $config->valueOf();
} | php | private function _loadObservers()
{
$class = $this->name();
$name = self::_configName($class);
$config = Config::getInstance($name);
$this->_observers = $config->valueOf();
} | [
"private",
"function",
"_loadObservers",
"(",
")",
"{",
"$",
"class",
"=",
"$",
"this",
"->",
"name",
"(",
")",
";",
"$",
"name",
"=",
"self",
"::",
"_configName",
"(",
"$",
"class",
")",
";",
"$",
"config",
"=",
"Config",
"::",
"getInstance",
"(",
... | Load observers.
@return null | [
"Load",
"observers",
"."
] | 8dfb94edccecaf307787d4091ba7f20a674b7792 | https://github.com/covex-nn/JooS/blob/8dfb94edccecaf307787d4091ba7f20a674b7792/src/JooS/Event/Event.php#L208-L215 |
202,102 | jamset/commands-executor | src/CommandsManager.php | CommandsManager.getSystemLoadInfo | public function getSystemLoadInfo()
{
$cpuMemDto = new CpuMemDto();
$cpuMemDto = $this->getMemFree($cpuMemDto);
$cpuMemDto = $this->getCpuIdle($cpuMemDto);
return $cpuMemDto;
} | php | public function getSystemLoadInfo()
{
$cpuMemDto = new CpuMemDto();
$cpuMemDto = $this->getMemFree($cpuMemDto);
$cpuMemDto = $this->getCpuIdle($cpuMemDto);
return $cpuMemDto;
} | [
"public",
"function",
"getSystemLoadInfo",
"(",
")",
"{",
"$",
"cpuMemDto",
"=",
"new",
"CpuMemDto",
"(",
")",
";",
"$",
"cpuMemDto",
"=",
"$",
"this",
"->",
"getMemFree",
"(",
"$",
"cpuMemDto",
")",
";",
"$",
"cpuMemDto",
"=",
"$",
"this",
"->",
"getC... | Get current cpu idle and memory free
@return CpuMemDto | [
"Get",
"current",
"cpu",
"idle",
"and",
"memory",
"free"
] | 5cca74fdd36d30e83dfae7c8c2457a00c8855d4f | https://github.com/jamset/commands-executor/blob/5cca74fdd36d30e83dfae7c8c2457a00c8855d4f/src/CommandsManager.php#L52-L60 |
202,103 | jamset/commands-executor | src/CommandsManager.php | CommandsManager.getPidByPpid | public function getPidByPpid($ppid)
{
$commandsDto = new CommandsExecutionDto();
$commandsDto->setCommandName(CommandsConstants::GET_PID_BY_PPID);
$commandsDto->setPid($ppid);
return $this->getCommandExecutionResult($commandsDto);
} | php | public function getPidByPpid($ppid)
{
$commandsDto = new CommandsExecutionDto();
$commandsDto->setCommandName(CommandsConstants::GET_PID_BY_PPID);
$commandsDto->setPid($ppid);
return $this->getCommandExecutionResult($commandsDto);
} | [
"public",
"function",
"getPidByPpid",
"(",
"$",
"ppid",
")",
"{",
"$",
"commandsDto",
"=",
"new",
"CommandsExecutionDto",
"(",
")",
";",
"$",
"commandsDto",
"->",
"setCommandName",
"(",
"CommandsConstants",
"::",
"GET_PID_BY_PPID",
")",
";",
"$",
"commandsDto",
... | Return PID of the child's process by parent PID
@param $pid | [
"Return",
"PID",
"of",
"the",
"child",
"s",
"process",
"by",
"parent",
"PID"
] | 5cca74fdd36d30e83dfae7c8c2457a00c8855d4f | https://github.com/jamset/commands-executor/blob/5cca74fdd36d30e83dfae7c8c2457a00c8855d4f/src/CommandsManager.php#L93-L100 |
202,104 | php-api-clients/installer | src/Filesystem.php | Filesystem.write | public function write(string $filename, string $contents): int
{
return (int)file_put_contents($filename, $contents);
} | php | public function write(string $filename, string $contents): int
{
return (int)file_put_contents($filename, $contents);
} | [
"public",
"function",
"write",
"(",
"string",
"$",
"filename",
",",
"string",
"$",
"contents",
")",
":",
"int",
"{",
"return",
"(",
"int",
")",
"file_put_contents",
"(",
"$",
"filename",
",",
"$",
"contents",
")",
";",
"}"
] | Write the given contents to the given file.
@param string $filename
@param string $contents
@return int | [
"Write",
"the",
"given",
"contents",
"to",
"the",
"given",
"file",
"."
] | 5d5a936520ff2261cf94882b335c2d1d7ea4dda2 | https://github.com/php-api-clients/installer/blob/5d5a936520ff2261cf94882b335c2d1d7ea4dda2/src/Filesystem.php#L25-L28 |
202,105 | php-api-clients/installer | src/Filesystem.php | Filesystem.ls | public function ls(string $path): array
{
$files = [];
$d = dir($path);
while (false !== ($entry = $d->read())) {
if (in_array($entry, ['.', '..'], true)) {
continue;
}
$entryPath = $path . $entry;
if (is_dir($entryPath)) {
... | php | public function ls(string $path): array
{
$files = [];
$d = dir($path);
while (false !== ($entry = $d->read())) {
if (in_array($entry, ['.', '..'], true)) {
continue;
}
$entryPath = $path . $entry;
if (is_dir($entryPath)) {
... | [
"public",
"function",
"ls",
"(",
"string",
"$",
"path",
")",
":",
"array",
"{",
"$",
"files",
"=",
"[",
"]",
";",
"$",
"d",
"=",
"dir",
"(",
"$",
"path",
")",
";",
"while",
"(",
"false",
"!==",
"(",
"$",
"entry",
"=",
"$",
"d",
"->",
"read",
... | List all files in a directory and it's subdirectories.
@param string $path
@return array | [
"List",
"all",
"files",
"in",
"a",
"directory",
"and",
"it",
"s",
"subdirectories",
"."
] | 5d5a936520ff2261cf94882b335c2d1d7ea4dda2 | https://github.com/php-api-clients/installer/blob/5d5a936520ff2261cf94882b335c2d1d7ea4dda2/src/Filesystem.php#L36-L59 |
202,106 | geoffadams/bedrest-core | library/BedRest/Content/Negotiation/QualityFactorList.php | QualityFactorList.qualityFactorComparator | public function qualityFactorComparator($mediaType1, $mediaType2)
{
$diff = $mediaType2['q'] - $mediaType1['q'];
// doesn't cope too well with values 1 > v > -1, so make sure we return simple integers
if ($diff > 0) {
$diff = 1;
} elseif ($diff < 0) {
$diff =... | php | public function qualityFactorComparator($mediaType1, $mediaType2)
{
$diff = $mediaType2['q'] - $mediaType1['q'];
// doesn't cope too well with values 1 > v > -1, so make sure we return simple integers
if ($diff > 0) {
$diff = 1;
} elseif ($diff < 0) {
$diff =... | [
"public",
"function",
"qualityFactorComparator",
"(",
"$",
"mediaType1",
",",
"$",
"mediaType2",
")",
"{",
"$",
"diff",
"=",
"$",
"mediaType2",
"[",
"'q'",
"]",
"-",
"$",
"mediaType1",
"[",
"'q'",
"]",
";",
"// doesn't cope too well with values 1 > v > -1, so make... | Comparator function for sorting a list of arrays by their 'q' factor.
@param array $mediaType1
@param array $mediaType2
@return integer | [
"Comparator",
"function",
"for",
"sorting",
"a",
"list",
"of",
"arrays",
"by",
"their",
"q",
"factor",
"."
] | a77bf8b7492dfbfb720b201f7ec91a4f03417b5c | https://github.com/geoffadams/bedrest-core/blob/a77bf8b7492dfbfb720b201f7ec91a4f03417b5c/library/BedRest/Content/Negotiation/QualityFactorList.php#L80-L92 |
202,107 | pixelpolishers/makedocs | src/MakeDocs/Generator/AssetManager.php | AssetManager.addAsset | public function addAsset($name, $path)
{
if (!is_file($path)) {
throw new \RuntimeException('The asset file "' . $path . '" does not exist.');
}
$this->assets[$name] = $path;
} | php | public function addAsset($name, $path)
{
if (!is_file($path)) {
throw new \RuntimeException('The asset file "' . $path . '" does not exist.');
}
$this->assets[$name] = $path;
} | [
"public",
"function",
"addAsset",
"(",
"$",
"name",
",",
"$",
"path",
")",
"{",
"if",
"(",
"!",
"is_file",
"(",
"$",
"path",
")",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"'The asset file \"'",
".",
"$",
"path",
".",
"'\" does not exist.'... | Adds an asset.
@param string $name The name of the asset.
@param string $path The path to the asset.
@throws \RuntimeException | [
"Adds",
"an",
"asset",
"."
] | 1fa243b52565b5de417ef2dbdfbcae9896b6b483 | https://github.com/pixelpolishers/makedocs/blob/1fa243b52565b5de417ef2dbdfbcae9896b6b483/src/MakeDocs/Generator/AssetManager.php#L35-L41 |
202,108 | pixelpolishers/makedocs | src/MakeDocs/Generator/AssetManager.php | AssetManager.copyTo | public function copyTo($path)
{
foreach ($this->assets as $assetName => $assetPath) {
$outputPath = $path . '/' . $assetName;
$this->copyFromTo($assetPath, $outputPath);
}
} | php | public function copyTo($path)
{
foreach ($this->assets as $assetName => $assetPath) {
$outputPath = $path . '/' . $assetName;
$this->copyFromTo($assetPath, $outputPath);
}
} | [
"public",
"function",
"copyTo",
"(",
"$",
"path",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"assets",
"as",
"$",
"assetName",
"=>",
"$",
"assetPath",
")",
"{",
"$",
"outputPath",
"=",
"$",
"path",
".",
"'/'",
".",
"$",
"assetName",
";",
"$",
"th... | Copies all assets to the given path.
@param string $path The path to copy to. | [
"Copies",
"all",
"assets",
"to",
"the",
"given",
"path",
"."
] | 1fa243b52565b5de417ef2dbdfbcae9896b6b483 | https://github.com/pixelpolishers/makedocs/blob/1fa243b52565b5de417ef2dbdfbcae9896b6b483/src/MakeDocs/Generator/AssetManager.php#L48-L55 |
202,109 | pixelpolishers/makedocs | src/MakeDocs/Generator/AssetManager.php | AssetManager.copyFromTo | private function copyFromTo($from, $to)
{
$directory = dirname($to);
if (!is_dir($directory)) {
mkdir($directory, 0777, true);
}
copy($from, $to);
} | php | private function copyFromTo($from, $to)
{
$directory = dirname($to);
if (!is_dir($directory)) {
mkdir($directory, 0777, true);
}
copy($from, $to);
} | [
"private",
"function",
"copyFromTo",
"(",
"$",
"from",
",",
"$",
"to",
")",
"{",
"$",
"directory",
"=",
"dirname",
"(",
"$",
"to",
")",
";",
"if",
"(",
"!",
"is_dir",
"(",
"$",
"directory",
")",
")",
"{",
"mkdir",
"(",
"$",
"directory",
",",
"077... | Copies a single asset from a path to a path.
@param string $from The location to copy from.
@param string $to The location to copy to. | [
"Copies",
"a",
"single",
"asset",
"from",
"a",
"path",
"to",
"a",
"path",
"."
] | 1fa243b52565b5de417ef2dbdfbcae9896b6b483 | https://github.com/pixelpolishers/makedocs/blob/1fa243b52565b5de417ef2dbdfbcae9896b6b483/src/MakeDocs/Generator/AssetManager.php#L63-L71 |
202,110 | vukbgit/PHPCraft.Subject | src/Traits/Upload/Field.php | Field.setInput | private function setInput()
{
$this->inputFile = $_FILES[$this->field]['name'];
$this->inputHash = hash_file('md5', $_FILES[$this->field]['tmp_name']);
} | php | private function setInput()
{
$this->inputFile = $_FILES[$this->field]['name'];
$this->inputHash = hash_file('md5', $_FILES[$this->field]['tmp_name']);
} | [
"private",
"function",
"setInput",
"(",
")",
"{",
"$",
"this",
"->",
"inputFile",
"=",
"$",
"_FILES",
"[",
"$",
"this",
"->",
"field",
"]",
"[",
"'name'",
"]",
";",
"$",
"this",
"->",
"inputHash",
"=",
"hash_file",
"(",
"'md5'",
",",
"$",
"_FILES",
... | Stores input informations | [
"Stores",
"input",
"informations"
] | a43ad7868098ff1e7bda6819547ea64f9a853732 | https://github.com/vukbgit/PHPCraft.Subject/blob/a43ad7868098ff1e7bda6819547ea64f9a853732/src/Traits/Upload/Field.php#L60-L64 |
202,111 | vukbgit/PHPCraft.Subject | src/Traits/Upload/Field.php | Field.handleUpload | public function handleUpload(&$uploader)
{
// store uploader
$this->uploader =& $uploader;
//store input
$this->setInput();
// tell uploader which field is uploaded
$this->uploader->setField($this->field);
// make temporary file
$this->uploader->setDes... | php | public function handleUpload(&$uploader)
{
// store uploader
$this->uploader =& $uploader;
//store input
$this->setInput();
// tell uploader which field is uploaded
$this->uploader->setField($this->field);
// make temporary file
$this->uploader->setDes... | [
"public",
"function",
"handleUpload",
"(",
"&",
"$",
"uploader",
")",
"{",
"// store uploader",
"$",
"this",
"->",
"uploader",
"=",
"&",
"$",
"uploader",
";",
"//store input",
"$",
"this",
"->",
"setInput",
"(",
")",
";",
"// tell uploader which field is uploade... | Handles an upload
@param $uploader adapter following PHPCraft\Upload\UploadInterface | [
"Handles",
"an",
"upload"
] | a43ad7868098ff1e7bda6819547ea64f9a853732 | https://github.com/vukbgit/PHPCraft.Subject/blob/a43ad7868098ff1e7bda6819547ea64f9a853732/src/Traits/Upload/Field.php#L80-L120 |
202,112 | Kris-Kuiper/sFire-Framework | src/Form/Types/Button.php | Button.text | public function text($text) {
if(false === is_string($text)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($text)), E_USER_ERROR);
}
$this -> text = $text;
return $this;
} | php | public function text($text) {
if(false === is_string($text)) {
return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string, "%s" given', __METHOD__, gettype($text)), E_USER_ERROR);
}
$this -> text = $text;
return $this;
} | [
"public",
"function",
"text",
"(",
"$",
"text",
")",
"{",
"if",
"(",
"false",
"===",
"is_string",
"(",
"$",
"text",
")",
")",
"{",
"return",
"trigger_error",
"(",
"sprintf",
"(",
"'Argument 1 passed to %s() must be of the type string, \"%s\" given'",
",",
"__METHO... | Set the text of the button
@param string $text
@return sFire\Form\Types\Button | [
"Set",
"the",
"text",
"of",
"the",
"button"
] | deefe1d9d2b40e7326381e8dcd4f01f9aa61885c | https://github.com/Kris-Kuiper/sFire-Framework/blob/deefe1d9d2b40e7326381e8dcd4f01f9aa61885c/src/Form/Types/Button.php#L32-L41 |
202,113 | t3v/t3v_core | Classes/Service/LanguageService.php | LanguageService.getLanguage | public function getLanguage(string $default = null): string {
$language = $default ?: 'en';
if (TYPO3_MODE === 'FE') {
if (isset($GLOBALS['TSFE']->lang)) {
$language = $GLOBALS['TSFE']->lang;
}
} elseif (is_object($GLOBALS['LANG'])) {
if (isset($GLOBALS['LANG']->lang)) {
$... | php | public function getLanguage(string $default = null): string {
$language = $default ?: 'en';
if (TYPO3_MODE === 'FE') {
if (isset($GLOBALS['TSFE']->lang)) {
$language = $GLOBALS['TSFE']->lang;
}
} elseif (is_object($GLOBALS['LANG'])) {
if (isset($GLOBALS['LANG']->lang)) {
$... | [
"public",
"function",
"getLanguage",
"(",
"string",
"$",
"default",
"=",
"null",
")",
":",
"string",
"{",
"$",
"language",
"=",
"$",
"default",
"?",
":",
"'en'",
";",
"if",
"(",
"TYPO3_MODE",
"===",
"'FE'",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"... | Gets the current language.
@param string $default The default language, defaults to `en`
@return string The current language if available, otherwise the default one | [
"Gets",
"the",
"current",
"language",
"."
] | 8c04b7688cc2773f11fcc87fda3f7cd53d80a980 | https://github.com/t3v/t3v_core/blob/8c04b7688cc2773f11fcc87fda3f7cd53d80a980/Classes/Service/LanguageService.php#L18-L40 |
202,114 | t3v/t3v_core | Classes/Service/LanguageService.php | LanguageService.getLanguageUid | public function getLanguageUid(int $default = null): int {
$languageUid = $default ?: 0;
if (TYPO3_MODE === 'FE') {
if (isset($GLOBALS['TSFE']->sys_language_uid)) {
$languageUid = $GLOBALS['TSFE']->sys_language_uid;
}
} elseif (is_object($GLOBALS['LANG'])) {
if (isset($GLOBALS['LA... | php | public function getLanguageUid(int $default = null): int {
$languageUid = $default ?: 0;
if (TYPO3_MODE === 'FE') {
if (isset($GLOBALS['TSFE']->sys_language_uid)) {
$languageUid = $GLOBALS['TSFE']->sys_language_uid;
}
} elseif (is_object($GLOBALS['LANG'])) {
if (isset($GLOBALS['LA... | [
"public",
"function",
"getLanguageUid",
"(",
"int",
"$",
"default",
"=",
"null",
")",
":",
"int",
"{",
"$",
"languageUid",
"=",
"$",
"default",
"?",
":",
"0",
";",
"if",
"(",
"TYPO3_MODE",
"===",
"'FE'",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"GLO... | Gets the current language UID.
@param int $default The default language UID, defaults to `0`
@return int The current language UID if available, otherwise the default one | [
"Gets",
"the",
"current",
"language",
"UID",
"."
] | 8c04b7688cc2773f11fcc87fda3f7cd53d80a980 | https://github.com/t3v/t3v_core/blob/8c04b7688cc2773f11fcc87fda3f7cd53d80a980/Classes/Service/LanguageService.php#L48-L62 |
202,115 | brain-diminished/schema-version-control | src/SchemaVersionControlService.php | SchemaVersionControlService.loadSchemaFile | public function loadSchemaFile(): Schema
{
if (!file_exists($this->schemaFile)) {
return new Schema();
}
$content = file_get_contents($this->schemaFile);
$desc = Yaml::parse($content);
if (empty($desc)) {
return new Schema();
}
$build... | php | public function loadSchemaFile(): Schema
{
if (!file_exists($this->schemaFile)) {
return new Schema();
}
$content = file_get_contents($this->schemaFile);
$desc = Yaml::parse($content);
if (empty($desc)) {
return new Schema();
}
$build... | [
"public",
"function",
"loadSchemaFile",
"(",
")",
":",
"Schema",
"{",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"this",
"->",
"schemaFile",
")",
")",
"{",
"return",
"new",
"Schema",
"(",
")",
";",
"}",
"$",
"content",
"=",
"file_get_contents",
"(",
"$",... | Load schema from config file.
@return Schema | [
"Load",
"schema",
"from",
"config",
"file",
"."
] | 215dd96394072720b61a682e10a55a6520470c46 | https://github.com/brain-diminished/schema-version-control/blob/215dd96394072720b61a682e10a55a6520470c46/src/SchemaVersionControlService.php#L52-L66 |
202,116 | brain-diminished/schema-version-control | src/SchemaVersionControlService.php | SchemaVersionControlService.applySchema | public function applySchema(bool $strict = false): array
{
$sqlStatements = $this->getMigrationSql();
foreach ($sqlStatements as $sqlStatement) {
$this->connection->exec($sqlStatement);
}
if ($strict) {
$reorderSql = $this->reorderSql();
$sqlStatem... | php | public function applySchema(bool $strict = false): array
{
$sqlStatements = $this->getMigrationSql();
foreach ($sqlStatements as $sqlStatement) {
$this->connection->exec($sqlStatement);
}
if ($strict) {
$reorderSql = $this->reorderSql();
$sqlStatem... | [
"public",
"function",
"applySchema",
"(",
"bool",
"$",
"strict",
"=",
"false",
")",
":",
"array",
"{",
"$",
"sqlStatements",
"=",
"$",
"this",
"->",
"getMigrationSql",
"(",
")",
";",
"foreach",
"(",
"$",
"sqlStatements",
"as",
"$",
"sqlStatement",
")",
"... | Alter schema in database, according to config file.
@return int | [
"Alter",
"schema",
"in",
"database",
"according",
"to",
"config",
"file",
"."
] | 215dd96394072720b61a682e10a55a6520470c46 | https://github.com/brain-diminished/schema-version-control/blob/215dd96394072720b61a682e10a55a6520470c46/src/SchemaVersionControlService.php#L72-L86 |
202,117 | brain-diminished/schema-version-control | src/SchemaVersionControlService.php | SchemaVersionControlService.getSchemaDiff | public function getSchemaDiff(bool $reverseDiff = false): SchemaDiff
{
$currentSchema = $this->getCurrentSchema();
$newSchema = $this->loadSchemaFile();
$comparator = new Comparator();
if ($reverseDiff) {
return $comparator->compare($newSchema, $currentSchema);
} ... | php | public function getSchemaDiff(bool $reverseDiff = false): SchemaDiff
{
$currentSchema = $this->getCurrentSchema();
$newSchema = $this->loadSchemaFile();
$comparator = new Comparator();
if ($reverseDiff) {
return $comparator->compare($newSchema, $currentSchema);
} ... | [
"public",
"function",
"getSchemaDiff",
"(",
"bool",
"$",
"reverseDiff",
"=",
"false",
")",
":",
"SchemaDiff",
"{",
"$",
"currentSchema",
"=",
"$",
"this",
"->",
"getCurrentSchema",
"(",
")",
";",
"$",
"newSchema",
"=",
"$",
"this",
"->",
"loadSchemaFile",
... | Get diff between current schema and config file
@return SchemaDiff | [
"Get",
"diff",
"between",
"current",
"schema",
"and",
"config",
"file"
] | 215dd96394072720b61a682e10a55a6520470c46 | https://github.com/brain-diminished/schema-version-control/blob/215dd96394072720b61a682e10a55a6520470c46/src/SchemaVersionControlService.php#L102-L112 |
202,118 | brain-diminished/schema-version-control | src/SchemaVersionControlService.php | SchemaVersionControlService.dumpSchema | public function dumpSchema()
{
$schema = $this->getCurrentSchema();
$normalizer = new SchemaNormalizer();
$desc = $normalizer->normalize($schema);
$yamlSchema = Yaml::dump(['schema' =>$desc], 10, 2);
$directory = dirname($this->schemaFile);
if (!file_exists($directory... | php | public function dumpSchema()
{
$schema = $this->getCurrentSchema();
$normalizer = new SchemaNormalizer();
$desc = $normalizer->normalize($schema);
$yamlSchema = Yaml::dump(['schema' =>$desc], 10, 2);
$directory = dirname($this->schemaFile);
if (!file_exists($directory... | [
"public",
"function",
"dumpSchema",
"(",
")",
"{",
"$",
"schema",
"=",
"$",
"this",
"->",
"getCurrentSchema",
"(",
")",
";",
"$",
"normalizer",
"=",
"new",
"SchemaNormalizer",
"(",
")",
";",
"$",
"desc",
"=",
"$",
"normalizer",
"->",
"normalize",
"(",
... | Write current database schema in config file | [
"Write",
"current",
"database",
"schema",
"in",
"config",
"file"
] | 215dd96394072720b61a682e10a55a6520470c46 | https://github.com/brain-diminished/schema-version-control/blob/215dd96394072720b61a682e10a55a6520470c46/src/SchemaVersionControlService.php#L117-L128 |
202,119 | jenskooij/cloudcontrol | src/storage/storage/DocumentTypesStorage.php | DocumentTypesStorage.addDocumentType | public function addDocumentType($postValues)
{
$documentTypeObject = DocumentTypeFactory::createDocumentTypeFromPostValues($postValues);
$documentTypes = $this->repository->documentTypes;
$documentTypes[] = $documentTypeObject;
$this->repository->documentTypes = $documentTypes;
... | php | public function addDocumentType($postValues)
{
$documentTypeObject = DocumentTypeFactory::createDocumentTypeFromPostValues($postValues);
$documentTypes = $this->repository->documentTypes;
$documentTypes[] = $documentTypeObject;
$this->repository->documentTypes = $documentTypes;
... | [
"public",
"function",
"addDocumentType",
"(",
"$",
"postValues",
")",
"{",
"$",
"documentTypeObject",
"=",
"DocumentTypeFactory",
"::",
"createDocumentTypeFromPostValues",
"(",
"$",
"postValues",
")",
";",
"$",
"documentTypes",
"=",
"$",
"this",
"->",
"repository",
... | Add a document type from post values
@param $postValues
@throws \Exception | [
"Add",
"a",
"document",
"type",
"from",
"post",
"values"
] | 76e5d9ac8f9c50d06d39a995d13cc03742536548 | https://github.com/jenskooij/cloudcontrol/blob/76e5d9ac8f9c50d06d39a995d13cc03742536548/src/storage/storage/DocumentTypesStorage.php#L33-L42 |
202,120 | jenskooij/cloudcontrol | src/storage/storage/DocumentTypesStorage.php | DocumentTypesStorage.deleteDocumentTypeBySlug | public function deleteDocumentTypeBySlug($slug)
{
$documentTypes = $this->repository->documentTypes;
foreach ($documentTypes as $key => $documentTypeObject) {
if ($documentTypeObject->slug == $slug) {
unset($documentTypes[$key]);
}
}
$documentT... | php | public function deleteDocumentTypeBySlug($slug)
{
$documentTypes = $this->repository->documentTypes;
foreach ($documentTypes as $key => $documentTypeObject) {
if ($documentTypeObject->slug == $slug) {
unset($documentTypes[$key]);
}
}
$documentT... | [
"public",
"function",
"deleteDocumentTypeBySlug",
"(",
"$",
"slug",
")",
"{",
"$",
"documentTypes",
"=",
"$",
"this",
"->",
"repository",
"->",
"documentTypes",
";",
"foreach",
"(",
"$",
"documentTypes",
"as",
"$",
"key",
"=>",
"$",
"documentTypeObject",
")",
... | Delete document type
@param $slug
@throws \Exception | [
"Delete",
"document",
"type"
] | 76e5d9ac8f9c50d06d39a995d13cc03742536548 | https://github.com/jenskooij/cloudcontrol/blob/76e5d9ac8f9c50d06d39a995d13cc03742536548/src/storage/storage/DocumentTypesStorage.php#L51-L62 |
202,121 | jenskooij/cloudcontrol | src/storage/storage/DocumentTypesStorage.php | DocumentTypesStorage.getDocumentTypeBySlug | public function getDocumentTypeBySlug($slug, $getBricks = false)
{
$documentTypes = $this->repository->documentTypes;
foreach ($documentTypes as $documentType) {
if ($documentType->slug == $slug) {
if ($getBricks === true) {
foreach ($documentType->bri... | php | public function getDocumentTypeBySlug($slug, $getBricks = false)
{
$documentTypes = $this->repository->documentTypes;
foreach ($documentTypes as $documentType) {
if ($documentType->slug == $slug) {
if ($getBricks === true) {
foreach ($documentType->bri... | [
"public",
"function",
"getDocumentTypeBySlug",
"(",
"$",
"slug",
",",
"$",
"getBricks",
"=",
"false",
")",
"{",
"$",
"documentTypes",
"=",
"$",
"this",
"->",
"repository",
"->",
"documentTypes",
";",
"foreach",
"(",
"$",
"documentTypes",
"as",
"$",
"document... | Get document type by its slug
@param $slug
@param bool $getBricks
@return mixed | [
"Get",
"document",
"type",
"by",
"its",
"slug"
] | 76e5d9ac8f9c50d06d39a995d13cc03742536548 | https://github.com/jenskooij/cloudcontrol/blob/76e5d9ac8f9c50d06d39a995d13cc03742536548/src/storage/storage/DocumentTypesStorage.php#L72-L93 |
202,122 | jenskooij/cloudcontrol | src/storage/storage/DocumentTypesStorage.php | DocumentTypesStorage.saveDocumentType | public function saveDocumentType($slug, $postValues)
{
$documentTypeObject = DocumentTypeFactory::createDocumentTypeFromPostValues($postValues);
$documentTypes = $this->repository->documentTypes;
foreach ($documentTypes as $key => $documentType) {
if ($documentType->slug == $slu... | php | public function saveDocumentType($slug, $postValues)
{
$documentTypeObject = DocumentTypeFactory::createDocumentTypeFromPostValues($postValues);
$documentTypes = $this->repository->documentTypes;
foreach ($documentTypes as $key => $documentType) {
if ($documentType->slug == $slu... | [
"public",
"function",
"saveDocumentType",
"(",
"$",
"slug",
",",
"$",
"postValues",
")",
"{",
"$",
"documentTypeObject",
"=",
"DocumentTypeFactory",
"::",
"createDocumentTypeFromPostValues",
"(",
"$",
"postValues",
")",
";",
"$",
"documentTypes",
"=",
"$",
"this",... | Save changes to a document type
@param $slug
@param $postValues
@throws \Exception | [
"Save",
"changes",
"to",
"a",
"document",
"type"
] | 76e5d9ac8f9c50d06d39a995d13cc03742536548 | https://github.com/jenskooij/cloudcontrol/blob/76e5d9ac8f9c50d06d39a995d13cc03742536548/src/storage/storage/DocumentTypesStorage.php#L103-L115 |
202,123 | Eden-PHP/Block | Component/Tree.php | Tree.addItem | public function addItem($path, $object = array(), $class = null)
{
$path = explode('/', $path);
$object['class'] = $class;
$args = array();
foreach($path as $key) {
$args[] = $key;
$args[] = 'children';
}
//soft inject
$tree = eden('registry', $this->tree);
$last = count($args);
fore... | php | public function addItem($path, $object = array(), $class = null)
{
$path = explode('/', $path);
$object['class'] = $class;
$args = array();
foreach($path as $key) {
$args[] = $key;
$args[] = 'children';
}
//soft inject
$tree = eden('registry', $this->tree);
$last = count($args);
fore... | [
"public",
"function",
"addItem",
"(",
"$",
"path",
",",
"$",
"object",
"=",
"array",
"(",
")",
",",
"$",
"class",
"=",
"null",
")",
"{",
"$",
"path",
"=",
"explode",
"(",
"'/'",
",",
"$",
"path",
")",
";",
"$",
"object",
"[",
"'class'",
"]",
"=... | Adds item to the tree
@param string
@param mixed
@return array | [
"Adds",
"item",
"to",
"the",
"tree"
] | 681b9f01dd118612d0fced84d2f702167b52109b | https://github.com/Eden-PHP/Block/blob/681b9f01dd118612d0fced84d2f702167b52109b/Component/Tree.php#L50-L73 |
202,124 | PenoaksDev/Milky-Framework | src/Milky/Database/Eloquent/Nested/SetMapper.php | SetMapper.map | public function map( $modelList )
{
$self = $this;
return $this->wrapInTransaction( function () use ( $self, $modelList )
{
forward_static_call( [get_class( $self->model ), 'unguard'] );
$result = $self->mapTree( $modelList );
forward_static_call( [get_class( $self->model ), 'reguard'] );
return ... | php | public function map( $modelList )
{
$self = $this;
return $this->wrapInTransaction( function () use ( $self, $modelList )
{
forward_static_call( [get_class( $self->model ), 'unguard'] );
$result = $self->mapTree( $modelList );
forward_static_call( [get_class( $self->model ), 'reguard'] );
return ... | [
"public",
"function",
"map",
"(",
"$",
"modelList",
")",
"{",
"$",
"self",
"=",
"$",
"this",
";",
"return",
"$",
"this",
"->",
"wrapInTransaction",
"(",
"function",
"(",
")",
"use",
"(",
"$",
"self",
",",
"$",
"modelList",
")",
"{",
"forward_static_cal... | Maps a tree structure into the database. Unguards & wraps in transaction.
@param array|Arrayable
@return boolean | [
"Maps",
"a",
"tree",
"structure",
"into",
"the",
"database",
".",
"Unguards",
"&",
"wraps",
"in",
"transaction",
"."
] | 8afd7156610a70371aa5b1df50b8a212bf7b142c | https://github.com/PenoaksDev/Milky-Framework/blob/8afd7156610a70371aa5b1df50b8a212bf7b142c/src/Milky/Database/Eloquent/Nested/SetMapper.php#L41-L55 |
202,125 | PenoaksDev/Milky-Framework | src/Milky/Database/Eloquent/Nested/SetMapper.php | SetMapper.mapTree | public function mapTree( $modelList )
{
$tree = $modelList instanceof Arrayable ? $modelList->toArray() : $modelList;
$affectedKeys = [];
$result = $this->mapTreeRecursive( $tree, $this->model->getKey(), $affectedKeys );
if ( $result && count( $affectedKeys ) > 0 )
$this->deleteUnaffected( $affectedKeys ... | php | public function mapTree( $modelList )
{
$tree = $modelList instanceof Arrayable ? $modelList->toArray() : $modelList;
$affectedKeys = [];
$result = $this->mapTreeRecursive( $tree, $this->model->getKey(), $affectedKeys );
if ( $result && count( $affectedKeys ) > 0 )
$this->deleteUnaffected( $affectedKeys ... | [
"public",
"function",
"mapTree",
"(",
"$",
"modelList",
")",
"{",
"$",
"tree",
"=",
"$",
"modelList",
"instanceof",
"Arrayable",
"?",
"$",
"modelList",
"->",
"toArray",
"(",
")",
":",
"$",
"modelList",
";",
"$",
"affectedKeys",
"=",
"[",
"]",
";",
"$",... | Maps a tree structure into the database without unguarding nor wrapping
inside a transaction.
@param array|Arrayable
@return boolean | [
"Maps",
"a",
"tree",
"structure",
"into",
"the",
"database",
"without",
"unguarding",
"nor",
"wrapping",
"inside",
"a",
"transaction",
"."
] | 8afd7156610a70371aa5b1df50b8a212bf7b142c | https://github.com/PenoaksDev/Milky-Framework/blob/8afd7156610a70371aa5b1df50b8a212bf7b142c/src/Milky/Database/Eloquent/Nested/SetMapper.php#L64-L76 |
202,126 | agentmedia/phine-builtin | src/BuiltIn/Modules/Backend/LoginForm.php | LoginForm.SaveElement | protected function SaveElement()
{
$this->login->SetNextUrl($this->selectorNext->Save($this->login->GetNextUrl()));
$this->login->SetPasswordUrl($this->selectorPassword->Save($this->login->GetPasswordUrl()));
return $this->login;
} | php | protected function SaveElement()
{
$this->login->SetNextUrl($this->selectorNext->Save($this->login->GetNextUrl()));
$this->login->SetPasswordUrl($this->selectorPassword->Save($this->login->GetPasswordUrl()));
return $this->login;
} | [
"protected",
"function",
"SaveElement",
"(",
")",
"{",
"$",
"this",
"->",
"login",
"->",
"SetNextUrl",
"(",
"$",
"this",
"->",
"selectorNext",
"->",
"Save",
"(",
"$",
"this",
"->",
"login",
"->",
"GetNextUrl",
"(",
")",
")",
")",
";",
"$",
"this",
"-... | Saves the login element and returns it
@return ContentLogin Returns the login element with form values applied | [
"Saves",
"the",
"login",
"element",
"and",
"returns",
"it"
] | 4dd05bc406a71e997bd4eaa16b12e23dbe62a456 | https://github.com/agentmedia/phine-builtin/blob/4dd05bc406a71e997bd4eaa16b12e23dbe62a456/src/BuiltIn/Modules/Backend/LoginForm.php#L81-L86 |
202,127 | ivopetkov/form-bearframework-addon | classes/Form/Constraints.php | Constraints.setMinLength | public function setMinLength(string $elementName, int $minLength, string $errorMessage = null): \IvoPetkov\BearFrameworkAddons\Form\Constraints
{
if ($errorMessage === null) {
$errorMessage = sprintf(__('ivopetkov.form.The length of this field must be atleast %s characters.'), $minLength);
... | php | public function setMinLength(string $elementName, int $minLength, string $errorMessage = null): \IvoPetkov\BearFrameworkAddons\Form\Constraints
{
if ($errorMessage === null) {
$errorMessage = sprintf(__('ivopetkov.form.The length of this field must be atleast %s characters.'), $minLength);
... | [
"public",
"function",
"setMinLength",
"(",
"string",
"$",
"elementName",
",",
"int",
"$",
"minLength",
",",
"string",
"$",
"errorMessage",
"=",
"null",
")",
":",
"\\",
"IvoPetkov",
"\\",
"BearFrameworkAddons",
"\\",
"Form",
"\\",
"Constraints",
"{",
"if",
"(... | Sets a minimum length requirement for an element
@param string $elementName The element name
@param int $minLength
@param string $errorMessage Error message
@return \IvoPetkov\BearFrameworkAddons\Form\Constraints Returns a reference to itself. | [
"Sets",
"a",
"minimum",
"length",
"requirement",
"for",
"an",
"element"
] | 78ab860c430166805b4e81942eb5a8c32777df01 | https://github.com/ivopetkov/form-bearframework-addon/blob/78ab860c430166805b4e81942eb5a8c32777df01/classes/Form/Constraints.php#L48-L55 |
202,128 | ivopetkov/form-bearframework-addon | classes/Form/Constraints.php | Constraints.setMaxLength | public function setMaxLength(string $elementName, int $maxLength, string $errorMessage = null): \IvoPetkov\BearFrameworkAddons\Form\Constraints
{
if ($errorMessage === null) {
$errorMessage = sprintf(__('ivopetkov.form.The length of this field must be atmost %s characters.'), $maxLength);
... | php | public function setMaxLength(string $elementName, int $maxLength, string $errorMessage = null): \IvoPetkov\BearFrameworkAddons\Form\Constraints
{
if ($errorMessage === null) {
$errorMessage = sprintf(__('ivopetkov.form.The length of this field must be atmost %s characters.'), $maxLength);
... | [
"public",
"function",
"setMaxLength",
"(",
"string",
"$",
"elementName",
",",
"int",
"$",
"maxLength",
",",
"string",
"$",
"errorMessage",
"=",
"null",
")",
":",
"\\",
"IvoPetkov",
"\\",
"BearFrameworkAddons",
"\\",
"Form",
"\\",
"Constraints",
"{",
"if",
"(... | Sets a maximum length requirement for an element
@param string $elementName The element name
@param int $maxLength
@param string $errorMessage Error message
@return \IvoPetkov\BearFrameworkAddons\Form\Constraints Returns a reference to itself. | [
"Sets",
"a",
"maximum",
"length",
"requirement",
"for",
"an",
"element"
] | 78ab860c430166805b4e81942eb5a8c32777df01 | https://github.com/ivopetkov/form-bearframework-addon/blob/78ab860c430166805b4e81942eb5a8c32777df01/classes/Form/Constraints.php#L65-L72 |
202,129 | ivopetkov/form-bearframework-addon | classes/Form/Constraints.php | Constraints.setEmail | public function setEmail(string $elementName, string $errorMessage = null): \IvoPetkov\BearFrameworkAddons\Form\Constraints
{
if ($errorMessage === null) {
$errorMessage = __('ivopetkov.form.This is not a valid email address.');
}
$this->data[] = ['email', $errorMessage, $element... | php | public function setEmail(string $elementName, string $errorMessage = null): \IvoPetkov\BearFrameworkAddons\Form\Constraints
{
if ($errorMessage === null) {
$errorMessage = __('ivopetkov.form.This is not a valid email address.');
}
$this->data[] = ['email', $errorMessage, $element... | [
"public",
"function",
"setEmail",
"(",
"string",
"$",
"elementName",
",",
"string",
"$",
"errorMessage",
"=",
"null",
")",
":",
"\\",
"IvoPetkov",
"\\",
"BearFrameworkAddons",
"\\",
"Form",
"\\",
"Constraints",
"{",
"if",
"(",
"$",
"errorMessage",
"===",
"nu... | Requires the element value to be a valid email address
@param string $elementName The element name
@param string $errorMessage Error message
@return \IvoPetkov\BearFrameworkAddons\Form\Constraints Returns a reference to itself. | [
"Requires",
"the",
"element",
"value",
"to",
"be",
"a",
"valid",
"email",
"address"
] | 78ab860c430166805b4e81942eb5a8c32777df01 | https://github.com/ivopetkov/form-bearframework-addon/blob/78ab860c430166805b4e81942eb5a8c32777df01/classes/Form/Constraints.php#L81-L88 |
202,130 | ivopetkov/form-bearframework-addon | classes/Form/Constraints.php | Constraints.setRegularExpression | public function setRegularExpression(string $elementName, string $regularExpression, string $errorMessage = null): \IvoPetkov\BearFrameworkAddons\Form\Constraints
{
if ($errorMessage === null) {
$errorMessage = __('ivopetkov.form.This is not a valid value.');
}
$this->data[] = ['... | php | public function setRegularExpression(string $elementName, string $regularExpression, string $errorMessage = null): \IvoPetkov\BearFrameworkAddons\Form\Constraints
{
if ($errorMessage === null) {
$errorMessage = __('ivopetkov.form.This is not a valid value.');
}
$this->data[] = ['... | [
"public",
"function",
"setRegularExpression",
"(",
"string",
"$",
"elementName",
",",
"string",
"$",
"regularExpression",
",",
"string",
"$",
"errorMessage",
"=",
"null",
")",
":",
"\\",
"IvoPetkov",
"\\",
"BearFrameworkAddons",
"\\",
"Form",
"\\",
"Constraints",
... | Performs a regular expression validation
@param string $elementName The element name
@param string $regularExpression
@param string $errorMessage Error message
@return \IvoPetkov\BearFrameworkAddons\Form\Constraints Returns a reference to itself. | [
"Performs",
"a",
"regular",
"expression",
"validation"
] | 78ab860c430166805b4e81942eb5a8c32777df01 | https://github.com/ivopetkov/form-bearframework-addon/blob/78ab860c430166805b4e81942eb5a8c32777df01/classes/Form/Constraints.php#L98-L105 |
202,131 | ivopetkov/form-bearframework-addon | classes/Form/Constraints.php | Constraints.validate | public function validate(array $values, array &$errorsList): bool
{
$hasErrors = false;
foreach ($this->data as $item) {
$type = $item[0];
$errorMessage = $item[1];
$elementName = $item[2];
$value = isset($values[$elementName]) ? (string) $values[$elem... | php | public function validate(array $values, array &$errorsList): bool
{
$hasErrors = false;
foreach ($this->data as $item) {
$type = $item[0];
$errorMessage = $item[1];
$elementName = $item[2];
$value = isset($values[$elementName]) ? (string) $values[$elem... | [
"public",
"function",
"validate",
"(",
"array",
"$",
"values",
",",
"array",
"&",
"$",
"errorsList",
")",
":",
"bool",
"{",
"$",
"hasErrors",
"=",
"false",
";",
"foreach",
"(",
"$",
"this",
"->",
"data",
"as",
"$",
"item",
")",
"{",
"$",
"type",
"=... | Validates the values passed
@param array $values The values to checks
@param array $errorsList List of validation errors
@return bool TRUE if no validation errors found. FALSE otherwise. | [
"Validates",
"the",
"values",
"passed"
] | 78ab860c430166805b4e81942eb5a8c32777df01 | https://github.com/ivopetkov/form-bearframework-addon/blob/78ab860c430166805b4e81942eb5a8c32777df01/classes/Form/Constraints.php#L114-L153 |
202,132 | DoSomething/mb-toolbox | src/MB_Toolbox.php | MB_Toolbox.isDSAffiliate | public function isDSAffiliate($targetCountyCode)
{
$foundAffiliate = false;
$affiliates = [
'GB', // United Kingdom
'UK', // United Kingdom
'CA', // Canada
'ID', // Indonesia
'BW', // Botswana
'KE', // Kenya
'GH', // Ghana
'NG', // Nigeria
'CD', // Congo, The Democratic R... | php | public function isDSAffiliate($targetCountyCode)
{
$foundAffiliate = false;
$affiliates = [
'GB', // United Kingdom
'UK', // United Kingdom
'CA', // Canada
'ID', // Indonesia
'BW', // Botswana
'KE', // Kenya
'GH', // Ghana
'NG', // Nigeria
'CD', // Congo, The Democratic R... | [
"public",
"function",
"isDSAffiliate",
"(",
"$",
"targetCountyCode",
")",
"{",
"$",
"foundAffiliate",
"=",
"false",
";",
"$",
"affiliates",
"=",
"[",
"'GB'",
",",
"// United Kingdom",
"'UK'",
",",
"// United Kingdom",
"'CA'",
",",
"// Canada",
"'ID'",
",",
"//... | Test if country code has a DoSomething affiliate.
Follow country code convention defined in:
http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements
@param string $targetCountyCode
Country code to check.
@return boolean/array $foundAffiliate
Test if supplied country code is a DoSomething a... | [
"Test",
"if",
"country",
"code",
"has",
"a",
"DoSomething",
"affiliate",
"."
] | ceec5fc594bae137d1ab1f447344800343b62ac6 | https://github.com/DoSomething/mb-toolbox/blob/ceec5fc594bae137d1ab1f447344800343b62ac6/src/MB_Toolbox.php#L83-L123 |
202,133 | DoSomething/mb-toolbox | src/MB_Toolbox.php | MB_Toolbox.createNorthstarUser | public function createNorthstarUser($user)
{
$northstarAPIConfig = $this->mbConfig->getProperty('northstar_config');
if (empty($northstarAPIConfig['host'])) {
throw new Exception('MB_Toolbox->createNorthstarUser() northstar_config missing host setting.');
}
// Required - at least one of email ... | php | public function createNorthstarUser($user)
{
$northstarAPIConfig = $this->mbConfig->getProperty('northstar_config');
if (empty($northstarAPIConfig['host'])) {
throw new Exception('MB_Toolbox->createNorthstarUser() northstar_config missing host setting.');
}
// Required - at least one of email ... | [
"public",
"function",
"createNorthstarUser",
"(",
"$",
"user",
")",
"{",
"$",
"northstarAPIConfig",
"=",
"$",
"this",
"->",
"mbConfig",
"->",
"getProperty",
"(",
"'northstar_config'",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"northstarAPIConfig",
"[",
"'host'",... | Create a user entry in Northstar, the DoSomething User API.
@param object $user Values used to define the user created in Northstar.
@return object The values returned from Northstar as a result of user creation. | [
"Create",
"a",
"user",
"entry",
"in",
"Northstar",
"the",
"DoSomething",
"User",
"API",
"."
] | ceec5fc594bae137d1ab1f447344800343b62ac6 | https://github.com/DoSomething/mb-toolbox/blob/ceec5fc594bae137d1ab1f447344800343b62ac6/src/MB_Toolbox.php#L212-L293 |
202,134 | DoSomething/mb-toolbox | src/MB_Toolbox.php | MB_Toolbox.lookupNorthstarUser | public function lookupNorthstarUser($user)
{
$northstarAPIConfig = $this->mbConfig->getProperty('northstar_config');
if (empty($northstarAPIConfig['host'])) {
throw new Exception('MB_Toolbox->lookupNorthstarUser() northstar_config missing host setting.');
}
$northstarUrl = $northstarAPIConfig[... | php | public function lookupNorthstarUser($user)
{
$northstarAPIConfig = $this->mbConfig->getProperty('northstar_config');
if (empty($northstarAPIConfig['host'])) {
throw new Exception('MB_Toolbox->lookupNorthstarUser() northstar_config missing host setting.');
}
$northstarUrl = $northstarAPIConfig[... | [
"public",
"function",
"lookupNorthstarUser",
"(",
"$",
"user",
")",
"{",
"$",
"northstarAPIConfig",
"=",
"$",
"this",
"->",
"mbConfig",
"->",
"getProperty",
"(",
"'northstar_config'",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"northstarAPIConfig",
"[",
"'host'",... | Lookup user on Northstar. | [
"Lookup",
"user",
"on",
"Northstar",
"."
] | ceec5fc594bae137d1ab1f447344800343b62ac6 | https://github.com/DoSomething/mb-toolbox/blob/ceec5fc594bae137d1ab1f447344800343b62ac6/src/MB_Toolbox.php#L298-L353 |
202,135 | DoSomething/mb-toolbox | src/MB_Toolbox.php | MB_Toolbox.parseNorthstarUserResponse | public function parseNorthstarUserResponse($response) {
// Check response contains correct data.
if (!is_array($response) || empty($response[0]) || empty($response[1])) {
throw new Exception(
'- Unexpected Northstar response:' . var_export($response, true)
);
}
// Check HTTP code.
... | php | public function parseNorthstarUserResponse($response) {
// Check response contains correct data.
if (!is_array($response) || empty($response[0]) || empty($response[1])) {
throw new Exception(
'- Unexpected Northstar response:' . var_export($response, true)
);
}
// Check HTTP code.
... | [
"public",
"function",
"parseNorthstarUserResponse",
"(",
"$",
"response",
")",
"{",
"// Check response contains correct data.",
"if",
"(",
"!",
"is_array",
"(",
"$",
"response",
")",
"||",
"empty",
"(",
"$",
"response",
"[",
"0",
"]",
")",
"||",
"empty",
"(",
... | Parse Northstar user response, throw exception on failure. | [
"Parse",
"Northstar",
"user",
"response",
"throw",
"exception",
"on",
"failure",
"."
] | ceec5fc594bae137d1ab1f447344800343b62ac6 | https://github.com/DoSomething/mb-toolbox/blob/ceec5fc594bae137d1ab1f447344800343b62ac6/src/MB_Toolbox.php#L358-L387 |
202,136 | gplcart/cli | controllers/commands/User.php | User.cmdGetUser | public function cmdGetUser()
{
$result = $this->getListUser();
$this->outputFormat($result);
$this->outputFormatTableUser($result);
$this->output();
} | php | public function cmdGetUser()
{
$result = $this->getListUser();
$this->outputFormat($result);
$this->outputFormatTableUser($result);
$this->output();
} | [
"public",
"function",
"cmdGetUser",
"(",
")",
"{",
"$",
"result",
"=",
"$",
"this",
"->",
"getListUser",
"(",
")",
";",
"$",
"this",
"->",
"outputFormat",
"(",
"$",
"result",
")",
";",
"$",
"this",
"->",
"outputFormatTableUser",
"(",
"$",
"result",
")"... | Callback for "user-get" command | [
"Callback",
"for",
"user",
"-",
"get",
"command"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/User.php#L41-L47 |
202,137 | gplcart/cli | controllers/commands/User.php | User.cmdUpdateUser | public function cmdUpdateUser()
{
$params = $this->getParam();
if (empty($params[0]) || count($params) < 2) {
$this->errorAndExit($this->text('Invalid command'));
}
if (!is_numeric($params[0])) {
$this->errorAndExit($this->text('Invalid argument'));
... | php | public function cmdUpdateUser()
{
$params = $this->getParam();
if (empty($params[0]) || count($params) < 2) {
$this->errorAndExit($this->text('Invalid command'));
}
if (!is_numeric($params[0])) {
$this->errorAndExit($this->text('Invalid argument'));
... | [
"public",
"function",
"cmdUpdateUser",
"(",
")",
"{",
"$",
"params",
"=",
"$",
"this",
"->",
"getParam",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"params",
"[",
"0",
"]",
")",
"||",
"count",
"(",
"$",
"params",
")",
"<",
"2",
")",
"{",
"$",... | Callback for "user-update" command | [
"Callback",
"for",
"user",
"-",
"update",
"command"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/User.php#L106-L126 |
202,138 | gplcart/cli | controllers/commands/User.php | User.submitAddUser | protected function submitAddUser()
{
$this->setSubmitted(null, $this->getParam());
$this->setSubmittedJson('data');
$this->validateComponent('user');
$this->addUser();
} | php | protected function submitAddUser()
{
$this->setSubmitted(null, $this->getParam());
$this->setSubmittedJson('data');
$this->validateComponent('user');
$this->addUser();
} | [
"protected",
"function",
"submitAddUser",
"(",
")",
"{",
"$",
"this",
"->",
"setSubmitted",
"(",
"null",
",",
"$",
"this",
"->",
"getParam",
"(",
")",
")",
";",
"$",
"this",
"->",
"setSubmittedJson",
"(",
"'data'",
")",
";",
"$",
"this",
"->",
"validat... | Add a new user at once | [
"Add",
"a",
"new",
"user",
"at",
"once"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/User.php#L208-L215 |
202,139 | gplcart/cli | controllers/commands/User.php | User.addUser | protected function addUser()
{
if (!$this->isError()) {
$id = $this->user->add($this->getSubmitted());
if (empty($id)) {
$this->errorAndExit($this->text('Unexpected result'));
}
$this->line($id);
}
} | php | protected function addUser()
{
if (!$this->isError()) {
$id = $this->user->add($this->getSubmitted());
if (empty($id)) {
$this->errorAndExit($this->text('Unexpected result'));
}
$this->line($id);
}
} | [
"protected",
"function",
"addUser",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"isError",
"(",
")",
")",
"{",
"$",
"id",
"=",
"$",
"this",
"->",
"user",
"->",
"add",
"(",
"$",
"this",
"->",
"getSubmitted",
"(",
")",
")",
";",
"if",
"(",
... | Add a new user | [
"Add",
"a",
"new",
"user"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/User.php#L220-L229 |
202,140 | gplcart/cli | controllers/commands/User.php | User.wizardAddUser | protected function wizardAddUser()
{
// Required
$this->validatePrompt('email', $this->text('E-mail'), 'user');
$this->validatePrompt('password', $this->text('Password'), 'user');
$this->validatePrompt('name', $this->text('Name'), 'user');
// Optional
$this->validate... | php | protected function wizardAddUser()
{
// Required
$this->validatePrompt('email', $this->text('E-mail'), 'user');
$this->validatePrompt('password', $this->text('Password'), 'user');
$this->validatePrompt('name', $this->text('Name'), 'user');
// Optional
$this->validate... | [
"protected",
"function",
"wizardAddUser",
"(",
")",
"{",
"// Required",
"$",
"this",
"->",
"validatePrompt",
"(",
"'email'",
",",
"$",
"this",
"->",
"text",
"(",
"'E-mail'",
")",
",",
"'user'",
")",
";",
"$",
"this",
"->",
"validatePrompt",
"(",
"'password... | Add a new user step by step | [
"Add",
"a",
"new",
"user",
"step",
"by",
"step"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/User.php#L234-L251 |
202,141 | gplcart/cli | controllers/commands/User.php | User.setStatusUser | public function setStatusUser($status)
{
$options = $id = $result = null;
if ($this->getParam('all')) {
$options = array();
} else {
$id = $this->getParam(0);
if (!is_numeric($id)) { // Allow 0 for roleless users
$this->errorAndExit($thi... | php | public function setStatusUser($status)
{
$options = $id = $result = null;
if ($this->getParam('all')) {
$options = array();
} else {
$id = $this->getParam(0);
if (!is_numeric($id)) { // Allow 0 for roleless users
$this->errorAndExit($thi... | [
"public",
"function",
"setStatusUser",
"(",
"$",
"status",
")",
"{",
"$",
"options",
"=",
"$",
"id",
"=",
"$",
"result",
"=",
"null",
";",
"if",
"(",
"$",
"this",
"->",
"getParam",
"(",
"'all'",
")",
")",
"{",
"$",
"options",
"=",
"array",
"(",
"... | Sets a user status
@param $status | [
"Sets",
"a",
"user",
"status"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/User.php#L257-L295 |
202,142 | locomotivemtl/charcoal-queue | src/Charcoal/Queue/QueueableTrait.php | QueueableTrait.setQueueId | public function setQueueId($id)
{
if ($id === null) {
$this->queueId = null;
return $this;
}
if (!is_string($id)) {
throw new InvalidArgumentException(
'Queue ID must be a string'
);
}
$this->queueId = $id;
... | php | public function setQueueId($id)
{
if ($id === null) {
$this->queueId = null;
return $this;
}
if (!is_string($id)) {
throw new InvalidArgumentException(
'Queue ID must be a string'
);
}
$this->queueId = $id;
... | [
"public",
"function",
"setQueueId",
"(",
"$",
"id",
")",
"{",
"if",
"(",
"$",
"id",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"queueId",
"=",
"null",
";",
"return",
"$",
"this",
";",
"}",
"if",
"(",
"!",
"is_string",
"(",
"$",
"id",
")",
")",... | Set the queue's ID.
@param string|null $id The unique queue identifier.
@throws InvalidArgumentException If the ID isn't a string.
@return self | [
"Set",
"the",
"queue",
"s",
"ID",
"."
] | 90c47581cd35fbb554eca513f909171a70325b44 | https://github.com/locomotivemtl/charcoal-queue/blob/90c47581cd35fbb554eca513f909171a70325b44/src/Charcoal/Queue/QueueableTrait.php#L26-L42 |
202,143 | zewadesign/framework | Zewa/App.php | App.initialize | public function initialize()
{
$request = $this->router->getAction();
$isRouteCallback = $this->processRequestParameters($request);
$this->start($isRouteCallback);
return $this;
} | php | public function initialize()
{
$request = $this->router->getAction();
$isRouteCallback = $this->processRequestParameters($request);
$this->start($isRouteCallback);
return $this;
} | [
"public",
"function",
"initialize",
"(",
")",
"{",
"$",
"request",
"=",
"$",
"this",
"->",
"router",
"->",
"getAction",
"(",
")",
";",
"$",
"isRouteCallback",
"=",
"$",
"this",
"->",
"processRequestParameters",
"(",
"$",
"request",
")",
";",
"$",
"this",... | Calls the proper shell for app execution
@access private | [
"Calls",
"the",
"proper",
"shell",
"for",
"app",
"execution"
] | be74e41c674ac2c2ef924752ed310cfbaafe33b8 | https://github.com/zewadesign/framework/blob/be74e41c674ac2c2ef924752ed310cfbaafe33b8/Zewa/App.php#L71-L80 |
202,144 | 19ft/NFHtmlToText | HtmlToText.php | HtmlToText.processNode | protected function processNode($node)
{
if ($node instanceof DOMDocumentType) {
return '';
}
if ($node instanceof DOMText) {
// return the plain text
return preg_replace("/\\s+/im", " ", $node->wholeText);
}
$tag = strtolower($node->nodeN... | php | protected function processNode($node)
{
if ($node instanceof DOMDocumentType) {
return '';
}
if ($node instanceof DOMText) {
// return the plain text
return preg_replace("/\\s+/im", " ", $node->wholeText);
}
$tag = strtolower($node->nodeN... | [
"protected",
"function",
"processNode",
"(",
"$",
"node",
")",
"{",
"if",
"(",
"$",
"node",
"instanceof",
"DOMDocumentType",
")",
"{",
"return",
"''",
";",
"}",
"if",
"(",
"$",
"node",
"instanceof",
"DOMText",
")",
"{",
"// return the plain text",
"return",
... | Recursively called method that creates the plain text required for a
give tag.
NOTE: This is rather simplistic and only handles reasonably well
structured block tags along with OL and UL lists. All inline tags are
ignored.
@param DOMNode $node DOM node to process
@return string plain text representation of the... | [
"Recursively",
"called",
"method",
"that",
"creates",
"the",
"plain",
"text",
"required",
"for",
"a",
"give",
"tag",
"."
] | d7be8382d23c1ba5960b22f487c9915d4f4ebb3c | https://github.com/19ft/NFHtmlToText/blob/d7be8382d23c1ba5960b22f487c9915d4f4ebb3c/HtmlToText.php#L102-L165 |
202,145 | 19ft/NFHtmlToText | HtmlToText.php | HtmlToText.lastTagName | protected function lastTagName($node)
{
$lastNode = $node->previousSibling;
while ($lastNode != null) {
if ($lastNode instanceof DOMElement) {
break;
}
$lastNode = $lastNode->previousSibling;
}
$lastTag = '';
if ($lastNode i... | php | protected function lastTagName($node)
{
$lastNode = $node->previousSibling;
while ($lastNode != null) {
if ($lastNode instanceof DOMElement) {
break;
}
$lastNode = $lastNode->previousSibling;
}
$lastTag = '';
if ($lastNode i... | [
"protected",
"function",
"lastTagName",
"(",
"$",
"node",
")",
"{",
"$",
"lastNode",
"=",
"$",
"node",
"->",
"previousSibling",
";",
"while",
"(",
"$",
"lastNode",
"!=",
"null",
")",
"{",
"if",
"(",
"$",
"lastNode",
"instanceof",
"DOMElement",
")",
"{",
... | Find the previous sibling tag name for this node
@param DOMNode $node DOM node
@return string tag name | [
"Find",
"the",
"previous",
"sibling",
"tag",
"name",
"for",
"this",
"node"
] | d7be8382d23c1ba5960b22f487c9915d4f4ebb3c | https://github.com/19ft/NFHtmlToText/blob/d7be8382d23c1ba5960b22f487c9915d4f4ebb3c/HtmlToText.php#L173-L188 |
202,146 | 19ft/NFHtmlToText | HtmlToText.php | HtmlToText.nextTagName | protected function nextTagName($node)
{
$nextNode = $node->nextSibling;
while ($nextNode != null) {
if ($nextNode instanceof DOMElement) {
break;
}
$nextNode = $nextNode->nextSibling;
}
$nextTag = '';
if ($nextNode instanceo... | php | protected function nextTagName($node)
{
$nextNode = $node->nextSibling;
while ($nextNode != null) {
if ($nextNode instanceof DOMElement) {
break;
}
$nextNode = $nextNode->nextSibling;
}
$nextTag = '';
if ($nextNode instanceo... | [
"protected",
"function",
"nextTagName",
"(",
"$",
"node",
")",
"{",
"$",
"nextNode",
"=",
"$",
"node",
"->",
"nextSibling",
";",
"while",
"(",
"$",
"nextNode",
"!=",
"null",
")",
"{",
"if",
"(",
"$",
"nextNode",
"instanceof",
"DOMElement",
")",
"{",
"b... | Find the next sibling tag name for this node
@param DOMNode $node DOM node
@return string tag name | [
"Find",
"the",
"next",
"sibling",
"tag",
"name",
"for",
"this",
"node"
] | d7be8382d23c1ba5960b22f487c9915d4f4ebb3c | https://github.com/19ft/NFHtmlToText/blob/d7be8382d23c1ba5960b22f487c9915d4f4ebb3c/HtmlToText.php#L196-L211 |
202,147 | Vectrex/vxPHP | src/Security/Csrf/CsrfTokenSessionStorage.php | CsrfTokenSessionStorage.getToken | public function getToken($tokenId) {
$sessionToken = $this->sessionDataBag->get($this->namespace . '/' . $tokenId);
if(!$sessionToken) {
throw new CsrfTokenException(sprintf("CSRF token with id '%s' not found.", $tokenId));
}
return $sessionToken;
} | php | public function getToken($tokenId) {
$sessionToken = $this->sessionDataBag->get($this->namespace . '/' . $tokenId);
if(!$sessionToken) {
throw new CsrfTokenException(sprintf("CSRF token with id '%s' not found.", $tokenId));
}
return $sessionToken;
} | [
"public",
"function",
"getToken",
"(",
"$",
"tokenId",
")",
"{",
"$",
"sessionToken",
"=",
"$",
"this",
"->",
"sessionDataBag",
"->",
"get",
"(",
"$",
"this",
"->",
"namespace",
".",
"'/'",
".",
"$",
"tokenId",
")",
";",
"if",
"(",
"!",
"$",
"session... | retrieves token stored in session under namespaced token id
@param string $tokenId
@return string
@throws CsrfTokenException | [
"retrieves",
"token",
"stored",
"in",
"session",
"under",
"namespaced",
"token",
"id"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Security/Csrf/CsrfTokenSessionStorage.php#L69-L78 |
202,148 | Vectrex/vxPHP | src/Security/Csrf/CsrfTokenSessionStorage.php | CsrfTokenSessionStorage.setToken | public function setToken($tokenId, CsrfToken $token) {
if(!trim((string) $tokenId)) {
throw new \InvalidArgumentException('Invalid token id.');
}
$this->sessionDataBag->set(
$this->namespace . '/' . $tokenId,
$token
);
} | php | public function setToken($tokenId, CsrfToken $token) {
if(!trim((string) $tokenId)) {
throw new \InvalidArgumentException('Invalid token id.');
}
$this->sessionDataBag->set(
$this->namespace . '/' . $tokenId,
$token
);
} | [
"public",
"function",
"setToken",
"(",
"$",
"tokenId",
",",
"CsrfToken",
"$",
"token",
")",
"{",
"if",
"(",
"!",
"trim",
"(",
"(",
"string",
")",
"$",
"tokenId",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'Invalid token id.'",
... | store token under namespaced token id in session
@param string $tokenId
@param CsrfToken $token
@throws \InvalidArgumentException | [
"store",
"token",
"under",
"namespaced",
"token",
"id",
"in",
"session"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Security/Csrf/CsrfTokenSessionStorage.php#L88-L98 |
202,149 | MinyFramework/Miny-Core | src/Shutdown/ShutdownService.php | ShutdownService.register | public function register(callable $callback, $priority = null)
{
$priority = $this->getPriority($priority);
if (!isset($this->callbacks[$priority])) {
$this->callbacks[$priority] = [];
}
$this->callbacks[$priority][] = $callback;
$this->lowestPriority = max($prior... | php | public function register(callable $callback, $priority = null)
{
$priority = $this->getPriority($priority);
if (!isset($this->callbacks[$priority])) {
$this->callbacks[$priority] = [];
}
$this->callbacks[$priority][] = $callback;
$this->lowestPriority = max($prior... | [
"public",
"function",
"register",
"(",
"callable",
"$",
"callback",
",",
"$",
"priority",
"=",
"null",
")",
"{",
"$",
"priority",
"=",
"$",
"this",
"->",
"getPriority",
"(",
"$",
"priority",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
... | Registers a callback to be called on shutdown.
@param callable $callback
@param null|int $priority The priority of the callback. Lowest number means higher priority.
@throws \InvalidArgumentException | [
"Registers",
"a",
"callback",
"to",
"be",
"called",
"on",
"shutdown",
"."
] | a1bfe801a44a49cf01f16411cb4663473e9c827c | https://github.com/MinyFramework/Miny-Core/blob/a1bfe801a44a49cf01f16411cb4663473e9c827c/src/Shutdown/ShutdownService.php#L33-L41 |
202,150 | Wedeto/HTTP | src/ProcessChain.php | ProcessChain.addProcessor | public function addProcessor(Processor $processor, int $precedence = ProcessChain::RUN_DEFAULT)
{
return $this->appendProcessor($processor, static::STAGE_PROCESS, $precedence);
} | php | public function addProcessor(Processor $processor, int $precedence = ProcessChain::RUN_DEFAULT)
{
return $this->appendProcessor($processor, static::STAGE_PROCESS, $precedence);
} | [
"public",
"function",
"addProcessor",
"(",
"Processor",
"$",
"processor",
",",
"int",
"$",
"precedence",
"=",
"ProcessChain",
"::",
"RUN_DEFAULT",
")",
"{",
"return",
"$",
"this",
"->",
"appendProcessor",
"(",
"$",
"processor",
",",
"static",
"::",
"STAGE_PROC... | Add a processor to the chain in the PROCESS stage. Any operator in this stage is expected
to produce a response.
@param Processor $processor The processor to add
@param int $precedence The precedence - the lower this value, the higher it will be put in the chain
@return $this Provides fluent interface. | [
"Add",
"a",
"processor",
"to",
"the",
"chain",
"in",
"the",
"PROCESS",
"stage",
".",
"Any",
"operator",
"in",
"this",
"stage",
"is",
"expected",
"to",
"produce",
"a",
"response",
"."
] | 7318eff1b81a3c103c4263466d09b7f3593b70b9 | https://github.com/Wedeto/HTTP/blob/7318eff1b81a3c103c4263466d09b7f3593b70b9/src/ProcessChain.php#L88-L91 |
202,151 | Wedeto/HTTP | src/ProcessChain.php | ProcessChain.addPostProcessor | public function addPostProcessor(Processor $processor, int $precedence = ProcessChain::RUN_DEFAULT)
{
return $this->appendProcessor($processor, static::STAGE_POSTPROCESS, $precedence);
} | php | public function addPostProcessor(Processor $processor, int $precedence = ProcessChain::RUN_DEFAULT)
{
return $this->appendProcessor($processor, static::STAGE_POSTPROCESS, $precedence);
} | [
"public",
"function",
"addPostProcessor",
"(",
"Processor",
"$",
"processor",
",",
"int",
"$",
"precedence",
"=",
"ProcessChain",
"::",
"RUN_DEFAULT",
")",
"{",
"return",
"$",
"this",
"->",
"appendProcessor",
"(",
"$",
"processor",
",",
"static",
"::",
"STAGE_... | Adds a post processor to the pipeline. A postprocessor is a filter that
operates on the response rather than producing it.
@param Processor $processor The Processor to add
@param int $precedence The precedence - the lower this value, the higher it will be put in the chain
@return $this Provides fluent interface | [
"Adds",
"a",
"post",
"processor",
"to",
"the",
"pipeline",
".",
"A",
"postprocessor",
"is",
"a",
"filter",
"that",
"operates",
"on",
"the",
"response",
"rather",
"than",
"producing",
"it",
"."
] | 7318eff1b81a3c103c4263466d09b7f3593b70b9 | https://github.com/Wedeto/HTTP/blob/7318eff1b81a3c103c4263466d09b7f3593b70b9/src/ProcessChain.php#L101-L104 |
202,152 | Wedeto/HTTP | src/ProcessChain.php | ProcessChain.appendProcessor | protected function appendProcessor(Processor $processor, int $stage, int $precedence = ProcessChain::RUN_DEFAULT)
{
$stage = WF::clamp($stage, static::STAGE_FILTER, static::STAGE_POSTPROCESS);
$precedence = WF::clamp($precedence, static::RUN_FIRST, static::RUN_LAST);
$this->processors[] = [
... | php | protected function appendProcessor(Processor $processor, int $stage, int $precedence = ProcessChain::RUN_DEFAULT)
{
$stage = WF::clamp($stage, static::STAGE_FILTER, static::STAGE_POSTPROCESS);
$precedence = WF::clamp($precedence, static::RUN_FIRST, static::RUN_LAST);
$this->processors[] = [
... | [
"protected",
"function",
"appendProcessor",
"(",
"Processor",
"$",
"processor",
",",
"int",
"$",
"stage",
",",
"int",
"$",
"precedence",
"=",
"ProcessChain",
"::",
"RUN_DEFAULT",
")",
"{",
"$",
"stage",
"=",
"WF",
"::",
"clamp",
"(",
"$",
"stage",
",",
"... | Helper to add a processor to the pipeline
@param Wedeto\HTTP\Processor $processor The processor to add
@param int $stage The stage - STAGE_PREPROCESS, STAGE_PROCESS or STAGE_POSTPROCESS
@param int $precedence The precedence of the processor - the lower, the sooner it will be placed
in its stage.
@return $this Provides... | [
"Helper",
"to",
"add",
"a",
"processor",
"to",
"the",
"pipeline"
] | 7318eff1b81a3c103c4263466d09b7f3593b70b9 | https://github.com/Wedeto/HTTP/blob/7318eff1b81a3c103c4263466d09b7f3593b70b9/src/ProcessChain.php#L115-L135 |
202,153 | Wedeto/HTTP | src/ProcessChain.php | ProcessChain.getProcessors | public function getProcessors(int $stage)
{
$list = [];
foreach ($this->processors as $proc)
{
if ($proc['stage'] === $stage)
$list[] = $proc['processor'];
}
return $list;
} | php | public function getProcessors(int $stage)
{
$list = [];
foreach ($this->processors as $proc)
{
if ($proc['stage'] === $stage)
$list[] = $proc['processor'];
}
return $list;
} | [
"public",
"function",
"getProcessors",
"(",
"int",
"$",
"stage",
")",
"{",
"$",
"list",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"processors",
"as",
"$",
"proc",
")",
"{",
"if",
"(",
"$",
"proc",
"[",
"'stage'",
"]",
"===",
"$",
"st... | Get a list of processor for a stage
@param int $stage The stage for which to get a list of processor
@return array The list of processor for the stage | [
"Get",
"a",
"list",
"of",
"processor",
"for",
"a",
"stage"
] | 7318eff1b81a3c103c4263466d09b7f3593b70b9 | https://github.com/Wedeto/HTTP/blob/7318eff1b81a3c103c4263466d09b7f3593b70b9/src/ProcessChain.php#L142-L151 |
202,154 | Wedeto/HTTP | src/ProcessChain.php | ProcessChain.process | public function process(Request $request)
{
$result = new Result;
$stage = static::STAGE_FILTER;
foreach ($this->processors as $processor)
{
if ($processor['stage'] < $stage)
continue;
$stage = $processor['stage'];
$processor = $... | php | public function process(Request $request)
{
$result = new Result;
$stage = static::STAGE_FILTER;
foreach ($this->processors as $processor)
{
if ($processor['stage'] < $stage)
continue;
$stage = $processor['stage'];
$processor = $... | [
"public",
"function",
"process",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"result",
"=",
"new",
"Result",
";",
"$",
"stage",
"=",
"static",
"::",
"STAGE_FILTER",
";",
"foreach",
"(",
"$",
"this",
"->",
"processors",
"as",
"$",
"processor",
")",
"... | Process a request - put it through the pipeline and return the response. The request
will be routed through each processor until one throws an exception at which point the
stage is advanced to the post processing stage.
@param Request $request The request to process
@return Result The produced response | [
"Process",
"a",
"request",
"-",
"put",
"it",
"through",
"the",
"pipeline",
"and",
"return",
"the",
"response",
".",
"The",
"request",
"will",
"be",
"routed",
"through",
"each",
"processor",
"until",
"one",
"throws",
"an",
"exception",
"at",
"which",
"point",... | 7318eff1b81a3c103c4263466d09b7f3593b70b9 | https://github.com/Wedeto/HTTP/blob/7318eff1b81a3c103c4263466d09b7f3593b70b9/src/ProcessChain.php#L161-L186 |
202,155 | judus/minimal-http | src/Request.php | Request.fetchRequestMethod | public function fetchRequestMethod($server = null)
{
$server || $server = $this->_SERVER;
if (isset($_POST['_method'])) {
if (
strtoupper($_POST['_method']) == 'PUT' ||
strtoupper($_POST['_method']) == 'PATCH' ||
strtoupper($_POST['_method... | php | public function fetchRequestMethod($server = null)
{
$server || $server = $this->_SERVER;
if (isset($_POST['_method'])) {
if (
strtoupper($_POST['_method']) == 'PUT' ||
strtoupper($_POST['_method']) == 'PATCH' ||
strtoupper($_POST['_method... | [
"public",
"function",
"fetchRequestMethod",
"(",
"$",
"server",
"=",
"null",
")",
"{",
"$",
"server",
"||",
"$",
"server",
"=",
"$",
"this",
"->",
"_SERVER",
";",
"if",
"(",
"isset",
"(",
"$",
"_POST",
"[",
"'_method'",
"]",
")",
")",
"{",
"if",
"(... | Fetch the http method | [
"Fetch",
"the",
"http",
"method"
] | 13c49e1350488acea8acf44ab5ed7796a39a9f1a | https://github.com/judus/minimal-http/blob/13c49e1350488acea8acf44ab5ed7796a39a9f1a/src/Request.php#L496-L515 |
202,156 | judus/minimal-http | src/Request.php | Request.parseCliArgs | public function parseCliArgs($server = null)
{
$server || $server = $this->_SERVER;
if (!isset($server['argv'])) {
throw new \Exception('$_SERVER["argv"] is not available');
}
$args = array_slice($server['argv'], 1);
return $args ? '/' . implode('/', $args) : '... | php | public function parseCliArgs($server = null)
{
$server || $server = $this->_SERVER;
if (!isset($server['argv'])) {
throw new \Exception('$_SERVER["argv"] is not available');
}
$args = array_slice($server['argv'], 1);
return $args ? '/' . implode('/', $args) : '... | [
"public",
"function",
"parseCliArgs",
"(",
"$",
"server",
"=",
"null",
")",
"{",
"$",
"server",
"||",
"$",
"server",
"=",
"$",
"this",
"->",
"_SERVER",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"server",
"[",
"'argv'",
"]",
")",
")",
"{",
"throw",
... | Formats cli args like a uri
@return string
@throws \Exception | [
"Formats",
"cli",
"args",
"like",
"a",
"uri"
] | 13c49e1350488acea8acf44ab5ed7796a39a9f1a | https://github.com/judus/minimal-http/blob/13c49e1350488acea8acf44ab5ed7796a39a9f1a/src/Request.php#L552-L563 |
202,157 | judus/minimal-http | src/Request.php | Request.explodeSegments | public function explodeSegments($uri)
{
$segments = [];
$pattern = "|/*(.+?)/*$|";
$elements = explode("/", preg_replace($pattern, "\\1", $uri));
foreach ($elements as $val) {
$val = trim($this->filterUri($val));
empty($val) || $segments[] = $val;
}
... | php | public function explodeSegments($uri)
{
$segments = [];
$pattern = "|/*(.+?)/*$|";
$elements = explode("/", preg_replace($pattern, "\\1", $uri));
foreach ($elements as $val) {
$val = trim($this->filterUri($val));
empty($val) || $segments[] = $val;
}
... | [
"public",
"function",
"explodeSegments",
"(",
"$",
"uri",
")",
"{",
"$",
"segments",
"=",
"[",
"]",
";",
"$",
"pattern",
"=",
"\"|/*(.+?)/*$|\"",
";",
"$",
"elements",
"=",
"explode",
"(",
"\"/\"",
",",
"preg_replace",
"(",
"$",
"pattern",
",",
"\"\\\\1\... | Explodes the uri string | [
"Explodes",
"the",
"uri",
"string"
] | 13c49e1350488acea8acf44ab5ed7796a39a9f1a | https://github.com/judus/minimal-http/blob/13c49e1350488acea8acf44ab5ed7796a39a9f1a/src/Request.php#L583-L596 |
202,158 | jabernardo/lollipop-php | Library/System/File.php | File.write | static function write($filename, $contents, $overwriteExisting = true) {
if (file_exists($filename) && self::isWritable($filename)) {
if ($overwriteExisting) unlink($filename);
}
file_put_contents($filename, $contents);
} | php | static function write($filename, $contents, $overwriteExisting = true) {
if (file_exists($filename) && self::isWritable($filename)) {
if ($overwriteExisting) unlink($filename);
}
file_put_contents($filename, $contents);
} | [
"static",
"function",
"write",
"(",
"$",
"filename",
",",
"$",
"contents",
",",
"$",
"overwriteExisting",
"=",
"true",
")",
"{",
"if",
"(",
"file_exists",
"(",
"$",
"filename",
")",
"&&",
"self",
"::",
"isWritable",
"(",
"$",
"filename",
")",
")",
"{",... | Create or updates file
@param string $filename File to create or update
@param string $contents Contents to write into file
@param bool $overwriteExisting Overwrite existing file | [
"Create",
"or",
"updates",
"file"
] | 004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5 | https://github.com/jabernardo/lollipop-php/blob/004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5/Library/System/File.php#L47-L53 |
202,159 | jabernardo/lollipop-php | Library/System/File.php | File.read | static function read($filename) {
if (file_exists($filename) && self::isReadable($filename)) {
return file_get_contents($filename);
}
return NULL;
} | php | static function read($filename) {
if (file_exists($filename) && self::isReadable($filename)) {
return file_get_contents($filename);
}
return NULL;
} | [
"static",
"function",
"read",
"(",
"$",
"filename",
")",
"{",
"if",
"(",
"file_exists",
"(",
"$",
"filename",
")",
"&&",
"self",
"::",
"isReadable",
"(",
"$",
"filename",
")",
")",
"{",
"return",
"file_get_contents",
"(",
"$",
"filename",
")",
";",
"}"... | Gets the contents of a file
@param string $filename File to be read
@return string | [
"Gets",
"the",
"contents",
"of",
"a",
"file"
] | 004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5 | https://github.com/jabernardo/lollipop-php/blob/004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5/Library/System/File.php#L62-L68 |
202,160 | jabernardo/lollipop-php | Library/System/File.php | File.rename | static function rename($src, $dest) {
if (self::exists($dest)) {
throw new \Lollipop\Exception\Runtime('File already exists: ' . $dest);
}
if (is_uploaded_file($src)) {
return \move_uploaded_file($src, $dest);
}
return \rename($src, $dest... | php | static function rename($src, $dest) {
if (self::exists($dest)) {
throw new \Lollipop\Exception\Runtime('File already exists: ' . $dest);
}
if (is_uploaded_file($src)) {
return \move_uploaded_file($src, $dest);
}
return \rename($src, $dest... | [
"static",
"function",
"rename",
"(",
"$",
"src",
",",
"$",
"dest",
")",
"{",
"if",
"(",
"self",
"::",
"exists",
"(",
"$",
"dest",
")",
")",
"{",
"throw",
"new",
"\\",
"Lollipop",
"\\",
"Exception",
"\\",
"Runtime",
"(",
"'File already exists: '",
".",
... | Alias rename file
@param string $src Source file
@param string $dest Destination file
@return int | [
"Alias",
"rename",
"file"
] | 004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5 | https://github.com/jabernardo/lollipop-php/blob/004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5/Library/System/File.php#L116-L126 |
202,161 | ValkSystems/bootbuilder | src/bootbuilder/Controls/Control.php | Control.isValid | public function isValid() {
if($this->isRequired()) {
if($this->getValue() == null) return false;
if($this->getValue() == "") return false;
}
return true;
} | php | public function isValid() {
if($this->isRequired()) {
if($this->getValue() == null) return false;
if($this->getValue() == "") return false;
}
return true;
} | [
"public",
"function",
"isValid",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"isRequired",
"(",
")",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getValue",
"(",
")",
"==",
"null",
")",
"return",
"false",
";",
"if",
"(",
"$",
"this",
"->",
"getValue... | Validate value of control
@return boolean validation successfully? | [
"Validate",
"value",
"of",
"control"
] | 7601a403f42eba47ce4cf02a3c852d5196b1d860 | https://github.com/ValkSystems/bootbuilder/blob/7601a403f42eba47ce4cf02a3c852d5196b1d860/src/bootbuilder/Controls/Control.php#L227-L233 |
202,162 | ValkSystems/bootbuilder | src/bootbuilder/Controls/Control.php | Control.getCompiledAttributes | protected function getCompiledAttributes($prependClass = "", $skipValue = false) {
$attrs = "";
if($this->id) $attrs .= " id='$this->id'";
$attrs .= " class='$prependClass $this->class'";
if($this->name) $attrs .= " name='$this->name'";
if($this->placeholder) $attrs .= " placehol... | php | protected function getCompiledAttributes($prependClass = "", $skipValue = false) {
$attrs = "";
if($this->id) $attrs .= " id='$this->id'";
$attrs .= " class='$prependClass $this->class'";
if($this->name) $attrs .= " name='$this->name'";
if($this->placeholder) $attrs .= " placehol... | [
"protected",
"function",
"getCompiledAttributes",
"(",
"$",
"prependClass",
"=",
"\"\"",
",",
"$",
"skipValue",
"=",
"false",
")",
"{",
"$",
"attrs",
"=",
"\"\"",
";",
"if",
"(",
"$",
"this",
"->",
"id",
")",
"$",
"attrs",
".=",
"\" id='$this->id'\"",
";... | Compile the HTML attributes for using in the controls tag
@param string $prependClass
@param boolean $skipValue
@return string Compiled attributes | [
"Compile",
"the",
"HTML",
"attributes",
"for",
"using",
"in",
"the",
"controls",
"tag"
] | 7601a403f42eba47ce4cf02a3c852d5196b1d860 | https://github.com/ValkSystems/bootbuilder/blob/7601a403f42eba47ce4cf02a3c852d5196b1d860/src/bootbuilder/Controls/Control.php#L241-L254 |
202,163 | anime-db/catalog-bundle | src/Controller/HomeController.php | HomeController.searchSimpleFormAction | public function searchSimpleFormAction()
{
$form = new SearchSimple($this->generateUrl('home_autocomplete_name'));
return $this->render('AnimeDbCatalogBundle:Home:searchSimpleForm.html.twig', [
'form' => $this->createForm($form)->createView(),
]);
} | php | public function searchSimpleFormAction()
{
$form = new SearchSimple($this->generateUrl('home_autocomplete_name'));
return $this->render('AnimeDbCatalogBundle:Home:searchSimpleForm.html.twig', [
'form' => $this->createForm($form)->createView(),
]);
} | [
"public",
"function",
"searchSimpleFormAction",
"(",
")",
"{",
"$",
"form",
"=",
"new",
"SearchSimple",
"(",
"$",
"this",
"->",
"generateUrl",
"(",
"'home_autocomplete_name'",
")",
")",
";",
"return",
"$",
"this",
"->",
"render",
"(",
"'AnimeDbCatalogBundle:Home... | Search simple form.
@return Response | [
"Search",
"simple",
"form",
"."
] | 631b6f92a654e91bee84f46218c52cf42bdb8606 | https://github.com/anime-db/catalog-bundle/blob/631b6f92a654e91bee84f46218c52cf42bdb8606/src/Controller/HomeController.php#L110-L117 |
202,164 | anime-db/catalog-bundle | src/Controller/HomeController.php | HomeController.autocompleteNameAction | public function autocompleteNameAction(Request $request)
{
/* @var $response JsonResponse */
$response = $this->getCacheTimeKeeper()
->getResponse('AnimeDbCatalogBundle:Item', -1, new JsonResponse());
// response was not modified for this request
if ($response->isNotModif... | php | public function autocompleteNameAction(Request $request)
{
/* @var $response JsonResponse */
$response = $this->getCacheTimeKeeper()
->getResponse('AnimeDbCatalogBundle:Item', -1, new JsonResponse());
// response was not modified for this request
if ($response->isNotModif... | [
"public",
"function",
"autocompleteNameAction",
"(",
"Request",
"$",
"request",
")",
"{",
"/* @var $response JsonResponse */",
"$",
"response",
"=",
"$",
"this",
"->",
"getCacheTimeKeeper",
"(",
")",
"->",
"getResponse",
"(",
"'AnimeDbCatalogBundle:Item'",
",",
"-",
... | Autocomplete name.
@param Request $request
@return Response | [
"Autocomplete",
"name",
"."
] | 631b6f92a654e91bee84f46218c52cf42bdb8606 | https://github.com/anime-db/catalog-bundle/blob/631b6f92a654e91bee84f46218c52cf42bdb8606/src/Controller/HomeController.php#L126-L158 |
202,165 | anime-db/catalog-bundle | src/Controller/HomeController.php | HomeController.searchAction | public function searchAction(Request $request)
{
$response = $this->getCacheTimeKeeper()
->getResponse(['AnimeDbCatalogBundle:Item', 'AnimeDbCatalogBundle:Storage']);
// response was not modified for this request
if ($response->isNotModified($request)) {
return $respo... | php | public function searchAction(Request $request)
{
$response = $this->getCacheTimeKeeper()
->getResponse(['AnimeDbCatalogBundle:Item', 'AnimeDbCatalogBundle:Storage']);
// response was not modified for this request
if ($response->isNotModified($request)) {
return $respo... | [
"public",
"function",
"searchAction",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"getCacheTimeKeeper",
"(",
")",
"->",
"getResponse",
"(",
"[",
"'AnimeDbCatalogBundle:Item'",
",",
"'AnimeDbCatalogBundle:Storage'",
"]",
")",
... | Search item.
@param Request $request
@return Response | [
"Search",
"item",
"."
] | 631b6f92a654e91bee84f46218c52cf42bdb8606 | https://github.com/anime-db/catalog-bundle/blob/631b6f92a654e91bee84f46218c52cf42bdb8606/src/Controller/HomeController.php#L167-L223 |
202,166 | anime-db/catalog-bundle | src/Controller/HomeController.php | HomeController.settingsAction | public function settingsAction(Request $request)
{
$response = $this->getCacheTimeKeeper()->getResponse();
// response was not modified for this request
if ($response->isNotModified($request)) {
return $response;
}
$entity = (new GeneralEntity())
->se... | php | public function settingsAction(Request $request)
{
$response = $this->getCacheTimeKeeper()->getResponse();
// response was not modified for this request
if ($response->isNotModified($request)) {
return $response;
}
$entity = (new GeneralEntity())
->se... | [
"public",
"function",
"settingsAction",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"getCacheTimeKeeper",
"(",
")",
"->",
"getResponse",
"(",
")",
";",
"// response was not modified for this request",
"if",
"(",
"$",
"respo... | General settings.
@param Request $request
@return Response | [
"General",
"settings",
"."
] | 631b6f92a654e91bee84f46218c52cf42bdb8606 | https://github.com/anime-db/catalog-bundle/blob/631b6f92a654e91bee84f46218c52cf42bdb8606/src/Controller/HomeController.php#L232-L268 |
202,167 | FusePump/cli.php | lib/FusePump/Cli/Logger.php | Logger.log | public static function log($message, $options = array())
{
if (array_key_exists('inputs', $options)) {
$inputs = $options['inputs'];
} else {
$inputs = array(
self::getTimestamp(),
'LOG',
self::getFilename(),
sel... | php | public static function log($message, $options = array())
{
if (array_key_exists('inputs', $options)) {
$inputs = $options['inputs'];
} else {
$inputs = array(
self::getTimestamp(),
'LOG',
self::getFilename(),
sel... | [
"public",
"static",
"function",
"log",
"(",
"$",
"message",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"'inputs'",
",",
"$",
"options",
")",
")",
"{",
"$",
"inputs",
"=",
"$",
"options",
"[",
"'inputs'"... | Output log message
@param string $message
@param array $options
@static | [
"Output",
"log",
"message"
] | 2cc92f09ce7b2f73d5cbc09f5ae4f31f3f9ae3b4 | https://github.com/FusePump/cli.php/blob/2cc92f09ce7b2f73d5cbc09f5ae4f31f3f9ae3b4/lib/FusePump/Cli/Logger.php#L33-L64 |
202,168 | FusePump/cli.php | lib/FusePump/Cli/Logger.php | Logger.warn | public static function warn($message, $options = array())
{
$options['inputs'] = array(
self::getTimestamp(),
'WARN',
self::getFilename(),
self::getLineNumber()
);
self::log($message, $options);
} | php | public static function warn($message, $options = array())
{
$options['inputs'] = array(
self::getTimestamp(),
'WARN',
self::getFilename(),
self::getLineNumber()
);
self::log($message, $options);
} | [
"public",
"static",
"function",
"warn",
"(",
"$",
"message",
",",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"$",
"options",
"[",
"'inputs'",
"]",
"=",
"array",
"(",
"self",
"::",
"getTimestamp",
"(",
")",
",",
"'WARN'",
",",
"self",
"::",
"... | Output warn message
@param string $message
@param array $options
@static | [
"Output",
"warn",
"message"
] | 2cc92f09ce7b2f73d5cbc09f5ae4f31f3f9ae3b4 | https://github.com/FusePump/cli.php/blob/2cc92f09ce7b2f73d5cbc09f5ae4f31f3f9ae3b4/lib/FusePump/Cli/Logger.php#L95-L104 |
202,169 | wobblecode/WobbleCodeUserBundle | Manager/UserManager.php | UserManager.createUserFromOAuth | public function createUserFromOAuth($data)
{
$user = $this->createUser();
$user->setAuthDataByProvider($data['provider'], ['id' => $data['id'], 'token' => $data['token']]);
$user->setAuthProvider($data['provider']);
$user->setFirstAuthProvider($data['provider']);
$user->setUs... | php | public function createUserFromOAuth($data)
{
$user = $this->createUser();
$user->setAuthDataByProvider($data['provider'], ['id' => $data['id'], 'token' => $data['token']]);
$user->setAuthProvider($data['provider']);
$user->setFirstAuthProvider($data['provider']);
$user->setUs... | [
"public",
"function",
"createUserFromOAuth",
"(",
"$",
"data",
")",
"{",
"$",
"user",
"=",
"$",
"this",
"->",
"createUser",
"(",
")",
";",
"$",
"user",
"->",
"setAuthDataByProvider",
"(",
"$",
"data",
"[",
"'provider'",
"]",
",",
"[",
"'id'",
"=>",
"$"... | Creates a new User from oAuth data
@param array $data Normalized oAuth data
@return User | [
"Creates",
"a",
"new",
"User",
"from",
"oAuth",
"data"
] | 7b8206f8b4a50fbc61f7bfe4f83eb466cad96440 | https://github.com/wobblecode/WobbleCodeUserBundle/blob/7b8206f8b4a50fbc61f7bfe4f83eb466cad96440/Manager/UserManager.php#L67-L80 |
202,170 | wobblecode/WobbleCodeUserBundle | Manager/UserManager.php | UserManager.updateFromGeoIp | public function updateFromGeoIp(User $user, array $ipInfo)
{
$contact = $user->getContact();
$country = $contact->getCountry();
$city = $contact->getCity();
$region = $contact->getRegion();
if (!$country) {
$contact->setCountry($ipInfo['country']);
}
... | php | public function updateFromGeoIp(User $user, array $ipInfo)
{
$contact = $user->getContact();
$country = $contact->getCountry();
$city = $contact->getCity();
$region = $contact->getRegion();
if (!$country) {
$contact->setCountry($ipInfo['country']);
}
... | [
"public",
"function",
"updateFromGeoIp",
"(",
"User",
"$",
"user",
",",
"array",
"$",
"ipInfo",
")",
"{",
"$",
"contact",
"=",
"$",
"user",
"->",
"getContact",
"(",
")",
";",
"$",
"country",
"=",
"$",
"contact",
"->",
"getCountry",
"(",
")",
";",
"$"... | Update User contact data from geoIp
@param User $user
@param array $ipInfo
@return self | [
"Update",
"User",
"contact",
"data",
"from",
"geoIp"
] | 7b8206f8b4a50fbc61f7bfe4f83eb466cad96440 | https://github.com/wobblecode/WobbleCodeUserBundle/blob/7b8206f8b4a50fbc61f7bfe4f83eb466cad96440/Manager/UserManager.php#L90-L112 |
202,171 | wobblecode/WobbleCodeUserBundle | Manager/UserManager.php | UserManager.signupLog | public function signupLog(User $user, array $ipInfo)
{
$user->setAttribute('signupIp', $ipInfo);
$this->dm->persist($user);
$this->dm->flush();
return $this;
} | php | public function signupLog(User $user, array $ipInfo)
{
$user->setAttribute('signupIp', $ipInfo);
$this->dm->persist($user);
$this->dm->flush();
return $this;
} | [
"public",
"function",
"signupLog",
"(",
"User",
"$",
"user",
",",
"array",
"$",
"ipInfo",
")",
"{",
"$",
"user",
"->",
"setAttribute",
"(",
"'signupIp'",
",",
"$",
"ipInfo",
")",
";",
"$",
"this",
"->",
"dm",
"->",
"persist",
"(",
"$",
"user",
")",
... | Set signup attributes for geoIp on signup
@param User $user
@param array $geoIp
@return self | [
"Set",
"signup",
"attributes",
"for",
"geoIp",
"on",
"signup"
] | 7b8206f8b4a50fbc61f7bfe4f83eb466cad96440 | https://github.com/wobblecode/WobbleCodeUserBundle/blob/7b8206f8b4a50fbc61f7bfe4f83eb466cad96440/Manager/UserManager.php#L122-L129 |
202,172 | wobblecode/WobbleCodeUserBundle | Manager/UserManager.php | UserManager.loginLog | public function loginLog(User $user, array $geoIp)
{
$geoIp['date'] = date('Y-m-d H:i:s');
$loginIps = $user->getAttribute('lastLoginIps');
if (!$loginIps) {
$loginIps = [];
}
array_unshift($loginIps, $geoIp);
$loginIps = array_slice($loginIps, 0, 3);
... | php | public function loginLog(User $user, array $geoIp)
{
$geoIp['date'] = date('Y-m-d H:i:s');
$loginIps = $user->getAttribute('lastLoginIps');
if (!$loginIps) {
$loginIps = [];
}
array_unshift($loginIps, $geoIp);
$loginIps = array_slice($loginIps, 0, 3);
... | [
"public",
"function",
"loginLog",
"(",
"User",
"$",
"user",
",",
"array",
"$",
"geoIp",
")",
"{",
"$",
"geoIp",
"[",
"'date'",
"]",
"=",
"date",
"(",
"'Y-m-d H:i:s'",
")",
";",
"$",
"loginIps",
"=",
"$",
"user",
"->",
"getAttribute",
"(",
"'lastLoginIp... | Save login geoIp last 20 events
@param User $user
@param array $geoIp
@return self | [
"Save",
"login",
"geoIp",
"last",
"20",
"events"
] | 7b8206f8b4a50fbc61f7bfe4f83eb466cad96440 | https://github.com/wobblecode/WobbleCodeUserBundle/blob/7b8206f8b4a50fbc61f7bfe4f83eb466cad96440/Manager/UserManager.php#L139-L156 |
202,173 | wobblecode/WobbleCodeUserBundle | Manager/UserManager.php | UserManager.setLocale | public function setLocale(User $user, $locale)
{
$user->getContact()->setLocale($locale);
$this->dm->persist($user);
$this->dm->flush();
return $this;
} | php | public function setLocale(User $user, $locale)
{
$user->getContact()->setLocale($locale);
$this->dm->persist($user);
$this->dm->flush();
return $this;
} | [
"public",
"function",
"setLocale",
"(",
"User",
"$",
"user",
",",
"$",
"locale",
")",
"{",
"$",
"user",
"->",
"getContact",
"(",
")",
"->",
"setLocale",
"(",
"$",
"locale",
")",
";",
"$",
"this",
"->",
"dm",
"->",
"persist",
"(",
"$",
"user",
")",
... | Set locale for an user
@param User $user
@param $locale
@return $this | [
"Set",
"locale",
"for",
"an",
"user"
] | 7b8206f8b4a50fbc61f7bfe4f83eb466cad96440 | https://github.com/wobblecode/WobbleCodeUserBundle/blob/7b8206f8b4a50fbc61f7bfe4f83eb466cad96440/Manager/UserManager.php#L166-L174 |
202,174 | wobblecode/WobbleCodeUserBundle | Manager/UserManager.php | UserManager.enableRememberMe | public function enableRememberMe($user)
{
$rememberMeValue = $this->generateRememberMeCookie($user->getUsername());
$this->session->set('REMEMBER_ME', $rememberMeValue);
} | php | public function enableRememberMe($user)
{
$rememberMeValue = $this->generateRememberMeCookie($user->getUsername());
$this->session->set('REMEMBER_ME', $rememberMeValue);
} | [
"public",
"function",
"enableRememberMe",
"(",
"$",
"user",
")",
"{",
"$",
"rememberMeValue",
"=",
"$",
"this",
"->",
"generateRememberMeCookie",
"(",
"$",
"user",
"->",
"getUsername",
"(",
")",
")",
";",
"$",
"this",
"->",
"session",
"->",
"set",
"(",
"... | Enable Remember Me feature
@param User | [
"Enable",
"Remember",
"Me",
"feature"
] | 7b8206f8b4a50fbc61f7bfe4f83eb466cad96440 | https://github.com/wobblecode/WobbleCodeUserBundle/blob/7b8206f8b4a50fbc61f7bfe4f83eb466cad96440/Manager/UserManager.php#L198-L202 |
202,175 | wobblecode/WobbleCodeUserBundle | Manager/UserManager.php | UserManager.generateRememberMeCookie | protected function generateRememberMeCookie($username)
{
$key = 'ThisTokenIsNotSoSecretChangeIt';
$class = 'WobbleCode\UserBundle\Document\User';
$password = 'none';
$expires = time()+2592000;
$hash = hash('sha256', $class.$username.$expires.$password.$key);
return ... | php | protected function generateRememberMeCookie($username)
{
$key = 'ThisTokenIsNotSoSecretChangeIt';
$class = 'WobbleCode\UserBundle\Document\User';
$password = 'none';
$expires = time()+2592000;
$hash = hash('sha256', $class.$username.$expires.$password.$key);
return ... | [
"protected",
"function",
"generateRememberMeCookie",
"(",
"$",
"username",
")",
"{",
"$",
"key",
"=",
"'ThisTokenIsNotSoSecretChangeIt'",
";",
"$",
"class",
"=",
"'WobbleCode\\UserBundle\\Document\\User'",
";",
"$",
"password",
"=",
"'none'",
";",
"$",
"expires",
"=... | Generate remember me cookie final value
@todo Add bundle option to define the class name
@todo Add bundle option to get the expire time
@todo Add functionality to get the secret key from service
@param string $username Username to remember
@return string Cookie final value | [
"Generate",
"remember",
"me",
"cookie",
"final",
"value"
] | 7b8206f8b4a50fbc61f7bfe4f83eb466cad96440 | https://github.com/wobblecode/WobbleCodeUserBundle/blob/7b8206f8b4a50fbc61f7bfe4f83eb466cad96440/Manager/UserManager.php#L215-L225 |
202,176 | modulusphp/http | Request.php | Request.ip | public function ip($return_type = null, $ip_addresses = [])
{
$ip_elements = array(
'HTTP_X_FORWARDED_FOR', 'HTTP_FORWARDED_FOR',
'HTTP_X_FORWARDED', 'HTTP_FORWARDED',
'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_CLUSTER_CLIENT_IP',
'HTTP_X_CLIENT_IP', 'HTTP_CLIENT_IP',
'REMOTE_ADDR'
);
... | php | public function ip($return_type = null, $ip_addresses = [])
{
$ip_elements = array(
'HTTP_X_FORWARDED_FOR', 'HTTP_FORWARDED_FOR',
'HTTP_X_FORWARDED', 'HTTP_FORWARDED',
'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_CLUSTER_CLIENT_IP',
'HTTP_X_CLIENT_IP', 'HTTP_CLIENT_IP',
'REMOTE_ADDR'
);
... | [
"public",
"function",
"ip",
"(",
"$",
"return_type",
"=",
"null",
",",
"$",
"ip_addresses",
"=",
"[",
"]",
")",
"{",
"$",
"ip_elements",
"=",
"array",
"(",
"'HTTP_X_FORWARDED_FOR'",
",",
"'HTTP_FORWARDED_FOR'",
",",
"'HTTP_X_FORWARDED'",
",",
"'HTTP_FORWARDED'",... | Get client ip address
@return void | [
"Get",
"client",
"ip",
"address"
] | fc5c0f2b582a04de1685578d3fb790686a0a240c | https://github.com/modulusphp/http/blob/fc5c0f2b582a04de1685578d3fb790686a0a240c/Request.php#L80-L111 |
202,177 | Hnto/nuki | src/Handlers/Database/PDO.php | PDO.insert | public function insert($query, array $data){
$this->conn->prepare($query)->execute($data);
return $this->conn->lastInsertId();
} | php | public function insert($query, array $data){
$this->conn->prepare($query)->execute($data);
return $this->conn->lastInsertId();
} | [
"public",
"function",
"insert",
"(",
"$",
"query",
",",
"array",
"$",
"data",
")",
"{",
"$",
"this",
"->",
"conn",
"->",
"prepare",
"(",
"$",
"query",
")",
"->",
"execute",
"(",
"$",
"data",
")",
";",
"return",
"$",
"this",
"->",
"conn",
"->",
"l... | Insert a record in the storage
@param string $query
@param array $data
@return string the last inserted id | [
"Insert",
"a",
"record",
"in",
"the",
"storage"
] | c3fb16244e8d611c335a88e3b9c9ee7d81fafc0c | https://github.com/Hnto/nuki/blob/c3fb16244e8d611c335a88e3b9c9ee7d81fafc0c/src/Handlers/Database/PDO.php#L40-L44 |
202,178 | Hnto/nuki | src/Handlers/Database/PDO.php | PDO.update | public function update($query, array $data) {
$stmt = $this->executeQuery($query, $data);
return $stmt->rowCount();
} | php | public function update($query, array $data) {
$stmt = $this->executeQuery($query, $data);
return $stmt->rowCount();
} | [
"public",
"function",
"update",
"(",
"$",
"query",
",",
"array",
"$",
"data",
")",
"{",
"$",
"stmt",
"=",
"$",
"this",
"->",
"executeQuery",
"(",
"$",
"query",
",",
"$",
"data",
")",
";",
"return",
"$",
"stmt",
"->",
"rowCount",
"(",
")",
";",
"}... | Update an existing record in the storage
@param string $query
@param array $data
@return int the number of rows | [
"Update",
"an",
"existing",
"record",
"in",
"the",
"storage"
] | c3fb16244e8d611c335a88e3b9c9ee7d81fafc0c | https://github.com/Hnto/nuki/blob/c3fb16244e8d611c335a88e3b9c9ee7d81fafc0c/src/Handlers/Database/PDO.php#L53-L57 |
202,179 | Hnto/nuki | src/Handlers/Database/PDO.php | PDO.delete | public function delete($query, array $data) {
$stmt = $this->executeQuery($query, $data);
return $stmt->rowCount();
} | php | public function delete($query, array $data) {
$stmt = $this->executeQuery($query, $data);
return $stmt->rowCount();
} | [
"public",
"function",
"delete",
"(",
"$",
"query",
",",
"array",
"$",
"data",
")",
"{",
"$",
"stmt",
"=",
"$",
"this",
"->",
"executeQuery",
"(",
"$",
"query",
",",
"$",
"data",
")",
";",
"return",
"$",
"stmt",
"->",
"rowCount",
"(",
")",
";",
"}... | Delete a record in the storage
@param string $query
@param array $data
@return int the number of rows | [
"Delete",
"a",
"record",
"in",
"the",
"storage"
] | c3fb16244e8d611c335a88e3b9c9ee7d81fafc0c | https://github.com/Hnto/nuki/blob/c3fb16244e8d611c335a88e3b9c9ee7d81fafc0c/src/Handlers/Database/PDO.php#L66-L70 |
202,180 | Hnto/nuki | src/Handlers/Database/PDO.php | PDO.findOne | public function findOne($query, array $data = null) {
$stmt = $this->executeQuery($query, $data);
return $stmt->fetch(\PDO::FETCH_ASSOC);
} | php | public function findOne($query, array $data = null) {
$stmt = $this->executeQuery($query, $data);
return $stmt->fetch(\PDO::FETCH_ASSOC);
} | [
"public",
"function",
"findOne",
"(",
"$",
"query",
",",
"array",
"$",
"data",
"=",
"null",
")",
"{",
"$",
"stmt",
"=",
"$",
"this",
"->",
"executeQuery",
"(",
"$",
"query",
",",
"$",
"data",
")",
";",
"return",
"$",
"stmt",
"->",
"fetch",
"(",
"... | Fetch a record from the storage
@param string $query
@param array $data
@return object data as object | [
"Fetch",
"a",
"record",
"from",
"the",
"storage"
] | c3fb16244e8d611c335a88e3b9c9ee7d81fafc0c | https://github.com/Hnto/nuki/blob/c3fb16244e8d611c335a88e3b9c9ee7d81fafc0c/src/Handlers/Database/PDO.php#L79-L83 |
202,181 | Hnto/nuki | src/Handlers/Database/PDO.php | PDO.findMany | public function findMany($query, array $data = null){
$stmt = $this->executeQuery($query, $data);
return($stmt->fetchAll(\PDO::FETCH_ASSOC));
} | php | public function findMany($query, array $data = null){
$stmt = $this->executeQuery($query, $data);
return($stmt->fetchAll(\PDO::FETCH_ASSOC));
} | [
"public",
"function",
"findMany",
"(",
"$",
"query",
",",
"array",
"$",
"data",
"=",
"null",
")",
"{",
"$",
"stmt",
"=",
"$",
"this",
"->",
"executeQuery",
"(",
"$",
"query",
",",
"$",
"data",
")",
";",
"return",
"(",
"$",
"stmt",
"->",
"fetchAll",... | Fetch all records from a certain location in the storage
@param string $query
@param array $data
@return object as object | [
"Fetch",
"all",
"records",
"from",
"a",
"certain",
"location",
"in",
"the",
"storage"
] | c3fb16244e8d611c335a88e3b9c9ee7d81fafc0c | https://github.com/Hnto/nuki/blob/c3fb16244e8d611c335a88e3b9c9ee7d81fafc0c/src/Handlers/Database/PDO.php#L92-L96 |
202,182 | Hnto/nuki | src/Handlers/Database/PDO.php | PDO.executeQuery | private function executeQuery($query, $data = null) {
$stmt = $this->conn->prepare($query);
$stmt->execute($data);
return $stmt;
} | php | private function executeQuery($query, $data = null) {
$stmt = $this->conn->prepare($query);
$stmt->execute($data);
return $stmt;
} | [
"private",
"function",
"executeQuery",
"(",
"$",
"query",
",",
"$",
"data",
"=",
"null",
")",
"{",
"$",
"stmt",
"=",
"$",
"this",
"->",
"conn",
"->",
"prepare",
"(",
"$",
"query",
")",
";",
"$",
"stmt",
"->",
"execute",
"(",
"$",
"data",
")",
";"... | Execute a raw query
@param string $query
@param array $data
@return object statement object | [
"Execute",
"a",
"raw",
"query"
] | c3fb16244e8d611c335a88e3b9c9ee7d81fafc0c | https://github.com/Hnto/nuki/blob/c3fb16244e8d611c335a88e3b9c9ee7d81fafc0c/src/Handlers/Database/PDO.php#L105-L110 |
202,183 | vpg/titon.utility | src/Titon/Utility/Hash.php | Hash.each | public static function each(array $set, Closure $callback, $recursive = true) {
foreach ($set as $key => $value) {
if (is_array($value) && $recursive) {
$set[$key] = static::each($value, $callback, $recursive);
} else {
$set[$key] = $callback($value, $key)... | php | public static function each(array $set, Closure $callback, $recursive = true) {
foreach ($set as $key => $value) {
if (is_array($value) && $recursive) {
$set[$key] = static::each($value, $callback, $recursive);
} else {
$set[$key] = $callback($value, $key)... | [
"public",
"static",
"function",
"each",
"(",
"array",
"$",
"set",
",",
"Closure",
"$",
"callback",
",",
"$",
"recursive",
"=",
"true",
")",
"{",
"foreach",
"(",
"$",
"set",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"is_array",
"(",... | Calls a function for each key-value pair in the set.
If recursive is true, will apply the callback to nested arrays as well.
@param array $set
@param \Closure $callback
@param bool $recursive
@return array | [
"Calls",
"a",
"function",
"for",
"each",
"key",
"-",
"value",
"pair",
"in",
"the",
"set",
".",
"If",
"recursive",
"is",
"true",
"will",
"apply",
"the",
"callback",
"to",
"nested",
"arrays",
"as",
"well",
"."
] | 8a77eb9e7b8baacf41cc25487289779d8319cd3a | https://github.com/vpg/titon.utility/blob/8a77eb9e7b8baacf41cc25487289779d8319cd3a/src/Titon/Utility/Hash.php#L66-L76 |
202,184 | vpg/titon.utility | src/Titon/Utility/Hash.php | Hash.every | public static function every(array $set, Closure $callback) {
foreach ($set as $key => $value) {
if (!$callback($value, $key)) {
return false;
}
}
return true;
} | php | public static function every(array $set, Closure $callback) {
foreach ($set as $key => $value) {
if (!$callback($value, $key)) {
return false;
}
}
return true;
} | [
"public",
"static",
"function",
"every",
"(",
"array",
"$",
"set",
",",
"Closure",
"$",
"callback",
")",
"{",
"foreach",
"(",
"$",
"set",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"$",
"callback",
"(",
"$",
"value",
",",
"$"... | Returns true if every element in the array satisfies the provided testing function.
@param array $set
@param \Closure $callback
@return bool | [
"Returns",
"true",
"if",
"every",
"element",
"in",
"the",
"array",
"satisfies",
"the",
"provided",
"testing",
"function",
"."
] | 8a77eb9e7b8baacf41cc25487289779d8319cd3a | https://github.com/vpg/titon.utility/blob/8a77eb9e7b8baacf41cc25487289779d8319cd3a/src/Titon/Utility/Hash.php#L85-L93 |
202,185 | vpg/titon.utility | src/Titon/Utility/Hash.php | Hash.expand | public static function expand(array $set) {
$data = array();
foreach ($set as $key => $value) {
$data = static::insert($data, $key, $value);
}
return $data;
} | php | public static function expand(array $set) {
$data = array();
foreach ($set as $key => $value) {
$data = static::insert($data, $key, $value);
}
return $data;
} | [
"public",
"static",
"function",
"expand",
"(",
"array",
"$",
"set",
")",
"{",
"$",
"data",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"set",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"data",
"=",
"static",
"::",
"insert",
"(",
... | Expand an array to a fully workable multi-dimensional array, where the values key is a dot notated path.
@param array $set
@return array | [
"Expand",
"an",
"array",
"to",
"a",
"fully",
"workable",
"multi",
"-",
"dimensional",
"array",
"where",
"the",
"values",
"key",
"is",
"a",
"dot",
"notated",
"path",
"."
] | 8a77eb9e7b8baacf41cc25487289779d8319cd3a | https://github.com/vpg/titon.utility/blob/8a77eb9e7b8baacf41cc25487289779d8319cd3a/src/Titon/Utility/Hash.php#L116-L124 |
202,186 | vpg/titon.utility | src/Titon/Utility/Hash.php | Hash.extract | public static function extract(array $set, $path) {
if (!$set) {
return null;
}
// Exit early for faster processing
if (strpos($path, '.') === false) {
return isset($set[$path]) ? $set[$path] : null;
}
$search =& $set;
$paths = explode('.... | php | public static function extract(array $set, $path) {
if (!$set) {
return null;
}
// Exit early for faster processing
if (strpos($path, '.') === false) {
return isset($set[$path]) ? $set[$path] : null;
}
$search =& $set;
$paths = explode('.... | [
"public",
"static",
"function",
"extract",
"(",
"array",
"$",
"set",
",",
"$",
"path",
")",
"{",
"if",
"(",
"!",
"$",
"set",
")",
"{",
"return",
"null",
";",
"}",
"// Exit early for faster processing",
"if",
"(",
"strpos",
"(",
"$",
"path",
",",
"'.'",... | Extract the value of an array, depending on the paths given, represented by key.key.key notation.
@param array $set
@param string $path
@return mixed | [
"Extract",
"the",
"value",
"of",
"an",
"array",
"depending",
"on",
"the",
"paths",
"given",
"represented",
"by",
"key",
".",
"key",
".",
"key",
"notation",
"."
] | 8a77eb9e7b8baacf41cc25487289779d8319cd3a | https://github.com/vpg/titon.utility/blob/8a77eb9e7b8baacf41cc25487289779d8319cd3a/src/Titon/Utility/Hash.php#L133-L165 |
202,187 | vpg/titon.utility | src/Titon/Utility/Hash.php | Hash.flatten | public static function flatten(array $set, $path = null) {
if ($path) {
$path = $path . '.';
}
$data = array();
foreach ($set as $key => $value) {
if (is_array($value)) {
if ($value) {
$data += static::flatten($value, $path . ... | php | public static function flatten(array $set, $path = null) {
if ($path) {
$path = $path . '.';
}
$data = array();
foreach ($set as $key => $value) {
if (is_array($value)) {
if ($value) {
$data += static::flatten($value, $path . ... | [
"public",
"static",
"function",
"flatten",
"(",
"array",
"$",
"set",
",",
"$",
"path",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"path",
")",
"{",
"$",
"path",
"=",
"$",
"path",
".",
"'.'",
";",
"}",
"$",
"data",
"=",
"array",
"(",
")",
";",
"fo... | Flatten a multi-dimensional array by returning the values with their keys representing their previous pathing.
@param array $set
@param string $path
@return array | [
"Flatten",
"a",
"multi",
"-",
"dimensional",
"array",
"by",
"returning",
"the",
"values",
"with",
"their",
"keys",
"representing",
"their",
"previous",
"pathing",
"."
] | 8a77eb9e7b8baacf41cc25487289779d8319cd3a | https://github.com/vpg/titon.utility/blob/8a77eb9e7b8baacf41cc25487289779d8319cd3a/src/Titon/Utility/Hash.php#L201-L221 |
202,188 | vpg/titon.utility | src/Titon/Utility/Hash.php | Hash.inject | public static function inject(array $set, $path, $value) {
if (static::has($set, $path)) {
return $set;
}
return static::insert($set, $path, $value);
} | php | public static function inject(array $set, $path, $value) {
if (static::has($set, $path)) {
return $set;
}
return static::insert($set, $path, $value);
} | [
"public",
"static",
"function",
"inject",
"(",
"array",
"$",
"set",
",",
"$",
"path",
",",
"$",
"value",
")",
"{",
"if",
"(",
"static",
"::",
"has",
"(",
"$",
"set",
",",
"$",
"path",
")",
")",
"{",
"return",
"$",
"set",
";",
"}",
"return",
"st... | Includes the specified key-value pair in the set if the key doesn't already exist.
@param array $set
@param string $path
@param mixed $value
@return array | [
"Includes",
"the",
"specified",
"key",
"-",
"value",
"pair",
"in",
"the",
"set",
"if",
"the",
"key",
"doesn",
"t",
"already",
"exist",
"."
] | 8a77eb9e7b8baacf41cc25487289779d8319cd3a | https://github.com/vpg/titon.utility/blob/8a77eb9e7b8baacf41cc25487289779d8319cd3a/src/Titon/Utility/Hash.php#L320-L326 |
202,189 | vpg/titon.utility | src/Titon/Utility/Hash.php | Hash.insert | public static function insert(array $set, $path, $value) {
if (!$path) {
return $set;
}
// Exit early for faster processing
if (strpos($path, '.') === false) {
$set[$path] = $value;
return $set;
}
$search =& $set;
$paths = ex... | php | public static function insert(array $set, $path, $value) {
if (!$path) {
return $set;
}
// Exit early for faster processing
if (strpos($path, '.') === false) {
$set[$path] = $value;
return $set;
}
$search =& $set;
$paths = ex... | [
"public",
"static",
"function",
"insert",
"(",
"array",
"$",
"set",
",",
"$",
"path",
",",
"$",
"value",
")",
"{",
"if",
"(",
"!",
"$",
"path",
")",
"{",
"return",
"$",
"set",
";",
"}",
"// Exit early for faster processing",
"if",
"(",
"strpos",
"(",
... | Inserts a value into the array set based on the given path.
@param array $set
@param string $path
@param mixed $value
@return array | [
"Inserts",
"a",
"value",
"into",
"the",
"array",
"set",
"based",
"on",
"the",
"given",
"path",
"."
] | 8a77eb9e7b8baacf41cc25487289779d8319cd3a | https://github.com/vpg/titon.utility/blob/8a77eb9e7b8baacf41cc25487289779d8319cd3a/src/Titon/Utility/Hash.php#L336-L372 |
202,190 | vpg/titon.utility | src/Titon/Utility/Hash.php | Hash.keyOf | public static function keyOf(array $set, $match) {
$return = null;
$isArray = array();
foreach ($set as $key => $value) {
if ($value === $match) {
$return = $key;
}
if (is_array($value)) {
$isArray[] = $key;
}
... | php | public static function keyOf(array $set, $match) {
$return = null;
$isArray = array();
foreach ($set as $key => $value) {
if ($value === $match) {
$return = $key;
}
if (is_array($value)) {
$isArray[] = $key;
}
... | [
"public",
"static",
"function",
"keyOf",
"(",
"array",
"$",
"set",
",",
"$",
"match",
")",
"{",
"$",
"return",
"=",
"null",
";",
"$",
"isArray",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"set",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
... | Returns the key of the specified value. Will recursively search if the first pass doesn't match.
@param array $set
@param mixed $match
@return mixed | [
"Returns",
"the",
"key",
"of",
"the",
"specified",
"value",
".",
"Will",
"recursively",
"search",
"if",
"the",
"first",
"pass",
"doesn",
"t",
"match",
"."
] | 8a77eb9e7b8baacf41cc25487289779d8319cd3a | https://github.com/vpg/titon.utility/blob/8a77eb9e7b8baacf41cc25487289779d8319cd3a/src/Titon/Utility/Hash.php#L417-L440 |
202,191 | vpg/titon.utility | src/Titon/Utility/Hash.php | Hash.pluck | public static function pluck(array $set, $path) {
$data = array();
foreach ($set as $array) {
if ($value = static::extract($array, $path)) {
$data[] = $value;
}
}
return $data;
} | php | public static function pluck(array $set, $path) {
$data = array();
foreach ($set as $array) {
if ($value = static::extract($array, $path)) {
$data[] = $value;
}
}
return $data;
} | [
"public",
"static",
"function",
"pluck",
"(",
"array",
"$",
"set",
",",
"$",
"path",
")",
"{",
"$",
"data",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"set",
"as",
"$",
"array",
")",
"{",
"if",
"(",
"$",
"value",
"=",
"static",
"::",
"ex... | Pluck a value out of each child-array and return an array of the plucked values.
@param array $set
@param string $path
@return array | [
"Pluck",
"a",
"value",
"out",
"of",
"each",
"child",
"-",
"array",
"and",
"return",
"an",
"array",
"of",
"the",
"plucked",
"values",
"."
] | 8a77eb9e7b8baacf41cc25487289779d8319cd3a | https://github.com/vpg/titon.utility/blob/8a77eb9e7b8baacf41cc25487289779d8319cd3a/src/Titon/Utility/Hash.php#L541-L551 |
202,192 | vpg/titon.utility | src/Titon/Utility/Hash.php | Hash.reduce | public static function reduce(array $set, array $keys) {
$array = array();
foreach ($set as $key => $value) {
if (in_array($key, $keys)) {
$array[$key] = $value;
}
}
return $array;
} | php | public static function reduce(array $set, array $keys) {
$array = array();
foreach ($set as $key => $value) {
if (in_array($key, $keys)) {
$array[$key] = $value;
}
}
return $array;
} | [
"public",
"static",
"function",
"reduce",
"(",
"array",
"$",
"set",
",",
"array",
"$",
"keys",
")",
"{",
"$",
"array",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"set",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"in_array",... | Reduce an array by removing all keys that have not been defined for persistence.
@param array $set
@param array $keys
@return array | [
"Reduce",
"an",
"array",
"by",
"removing",
"all",
"keys",
"that",
"have",
"not",
"been",
"defined",
"for",
"persistence",
"."
] | 8a77eb9e7b8baacf41cc25487289779d8319cd3a | https://github.com/vpg/titon.utility/blob/8a77eb9e7b8baacf41cc25487289779d8319cd3a/src/Titon/Utility/Hash.php#L594-L604 |
202,193 | vpg/titon.utility | src/Titon/Utility/Hash.php | Hash.set | public static function set(array $set, $path, $value = null) {
if (is_array($path)) {
foreach ($path as $key => $value) {
$set = static::insert($set, $key, $value);
}
} else {
$set = static::insert($set, $path, $value);
}
return $set;
... | php | public static function set(array $set, $path, $value = null) {
if (is_array($path)) {
foreach ($path as $key => $value) {
$set = static::insert($set, $key, $value);
}
} else {
$set = static::insert($set, $path, $value);
}
return $set;
... | [
"public",
"static",
"function",
"set",
"(",
"array",
"$",
"set",
",",
"$",
"path",
",",
"$",
"value",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"path",
")",
")",
"{",
"foreach",
"(",
"$",
"path",
"as",
"$",
"key",
"=>",
"$",
"valu... | Set a value into the result set. If the paths is an array, loop over each one and insert the value.
@param array $set
@param array|string $path
@param mixed $value
@return array | [
"Set",
"a",
"value",
"into",
"the",
"result",
"set",
".",
"If",
"the",
"paths",
"is",
"an",
"array",
"loop",
"over",
"each",
"one",
"and",
"insert",
"the",
"value",
"."
] | 8a77eb9e7b8baacf41cc25487289779d8319cd3a | https://github.com/vpg/titon.utility/blob/8a77eb9e7b8baacf41cc25487289779d8319cd3a/src/Titon/Utility/Hash.php#L658-L668 |
202,194 | vpg/titon.utility | src/Titon/Utility/Hash.php | Hash.some | public static function some(array $set, Closure $callback) {
foreach ($set as $value) {
if ($callback($value, $value)) {
return true;
}
}
return false;
} | php | public static function some(array $set, Closure $callback) {
foreach ($set as $value) {
if ($callback($value, $value)) {
return true;
}
}
return false;
} | [
"public",
"static",
"function",
"some",
"(",
"array",
"$",
"set",
",",
"Closure",
"$",
"callback",
")",
"{",
"foreach",
"(",
"$",
"set",
"as",
"$",
"value",
")",
"{",
"if",
"(",
"$",
"callback",
"(",
"$",
"value",
",",
"$",
"value",
")",
")",
"{"... | Returns true if at least one element in the array satisfies the provided testing function.
@param array $set
@param \Closure $callback
@return bool | [
"Returns",
"true",
"if",
"at",
"least",
"one",
"element",
"in",
"the",
"array",
"satisfies",
"the",
"provided",
"testing",
"function",
"."
] | 8a77eb9e7b8baacf41cc25487289779d8319cd3a | https://github.com/vpg/titon.utility/blob/8a77eb9e7b8baacf41cc25487289779d8319cd3a/src/Titon/Utility/Hash.php#L677-L685 |
202,195 | erenmustafaozdal/laravel-modules-base | src/Repositories/FileRepository.php | FileRepository.moveFile | public function moveFile($file, $model)
{
$path = $this->getUploadPath($model, $this->options);
$this->makeDirectoryBeforeUpload($path, true);
if ( ! is_null($this->elfinderFilePath) ) {
$this->copy($this->elfinderFilePath, $path . '/' . $this->fileName);
} else {... | php | public function moveFile($file, $model)
{
$path = $this->getUploadPath($model, $this->options);
$this->makeDirectoryBeforeUpload($path, true);
if ( ! is_null($this->elfinderFilePath) ) {
$this->copy($this->elfinderFilePath, $path . '/' . $this->fileName);
} else {... | [
"public",
"function",
"moveFile",
"(",
"$",
"file",
",",
"$",
"model",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"getUploadPath",
"(",
"$",
"model",
",",
"$",
"this",
"->",
"options",
")",
";",
"$",
"this",
"->",
"makeDirectoryBeforeUpload",
"(",
... | move upload file
@param $file
@param \Illuminate\Database\Eloquent\Model $model
@return string | [
"move",
"upload",
"file"
] | c26600543817642926bcf16ada84009e00d784e0 | https://github.com/erenmustafaozdal/laravel-modules-base/blob/c26600543817642926bcf16ada84009e00d784e0/src/Repositories/FileRepository.php#L86-L101 |
202,196 | erenmustafaozdal/laravel-modules-base | src/Repositories/FileRepository.php | FileRepository.setFileName | protected function setFileName($file)
{
if (isset($this->options['thumbnails'])) {
$thumbs = isset($this->options['changeThumb'])
? $this->options['thumbnails'][$this->options['changeThumb']]
: $this->options['thumbnails'];
$thumbs = array_values... | php | protected function setFileName($file)
{
if (isset($this->options['thumbnails'])) {
$thumbs = isset($this->options['changeThumb'])
? $this->options['thumbnails'][$this->options['changeThumb']]
: $this->options['thumbnails'];
$thumbs = array_values... | [
"protected",
"function",
"setFileName",
"(",
"$",
"file",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"options",
"[",
"'thumbnails'",
"]",
")",
")",
"{",
"$",
"thumbs",
"=",
"isset",
"(",
"$",
"this",
"->",
"options",
"[",
"'changeThumb'",
... | set file name
@param \Symfony\Component\HttpFoundation\File\UploadedFile|string $file
@return void | [
"set",
"file",
"name"
] | c26600543817642926bcf16ada84009e00d784e0 | https://github.com/erenmustafaozdal/laravel-modules-base/blob/c26600543817642926bcf16ada84009e00d784e0/src/Repositories/FileRepository.php#L109-L123 |
202,197 | erenmustafaozdal/laravel-modules-base | src/Repositories/FileRepository.php | FileRepository.setFileSize | protected function setFileSize($file)
{
$this->fileSize = ! is_null($this->elfinderFilePath) ? $this->getFileSize() : (is_string($file) ? $this->size($file) : $file->getClientSize());
} | php | protected function setFileSize($file)
{
$this->fileSize = ! is_null($this->elfinderFilePath) ? $this->getFileSize() : (is_string($file) ? $this->size($file) : $file->getClientSize());
} | [
"protected",
"function",
"setFileSize",
"(",
"$",
"file",
")",
"{",
"$",
"this",
"->",
"fileSize",
"=",
"!",
"is_null",
"(",
"$",
"this",
"->",
"elfinderFilePath",
")",
"?",
"$",
"this",
"->",
"getFileSize",
"(",
")",
":",
"(",
"is_string",
"(",
"$",
... | set file size
@param \Symfony\Component\HttpFoundation\File\UploadedFile|string $file
@return void | [
"set",
"file",
"size"
] | c26600543817642926bcf16ada84009e00d784e0 | https://github.com/erenmustafaozdal/laravel-modules-base/blob/c26600543817642926bcf16ada84009e00d784e0/src/Repositories/FileRepository.php#L131-L134 |
202,198 | erenmustafaozdal/laravel-modules-base | src/Repositories/FileRepository.php | FileRepository.createFileName | public function createFileName($file)
{
if ( ! is_null($this->elfinderFilePath) ) {
return $this->getFileName();
}
if ( is_string($file) ) {
return substr( strrchr( $file, '/' ), 1 );
}
$filename = $file->getClientOriginalName();
$mi... | php | public function createFileName($file)
{
if ( ! is_null($this->elfinderFilePath) ) {
return $this->getFileName();
}
if ( is_string($file) ) {
return substr( strrchr( $file, '/' ), 1 );
}
$filename = $file->getClientOriginalName();
$mi... | [
"public",
"function",
"createFileName",
"(",
"$",
"file",
")",
"{",
"if",
"(",
"!",
"is_null",
"(",
"$",
"this",
"->",
"elfinderFilePath",
")",
")",
"{",
"return",
"$",
"this",
"->",
"getFileName",
"(",
")",
";",
"}",
"if",
"(",
"is_string",
"(",
"$"... | create file name
@param $file
@return string | [
"create",
"file",
"name"
] | c26600543817642926bcf16ada84009e00d784e0 | https://github.com/erenmustafaozdal/laravel-modules-base/blob/c26600543817642926bcf16ada84009e00d784e0/src/Repositories/FileRepository.php#L142-L156 |
202,199 | erenmustafaozdal/laravel-modules-base | src/Repositories/FileRepository.php | FileRepository.getFile | protected function getFile($request)
{
$columns = explode('.',$this->options['column']);
$column = count($columns) > 1 ? $columns[1] : $columns[0];
$inputName = isset($this->options['group'])
? "{$this->options['group']}.{$this->options['index']}.{$column}"
: $c... | php | protected function getFile($request)
{
$columns = explode('.',$this->options['column']);
$column = count($columns) > 1 ? $columns[1] : $columns[0];
$inputName = isset($this->options['group'])
? "{$this->options['group']}.{$this->options['index']}.{$column}"
: $c... | [
"protected",
"function",
"getFile",
"(",
"$",
"request",
")",
"{",
"$",
"columns",
"=",
"explode",
"(",
"'.'",
",",
"$",
"this",
"->",
"options",
"[",
"'column'",
"]",
")",
";",
"$",
"column",
"=",
"count",
"(",
"$",
"columns",
")",
">",
"1",
"?",
... | get file or string path
@param \Illuminate\Http\Request $request
@return \Symfony\Component\HttpFoundation\File\UploadedFile|string | [
"get",
"file",
"or",
"string",
"path"
] | c26600543817642926bcf16ada84009e00d784e0 | https://github.com/erenmustafaozdal/laravel-modules-base/blob/c26600543817642926bcf16ada84009e00d784e0/src/Repositories/FileRepository.php#L164-L185 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.