repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
gplcart/cli | controllers/commands/Alias.php | Alias.getListAlias | protected function getListAlias()
{
$id = $this->getParam(0);
if (!isset($id)) {
return $this->alias->getList(array('limit' => $this->getLimit()));
}
if ($this->getParam('entity')) {
return $this->alias->getList(array('entity' => $id, 'limit' => $this->getLi... | php | protected function getListAlias()
{
$id = $this->getParam(0);
if (!isset($id)) {
return $this->alias->getList(array('limit' => $this->getLimit()));
}
if ($this->getParam('entity')) {
return $this->alias->getList(array('entity' => $id, 'limit' => $this->getLi... | [
"protected",
"function",
"getListAlias",
"(",
")",
"{",
"$",
"id",
"=",
"$",
"this",
"->",
"getParam",
"(",
"0",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"id",
")",
")",
"{",
"return",
"$",
"this",
"->",
"alias",
"->",
"getList",
"(",
"array"... | Returns an array of URL aliases
@return array | [
"Returns",
"an",
"array",
"of",
"URL",
"aliases"
] | e57dba53e291a225b4bff0c0d9b23d685dd1c125 | https://github.com/gplcart/cli/blob/e57dba53e291a225b4bff0c0d9b23d685dd1c125/controllers/commands/Alias.php#L251-L274 | train |
linpax/microphp-framework | src/mvc/views/PhpView.php | PhpView.render | public function render()
{
if (!$this->view) {
return false;
}
return $this->renderRawData(
$this->data ?: $this->renderFile($this->getViewFile($this->view), $this->params)
);
} | php | public function render()
{
if (!$this->view) {
return false;
}
return $this->renderRawData(
$this->data ?: $this->renderFile($this->getViewFile($this->view), $this->params)
);
} | [
"public",
"function",
"render",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"view",
")",
"{",
"return",
"false",
";",
"}",
"return",
"$",
"this",
"->",
"renderRawData",
"(",
"$",
"this",
"->",
"data",
"?",
":",
"$",
"this",
"->",
"renderFile"... | Render insert data into view
@access protected
@return string
@throws Exception | [
"Render",
"insert",
"data",
"into",
"view"
] | 11f3370f3f64c516cce9b84ecd8276c6e9ae8df9 | https://github.com/linpax/microphp-framework/blob/11f3370f3f64c516cce9b84ecd8276c6e9ae8df9/src/mvc/views/PhpView.php#L67-L76 | train |
linpax/microphp-framework | src/mvc/views/PhpView.php | PhpView.renderRawData | public function renderRawData($data = '')
{
$layoutPath = null;
if ($this->layout && (!$layoutPath = $this->getLayoutFile((new KernelInjector)->build()->getAppDir(),
$this->module))
) {
(new LoggerInjector)->build()->send('error', 'Layout `'.$this->layout.'` not f... | php | public function renderRawData($data = '')
{
$layoutPath = null;
if ($this->layout && (!$layoutPath = $this->getLayoutFile((new KernelInjector)->build()->getAppDir(),
$this->module))
) {
(new LoggerInjector)->build()->send('error', 'Layout `'.$this->layout.'` not f... | [
"public",
"function",
"renderRawData",
"(",
"$",
"data",
"=",
"''",
")",
"{",
"$",
"layoutPath",
"=",
"null",
";",
"if",
"(",
"$",
"this",
"->",
"layout",
"&&",
"(",
"!",
"$",
"layoutPath",
"=",
"$",
"this",
"->",
"getLayoutFile",
"(",
"(",
"new",
... | Render raw data in layout
@access public
@param string $data arguments array
@return string
@throws Exception | [
"Render",
"raw",
"data",
"in",
"layout"
] | 11f3370f3f64c516cce9b84ecd8276c6e9ae8df9 | https://github.com/linpax/microphp-framework/blob/11f3370f3f64c516cce9b84ecd8276c6e9ae8df9/src/mvc/views/PhpView.php#L88-L102 | train |
linpax/microphp-framework | src/mvc/views/PhpView.php | PhpView.getLayoutFile | protected function getLayoutFile($appDir, $module)
{
if ($module) {
$module = strtolower(str_replace('\\', '/', $module));
$module = substr($module, strpos($module, '/') + 1);
$module = substr($module, 0, strrpos($module, '/'));
}
$layout = $appDir.'/'.($... | php | protected function getLayoutFile($appDir, $module)
{
if ($module) {
$module = strtolower(str_replace('\\', '/', $module));
$module = substr($module, strpos($module, '/') + 1);
$module = substr($module, 0, strrpos($module, '/'));
}
$layout = $appDir.'/'.($... | [
"protected",
"function",
"getLayoutFile",
"(",
"$",
"appDir",
",",
"$",
"module",
")",
"{",
"if",
"(",
"$",
"module",
")",
"{",
"$",
"module",
"=",
"strtolower",
"(",
"str_replace",
"(",
"'\\\\'",
",",
"'/'",
",",
"$",
"module",
")",
")",
";",
"$",
... | Get layout path
@access protected
@param string $appDir path to base dir
@param string $module module name
@return string
@throws Exception | [
"Get",
"layout",
"path"
] | 11f3370f3f64c516cce9b84ecd8276c6e9ae8df9 | https://github.com/linpax/microphp-framework/blob/11f3370f3f64c516cce9b84ecd8276c6e9ae8df9/src/mvc/views/PhpView.php#L115-L135 | train |
linpax/microphp-framework | src/mvc/views/PhpView.php | PhpView.renderFile | protected function renderFile($fileName, array $data = [])
{
/** @noinspection OnlyWritesOnParameterInspection */
/** @noinspection PhpUnusedLocalVariableInspection */
$lang = new Language($fileName);
extract($data, EXTR_PREFIX_SAME || EXTR_REFS, 'data');
ob_start();
... | php | protected function renderFile($fileName, array $data = [])
{
/** @noinspection OnlyWritesOnParameterInspection */
/** @noinspection PhpUnusedLocalVariableInspection */
$lang = new Language($fileName);
extract($data, EXTR_PREFIX_SAME || EXTR_REFS, 'data');
ob_start();
... | [
"protected",
"function",
"renderFile",
"(",
"$",
"fileName",
",",
"array",
"$",
"data",
"=",
"[",
"]",
")",
"{",
"/** @noinspection OnlyWritesOnParameterInspection */",
"/** @noinspection PhpUnusedLocalVariableInspection */",
"$",
"lang",
"=",
"new",
"Language",
"(",
"$... | Render file by path
@access protected
@param string $fileName file name
@param array $data arguments array
@return string
@throws Exception widget not declared | [
"Render",
"file",
"by",
"path"
] | 11f3370f3f64c516cce9b84ecd8276c6e9ae8df9 | https://github.com/linpax/microphp-framework/blob/11f3370f3f64c516cce9b84ecd8276c6e9ae8df9/src/mvc/views/PhpView.php#L148-L164 | train |
linpax/microphp-framework | src/mvc/views/PhpView.php | PhpView.getViewFile | private function getViewFile($view)
{
$calledClass = $this->path;
// Calculate path to view
if (0 === strpos($calledClass, 'App')) {
$path = (new KernelInjector)->build()->getAppDir();
} else {
$path = Autoload::getAlias('Micro');
}
$cl = str... | php | private function getViewFile($view)
{
$calledClass = $this->path;
// Calculate path to view
if (0 === strpos($calledClass, 'App')) {
$path = (new KernelInjector)->build()->getAppDir();
} else {
$path = Autoload::getAlias('Micro');
}
$cl = str... | [
"private",
"function",
"getViewFile",
"(",
"$",
"view",
")",
"{",
"$",
"calledClass",
"=",
"$",
"this",
"->",
"path",
";",
"// Calculate path to view",
"if",
"(",
"0",
"===",
"strpos",
"(",
"$",
"calledClass",
",",
"'App'",
")",
")",
"{",
"$",
"path",
... | Get view file
@access private
@param string $view view file name
@return string
@throws Exception | [
"Get",
"view",
"file"
] | 11f3370f3f64c516cce9b84ecd8276c6e9ae8df9 | https://github.com/linpax/microphp-framework/blob/11f3370f3f64c516cce9b84ecd8276c6e9ae8df9/src/mvc/views/PhpView.php#L176-L205 | train |
iumio/framework-setup | Tools.php | Tools.checkPhpVersion | final public static function checkPhpVersion()
{
$phpv = phpversion();
if ($phpv >= self::$php_accept) {
return (json_encode(array("code" => 200, "results" => "OK", "phpv" => $phpv)));
} else {
return (json_encode(array("code" => 500, "results" => "NOK", "phpv" => $p... | php | final public static function checkPhpVersion()
{
$phpv = phpversion();
if ($phpv >= self::$php_accept) {
return (json_encode(array("code" => 200, "results" => "OK", "phpv" => $phpv)));
} else {
return (json_encode(array("code" => 500, "results" => "NOK", "phpv" => $p... | [
"final",
"public",
"static",
"function",
"checkPhpVersion",
"(",
")",
"{",
"$",
"phpv",
"=",
"phpversion",
"(",
")",
";",
"if",
"(",
"$",
"phpv",
">=",
"self",
"::",
"$",
"php_accept",
")",
"{",
"return",
"(",
"json_encode",
"(",
"array",
"(",
"\"code\... | Check the php version
@return string If php version is compatible | [
"Check",
"the",
"php",
"version"
] | 02bb46ce6aa3a52908ff4608bd14264608bb38d1 | https://github.com/iumio/framework-setup/blob/02bb46ce6aa3a52908ff4608bd14264608bb38d1/Tools.php#L59-L70 | train |
iumio/framework-setup | Tools.php | Tools.checkFrameworkBuildVersion | final public static function checkFrameworkBuildVersion()
{
$f = json_decode(file_get_contents(__DIR__."/../../elements/config_files/core/framework.config.json"));
if (!property_exists($f, 'installation')) {
return (json_encode(array("code" => 500, "results" => "NOK", "fv" => "unknow",
... | php | final public static function checkFrameworkBuildVersion()
{
$f = json_decode(file_get_contents(__DIR__."/../../elements/config_files/core/framework.config.json"));
if (!property_exists($f, 'installation')) {
return (json_encode(array("code" => 500, "results" => "NOK", "fv" => "unknow",
... | [
"final",
"public",
"static",
"function",
"checkFrameworkBuildVersion",
"(",
")",
"{",
"$",
"f",
"=",
"json_decode",
"(",
"file_get_contents",
"(",
"__DIR__",
".",
"\"/../../elements/config_files/core/framework.config.json\"",
")",
")",
";",
"if",
"(",
"!",
"property_e... | Check the iumio Framework version
@return string If iumio Framework version is compatible | [
"Check",
"the",
"iumio",
"Framework",
"version"
] | 02bb46ce6aa3a52908ff4608bd14264608bb38d1 | https://github.com/iumio/framework-setup/blob/02bb46ce6aa3a52908ff4608bd14264608bb38d1/Tools.php#L75-L104 | train |
iumio/framework-setup | Tools.php | Tools.isDirEmpty | final public static function isDirEmpty($dir)
{
if (!is_readable($dir)) {
return (null);
}
$handle = opendir($dir);
while (false !== ($entry = readdir($handle))) {
if ($entry != "." && $entry != "..") {
return (false);
}
}
... | php | final public static function isDirEmpty($dir)
{
if (!is_readable($dir)) {
return (null);
}
$handle = opendir($dir);
while (false !== ($entry = readdir($handle))) {
if ($entry != "." && $entry != "..") {
return (false);
}
}
... | [
"final",
"public",
"static",
"function",
"isDirEmpty",
"(",
"$",
"dir",
")",
"{",
"if",
"(",
"!",
"is_readable",
"(",
"$",
"dir",
")",
")",
"{",
"return",
"(",
"null",
")",
";",
"}",
"$",
"handle",
"=",
"opendir",
"(",
"$",
"dir",
")",
";",
"whil... | Check if dir is empty or not
@param $dir string Dir path
@return bool|null If empty or not | [
"Check",
"if",
"dir",
"is",
"empty",
"or",
"not"
] | 02bb46ce6aa3a52908ff4608bd14264608bb38d1 | https://github.com/iumio/framework-setup/blob/02bb46ce6aa3a52908ff4608bd14264608bb38d1/Tools.php#L149-L161 | train |
iumio/framework-setup | Tools.php | Tools.checkLibrariesRequired | final public static function checkLibrariesRequired()
{
$base = __DIR__."/../../";
foreach (self::$libs as $lib => $val) {
if (!is_dir($base.$lib) || !self::checkIsReadable($base.$lib) ||
!self::checkIsWritable($base.$lib) || self::isDirEmpty($base.$lib)) {
... | php | final public static function checkLibrariesRequired()
{
$base = __DIR__."/../../";
foreach (self::$libs as $lib => $val) {
if (!is_dir($base.$lib) || !self::checkIsReadable($base.$lib) ||
!self::checkIsWritable($base.$lib) || self::isDirEmpty($base.$lib)) {
... | [
"final",
"public",
"static",
"function",
"checkLibrariesRequired",
"(",
")",
"{",
"$",
"base",
"=",
"__DIR__",
".",
"\"/../../\"",
";",
"foreach",
"(",
"self",
"::",
"$",
"libs",
"as",
"$",
"lib",
"=>",
"$",
"val",
")",
"{",
"if",
"(",
"!",
"is_dir",
... | Check if librairies required are installed
@return int Are installed or not | [
"Check",
"if",
"librairies",
"required",
"are",
"installed"
] | 02bb46ce6aa3a52908ff4608bd14264608bb38d1 | https://github.com/iumio/framework-setup/blob/02bb46ce6aa3a52908ff4608bd14264608bb38d1/Tools.php#L167-L184 | train |
FuzeWorks/Core | src/FuzeWorks/Configurator.php | Configurator.setParameters | public function setParameters(array $params): self
{
foreach ($params as $key => $value) {
$this->parameters[$key] = $value;
}
return $this;
} | php | public function setParameters(array $params): self
{
foreach ($params as $key => $value) {
$this->parameters[$key] = $value;
}
return $this;
} | [
"public",
"function",
"setParameters",
"(",
"array",
"$",
"params",
")",
":",
"self",
"{",
"foreach",
"(",
"$",
"params",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"parameters",
"[",
"$",
"key",
"]",
"=",
"$",
"value",
";",... | Adds new parameters. The %params% will be expanded.
@return self | [
"Adds",
"new",
"parameters",
".",
"The",
"%params%",
"will",
"be",
"expanded",
"."
] | 051c64fdaa3a648174cbd54557d05ad553dd826b | https://github.com/FuzeWorks/Core/blob/051c64fdaa3a648174cbd54557d05ad553dd826b/src/FuzeWorks/Configurator.php#L111-L117 | train |
FuzeWorks/Core | src/FuzeWorks/Configurator.php | Configurator.setDebugMode | public function setDebugMode($value): self
{
if (is_string($value) || is_array($value)) {
$value = static::detectDebugMode($value);
} elseif (!is_bool($value)) {
throw new InvalidArgumentException(sprintf('Value must be either a string, array, or boolean, %s given.', gettype(... | php | public function setDebugMode($value): self
{
if (is_string($value) || is_array($value)) {
$value = static::detectDebugMode($value);
} elseif (!is_bool($value)) {
throw new InvalidArgumentException(sprintf('Value must be either a string, array, or boolean, %s given.', gettype(... | [
"public",
"function",
"setDebugMode",
"(",
"$",
"value",
")",
":",
"self",
"{",
"if",
"(",
"is_string",
"(",
"$",
"value",
")",
"||",
"is_array",
"(",
"$",
"value",
")",
")",
"{",
"$",
"value",
"=",
"static",
"::",
"detectDebugMode",
"(",
"$",
"value... | Set parameter %debugMode%.
@param bool|string|array
@return self | [
"Set",
"parameter",
"%debugMode%",
"."
] | 051c64fdaa3a648174cbd54557d05ad553dd826b | https://github.com/FuzeWorks/Core/blob/051c64fdaa3a648174cbd54557d05ad553dd826b/src/FuzeWorks/Configurator.php#L142-L151 | train |
FuzeWorks/Core | src/FuzeWorks/Configurator.php | Configurator.createContainer | public function createContainer(): Factory
{
// First set all the directories
Core::$appDir = $this->parameters['appDir'];
Core::$wwwDir = $this->parameters['wwwDir'];
Core::$tempDir = $this->parameters['tempDir'];
Core::$logDir = $this->parameters['logDir'];
// Then... | php | public function createContainer(): Factory
{
// First set all the directories
Core::$appDir = $this->parameters['appDir'];
Core::$wwwDir = $this->parameters['wwwDir'];
Core::$tempDir = $this->parameters['tempDir'];
Core::$logDir = $this->parameters['logDir'];
// Then... | [
"public",
"function",
"createContainer",
"(",
")",
":",
"Factory",
"{",
"// First set all the directories",
"Core",
"::",
"$",
"appDir",
"=",
"$",
"this",
"->",
"parameters",
"[",
"'appDir'",
"]",
";",
"Core",
"::",
"$",
"wwwDir",
"=",
"$",
"this",
"->",
"... | Create the container which holds FuzeWorks.
Due to the static nature of FuzeWorks, this is not yet possible.
When issue #101 is completed, this should be resolved.
@return Factory | [
"Create",
"the",
"container",
"which",
"holds",
"FuzeWorks",
"."
] | 051c64fdaa3a648174cbd54557d05ad553dd826b | https://github.com/FuzeWorks/Core/blob/051c64fdaa3a648174cbd54557d05ad553dd826b/src/FuzeWorks/Configurator.php#L194-L227 | train |
phpffcms/ffcms-core | src/Properties.php | Properties.get | public function get(string $configKey, string $configFile = 'default', ?string $parseType = null)
{
$this->load($configFile);
// check if configs for this file is loaded
if (!isset($this->data[$configFile])) {
return false;
}
// check if config key is exist
... | php | public function get(string $configKey, string $configFile = 'default', ?string $parseType = null)
{
$this->load($configFile);
// check if configs for this file is loaded
if (!isset($this->data[$configFile])) {
return false;
}
// check if config key is exist
... | [
"public",
"function",
"get",
"(",
"string",
"$",
"configKey",
",",
"string",
"$",
"configFile",
"=",
"'default'",
",",
"?",
"string",
"$",
"parseType",
"=",
"null",
")",
"{",
"$",
"this",
"->",
"load",
"(",
"$",
"configFile",
")",
";",
"// check if confi... | Get config value by config key from configuration file
@param string $configKey
@param string $configFile
@param string|null $parseType
@return mixed | [
"Get",
"config",
"value",
"by",
"config",
"key",
"from",
"configuration",
"file"
] | 44a309553ef9f115ccfcfd71f2ac6e381c612082 | https://github.com/phpffcms/ffcms-core/blob/44a309553ef9f115ccfcfd71f2ac6e381c612082/src/Properties.php#L61-L96 | train |
phpffcms/ffcms-core | src/Properties.php | Properties.getAll | public function getAll($configFile = 'default'): ?array
{
$this->load($configFile);
if (!Any::isArray($this->data) || !array_key_exists($configFile, $this->data)) {
return null;
}
return $this->data[$configFile];
} | php | public function getAll($configFile = 'default'): ?array
{
$this->load($configFile);
if (!Any::isArray($this->data) || !array_key_exists($configFile, $this->data)) {
return null;
}
return $this->data[$configFile];
} | [
"public",
"function",
"getAll",
"(",
"$",
"configFile",
"=",
"'default'",
")",
":",
"?",
"array",
"{",
"$",
"this",
"->",
"load",
"(",
"$",
"configFile",
")",
";",
"if",
"(",
"!",
"Any",
"::",
"isArray",
"(",
"$",
"this",
"->",
"data",
")",
"||",
... | Get all configuration data of selected file
@param string $configFile
@return array|null | [
"Get",
"all",
"configuration",
"data",
"of",
"selected",
"file"
] | 44a309553ef9f115ccfcfd71f2ac6e381c612082 | https://github.com/phpffcms/ffcms-core/blob/44a309553ef9f115ccfcfd71f2ac6e381c612082/src/Properties.php#L103-L111 | train |
phpffcms/ffcms-core | src/Properties.php | Properties.updateConfig | public function updateConfig(string $configFile, array $newData, ?bool $mergeDeep = false): bool
{
$this->load($configFile);
if (!isset($this->data[$configFile])) {
return false;
}
$oldData = $this->data[$configFile];
$saveData = ($mergeDeep ? Arr::mergeRecursive... | php | public function updateConfig(string $configFile, array $newData, ?bool $mergeDeep = false): bool
{
$this->load($configFile);
if (!isset($this->data[$configFile])) {
return false;
}
$oldData = $this->data[$configFile];
$saveData = ($mergeDeep ? Arr::mergeRecursive... | [
"public",
"function",
"updateConfig",
"(",
"string",
"$",
"configFile",
",",
"array",
"$",
"newData",
",",
"?",
"bool",
"$",
"mergeDeep",
"=",
"false",
")",
":",
"bool",
"{",
"$",
"this",
"->",
"load",
"(",
"$",
"configFile",
")",
";",
"if",
"(",
"!"... | Update configuration data based on key-value array of new data. Do not pass multi-level array on new position without existing keys
@param string $configFile
@param array $newData
@param bool $mergeDeep
@return bool | [
"Update",
"configuration",
"data",
"based",
"on",
"key",
"-",
"value",
"array",
"of",
"new",
"data",
".",
"Do",
"not",
"pass",
"multi",
"-",
"level",
"array",
"on",
"new",
"position",
"without",
"existing",
"keys"
] | 44a309553ef9f115ccfcfd71f2ac6e381c612082 | https://github.com/phpffcms/ffcms-core/blob/44a309553ef9f115ccfcfd71f2ac6e381c612082/src/Properties.php#L120-L130 | train |
phpffcms/ffcms-core | src/Properties.php | Properties.writeConfig | public function writeConfig(string $configFile, array $data): bool
{
$path = '/Private/Config/' . ucfirst(Str::lowerCase($configFile)) . '.php';
if (!File::exist($path) || !File::writable($path)) {
return false;
}
$saveData = '<?php return ' . Arr::exportVar($data) . ';'... | php | public function writeConfig(string $configFile, array $data): bool
{
$path = '/Private/Config/' . ucfirst(Str::lowerCase($configFile)) . '.php';
if (!File::exist($path) || !File::writable($path)) {
return false;
}
$saveData = '<?php return ' . Arr::exportVar($data) . ';'... | [
"public",
"function",
"writeConfig",
"(",
"string",
"$",
"configFile",
",",
"array",
"$",
"data",
")",
":",
"bool",
"{",
"$",
"path",
"=",
"'/Private/Config/'",
".",
"ucfirst",
"(",
"Str",
"::",
"lowerCase",
"(",
"$",
"configFile",
")",
")",
".",
"'.php'... | Write configurations data from array to cfg file
@param string $configFile
@param array $data
@return bool | [
"Write",
"configurations",
"data",
"from",
"array",
"to",
"cfg",
"file"
] | 44a309553ef9f115ccfcfd71f2ac6e381c612082 | https://github.com/phpffcms/ffcms-core/blob/44a309553ef9f115ccfcfd71f2ac6e381c612082/src/Properties.php#L138-L150 | train |
ARCANESOFT/SEO | src/Models/Presenters/PagePresenter.php | PagePresenter.renderContent | protected function renderContent(array $replacements)
{
return $this->getContentReplacer()->replace($this->content, array_merge([
'app_name' => config('app.name'),
'app_url' => link_to(config('app.url'), config('app.name')),
'mobile' => html()->tel(config('cms.company.... | php | protected function renderContent(array $replacements)
{
return $this->getContentReplacer()->replace($this->content, array_merge([
'app_name' => config('app.name'),
'app_url' => link_to(config('app.url'), config('app.name')),
'mobile' => html()->tel(config('cms.company.... | [
"protected",
"function",
"renderContent",
"(",
"array",
"$",
"replacements",
")",
"{",
"return",
"$",
"this",
"->",
"getContentReplacer",
"(",
")",
"->",
"replace",
"(",
"$",
"this",
"->",
"content",
",",
"array_merge",
"(",
"[",
"'app_name'",
"=>",
"config"... | Render the content.
@param array $replacements
@return string | [
"Render",
"the",
"content",
"."
] | ce6d6135d55e8b2fd43cf7923839b4791b7c7ad2 | https://github.com/ARCANESOFT/SEO/blob/ce6d6135d55e8b2fd43cf7923839b4791b7c7ad2/src/Models/Presenters/PagePresenter.php#L56-L65 | train |
Vectrex/vxPHP | src/Form/FormElement/FormElement.php | FormElement.setLabel | public function setLabel(LabelElement $label)
{
$this->label = $label;
if(($for = $this->getAttribute('id'))) {
$label->setAttribute('for', $for);
}
return $this;
} | php | public function setLabel(LabelElement $label)
{
$this->label = $label;
if(($for = $this->getAttribute('id'))) {
$label->setAttribute('for', $for);
}
return $this;
} | [
"public",
"function",
"setLabel",
"(",
"LabelElement",
"$",
"label",
")",
"{",
"$",
"this",
"->",
"label",
"=",
"$",
"label",
";",
"if",
"(",
"(",
"$",
"for",
"=",
"$",
"this",
"->",
"getAttribute",
"(",
"'id'",
")",
")",
")",
"{",
"$",
"label",
... | assign label element to this form element
"for" attribute of label is set if form element has an "id" attribute
@param LabelElement $label
@return $this | [
"assign",
"label",
"element",
"to",
"this",
"form",
"element",
"for",
"attribute",
"of",
"label",
"is",
"set",
"if",
"form",
"element",
"has",
"an",
"id",
"attribute"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Form/FormElement/FormElement.php#L196-L207 | train |
Vectrex/vxPHP | src/Form/FormElement/FormElement.php | FormElement.setAttribute | public function setAttribute($attr, $value) {
$attr = strtolower($attr);
if($attr === 'value') {
return $this->setValue($value);
}
if($attr === 'name') {
return $this->setName($value);
}
if($attr === 'id' && $this->label) {
$this->label->setAttribute('for', $value);
}
if(is_null($... | php | public function setAttribute($attr, $value) {
$attr = strtolower($attr);
if($attr === 'value') {
return $this->setValue($value);
}
if($attr === 'name') {
return $this->setName($value);
}
if($attr === 'id' && $this->label) {
$this->label->setAttribute('for', $value);
}
if(is_null($... | [
"public",
"function",
"setAttribute",
"(",
"$",
"attr",
",",
"$",
"value",
")",
"{",
"$",
"attr",
"=",
"strtolower",
"(",
"$",
"attr",
")",
";",
"if",
"(",
"$",
"attr",
"===",
"'value'",
")",
"{",
"return",
"$",
"this",
"->",
"setValue",
"(",
"$",
... | sets miscellaneous attribute of form element
attributes 'value', 'name' are treated by calling the according setters
setting 'id' will update 'for' when a label element is assigned
@param string $attr
@param mixed $value
@return \vxPHP\Form\FormElement\FormElement | [
"sets",
"miscellaneous",
"attribute",
"of",
"form",
"element",
"attributes",
"value",
"name",
"are",
"treated",
"by",
"calling",
"the",
"according",
"setters",
"setting",
"id",
"will",
"update",
"for",
"when",
"a",
"label",
"element",
"is",
"assigned"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Form/FormElement/FormElement.php#L230-L254 | train |
Vectrex/vxPHP | src/Form/FormElement/FormElement.php | FormElement.setAttributes | public function setAttributes(Array $attributes) {
foreach($attributes as $k => $v) {
$this->setAttribute($k, $v);
}
return $this;
} | php | public function setAttributes(Array $attributes) {
foreach($attributes as $k => $v) {
$this->setAttribute($k, $v);
}
return $this;
} | [
"public",
"function",
"setAttributes",
"(",
"Array",
"$",
"attributes",
")",
"{",
"foreach",
"(",
"$",
"attributes",
"as",
"$",
"k",
"=>",
"$",
"v",
")",
"{",
"$",
"this",
"->",
"setAttribute",
"(",
"$",
"k",
",",
"$",
"v",
")",
";",
"}",
"return",... | sets several attributes with an associative array
@param array $attributes
@return \vxPHP\Form\FormElement\FormElement | [
"sets",
"several",
"attributes",
"with",
"an",
"associative",
"array"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Form/FormElement/FormElement.php#L262-L269 | train |
Vectrex/vxPHP | src/Form/FormElement/FormElement.php | FormElement.getAttribute | public function getAttribute($name) {
$key = strtolower($name);
if('value' === $key) {
return $this->getValue();
}
if('name' === $key) {
return $this->getName();
}
if(array_key_exists($key, $this->attributes)) {
return $this->attributes[strtolowe... | php | public function getAttribute($name) {
$key = strtolower($name);
if('value' === $key) {
return $this->getValue();
}
if('name' === $key) {
return $this->getName();
}
if(array_key_exists($key, $this->attributes)) {
return $this->attributes[strtolowe... | [
"public",
"function",
"getAttribute",
"(",
"$",
"name",
")",
"{",
"$",
"key",
"=",
"strtolower",
"(",
"$",
"name",
")",
";",
"if",
"(",
"'value'",
"===",
"$",
"key",
")",
"{",
"return",
"$",
"this",
"->",
"getValue",
"(",
")",
";",
"}",
"if",
"("... | get a single attribute
name and value attributes are redirected to
the respective getter methods
@param $name
@return string|null | [
"get",
"a",
"single",
"attribute",
"name",
"and",
"value",
"attributes",
"are",
"redirected",
"to",
"the",
"respective",
"getter",
"methods"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Form/FormElement/FormElement.php#L279-L299 | train |
Vectrex/vxPHP | src/Form/FormElement/FormElement.php | FormElement.isValid | public function isValid() {
if(!isset($this->valid)) {
$this->valid = $this->applyValidators(
$this->applyModifiers($this->getValue())
);
}
return $this->valid;
} | php | public function isValid() {
if(!isset($this->valid)) {
$this->valid = $this->applyValidators(
$this->applyModifiers($this->getValue())
);
}
return $this->valid;
} | [
"public",
"function",
"isValid",
"(",
")",
"{",
"if",
"(",
"!",
"isset",
"(",
"$",
"this",
"->",
"valid",
")",
")",
"{",
"$",
"this",
"->",
"valid",
"=",
"$",
"this",
"->",
"applyValidators",
"(",
"$",
"this",
"->",
"applyModifiers",
"(",
"$",
"thi... | checks whether modified form element passes validation rules
@return boolean $success | [
"checks",
"whether",
"modified",
"form",
"element",
"passes",
"validation",
"rules"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Form/FormElement/FormElement.php#L410-L420 | train |
Vectrex/vxPHP | src/Form/FormElement/FormElement.php | FormElement.canSubmit | public function canSubmit() {
return
$this instanceof InputElement && isset($this->attributes['type']) && $this->attributes['type'] == 'submit' ||
$this instanceof ImageElement ||
$this instanceof SubmitInputElement ||
$this instanceof ButtonElement && $this->attributes['type'] == 'submit';
} | php | public function canSubmit() {
return
$this instanceof InputElement && isset($this->attributes['type']) && $this->attributes['type'] == 'submit' ||
$this instanceof ImageElement ||
$this instanceof SubmitInputElement ||
$this instanceof ButtonElement && $this->attributes['type'] == 'submit';
} | [
"public",
"function",
"canSubmit",
"(",
")",
"{",
"return",
"$",
"this",
"instanceof",
"InputElement",
"&&",
"isset",
"(",
"$",
"this",
"->",
"attributes",
"[",
"'type'",
"]",
")",
"&&",
"$",
"this",
"->",
"attributes",
"[",
"'type'",
"]",
"==",
"'submit... | check whether element can submit a form
@return boolean $result | [
"check",
"whether",
"element",
"can",
"submit",
"a",
"form"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Form/FormElement/FormElement.php#L427-L435 | train |
Vectrex/vxPHP | src/Form/FormElement/FormElement.php | FormElement.render | public function render()
{
if(!$this->template) {
throw new \RuntimeException(sprintf("No template for element '%s' defined.", $this->getName()));
}
$this->html = $this->template->assign('element', $this)->display();
return $this->html;
} | php | public function render()
{
if(!$this->template) {
throw new \RuntimeException(sprintf("No template for element '%s' defined.", $this->getName()));
}
$this->html = $this->template->assign('element', $this)->display();
return $this->html;
} | [
"public",
"function",
"render",
"(",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"template",
")",
"{",
"throw",
"new",
"\\",
"RuntimeException",
"(",
"sprintf",
"(",
"\"No template for element '%s' defined.\"",
",",
"$",
"this",
"->",
"getName",
"(",
")",
... | renders form element and returns markup
requires a template for rendering
@return string
@throws \vxPHP\Application\Exception\ApplicationException
@throws \vxPHP\Template\Exception\SimpleTemplateException | [
"renders",
"form",
"element",
"and",
"returns",
"markup",
"requires",
"a",
"template",
"for",
"rendering"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Form/FormElement/FormElement.php#L577-L585 | train |
jmfeurprier/perf-database | lib/perf/Db/ConnectionPool.php | ConnectionPool.prepare | public function prepare($connectionId, Credentials $credentials)
{
$connection = Connection::fromCredentials($credentials);
$this->store($connectionId, $connection);
} | php | public function prepare($connectionId, Credentials $credentials)
{
$connection = Connection::fromCredentials($credentials);
$this->store($connectionId, $connection);
} | [
"public",
"function",
"prepare",
"(",
"$",
"connectionId",
",",
"Credentials",
"$",
"credentials",
")",
"{",
"$",
"connection",
"=",
"Connection",
"::",
"fromCredentials",
"(",
"$",
"credentials",
")",
";",
"$",
"this",
"->",
"store",
"(",
"$",
"connectionId... | Stores a new database connection with provided credentials.
@param string $connectionId
@param Credentials $credentials
@return void | [
"Stores",
"a",
"new",
"database",
"connection",
"with",
"provided",
"credentials",
"."
] | 9b39dc76be9f8a33d02aadc168fdb74d786f0ff2 | https://github.com/jmfeurprier/perf-database/blob/9b39dc76be9f8a33d02aadc168fdb74d786f0ff2/lib/perf/Db/ConnectionPool.php#L27-L32 | train |
jmfeurprier/perf-database | lib/perf/Db/ConnectionPool.php | ConnectionPool.store | public function store($connectionId, Connection $connection)
{
$connectionId = (string) $connectionId;
$this->connections[$connectionId] = $connection;
} | php | public function store($connectionId, Connection $connection)
{
$connectionId = (string) $connectionId;
$this->connections[$connectionId] = $connection;
} | [
"public",
"function",
"store",
"(",
"$",
"connectionId",
",",
"Connection",
"$",
"connection",
")",
"{",
"$",
"connectionId",
"=",
"(",
"string",
")",
"$",
"connectionId",
";",
"$",
"this",
"->",
"connections",
"[",
"$",
"connectionId",
"]",
"=",
"$",
"c... | Stores an existing database connection.
@param string $connectionId
@param Connection $connection
@return void | [
"Stores",
"an",
"existing",
"database",
"connection",
"."
] | 9b39dc76be9f8a33d02aadc168fdb74d786f0ff2 | https://github.com/jmfeurprier/perf-database/blob/9b39dc76be9f8a33d02aadc168fdb74d786f0ff2/lib/perf/Db/ConnectionPool.php#L41-L46 | train |
jmfeurprier/perf-database | lib/perf/Db/ConnectionPool.php | ConnectionPool.fetch | public function fetch($connectionId)
{
$connectionId = (string) $connectionId;
if ($this->exist($connectionId)) {
return $this->connections[$connectionId];
}
throw new \DomainException("Requested database connection '{$connectionId}' does not exist.");
} | php | public function fetch($connectionId)
{
$connectionId = (string) $connectionId;
if ($this->exist($connectionId)) {
return $this->connections[$connectionId];
}
throw new \DomainException("Requested database connection '{$connectionId}' does not exist.");
} | [
"public",
"function",
"fetch",
"(",
"$",
"connectionId",
")",
"{",
"$",
"connectionId",
"=",
"(",
"string",
")",
"$",
"connectionId",
";",
"if",
"(",
"$",
"this",
"->",
"exist",
"(",
"$",
"connectionId",
")",
")",
"{",
"return",
"$",
"this",
"->",
"c... | Returns the database connection with provided identifier, or throws an exception if not found.
@param string $connectionId
@return Connection
@throws \DomainException | [
"Returns",
"the",
"database",
"connection",
"with",
"provided",
"identifier",
"or",
"throws",
"an",
"exception",
"if",
"not",
"found",
"."
] | 9b39dc76be9f8a33d02aadc168fdb74d786f0ff2 | https://github.com/jmfeurprier/perf-database/blob/9b39dc76be9f8a33d02aadc168fdb74d786f0ff2/lib/perf/Db/ConnectionPool.php#L55-L64 | train |
yuncms/yuncms-core | console/controllers/CronController.php | CronController.actionMinute | public function actionMinute()
{
$this->stdout("Executing minute tasks:" . PHP_EOL, Console::FG_YELLOW);
$this->trigger(self::EVENT_ON_MINUTE_RUN);
Yii::$app->settings->set('cronLastMinuteRun', time(), 'core');
return ExitCode::OK;
} | php | public function actionMinute()
{
$this->stdout("Executing minute tasks:" . PHP_EOL, Console::FG_YELLOW);
$this->trigger(self::EVENT_ON_MINUTE_RUN);
Yii::$app->settings->set('cronLastMinuteRun', time(), 'core');
return ExitCode::OK;
} | [
"public",
"function",
"actionMinute",
"(",
")",
"{",
"$",
"this",
"->",
"stdout",
"(",
"\"Executing minute tasks:\"",
".",
"PHP_EOL",
",",
"Console",
"::",
"FG_YELLOW",
")",
";",
"$",
"this",
"->",
"trigger",
"(",
"self",
"::",
"EVENT_ON_MINUTE_RUN",
")",
";... | Executes minute cron tasks.
@throws \yii\base\InvalidConfigException | [
"Executes",
"minute",
"cron",
"tasks",
"."
] | bfaf61c38e48979036c3ede3a0f2beb637500df5 | https://github.com/yuncms/yuncms-core/blob/bfaf61c38e48979036c3ede3a0f2beb637500df5/console/controllers/CronController.php#L49-L55 | train |
yuncms/yuncms-core | console/controllers/CronController.php | CronController.actionHourly | public function actionHourly()
{
$this->stdout("Executing hourly tasks:" . PHP_EOL, Console::FG_YELLOW);
$this->trigger(self::EVENT_ON_HOURLY_RUN);
Yii::$app->settings->set('cronLastHourlyRun', time(), 'core');
return ExitCode::OK;
} | php | public function actionHourly()
{
$this->stdout("Executing hourly tasks:" . PHP_EOL, Console::FG_YELLOW);
$this->trigger(self::EVENT_ON_HOURLY_RUN);
Yii::$app->settings->set('cronLastHourlyRun', time(), 'core');
return ExitCode::OK;
} | [
"public",
"function",
"actionHourly",
"(",
")",
"{",
"$",
"this",
"->",
"stdout",
"(",
"\"Executing hourly tasks:\"",
".",
"PHP_EOL",
",",
"Console",
"::",
"FG_YELLOW",
")",
";",
"$",
"this",
"->",
"trigger",
"(",
"self",
"::",
"EVENT_ON_HOURLY_RUN",
")",
";... | Executes hourly cron tasks.
@throws \yii\base\InvalidConfigException | [
"Executes",
"hourly",
"cron",
"tasks",
"."
] | bfaf61c38e48979036c3ede3a0f2beb637500df5 | https://github.com/yuncms/yuncms-core/blob/bfaf61c38e48979036c3ede3a0f2beb637500df5/console/controllers/CronController.php#L61-L67 | train |
yuncms/yuncms-core | console/controllers/CronController.php | CronController.actionDaily | public function actionDaily()
{
$this->stdout("Executing daily tasks:" . PHP_EOL, Console::FG_YELLOW);
$this->trigger(self::EVENT_ON_DAILY_RUN);
Yii::$app->settings->set('cronLastDailyRun', time(), 'core');
return ExitCode::OK;
} | php | public function actionDaily()
{
$this->stdout("Executing daily tasks:" . PHP_EOL, Console::FG_YELLOW);
$this->trigger(self::EVENT_ON_DAILY_RUN);
Yii::$app->settings->set('cronLastDailyRun', time(), 'core');
return ExitCode::OK;
} | [
"public",
"function",
"actionDaily",
"(",
")",
"{",
"$",
"this",
"->",
"stdout",
"(",
"\"Executing daily tasks:\"",
".",
"PHP_EOL",
",",
"Console",
"::",
"FG_YELLOW",
")",
";",
"$",
"this",
"->",
"trigger",
"(",
"self",
"::",
"EVENT_ON_DAILY_RUN",
")",
";",
... | Executes daily cron tasks.
@throws \yii\base\InvalidConfigException | [
"Executes",
"daily",
"cron",
"tasks",
"."
] | bfaf61c38e48979036c3ede3a0f2beb637500df5 | https://github.com/yuncms/yuncms-core/blob/bfaf61c38e48979036c3ede3a0f2beb637500df5/console/controllers/CronController.php#L73-L79 | train |
yuncms/yuncms-core | console/controllers/CronController.php | CronController.actionMonth | public function actionMonth()
{
$this->stdout("Executing month tasks:" . PHP_EOL, Console::FG_YELLOW);
$this->trigger(self::EVENT_ON_MONTH_RUN);
Yii::$app->settings->set('cronLastMonthRun', time(), 'core');
return ExitCode::OK;
} | php | public function actionMonth()
{
$this->stdout("Executing month tasks:" . PHP_EOL, Console::FG_YELLOW);
$this->trigger(self::EVENT_ON_MONTH_RUN);
Yii::$app->settings->set('cronLastMonthRun', time(), 'core');
return ExitCode::OK;
} | [
"public",
"function",
"actionMonth",
"(",
")",
"{",
"$",
"this",
"->",
"stdout",
"(",
"\"Executing month tasks:\"",
".",
"PHP_EOL",
",",
"Console",
"::",
"FG_YELLOW",
")",
";",
"$",
"this",
"->",
"trigger",
"(",
"self",
"::",
"EVENT_ON_MONTH_RUN",
")",
";",
... | Executes month cron tasks.
@throws \yii\base\InvalidConfigException | [
"Executes",
"month",
"cron",
"tasks",
"."
] | bfaf61c38e48979036c3ede3a0f2beb637500df5 | https://github.com/yuncms/yuncms-core/blob/bfaf61c38e48979036c3ede3a0f2beb637500df5/console/controllers/CronController.php#L85-L91 | train |
wasinger/adaptimage | src/ResponsiveImages/ResponsiveImageClass.php | ResponsiveImageClass.getImageResizeDefinitionByWidth | public function getImageResizeDefinitionByWidth($width)
{
if (!key_exists($width, $this->irds)) {
throw new WidthNotAllowedException($width);
}
return $this->irds[$width];
} | php | public function getImageResizeDefinitionByWidth($width)
{
if (!key_exists($width, $this->irds)) {
throw new WidthNotAllowedException($width);
}
return $this->irds[$width];
} | [
"public",
"function",
"getImageResizeDefinitionByWidth",
"(",
"$",
"width",
")",
"{",
"if",
"(",
"!",
"key_exists",
"(",
"$",
"width",
",",
"$",
"this",
"->",
"irds",
")",
")",
"{",
"throw",
"new",
"WidthNotAllowedException",
"(",
"$",
"width",
")",
";",
... | Get an ImageResizeDefinition for a given width
@param int $width
@return ImageResizeDefinition | [
"Get",
"an",
"ImageResizeDefinition",
"for",
"a",
"given",
"width"
] | 7b529b25081b399451c8bbd56d0cef7daaa83ec4 | https://github.com/wasinger/adaptimage/blob/7b529b25081b399451c8bbd56d0cef7daaa83ec4/src/ResponsiveImages/ResponsiveImageClass.php#L181-L187 | train |
wasinger/adaptimage | src/ResponsiveImages/ResponsiveImageClass.php | ResponsiveImageClass.setScaleAlgorithm | public function setScaleAlgorithm($algorithm)
{
foreach ($this->available_image_widths as $width) {
$this->irds[$width]->setScaleAlgorithm($algorithm);
}
return $this;
} | php | public function setScaleAlgorithm($algorithm)
{
foreach ($this->available_image_widths as $width) {
$this->irds[$width]->setScaleAlgorithm($algorithm);
}
return $this;
} | [
"public",
"function",
"setScaleAlgorithm",
"(",
"$",
"algorithm",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"available_image_widths",
"as",
"$",
"width",
")",
"{",
"$",
"this",
"->",
"irds",
"[",
"$",
"width",
"]",
"->",
"setScaleAlgorithm",
"(",
"$",
... | Set the algorithm used for scaling
@param string $algorithm One of the ImageInterface::FILTER_* constants
@return $this | [
"Set",
"the",
"algorithm",
"used",
"for",
"scaling"
] | 7b529b25081b399451c8bbd56d0cef7daaa83ec4 | https://github.com/wasinger/adaptimage/blob/7b529b25081b399451c8bbd56d0cef7daaa83ec4/src/ResponsiveImages/ResponsiveImageClass.php#L264-L270 | train |
bseddon/XPath20 | Value/DurationValue.php | DurationValue.getTotalDays | public function getTotalDays()
{
// Get a count of days. The 'diff' function generates an interval with a count of days in ->days
$dt = new \DateTimeImmutable();
return $dt->add( $this->Value )->diff( $dt )->days;
} | php | public function getTotalDays()
{
// Get a count of days. The 'diff' function generates an interval with a count of days in ->days
$dt = new \DateTimeImmutable();
return $dt->add( $this->Value )->diff( $dt )->days;
} | [
"public",
"function",
"getTotalDays",
"(",
")",
"{",
"// Get a count of days. The 'diff' function generates an interval with a count of days in ->days\r",
"$",
"dt",
"=",
"new",
"\\",
"DateTimeImmutable",
"(",
")",
";",
"return",
"$",
"dt",
"->",
"add",
"(",
"$",
"this... | Return the total days of the duration
@return int | [
"Return",
"the",
"total",
"days",
"of",
"the",
"duration"
] | 69882b6efffaa5470a819d5fdd2f6473ddeb046d | https://github.com/bseddon/XPath20/blob/69882b6efffaa5470a819d5fdd2f6473ddeb046d/Value/DurationValue.php#L323-L328 | train |
bseddon/XPath20 | Value/DurationValue.php | DurationValue.hasValue | public static function hasValue( $di )
{
$components = array( "s", "i", "h", "d", "m", "y" );
$hasValue = false;
foreach( $components as $component )
{
$hasValue = isset( $di->$component ) && $di->$component != 0;
if ( $hasValue ) break;
}
return $hasValue;
} | php | public static function hasValue( $di )
{
$components = array( "s", "i", "h", "d", "m", "y" );
$hasValue = false;
foreach( $components as $component )
{
$hasValue = isset( $di->$component ) && $di->$component != 0;
if ( $hasValue ) break;
}
return $hasValue;
} | [
"public",
"static",
"function",
"hasValue",
"(",
"$",
"di",
")",
"{",
"$",
"components",
"=",
"array",
"(",
"\"s\"",
",",
"\"i\"",
",",
"\"h\"",
",",
"\"d\"",
",",
"\"m\"",
",",
"\"y\"",
")",
";",
"$",
"hasValue",
"=",
"false",
";",
"foreach",
"(",
... | Returns true if the date interval parameter has a non zero value
@param \DateInterval $di
@return bool | [
"Returns",
"true",
"if",
"the",
"date",
"interval",
"parameter",
"has",
"a",
"non",
"zero",
"value"
] | 69882b6efffaa5470a819d5fdd2f6473ddeb046d | https://github.com/bseddon/XPath20/blob/69882b6efffaa5470a819d5fdd2f6473ddeb046d/Value/DurationValue.php#L422-L432 | train |
koolkode/view-express | src/Tree/AttributeNode.php | AttributeNode.compile | public function compile(ExpressCompiler $compiler, $flags = 0)
{
try
{
if($flags & self::FLAG_RAW)
{
if(empty($this->childNodes))
{
$compiler->write("''");
}
else
{
$compiler->write('(');
foreach($this->childNodes as $i => $node)
{
if($i > 0)
{
... | php | public function compile(ExpressCompiler $compiler, $flags = 0)
{
try
{
if($flags & self::FLAG_RAW)
{
if(empty($this->childNodes))
{
$compiler->write("''");
}
else
{
$compiler->write('(');
foreach($this->childNodes as $i => $node)
{
if($i > 0)
{
... | [
"public",
"function",
"compile",
"(",
"ExpressCompiler",
"$",
"compiler",
",",
"$",
"flags",
"=",
"0",
")",
"{",
"try",
"{",
"if",
"(",
"$",
"flags",
"&",
"self",
"::",
"FLAG_RAW",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"childNodes",
... | Compile the attribute value into it's PHP code.
@param ExpressCompiler $compiler
@param integer $flags Raw mode is used when the element is going to be morphed from a TagBuilder. | [
"Compile",
"the",
"attribute",
"value",
"into",
"it",
"s",
"PHP",
"code",
"."
] | a8ebe6f373b6bfe8b8818d6264535e8fe063a596 | https://github.com/koolkode/view-express/blob/a8ebe6f373b6bfe8b8818d6264535e8fe063a596/src/Tree/AttributeNode.php#L91-L134 | train |
mkurc1/DoctrinePrefixBundle | Subscriber/TablePrefixSubscriber.php | TablePrefixSubscriber.loadClassMetadata | public function loadClassMetadata(LoadClassMetadataEventArgs $args)
{
if (empty($this->prefix)) {
return;
}
/** @var ClassMetadata $classMetadata */
$classMetadata = $args->getClassMetadata();
if (false === strpos($classMetadata->getTableName(), $this->prefix)) ... | php | public function loadClassMetadata(LoadClassMetadataEventArgs $args)
{
if (empty($this->prefix)) {
return;
}
/** @var ClassMetadata $classMetadata */
$classMetadata = $args->getClassMetadata();
if (false === strpos($classMetadata->getTableName(), $this->prefix)) ... | [
"public",
"function",
"loadClassMetadata",
"(",
"LoadClassMetadataEventArgs",
"$",
"args",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"prefix",
")",
")",
"{",
"return",
";",
"}",
"/** @var ClassMetadata $classMetadata */",
"$",
"classMetadata",
"=",
"... | Load class meta data event
@param LoadClassMetadataEventArgs $args
@return void | [
"Load",
"class",
"meta",
"data",
"event"
] | eaea50e4d3a81c3b4e2648c425387deceacddac7 | https://github.com/mkurc1/DoctrinePrefixBundle/blob/eaea50e4d3a81c3b4e2648c425387deceacddac7/Subscriber/TablePrefixSubscriber.php#L45-L70 | train |
foxslider/cmg-plugin | common/components/Core.php | Core.init | public function init() {
parent::init();
// Foxslider Alias
Yii::setAlias( 'foxslider', dirname( dirname( dirname( __DIR__ ) ) ) );
// Register components and objects
$this->registerComponents();
} | php | public function init() {
parent::init();
// Foxslider Alias
Yii::setAlias( 'foxslider', dirname( dirname( dirname( __DIR__ ) ) ) );
// Register components and objects
$this->registerComponents();
} | [
"public",
"function",
"init",
"(",
")",
"{",
"parent",
"::",
"init",
"(",
")",
";",
"// Foxslider Alias",
"Yii",
"::",
"setAlias",
"(",
"'foxslider'",
",",
"dirname",
"(",
"dirname",
"(",
"dirname",
"(",
"__DIR__",
")",
")",
")",
")",
";",
"// Register c... | Initialize the services. | [
"Initialize",
"the",
"services",
"."
] | 843f723ebb512ab833feff581beb9714df4e41bd | https://github.com/foxslider/cmg-plugin/blob/843f723ebb512ab833feff581beb9714df4e41bd/common/components/Core.php#L36-L45 | train |
FusePump/cli.php | lib/FusePump/Cli/Inputs.php | Inputs.checkInputs | private function checkInputs($short, $long)
{
$key = array_search($short, $this->inputs);
if ($key === false) {
$key = array_search($long, $this->inputs);
if ($key === false) {
return false;
} else {
return $key;
}
... | php | private function checkInputs($short, $long)
{
$key = array_search($short, $this->inputs);
if ($key === false) {
$key = array_search($long, $this->inputs);
if ($key === false) {
return false;
} else {
return $key;
}
... | [
"private",
"function",
"checkInputs",
"(",
"$",
"short",
",",
"$",
"long",
")",
"{",
"$",
"key",
"=",
"array_search",
"(",
"$",
"short",
",",
"$",
"this",
"->",
"inputs",
")",
";",
"if",
"(",
"$",
"key",
"===",
"false",
")",
"{",
"$",
"key",
"=",... | Check input for flag
@param string $short
@param string $long
@return bool|mixed | [
"Check",
"input",
"for",
"flag"
] | 2cc92f09ce7b2f73d5cbc09f5ae4f31f3f9ae3b4 | https://github.com/FusePump/cli.php/blob/2cc92f09ce7b2f73d5cbc09f5ae4f31f3f9ae3b4/lib/FusePump/Cli/Inputs.php#L199-L212 | train |
FusePump/cli.php | lib/FusePump/Cli/Inputs.php | Inputs.checkRequired | private function checkRequired()
{
// Loop through all params
foreach ($this->params as $param) {
if (array_key_exists('required', $param) && $param['required'] == true) {
if (!array_key_exists($param['name'], $this->pinputs)) {
throw new \Exception('P... | php | private function checkRequired()
{
// Loop through all params
foreach ($this->params as $param) {
if (array_key_exists('required', $param) && $param['required'] == true) {
if (!array_key_exists($param['name'], $this->pinputs)) {
throw new \Exception('P... | [
"private",
"function",
"checkRequired",
"(",
")",
"{",
"// Loop through all params",
"foreach",
"(",
"$",
"this",
"->",
"params",
"as",
"$",
"param",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"'required'",
",",
"$",
"param",
")",
"&&",
"$",
"param",
"[... | Check required options
If a required option is not provided then throw and exception
@throws \Exception if required param or option is not present | [
"Check",
"required",
"options",
"If",
"a",
"required",
"option",
"is",
"not",
"provided",
"then",
"throw",
"and",
"exception"
] | 2cc92f09ce7b2f73d5cbc09f5ae4f31f3f9ae3b4 | https://github.com/FusePump/cli.php/blob/2cc92f09ce7b2f73d5cbc09f5ae4f31f3f9ae3b4/lib/FusePump/Cli/Inputs.php#L220-L242 | train |
FusePump/cli.php | lib/FusePump/Cli/Inputs.php | Inputs.confirm | public static function confirm($msg)
{
echo $msg;
$input = trim(fgets(STDIN));
if (strtolower($input) == 'y' || strtolower($input) == 'yes') {
return true;
} else {
return false;
}
} | php | public static function confirm($msg)
{
echo $msg;
$input = trim(fgets(STDIN));
if (strtolower($input) == 'y' || strtolower($input) == 'yes') {
return true;
} else {
return false;
}
} | [
"public",
"static",
"function",
"confirm",
"(",
"$",
"msg",
")",
"{",
"echo",
"$",
"msg",
";",
"$",
"input",
"=",
"trim",
"(",
"fgets",
"(",
"STDIN",
")",
")",
";",
"if",
"(",
"strtolower",
"(",
"$",
"input",
")",
"==",
"'y'",
"||",
"strtolower",
... | Add a confirmation
@param string $msg - question to ask
@static
@return bool - true if yes, false if anything else | [
"Add",
"a",
"confirmation"
] | 2cc92f09ce7b2f73d5cbc09f5ae4f31f3f9ae3b4 | https://github.com/FusePump/cli.php/blob/2cc92f09ce7b2f73d5cbc09f5ae4f31f3f9ae3b4/lib/FusePump/Cli/Inputs.php#L362-L372 | train |
FusePump/cli.php | lib/FusePump/Cli/Inputs.php | Inputs.outputHelp | public function outputHelp($short = false)
{
echo "Usage: " . $this->getName() . " ";
if (!empty($this->params)) {
foreach ($this->params as $param) {
if ($param['required'] == true) {
echo '<' . $param['name'] . '> ';
} else {
... | php | public function outputHelp($short = false)
{
echo "Usage: " . $this->getName() . " ";
if (!empty($this->params)) {
foreach ($this->params as $param) {
if ($param['required'] == true) {
echo '<' . $param['name'] . '> ';
} else {
... | [
"public",
"function",
"outputHelp",
"(",
"$",
"short",
"=",
"false",
")",
"{",
"echo",
"\"Usage: \"",
".",
"$",
"this",
"->",
"getName",
"(",
")",
".",
"\" \"",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"params",
")",
")",
"{",
"foreach... | Output help text
Format:
Usage: {{name}} <param> [options]
Options:
-p, --peppers Add peppers
-c, --cheese [type] Add a cheese
-m, --mayo Add mayonaise
-h, --help Output usage information
@param bool $short - if true, short output text | [
"Output",
"help",
"text"
] | 2cc92f09ce7b2f73d5cbc09f5ae4f31f3f9ae3b4 | https://github.com/FusePump/cli.php/blob/2cc92f09ce7b2f73d5cbc09f5ae4f31f3f9ae3b4/lib/FusePump/Cli/Inputs.php#L389-L427 | train |
Wedeto/Log | src/Writer/FileWriter.php | FileWriter.writeLine | private function writeLine(string $str)
{
$now = time();
if ($this->file && $this->file_opened < $now - $this->reopen_interval)
{
// Close the file after a set interval
fclose($this->file);
$this->file = null;
}
if (!$this->file)
{... | php | private function writeLine(string $str)
{
$now = time();
if ($this->file && $this->file_opened < $now - $this->reopen_interval)
{
// Close the file after a set interval
fclose($this->file);
$this->file = null;
}
if (!$this->file)
{... | [
"private",
"function",
"writeLine",
"(",
"string",
"$",
"str",
")",
"{",
"$",
"now",
"=",
"time",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"file",
"&&",
"$",
"this",
"->",
"file_opened",
"<",
"$",
"now",
"-",
"$",
"this",
"->",
"reopen_interval... | Write a line to the log file
@param string $str The line to write | [
"Write",
"a",
"line",
"to",
"the",
"log",
"file"
] | 88252c5052089fdcc5dae466d1ad5889bb2b735f | https://github.com/Wedeto/Log/blob/88252c5052089fdcc5dae466d1ad5889bb2b735f/src/Writer/FileWriter.php#L88-L119 | train |
irfantoor/database | src/Database/SQLite.php | SQLite.insertOrUpdate | public function insertOrUpdate($tableORq, $data)
{
if (is_string($tableORq)) {
$this->defaults['table'] = $tableORq;
$tableORq = [];
}
extract($this->defaults);
extract($tableORq);
if (!$table)
throw new Exception("table [$tabel] not defin... | php | public function insertOrUpdate($tableORq, $data)
{
if (is_string($tableORq)) {
$this->defaults['table'] = $tableORq;
$tableORq = [];
}
extract($this->defaults);
extract($tableORq);
if (!$table)
throw new Exception("table [$tabel] not defin... | [
"public",
"function",
"insertOrUpdate",
"(",
"$",
"tableORq",
",",
"$",
"data",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"tableORq",
")",
")",
"{",
"$",
"this",
"->",
"defaults",
"[",
"'table'",
"]",
"=",
"$",
"tableORq",
";",
"$",
"tableORq",
"="... | inserts or update a record
@param array $record | [
"inserts",
"or",
"update",
"a",
"record"
] | 0e01e2f265b95f17b1a888137c4364714c367128 | https://github.com/irfantoor/database/blob/0e01e2f265b95f17b1a888137c4364714c367128/src/Database/SQLite.php#L57-L74 | train |
agentmedia/phine-builtin | src/BuiltIn/Modules/Frontend/HtmlCode.php | HtmlCode.Init | protected function Init()
{
$htmlCode = ContentHtmlCode::Schema()->ByContent($this->content);
$this->code= $htmlCode->GetCode();
return parent::Init();
} | php | protected function Init()
{
$htmlCode = ContentHtmlCode::Schema()->ByContent($this->content);
$this->code= $htmlCode->GetCode();
return parent::Init();
} | [
"protected",
"function",
"Init",
"(",
")",
"{",
"$",
"htmlCode",
"=",
"ContentHtmlCode",
"::",
"Schema",
"(",
")",
"->",
"ByContent",
"(",
"$",
"this",
"->",
"content",
")",
";",
"$",
"this",
"->",
"code",
"=",
"$",
"htmlCode",
"->",
"GetCode",
"(",
... | Initializes the html code frontend module
@return boolean | [
"Initializes",
"the",
"html",
"code",
"frontend",
"module"
] | 4dd05bc406a71e997bd4eaa16b12e23dbe62a456 | https://github.com/agentmedia/phine-builtin/blob/4dd05bc406a71e997bd4eaa16b12e23dbe62a456/src/BuiltIn/Modules/Frontend/HtmlCode.php#L23-L28 | train |
agentmedia/phine-builtin | src/BuiltIn/Modules/Frontend/HtmlCode.php | HtmlCode.BackendName | public function BackendName()
{
$result = 'code';
if (!$this->content)
{
return $result;
}
$htmlCode = ContentHtmlCode::Schema()->ByContent($this->content);
$code = Text::Shorten($htmlCode->GetCode());
if ($code)
{
$result .= ' ... | php | public function BackendName()
{
$result = 'code';
if (!$this->content)
{
return $result;
}
$htmlCode = ContentHtmlCode::Schema()->ByContent($this->content);
$code = Text::Shorten($htmlCode->GetCode());
if ($code)
{
$result .= ' ... | [
"public",
"function",
"BackendName",
"(",
")",
"{",
"$",
"result",
"=",
"'code'",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"content",
")",
"{",
"return",
"$",
"result",
";",
"}",
"$",
"htmlCode",
"=",
"ContentHtmlCode",
"::",
"Schema",
"(",
")",
"->",... | The backend name for the code
@return string | [
"The",
"backend",
"name",
"for",
"the",
"code"
] | 4dd05bc406a71e997bd4eaa16b12e23dbe62a456 | https://github.com/agentmedia/phine-builtin/blob/4dd05bc406a71e997bd4eaa16b12e23dbe62a456/src/BuiltIn/Modules/Frontend/HtmlCode.php#L52-L66 | train |
wb-crowdfusion/crowdfusion | system/core/classes/mvc/filters/PermissionFilterer.php | PermissionFilterer.pass | public function pass()
{
$action = $this->getParameter('action');
return $this->Permissions->checkPermission($action, $this->getLocal('SiteSlug'));
} | php | public function pass()
{
$action = $this->getParameter('action');
return $this->Permissions->checkPermission($action, $this->getLocal('SiteSlug'));
} | [
"public",
"function",
"pass",
"(",
")",
"{",
"$",
"action",
"=",
"$",
"this",
"->",
"getParameter",
"(",
"'action'",
")",
";",
"return",
"$",
"this",
"->",
"Permissions",
"->",
"checkPermission",
"(",
"$",
"action",
",",
"$",
"this",
"->",
"getLocal",
... | Checks if the specified action is granted to the current user
Expected Params:
action string The action string to check
@return boolean True if the user is allowed access | [
"Checks",
"if",
"the",
"specified",
"action",
"is",
"granted",
"to",
"the",
"current",
"user"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/mvc/filters/PermissionFilterer.php#L60-L65 | train |
ScaraMVC/Framework | src/Scara/Validation/ValidationParser.php | ValidationParser.required | public function required($input, $key, $lang)
{
$lang = $this->custom('required', $lang);
if (empty($input[$key])) {
return str_replace(':field', $key, $lang);
}
} | php | public function required($input, $key, $lang)
{
$lang = $this->custom('required', $lang);
if (empty($input[$key])) {
return str_replace(':field', $key, $lang);
}
} | [
"public",
"function",
"required",
"(",
"$",
"input",
",",
"$",
"key",
",",
"$",
"lang",
")",
"{",
"$",
"lang",
"=",
"$",
"this",
"->",
"custom",
"(",
"'required'",
",",
"$",
"lang",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"input",
"[",
"$",
"ke... | Parses a required validation field.
@param array $input - Input to be validated
@param string $key - Validation key
@param string $lang - Language string
@return string | [
"Parses",
"a",
"required",
"validation",
"field",
"."
] | 199b08b45fadf5dae14ac4732af03b36e15bbef2 | https://github.com/ScaraMVC/Framework/blob/199b08b45fadf5dae14ac4732af03b36e15bbef2/src/Scara/Validation/ValidationParser.php#L57-L63 | train |
ScaraMVC/Framework | src/Scara/Validation/ValidationParser.php | ValidationParser.match | public function match($input, $key, $match, $lang)
{
$lang = $this->custom('match', $lang);
if ($input[$key] !== $input[$match]) {
return preg_replace_callback('/(\:field)(.*)(\:match)/i',
function ($m) use ($key, $match) {
return $key.$m[2].$match;
... | php | public function match($input, $key, $match, $lang)
{
$lang = $this->custom('match', $lang);
if ($input[$key] !== $input[$match]) {
return preg_replace_callback('/(\:field)(.*)(\:match)/i',
function ($m) use ($key, $match) {
return $key.$m[2].$match;
... | [
"public",
"function",
"match",
"(",
"$",
"input",
",",
"$",
"key",
",",
"$",
"match",
",",
"$",
"lang",
")",
"{",
"$",
"lang",
"=",
"$",
"this",
"->",
"custom",
"(",
"'match'",
",",
"$",
"lang",
")",
";",
"if",
"(",
"$",
"input",
"[",
"$",
"k... | Parses a match validation field.
@param array $input - Input to be validated
@param string $key - Validation key
@param string $match - The option looking to be matched up with $key
@param string $lang - Language string
@return string | [
"Parses",
"a",
"match",
"validation",
"field",
"."
] | 199b08b45fadf5dae14ac4732af03b36e15bbef2 | https://github.com/ScaraMVC/Framework/blob/199b08b45fadf5dae14ac4732af03b36e15bbef2/src/Scara/Validation/ValidationParser.php#L75-L84 | train |
ScaraMVC/Framework | src/Scara/Validation/ValidationParser.php | ValidationParser.email | public function email($input, $key, $lang)
{
$lang = $this->custom('email', $lang);
if (filter_var($input[$key], FILTER_VALIDATE_EMAIL) === false) {
return str_replace(':field', $key, $lang);
}
} | php | public function email($input, $key, $lang)
{
$lang = $this->custom('email', $lang);
if (filter_var($input[$key], FILTER_VALIDATE_EMAIL) === false) {
return str_replace(':field', $key, $lang);
}
} | [
"public",
"function",
"email",
"(",
"$",
"input",
",",
"$",
"key",
",",
"$",
"lang",
")",
"{",
"$",
"lang",
"=",
"$",
"this",
"->",
"custom",
"(",
"'email'",
",",
"$",
"lang",
")",
";",
"if",
"(",
"filter_var",
"(",
"$",
"input",
"[",
"$",
"key... | Parses an email validation field.
@param array $input - Input to be validated
@param string $key - Validation key
@param string $lang - Language string
@return string | [
"Parses",
"an",
"email",
"validation",
"field",
"."
] | 199b08b45fadf5dae14ac4732af03b36e15bbef2 | https://github.com/ScaraMVC/Framework/blob/199b08b45fadf5dae14ac4732af03b36e15bbef2/src/Scara/Validation/ValidationParser.php#L95-L101 | train |
ScaraMVC/Framework | src/Scara/Validation/ValidationParser.php | ValidationParser.url | public function url($input, $key, $lang)
{
$lang = $this->custom('url', $lang);
if (filter_var($input[$key], FILTER_VALIDATE_URL) === false) {
return str_replace(':field', $key, $lang);
}
} | php | public function url($input, $key, $lang)
{
$lang = $this->custom('url', $lang);
if (filter_var($input[$key], FILTER_VALIDATE_URL) === false) {
return str_replace(':field', $key, $lang);
}
} | [
"public",
"function",
"url",
"(",
"$",
"input",
",",
"$",
"key",
",",
"$",
"lang",
")",
"{",
"$",
"lang",
"=",
"$",
"this",
"->",
"custom",
"(",
"'url'",
",",
"$",
"lang",
")",
";",
"if",
"(",
"filter_var",
"(",
"$",
"input",
"[",
"$",
"key",
... | Parses URL validation field.
@param array $input - Input to be validated
@param string $key - Validation key
@param string $lang - Language string
@return string | [
"Parses",
"URL",
"validation",
"field",
"."
] | 199b08b45fadf5dae14ac4732af03b36e15bbef2 | https://github.com/ScaraMVC/Framework/blob/199b08b45fadf5dae14ac4732af03b36e15bbef2/src/Scara/Validation/ValidationParser.php#L112-L118 | train |
ScaraMVC/Framework | src/Scara/Validation/ValidationParser.php | ValidationParser.min | public function min($input, $key, $min, $lang)
{
$lang = $this->custom('min', $lang);
if (strlen($input[$key]) < $min) {
return preg_replace_callback('/(:field)(.*)(\:num)/i',
function ($m) use ($key, $min) {
return $key.$m[2].$min;
}, $lang);
... | php | public function min($input, $key, $min, $lang)
{
$lang = $this->custom('min', $lang);
if (strlen($input[$key]) < $min) {
return preg_replace_callback('/(:field)(.*)(\:num)/i',
function ($m) use ($key, $min) {
return $key.$m[2].$min;
}, $lang);
... | [
"public",
"function",
"min",
"(",
"$",
"input",
",",
"$",
"key",
",",
"$",
"min",
",",
"$",
"lang",
")",
"{",
"$",
"lang",
"=",
"$",
"this",
"->",
"custom",
"(",
"'min'",
",",
"$",
"lang",
")",
";",
"if",
"(",
"strlen",
"(",
"$",
"input",
"["... | Parses a set minimum number of characters.
@param array $input - Language string
@param string $key - Validation Key
@param int $min - The set minimum
@param string $lang - Language string
@return mixed | [
"Parses",
"a",
"set",
"minimum",
"number",
"of",
"characters",
"."
] | 199b08b45fadf5dae14ac4732af03b36e15bbef2 | https://github.com/ScaraMVC/Framework/blob/199b08b45fadf5dae14ac4732af03b36e15bbef2/src/Scara/Validation/ValidationParser.php#L130-L139 | train |
ScaraMVC/Framework | src/Scara/Validation/ValidationParser.php | ValidationParser.max | public function max($input, $key, $max, $lang)
{
$lang = $this->custom('max', $lang);
if (strlen($input[$key]) > $max) {
return preg_replace_callback('/(:field)(.*)(\:num)/i',
function ($m) use ($key, $max) {
return $key.$m[2].$max;
}, $lang);
... | php | public function max($input, $key, $max, $lang)
{
$lang = $this->custom('max', $lang);
if (strlen($input[$key]) > $max) {
return preg_replace_callback('/(:field)(.*)(\:num)/i',
function ($m) use ($key, $max) {
return $key.$m[2].$max;
}, $lang);
... | [
"public",
"function",
"max",
"(",
"$",
"input",
",",
"$",
"key",
",",
"$",
"max",
",",
"$",
"lang",
")",
"{",
"$",
"lang",
"=",
"$",
"this",
"->",
"custom",
"(",
"'max'",
",",
"$",
"lang",
")",
";",
"if",
"(",
"strlen",
"(",
"$",
"input",
"["... | Parses a set maximum number of characters.
@param $input - Language string
@param string $key - Validation Key
@param int $max - The set maximum
@param string $lang - Language string
@return mixed | [
"Parses",
"a",
"set",
"maximum",
"number",
"of",
"characters",
"."
] | 199b08b45fadf5dae14ac4732af03b36e15bbef2 | https://github.com/ScaraMVC/Framework/blob/199b08b45fadf5dae14ac4732af03b36e15bbef2/src/Scara/Validation/ValidationParser.php#L151-L160 | train |
ScaraMVC/Framework | src/Scara/Validation/ValidationParser.php | ValidationParser.from | public function from($input, $key, $rule, $lang)
{
$lang = $this->custom('from', $lang);
$db = new Database();
$cap = $db->getCapsule();
$exp = explode(':', $rule);
$table = $cap->table($exp[1]);
if ($table->where($exp[2], '=', $input[$key])->count() == 0) {
... | php | public function from($input, $key, $rule, $lang)
{
$lang = $this->custom('from', $lang);
$db = new Database();
$cap = $db->getCapsule();
$exp = explode(':', $rule);
$table = $cap->table($exp[1]);
if ($table->where($exp[2], '=', $input[$key])->count() == 0) {
... | [
"public",
"function",
"from",
"(",
"$",
"input",
",",
"$",
"key",
",",
"$",
"rule",
",",
"$",
"lang",
")",
"{",
"$",
"lang",
"=",
"$",
"this",
"->",
"custom",
"(",
"'from'",
",",
"$",
"lang",
")",
";",
"$",
"db",
"=",
"new",
"Database",
"(",
... | Checks if a given field exists in given database table.
@param $input - Language string
@param string $key - Validation Key
@param array $rule - The entire rule (Needed for multi-parsing)
@param string $lang - Language string
@return mixed | [
"Checks",
"if",
"a",
"given",
"field",
"exists",
"in",
"given",
"database",
"table",
"."
] | 199b08b45fadf5dae14ac4732af03b36e15bbef2 | https://github.com/ScaraMVC/Framework/blob/199b08b45fadf5dae14ac4732af03b36e15bbef2/src/Scara/Validation/ValidationParser.php#L172-L189 | train |
CommonApi/Query | QueryUsageTrait.php | QueryUsageTrait.setQueryController | protected function setQueryController($namespace, $crud_type = 'Read')
{
$options = $this->setQueryOptions($crud_type);
try {
$this->query = $this->resource->get('query://' . $namespace, $options);
} catch (Exception $e) {
throw new RuntimeException($e->getMessage()... | php | protected function setQueryController($namespace, $crud_type = 'Read')
{
$options = $this->setQueryOptions($crud_type);
try {
$this->query = $this->resource->get('query://' . $namespace, $options);
} catch (Exception $e) {
throw new RuntimeException($e->getMessage()... | [
"protected",
"function",
"setQueryController",
"(",
"$",
"namespace",
",",
"$",
"crud_type",
"=",
"'Read'",
")",
"{",
"$",
"options",
"=",
"$",
"this",
"->",
"setQueryOptions",
"(",
"$",
"crud_type",
")",
";",
"try",
"{",
"$",
"this",
"->",
"query",
"=",... | Set Query Controller
@param string $namespace
@param string $crud_type
@return $this
@since 1.0.0
@throws \CommonApi\Exception\RuntimeException | [
"Set",
"Query",
"Controller"
] | 0c4bdcd1dc82b1994fdce83cda581573ba56d6e7 | https://github.com/CommonApi/Query/blob/0c4bdcd1dc82b1994fdce83cda581573ba56d6e7/QueryUsageTrait.php#L85-L97 | train |
CommonApi/Query | QueryUsageTrait.php | QueryUsageTrait.setQueryOptions | protected function setQueryOptions($crud_type = 'Read')
{
$options = array();
$crud_type = ucfirst(strtolower($crud_type));
if ($crud_type === 'Create'
|| $crud_type === 'Read'
|| $crud_type === 'Update'
|| $crud_type === 'Delete'
) {
} ... | php | protected function setQueryOptions($crud_type = 'Read')
{
$options = array();
$crud_type = ucfirst(strtolower($crud_type));
if ($crud_type === 'Create'
|| $crud_type === 'Read'
|| $crud_type === 'Update'
|| $crud_type === 'Delete'
) {
} ... | [
"protected",
"function",
"setQueryOptions",
"(",
"$",
"crud_type",
"=",
"'Read'",
")",
"{",
"$",
"options",
"=",
"array",
"(",
")",
";",
"$",
"crud_type",
"=",
"ucfirst",
"(",
"strtolower",
"(",
"$",
"crud_type",
")",
")",
";",
"if",
"(",
"$",
"crud_ty... | Set Query Options
@param string $crud_type
@return array
@since 1.0.0 | [
"Set",
"Query",
"Options"
] | 0c4bdcd1dc82b1994fdce83cda581573ba56d6e7 | https://github.com/CommonApi/Query/blob/0c4bdcd1dc82b1994fdce83cda581573ba56d6e7/QueryUsageTrait.php#L107-L129 | train |
CommonApi/Query | QueryUsageTrait.php | QueryUsageTrait.setQueryControllerDefaults | protected function setQueryControllerDefaults(
$process_events = 0,
$query_object = 'item',
$get_customfields = 0,
$use_special_joins = 0,
$use_pagination = 0,
$check_view_level_access = 0,
$get_item_children = 0
) {
$this->query->setModelRegistry('pro... | php | protected function setQueryControllerDefaults(
$process_events = 0,
$query_object = 'item',
$get_customfields = 0,
$use_special_joins = 0,
$use_pagination = 0,
$check_view_level_access = 0,
$get_item_children = 0
) {
$this->query->setModelRegistry('pro... | [
"protected",
"function",
"setQueryControllerDefaults",
"(",
"$",
"process_events",
"=",
"0",
",",
"$",
"query_object",
"=",
"'item'",
",",
"$",
"get_customfields",
"=",
"0",
",",
"$",
"use_special_joins",
"=",
"0",
",",
"$",
"use_pagination",
"=",
"0",
",",
... | Set Query Controller Default Values
@param integer $process_events
@param string $query_object
@param integer $get_customfields
@param integer $use_special_joins
@param integer $use_pagination
@param integer $check_view_level_access
@return $this
@since 1.0.0 | [
"Set",
"Query",
"Controller",
"Default",
"Values"
] | 0c4bdcd1dc82b1994fdce83cda581573ba56d6e7 | https://github.com/CommonApi/Query/blob/0c4bdcd1dc82b1994fdce83cda581573ba56d6e7/QueryUsageTrait.php#L144-L162 | train |
CommonApi/Query | QueryUsageTrait.php | QueryUsageTrait.setModelRegistryCriteria | protected function setModelRegistryCriteria()
{
$prefix = $this->query->getModelRegistry('primary_prefix', 'a');
$this->setModelRegistryCatalogTypeIdCriteria($prefix);
$this->setModelRegistryExtensionInstanceIdCriteria($prefix);
$this->setModelRegistryMenuIdCriteria($prefix);
... | php | protected function setModelRegistryCriteria()
{
$prefix = $this->query->getModelRegistry('primary_prefix', 'a');
$this->setModelRegistryCatalogTypeIdCriteria($prefix);
$this->setModelRegistryExtensionInstanceIdCriteria($prefix);
$this->setModelRegistryMenuIdCriteria($prefix);
... | [
"protected",
"function",
"setModelRegistryCriteria",
"(",
")",
"{",
"$",
"prefix",
"=",
"$",
"this",
"->",
"query",
"->",
"getModelRegistry",
"(",
"'primary_prefix'",
",",
"'a'",
")",
";",
"$",
"this",
"->",
"setModelRegistryCatalogTypeIdCriteria",
"(",
"$",
"pr... | Set Standard Model Registry Criteria
@return $this
@since 1.0.0 | [
"Set",
"Standard",
"Model",
"Registry",
"Criteria"
] | 0c4bdcd1dc82b1994fdce83cda581573ba56d6e7 | https://github.com/CommonApi/Query/blob/0c4bdcd1dc82b1994fdce83cda581573ba56d6e7/QueryUsageTrait.php#L210-L220 | train |
CommonApi/Query | QueryUsageTrait.php | QueryUsageTrait.setStandardFields | protected function setStandardFields($data, array $model_registry = array())
{
$fields = $model_registry['fields'];
$this->customfieldgroups = $model_registry['customfieldgroups'];
$base = $this->processQueryFields($data, $fields);
return $this->sortObject($base);
} | php | protected function setStandardFields($data, array $model_registry = array())
{
$fields = $model_registry['fields'];
$this->customfieldgroups = $model_registry['customfieldgroups'];
$base = $this->processQueryFields($data, $fields);
return $this->sortObject($base);
} | [
"protected",
"function",
"setStandardFields",
"(",
"$",
"data",
",",
"array",
"$",
"model_registry",
"=",
"array",
"(",
")",
")",
"{",
"$",
"fields",
"=",
"$",
"model_registry",
"[",
"'fields'",
"]",
";",
"$",
"this",
"->",
"customfieldgroups",
"=",
"$",
... | Set Standard Fields
@param object $data
@param array $model_registry
@return stdClass
@since 1.0.0 | [
"Set",
"Standard",
"Fields"
] | 0c4bdcd1dc82b1994fdce83cda581573ba56d6e7 | https://github.com/CommonApi/Query/blob/0c4bdcd1dc82b1994fdce83cda581573ba56d6e7/QueryUsageTrait.php#L312-L321 | train |
CommonApi/Query | QueryUsageTrait.php | QueryUsageTrait.setCustomFields | protected function setCustomFields($base, $data, array $model_registry = array())
{
if (count($this->customfieldgroups) > 0) {
} else {
return $base;
}
foreach ($this->customfieldgroups as $group) {
$group_data = $this->processQueryFields(json_decode($data-... | php | protected function setCustomFields($base, $data, array $model_registry = array())
{
if (count($this->customfieldgroups) > 0) {
} else {
return $base;
}
foreach ($this->customfieldgroups as $group) {
$group_data = $this->processQueryFields(json_decode($data-... | [
"protected",
"function",
"setCustomFields",
"(",
"$",
"base",
",",
"$",
"data",
",",
"array",
"$",
"model_registry",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"customfieldgroups",
")",
">",
"0",
")",
"{",
"}",
"els... | Set Custom Fields
@param object $base
@param object $data
@param array $model_registry
@return object
@since 1.0.0 | [
"Set",
"Custom",
"Fields"
] | 0c4bdcd1dc82b1994fdce83cda581573ba56d6e7 | https://github.com/CommonApi/Query/blob/0c4bdcd1dc82b1994fdce83cda581573ba56d6e7/QueryUsageTrait.php#L333-L346 | train |
CommonApi/Query | QueryUsageTrait.php | QueryUsageTrait.verifyFieldDefined | protected function verifyFieldDefined($key, $field)
{
if (count($field) === 0) {
throw new RuntimeException(
get_class($this)
. ' Field: ' . $key . ' not defined '
. ' in QueryUsageTrait::processQueryFields.'
);
}
retu... | php | protected function verifyFieldDefined($key, $field)
{
if (count($field) === 0) {
throw new RuntimeException(
get_class($this)
. ' Field: ' . $key . ' not defined '
. ' in QueryUsageTrait::processQueryFields.'
);
}
retu... | [
"protected",
"function",
"verifyFieldDefined",
"(",
"$",
"key",
",",
"$",
"field",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"field",
")",
"===",
"0",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"get_class",
"(",
"$",
"this",
")",
".",
"' Field: '... | Verify Field is Defined
@param string $key
@param array $fields
@return $this
@since 1.0.0
@throws \CommonApi\Exception\RuntimeException | [
"Verify",
"Field",
"is",
"Defined"
] | 0c4bdcd1dc82b1994fdce83cda581573ba56d6e7 | https://github.com/CommonApi/Query/blob/0c4bdcd1dc82b1994fdce83cda581573ba56d6e7/QueryUsageTrait.php#L391-L403 | train |
CommonApi/Query | QueryUsageTrait.php | QueryUsageTrait.setFieldValue | protected function setFieldValue($key, $data, $default = null)
{
$value = null;
if (isset($data->$key)) {
$value = $data->$key;
}
if ($value === null) {
$value = $default;
}
return $value;
} | php | protected function setFieldValue($key, $data, $default = null)
{
$value = null;
if (isset($data->$key)) {
$value = $data->$key;
}
if ($value === null) {
$value = $default;
}
return $value;
} | [
"protected",
"function",
"setFieldValue",
"(",
"$",
"key",
",",
"$",
"data",
",",
"$",
"default",
"=",
"null",
")",
"{",
"$",
"value",
"=",
"null",
";",
"if",
"(",
"isset",
"(",
"$",
"data",
"->",
"$",
"key",
")",
")",
"{",
"$",
"value",
"=",
"... | Set Value for Field
@param string $key
@param object $data
@param null|mixed $default
@return stdClass
@since 1.0.0 | [
"Set",
"Value",
"for",
"Field"
] | 0c4bdcd1dc82b1994fdce83cda581573ba56d6e7 | https://github.com/CommonApi/Query/blob/0c4bdcd1dc82b1994fdce83cda581573ba56d6e7/QueryUsageTrait.php#L452-L465 | train |
CommonApi/Query | QueryUsageTrait.php | QueryUsageTrait.sortObject | protected function sortObject($object)
{
$sort_array = get_object_vars($object);
ksort($sort_array);
$new_object = new stdClass();
foreach ($sort_array as $key => $value) {
if (is_object($value)) {
$value = $this->sortObject($value);
}
... | php | protected function sortObject($object)
{
$sort_array = get_object_vars($object);
ksort($sort_array);
$new_object = new stdClass();
foreach ($sort_array as $key => $value) {
if (is_object($value)) {
$value = $this->sortObject($value);
}
... | [
"protected",
"function",
"sortObject",
"(",
"$",
"object",
")",
"{",
"$",
"sort_array",
"=",
"get_object_vars",
"(",
"$",
"object",
")",
";",
"ksort",
"(",
"$",
"sort_array",
")",
";",
"$",
"new_object",
"=",
"new",
"stdClass",
"(",
")",
";",
"foreach",
... | Sort an object
@param object $object
@return object
@since 1.0.0 | [
"Sort",
"an",
"object"
] | 0c4bdcd1dc82b1994fdce83cda581573ba56d6e7 | https://github.com/CommonApi/Query/blob/0c4bdcd1dc82b1994fdce83cda581573ba56d6e7/QueryUsageTrait.php#L494-L511 | train |
OpenConext-Attic/OpenConext-engineblock-metadata | src/X509/X509PrivateKey.php | X509PrivateKey.sign | public function sign($data)
{
$privateKeyResource = openssl_pkey_get_private('file://' . $this->filePath);
$signature = null;
openssl_sign($data, $signature, $privateKeyResource);
openssl_free_key($privateKeyResource);
return $signature;
} | php | public function sign($data)
{
$privateKeyResource = openssl_pkey_get_private('file://' . $this->filePath);
$signature = null;
openssl_sign($data, $signature, $privateKeyResource);
openssl_free_key($privateKeyResource);
return $signature;
} | [
"public",
"function",
"sign",
"(",
"$",
"data",
")",
"{",
"$",
"privateKeyResource",
"=",
"openssl_pkey_get_private",
"(",
"'file://'",
".",
"$",
"this",
"->",
"filePath",
")",
";",
"$",
"signature",
"=",
"null",
";",
"openssl_sign",
"(",
"$",
"data",
",",... | Sign some data with this private key.
Note how we never actually load the private key into memory, we let OpenSSL do this and afterwards immediately
tell OpenSSL to forget the key to reduce chances of leakage.
@param string $data
@return string | [
"Sign",
"some",
"data",
"with",
"this",
"private",
"key",
"."
] | 236e2f52ef9cf28e71404544a1c4388f63ee535d | https://github.com/OpenConext-Attic/OpenConext-engineblock-metadata/blob/236e2f52ef9cf28e71404544a1c4388f63ee535d/src/X509/X509PrivateKey.php#L62-L72 | train |
gplcart/twocheckout | controllers/Settings.php | Settings.editSettings | public function editSettings()
{
$this->setTitleEditSettings();
$this->setBreadcrumbEditSettings();
$this->setData('statuses', $this->order->getStatuses());
$this->setData('settings', $this->module->getSettings('twocheckout'));
$this->submitSettings();
$this->output... | php | public function editSettings()
{
$this->setTitleEditSettings();
$this->setBreadcrumbEditSettings();
$this->setData('statuses', $this->order->getStatuses());
$this->setData('settings', $this->module->getSettings('twocheckout'));
$this->submitSettings();
$this->output... | [
"public",
"function",
"editSettings",
"(",
")",
"{",
"$",
"this",
"->",
"setTitleEditSettings",
"(",
")",
";",
"$",
"this",
"->",
"setBreadcrumbEditSettings",
"(",
")",
";",
"$",
"this",
"->",
"setData",
"(",
"'statuses'",
",",
"$",
"this",
"->",
"order",
... | Route page callback to display module settings form | [
"Route",
"page",
"callback",
"to",
"display",
"module",
"settings",
"form"
] | b1578f866ac29d37720e1d616b8b4783832d5107 | https://github.com/gplcart/twocheckout/blob/b1578f866ac29d37720e1d616b8b4783832d5107/controllers/Settings.php#L41-L51 | train |
PaulDevelop/Library.Modeling.Xml | src/class/Tag.php | Tag.toXml | public function toXml()
{
// init
$result = '';
$tagName = ($this->namespace == '' ? '' : $this->namespace.':').$this->name;
$attributes = '';
foreach ($this->attributes as $attribute) {
$attributes .= ' '.$attribute->Name.'="'.$attribute->Value.'"';
}
... | php | public function toXml()
{
// init
$result = '';
$tagName = ($this->namespace == '' ? '' : $this->namespace.':').$this->name;
$attributes = '';
foreach ($this->attributes as $attribute) {
$attributes .= ' '.$attribute->Name.'="'.$attribute->Value.'"';
}
... | [
"public",
"function",
"toXml",
"(",
")",
"{",
"// init",
"$",
"result",
"=",
"''",
";",
"$",
"tagName",
"=",
"(",
"$",
"this",
"->",
"namespace",
"==",
"''",
"?",
"''",
":",
"$",
"this",
"->",
"namespace",
".",
"':'",
")",
".",
"$",
"this",
"->",... | Convert to XML.
@return string | [
"Convert",
"to",
"XML",
"."
] | d13d302e1200ca5943169555265c9731c8eddaf5 | https://github.com/PaulDevelop/Library.Modeling.Xml/blob/d13d302e1200ca5943169555265c9731c8eddaf5/src/class/Tag.php#L95-L115 | train |
jayzeng/PHPEnum | Src/Util/Enum.php | Enum.getAllValues | final public function getAllValues() {
$subClass = get_called_class();
// Subclass has already been registered
if(isset($this->_cachedEnums[$subClass])) {
return FALSE;
}
$reflection = new \ReflectionClass($subClass);
return $reflection->getConstants();
... | php | final public function getAllValues() {
$subClass = get_called_class();
// Subclass has already been registered
if(isset($this->_cachedEnums[$subClass])) {
return FALSE;
}
$reflection = new \ReflectionClass($subClass);
return $reflection->getConstants();
... | [
"final",
"public",
"function",
"getAllValues",
"(",
")",
"{",
"$",
"subClass",
"=",
"get_called_class",
"(",
")",
";",
"// Subclass has already been registered",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_cachedEnums",
"[",
"$",
"subClass",
"]",
")",
")",
... | Return all populated arrays
@return false|array return array of constants
or false when the subclass is
already registered in cache | [
"Return",
"all",
"populated",
"arrays"
] | af04fa72a664f19a0900de4b7a69af4888854d1d | https://github.com/jayzeng/PHPEnum/blob/af04fa72a664f19a0900de4b7a69af4888854d1d/Src/Util/Enum.php#L63-L74 | train |
KickAssCommerce/framework | src/Commerce/Product/Cache/Product.php | Product.afterMethodExecution | public function afterMethodExecution(MethodInvocation $invocation)
{
$filesystemAdapter = new Local(APP_BASE_DIR . 'storage/cache/api/');
$filesystem = new Filesystem($filesystemAdapter);
$pool = new FilesystemCachePool($filesystem);
$cacheKey = "products_" . md5(implode('_'... | php | public function afterMethodExecution(MethodInvocation $invocation)
{
$filesystemAdapter = new Local(APP_BASE_DIR . 'storage/cache/api/');
$filesystem = new Filesystem($filesystemAdapter);
$pool = new FilesystemCachePool($filesystem);
$cacheKey = "products_" . md5(implode('_'... | [
"public",
"function",
"afterMethodExecution",
"(",
"MethodInvocation",
"$",
"invocation",
")",
"{",
"$",
"filesystemAdapter",
"=",
"new",
"Local",
"(",
"APP_BASE_DIR",
".",
"'storage/cache/api/'",
")",
";",
"$",
"filesystem",
"=",
"new",
"Filesystem",
"(",
"$",
... | Cache bridge file response
@param MethodInvocation $invocation
@return \KickAss\Commerce\Product\Map\Product
@Around("execution(public KickAss\Commerce\Product\Repository\Product->loadByAttribute(*))") | [
"Cache",
"bridge",
"file",
"response"
] | 492f4baa1e660f72acc83d37df45581aa8dfeb38 | https://github.com/KickAssCommerce/framework/blob/492f4baa1e660f72acc83d37df45581aa8dfeb38/src/Commerce/Product/Cache/Product.php#L32-L62 | train |
kael-shipman/php-std-traits | src/AbstractCliConfig.php | AbstractCliConfig.reload | public function reload(): void
{
$config = [];
foreach($this->configSources as $src) {
// If it's a string, then it's a file or directory path
if (is_string($src)) {
// If directory, get all config files within it, recursively
if (is_dir($src))... | php | public function reload(): void
{
$config = [];
foreach($this->configSources as $src) {
// If it's a string, then it's a file or directory path
if (is_string($src)) {
// If directory, get all config files within it, recursively
if (is_dir($src))... | [
"public",
"function",
"reload",
"(",
")",
":",
"void",
"{",
"$",
"config",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"configSources",
"as",
"$",
"src",
")",
"{",
"// If it's a string, then it's a file or directory path",
"if",
"(",
"is_string",
... | Reload the config from it's sources (usually done on SIGHUP to load in
configuration changes in files
@return void | [
"Reload",
"the",
"config",
"from",
"it",
"s",
"sources",
"(",
"usually",
"done",
"on",
"SIGHUP",
"to",
"load",
"in",
"configuration",
"changes",
"in",
"files"
] | c21ddfc9dc682e6589e52f3717df81e0d2972c0e | https://github.com/kael-shipman/php-std-traits/blob/c21ddfc9dc682e6589e52f3717df81e0d2972c0e/src/AbstractCliConfig.php#L55-L102 | train |
kael-shipman/php-std-traits | src/AbstractCliConfig.php | AbstractCliConfig.parseConfig | protected function parseConfig(string $config): array
{
$config = json_decode($config, true);
if ($config === null) {
throw new ConfigFileFormatException("Config files should be written in valid JSON");
}
return $config;
} | php | protected function parseConfig(string $config): array
{
$config = json_decode($config, true);
if ($config === null) {
throw new ConfigFileFormatException("Config files should be written in valid JSON");
}
return $config;
} | [
"protected",
"function",
"parseConfig",
"(",
"string",
"$",
"config",
")",
":",
"array",
"{",
"$",
"config",
"=",
"json_decode",
"(",
"$",
"config",
",",
"true",
")",
";",
"if",
"(",
"$",
"config",
"===",
"null",
")",
"{",
"throw",
"new",
"ConfigFileFo... | An overridable method that allows parsing arbitrary strings into config arrays
@param string $config The contents of a config file (or sometimes the filename itself)
@return array The config array resulting from the parse | [
"An",
"overridable",
"method",
"that",
"allows",
"parsing",
"arbitrary",
"strings",
"into",
"config",
"arrays"
] | c21ddfc9dc682e6589e52f3717df81e0d2972c0e | https://github.com/kael-shipman/php-std-traits/blob/c21ddfc9dc682e6589e52f3717df81e0d2972c0e/src/AbstractCliConfig.php#L110-L117 | train |
ColibriPlatform/base | controllers/InstallController.php | InstallController.actionIndex | public function actionIndex($lang = '')
{
$model = new InstallForm();
if (!empty($lang)) {
Yii::$app->language = $lang;
$model->language = $lang;
}
if ($model->load(Yii::$app->request->post()) && $model->validate()) {
$this->createEnvFile($model... | php | public function actionIndex($lang = '')
{
$model = new InstallForm();
if (!empty($lang)) {
Yii::$app->language = $lang;
$model->language = $lang;
}
if ($model->load(Yii::$app->request->post()) && $model->validate()) {
$this->createEnvFile($model... | [
"public",
"function",
"actionIndex",
"(",
"$",
"lang",
"=",
"''",
")",
"{",
"$",
"model",
"=",
"new",
"InstallForm",
"(",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"lang",
")",
")",
"{",
"Yii",
"::",
"$",
"app",
"->",
"language",
"=",
"$",
"... | Display the install form
@param string $lang The lang to use
@return string | [
"Display",
"the",
"install",
"form"
] | b45db9c88317e28acc5b024ac98f8428685179aa | https://github.com/ColibriPlatform/base/blob/b45db9c88317e28acc5b024ac98f8428685179aa/controllers/InstallController.php#L31-L64 | train |
ColibriPlatform/base | controllers/InstallController.php | InstallController.processMigrations | protected function processMigrations()
{
$messages = '';
$migrationsPaths = [
'@vendor/dektrium/yii2-user/migrations',
'@yii/rbac/migrations',
'@pheme/settings/migrations',
];
foreach ($migrationsPaths as $path)
{
$migration =... | php | protected function processMigrations()
{
$messages = '';
$migrationsPaths = [
'@vendor/dektrium/yii2-user/migrations',
'@yii/rbac/migrations',
'@pheme/settings/migrations',
];
foreach ($migrationsPaths as $path)
{
$migration =... | [
"protected",
"function",
"processMigrations",
"(",
")",
"{",
"$",
"messages",
"=",
"''",
";",
"$",
"migrationsPaths",
"=",
"[",
"'@vendor/dektrium/yii2-user/migrations'",
",",
"'@yii/rbac/migrations'",
",",
"'@pheme/settings/migrations'",
",",
"]",
";",
"foreach",
"("... | Process required migrations
@return string | [
"Process",
"required",
"migrations"
] | b45db9c88317e28acc5b024ac98f8428685179aa | https://github.com/ColibriPlatform/base/blob/b45db9c88317e28acc5b024ac98f8428685179aa/controllers/InstallController.php#L71-L89 | train |
ColibriPlatform/base | controllers/InstallController.php | InstallController.createEnvFile | protected function createEnvFile(InstallForm $model)
{
$envFile = Yii::getAlias('@app/.env');
if (!file_exists($envFile)) {
$dsn = '';
$buffer = "\n";
$cookieKey = $this->generateRandomString();
$buffer .= "YII_DEBUG = 0\n";
$buf... | php | protected function createEnvFile(InstallForm $model)
{
$envFile = Yii::getAlias('@app/.env');
if (!file_exists($envFile)) {
$dsn = '';
$buffer = "\n";
$cookieKey = $this->generateRandomString();
$buffer .= "YII_DEBUG = 0\n";
$buf... | [
"protected",
"function",
"createEnvFile",
"(",
"InstallForm",
"$",
"model",
")",
"{",
"$",
"envFile",
"=",
"Yii",
"::",
"getAlias",
"(",
"'@app/.env'",
")",
";",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"envFile",
")",
")",
"{",
"$",
"dsn",
"=",
"''",
... | Create the application env file
@param InstallForm $model
@return void | [
"Create",
"the",
"application",
"env",
"file"
] | b45db9c88317e28acc5b024ac98f8428685179aa | https://github.com/ColibriPlatform/base/blob/b45db9c88317e28acc5b024ac98f8428685179aa/controllers/InstallController.php#L98-L129 | train |
ColibriPlatform/base | controllers/InstallController.php | InstallController.callModulesMethod | protected function callModulesMethod($methodName)
{
$modules = Yii::$app->getModules();
$returns = [];
foreach ($modules as $moduleName => $module)
{
if (is_array($module)) {
$module = Yii::$app->getModule($moduleName);
}
if (meth... | php | protected function callModulesMethod($methodName)
{
$modules = Yii::$app->getModules();
$returns = [];
foreach ($modules as $moduleName => $module)
{
if (is_array($module)) {
$module = Yii::$app->getModule($moduleName);
}
if (meth... | [
"protected",
"function",
"callModulesMethod",
"(",
"$",
"methodName",
")",
"{",
"$",
"modules",
"=",
"Yii",
"::",
"$",
"app",
"->",
"getModules",
"(",
")",
";",
"$",
"returns",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"modules",
"as",
"$",
"moduleName"... | Call a method if exists on every application modules
@param string $methodName The method to call
@return mixed[] | [
"Call",
"a",
"method",
"if",
"exists",
"on",
"every",
"application",
"modules"
] | b45db9c88317e28acc5b024ac98f8428685179aa | https://github.com/ColibriPlatform/base/blob/b45db9c88317e28acc5b024ac98f8428685179aa/controllers/InstallController.php#L204-L221 | train |
miguelibero/meinhof | src/Meinhof/Action/OutputAction.php | OutputAction.shouldWriteOutput | protected function shouldWriteOutput($min=0, $max=null)
{
$out = $this->getOutput();
if (!$out instanceof OutputInterface) {
return false;
}
$v = $out->getVerbosity();
return !($v<$min || ($max!==null && $v>$max));
} | php | protected function shouldWriteOutput($min=0, $max=null)
{
$out = $this->getOutput();
if (!$out instanceof OutputInterface) {
return false;
}
$v = $out->getVerbosity();
return !($v<$min || ($max!==null && $v>$max));
} | [
"protected",
"function",
"shouldWriteOutput",
"(",
"$",
"min",
"=",
"0",
",",
"$",
"max",
"=",
"null",
")",
"{",
"$",
"out",
"=",
"$",
"this",
"->",
"getOutput",
"(",
")",
";",
"if",
"(",
"!",
"$",
"out",
"instanceof",
"OutputInterface",
")",
"{",
... | Checks if the output verbositiy is between two given levels
@param integer $min minimum verbosity level
@param integer $max maximum verbosity level or null for no maximum
@return boolean if output should be written | [
"Checks",
"if",
"the",
"output",
"verbositiy",
"is",
"between",
"two",
"given",
"levels"
] | 3a090f08485dc0da3e27463cf349dba374201072 | https://github.com/miguelibero/meinhof/blob/3a090f08485dc0da3e27463cf349dba374201072/src/Meinhof/Action/OutputAction.php#L30-L39 | train |
miguelibero/meinhof | src/Meinhof/Action/OutputAction.php | OutputAction.writeOutputLine | protected function writeOutputLine($msg, $min=0, $max=null)
{
if (!$this->shouldWriteOutput($min, $max)) {
return;
}
$this->getOutput()->writeln($msg);
} | php | protected function writeOutputLine($msg, $min=0, $max=null)
{
if (!$this->shouldWriteOutput($min, $max)) {
return;
}
$this->getOutput()->writeln($msg);
} | [
"protected",
"function",
"writeOutputLine",
"(",
"$",
"msg",
",",
"$",
"min",
"=",
"0",
",",
"$",
"max",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"shouldWriteOutput",
"(",
"$",
"min",
",",
"$",
"max",
")",
")",
"{",
"return",
";"... | Prints a text line if the output verbositiy is between two given levels
@param string $msg the text to print
@param integer $min minimum verbosity level
@param integer $max maximum verbosity level or null for no maximum | [
"Prints",
"a",
"text",
"line",
"if",
"the",
"output",
"verbositiy",
"is",
"between",
"two",
"given",
"levels"
] | 3a090f08485dc0da3e27463cf349dba374201072 | https://github.com/miguelibero/meinhof/blob/3a090f08485dc0da3e27463cf349dba374201072/src/Meinhof/Action/OutputAction.php#L48-L55 | train |
miguelibero/meinhof | src/Meinhof/Action/OutputAction.php | OutputAction.writeOutput | protected function writeOutput($msg, $min=0, $max=null)
{
if (!$this->shouldWriteOutput($min, $max)) {
return;
}
return $this->getOutput()->write($msg);
} | php | protected function writeOutput($msg, $min=0, $max=null)
{
if (!$this->shouldWriteOutput($min, $max)) {
return;
}
return $this->getOutput()->write($msg);
} | [
"protected",
"function",
"writeOutput",
"(",
"$",
"msg",
",",
"$",
"min",
"=",
"0",
",",
"$",
"max",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"shouldWriteOutput",
"(",
"$",
"min",
",",
"$",
"max",
")",
")",
"{",
"return",
";",
... | Prints a text if the output verbositiy is between two given levels
@param string $msg the text to print
@param integer $min minimum verbosity level
@param integer $max maximum verbosity level or null for no maximum | [
"Prints",
"a",
"text",
"if",
"the",
"output",
"verbositiy",
"is",
"between",
"two",
"given",
"levels"
] | 3a090f08485dc0da3e27463cf349dba374201072 | https://github.com/miguelibero/meinhof/blob/3a090f08485dc0da3e27463cf349dba374201072/src/Meinhof/Action/OutputAction.php#L79-L86 | train |
ivopetkov/html-server-components-bearframework-addon | classes/HTMLServerComponents/Internal/Compiler.php | Compiler.makeComponent | public function makeComponent(array $attributes = [], string $innerHTML = '', string $tagName = 'component')
{
$app = App::get();
if (self::$newComponentCache === null) {
self::$newComponentCache = new \IvoPetkov\BearFramework\Addons\HTMLServerComponents\Internal\Component();
}
... | php | public function makeComponent(array $attributes = [], string $innerHTML = '', string $tagName = 'component')
{
$app = App::get();
if (self::$newComponentCache === null) {
self::$newComponentCache = new \IvoPetkov\BearFramework\Addons\HTMLServerComponents\Internal\Component();
}
... | [
"public",
"function",
"makeComponent",
"(",
"array",
"$",
"attributes",
"=",
"[",
"]",
",",
"string",
"$",
"innerHTML",
"=",
"''",
",",
"string",
"$",
"tagName",
"=",
"'component'",
")",
"{",
"$",
"app",
"=",
"App",
"::",
"get",
"(",
")",
";",
"if",
... | Constructs a component object
@param array $attributes The attributes of the component object
@param string $innerHTML The innerHTML of the component object
@param string $tagName The tag name of the component object
@return \IvoPetkov\BearFramework\Addons\HTMLServerComponents\Internal\Component A component object | [
"Constructs",
"a",
"component",
"object"
] | c9a5f275d10f194b2216d733bfea612fd876a0b2 | https://github.com/ivopetkov/html-server-components-bearframework-addon/blob/c9a5f275d10f194b2216d733bfea612fd876a0b2/classes/HTMLServerComponents/Internal/Compiler.php#L33-L49 | train |
zhaoxianfang/tools | src/Symfony/Component/DependencyInjection/Compiler/PassConfig.php | PassConfig.getPasses | public function getPasses()
{
return array_merge(
array($this->mergePass),
$this->getBeforeOptimizationPasses(),
$this->getOptimizationPasses(),
$this->getBeforeRemovingPasses(),
$this->getRemovingPasses(),
$this->getAfterRemovingPasses... | php | public function getPasses()
{
return array_merge(
array($this->mergePass),
$this->getBeforeOptimizationPasses(),
$this->getOptimizationPasses(),
$this->getBeforeRemovingPasses(),
$this->getRemovingPasses(),
$this->getAfterRemovingPasses... | [
"public",
"function",
"getPasses",
"(",
")",
"{",
"return",
"array_merge",
"(",
"array",
"(",
"$",
"this",
"->",
"mergePass",
")",
",",
"$",
"this",
"->",
"getBeforeOptimizationPasses",
"(",
")",
",",
"$",
"this",
"->",
"getOptimizationPasses",
"(",
")",
"... | Returns all passes in order to be processed.
@return CompilerPassInterface[] | [
"Returns",
"all",
"passes",
"in",
"order",
"to",
"be",
"processed",
"."
] | d8fc8a9ecd75b5ce4236f0a2e9fdc055108573e7 | https://github.com/zhaoxianfang/tools/blob/d8fc8a9ecd75b5ce4236f0a2e9fdc055108573e7/src/Symfony/Component/DependencyInjection/Compiler/PassConfig.php#L101-L111 | train |
squareproton/Bond | src/Bond/Pg/Resource.php | Resource.ensure | public static function ensure()
{
$cnt = 0;
foreach( self::$instances as $instance ) {
if( !$instance->isAlive() ) {
$instance->reset();
$cnt++;
}
}
return $cnt;
} | php | public static function ensure()
{
$cnt = 0;
foreach( self::$instances as $instance ) {
if( !$instance->isAlive() ) {
$instance->reset();
$cnt++;
}
}
return $cnt;
} | [
"public",
"static",
"function",
"ensure",
"(",
")",
"{",
"$",
"cnt",
"=",
"0",
";",
"foreach",
"(",
"self",
"::",
"$",
"instances",
"as",
"$",
"instance",
")",
"{",
"if",
"(",
"!",
"$",
"instance",
"->",
"isAlive",
"(",
")",
")",
"{",
"$",
"insta... | Ensure all known, non terminated, resource objects are golden | [
"Ensure",
"all",
"known",
"non",
"terminated",
"resource",
"objects",
"are",
"golden"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Pg/Resource.php#L97-L107 | train |
squareproton/Bond | src/Bond/Pg/Resource.php | Resource.unserialize | public function unserialize($data)
{
$connectionSettings = new ConnectionSettings( json_decode( $data, true ) );
$this->__construct( $connectionSettings );
} | php | public function unserialize($data)
{
$connectionSettings = new ConnectionSettings( json_decode( $data, true ) );
$this->__construct( $connectionSettings );
} | [
"public",
"function",
"unserialize",
"(",
"$",
"data",
")",
"{",
"$",
"connectionSettings",
"=",
"new",
"ConnectionSettings",
"(",
"json_decode",
"(",
"$",
"data",
",",
"true",
")",
")",
";",
"$",
"this",
"->",
"__construct",
"(",
"$",
"connectionSettings",
... | Unserialize. Object.
@waring. Unserializing a resource will generate a new resource | [
"Unserialize",
".",
"Object",
"."
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Pg/Resource.php#L131-L135 | train |
squareproton/Bond | src/Bond/Pg/Resource.php | Resource.isTerminated | public function isTerminated( $throwExceptionIfTerminated = true )
{
if( $this->terminated ) {
if( $throwExceptionIfTerminated ) {
throw new ConnectionTerminatedException( $this );
}
return true;
}
return false;
} | php | public function isTerminated( $throwExceptionIfTerminated = true )
{
if( $this->terminated ) {
if( $throwExceptionIfTerminated ) {
throw new ConnectionTerminatedException( $this );
}
return true;
}
return false;
} | [
"public",
"function",
"isTerminated",
"(",
"$",
"throwExceptionIfTerminated",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"terminated",
")",
"{",
"if",
"(",
"$",
"throwExceptionIfTerminated",
")",
"{",
"throw",
"new",
"ConnectionTerminatedException",
"(... | Has this resource been terminated?
@throws Bond\Pg\ConnectionTerminated
@return bool | [
"Has",
"this",
"resource",
"been",
"terminated?"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Pg/Resource.php#L180-L189 | train |
squareproton/Bond | src/Bond/Pg/Resource.php | Resource.get | public function get( $reconnectOnFailure = false )
{
if( $reconnectOnFailure and !$this->isAlive() ) {
$this->reset();
}
return $this->resource;
} | php | public function get( $reconnectOnFailure = false )
{
if( $reconnectOnFailure and !$this->isAlive() ) {
$this->reset();
}
return $this->resource;
} | [
"public",
"function",
"get",
"(",
"$",
"reconnectOnFailure",
"=",
"false",
")",
"{",
"if",
"(",
"$",
"reconnectOnFailure",
"and",
"!",
"$",
"this",
"->",
"isAlive",
"(",
")",
")",
"{",
"$",
"this",
"->",
"reset",
"(",
")",
";",
"}",
"return",
"$",
... | Return the pglink resource.
@param bool Reset the connection if, for any reason, it has gone away
@return pg_link resource | [
"Return",
"the",
"pglink",
"resource",
"."
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Pg/Resource.php#L220-L226 | train |
koolkode/context | src/Container.php | Container.createInstance | public function createInstance(Binding $binding, InjectionPointInterface $point = NULL)
{
switch($binding->getOptions() & BindingInterface::MASK_TYPE)
{
case BindingInterface::TYPE_ALIAS:
return $this->get($binding->getTarget(), $point);
case BindingInterface::TYPE_FACTORY:
case BindingInterface::TYPE... | php | public function createInstance(Binding $binding, InjectionPointInterface $point = NULL)
{
switch($binding->getOptions() & BindingInterface::MASK_TYPE)
{
case BindingInterface::TYPE_ALIAS:
return $this->get($binding->getTarget(), $point);
case BindingInterface::TYPE_FACTORY:
case BindingInterface::TYPE... | [
"public",
"function",
"createInstance",
"(",
"Binding",
"$",
"binding",
",",
"InjectionPointInterface",
"$",
"point",
"=",
"NULL",
")",
"{",
"switch",
"(",
"$",
"binding",
"->",
"getOptions",
"(",
")",
"&",
"BindingInterface",
"::",
"MASK_TYPE",
")",
"{",
"c... | Create an instance of the bound type, will NOT create or re-use a scoped proxy.
@param Binding $binding
@param InjectionPointInterface $point
@return object | [
"Create",
"an",
"instance",
"of",
"the",
"bound",
"type",
"will",
"NOT",
"create",
"or",
"re",
"-",
"use",
"a",
"scoped",
"proxy",
"."
] | f4aa614eb4ca1080bd89c7a2a54c9467c5b17a36 | https://github.com/koolkode/context/blob/f4aa614eb4ca1080bd89c7a2a54c9467c5b17a36/src/Container.php#L228-L245 | train |
koolkode/context | src/Container.php | Container.createObjectUsingFactory | protected function createObjectUsingFactory(Binding $binding, InjectionPointInterface $point = NULL)
{
$callback = $binding->getTarget();
if(is_array($callback))
{
$callback = [$this->get($callback[0]), $callback[1]];
$ref = new \ReflectionMethod(get_class($callback[0]), $callback[1]);
}
else
{
... | php | protected function createObjectUsingFactory(Binding $binding, InjectionPointInterface $point = NULL)
{
$callback = $binding->getTarget();
if(is_array($callback))
{
$callback = [$this->get($callback[0]), $callback[1]];
$ref = new \ReflectionMethod(get_class($callback[0]), $callback[1]);
}
else
{
... | [
"protected",
"function",
"createObjectUsingFactory",
"(",
"Binding",
"$",
"binding",
",",
"InjectionPointInterface",
"$",
"point",
"=",
"NULL",
")",
"{",
"$",
"callback",
"=",
"$",
"binding",
"->",
"getTarget",
"(",
")",
";",
"if",
"(",
"is_array",
"(",
"$",... | Create an object using the factory defined in the given binding.
@param Binding $binding
@param InjectionPointInterface $point
@return object | [
"Create",
"an",
"object",
"using",
"the",
"factory",
"defined",
"in",
"the",
"given",
"binding",
"."
] | f4aa614eb4ca1080bd89c7a2a54c9467c5b17a36 | https://github.com/koolkode/context/blob/f4aa614eb4ca1080bd89c7a2a54c9467c5b17a36/src/Container.php#L269-L337 | train |
koolkode/context | src/Container.php | Container.registerBindings | protected function registerBindings(array $bindings)
{
foreach($bindings as $binding)
{
$this->bindings[(string)$binding] = $binding;
foreach($binding->getMarkers() as $marker)
{
$marker = get_class($marker);
if(empty($this->markers[$marker]))
{
$this->markers[$marker] = new \SplO... | php | protected function registerBindings(array $bindings)
{
foreach($bindings as $binding)
{
$this->bindings[(string)$binding] = $binding;
foreach($binding->getMarkers() as $marker)
{
$marker = get_class($marker);
if(empty($this->markers[$marker]))
{
$this->markers[$marker] = new \SplO... | [
"protected",
"function",
"registerBindings",
"(",
"array",
"$",
"bindings",
")",
"{",
"foreach",
"(",
"$",
"bindings",
"as",
"$",
"binding",
")",
"{",
"$",
"this",
"->",
"bindings",
"[",
"(",
"string",
")",
"$",
"binding",
"]",
"=",
"$",
"binding",
";"... | Register the given bindings with the container and prepare markers.
@param array<Binding> $bindings | [
"Register",
"the",
"given",
"bindings",
"with",
"the",
"container",
"and",
"prepare",
"markers",
"."
] | f4aa614eb4ca1080bd89c7a2a54c9467c5b17a36 | https://github.com/koolkode/context/blob/f4aa614eb4ca1080bd89c7a2a54c9467c5b17a36/src/Container.php#L344-L362 | train |
anime-db/catalog-bundle | src/Console/Progress/Export.php | Export.advance | public function advance($step = 1, $redraw = false)
{
parent::advance($step, $redraw);
$this->current += $step;
$percent = 0;
if ($this->max > 0) {
$percent = (float) $this->current / $this->max;
}
$this->output->write(sprintf('%d%%', floor($percent * 10... | php | public function advance($step = 1, $redraw = false)
{
parent::advance($step, $redraw);
$this->current += $step;
$percent = 0;
if ($this->max > 0) {
$percent = (float) $this->current / $this->max;
}
$this->output->write(sprintf('%d%%', floor($percent * 10... | [
"public",
"function",
"advance",
"(",
"$",
"step",
"=",
"1",
",",
"$",
"redraw",
"=",
"false",
")",
"{",
"parent",
"::",
"advance",
"(",
"$",
"step",
",",
"$",
"redraw",
")",
";",
"$",
"this",
"->",
"current",
"+=",
"$",
"step",
";",
"$",
"percen... | Advances the progress output X steps.
@param int $step Number of steps to advance
@param bool $redraw Whether to redraw or not
@throws \LogicException | [
"Advances",
"the",
"progress",
"output",
"X",
"steps",
"."
] | 631b6f92a654e91bee84f46218c52cf42bdb8606 | https://github.com/anime-db/catalog-bundle/blob/631b6f92a654e91bee84f46218c52cf42bdb8606/src/Console/Progress/Export.php#L72-L83 | train |
AnonymPHP/Anonym-Database | Capsule/Capsule.php | Capsule.addConnection | public function addConnection(Base $connection = null, $name = '')
{
if($connection instanceof Base)
{
if($name !== '')
{
$this->connections[$name] = $connection;
}else{
$this->connections[] = $connection;
}
}els... | php | public function addConnection(Base $connection = null, $name = '')
{
if($connection instanceof Base)
{
if($name !== '')
{
$this->connections[$name] = $connection;
}else{
$this->connections[] = $connection;
}
}els... | [
"public",
"function",
"addConnection",
"(",
"Base",
"$",
"connection",
"=",
"null",
",",
"$",
"name",
"=",
"''",
")",
"{",
"if",
"(",
"$",
"connection",
"instanceof",
"Base",
")",
"{",
"if",
"(",
"$",
"name",
"!==",
"''",
")",
"{",
"$",
"this",
"->... | add a connection to capsule
@param Base $connection
@param string $name
@throws CapsuleInstanceException | [
"add",
"a",
"connection",
"to",
"capsule"
] | 4d034219e0e3eb2833fa53204e9f52a74a9a7e4b | https://github.com/AnonymPHP/Anonym-Database/blob/4d034219e0e3eb2833fa53204e9f52a74a9a7e4b/Capsule/Capsule.php#L47-L60 | train |
AnonymPHP/Anonym-Database | Capsule/Capsule.php | Capsule.deleteConnection | public function deleteConnection($offset)
{
if(isset($this->connections[$offset]))
{
unset($this->connections[$offset]);
}
return $this;
} | php | public function deleteConnection($offset)
{
if(isset($this->connections[$offset]))
{
unset($this->connections[$offset]);
}
return $this;
} | [
"public",
"function",
"deleteConnection",
"(",
"$",
"offset",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"connections",
"[",
"$",
"offset",
"]",
")",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"connections",
"[",
"$",
"offset",
"]",
")",
... | delete a connection in capsule
@param mixed $offset
@return $this | [
"delete",
"a",
"connection",
"in",
"capsule"
] | 4d034219e0e3eb2833fa53204e9f52a74a9a7e4b | https://github.com/AnonymPHP/Anonym-Database/blob/4d034219e0e3eb2833fa53204e9f52a74a9a7e4b/Capsule/Capsule.php#L69-L77 | train |
sil-project/Product | Factory/CodeFactory.php | CodeFactory.generateProductVariantCode | public static function generateProductVariantCode(ProductInterface $product, array $productOptions): CodeInterface
{
$productVariantCodeGenerator = new ProductVariantCodeGenerator();
return $productVariantCodeGenerator->generate($product->getCode(), $productOptions);
} | php | public static function generateProductVariantCode(ProductInterface $product, array $productOptions): CodeInterface
{
$productVariantCodeGenerator = new ProductVariantCodeGenerator();
return $productVariantCodeGenerator->generate($product->getCode(), $productOptions);
} | [
"public",
"static",
"function",
"generateProductVariantCode",
"(",
"ProductInterface",
"$",
"product",
",",
"array",
"$",
"productOptions",
")",
":",
"CodeInterface",
"{",
"$",
"productVariantCodeGenerator",
"=",
"new",
"ProductVariantCodeGenerator",
"(",
")",
";",
"r... | Generate product variant code.
@param ProductInterface $product Current Product
@param array|Option[] $productOptions array of Options
@return CodeInterface Generated Code | [
"Generate",
"product",
"variant",
"code",
"."
] | 830dca4cc90502a7adcf3d6f0e1f14b4dddf80b4 | https://github.com/sil-project/Product/blob/830dca4cc90502a7adcf3d6f0e1f14b4dddf80b4/Factory/CodeFactory.php#L45-L50 | train |
helsingborg-stad/better-post-UI | source/php/Components/Comments.php | Comments.commentsFilter | public function commentsFilter()
{
$post_types = get_post_types();
foreach ($post_types as &$post_type) {
if (post_type_supports($post_type, 'comments')) {
$post_type_obj = get_post_type_object($post_type);
$post_type = array(
'name' => $post_type_obj->nam... | php | public function commentsFilter()
{
$post_types = get_post_types();
foreach ($post_types as &$post_type) {
if (post_type_supports($post_type, 'comments')) {
$post_type_obj = get_post_type_object($post_type);
$post_type = array(
'name' => $post_type_obj->nam... | [
"public",
"function",
"commentsFilter",
"(",
")",
"{",
"$",
"post_types",
"=",
"get_post_types",
"(",
")",
";",
"foreach",
"(",
"$",
"post_types",
"as",
"&",
"$",
"post_type",
")",
"{",
"if",
"(",
"post_type_supports",
"(",
"$",
"post_type",
",",
"'comment... | Filter comments by post type
@return void | [
"Filter",
"comments",
"by",
"post",
"type"
] | 0454e8d6f42787244d02f0e976825ed8dca579f0 | https://github.com/helsingborg-stad/better-post-UI/blob/0454e8d6f42787244d02f0e976825ed8dca579f0/source/php/Components/Comments.php#L19-L41 | train |
helsingborg-stad/better-post-UI | source/php/Components/Comments.php | Comments.queryFilter | public function queryFilter($query)
{
global $pagenow;
if (!is_admin() || !$pagenow || $pagenow !== 'edit-comments.php' || !isset($_GET['post_type']) || !$_GET['post_type']) {
return;
}
$query->set('post_type', $_GET['post_type']);
} | php | public function queryFilter($query)
{
global $pagenow;
if (!is_admin() || !$pagenow || $pagenow !== 'edit-comments.php' || !isset($_GET['post_type']) || !$_GET['post_type']) {
return;
}
$query->set('post_type', $_GET['post_type']);
} | [
"public",
"function",
"queryFilter",
"(",
"$",
"query",
")",
"{",
"global",
"$",
"pagenow",
";",
"if",
"(",
"!",
"is_admin",
"(",
")",
"||",
"!",
"$",
"pagenow",
"||",
"$",
"pagenow",
"!==",
"'edit-comments.php'",
"||",
"!",
"isset",
"(",
"$",
"_GET",
... | Filter the wp query
@param WP_Query $query
@return void | [
"Filter",
"the",
"wp",
"query"
] | 0454e8d6f42787244d02f0e976825ed8dca579f0 | https://github.com/helsingborg-stad/better-post-UI/blob/0454e8d6f42787244d02f0e976825ed8dca579f0/source/php/Components/Comments.php#L48-L57 | train |
helsingborg-stad/better-post-UI | source/php/Components/Comments.php | Comments.tableColumnsContent | public function tableColumnsContent($column, $postId)
{
if ($column == 'post_type') {
$comment = get_comment($postId, OBJECT);
$post_type_slug = get_post_type($comment->comment_post_ID);
$post_type_obj = get_post_type_object($post_type_slug);
echo $post_type_obj->label;
}
} | php | public function tableColumnsContent($column, $postId)
{
if ($column == 'post_type') {
$comment = get_comment($postId, OBJECT);
$post_type_slug = get_post_type($comment->comment_post_ID);
$post_type_obj = get_post_type_object($post_type_slug);
echo $post_type_obj->label;
}
} | [
"public",
"function",
"tableColumnsContent",
"(",
"$",
"column",
",",
"$",
"postId",
")",
"{",
"if",
"(",
"$",
"column",
"==",
"'post_type'",
")",
"{",
"$",
"comment",
"=",
"get_comment",
"(",
"$",
"postId",
",",
"OBJECT",
")",
";",
"$",
"post_type_slug"... | Content for table columns
@param string $column
@param int $postId
@return void | [
"Content",
"for",
"table",
"columns"
] | 0454e8d6f42787244d02f0e976825ed8dca579f0 | https://github.com/helsingborg-stad/better-post-UI/blob/0454e8d6f42787244d02f0e976825ed8dca579f0/source/php/Components/Comments.php#L82-L90 | train |
danielgp/composer-packages-listing | source/ComposerPackagesListing.php | ComposerPackagesListing.getFileModifiedTimestampOfFile | protected function getFileModifiedTimestampOfFile($fileName, $format = 'Y-m-d H:i:s', $resultInUtc = false)
{
if (!file_exists($fileName)) {
return ['error' => $fileName . ' was not found'];
}
$info = new \SplFileInfo($fileName);
if ($format === 'PHPtime') {
r... | php | protected function getFileModifiedTimestampOfFile($fileName, $format = 'Y-m-d H:i:s', $resultInUtc = false)
{
if (!file_exists($fileName)) {
return ['error' => $fileName . ' was not found'];
}
$info = new \SplFileInfo($fileName);
if ($format === 'PHPtime') {
r... | [
"protected",
"function",
"getFileModifiedTimestampOfFile",
"(",
"$",
"fileName",
",",
"$",
"format",
"=",
"'Y-m-d H:i:s'",
",",
"$",
"resultInUtc",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"fileName",
")",
")",
"{",
"return",
"[",
"... | Returns Modified date and time of a given file
@param string $fileName
@param string $format
@param boolean $resultInUtc
@return string | [
"Returns",
"Modified",
"date",
"and",
"time",
"of",
"a",
"given",
"file"
] | 400cdc599348cee1072df10fb207bc03bce94b9f | https://github.com/danielgp/composer-packages-listing/blob/400cdc599348cee1072df10fb207bc03bce94b9f/source/ComposerPackagesListing.php#L115-L129 | train |
danielgp/composer-packages-listing | source/ComposerPackagesListing.php | ComposerPackagesListing.getPackageDetailsFromGivenComposerLockFileEnhanced | protected function getPackageDetailsFromGivenComposerLockFileEnhanced($fileIn, $inParametersArray = [])
{
if (!file_exists($fileIn)) {
return ['error' => $fileIn . ' was not found'];
}
$alnfo = [];
$packages = $this->getPkgFileInListOfPackageArrayOut($fileIn);
... | php | protected function getPackageDetailsFromGivenComposerLockFileEnhanced($fileIn, $inParametersArray = [])
{
if (!file_exists($fileIn)) {
return ['error' => $fileIn . ' was not found'];
}
$alnfo = [];
$packages = $this->getPkgFileInListOfPackageArrayOut($fileIn);
... | [
"protected",
"function",
"getPackageDetailsFromGivenComposerLockFileEnhanced",
"(",
"$",
"fileIn",
",",
"$",
"inParametersArray",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"fileIn",
")",
")",
"{",
"return",
"[",
"'error'",
"=>",
"$",
... | Returns a complete list of packages and respective details from a composer.lock file
@param string $fileIn
@param array $inParametersArray
@return array | [
"Returns",
"a",
"complete",
"list",
"of",
"packages",
"and",
"respective",
"details",
"from",
"a",
"composer",
".",
"lock",
"file"
] | 400cdc599348cee1072df10fb207bc03bce94b9f | https://github.com/danielgp/composer-packages-listing/blob/400cdc599348cee1072df10fb207bc03bce94b9f/source/ComposerPackagesListing.php#L159-L177 | train |
1HappyPlace/ansi-terminal | src/ANSI/Color/Color.php | Color.setEmpty | public function setEmpty() {
// set all properties to null
$this->name = $this->ANSICode = $this->XTermCode = $this->RGB = null;
} | php | public function setEmpty() {
// set all properties to null
$this->name = $this->ANSICode = $this->XTermCode = $this->RGB = null;
} | [
"public",
"function",
"setEmpty",
"(",
")",
"{",
"// set all properties to null",
"$",
"this",
"->",
"name",
"=",
"$",
"this",
"->",
"ANSICode",
"=",
"$",
"this",
"->",
"XTermCode",
"=",
"$",
"this",
"->",
"RGB",
"=",
"null",
";",
"}"
] | Set the color object to empty | [
"Set",
"the",
"color",
"object",
"to",
"empty"
] | 3a550eadb21bb87a6909436c3b961919d2731923 | https://github.com/1HappyPlace/ansi-terminal/blob/3a550eadb21bb87a6909436c3b961919d2731923/src/ANSI/Color/Color.php#L228-L232 | train |
1HappyPlace/ansi-terminal | src/ANSI/Color/Color.php | Color.isEmpty | public function isEmpty() {
// return true if all properties are null
return (is_null($this->name) && is_null($this->ANSICode) && is_null($this->XTermCode) && is_null($this->RGB));
} | php | public function isEmpty() {
// return true if all properties are null
return (is_null($this->name) && is_null($this->ANSICode) && is_null($this->XTermCode) && is_null($this->RGB));
} | [
"public",
"function",
"isEmpty",
"(",
")",
"{",
"// return true if all properties are null",
"return",
"(",
"is_null",
"(",
"$",
"this",
"->",
"name",
")",
"&&",
"is_null",
"(",
"$",
"this",
"->",
"ANSICode",
")",
"&&",
"is_null",
"(",
"$",
"this",
"->",
"... | Return whether the object is empty
@return bool | [
"Return",
"whether",
"the",
"object",
"is",
"empty"
] | 3a550eadb21bb87a6909436c3b961919d2731923 | https://github.com/1HappyPlace/ansi-terminal/blob/3a550eadb21bb87a6909436c3b961919d2731923/src/ANSI/Color/Color.php#L238-L243 | train |
1HappyPlace/ansi-terminal | src/ANSI/Color/Color.php | Color.setColor | public function setColor($color) {
// if null is passed in, then just leave everything null
if (!is_null($color)) {
// if it an instance of another color
if ($color instanceof ColorInterface) {
// save the name
$this->name = $color->getName();
... | php | public function setColor($color) {
// if null is passed in, then just leave everything null
if (!is_null($color)) {
// if it an instance of another color
if ($color instanceof ColorInterface) {
// save the name
$this->name = $color->getName();
... | [
"public",
"function",
"setColor",
"(",
"$",
"color",
")",
"{",
"// if null is passed in, then just leave everything null",
"if",
"(",
"!",
"is_null",
"(",
"$",
"color",
")",
")",
"{",
"// if it an instance of another color",
"if",
"(",
"$",
"color",
"instanceof",
"C... | The variety of ways to set a color
@param ColorInterface | string | integer | int[] $color - Many options for initializing a color object - SEE CONSTRUCTOR | [
"The",
"variety",
"of",
"ways",
"to",
"set",
"a",
"color"
] | 3a550eadb21bb87a6909436c3b961919d2731923 | https://github.com/1HappyPlace/ansi-terminal/blob/3a550eadb21bb87a6909436c3b961919d2731923/src/ANSI/Color/Color.php#L249-L333 | train |
1HappyPlace/ansi-terminal | src/ANSI/Color/Color.php | Color.generateColorCoding | public function generateColorCoding($mode, $isFill = false) {
// initialize the returned code
$codes = "";
// ensure the color has a value
if ($this->isValid()) {
// cast the mode into the class
$mode = new Mode($mode);
// generally yo... | php | public function generateColorCoding($mode, $isFill = false) {
// initialize the returned code
$codes = "";
// ensure the color has a value
if ($this->isValid()) {
// cast the mode into the class
$mode = new Mode($mode);
// generally yo... | [
"public",
"function",
"generateColorCoding",
"(",
"$",
"mode",
",",
"$",
"isFill",
"=",
"false",
")",
"{",
"// initialize the returned code",
"$",
"codes",
"=",
"\"\"",
";",
"// ensure the color has a value",
"if",
"(",
"$",
"this",
"->",
"isValid",
"(",
")",
... | Generate a color coding based on the terminal type
@param Mode | int | string $mode
Mode
send in a Mode object built already
integer -
send in the desired number of colors to pick the closest mode (<16 for VT100, >16 and <256 for xterm and > 256 for RGB)
string -
send in one of the constants Mode::VT100, Mode::XTERM, ... | [
"Generate",
"a",
"color",
"coding",
"based",
"on",
"the",
"terminal",
"type"
] | 3a550eadb21bb87a6909436c3b961919d2731923 | https://github.com/1HappyPlace/ansi-terminal/blob/3a550eadb21bb87a6909436c3b961919d2731923/src/ANSI/Color/Color.php#L478-L533 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.