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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
SpoonX/SxBootstrap | src/SxBootstrap/Service/BootstrapFilter.php | BootstrapFilter.removeImportFiles | protected function removeImportFiles(array $importFiles, array $config)
{
foreach ($config as $item) {
if (in_array($item, $importFiles)) {
unset($importFiles[array_search($item, $importFiles)]);
}
}
return $importFiles;
} | php | protected function removeImportFiles(array $importFiles, array $config)
{
foreach ($config as $item) {
if (in_array($item, $importFiles)) {
unset($importFiles[array_search($item, $importFiles)]);
}
}
return $importFiles;
} | [
"protected",
"function",
"removeImportFiles",
"(",
"array",
"$",
"importFiles",
",",
"array",
"$",
"config",
")",
"{",
"foreach",
"(",
"$",
"config",
"as",
"$",
"item",
")",
"{",
"if",
"(",
"in_array",
"(",
"$",
"item",
",",
"$",
"importFiles",
")",
")... | Remove import files from the import config.
@param array $importFiles
@param array $config
@return array | [
"Remove",
"import",
"files",
"from",
"the",
"import",
"config",
"."
] | 768b02e3b65f7dfe560e821cb0ff41ad3f86b3b6 | https://github.com/SpoonX/SxBootstrap/blob/768b02e3b65f7dfe560e821cb0ff41ad3f86b3b6/src/SxBootstrap/Service/BootstrapFilter.php#L212-L221 | train |
phramework/phramework | src/Models/Request.php | Request.checkPermission | public static function checkPermission($userId = false)
{
$user = \Phramework\Phramework::getUser();
//If user is not authenticated throw an \Exception
if (!$user) {
throw new \Phramework\Exceptions\UnauthorizedException();
}
//Check if speficied user is same as... | php | public static function checkPermission($userId = false)
{
$user = \Phramework\Phramework::getUser();
//If user is not authenticated throw an \Exception
if (!$user) {
throw new \Phramework\Exceptions\UnauthorizedException();
}
//Check if speficied user is same as... | [
"public",
"static",
"function",
"checkPermission",
"(",
"$",
"userId",
"=",
"false",
")",
"{",
"$",
"user",
"=",
"\\",
"Phramework",
"\\",
"Phramework",
"::",
"getUser",
"(",
")",
";",
"//If user is not authenticated throw an \\Exception",
"if",
"(",
"!",
"$",
... | Check if current request is authenticated
Optionaly it checks the authenticated user has a specific user_id
@param integer $userId *[Optional]* Check if current user has the same id with $userId
@return object Returns the user object
@throws \Phramework\Exceptions\PermissionException
@throws \Phramework\Exceptions\Una... | [
"Check",
"if",
"current",
"request",
"is",
"authenticated"
] | 40041d1ef23b1f8cdbd26fb112448d6a3dbef012 | https://github.com/phramework/phramework/blob/40041d1ef23b1f8cdbd26fb112448d6a3dbef012/src/Models/Request.php#L46-L63 | train |
phramework/phramework | src/Models/Request.php | Request.requireParameters | public static function requireParameters($parameters, $required)
{
//Work with arrays
if (is_object($parameters)) {
$parameters = (array)$parameters;
}
$missing = [];
if (!is_array($required)) {
$required = [$required];
}
foreach ($r... | php | public static function requireParameters($parameters, $required)
{
//Work with arrays
if (is_object($parameters)) {
$parameters = (array)$parameters;
}
$missing = [];
if (!is_array($required)) {
$required = [$required];
}
foreach ($r... | [
"public",
"static",
"function",
"requireParameters",
"(",
"$",
"parameters",
",",
"$",
"required",
")",
"{",
"//Work with arrays",
"if",
"(",
"is_object",
"(",
"$",
"parameters",
")",
")",
"{",
"$",
"parameters",
"=",
"(",
"array",
")",
"$",
"parameters",
... | Check if required parameters are set
@param array|object $parameters Request's parameters
@param string|array $required The required parameters
@throws \Phramework\Exceptions\MissingParametersException | [
"Check",
"if",
"required",
"parameters",
"are",
"set"
] | 40041d1ef23b1f8cdbd26fb112448d6a3dbef012 | https://github.com/phramework/phramework/blob/40041d1ef23b1f8cdbd26fb112448d6a3dbef012/src/Models/Request.php#L71-L93 | train |
phramework/phramework | src/Models/Request.php | Request.resourceId | public static function resourceId($parameters, $UINTEGER = true)
{
//Work with arrays
if (is_object($parameters)) {
$parameters = (array)$parameters;
}
//Check if is set AND validate
if (isset($parameters['resource_id'])
&& preg_match(Validate::REGEXP... | php | public static function resourceId($parameters, $UINTEGER = true)
{
//Work with arrays
if (is_object($parameters)) {
$parameters = (array)$parameters;
}
//Check if is set AND validate
if (isset($parameters['resource_id'])
&& preg_match(Validate::REGEXP... | [
"public",
"static",
"function",
"resourceId",
"(",
"$",
"parameters",
",",
"$",
"UINTEGER",
"=",
"true",
")",
"{",
"//Work with arrays",
"if",
"(",
"is_object",
"(",
"$",
"parameters",
")",
")",
"{",
"$",
"parameters",
"=",
"(",
"array",
")",
"$",
"param... | Require id parameter if it's set else return NULL, it uses `resource_id` or `id` parameter if available
@param array|object $parameters The request parameters
@param boolean $UINTEGER *[Optional]*, Check id's type to be unsigned integer
@throws \Phramework\Exceptions\IncorrectParameters When value is not corre... | [
"Require",
"id",
"parameter",
"if",
"it",
"s",
"set",
"else",
"return",
"NULL",
"it",
"uses",
"resource_id",
"or",
"id",
"parameter",
"if",
"available"
] | 40041d1ef23b1f8cdbd26fb112448d6a3dbef012 | https://github.com/phramework/phramework/blob/40041d1ef23b1f8cdbd26fb112448d6a3dbef012/src/Models/Request.php#L103-L129 | train |
phramework/phramework | src/Models/Request.php | Request.requireId | public static function requireId($parameters, $UINTEGER = true)
{
//Work with arrays
if (is_object($parameters)) {
$parameters = (array)$parameters;
}
if (isset($parameters['resource_id'])
&& preg_match(Validate::REGEXP_RESOURCE_ID, $parameters['resource_id']... | php | public static function requireId($parameters, $UINTEGER = true)
{
//Work with arrays
if (is_object($parameters)) {
$parameters = (array)$parameters;
}
if (isset($parameters['resource_id'])
&& preg_match(Validate::REGEXP_RESOURCE_ID, $parameters['resource_id']... | [
"public",
"static",
"function",
"requireId",
"(",
"$",
"parameters",
",",
"$",
"UINTEGER",
"=",
"true",
")",
"{",
"//Work with arrays",
"if",
"(",
"is_object",
"(",
"$",
"parameters",
")",
")",
"{",
"$",
"parameters",
"=",
"(",
"array",
")",
"$",
"parame... | Require id parameter, it uses `resource_id` or `id` parameter if available
@param array|object $parameters The request paramters
@param boolean $UINTEGER *[Optional]*, Check id's type to be unsigned integer, default is true
@throws \Phramework\Exceptions\IncorrectParameters When value is not correct
@throws \Ph... | [
"Require",
"id",
"parameter",
"it",
"uses",
"resource_id",
"or",
"id",
"parameter",
"if",
"available"
] | 40041d1ef23b1f8cdbd26fb112448d6a3dbef012 | https://github.com/phramework/phramework/blob/40041d1ef23b1f8cdbd26fb112448d6a3dbef012/src/Models/Request.php#L139-L167 | train |
phramework/phramework | src/Models/Request.php | Request.parseModel | public static function parseModel($parameters, $model)
{
if (is_object($parameters)) {
$parameters = (array)$parameters;
}
$required_fields = [];
foreach ($model as $key => $value) {
if (in_array('required', $value, true) === true
|| in_array(... | php | public static function parseModel($parameters, $model)
{
if (is_object($parameters)) {
$parameters = (array)$parameters;
}
$required_fields = [];
foreach ($model as $key => $value) {
if (in_array('required', $value, true) === true
|| in_array(... | [
"public",
"static",
"function",
"parseModel",
"(",
"$",
"parameters",
",",
"$",
"model",
")",
"{",
"if",
"(",
"is_object",
"(",
"$",
"parameters",
")",
")",
"{",
"$",
"parameters",
"=",
"(",
"array",
")",
"$",
"parameters",
";",
"}",
"$",
"required_fie... | Required required values and parse provided parameters into an array
Validate the provided request model and return the
@uses \Phramework\Models\Request::requireParameters
@param array|object $parameters
@param array $model
@return array Return the keys => values collection
@deprecated since 1.0.0 | [
"Required",
"required",
"values",
"and",
"parse",
"provided",
"parameters",
"into",
"an",
"array",
"Validate",
"the",
"provided",
"request",
"model",
"and",
"return",
"the"
] | 40041d1ef23b1f8cdbd26fb112448d6a3dbef012 | https://github.com/phramework/phramework/blob/40041d1ef23b1f8cdbd26fb112448d6a3dbef012/src/Models/Request.php#L178-L220 | train |
keeko/framework | src/utils/NameUtils.php | NameUtils.toStudlyCase | public static function toStudlyCase($input) {
$input = trim($input, '-_');
return ucfirst(preg_replace_callback('/([A-Z-_][a-z]+)/', function($matches) {
return ucfirst(str_replace(['-','_'], '',$matches[0]));
}, $input));
} | php | public static function toStudlyCase($input) {
$input = trim($input, '-_');
return ucfirst(preg_replace_callback('/([A-Z-_][a-z]+)/', function($matches) {
return ucfirst(str_replace(['-','_'], '',$matches[0]));
}, $input));
} | [
"public",
"static",
"function",
"toStudlyCase",
"(",
"$",
"input",
")",
"{",
"$",
"input",
"=",
"trim",
"(",
"$",
"input",
",",
"'-_'",
")",
";",
"return",
"ucfirst",
"(",
"preg_replace_callback",
"(",
"'/([A-Z-_][a-z]+)/'",
",",
"function",
"(",
"$",
"mat... | Transforms a given input into StudlyCase
@param string $input
@return string | [
"Transforms",
"a",
"given",
"input",
"into",
"StudlyCase"
] | a2c5d76a4ab7bd658e81d88fb3c98eee115c06ac | https://github.com/keeko/framework/blob/a2c5d76a4ab7bd658e81d88fb3c98eee115c06ac/src/utils/NameUtils.php#L14-L19 | train |
keeko/framework | src/utils/NameUtils.php | NameUtils.pluralize | public static function pluralize($input) {
if (self::$pluralizer === null) {
self::$pluralizer = new StandardEnglishSingularizer();
}
return self::$pluralizer->getPluralForm($input);
} | php | public static function pluralize($input) {
if (self::$pluralizer === null) {
self::$pluralizer = new StandardEnglishSingularizer();
}
return self::$pluralizer->getPluralForm($input);
} | [
"public",
"static",
"function",
"pluralize",
"(",
"$",
"input",
")",
"{",
"if",
"(",
"self",
"::",
"$",
"pluralizer",
"===",
"null",
")",
"{",
"self",
"::",
"$",
"pluralizer",
"=",
"new",
"StandardEnglishSingularizer",
"(",
")",
";",
"}",
"return",
"self... | Returns the plural form of the input
@param string $input
@return string | [
"Returns",
"the",
"plural",
"form",
"of",
"the",
"input"
] | a2c5d76a4ab7bd658e81d88fb3c98eee115c06ac | https://github.com/keeko/framework/blob/a2c5d76a4ab7bd658e81d88fb3c98eee115c06ac/src/utils/NameUtils.php#L67-L73 | train |
keeko/framework | src/utils/NameUtils.php | NameUtils.singularize | public static function singularize($input) {
if (self::$pluralizer === null) {
self::$pluralizer = new StandardEnglishSingularizer();
}
return self::$pluralizer->getSingularForm($input);
} | php | public static function singularize($input) {
if (self::$pluralizer === null) {
self::$pluralizer = new StandardEnglishSingularizer();
}
return self::$pluralizer->getSingularForm($input);
} | [
"public",
"static",
"function",
"singularize",
"(",
"$",
"input",
")",
"{",
"if",
"(",
"self",
"::",
"$",
"pluralizer",
"===",
"null",
")",
"{",
"self",
"::",
"$",
"pluralizer",
"=",
"new",
"StandardEnglishSingularizer",
"(",
")",
";",
"}",
"return",
"se... | Returns the singular form of the input
@param string $input
@return string | [
"Returns",
"the",
"singular",
"form",
"of",
"the",
"input"
] | a2c5d76a4ab7bd658e81d88fb3c98eee115c06ac | https://github.com/keeko/framework/blob/a2c5d76a4ab7bd658e81d88fb3c98eee115c06ac/src/utils/NameUtils.php#L81-L87 | train |
znframework/package-pagination | Paginator.php | Paginator.linkNames | public function linkNames(String $prev, String $next, String $first, String $last) : Paginator
{
$this->settings['prevName'] = $prev;
$this->settings['nextName'] = $next;
$this->settings['firstName'] = $first;
$this->settings['lastName'] = $last;
return $this;
} | php | public function linkNames(String $prev, String $next, String $first, String $last) : Paginator
{
$this->settings['prevName'] = $prev;
$this->settings['nextName'] = $next;
$this->settings['firstName'] = $first;
$this->settings['lastName'] = $last;
return $this;
} | [
"public",
"function",
"linkNames",
"(",
"String",
"$",
"prev",
",",
"String",
"$",
"next",
",",
"String",
"$",
"first",
",",
"String",
"$",
"last",
")",
":",
"Paginator",
"{",
"$",
"this",
"->",
"settings",
"[",
"'prevName'",
"]",
"=",
"$",
"prev",
"... | Change the names of links.
@param string $prev
@param string $next
@param string $first
@param string $last
@return Paginator | [
"Change",
"the",
"names",
"of",
"links",
"."
] | 43549d3c7d1783d0d92195384f0cc2b0f73c1693 | https://github.com/znframework/package-pagination/blob/43549d3c7d1783d0d92195384f0cc2b0f73c1693/Paginator.php#L237-L245 | train |
znframework/package-pagination | Paginator.php | Paginator.settings | public function settings(Array $config = []) : Paginator
{
foreach( $config as $key => $value )
{
$this->$key = $value;
}
$this->class = array_merge($this->config['class'], $this->class ?? []);
$this->style = array_merge($this->config['style'], $this->sty... | php | public function settings(Array $config = []) : Paginator
{
foreach( $config as $key => $value )
{
$this->$key = $value;
}
$this->class = array_merge($this->config['class'], $this->class ?? []);
$this->style = array_merge($this->config['style'], $this->sty... | [
"public",
"function",
"settings",
"(",
"Array",
"$",
"config",
"=",
"[",
"]",
")",
":",
"Paginator",
"{",
"foreach",
"(",
"$",
"config",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"$",
"key",
"=",
"$",
"value",
";",
"}",
... | Configures all settings of the page.
@param array $cofig = []
@return Paginator | [
"Configures",
"all",
"settings",
"of",
"the",
"page",
"."
] | 43549d3c7d1783d0d92195384f0cc2b0f73c1693 | https://github.com/znframework/package-pagination/blob/43549d3c7d1783d0d92195384f0cc2b0f73c1693/Paginator.php#L308-L332 | train |
znframework/package-pagination | Paginator.php | Paginator.create | public function create($start = NULL, Array $settings = []) : String
{
# The configuration arrays are merge.
$settings = array_merge($this->config, $this->settings, $settings);
# If the configuration is present, it is rearranged.
if( ! empty($settings) )
{
$this-... | php | public function create($start = NULL, Array $settings = []) : String
{
# The configuration arrays are merge.
$settings = array_merge($this->config, $this->settings, $settings);
# If the configuration is present, it is rearranged.
if( ! empty($settings) )
{
$this-... | [
"public",
"function",
"create",
"(",
"$",
"start",
"=",
"NULL",
",",
"Array",
"$",
"settings",
"=",
"[",
"]",
")",
":",
"String",
"{",
"# The configuration arrays are merge.",
"$",
"settings",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"config",
",",
"$",... | Creates the pagination.
@param mixed $start
@param array $settings = []
@return string | [
"Creates",
"the",
"pagination",
"."
] | 43549d3c7d1783d0d92195384f0cc2b0f73c1693 | https://github.com/znframework/package-pagination/blob/43549d3c7d1783d0d92195384f0cc2b0f73c1693/Paginator.php#L342-L366 | train |
znframework/package-pagination | Paginator.php | Paginator.createBasicPaginationBar | protected function createBasicPaginationBar($startRowNumber)
{
# Add prev link.
if( $this->isPrevLink($startRowNumber) )
{
$this->addPrevLink($startRowNumber, $prevLink);
}
# Remove prev link.
else
{
$this->removeLinkFromPagingationBar(... | php | protected function createBasicPaginationBar($startRowNumber)
{
# Add prev link.
if( $this->isPrevLink($startRowNumber) )
{
$this->addPrevLink($startRowNumber, $prevLink);
}
# Remove prev link.
else
{
$this->removeLinkFromPagingationBar(... | [
"protected",
"function",
"createBasicPaginationBar",
"(",
"$",
"startRowNumber",
")",
"{",
"# Add prev link.",
"if",
"(",
"$",
"this",
"->",
"isPrevLink",
"(",
"$",
"startRowNumber",
")",
")",
"{",
"$",
"this",
"->",
"addPrevLink",
"(",
"$",
"startRowNumber",
... | Protected create basic pagination bar | [
"Protected",
"create",
"basic",
"pagination",
"bar"
] | 43549d3c7d1783d0d92195384f0cc2b0f73c1693 | https://github.com/znframework/package-pagination/blob/43549d3c7d1783d0d92195384f0cc2b0f73c1693/Paginator.php#L371-L397 | train |
znframework/package-pagination | Paginator.php | Paginator.createAdvancedPaginationBar | protected function createAdvancedPaginationBar($startRowNumber)
{
# Add prev link.
if( $this->isAdvancedPrevLink($startRowNumber) )
{
$this->addPrevLink($startRowNumber, $prevLink);
}
# Remove prev link.
else
{
$this->removeLinkFromPagi... | php | protected function createAdvancedPaginationBar($startRowNumber)
{
# Add prev link.
if( $this->isAdvancedPrevLink($startRowNumber) )
{
$this->addPrevLink($startRowNumber, $prevLink);
}
# Remove prev link.
else
{
$this->removeLinkFromPagi... | [
"protected",
"function",
"createAdvancedPaginationBar",
"(",
"$",
"startRowNumber",
")",
"{",
"# Add prev link.",
"if",
"(",
"$",
"this",
"->",
"isAdvancedPrevLink",
"(",
"$",
"startRowNumber",
")",
")",
"{",
"$",
"this",
"->",
"addPrevLink",
"(",
"$",
"startRow... | Protected create advanced pagination bar | [
"Protected",
"create",
"advanced",
"pagination",
"bar"
] | 43549d3c7d1783d0d92195384f0cc2b0f73c1693 | https://github.com/znframework/package-pagination/blob/43549d3c7d1783d0d92195384f0cc2b0f73c1693/Paginator.php#L402-L445 | train |
znframework/package-pagination | Paginator.php | Paginator.addLastLink | protected function addLastLink(&$lastLink)
{
$lastLink = $this->getLink($this->calculatePageRowNumberForLastLink(), $this->getStyleClassAttributes('last'), $this->lastName);
} | php | protected function addLastLink(&$lastLink)
{
$lastLink = $this->getLink($this->calculatePageRowNumberForLastLink(), $this->getStyleClassAttributes('last'), $this->lastName);
} | [
"protected",
"function",
"addLastLink",
"(",
"&",
"$",
"lastLink",
")",
"{",
"$",
"lastLink",
"=",
"$",
"this",
"->",
"getLink",
"(",
"$",
"this",
"->",
"calculatePageRowNumberForLastLink",
"(",
")",
",",
"$",
"this",
"->",
"getStyleClassAttributes",
"(",
"'... | Protected get last link | [
"Protected",
"get",
"last",
"link"
] | 43549d3c7d1783d0d92195384f0cc2b0f73c1693 | https://github.com/znframework/package-pagination/blob/43549d3c7d1783d0d92195384f0cc2b0f73c1693/Paginator.php#L487-L490 | train |
znframework/package-pagination | Paginator.php | Paginator.addPrevLink | protected function addPrevLink($startRowNumber, &$prevLink)
{
$prevLink = $this->getLink($this->decrementPageRowNumber($startRowNumber), $this->getStyleClassAttributes('prev'), $this->prevName);
} | php | protected function addPrevLink($startRowNumber, &$prevLink)
{
$prevLink = $this->getLink($this->decrementPageRowNumber($startRowNumber), $this->getStyleClassAttributes('prev'), $this->prevName);
} | [
"protected",
"function",
"addPrevLink",
"(",
"$",
"startRowNumber",
",",
"&",
"$",
"prevLink",
")",
"{",
"$",
"prevLink",
"=",
"$",
"this",
"->",
"getLink",
"(",
"$",
"this",
"->",
"decrementPageRowNumber",
"(",
"$",
"startRowNumber",
")",
",",
"$",
"this"... | Protected get prev link | [
"Protected",
"get",
"prev",
"link"
] | 43549d3c7d1783d0d92195384f0cc2b0f73c1693 | https://github.com/znframework/package-pagination/blob/43549d3c7d1783d0d92195384f0cc2b0f73c1693/Paginator.php#L495-L498 | train |
znframework/package-pagination | Paginator.php | Paginator.addNextLink | protected function addNextLink($startRowNumber, &$nextLink)
{
$nextLink = $this->getLink($this->incrementPageRowNumber($startRowNumber), $this->getStyleClassAttributes('next'), $this->nextName);
} | php | protected function addNextLink($startRowNumber, &$nextLink)
{
$nextLink = $this->getLink($this->incrementPageRowNumber($startRowNumber), $this->getStyleClassAttributes('next'), $this->nextName);
} | [
"protected",
"function",
"addNextLink",
"(",
"$",
"startRowNumber",
",",
"&",
"$",
"nextLink",
")",
"{",
"$",
"nextLink",
"=",
"$",
"this",
"->",
"getLink",
"(",
"$",
"this",
"->",
"incrementPageRowNumber",
"(",
"$",
"startRowNumber",
")",
",",
"$",
"this"... | Protected get advanced next link | [
"Protected",
"get",
"advanced",
"next",
"link"
] | 43549d3c7d1783d0d92195384f0cc2b0f73c1693 | https://github.com/znframework/package-pagination/blob/43549d3c7d1783d0d92195384f0cc2b0f73c1693/Paginator.php#L503-L506 | train |
znframework/package-pagination | Paginator.php | Paginator.getStartRowNumber | protected function getStartRowNumber($start)
{
if( $this->start !== NULL )
{
$start = (int) $this->start;
}
if( empty($start) && ! is_numeric($start) )
{
return ! is_numeric($segment = URI::segment(-1)) ? 0 : $segment;
}
retur... | php | protected function getStartRowNumber($start)
{
if( $this->start !== NULL )
{
$start = (int) $this->start;
}
if( empty($start) && ! is_numeric($start) )
{
return ! is_numeric($segment = URI::segment(-1)) ? 0 : $segment;
}
retur... | [
"protected",
"function",
"getStartRowNumber",
"(",
"$",
"start",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"start",
"!==",
"NULL",
")",
"{",
"$",
"start",
"=",
"(",
"int",
")",
"$",
"this",
"->",
"start",
";",
"}",
"if",
"(",
"empty",
"(",
"$",
"st... | Protected get start row number | [
"Protected",
"get",
"start",
"row",
"number"
] | 43549d3c7d1783d0d92195384f0cc2b0f73c1693 | https://github.com/znframework/package-pagination/blob/43549d3c7d1783d0d92195384f0cc2b0f73c1693/Paginator.php#L511-L524 | train |
znframework/package-pagination | Paginator.php | Paginator.getAdvancedPerPage | protected function getAdvancedPerPage($pageIndex, &$nextLink, &$lastLink)
{
$perPage = $this->countLinks + $pageIndex - 1;
if( $perPage >= ($getPerPage = $this->getPerPage()) )
{
$this->removeLinkFromPagingationBar($nextLink);
$this->removeLinkFromPagingationBar($las... | php | protected function getAdvancedPerPage($pageIndex, &$nextLink, &$lastLink)
{
$perPage = $this->countLinks + $pageIndex - 1;
if( $perPage >= ($getPerPage = $this->getPerPage()) )
{
$this->removeLinkFromPagingationBar($nextLink);
$this->removeLinkFromPagingationBar($las... | [
"protected",
"function",
"getAdvancedPerPage",
"(",
"$",
"pageIndex",
",",
"&",
"$",
"nextLink",
",",
"&",
"$",
"lastLink",
")",
"{",
"$",
"perPage",
"=",
"$",
"this",
"->",
"countLinks",
"+",
"$",
"pageIndex",
"-",
"1",
";",
"if",
"(",
"$",
"perPage",... | Protected advanced per page. | [
"Protected",
"advanced",
"per",
"page",
"."
] | 43549d3c7d1783d0d92195384f0cc2b0f73c1693 | https://github.com/znframework/package-pagination/blob/43549d3c7d1783d0d92195384f0cc2b0f73c1693/Paginator.php#L545-L558 | train |
znframework/package-pagination | Paginator.php | Paginator.getNumberLinks | protected function getNumberLinks($perPage, $startRowNumber, $startIndexNumber = 1)
{
$numberLinks = NULL;
for( $i = $startIndexNumber; $i <= $perPage; $i++ )
{
$page = ($i - 1) * $this->limit;
if( $i - 1 == floor((int) $startRowNumber / $this->limit) )
... | php | protected function getNumberLinks($perPage, $startRowNumber, $startIndexNumber = 1)
{
$numberLinks = NULL;
for( $i = $startIndexNumber; $i <= $perPage; $i++ )
{
$page = ($i - 1) * $this->limit;
if( $i - 1 == floor((int) $startRowNumber / $this->limit) )
... | [
"protected",
"function",
"getNumberLinks",
"(",
"$",
"perPage",
",",
"$",
"startRowNumber",
",",
"$",
"startIndexNumber",
"=",
"1",
")",
"{",
"$",
"numberLinks",
"=",
"NULL",
";",
"for",
"(",
"$",
"i",
"=",
"$",
"startIndexNumber",
";",
"$",
"i",
"<=",
... | Protected get number links | [
"Protected",
"get",
"number",
"links"
] | 43549d3c7d1783d0d92195384f0cc2b0f73c1693 | https://github.com/znframework/package-pagination/blob/43549d3c7d1783d0d92195384f0cc2b0f73c1693/Paginator.php#L611-L632 | train |
znframework/package-pagination | Paginator.php | Paginator.calculatePageRowNumberForLastLink | protected function calculatePageRowNumberForLastLink()
{
$mod = $this->totalRows % $this->limit;
return ($this->totalRows - $mod ) - ($mod == 0 ? $this->limit : 0);
} | php | protected function calculatePageRowNumberForLastLink()
{
$mod = $this->totalRows % $this->limit;
return ($this->totalRows - $mod ) - ($mod == 0 ? $this->limit : 0);
} | [
"protected",
"function",
"calculatePageRowNumberForLastLink",
"(",
")",
"{",
"$",
"mod",
"=",
"$",
"this",
"->",
"totalRows",
"%",
"$",
"this",
"->",
"limit",
";",
"return",
"(",
"$",
"this",
"->",
"totalRows",
"-",
"$",
"mod",
")",
"-",
"(",
"$",
"mod... | Protected page row number for last link | [
"Protected",
"page",
"row",
"number",
"for",
"last",
"link"
] | 43549d3c7d1783d0d92195384f0cc2b0f73c1693 | https://github.com/znframework/package-pagination/blob/43549d3c7d1783d0d92195384f0cc2b0f73c1693/Paginator.php#L653-L658 | train |
znframework/package-pagination | Paginator.php | Paginator.checkGetRequest | protected function checkGetRequest($page)
{
$this->url .= $this->explodeRequestGetValue();
if( strstr($this->url, '?') )
{
$urlEx = explode('?', $this->url);
return Base::suffix($urlEx[0]) . $page . '?' . rtrim($urlEx[1], '/');
}
return $this->type ... | php | protected function checkGetRequest($page)
{
$this->url .= $this->explodeRequestGetValue();
if( strstr($this->url, '?') )
{
$urlEx = explode('?', $this->url);
return Base::suffix($urlEx[0]) . $page . '?' . rtrim($urlEx[1], '/');
}
return $this->type ... | [
"protected",
"function",
"checkGetRequest",
"(",
"$",
"page",
")",
"{",
"$",
"this",
"->",
"url",
".=",
"$",
"this",
"->",
"explodeRequestGetValue",
"(",
")",
";",
"if",
"(",
"strstr",
"(",
"$",
"this",
"->",
"url",
",",
"'?'",
")",
")",
"{",
"$",
... | Protected check get request | [
"Protected",
"check",
"get",
"request"
] | 43549d3c7d1783d0d92195384f0cc2b0f73c1693 | https://github.com/znframework/package-pagination/blob/43549d3c7d1783d0d92195384f0cc2b0f73c1693/Paginator.php#L697-L709 | train |
znframework/package-pagination | Paginator.php | Paginator.getLink | protected function getLink($var, $fix, $val)
{
return $this->getHtmlLiElement($this->getHtmlAnchorElement($var, $fix, $val), $fix);
} | php | protected function getLink($var, $fix, $val)
{
return $this->getHtmlLiElement($this->getHtmlAnchorElement($var, $fix, $val), $fix);
} | [
"protected",
"function",
"getLink",
"(",
"$",
"var",
",",
"$",
"fix",
",",
"$",
"val",
")",
"{",
"return",
"$",
"this",
"->",
"getHtmlLiElement",
"(",
"$",
"this",
"->",
"getHtmlAnchorElement",
"(",
"$",
"var",
",",
"$",
"fix",
",",
"$",
"val",
")",
... | Protected get link | [
"Protected",
"get",
"link"
] | 43549d3c7d1783d0d92195384f0cc2b0f73c1693 | https://github.com/znframework/package-pagination/blob/43549d3c7d1783d0d92195384f0cc2b0f73c1693/Paginator.php#L714-L717 | train |
znframework/package-pagination | Paginator.php | Paginator.getHtmlAnchorElement | protected function getHtmlAnchorElement($var, $attr, $val)
{
if( $this->output === 'bootstrap' )
{
$attr = NULL;
}
return '<a href="'.$this->checkGetRequest($var).'"'.$this->getAttributesForAjaxProcess($var).$attr.'>'.$val.'</a>';
} | php | protected function getHtmlAnchorElement($var, $attr, $val)
{
if( $this->output === 'bootstrap' )
{
$attr = NULL;
}
return '<a href="'.$this->checkGetRequest($var).'"'.$this->getAttributesForAjaxProcess($var).$attr.'>'.$val.'</a>';
} | [
"protected",
"function",
"getHtmlAnchorElement",
"(",
"$",
"var",
",",
"$",
"attr",
",",
"$",
"val",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"output",
"===",
"'bootstrap'",
")",
"{",
"$",
"attr",
"=",
"NULL",
";",
"}",
"return",
"'<a href=\"'",
".",
... | Protected get html anchor element | [
"Protected",
"get",
"html",
"anchor",
"element"
] | 43549d3c7d1783d0d92195384f0cc2b0f73c1693 | https://github.com/znframework/package-pagination/blob/43549d3c7d1783d0d92195384f0cc2b0f73c1693/Paginator.php#L722-L730 | train |
znframework/package-pagination | Paginator.php | Paginator.generatePaginationBar | protected function generatePaginationBar(...$numberLinks)
{
$links = $this->implodeLinks(...$numberLinks);
if( $this->output === 'bootstrap' )
{
return '<ul class="pagination">' . $links . '</ul>';
}
return $links;
} | php | protected function generatePaginationBar(...$numberLinks)
{
$links = $this->implodeLinks(...$numberLinks);
if( $this->output === 'bootstrap' )
{
return '<ul class="pagination">' . $links . '</ul>';
}
return $links;
} | [
"protected",
"function",
"generatePaginationBar",
"(",
"...",
"$",
"numberLinks",
")",
"{",
"$",
"links",
"=",
"$",
"this",
"->",
"implodeLinks",
"(",
"...",
"$",
"numberLinks",
")",
";",
"if",
"(",
"$",
"this",
"->",
"output",
"===",
"'bootstrap'",
")",
... | Protected get html ul element | [
"Protected",
"get",
"html",
"ul",
"element"
] | 43549d3c7d1783d0d92195384f0cc2b0f73c1693 | https://github.com/znframework/package-pagination/blob/43549d3c7d1783d0d92195384f0cc2b0f73c1693/Paginator.php#L748-L758 | train |
znframework/package-pagination | Paginator.php | Paginator.getStyleLinkAttribute | protected function getStyleLinkAttribute($var, $type = 'style')
{
$getAttribute = ( ! empty($this->{$type}[$var]) ) ? $this->{$type}[$var] . ' ' : '';
if( $type === 'class' )
{
$this->classAttribute = $getAttribute;
}
else
{
$this->styleAtt... | php | protected function getStyleLinkAttribute($var, $type = 'style')
{
$getAttribute = ( ! empty($this->{$type}[$var]) ) ? $this->{$type}[$var] . ' ' : '';
if( $type === 'class' )
{
$this->classAttribute = $getAttribute;
}
else
{
$this->styleAtt... | [
"protected",
"function",
"getStyleLinkAttribute",
"(",
"$",
"var",
",",
"$",
"type",
"=",
"'style'",
")",
"{",
"$",
"getAttribute",
"=",
"(",
"!",
"empty",
"(",
"$",
"this",
"->",
"{",
"$",
"type",
"}",
"[",
"$",
"var",
"]",
")",
")",
"?",
"$",
"... | Protected get style link attribute | [
"Protected",
"get",
"style",
"link",
"attribute"
] | 43549d3c7d1783d0d92195384f0cc2b0f73c1693 | https://github.com/znframework/package-pagination/blob/43549d3c7d1783d0d92195384f0cc2b0f73c1693/Paginator.php#L763-L777 | train |
znframework/package-pagination | Paginator.php | Paginator.getClassAttribute | protected function getClassAttribute($var, $type = 'class')
{
$status = trim(( $type === 'class' ? $this->classAttribute : $this->styleAttribute) . $this->{$type}[$var]);
return $this->createAttribute($status, $type);
} | php | protected function getClassAttribute($var, $type = 'class')
{
$status = trim(( $type === 'class' ? $this->classAttribute : $this->styleAttribute) . $this->{$type}[$var]);
return $this->createAttribute($status, $type);
} | [
"protected",
"function",
"getClassAttribute",
"(",
"$",
"var",
",",
"$",
"type",
"=",
"'class'",
")",
"{",
"$",
"status",
"=",
"trim",
"(",
"(",
"$",
"type",
"===",
"'class'",
"?",
"$",
"this",
"->",
"classAttribute",
":",
"$",
"this",
"->",
"styleAttr... | Protected get class attribute | [
"Protected",
"get",
"class",
"attribute"
] | 43549d3c7d1783d0d92195384f0cc2b0f73c1693 | https://github.com/znframework/package-pagination/blob/43549d3c7d1783d0d92195384f0cc2b0f73c1693/Paginator.php#L790-L795 | train |
znframework/package-pagination | Paginator.php | Paginator.createAttribute | protected function createAttribute($condition, $key, $value = NULL)
{
return ! empty($condition) ? ' ' . $key . '="' . trim($value ?? $condition) . '"' : '';
} | php | protected function createAttribute($condition, $key, $value = NULL)
{
return ! empty($condition) ? ' ' . $key . '="' . trim($value ?? $condition) . '"' : '';
} | [
"protected",
"function",
"createAttribute",
"(",
"$",
"condition",
",",
"$",
"key",
",",
"$",
"value",
"=",
"NULL",
")",
"{",
"return",
"!",
"empty",
"(",
"$",
"condition",
")",
"?",
"' '",
".",
"$",
"key",
".",
"'=\"'",
".",
"trim",
"(",
"$",
"val... | Protcted create attribute | [
"Protcted",
"create",
"attribute"
] | 43549d3c7d1783d0d92195384f0cc2b0f73c1693 | https://github.com/znframework/package-pagination/blob/43549d3c7d1783d0d92195384f0cc2b0f73c1693/Paginator.php#L800-L803 | train |
phavour/phavour | Phavour/Runnable.php | Runnable.finalise | final public function finalise()
{
if ($this->view->isEnabled()) {
$this->view->setResponse($this->response);
$this->view->render();
}
return true;
} | php | final public function finalise()
{
if ($this->view->isEnabled()) {
$this->view->setResponse($this->response);
$this->view->render();
}
return true;
} | [
"final",
"public",
"function",
"finalise",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"view",
"->",
"isEnabled",
"(",
")",
")",
"{",
"$",
"this",
"->",
"view",
"->",
"setResponse",
"(",
"$",
"this",
"->",
"response",
")",
";",
"$",
"this",
"->",
... | Called at the end of the process.
@return boolean | [
"Called",
"at",
"the",
"end",
"of",
"the",
"process",
"."
] | 2246f78203312eb2e23fdb0f776f790e81b4d20f | https://github.com/phavour/phavour/blob/2246f78203312eb2e23fdb0f776f790e81b4d20f/Phavour/Runnable.php#L199-L206 | train |
phavour/phavour | Phavour/Runnable.php | Runnable.urlFor | final public function urlFor($routeName, array $params = array())
{
if (null === $this->router) {
return '';
}
return $this->router->urlFor($routeName, $params);
} | php | final public function urlFor($routeName, array $params = array())
{
if (null === $this->router) {
return '';
}
return $this->router->urlFor($routeName, $params);
} | [
"final",
"public",
"function",
"urlFor",
"(",
"$",
"routeName",
",",
"array",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"this",
"->",
"router",
")",
"{",
"return",
"''",
";",
"}",
"return",
"$",
"this",
"->",
... | Get a route path by a given name
@param string $routeName
@param array $params (optional)
@return string | [
"Get",
"a",
"route",
"path",
"by",
"a",
"given",
"name"
] | 2246f78203312eb2e23fdb0f776f790e81b4d20f | https://github.com/phavour/phavour/blob/2246f78203312eb2e23fdb0f776f790e81b4d20f/Phavour/Runnable.php#L214-L221 | train |
phavour/phavour | Phavour/Runnable.php | Runnable.notFound | public function notFound($package = 'DefaultPackage', $class = 'Error', $method = 'notFound')
{
$this->response->setStatus(404);
$this->view->setPackage($package);
$this->view->setClass($class);
$this->view->setScriptName($method);
return;
} | php | public function notFound($package = 'DefaultPackage', $class = 'Error', $method = 'notFound')
{
$this->response->setStatus(404);
$this->view->setPackage($package);
$this->view->setClass($class);
$this->view->setScriptName($method);
return;
} | [
"public",
"function",
"notFound",
"(",
"$",
"package",
"=",
"'DefaultPackage'",
",",
"$",
"class",
"=",
"'Error'",
",",
"$",
"method",
"=",
"'notFound'",
")",
"{",
"$",
"this",
"->",
"response",
"->",
"setStatus",
"(",
"404",
")",
";",
"$",
"this",
"->... | When you need to send a not found in your runnable, you
can call this directly.
Optionally, you can specify the package name, class name,
and method name to render accordingly.
@param sring $package (optional) default 'DefaultPackage'
@param sring $class (optional) default 'Error'
@param sring $method (optional) defaul... | [
"When",
"you",
"need",
"to",
"send",
"a",
"not",
"found",
"in",
"your",
"runnable",
"you",
"can",
"call",
"this",
"directly",
".",
"Optionally",
"you",
"can",
"specify",
"the",
"package",
"name",
"class",
"name",
"and",
"method",
"name",
"to",
"render",
... | 2246f78203312eb2e23fdb0f776f790e81b4d20f | https://github.com/phavour/phavour/blob/2246f78203312eb2e23fdb0f776f790e81b4d20f/Phavour/Runnable.php#L233-L240 | train |
Boolive/Core | data/Entity.php | Entity.parent | function parent($new = null, $return_entity = false)
{
if (isset($new)){
if ($new instanceof Entity){
$this->_parent = $new;
$new = $new->uri();
}else{
$this->_parent = null; // for reloading
}
if ($new != $this-... | php | function parent($new = null, $return_entity = false)
{
if (isset($new)){
if ($new instanceof Entity){
$this->_parent = $new;
$new = $new->uri();
}else{
$this->_parent = null; // for reloading
}
if ($new != $this-... | [
"function",
"parent",
"(",
"$",
"new",
"=",
"null",
",",
"$",
"return_entity",
"=",
"false",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"new",
")",
")",
"{",
"if",
"(",
"$",
"new",
"instanceof",
"Entity",
")",
"{",
"$",
"this",
"->",
"_parent",
"=",... | Parent of this object
@param null|string|Entity $new New parent. URI or object
@param bool $return_entity Признак, возвращать объект вместо uri
@return string|Entity|false | [
"Parent",
"of",
"this",
"object"
] | ead9668f1a6adf41656131eb608a99db6855138d | https://github.com/Boolive/Core/blob/ead9668f1a6adf41656131eb608a99db6855138d/data/Entity.php#L248-L274 | train |
Boolive/Core | data/Entity.php | Entity.proto | function proto($new = null, $return_entity = false)
{
if (isset($new)){
if ($new instanceof Entity){
$this->_proto = $new;
$new = $new->uri();
}else{
$this->_proto = null; // for reloading
}
if ($new != $this->_a... | php | function proto($new = null, $return_entity = false)
{
if (isset($new)){
if ($new instanceof Entity){
$this->_proto = $new;
$new = $new->uri();
}else{
$this->_proto = null; // for reloading
}
if ($new != $this->_a... | [
"function",
"proto",
"(",
"$",
"new",
"=",
"null",
",",
"$",
"return_entity",
"=",
"false",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"new",
")",
")",
"{",
"if",
"(",
"$",
"new",
"instanceof",
"Entity",
")",
"{",
"$",
"this",
"->",
"_proto",
"=",
... | Prototype of this object
@param null|string|Entity $new Новый прототип. URI или объект
@param bool $return_entity Признак, возвращать объект вместо uri
@return string|Entity|false | [
"Prototype",
"of",
"this",
"object"
] | ead9668f1a6adf41656131eb608a99db6855138d | https://github.com/Boolive/Core/blob/ead9668f1a6adf41656131eb608a99db6855138d/data/Entity.php#L282-L306 | train |
Boolive/Core | data/Entity.php | Entity.author | function author($new = null, $return_entity = false)
{
if (isset($new)){
if ($new instanceof Entity){
$this->_author = $new;
$new = $new->uri();
}else{
$this->_author = null; // for reloading
}
if ($new != $this-... | php | function author($new = null, $return_entity = false)
{
if (isset($new)){
if ($new instanceof Entity){
$this->_author = $new;
$new = $new->uri();
}else{
$this->_author = null; // for reloading
}
if ($new != $this-... | [
"function",
"author",
"(",
"$",
"new",
"=",
"null",
",",
"$",
"return_entity",
"=",
"false",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"new",
")",
")",
"{",
"if",
"(",
"$",
"new",
"instanceof",
"Entity",
")",
"{",
"$",
"this",
"->",
"_author",
"=",... | Author of this object
@param null|string|Entity $new Новый автор. URI или объект
@param bool $return_entity Признак, возвращать объект вместо uri
@return mixed | [
"Author",
"of",
"this",
"object"
] | ead9668f1a6adf41656131eb608a99db6855138d | https://github.com/Boolive/Core/blob/ead9668f1a6adf41656131eb608a99db6855138d/data/Entity.php#L314-L338 | train |
Boolive/Core | data/Entity.php | Entity.is_link | function is_link($new = null, $return_entity = false)
{
if (isset($new) && ($this->_attributes['is_link'] != $new)){
$this->change('is_link', (bool)$new);
}
if ($return_entity){
if (!isset($this->_link)){
if (empty($this->_attributes['is_link'])){
... | php | function is_link($new = null, $return_entity = false)
{
if (isset($new) && ($this->_attributes['is_link'] != $new)){
$this->change('is_link', (bool)$new);
}
if ($return_entity){
if (!isset($this->_link)){
if (empty($this->_attributes['is_link'])){
... | [
"function",
"is_link",
"(",
"$",
"new",
"=",
"null",
",",
"$",
"return_entity",
"=",
"false",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"new",
")",
"&&",
"(",
"$",
"this",
"->",
"_attributes",
"[",
"'is_link'",
"]",
"!=",
"$",
"new",
")",
")",
"{",... | Object referenced by this object
@param null|bool $new Новое значение признака
@param bool $return_entity Признак, возвращать объект вместо uri
@return bool|Entity | [
"Object",
"referenced",
"by",
"this",
"object"
] | ead9668f1a6adf41656131eb608a99db6855138d | https://github.com/Boolive/Core/blob/ead9668f1a6adf41656131eb608a99db6855138d/data/Entity.php#L574-L591 | train |
comodojo/extender.framework | src/Comodojo/Extender/Task/Table.php | Table.add | public function add($name, $class, $description = null) {
if ( array_key_exists($name, $this->data) ) {
$this->logger->warning("Skipping duplicate task $name ($class)");
return false;
}
if ( empty($name) || empty($class) || !class_exists($class) ) {
$this->l... | php | public function add($name, $class, $description = null) {
if ( array_key_exists($name, $this->data) ) {
$this->logger->warning("Skipping duplicate task $name ($class)");
return false;
}
if ( empty($name) || empty($class) || !class_exists($class) ) {
$this->l... | [
"public",
"function",
"add",
"(",
"$",
"name",
",",
"$",
"class",
",",
"$",
"description",
"=",
"null",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"data",
")",
")",
"{",
"$",
"this",
"->",
"logger",
"->",
"... | Add a new task to table
@param string $name
@param string $class
@param string $description
@return bool | [
"Add",
"a",
"new",
"task",
"to",
"table"
] | cc9a4fbd29fe0e80965ce4535091c956aad70b27 | https://github.com/comodojo/extender.framework/blob/cc9a4fbd29fe0e80965ce4535091c956aad70b27/src/Comodojo/Extender/Task/Table.php#L84-L113 | train |
comodojo/extender.framework | src/Comodojo/Extender/Task/Table.php | Table.delete | public function delete($name) {
if ( array_key_exists($name, $this->data) ) {
unset($this->data[$name]);
return true;
}
return false;
} | php | public function delete($name) {
if ( array_key_exists($name, $this->data) ) {
unset($this->data[$name]);
return true;
}
return false;
} | [
"public",
"function",
"delete",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"name",
",",
"$",
"this",
"->",
"data",
")",
")",
"{",
"unset",
"(",
"$",
"this",
"->",
"data",
"[",
"$",
"name",
"]",
")",
";",
"return",
"true"... | Delete a task from table
@param string $name
@return bool | [
"Delete",
"a",
"task",
"from",
"table"
] | cc9a4fbd29fe0e80965ce4535091c956aad70b27 | https://github.com/comodojo/extender.framework/blob/cc9a4fbd29fe0e80965ce4535091c956aad70b27/src/Comodojo/Extender/Task/Table.php#L121-L130 | train |
comodojo/extender.framework | src/Comodojo/Extender/Task/Table.php | Table.addBulk | public function addBulk(array $tasks) {
$result = [];
foreach($tasks as $name => $task) {
if ( empty($task['class']) ) {
$this->logger->warning("Missing class for task $name");
$result[] = false;
} else {
$result[] = $this->ad... | php | public function addBulk(array $tasks) {
$result = [];
foreach($tasks as $name => $task) {
if ( empty($task['class']) ) {
$this->logger->warning("Missing class for task $name");
$result[] = false;
} else {
$result[] = $this->ad... | [
"public",
"function",
"addBulk",
"(",
"array",
"$",
"tasks",
")",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"tasks",
"as",
"$",
"name",
"=>",
"$",
"task",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"task",
"[",
"'class'",
"]",
"... | Load a bulk task list into the table
@param array $tasks
@return bool | [
"Load",
"a",
"bulk",
"task",
"list",
"into",
"the",
"table"
] | cc9a4fbd29fe0e80965ce4535091c956aad70b27 | https://github.com/comodojo/extender.framework/blob/cc9a4fbd29fe0e80965ce4535091c956aad70b27/src/Comodojo/Extender/Task/Table.php#L138-L159 | train |
andyburton/Sonic-Framework | src/Resource/Model/Collection.php | Collection.random | public function random ()
{
$arr = $this->getArrayCopy ();
$rand = array_rand ($arr);
return isset ($arr[$rand])? $arr[$rand] : FALSE;
} | php | public function random ()
{
$arr = $this->getArrayCopy ();
$rand = array_rand ($arr);
return isset ($arr[$rand])? $arr[$rand] : FALSE;
} | [
"public",
"function",
"random",
"(",
")",
"{",
"$",
"arr",
"=",
"$",
"this",
"->",
"getArrayCopy",
"(",
")",
";",
"$",
"rand",
"=",
"array_rand",
"(",
"$",
"arr",
")",
";",
"return",
"isset",
"(",
"$",
"arr",
"[",
"$",
"rand",
"]",
")",
"?",
"$... | Return random collection item
@return \Sonic\Model|FALSE | [
"Return",
"random",
"collection",
"item"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Resource/Model/Collection.php#L81-L86 | train |
andyburton/Sonic-Framework | src/Resource/Model/Collection.php | Collection.toArray | public function toArray ($attributes = FALSE, $relations = array (), $recursive = FALSE)
{
$arr = array ();
$it = $this->getIterator ();
while ($it->valid ())
{
$arr[$it->key ()] = $it->current ()->toArray ($attributes, $relations, $recursive);
$it->next ();
}
return $arr;
} | php | public function toArray ($attributes = FALSE, $relations = array (), $recursive = FALSE)
{
$arr = array ();
$it = $this->getIterator ();
while ($it->valid ())
{
$arr[$it->key ()] = $it->current ()->toArray ($attributes, $relations, $recursive);
$it->next ();
}
return $arr;
} | [
"public",
"function",
"toArray",
"(",
"$",
"attributes",
"=",
"FALSE",
",",
"$",
"relations",
"=",
"array",
"(",
")",
",",
"$",
"recursive",
"=",
"FALSE",
")",
"{",
"$",
"arr",
"=",
"array",
"(",
")",
";",
"$",
"it",
"=",
"$",
"this",
"->",
"getI... | Return a multidimensional array with objects and their attributes
@param array|boolean $attributes Attributes to include, default to false i.e all attributes
@param array $relations Array of related object attributes or tranformed method attributes to return
e.g. related value - 'query_name' => array ('\Sonic\Model\Use... | [
"Return",
"a",
"multidimensional",
"array",
"with",
"objects",
"and",
"their",
"attributes"
] | a5999448a0abab4d542413002a780ede391e7374 | https://github.com/andyburton/Sonic-Framework/blob/a5999448a0abab4d542413002a780ede391e7374/src/Resource/Model/Collection.php#L100-L114 | train |
newup/core | src/Foundation/Composer/Composer.php | Composer.prepareOptions | private function prepareOptions($options, $forceOptions = [])
{
$optionString = '';
foreach ($forceOptions as $option => $value) {
if (is_numeric($option)) {
$options[$value] = null;
} else {
$options[$option] = $value;
}
}... | php | private function prepareOptions($options, $forceOptions = [])
{
$optionString = '';
foreach ($forceOptions as $option => $value) {
if (is_numeric($option)) {
$options[$value] = null;
} else {
$options[$option] = $value;
}
}... | [
"private",
"function",
"prepareOptions",
"(",
"$",
"options",
",",
"$",
"forceOptions",
"=",
"[",
"]",
")",
"{",
"$",
"optionString",
"=",
"''",
";",
"foreach",
"(",
"$",
"forceOptions",
"as",
"$",
"option",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"... | Prepares the options string.
@param $options
@param $forceOptions
@return string | [
"Prepares",
"the",
"options",
"string",
"."
] | 54128903e7775e67d63284d958b46862c8df71f9 | https://github.com/newup/core/blob/54128903e7775e67d63284d958b46862c8df71f9/src/Foundation/Composer/Composer.php#L118-L140 | train |
newup/core | src/Foundation/Composer/Composer.php | Composer.prepareInstallationDirectory | private function prepareInstallationDirectory($directory)
{
if (!$this->files->exists($directory)) {
$this->files->makeDirectory($directory . DIRECTORY_SEPARATOR, 0755, true);
return;
}
$this->files->deleteDirectory($directory, true);
$this->checkInstallatio... | php | private function prepareInstallationDirectory($directory)
{
if (!$this->files->exists($directory)) {
$this->files->makeDirectory($directory . DIRECTORY_SEPARATOR, 0755, true);
return;
}
$this->files->deleteDirectory($directory, true);
$this->checkInstallatio... | [
"private",
"function",
"prepareInstallationDirectory",
"(",
"$",
"directory",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"files",
"->",
"exists",
"(",
"$",
"directory",
")",
")",
"{",
"$",
"this",
"->",
"files",
"->",
"makeDirectory",
"(",
"$",
"direct... | Prepares the installation directory.
This method will create the directory if it does
not exist and will ensure that the directory is
empty if it does.
@param $directory | [
"Prepares",
"the",
"installation",
"directory",
"."
] | 54128903e7775e67d63284d958b46862c8df71f9 | https://github.com/newup/core/blob/54128903e7775e67d63284d958b46862c8df71f9/src/Foundation/Composer/Composer.php#L151-L161 | train |
newup/core | src/Foundation/Composer/Composer.php | Composer.checkInstallationDirectory | private function checkInstallationDirectory($directory)
{
if ($this->installationAttempts >= $this->breakAtInstallationAttempt) {
$this->log->error('Installation directory checks failed at max attempts', ['attempts' => $this->installationAttempts]);
throw new PackageInstallationExcep... | php | private function checkInstallationDirectory($directory)
{
if ($this->installationAttempts >= $this->breakAtInstallationAttempt) {
$this->log->error('Installation directory checks failed at max attempts', ['attempts' => $this->installationAttempts]);
throw new PackageInstallationExcep... | [
"private",
"function",
"checkInstallationDirectory",
"(",
"$",
"directory",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"installationAttempts",
">=",
"$",
"this",
"->",
"breakAtInstallationAttempt",
")",
"{",
"$",
"this",
"->",
"log",
"->",
"error",
"(",
"'Install... | Checks the installation directory to make sure it is ready.
@throws InvalidInstallationDirectoryException
@throws PackageInstallationException
@param $directory | [
"Checks",
"the",
"installation",
"directory",
"to",
"make",
"sure",
"it",
"is",
"ready",
"."
] | 54128903e7775e67d63284d958b46862c8df71f9 | https://github.com/newup/core/blob/54128903e7775e67d63284d958b46862c8df71f9/src/Foundation/Composer/Composer.php#L170-L218 | train |
newup/core | src/Foundation/Composer/Composer.php | Composer.installPackage | public function installPackage($packageName, $options = [])
{
$process = $this->getProcess();
$processCommand = trim($this->findComposer() . ' create-project ' . $packageName . ' "' .
$this->workingPath . '" ' .
$this->prepareOptions($op... | php | public function installPackage($packageName, $options = [])
{
$process = $this->getProcess();
$processCommand = trim($this->findComposer() . ' create-project ' . $packageName . ' "' .
$this->workingPath . '" ' .
$this->prepareOptions($op... | [
"public",
"function",
"installPackage",
"(",
"$",
"packageName",
",",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"process",
"=",
"$",
"this",
"->",
"getProcess",
"(",
")",
";",
"$",
"processCommand",
"=",
"trim",
"(",
"$",
"this",
"->",
"findCompose... | Installs a Composer package, placing it in NewUp's template storage.
@param $packageName
@param array $options
@throws PackageInstallationException
@return bool | [
"Installs",
"a",
"Composer",
"package",
"placing",
"it",
"in",
"NewUp",
"s",
"template",
"storage",
"."
] | 54128903e7775e67d63284d958b46862c8df71f9 | https://github.com/newup/core/blob/54128903e7775e67d63284d958b46862c8df71f9/src/Foundation/Composer/Composer.php#L245-L276 | train |
newup/core | src/Foundation/Composer/Composer.php | Composer.updatePackageDependencies | public function updatePackageDependencies($options = [])
{
$process = $this->getProcess();
$processCommand = trim($this->findComposer() . ' update ' .
$this->prepareOptions($options, ['--no-progress', '--no-ansi']));
$process->setCommandLine($processCommand);... | php | public function updatePackageDependencies($options = [])
{
$process = $this->getProcess();
$processCommand = trim($this->findComposer() . ' update ' .
$this->prepareOptions($options, ['--no-progress', '--no-ansi']));
$process->setCommandLine($processCommand);... | [
"public",
"function",
"updatePackageDependencies",
"(",
"$",
"options",
"=",
"[",
"]",
")",
"{",
"$",
"process",
"=",
"$",
"this",
"->",
"getProcess",
"(",
")",
";",
"$",
"processCommand",
"=",
"trim",
"(",
"$",
"this",
"->",
"findComposer",
"(",
")",
... | Updates the packages dependencies by running "composer update".
@throws PackageInstallationException
@param array $options
@return bool | [
"Updates",
"the",
"packages",
"dependencies",
"by",
"running",
"composer",
"update",
"."
] | 54128903e7775e67d63284d958b46862c8df71f9 | https://github.com/newup/core/blob/54128903e7775e67d63284d958b46862c8df71f9/src/Foundation/Composer/Composer.php#L285-L313 | train |
newup/core | src/Foundation/Composer/Composer.php | Composer.getVersion | public function getVersion()
{
$process = $this->getProcess();
$processCommand = trim($this->findComposer() . ' --version');
$process->setCommandLine($processCommand);
$this->log->info('Running Composer command', ['command' => $processCommand]);
$process->run();
if (... | php | public function getVersion()
{
$process = $this->getProcess();
$processCommand = trim($this->findComposer() . ' --version');
$process->setCommandLine($processCommand);
$this->log->info('Running Composer command', ['command' => $processCommand]);
$process->run();
if (... | [
"public",
"function",
"getVersion",
"(",
")",
"{",
"$",
"process",
"=",
"$",
"this",
"->",
"getProcess",
"(",
")",
";",
"$",
"processCommand",
"=",
"trim",
"(",
"$",
"this",
"->",
"findComposer",
"(",
")",
".",
"' --version'",
")",
";",
"$",
"process",... | Gets the Composer version.
@return string
@throws ComposerException | [
"Gets",
"the",
"Composer",
"version",
"."
] | 54128903e7775e67d63284d958b46862c8df71f9 | https://github.com/newup/core/blob/54128903e7775e67d63284d958b46862c8df71f9/src/Foundation/Composer/Composer.php#L332-L347 | train |
newup/core | src/Foundation/Composer/Composer.php | Composer.selfUpdate | public function selfUpdate()
{
$beforeVersion = $this->getVersion();
$process = $this->getProcess();
$processCommand = trim($this->findComposer() . ' self-update');
$process->setCommandLine($processCommand);
$this->log->info('Running Composer command', ['command' => $process... | php | public function selfUpdate()
{
$beforeVersion = $this->getVersion();
$process = $this->getProcess();
$processCommand = trim($this->findComposer() . ' self-update');
$process->setCommandLine($processCommand);
$this->log->info('Running Composer command', ['command' => $process... | [
"public",
"function",
"selfUpdate",
"(",
")",
"{",
"$",
"beforeVersion",
"=",
"$",
"this",
"->",
"getVersion",
"(",
")",
";",
"$",
"process",
"=",
"$",
"this",
"->",
"getProcess",
"(",
")",
";",
"$",
"processCommand",
"=",
"trim",
"(",
"$",
"this",
"... | Attempts to update Composer.
Returns true if Composer was updated, false if not.
@return bool
@throws ComposerException | [
"Attempts",
"to",
"update",
"Composer",
"."
] | 54128903e7775e67d63284d958b46862c8df71f9 | https://github.com/newup/core/blob/54128903e7775e67d63284d958b46862c8df71f9/src/Foundation/Composer/Composer.php#L357-L380 | train |
schpill/thin | src/Database/Collection.php | Collection.get | public function get($index = 0)
{
if (is_integer($index)) {
if ($index + 1 > $this->count()) {
return null;
} else {
return Arrays::first(array_slice($this->_items, $index, 1));
}
} else {
... | php | public function get($index = 0)
{
if (is_integer($index)) {
if ($index + 1 > $this->count()) {
return null;
} else {
return Arrays::first(array_slice($this->_items, $index, 1));
}
} else {
... | [
"public",
"function",
"get",
"(",
"$",
"index",
"=",
"0",
")",
"{",
"if",
"(",
"is_integer",
"(",
"$",
"index",
")",
")",
"{",
"if",
"(",
"$",
"index",
"+",
"1",
">",
"$",
"this",
"->",
"count",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",... | Get item by numeric index
@param int $index model to get
@return Model | [
"Get",
"item",
"by",
"numeric",
"index"
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Database/Collection.php#L86-L101 | train |
schpill/thin | src/Database/Collection.php | Collection.keyBy | public function keyBy($keyBy)
{
$results = array();
foreach ($this->_items as $item) {
$key = dataGet($item, $keyBy);
$results[$key] = $item;
}
return new self($results);
} | php | public function keyBy($keyBy)
{
$results = array();
foreach ($this->_items as $item) {
$key = dataGet($item, $keyBy);
$results[$key] = $item;
}
return new self($results);
} | [
"public",
"function",
"keyBy",
"(",
"$",
"keyBy",
")",
"{",
"$",
"results",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"_items",
"as",
"$",
"item",
")",
"{",
"$",
"key",
"=",
"dataGet",
"(",
"$",
"item",
",",
"$",
"keyBy",
... | Key an associative array by a field.
@param string $keyBy
@return Collection | [
"Key",
"an",
"associative",
"array",
"by",
"a",
"field",
"."
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Database/Collection.php#L572-L582 | train |
schpill/thin | src/Database/Collection.php | Collection.extend | public function extend($name, Closure $callback)
{
if (count($this->_items)) {
$collection = array();
foreach ($this->_items as $item) {
if ($item instanceof Container) {
$item->fn($name, $callback);
}
... | php | public function extend($name, Closure $callback)
{
if (count($this->_items)) {
$collection = array();
foreach ($this->_items as $item) {
if ($item instanceof Container) {
$item->fn($name, $callback);
}
... | [
"public",
"function",
"extend",
"(",
"$",
"name",
",",
"Closure",
"$",
"callback",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"_items",
")",
")",
"{",
"$",
"collection",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"... | extends each Container item of this collection with a Closure.
@param string $name
@param Closure $callback callback
@return Collection | [
"extends",
"each",
"Container",
"item",
"of",
"this",
"collection",
"with",
"a",
"Closure",
"."
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Database/Collection.php#L727-L743 | train |
schpill/thin | src/Database/Collection.php | Collection.toJson | public function toJson($render = false)
{
$json = json_encode($this->toArray(true, true));
if (false === $render) {
return $json;
} else {
header('content-type: application/json; charset=utf-8');
die($json);
}
... | php | public function toJson($render = false)
{
$json = json_encode($this->toArray(true, true));
if (false === $render) {
return $json;
} else {
header('content-type: application/json; charset=utf-8');
die($json);
}
... | [
"public",
"function",
"toJson",
"(",
"$",
"render",
"=",
"false",
")",
"{",
"$",
"json",
"=",
"json_encode",
"(",
"$",
"this",
"->",
"toArray",
"(",
"true",
",",
"true",
")",
")",
";",
"if",
"(",
"false",
"===",
"$",
"render",
")",
"{",
"return",
... | Export all items to a json string
@param boolean $is_numeric_index is numeric index
@param boolean $itemToArray item to array
@return string | [
"Export",
"all",
"items",
"to",
"a",
"json",
"string"
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Database/Collection.php#L807-L817 | train |
phramework/phramework | src/Models/Response.php | Response.cacheHeaders | public static function cacheHeaders($expires = '+1 hour')
{
if (!headers_sent()) {
header('Cache-Control: private, max-age=3600');
header('Pragma: public');
header('Last-Modified: ' . date(DATE_RFC822, strtotime('-1 second')));
header('Expires: ' . date(DATE_R... | php | public static function cacheHeaders($expires = '+1 hour')
{
if (!headers_sent()) {
header('Cache-Control: private, max-age=3600');
header('Pragma: public');
header('Last-Modified: ' . date(DATE_RFC822, strtotime('-1 second')));
header('Expires: ' . date(DATE_R... | [
"public",
"static",
"function",
"cacheHeaders",
"(",
"$",
"expires",
"=",
"'+1 hour'",
")",
"{",
"if",
"(",
"!",
"headers_sent",
"(",
")",
")",
"{",
"header",
"(",
"'Cache-Control: private, max-age=3600'",
")",
";",
"header",
"(",
"'Pragma: public'",
")",
";",... | Write cache headers | [
"Write",
"cache",
"headers"
] | 40041d1ef23b1f8cdbd26fb112448d6a3dbef012 | https://github.com/phramework/phramework/blob/40041d1ef23b1f8cdbd26fb112448d6a3dbef012/src/Models/Response.php#L96-L104 | train |
plinker-rpc/system | src/System.php | System.enumerate | public function enumerate($methods = [], $params = [])
{
if (is_array($methods)) {
$return = [];
foreach ($methods as $key => $value) {
if (is_array($value)) {
$return[$key] = $this->$key(...$value);
} else {
$re... | php | public function enumerate($methods = [], $params = [])
{
if (is_array($methods)) {
$return = [];
foreach ($methods as $key => $value) {
if (is_array($value)) {
$return[$key] = $this->$key(...$value);
} else {
$re... | [
"public",
"function",
"enumerate",
"(",
"$",
"methods",
"=",
"[",
"]",
",",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"methods",
")",
")",
"{",
"$",
"return",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"methods",
"a... | Enumerate multiple methods, saves on HTTP calls
@param array $methods | [
"Enumerate",
"multiple",
"methods",
"saves",
"on",
"HTTP",
"calls"
] | b0b83aad136a91c094eaac8c463df7c916d1c76e | https://github.com/plinker-rpc/system/blob/b0b83aad136a91c094eaac8c463df7c916d1c76e/src/System.php#L47-L62 | train |
plinker-rpc/system | src/System.php | System.system_updates | public function system_updates()
{
if (file_exists($this->tmp_path.'/check-updates')) {
unlink($this->tmp_path.'/check-updates');
}
if ($this->host_os === 'WINDOWS') {
$updSess = new \COM("Microsoft.Update.Session");
$updSrc = $updSess->CreateUpdateSearch... | php | public function system_updates()
{
if (file_exists($this->tmp_path.'/check-updates')) {
unlink($this->tmp_path.'/check-updates');
}
if ($this->host_os === 'WINDOWS') {
$updSess = new \COM("Microsoft.Update.Session");
$updSrc = $updSess->CreateUpdateSearch... | [
"public",
"function",
"system_updates",
"(",
")",
"{",
"if",
"(",
"file_exists",
"(",
"$",
"this",
"->",
"tmp_path",
".",
"'/check-updates'",
")",
")",
"{",
"unlink",
"(",
"$",
"this",
"->",
"tmp_path",
".",
"'/check-updates'",
")",
";",
"}",
"if",
"(",
... | Check system for updates
@return int 1=has updates, 0=no updates, -1=unknown | [
"Check",
"system",
"for",
"updates"
] | b0b83aad136a91c094eaac8c463df7c916d1c76e | https://github.com/plinker-rpc/system/blob/b0b83aad136a91c094eaac8c463df7c916d1c76e/src/System.php#L69-L97 | train |
plinker-rpc/system | src/System.php | System.total_disk_space | public function total_disk_space($path = '/')
{
$ds = 0;
if ($this->host_os === 'WINDOWS') {
$wmi = new \COM("winmgmts:\\\\.\\root\\cimv2");
$disks = $wmi->ExecQuery("Select * from Win32_LogicalDisk");
foreach ($disks as $d) {
if ($d->Name == $pa... | php | public function total_disk_space($path = '/')
{
$ds = 0;
if ($this->host_os === 'WINDOWS') {
$wmi = new \COM("winmgmts:\\\\.\\root\\cimv2");
$disks = $wmi->ExecQuery("Select * from Win32_LogicalDisk");
foreach ($disks as $d) {
if ($d->Name == $pa... | [
"public",
"function",
"total_disk_space",
"(",
"$",
"path",
"=",
"'/'",
")",
"{",
"$",
"ds",
"=",
"0",
";",
"if",
"(",
"$",
"this",
"->",
"host_os",
"===",
"'WINDOWS'",
")",
"{",
"$",
"wmi",
"=",
"new",
"\\",
"COM",
"(",
"\"winmgmts:\\\\\\\\.\\\\root\\... | Get total diskspace
@param string $path
@return int | [
"Get",
"total",
"diskspace"
] | b0b83aad136a91c094eaac8c463df7c916d1c76e | https://github.com/plinker-rpc/system/blob/b0b83aad136a91c094eaac8c463df7c916d1c76e/src/System.php#L130-L146 | train |
plinker-rpc/system | src/System.php | System.memory_stats | public function memory_stats()
{
if ($this->host_os === 'WINDOWS') {
$wmi = new \COM("winmgmts:\\\\.\\root\\cimv2");
$os = $wmi->ExecQuery("SELECT * FROM Win32_OperatingSystem");
foreach ($os as $m) {
$mem_total = $m->TotalVisibleMemorySize;
... | php | public function memory_stats()
{
if ($this->host_os === 'WINDOWS') {
$wmi = new \COM("winmgmts:\\\\.\\root\\cimv2");
$os = $wmi->ExecQuery("SELECT * FROM Win32_OperatingSystem");
foreach ($os as $m) {
$mem_total = $m->TotalVisibleMemorySize;
... | [
"public",
"function",
"memory_stats",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"host_os",
"===",
"'WINDOWS'",
")",
"{",
"$",
"wmi",
"=",
"new",
"\\",
"COM",
"(",
"\"winmgmts:\\\\\\\\.\\\\root\\\\cimv2\"",
")",
";",
"$",
"os",
"=",
"$",
"wmi",
"->",
... | Get memory usage
@return array | [
"Get",
"memory",
"usage"
] | b0b83aad136a91c094eaac8c463df7c916d1c76e | https://github.com/plinker-rpc/system/blob/b0b83aad136a91c094eaac8c463df7c916d1c76e/src/System.php#L153-L198 | train |
plinker-rpc/system | src/System.php | System.memory_total | public function memory_total()
{
$mem_total = 0;
if ($this->host_os === 'WINDOWS') {
$wmi = new \COM("winmgmts:\\\\.\\root\\cimv2");
$os = $wmi->ExecQuery("SELECT * FROM Win32_OperatingSystem");
foreach ($os as $m) {
$mem_total = $m->TotalVisible... | php | public function memory_total()
{
$mem_total = 0;
if ($this->host_os === 'WINDOWS') {
$wmi = new \COM("winmgmts:\\\\.\\root\\cimv2");
$os = $wmi->ExecQuery("SELECT * FROM Win32_OperatingSystem");
foreach ($os as $m) {
$mem_total = $m->TotalVisible... | [
"public",
"function",
"memory_total",
"(",
")",
"{",
"$",
"mem_total",
"=",
"0",
";",
"if",
"(",
"$",
"this",
"->",
"host_os",
"===",
"'WINDOWS'",
")",
"{",
"$",
"wmi",
"=",
"new",
"\\",
"COM",
"(",
"\"winmgmts:\\\\\\\\.\\\\root\\\\cimv2\"",
")",
";",
"$... | Get memory total kB
@return int | [
"Get",
"memory",
"total",
"kB"
] | b0b83aad136a91c094eaac8c463df7c916d1c76e | https://github.com/plinker-rpc/system/blob/b0b83aad136a91c094eaac8c463df7c916d1c76e/src/System.php#L205-L228 | train |
plinker-rpc/system | src/System.php | System.cpu_usage | public function cpu_usage()
{
if ($this->host_os === 'WINDOWS') {
$wmi = new \COM("winmgmts:\\\\.\\root\\cimv2");
$cpus = $wmi->ExecQuery("SELECT LoadPercentage FROM Win32_Processor");
foreach ($cpus as $cpu) {
$return = $cpu->LoadPercentage;
... | php | public function cpu_usage()
{
if ($this->host_os === 'WINDOWS') {
$wmi = new \COM("winmgmts:\\\\.\\root\\cimv2");
$cpus = $wmi->ExecQuery("SELECT LoadPercentage FROM Win32_Processor");
foreach ($cpus as $cpu) {
$return = $cpu->LoadPercentage;
... | [
"public",
"function",
"cpu_usage",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"host_os",
"===",
"'WINDOWS'",
")",
"{",
"$",
"wmi",
"=",
"new",
"\\",
"COM",
"(",
"\"winmgmts:\\\\\\\\.\\\\root\\\\cimv2\"",
")",
";",
"$",
"cpus",
"=",
"$",
"wmi",
"->",
... | Get CPU usage in percentage
@return int | [
"Get",
"CPU",
"usage",
"in",
"percentage"
] | b0b83aad136a91c094eaac8c463df7c916d1c76e | https://github.com/plinker-rpc/system/blob/b0b83aad136a91c094eaac8c463df7c916d1c76e/src/System.php#L235-L248 | train |
plinker-rpc/system | src/System.php | System.netstat | public function netstat($parse = true)
{
$result = trim(shell_exec('netstat -pant'));
if ($parse) {
$lines = explode(PHP_EOL, $result);
unset($lines[0]);
unset($lines[1]);
$columns = [
'Proto',
'Recv-Q',
... | php | public function netstat($parse = true)
{
$result = trim(shell_exec('netstat -pant'));
if ($parse) {
$lines = explode(PHP_EOL, $result);
unset($lines[0]);
unset($lines[1]);
$columns = [
'Proto',
'Recv-Q',
... | [
"public",
"function",
"netstat",
"(",
"$",
"parse",
"=",
"true",
")",
"{",
"$",
"result",
"=",
"trim",
"(",
"shell_exec",
"(",
"'netstat -pant'",
")",
")",
";",
"if",
"(",
"$",
"parse",
")",
"{",
"$",
"lines",
"=",
"explode",
"(",
"PHP_EOL",
",",
"... | Get netstat output
@return string | [
"Get",
"netstat",
"output"
] | b0b83aad136a91c094eaac8c463df7c916d1c76e | https://github.com/plinker-rpc/system/blob/b0b83aad136a91c094eaac8c463df7c916d1c76e/src/System.php#L290-L321 | train |
plinker-rpc/system | src/System.php | System.arch | public function arch()
{
if ($this->host_os === 'WINDOWS') {
$wmi = new \COM("winmgmts:\\\\.\\root\\cimv2");
$cpu= $wmi->ExecQuery("Select * from Win32_Processor");
foreach ($cpu as $c) {
$arch = '32-bit';
$cpu_arch = $c->AddressWidth;
... | php | public function arch()
{
if ($this->host_os === 'WINDOWS') {
$wmi = new \COM("winmgmts:\\\\.\\root\\cimv2");
$cpu= $wmi->ExecQuery("Select * from Win32_Processor");
foreach ($cpu as $c) {
$arch = '32-bit';
$cpu_arch = $c->AddressWidth;
... | [
"public",
"function",
"arch",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"host_os",
"===",
"'WINDOWS'",
")",
"{",
"$",
"wmi",
"=",
"new",
"\\",
"COM",
"(",
"\"winmgmts:\\\\\\\\.\\\\root\\\\cimv2\"",
")",
";",
"$",
"cpu",
"=",
"$",
"wmi",
"->",
"ExecQ... | Get system architecture
@return string | [
"Get",
"system",
"architecture"
] | b0b83aad136a91c094eaac8c463df7c916d1c76e | https://github.com/plinker-rpc/system/blob/b0b83aad136a91c094eaac8c463df7c916d1c76e/src/System.php#L328-L352 | train |
plinker-rpc/system | src/System.php | System.hostname | public function hostname()
{
if ($this->host_os === 'WINDOWS') {
$wmi = new \COM("winmgmts:\\\\.\\root\\cimv2");
$computer = $wmi->ExecQuery("SELECT * FROM Win32_ComputerSystem");
foreach ($computer as $c) {
$hostname = $c->Name;
}
} e... | php | public function hostname()
{
if ($this->host_os === 'WINDOWS') {
$wmi = new \COM("winmgmts:\\\\.\\root\\cimv2");
$computer = $wmi->ExecQuery("SELECT * FROM Win32_ComputerSystem");
foreach ($computer as $c) {
$hostname = $c->Name;
}
} e... | [
"public",
"function",
"hostname",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"host_os",
"===",
"'WINDOWS'",
")",
"{",
"$",
"wmi",
"=",
"new",
"\\",
"COM",
"(",
"\"winmgmts:\\\\\\\\.\\\\root\\\\cimv2\"",
")",
";",
"$",
"computer",
"=",
"$",
"wmi",
"->",... | Get system hostname
@return string | [
"Get",
"system",
"hostname"
] | b0b83aad136a91c094eaac8c463df7c916d1c76e | https://github.com/plinker-rpc/system/blob/b0b83aad136a91c094eaac8c463df7c916d1c76e/src/System.php#L359-L372 | train |
plinker-rpc/system | src/System.php | System.logins | public function logins($parse = true)
{
$result = trim(shell_exec('last'));
if ($parse) {
$lines = explode(PHP_EOL, $result);
// detect end by empty line space
$end = 0;
foreach ($lines as $no => $line) {
if (trim($line) == '') {
... | php | public function logins($parse = true)
{
$result = trim(shell_exec('last'));
if ($parse) {
$lines = explode(PHP_EOL, $result);
// detect end by empty line space
$end = 0;
foreach ($lines as $no => $line) {
if (trim($line) == '') {
... | [
"public",
"function",
"logins",
"(",
"$",
"parse",
"=",
"true",
")",
"{",
"$",
"result",
"=",
"trim",
"(",
"shell_exec",
"(",
"'last'",
")",
")",
";",
"if",
"(",
"$",
"parse",
")",
"{",
"$",
"lines",
"=",
"explode",
"(",
"PHP_EOL",
",",
"$",
"res... | Get system last logins
@return string | [
"Get",
"system",
"last",
"logins"
] | b0b83aad136a91c094eaac8c463df7c916d1c76e | https://github.com/plinker-rpc/system/blob/b0b83aad136a91c094eaac8c463df7c916d1c76e/src/System.php#L379-L455 | train |
plinker-rpc/system | src/System.php | System.top | public function top($parse = true)
{
if (!file_exists($this->tmp_path.'/system')) {
mkdir($this->tmp_path.'/system', 0755, true);
}
shell_exec('top -n 1 -b > '.$this->tmp_path.'/system/top-output');
usleep(25000);
$result = trim(file_get_contents($this->tmp_path.'... | php | public function top($parse = true)
{
if (!file_exists($this->tmp_path.'/system')) {
mkdir($this->tmp_path.'/system', 0755, true);
}
shell_exec('top -n 1 -b > '.$this->tmp_path.'/system/top-output');
usleep(25000);
$result = trim(file_get_contents($this->tmp_path.'... | [
"public",
"function",
"top",
"(",
"$",
"parse",
"=",
"true",
")",
"{",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"this",
"->",
"tmp_path",
".",
"'/system'",
")",
")",
"{",
"mkdir",
"(",
"$",
"this",
"->",
"tmp_path",
".",
"'/system'",
",",
"0755",
"... | Get system top output
@param string | [
"Get",
"system",
"top",
"output"
] | b0b83aad136a91c094eaac8c463df7c916d1c76e | https://github.com/plinker-rpc/system/blob/b0b83aad136a91c094eaac8c463df7c916d1c76e/src/System.php#L472-L527 | train |
plinker-rpc/system | src/System.php | System.cpu_info | public function cpu_info($parse = true)
{
$lines = trim(shell_exec('lscpu'));
if (!$parse) {
return $lines;
}
if (empty($lines)) {
return [];
}
$lines = explode(PHP_EOL, $lines);
$return = [];
... | php | public function cpu_info($parse = true)
{
$lines = trim(shell_exec('lscpu'));
if (!$parse) {
return $lines;
}
if (empty($lines)) {
return [];
}
$lines = explode(PHP_EOL, $lines);
$return = [];
... | [
"public",
"function",
"cpu_info",
"(",
"$",
"parse",
"=",
"true",
")",
"{",
"$",
"lines",
"=",
"trim",
"(",
"shell_exec",
"(",
"'lscpu'",
")",
")",
";",
"if",
"(",
"!",
"$",
"parse",
")",
"{",
"return",
"$",
"lines",
";",
"}",
"if",
"(",
"empty",... | Get system CPU info | [
"Get",
"system",
"CPU",
"info"
] | b0b83aad136a91c094eaac8c463df7c916d1c76e | https://github.com/plinker-rpc/system/blob/b0b83aad136a91c094eaac8c463df7c916d1c76e/src/System.php#L553-L574 | train |
plinker-rpc/system | src/System.php | System.disks | public function disks($parse = true)
{
if ($this->host_os !== 'WINDOWS') {
$result = shell_exec('df -h --output=source,fstype,size,used,avail,pcent,target -x tmpfs -x devtmpfs');
} else {
$result = '';
}
if ($parse) {
if (empty($result)) {
... | php | public function disks($parse = true)
{
if ($this->host_os !== 'WINDOWS') {
$result = shell_exec('df -h --output=source,fstype,size,used,avail,pcent,target -x tmpfs -x devtmpfs');
} else {
$result = '';
}
if ($parse) {
if (empty($result)) {
... | [
"public",
"function",
"disks",
"(",
"$",
"parse",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"host_os",
"!==",
"'WINDOWS'",
")",
"{",
"$",
"result",
"=",
"shell_exec",
"(",
"'df -h --output=source,fstype,size,used,avail,pcent,target -x tmpfs -x devtmpfs'",... | Get disk file system table
@return string | [
"Get",
"disk",
"file",
"system",
"table"
] | b0b83aad136a91c094eaac8c463df7c916d1c76e | https://github.com/plinker-rpc/system/blob/b0b83aad136a91c094eaac8c463df7c916d1c76e/src/System.php#L623-L659 | train |
plinker-rpc/system | src/System.php | System.uptime | public function uptime($option = '-p')
{
if ($this->host_os === 'WINDOWS') {
$wmi = new \COM("winmgmts:\\\\.\\root\\cimv2");
$os = $wmi->ExecQuery("SELECT * FROM Win32_OperatingSystem");
foreach ($os as $o) {
$date = explode('.', $o->LastBootUpTime);
... | php | public function uptime($option = '-p')
{
if ($this->host_os === 'WINDOWS') {
$wmi = new \COM("winmgmts:\\\\.\\root\\cimv2");
$os = $wmi->ExecQuery("SELECT * FROM Win32_OperatingSystem");
foreach ($os as $o) {
$date = explode('.', $o->LastBootUpTime);
... | [
"public",
"function",
"uptime",
"(",
"$",
"option",
"=",
"'-p'",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"host_os",
"===",
"'WINDOWS'",
")",
"{",
"$",
"wmi",
"=",
"new",
"\\",
"COM",
"(",
"\"winmgmts:\\\\\\\\.\\\\root\\\\cimv2\"",
")",
";",
"$",
"os",
... | Get system uptime | [
"Get",
"system",
"uptime"
] | b0b83aad136a91c094eaac8c463df7c916d1c76e | https://github.com/plinker-rpc/system/blob/b0b83aad136a91c094eaac8c463df7c916d1c76e/src/System.php#L664-L682 | train |
plinker-rpc/system | src/System.php | System.ping | public function ping($host = '', $port = 80)
{
$start = microtime(true);
$file = @fsockopen($host, $port, $errno, $errstr, 5);
$stop = microtime(true);
$status = 0;
if (!$file) {
$status = -1;
} else {
fclose($file);
$status =... | php | public function ping($host = '', $port = 80)
{
$start = microtime(true);
$file = @fsockopen($host, $port, $errno, $errstr, 5);
$stop = microtime(true);
$status = 0;
if (!$file) {
$status = -1;
} else {
fclose($file);
$status =... | [
"public",
"function",
"ping",
"(",
"$",
"host",
"=",
"''",
",",
"$",
"port",
"=",
"80",
")",
"{",
"$",
"start",
"=",
"microtime",
"(",
"true",
")",
";",
"$",
"file",
"=",
"@",
"fsockopen",
"(",
"$",
"host",
",",
"$",
"port",
",",
"$",
"errno",
... | Ping a server and return timing
@return float | [
"Ping",
"a",
"server",
"and",
"return",
"timing"
] | b0b83aad136a91c094eaac8c463df7c916d1c76e | https://github.com/plinker-rpc/system/blob/b0b83aad136a91c094eaac8c463df7c916d1c76e/src/System.php#L689-L703 | train |
plinker-rpc/system | src/System.php | System.distro | public function distro()
{
if (file_exists('/etc/redhat-release')) {
$centos_array = explode(' ', file_get_contents('/etc/redhat-release'));
return strtoupper($centos_array[0]);
}
if (file_exists('/etc/os-release')) {
preg_match('/ID=([a-zA-Z]+)/', file_g... | php | public function distro()
{
if (file_exists('/etc/redhat-release')) {
$centos_array = explode(' ', file_get_contents('/etc/redhat-release'));
return strtoupper($centos_array[0]);
}
if (file_exists('/etc/os-release')) {
preg_match('/ID=([a-zA-Z]+)/', file_g... | [
"public",
"function",
"distro",
"(",
")",
"{",
"if",
"(",
"file_exists",
"(",
"'/etc/redhat-release'",
")",
")",
"{",
"$",
"centos_array",
"=",
"explode",
"(",
"' '",
",",
"file_get_contents",
"(",
"'/etc/redhat-release'",
")",
")",
";",
"return",
"strtoupper"... | Get system distro
@return string | [
"Get",
"system",
"distro"
] | b0b83aad136a91c094eaac8c463df7c916d1c76e | https://github.com/plinker-rpc/system/blob/b0b83aad136a91c094eaac8c463df7c916d1c76e/src/System.php#L710-L722 | train |
plinker-rpc/system | src/System.php | System.reboot | public function reboot()
{
if (!file_exists($this->tmp_path.'/reboot.sh')) {
file_put_contents($this->tmp_path.'/reboot.sh', '#!/bin/bash'.PHP_EOL.'/sbin/shutdown -r now');
chmod($this->tmp_path.'/reboot.sh', 0750);
}
shell_exec($this->tmp_path.'/reboot.sh');
... | php | public function reboot()
{
if (!file_exists($this->tmp_path.'/reboot.sh')) {
file_put_contents($this->tmp_path.'/reboot.sh', '#!/bin/bash'.PHP_EOL.'/sbin/shutdown -r now');
chmod($this->tmp_path.'/reboot.sh', 0750);
}
shell_exec($this->tmp_path.'/reboot.sh');
... | [
"public",
"function",
"reboot",
"(",
")",
"{",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"this",
"->",
"tmp_path",
".",
"'/reboot.sh'",
")",
")",
"{",
"file_put_contents",
"(",
"$",
"this",
"->",
"tmp_path",
".",
"'/reboot.sh'",
",",
"'#!/bin/bash'",
".",
... | Reboot the system
@requires root
@return void | [
"Reboot",
"the",
"system"
] | b0b83aad136a91c094eaac8c463df7c916d1c76e | https://github.com/plinker-rpc/system/blob/b0b83aad136a91c094eaac8c463df7c916d1c76e/src/System.php#L763-L771 | train |
QoboLtd/cakephp-translations | src/Model/Table/LanguagesTable.php | LanguagesTable.localeToLanguage | public function localeToLanguage(string $locale): string
{
if (empty($locale)) {
throw new InvalidArgumentException("Locale must be a non-emptystring.");
}
// Truncate all, starting with underscore, at, or dot
$result = (string)preg_replace('/(_|@|\.).*$/', '', strtolowe... | php | public function localeToLanguage(string $locale): string
{
if (empty($locale)) {
throw new InvalidArgumentException("Locale must be a non-emptystring.");
}
// Truncate all, starting with underscore, at, or dot
$result = (string)preg_replace('/(_|@|\.).*$/', '', strtolowe... | [
"public",
"function",
"localeToLanguage",
"(",
"string",
"$",
"locale",
")",
":",
"string",
"{",
"if",
"(",
"empty",
"(",
"$",
"locale",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"\"Locale must be a non-emptystring.\"",
")",
";",
"}",
"//... | Convert locale to language
On Linux, have a look at /usr/share/locale for the
list of possible locales and locale formats.
@throws \InvalidArgumentException when locale is not a string
@param string $locale Locale string (example: ru_RU.KOI8-R)
@return string Language (example: ru) | [
"Convert",
"locale",
"to",
"language"
] | b488eafce71a55d517b975342487812f0d2d375a | https://github.com/QoboLtd/cakephp-translations/blob/b488eafce71a55d517b975342487812f0d2d375a/src/Model/Table/LanguagesTable.php#L97-L109 | train |
QoboLtd/cakephp-translations | src/Model/Table/LanguagesTable.php | LanguagesTable.isRtl | public function isRtl(string $language): bool
{
$result = false;
// Simplify and verify, just in case
$language = $this->localeToLanguage($language);
if (in_array($language, $this->getRtl())) {
$result = true;
}
return $result;
} | php | public function isRtl(string $language): bool
{
$result = false;
// Simplify and verify, just in case
$language = $this->localeToLanguage($language);
if (in_array($language, $this->getRtl())) {
$result = true;
}
return $result;
} | [
"public",
"function",
"isRtl",
"(",
"string",
"$",
"language",
")",
":",
"bool",
"{",
"$",
"result",
"=",
"false",
";",
"// Simplify and verify, just in case",
"$",
"language",
"=",
"$",
"this",
"->",
"localeToLanguage",
"(",
"$",
"language",
")",
";",
"if",... | Check if given language is right-to-left
@param string $language Language code or locale string (example: ru_RU.KOI8-R)
@return bool | [
"Check",
"if",
"given",
"language",
"is",
"right",
"-",
"to",
"-",
"left"
] | b488eafce71a55d517b975342487812f0d2d375a | https://github.com/QoboLtd/cakephp-translations/blob/b488eafce71a55d517b975342487812f0d2d375a/src/Model/Table/LanguagesTable.php#L129-L140 | train |
QoboLtd/cakephp-translations | src/Model/Table/LanguagesTable.php | LanguagesTable.getAvailable | public function getAvailable(): array
{
$result = [];
$dbLanguages = $this->find('list', ['keyField' => 'code', 'valueField' => 'name'])
->where(['trashed IS' => null])
->toArray();
$supportedLanguages = $this->getSupported();
... | php | public function getAvailable(): array
{
$result = [];
$dbLanguages = $this->find('list', ['keyField' => 'code', 'valueField' => 'name'])
->where(['trashed IS' => null])
->toArray();
$supportedLanguages = $this->getSupported();
... | [
"public",
"function",
"getAvailable",
"(",
")",
":",
"array",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"$",
"dbLanguages",
"=",
"$",
"this",
"->",
"find",
"(",
"'list'",
",",
"[",
"'keyField'",
"=>",
"'code'",
",",
"'valueField'",
"=>",
"'name'",
"]",
... | Get a list of all available languages
Available languages are those that are in
configuration, but haven't yet been used for
an active language.
@return mixed[] | [
"Get",
"a",
"list",
"of",
"all",
"available",
"languages"
] | b488eafce71a55d517b975342487812f0d2d375a | https://github.com/QoboLtd/cakephp-translations/blob/b488eafce71a55d517b975342487812f0d2d375a/src/Model/Table/LanguagesTable.php#L163-L174 | train |
QoboLtd/cakephp-translations | src/Model/Table/LanguagesTable.php | LanguagesTable.getName | public function getName(string $code): string
{
$result = $code;
if (empty($code)) {
throw new InvalidArgumentException("Code must be a non-empty string.");
}
$languages = $this->getSupported();
if (!empty($languages[$code])) {
$result = $languages[$... | php | public function getName(string $code): string
{
$result = $code;
if (empty($code)) {
throw new InvalidArgumentException("Code must be a non-empty string.");
}
$languages = $this->getSupported();
if (!empty($languages[$code])) {
$result = $languages[$... | [
"public",
"function",
"getName",
"(",
"string",
"$",
"code",
")",
":",
"string",
"{",
"$",
"result",
"=",
"$",
"code",
";",
"if",
"(",
"empty",
"(",
"$",
"code",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"\"Code must be a non-empty st... | Get language name by code
@throws \InvalidArgumentException when code is not a string
@param string $code Language code to lookup
@return string | [
"Get",
"language",
"name",
"by",
"code"
] | b488eafce71a55d517b975342487812f0d2d375a | https://github.com/QoboLtd/cakephp-translations/blob/b488eafce71a55d517b975342487812f0d2d375a/src/Model/Table/LanguagesTable.php#L183-L197 | train |
QoboLtd/cakephp-translations | src/Model/Table/LanguagesTable.php | LanguagesTable.addOrRestore | public function addOrRestore(array $data): \Translations\Model\Entity\Language
{
if (empty($data['code'])) {
throw new InvalidArgumentException("Language data is missing 'code' key");
}
if (empty($data['is_rtl'])) {
$data['is_rtl'] = $this->isRtl($data['code']);
... | php | public function addOrRestore(array $data): \Translations\Model\Entity\Language
{
if (empty($data['code'])) {
throw new InvalidArgumentException("Language data is missing 'code' key");
}
if (empty($data['is_rtl'])) {
$data['is_rtl'] = $this->isRtl($data['code']);
... | [
"public",
"function",
"addOrRestore",
"(",
"array",
"$",
"data",
")",
":",
"\\",
"Translations",
"\\",
"Model",
"\\",
"Entity",
"\\",
"Language",
"{",
"if",
"(",
"empty",
"(",
"$",
"data",
"[",
"'code'",
"]",
")",
")",
"{",
"throw",
"new",
"InvalidArgu... | Add a new language or restore a deleted one
@throws \InvalidArgumentException when data is wrong or incomplete
@param mixed[] $data Language data to populate Entity with
@return \Translations\Model\Entity\Language | [
"Add",
"a",
"new",
"language",
"or",
"restore",
"a",
"deleted",
"one"
] | b488eafce71a55d517b975342487812f0d2d375a | https://github.com/QoboLtd/cakephp-translations/blob/b488eafce71a55d517b975342487812f0d2d375a/src/Model/Table/LanguagesTable.php#L206-L239 | train |
chilimatic/chilimatic-framework | lib/cgenerator/Mysql.php | Mysql.scan_table | public function scan_table($table_name = '')
{
if (empty($table_name)) return false;
$this->_l_table_name = strtolower($table_name);
$this->table_name = $table_name;
$this->tpl_replacements['table_name'] = $table_name;
// get a more deta... | php | public function scan_table($table_name = '')
{
if (empty($table_name)) return false;
$this->_l_table_name = strtolower($table_name);
$this->table_name = $table_name;
$this->tpl_replacements['table_name'] = $table_name;
// get a more deta... | [
"public",
"function",
"scan_table",
"(",
"$",
"table_name",
"=",
"''",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"table_name",
")",
")",
"return",
"false",
";",
"$",
"this",
"->",
"_l_table_name",
"=",
"strtolower",
"(",
"$",
"table_name",
")",
";",
"$",... | fetches a numeric table list
@param $table_name string
@return boolean | [
"fetches",
"a",
"numeric",
"table",
"list"
] | 8df7f12e75d75d3fd2197a58c80d39cbb4b9ff12 | https://github.com/chilimatic/chilimatic-framework/blob/8df7f12e75d75d3fd2197a58c80d39cbb4b9ff12/lib/cgenerator/Mysql.php#L92-L107 | train |
chilimatic/chilimatic-framework | lib/cgenerator/Mysql.php | Mysql.get_type_value | public function get_type_value($type = null, $type_cast = false)
{
if (empty($type)) return "null";
if (strpos(strtolower($type), 'int') !== false) {
return ($type_cast) ? '(int)' : 0;
}
if (strpos(strtolower($type), 'float') !== false) {
return ($type_cast... | php | public function get_type_value($type = null, $type_cast = false)
{
if (empty($type)) return "null";
if (strpos(strtolower($type), 'int') !== false) {
return ($type_cast) ? '(int)' : 0;
}
if (strpos(strtolower($type), 'float') !== false) {
return ($type_cast... | [
"public",
"function",
"get_type_value",
"(",
"$",
"type",
"=",
"null",
",",
"$",
"type_cast",
"=",
"false",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"type",
")",
")",
"return",
"\"null\"",
";",
"if",
"(",
"strpos",
"(",
"strtolower",
"(",
"$",
"type",... | get type value parses the mysql type and returns
@param $type string
@param bool|string $type_cast string
@return string | [
"get",
"type",
"value",
"parses",
"the",
"mysql",
"type",
"and",
"returns"
] | 8df7f12e75d75d3fd2197a58c80d39cbb4b9ff12 | https://github.com/chilimatic/chilimatic-framework/blob/8df7f12e75d75d3fd2197a58c80d39cbb4b9ff12/lib/cgenerator/Mysql.php#L118-L176 | train |
chilimatic/chilimatic-framework | lib/cgenerator/Mysql.php | Mysql.generate_primary_key_statement | public function generate_primary_key_statement()
{
if (empty($this->primary_key)) return false;
if (count($this->primary_key) == 1) {
$this->tpl_replacements['primary_key_assign_statement'] = "'{$this->primary_key[0]}'";
$this->tpl_replacements['primary_key_if_statement'] ... | php | public function generate_primary_key_statement()
{
if (empty($this->primary_key)) return false;
if (count($this->primary_key) == 1) {
$this->tpl_replacements['primary_key_assign_statement'] = "'{$this->primary_key[0]}'";
$this->tpl_replacements['primary_key_if_statement'] ... | [
"public",
"function",
"generate_primary_key_statement",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"primary_key",
")",
")",
"return",
"false",
";",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"primary_key",
")",
"==",
"1",
")",
"{",
"$"... | generates the primary key statement
@return bool | [
"generates",
"the",
"primary",
"key",
"statement"
] | 8df7f12e75d75d3fd2197a58c80d39cbb4b9ff12 | https://github.com/chilimatic/chilimatic-framework/blob/8df7f12e75d75d3fd2197a58c80d39cbb4b9ff12/lib/cgenerator/Mysql.php#L183-L210 | train |
RadialCorp/magento-core | src/app/code/community/Radial/Amqp/Helper/Config.php | Radial_Amqp_Helper_Config.getQueueConfigurationScopes | public function getQueueConfigurationScopes()
{
// cache of seen, unique AMQP configurations
$configurations = array();
// list of stores to produce unique AMQP configuration
$uniqueStores = array();
foreach (Mage::app()->getStores(true) as $store) {
$amqpConfig =... | php | public function getQueueConfigurationScopes()
{
// cache of seen, unique AMQP configurations
$configurations = array();
// list of stores to produce unique AMQP configuration
$uniqueStores = array();
foreach (Mage::app()->getStores(true) as $store) {
$amqpConfig =... | [
"public",
"function",
"getQueueConfigurationScopes",
"(",
")",
"{",
"// cache of seen, unique AMQP configurations",
"$",
"configurations",
"=",
"array",
"(",
")",
";",
"// list of stores to produce unique AMQP configuration",
"$",
"uniqueStores",
"=",
"array",
"(",
")",
";"... | Get an array of stores with unique AMQP configuration.
@return Mage_Core_Model_Store[] | [
"Get",
"an",
"array",
"of",
"stores",
"with",
"unique",
"AMQP",
"configuration",
"."
] | 9bb5f218d9caf79eab8598f4f8447037a0cc6355 | https://github.com/RadialCorp/magento-core/blob/9bb5f218d9caf79eab8598f4f8447037a0cc6355/src/app/code/community/Radial/Amqp/Helper/Config.php#L58-L72 | train |
RadialCorp/magento-core | src/app/code/community/Radial/Amqp/Helper/Config.php | Radial_Amqp_Helper_Config.updateLastTimestamp | public function updateLastTimestamp(ITestMessage $payload, Mage_Core_Model_Store $store)
{
list($scope, $scopeId) = $this->getScopeForStoreSettings($store);
return Mage::getModel('core/config_data')
->addData(array(
'path' => $this->_amqpConfigMap->getPathForKey('last_tes... | php | public function updateLastTimestamp(ITestMessage $payload, Mage_Core_Model_Store $store)
{
list($scope, $scopeId) = $this->getScopeForStoreSettings($store);
return Mage::getModel('core/config_data')
->addData(array(
'path' => $this->_amqpConfigMap->getPathForKey('last_tes... | [
"public",
"function",
"updateLastTimestamp",
"(",
"ITestMessage",
"$",
"payload",
",",
"Mage_Core_Model_Store",
"$",
"store",
")",
"{",
"list",
"(",
"$",
"scope",
",",
"$",
"scopeId",
")",
"=",
"$",
"this",
"->",
"getScopeForStoreSettings",
"(",
"$",
"store",
... | Update the core_config_data setting for timestamp from the last test
message received. Value should be saved in the most appropriate scope for
the store being processed. E.g. if the store is the default store, or has
the same AMQP configuration as the default store, the timestamp should be
updated in the default scope.... | [
"Update",
"the",
"core_config_data",
"setting",
"for",
"timestamp",
"from",
"the",
"last",
"test",
"message",
"received",
".",
"Value",
"should",
"be",
"saved",
"in",
"the",
"most",
"appropriate",
"scope",
"for",
"the",
"store",
"being",
"processed",
".",
"E",... | 9bb5f218d9caf79eab8598f4f8447037a0cc6355 | https://github.com/RadialCorp/magento-core/blob/9bb5f218d9caf79eab8598f4f8447037a0cc6355/src/app/code/community/Radial/Amqp/Helper/Config.php#L123-L134 | train |
romaricdrigon/OrchestraBundle | Controller/GenericController.php | GenericController.listAction | public function listAction(RepositoryDefinitionInterface $repository_definition, RepositoryInterface $repository, EntityReflectionInterface $entity)
{
$name = $this->get('orchestra.resolver.repository_name')->getName($repository_definition);
if (false === $entity->isListable()) {
throw ... | php | public function listAction(RepositoryDefinitionInterface $repository_definition, RepositoryInterface $repository, EntityReflectionInterface $entity)
{
$name = $this->get('orchestra.resolver.repository_name')->getName($repository_definition);
if (false === $entity->isListable()) {
throw ... | [
"public",
"function",
"listAction",
"(",
"RepositoryDefinitionInterface",
"$",
"repository_definition",
",",
"RepositoryInterface",
"$",
"repository",
",",
"EntityReflectionInterface",
"$",
"entity",
")",
"{",
"$",
"name",
"=",
"$",
"this",
"->",
"get",
"(",
"'orche... | Action used when a repository "listing" is called
@param RepositoryDefinitionInterface $repository_definition
@param RepositoryInterface $repository
@param EntityReflectionInterface $entity
@throws DomainErrorException
@return \Symfony\Component\HttpFoundation\Response | [
"Action",
"used",
"when",
"a",
"repository",
"listing",
"is",
"called"
] | 4abb9736fcb6b23ed08ebd14ab169867339a4785 | https://github.com/romaricdrigon/OrchestraBundle/blob/4abb9736fcb6b23ed08ebd14ab169867339a4785/Controller/GenericController.php#L52-L82 | train |
romaricdrigon/OrchestraBundle | Controller/GenericController.php | GenericController.repositoryQueryAction | public function repositoryQueryAction(RepositoryDefinitionInterface $repository_definition, RepositoryInterface $repository, EntityReflectionInterface $entity, $repository_method)
{
return $this->render('RomaricDrigonOrchestraBundle:Generic:dashboard.html.twig', []);
} | php | public function repositoryQueryAction(RepositoryDefinitionInterface $repository_definition, RepositoryInterface $repository, EntityReflectionInterface $entity, $repository_method)
{
return $this->render('RomaricDrigonOrchestraBundle:Generic:dashboard.html.twig', []);
} | [
"public",
"function",
"repositoryQueryAction",
"(",
"RepositoryDefinitionInterface",
"$",
"repository_definition",
",",
"RepositoryInterface",
"$",
"repository",
",",
"EntityReflectionInterface",
"$",
"entity",
",",
"$",
"repository_method",
")",
"{",
"return",
"$",
"this... | Action used when a method on en Repository is called
@param RepositoryDefinitionInterface $repository_definition
@param RepositoryInterface $repository
@param EntityReflectionInterface $entity
@param string $repository_method
@return \Symfony\Component\HttpFoundation\Response | [
"Action",
"used",
"when",
"a",
"method",
"on",
"en",
"Repository",
"is",
"called"
] | 4abb9736fcb6b23ed08ebd14ab169867339a4785 | https://github.com/romaricdrigon/OrchestraBundle/blob/4abb9736fcb6b23ed08ebd14ab169867339a4785/Controller/GenericController.php#L108-L111 | train |
romaricdrigon/OrchestraBundle | Controller/GenericController.php | GenericController.repositoryCommandAction | public function repositoryCommandAction(Request $request, RepositoryDefinitionInterface $repository_definition, RepositoryInterface $repository, $repository_method, CommandInterface $command)
{
$form = $this->createForm('orchestra_command_type', $command, [
'command' => $command
]);
... | php | public function repositoryCommandAction(Request $request, RepositoryDefinitionInterface $repository_definition, RepositoryInterface $repository, $repository_method, CommandInterface $command)
{
$form = $this->createForm('orchestra_command_type', $command, [
'command' => $command
]);
... | [
"public",
"function",
"repositoryCommandAction",
"(",
"Request",
"$",
"request",
",",
"RepositoryDefinitionInterface",
"$",
"repository_definition",
",",
"RepositoryInterface",
"$",
"repository",
",",
"$",
"repository_method",
",",
"CommandInterface",
"$",
"command",
")",... | Action used when a method accepting a Command, on en Repository is called
@param Request $request
@param RepositoryDefinitionInterface $repository_definition
@param RepositoryInterface $repository
@param string $repository_method
@param CommandInterface $command
@return \Symfony\Component\HttpFoundation\Response | [
"Action",
"used",
"when",
"a",
"method",
"accepting",
"a",
"Command",
"on",
"en",
"Repository",
"is",
"called"
] | 4abb9736fcb6b23ed08ebd14ab169867339a4785 | https://github.com/romaricdrigon/OrchestraBundle/blob/4abb9736fcb6b23ed08ebd14ab169867339a4785/Controller/GenericController.php#L123-L157 | train |
romaricdrigon/OrchestraBundle | Controller/GenericController.php | GenericController.entityCommandAction | public function entityCommandAction(Request $request, CommandInterface $command, EntityReflectionInterface $entity, $entity_method, EntityInterface $object = null)
{
if (null === $object) {
throw new NotFoundHttpException();
}
$form = $this->createForm('orchestra_command_type', ... | php | public function entityCommandAction(Request $request, CommandInterface $command, EntityReflectionInterface $entity, $entity_method, EntityInterface $object = null)
{
if (null === $object) {
throw new NotFoundHttpException();
}
$form = $this->createForm('orchestra_command_type', ... | [
"public",
"function",
"entityCommandAction",
"(",
"Request",
"$",
"request",
",",
"CommandInterface",
"$",
"command",
",",
"EntityReflectionInterface",
"$",
"entity",
",",
"$",
"entity_method",
",",
"EntityInterface",
"$",
"object",
"=",
"null",
")",
"{",
"if",
... | Action used when a method accepting a Command, on en Entity is called
@param Request $request
@param CommandInterface $command
@param EntityReflectionInterface $entity
@param string $entity_method
@param EntityInterface $object
@throws NotFoundHttpException
@return \Symfony\Component\HttpFoundation\Response | [
"Action",
"used",
"when",
"a",
"method",
"accepting",
"a",
"Command",
"on",
"en",
"Entity",
"is",
"called"
] | 4abb9736fcb6b23ed08ebd14ab169867339a4785 | https://github.com/romaricdrigon/OrchestraBundle/blob/4abb9736fcb6b23ed08ebd14ab169867339a4785/Controller/GenericController.php#L170-L205 | train |
romaricdrigon/OrchestraBundle | Controller/GenericController.php | GenericController.entityEventAction | public function entityEventAction(EntityReflectionInterface $entity, $entity_method, EntityInterface $object = null, RepositoryDefinitionInterface $repository_definition, RepositoryInterface $repository)
{
if (null === $object) {
throw new NotFoundHttpException();
}
// Get the E... | php | public function entityEventAction(EntityReflectionInterface $entity, $entity_method, EntityInterface $object = null, RepositoryDefinitionInterface $repository_definition, RepositoryInterface $repository)
{
if (null === $object) {
throw new NotFoundHttpException();
}
// Get the E... | [
"public",
"function",
"entityEventAction",
"(",
"EntityReflectionInterface",
"$",
"entity",
",",
"$",
"entity_method",
",",
"EntityInterface",
"$",
"object",
"=",
"null",
",",
"RepositoryDefinitionInterface",
"$",
"repository_definition",
",",
"RepositoryInterface",
"$",
... | Action used when a method with a "EmitEvent" annotations is called
@param EntityReflectionInterface $entity
@param string $entity_method
@param EntityInterface $object
@param RepositoryDefinitionInterface $repository_definition
@param RepositoryInterface $repository
@throws DomainErrorException
@throws NotFoundHttpExc... | [
"Action",
"used",
"when",
"a",
"method",
"with",
"a",
"EmitEvent",
"annotations",
"is",
"called"
] | 4abb9736fcb6b23ed08ebd14ab169867339a4785 | https://github.com/romaricdrigon/OrchestraBundle/blob/4abb9736fcb6b23ed08ebd14ab169867339a4785/Controller/GenericController.php#L219-L250 | train |
antaresproject/sample_module | src/Http/Form/Configuration.php | Configuration.controlsFieldset | protected function controlsFieldset()
{
return $this->grid->fieldset(function (Fieldset $fieldset) {
$fieldset->legend('Sample Module Configuration');
$fieldset->control('input:text', 'name')
->label(trans('antares/sample_module::messages.... | php | protected function controlsFieldset()
{
return $this->grid->fieldset(function (Fieldset $fieldset) {
$fieldset->legend('Sample Module Configuration');
$fieldset->control('input:text', 'name')
->label(trans('antares/sample_module::messages.... | [
"protected",
"function",
"controlsFieldset",
"(",
")",
"{",
"return",
"$",
"this",
"->",
"grid",
"->",
"fieldset",
"(",
"function",
"(",
"Fieldset",
"$",
"fieldset",
")",
"{",
"$",
"fieldset",
"->",
"legend",
"(",
"'Sample Module Configuration'",
")",
";",
"... | creates main controls fieldset
@return \Antares\Html\Form\Fieldset | [
"creates",
"main",
"controls",
"fieldset"
] | aceab14f392c25e32729018518e9d6b4e6fe23db | https://github.com/antaresproject/sample_module/blob/aceab14f392c25e32729018518e9d6b4e6fe23db/src/Http/Form/Configuration.php#L58-L113 | train |
luoxiaojun1992/lb_framework | components/helpers/FileHelper.php | FileHelper.send | public static function send($filePath, $remoteFileSystem)
{
return (new Client())->put($remoteFileSystem, ['body' => fopen($filePath, self::READ_BINARY)])
->getStatusCode() == HttpHelper::STATUS_OK;
} | php | public static function send($filePath, $remoteFileSystem)
{
return (new Client())->put($remoteFileSystem, ['body' => fopen($filePath, self::READ_BINARY)])
->getStatusCode() == HttpHelper::STATUS_OK;
} | [
"public",
"static",
"function",
"send",
"(",
"$",
"filePath",
",",
"$",
"remoteFileSystem",
")",
"{",
"return",
"(",
"new",
"Client",
"(",
")",
")",
"->",
"put",
"(",
"$",
"remoteFileSystem",
",",
"[",
"'body'",
"=>",
"fopen",
"(",
"$",
"filePath",
","... | Send a file
@param $filePath
@param $remoteFileSystem
@return bool | [
"Send",
"a",
"file"
] | 12a865729e7738d7d1e07371ad7203243c4571fa | https://github.com/luoxiaojun1992/lb_framework/blob/12a865729e7738d7d1e07371ad7203243c4571fa/components/helpers/FileHelper.php#L183-L187 | train |
luoxiaojun1992/lb_framework | components/helpers/FileHelper.php | FileHelper.receive | public static function receive($savePath, RequestContract $request = null)
{
file_put_contents($savePath, $request ? $request->getRawContent() : RequestKit::getRawContent());
} | php | public static function receive($savePath, RequestContract $request = null)
{
file_put_contents($savePath, $request ? $request->getRawContent() : RequestKit::getRawContent());
} | [
"public",
"static",
"function",
"receive",
"(",
"$",
"savePath",
",",
"RequestContract",
"$",
"request",
"=",
"null",
")",
"{",
"file_put_contents",
"(",
"$",
"savePath",
",",
"$",
"request",
"?",
"$",
"request",
"->",
"getRawContent",
"(",
")",
":",
"Requ... | Receive a file
@param $savePath
@param RequestContract|null $request | [
"Receive",
"a",
"file"
] | 12a865729e7738d7d1e07371ad7203243c4571fa | https://github.com/luoxiaojun1992/lb_framework/blob/12a865729e7738d7d1e07371ad7203243c4571fa/components/helpers/FileHelper.php#L195-L198 | train |
luoxiaojun1992/lb_framework | components/helpers/FileHelper.php | FileHelper.copy | public static function copy($src, $dst, $context = null)
{
return self::resourceExists($src) ? copy($src, $dst, $context) : false;
} | php | public static function copy($src, $dst, $context = null)
{
return self::resourceExists($src) ? copy($src, $dst, $context) : false;
} | [
"public",
"static",
"function",
"copy",
"(",
"$",
"src",
",",
"$",
"dst",
",",
"$",
"context",
"=",
"null",
")",
"{",
"return",
"self",
"::",
"resourceExists",
"(",
"$",
"src",
")",
"?",
"copy",
"(",
"$",
"src",
",",
"$",
"dst",
",",
"$",
"contex... | Copy a file or a directory
@param $src
@param $dst
@param null $context
@return bool | [
"Copy",
"a",
"file",
"or",
"a",
"directory"
] | 12a865729e7738d7d1e07371ad7203243c4571fa | https://github.com/luoxiaojun1992/lb_framework/blob/12a865729e7738d7d1e07371ad7203243c4571fa/components/helpers/FileHelper.php#L208-L211 | train |
luoxiaojun1992/lb_framework | components/helpers/FileHelper.php | FileHelper.move | public static function move($oldName, $newName, $context = null)
{
return self::rename($oldName, $newName, $context);
} | php | public static function move($oldName, $newName, $context = null)
{
return self::rename($oldName, $newName, $context);
} | [
"public",
"static",
"function",
"move",
"(",
"$",
"oldName",
",",
"$",
"newName",
",",
"$",
"context",
"=",
"null",
")",
"{",
"return",
"self",
"::",
"rename",
"(",
"$",
"oldName",
",",
"$",
"newName",
",",
"$",
"context",
")",
";",
"}"
] | Move a file or a directory
@param $oldName
@param $newName
@param null $context
@return bool | [
"Move",
"a",
"file",
"or",
"a",
"directory"
] | 12a865729e7738d7d1e07371ad7203243c4571fa | https://github.com/luoxiaojun1992/lb_framework/blob/12a865729e7738d7d1e07371ad7203243c4571fa/components/helpers/FileHelper.php#L221-L224 | train |
luoxiaojun1992/lb_framework | components/helpers/FileHelper.php | FileHelper.rename | public static function rename($oldName, $newName, $context = null)
{
return self::resourceExists($oldName) ? rename($oldName, $newName, $context) : false;
} | php | public static function rename($oldName, $newName, $context = null)
{
return self::resourceExists($oldName) ? rename($oldName, $newName, $context) : false;
} | [
"public",
"static",
"function",
"rename",
"(",
"$",
"oldName",
",",
"$",
"newName",
",",
"$",
"context",
"=",
"null",
")",
"{",
"return",
"self",
"::",
"resourceExists",
"(",
"$",
"oldName",
")",
"?",
"rename",
"(",
"$",
"oldName",
",",
"$",
"newName",... | Rename a file or a directory
@param $oldName
@param $newName
@param null $context
@return bool | [
"Rename",
"a",
"file",
"or",
"a",
"directory"
] | 12a865729e7738d7d1e07371ad7203243c4571fa | https://github.com/luoxiaojun1992/lb_framework/blob/12a865729e7738d7d1e07371ad7203243c4571fa/components/helpers/FileHelper.php#L234-L237 | train |
as3io/modlr | src/Events/EventDispatcher.php | EventDispatcher.getListeners | protected function getListeners($eventName)
{
if (isset($this->listeners[$eventName])) {
return $this->listeners[$eventName];
}
return null;
} | php | protected function getListeners($eventName)
{
if (isset($this->listeners[$eventName])) {
return $this->listeners[$eventName];
}
return null;
} | [
"protected",
"function",
"getListeners",
"(",
"$",
"eventName",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"listeners",
"[",
"$",
"eventName",
"]",
")",
")",
"{",
"return",
"$",
"this",
"->",
"listeners",
"[",
"$",
"eventName",
"]",
";",
"... | Gets all registered listeners for an event name.
@param string $eventName
@return array|null | [
"Gets",
"all",
"registered",
"listeners",
"for",
"an",
"event",
"name",
"."
] | 7e684b88bb22a2e18397df9402075c6533084b16 | https://github.com/as3io/modlr/blob/7e684b88bb22a2e18397df9402075c6533084b16/src/Events/EventDispatcher.php#L91-L97 | train |
inhere/php-library-plus | libs/Log/AbstractLogger.php | AbstractLogger.log | public function log($level, $message, array $context = array())
{
$level = static::toNumberLevel($level);
return $this->addRecord($level, $message, $context);
} | php | public function log($level, $message, array $context = array())
{
$level = static::toNumberLevel($level);
return $this->addRecord($level, $message, $context);
} | [
"public",
"function",
"log",
"(",
"$",
"level",
",",
"$",
"message",
",",
"array",
"$",
"context",
"=",
"array",
"(",
")",
")",
"{",
"$",
"level",
"=",
"static",
"::",
"toNumberLevel",
"(",
"$",
"level",
")",
";",
"return",
"$",
"this",
"->",
"addR... | Adds a log record at an arbitrary level.
This method allows for compatibility with common interfaces.
@param int|string $level The log level
@param string $message The log message
@param array $context The log context
@return Boolean Whether the record has been processed | [
"Adds",
"a",
"log",
"record",
"at",
"an",
"arbitrary",
"level",
".",
"This",
"method",
"allows",
"for",
"compatibility",
"with",
"common",
"interfaces",
"."
] | 8604e037937d31fa2338d79aaf9d0910cb48f559 | https://github.com/inhere/php-library-plus/blob/8604e037937d31fa2338d79aaf9d0910cb48f559/libs/Log/AbstractLogger.php#L202-L207 | train |
amarcinkowski/hospitalplugin | src/utils/Utils.php | Utils.diffDates | public static function diffDates($date1, $date2)
{
$ts1 = strtotime($date1);
$ts2 = strtotime($date2);
$seconds_diff = $ts2 - $ts1;
return floor($seconds_diff / 3600 / 24);
} | php | public static function diffDates($date1, $date2)
{
$ts1 = strtotime($date1);
$ts2 = strtotime($date2);
$seconds_diff = $ts2 - $ts1;
return floor($seconds_diff / 3600 / 24);
} | [
"public",
"static",
"function",
"diffDates",
"(",
"$",
"date1",
",",
"$",
"date2",
")",
"{",
"$",
"ts1",
"=",
"strtotime",
"(",
"$",
"date1",
")",
";",
"$",
"ts2",
"=",
"strtotime",
"(",
"$",
"date2",
")",
";",
"$",
"seconds_diff",
"=",
"$",
"ts2",... | diff in days
@param $date1 $date1 string parsable date strtotime(date)
@param $date2 $date2 string parsable date strtotime(date)
@return number | [
"diff",
"in",
"days"
] | acdc2be5157abfbdcafb4dcf6c6ba505e291263f | https://github.com/amarcinkowski/hospitalplugin/blob/acdc2be5157abfbdcafb4dcf6c6ba505e291263f/src/utils/Utils.php#L49-L57 | train |
amarcinkowski/hospitalplugin | src/utils/Utils.php | Utils.readFileToArray | public static function readFileToArray($url, $delm = ";", $encl = "\"", $head = false)
{
$csvxrow = file($url); // ---- csv rows to array ----
$csvxrow[0] = chop($csvxrow[0]);
$csvxrow[0] = str_replace($encl, '', $csvxrow[0]);
$keydata = explode($delm, $csvxrow[0]);
... | php | public static function readFileToArray($url, $delm = ";", $encl = "\"", $head = false)
{
$csvxrow = file($url); // ---- csv rows to array ----
$csvxrow[0] = chop($csvxrow[0]);
$csvxrow[0] = str_replace($encl, '', $csvxrow[0]);
$keydata = explode($delm, $csvxrow[0]);
... | [
"public",
"static",
"function",
"readFileToArray",
"(",
"$",
"url",
",",
"$",
"delm",
"=",
"\";\"",
",",
"$",
"encl",
"=",
"\"\\\"\"",
",",
"$",
"head",
"=",
"false",
")",
"{",
"$",
"csvxrow",
"=",
"file",
"(",
"$",
"url",
")",
";",
"// ---- csv rows... | read file to array
@param $url file url
@param $delm default ;
@param $encl default \
@param $head default false
@return array of strings | [
"read",
"file",
"to",
"array"
] | acdc2be5157abfbdcafb4dcf6c6ba505e291263f | https://github.com/amarcinkowski/hospitalplugin/blob/acdc2be5157abfbdcafb4dcf6c6ba505e291263f/src/utils/Utils.php#L225-L263 | train |
amarcinkowski/hospitalplugin | src/utils/Utils.php | Utils.w1250_to_utf8 | public static function w1250_to_utf8($text)
{
// map based on:
// http://konfiguracja.c0.pl/iso02vscp1250en.html
// http://konfiguracja.c0.pl/webpl/index_en.html#examp
// http://www.htmlentities.com/html/entities/
$map = array(
chr(0x8A) => chr(0xA9),
... | php | public static function w1250_to_utf8($text)
{
// map based on:
// http://konfiguracja.c0.pl/iso02vscp1250en.html
// http://konfiguracja.c0.pl/webpl/index_en.html#examp
// http://www.htmlentities.com/html/entities/
$map = array(
chr(0x8A) => chr(0xA9),
... | [
"public",
"static",
"function",
"w1250_to_utf8",
"(",
"$",
"text",
")",
"{",
"// map based on:",
"// http://konfiguracja.c0.pl/iso02vscp1250en.html",
"// http://konfiguracja.c0.pl/webpl/index_en.html#examp",
"// http://www.htmlentities.com/html/entities/",
"$",
"map",
"=",
"array",
... | PL chars conv iso8859-2 => win1250 => utf8
@param text string with PL chars
@return string encoded | [
"PL",
"chars",
"conv",
"iso8859",
"-",
"2",
"=",
">",
"win1250",
"=",
">",
"utf8"
] | acdc2be5157abfbdcafb4dcf6c6ba505e291263f | https://github.com/amarcinkowski/hospitalplugin/blob/acdc2be5157abfbdcafb4dcf6c6ba505e291263f/src/utils/Utils.php#L271-L336 | train |
thelia-modules/SmartyFilter | Model/Base/SmartyFilterQuery.php | SmartyFilterQuery.create | public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof \SmartyFilter\Model\SmartyFilterQuery) {
return $criteria;
}
$query = new \SmartyFilter\Model\SmartyFilterQuery();
if (null !== $modelAlias) {
$query->setModelAlias(... | php | public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof \SmartyFilter\Model\SmartyFilterQuery) {
return $criteria;
}
$query = new \SmartyFilter\Model\SmartyFilterQuery();
if (null !== $modelAlias) {
$query->setModelAlias(... | [
"public",
"static",
"function",
"create",
"(",
"$",
"modelAlias",
"=",
"null",
",",
"$",
"criteria",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"criteria",
"instanceof",
"\\",
"SmartyFilter",
"\\",
"Model",
"\\",
"SmartyFilterQuery",
")",
"{",
"return",
"$",
... | Returns a new ChildSmartyFilterQuery object.
@param string $modelAlias The alias of a model in the query
@param Criteria $criteria Optional Criteria to build the query from
@return ChildSmartyFilterQuery | [
"Returns",
"a",
"new",
"ChildSmartyFilterQuery",
"object",
"."
] | e510d281f51ddc4344e563d0f6aaa192fa7171e9 | https://github.com/thelia-modules/SmartyFilter/blob/e510d281f51ddc4344e563d0f6aaa192fa7171e9/Model/Base/SmartyFilterQuery.php#L80-L94 | train |
thelia-modules/SmartyFilter | Model/Base/SmartyFilterQuery.php | SmartyFilterQuery.filterByActive | public function filterByActive($active = null, $comparison = null)
{
if (is_array($active)) {
$useMinMax = false;
if (isset($active['min'])) {
$this->addUsingAlias(SmartyFilterTableMap::ACTIVE, $active['min'], Criteria::GREATER_EQUAL);
$useMinMax = tru... | php | public function filterByActive($active = null, $comparison = null)
{
if (is_array($active)) {
$useMinMax = false;
if (isset($active['min'])) {
$this->addUsingAlias(SmartyFilterTableMap::ACTIVE, $active['min'], Criteria::GREATER_EQUAL);
$useMinMax = tru... | [
"public",
"function",
"filterByActive",
"(",
"$",
"active",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"active",
")",
")",
"{",
"$",
"useMinMax",
"=",
"false",
";",
"if",
"(",
"isset",
"(",
"$",
"ac... | Filter the query on the active column
Example usage:
<code>
$query->filterByActive(1234); // WHERE active = 1234
$query->filterByActive(array(12, 34)); // WHERE active IN (12, 34)
$query->filterByActive(array('min' => 12)); // WHERE active > 12
</code>
@param mixed $active The value to use as filter.
Use scalar v... | [
"Filter",
"the",
"query",
"on",
"the",
"active",
"column"
] | e510d281f51ddc4344e563d0f6aaa192fa7171e9 | https://github.com/thelia-modules/SmartyFilter/blob/e510d281f51ddc4344e563d0f6aaa192fa7171e9/Model/Base/SmartyFilterQuery.php#L289-L310 | train |
thelia-modules/SmartyFilter | Model/Base/SmartyFilterQuery.php | SmartyFilterQuery.filterByFiltertype | public function filterByFiltertype($filtertype = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($filtertype)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $filtertype)) {
$filtertype = str_replace('*', '%', $filt... | php | public function filterByFiltertype($filtertype = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($filtertype)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $filtertype)) {
$filtertype = str_replace('*', '%', $filt... | [
"public",
"function",
"filterByFiltertype",
"(",
"$",
"filtertype",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"filtertype",
")",
")",
"{",
"$",
... | Filter the query on the filtertype column
Example usage:
<code>
$query->filterByFiltertype('fooValue'); // WHERE filtertype = 'fooValue'
$query->filterByFiltertype('%fooValue%'); // WHERE filtertype LIKE '%fooValue%'
</code>
@param string $filtertype The value to use as filter.
Accepts wildcards (* and % trigge... | [
"Filter",
"the",
"query",
"on",
"the",
"filtertype",
"column"
] | e510d281f51ddc4344e563d0f6aaa192fa7171e9 | https://github.com/thelia-modules/SmartyFilter/blob/e510d281f51ddc4344e563d0f6aaa192fa7171e9/Model/Base/SmartyFilterQuery.php#L327-L339 | train |
thelia-modules/SmartyFilter | Model/Base/SmartyFilterQuery.php | SmartyFilterQuery.filterBySmartyFilterI18n | public function filterBySmartyFilterI18n($smartyFilterI18n, $comparison = null)
{
if ($smartyFilterI18n instanceof \SmartyFilter\Model\SmartyFilterI18n) {
return $this
->addUsingAlias(SmartyFilterTableMap::ID, $smartyFilterI18n->getId(), $comparison);
} elseif ($smartyFil... | php | public function filterBySmartyFilterI18n($smartyFilterI18n, $comparison = null)
{
if ($smartyFilterI18n instanceof \SmartyFilter\Model\SmartyFilterI18n) {
return $this
->addUsingAlias(SmartyFilterTableMap::ID, $smartyFilterI18n->getId(), $comparison);
} elseif ($smartyFil... | [
"public",
"function",
"filterBySmartyFilterI18n",
"(",
"$",
"smartyFilterI18n",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"smartyFilterI18n",
"instanceof",
"\\",
"SmartyFilter",
"\\",
"Model",
"\\",
"SmartyFilterI18n",
")",
"{",
"return",
"$... | Filter the query by a related \SmartyFilter\Model\SmartyFilterI18n object
@param \SmartyFilter\Model\SmartyFilterI18n|ObjectCollection $smartyFilterI18n the related object to use as filter
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return ChildSmartyFilterQuery ... | [
"Filter",
"the",
"query",
"by",
"a",
"related",
"\\",
"SmartyFilter",
"\\",
"Model",
"\\",
"SmartyFilterI18n",
"object"
] | e510d281f51ddc4344e563d0f6aaa192fa7171e9 | https://github.com/thelia-modules/SmartyFilter/blob/e510d281f51ddc4344e563d0f6aaa192fa7171e9/Model/Base/SmartyFilterQuery.php#L378-L391 | train |
thelia-modules/SmartyFilter | Model/Base/SmartyFilterQuery.php | SmartyFilterQuery.useSmartyFilterI18nQuery | public function useSmartyFilterI18nQuery($relationAlias = null, $joinType = 'LEFT JOIN')
{
return $this
->joinSmartyFilterI18n($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'SmartyFilterI18n', '\SmartyFilter\Model\SmartyFilterI18nQuery');
} | php | public function useSmartyFilterI18nQuery($relationAlias = null, $joinType = 'LEFT JOIN')
{
return $this
->joinSmartyFilterI18n($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'SmartyFilterI18n', '\SmartyFilter\Model\SmartyFilterI18nQuery');
} | [
"public",
"function",
"useSmartyFilterI18nQuery",
"(",
"$",
"relationAlias",
"=",
"null",
",",
"$",
"joinType",
"=",
"'LEFT JOIN'",
")",
"{",
"return",
"$",
"this",
"->",
"joinSmartyFilterI18n",
"(",
"$",
"relationAlias",
",",
"$",
"joinType",
")",
"->",
"useQ... | Use the SmartyFilterI18n relation SmartyFilterI18n object
@see useQuery()
@param string $relationAlias optional alias for the relation,
to be used as main alias in the secondary query
@param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
@return \SmartyFilter\Model\Smart... | [
"Use",
"the",
"SmartyFilterI18n",
"relation",
"SmartyFilterI18n",
"object"
] | e510d281f51ddc4344e563d0f6aaa192fa7171e9 | https://github.com/thelia-modules/SmartyFilter/blob/e510d281f51ddc4344e563d0f6aaa192fa7171e9/Model/Base/SmartyFilterQuery.php#L436-L441 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.