id int32 0 241k | repo stringlengths 6 63 | path stringlengths 5 140 | func_name stringlengths 3 151 | original_string stringlengths 84 13k | language stringclasses 1
value | code stringlengths 84 13k | code_tokens list | docstring stringlengths 3 47.2k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 91 247 |
|---|---|---|---|---|---|---|---|---|---|---|---|
203,800 | ghousseyn/phiber | library/oosql/oosql.php | oosql.exe | public function exe()
{
if ($this->oosql_fromFlag) {
$this->from();
}
if (null != $this->oosql_join) {
$this->sql($this->oosql_join);
}
if (null != $this->oosql_where) {
$this->sql($this->oosql_where);
}
if (null != $this->... | php | public function exe()
{
if ($this->oosql_fromFlag) {
$this->from();
}
if (null != $this->oosql_join) {
$this->sql($this->oosql_join);
}
if (null != $this->oosql_where) {
$this->sql($this->oosql_where);
}
if (null != $this->... | [
"public",
"function",
"exe",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"oosql_fromFlag",
")",
"{",
"$",
"this",
"->",
"from",
"(",
")",
";",
"}",
"if",
"(",
"null",
"!=",
"$",
"this",
"->",
"oosql_join",
")",
"{",
"$",
"this",
"->",
"sql",
"... | Checks flags and clauses then assembles and executes the query
@throws \Exception
@return string|object
@throws \Exception | [
"Checks",
"flags",
"and",
"clauses",
"then",
"assembles",
"and",
"executes",
"the",
"query"
] | 2574249d49b6930a0123a310a32073a105cdd486 | https://github.com/ghousseyn/phiber/blob/2574249d49b6930a0123a310a32073a105cdd486/library/oosql/oosql.php#L969-L1029 |
203,801 | ghousseyn/phiber | library/oosql/oosql.php | oosql.prepFetch | protected function prepFetch()
{
if ($this->oosql_sub) {
return $this;
}
if (!$this->oosql_select instanceof oosql) {
$this->select();
}
$this->oosql_select->exe();
if (!$this->oosql_stmt) {
$msg = 'Query returned no results! ' . ... | php | protected function prepFetch()
{
if ($this->oosql_sub) {
return $this;
}
if (!$this->oosql_select instanceof oosql) {
$this->select();
}
$this->oosql_select->exe();
if (!$this->oosql_stmt) {
$msg = 'Query returned no results! ' . ... | [
"protected",
"function",
"prepFetch",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"oosql_sub",
")",
"{",
"return",
"$",
"this",
";",
"}",
"if",
"(",
"!",
"$",
"this",
"->",
"oosql_select",
"instanceof",
"oosql",
")",
"{",
"$",
"this",
"->",
"select"... | Returns the results of a SELECT if any
@throws \InvalidArgumentException
@throws \Exception
@return \Phiber\oosql\oosql|\Phiber\oosql\collection | [
"Returns",
"the",
"results",
"of",
"a",
"SELECT",
"if",
"any"
] | 2574249d49b6930a0123a310a32073a105cdd486 | https://github.com/ghousseyn/phiber/blob/2574249d49b6930a0123a310a32073a105cdd486/library/oosql/oosql.php#L1037-L1058 |
203,802 | ghousseyn/phiber | library/oosql/oosql.php | oosql.with | public function with(array $related)
{
$relations = $this->getEntityObject()->getRelations();
foreach ($relations as $fk => $target) {
$table = strstr($target, '.', true);
if (in_array($table, $related)) {
$this->sql(" ,$table.*");
$this->jo... | php | public function with(array $related)
{
$relations = $this->getEntityObject()->getRelations();
foreach ($relations as $fk => $target) {
$table = strstr($target, '.', true);
if (in_array($table, $related)) {
$this->sql(" ,$table.*");
$this->jo... | [
"public",
"function",
"with",
"(",
"array",
"$",
"related",
")",
"{",
"$",
"relations",
"=",
"$",
"this",
"->",
"getEntityObject",
"(",
")",
"->",
"getRelations",
"(",
")",
";",
"foreach",
"(",
"$",
"relations",
"as",
"$",
"fk",
"=>",
"$",
"target",
... | Creates a join automatically based on the relationships of current entity
@param array $related
@return \Phiber\oosql\oosql | [
"Creates",
"a",
"join",
"automatically",
"based",
"on",
"the",
"relationships",
"of",
"current",
"entity"
] | 2574249d49b6930a0123a310a32073a105cdd486 | https://github.com/ghousseyn/phiber/blob/2574249d49b6930a0123a310a32073a105cdd486/library/oosql/oosql.php#L1144-L1164 |
203,803 | ghousseyn/phiber | library/oosql/oosql.php | oosql.limit | public function limit($from, $size)
{
if (!$this->oosql_multiFlag) {
$this->oosql_limit = ' LIMIT ' . $from . ', ' . $size;
}
return $this;
} | php | public function limit($from, $size)
{
if (!$this->oosql_multiFlag) {
$this->oosql_limit = ' LIMIT ' . $from . ', ' . $size;
}
return $this;
} | [
"public",
"function",
"limit",
"(",
"$",
"from",
",",
"$",
"size",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"oosql_multiFlag",
")",
"{",
"$",
"this",
"->",
"oosql_limit",
"=",
"' LIMIT '",
".",
"$",
"from",
".",
"', '",
".",
"$",
"size",
";",
... | Creates a limit clause for MySQL
@param integer $from Offset tostart from
@param integer $size Chunk size
@return \Phiber\oosql\oosql | [
"Creates",
"a",
"limit",
"clause",
"for",
"MySQL"
] | 2574249d49b6930a0123a310a32073a105cdd486 | https://github.com/ghousseyn/phiber/blob/2574249d49b6930a0123a310a32073a105cdd486/library/oosql/oosql.php#L1172-L1178 |
203,804 | ghousseyn/phiber | library/oosql/oosql.php | oosql.orderBy | public function orderBy($field, $dir = 'ASC')
{
if (!$this->oosql_multiFlag) {
$this->oosql_order = ' ORDER BY ' . $field . ' ' . $dir;
}
return $this;
} | php | public function orderBy($field, $dir = 'ASC')
{
if (!$this->oosql_multiFlag) {
$this->oosql_order = ' ORDER BY ' . $field . ' ' . $dir;
}
return $this;
} | [
"public",
"function",
"orderBy",
"(",
"$",
"field",
",",
"$",
"dir",
"=",
"'ASC'",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"oosql_multiFlag",
")",
"{",
"$",
"this",
"->",
"oosql_order",
"=",
"' ORDER BY '",
".",
"$",
"field",
".",
"' '",
".",
... | Creates an ORDER BY clause
@param string $field Field name
@param string DESC|ASC
@return \Phiber\oosql\oosql | [
"Creates",
"an",
"ORDER",
"BY",
"clause"
] | 2574249d49b6930a0123a310a32073a105cdd486 | https://github.com/ghousseyn/phiber/blob/2574249d49b6930a0123a310a32073a105cdd486/library/oosql/oosql.php#L1186-L1192 |
203,805 | ghousseyn/phiber | library/oosql/oosql.php | oosql.findOne | public function findOne($arg = null, $operator = '=', $fields = array('*'))
{
return $this->find($arg, $operator, $fields)->limit(0, 1);
} | php | public function findOne($arg = null, $operator = '=', $fields = array('*'))
{
return $this->find($arg, $operator, $fields)->limit(0, 1);
} | [
"public",
"function",
"findOne",
"(",
"$",
"arg",
"=",
"null",
",",
"$",
"operator",
"=",
"'='",
",",
"$",
"fields",
"=",
"array",
"(",
"'*'",
")",
")",
"{",
"return",
"$",
"this",
"->",
"find",
"(",
"$",
"arg",
",",
"$",
"operator",
",",
"$",
... | Find first random value returned by the query
@param string $arg
@param string $operator
@param array $fields
@return \Phiber\oosql\oosql | [
"Find",
"first",
"random",
"value",
"returned",
"by",
"the",
"query"
] | 2574249d49b6930a0123a310a32073a105cdd486 | https://github.com/ghousseyn/phiber/blob/2574249d49b6930a0123a310a32073a105cdd486/library/oosql/oosql.php#L1201-L1204 |
203,806 | ghousseyn/phiber | library/oosql/oosql.php | oosql.findLimited | public function findLimited($from, $to, $arg = null, $operator = '=', $fields = array('*'))
{
return $this->find($arg, $operator, $fields)->limit($from, $to);
} | php | public function findLimited($from, $to, $arg = null, $operator = '=', $fields = array('*'))
{
return $this->find($arg, $operator, $fields)->limit($from, $to);
} | [
"public",
"function",
"findLimited",
"(",
"$",
"from",
",",
"$",
"to",
",",
"$",
"arg",
"=",
"null",
",",
"$",
"operator",
"=",
"'='",
",",
"$",
"fields",
"=",
"array",
"(",
"'*'",
")",
")",
"{",
"return",
"$",
"this",
"->",
"find",
"(",
"$",
"... | Find with limit
@param string $arg
@param integer $from
@param integer $to
@param string $operator
@param array $fields
@return \Phiber\oosql\oosql | [
"Find",
"with",
"limit"
] | 2574249d49b6930a0123a310a32073a105cdd486 | https://github.com/ghousseyn/phiber/blob/2574249d49b6930a0123a310a32073a105cdd486/library/oosql/oosql.php#L1215-L1218 |
203,807 | ghousseyn/phiber | library/oosql/oosql.php | oosql.find | public function find($arg = null, $operator = '=', $fields = array('*'))
{
if ($fields[0] == '*') {
$this->select();
} else {
$select_args = '';
foreach ($fields as $key => $field) {
if (is_array($field) && is_string($key)) {
fo... | php | public function find($arg = null, $operator = '=', $fields = array('*'))
{
if ($fields[0] == '*') {
$this->select();
} else {
$select_args = '';
foreach ($fields as $key => $field) {
if (is_array($field) && is_string($key)) {
fo... | [
"public",
"function",
"find",
"(",
"$",
"arg",
"=",
"null",
",",
"$",
"operator",
"=",
"'='",
",",
"$",
"fields",
"=",
"array",
"(",
"'*'",
")",
")",
"{",
"if",
"(",
"$",
"fields",
"[",
"0",
"]",
"==",
"'*'",
")",
"{",
"$",
"this",
"->",
"sel... | Find records with a filtering condition
@param string $arg
@param string $operator
@param array $fields
@return \Phiber\oosql\oosql | [
"Find",
"records",
"with",
"a",
"filtering",
"condition"
] | 2574249d49b6930a0123a310a32073a105cdd486 | https://github.com/ghousseyn/phiber/blob/2574249d49b6930a0123a310a32073a105cdd486/library/oosql/oosql.php#L1227-L1267 |
203,808 | ghousseyn/phiber | library/oosql/oosql.php | oosql.alias | public function alias($alias = null)
{
if (null === $alias) {
$alias = $this->getTableAlias();
}
$this->oosql_table_alias = $alias;
return $this;
} | php | public function alias($alias = null)
{
if (null === $alias) {
$alias = $this->getTableAlias();
}
$this->oosql_table_alias = $alias;
return $this;
} | [
"public",
"function",
"alias",
"(",
"$",
"alias",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"alias",
")",
"{",
"$",
"alias",
"=",
"$",
"this",
"->",
"getTableAlias",
"(",
")",
";",
"}",
"$",
"this",
"->",
"oosql_table_alias",
"=",
"$",
... | Creates or bind provided alias with the current loaded table class
@param string $alias
@return \Phiber\oosql\oosql | [
"Creates",
"or",
"bind",
"provided",
"alias",
"with",
"the",
"current",
"loaded",
"table",
"class"
] | 2574249d49b6930a0123a310a32073a105cdd486 | https://github.com/ghousseyn/phiber/blob/2574249d49b6930a0123a310a32073a105cdd486/library/oosql/oosql.php#L1274-L1281 |
203,809 | ghousseyn/phiber | library/oosql/oosql.php | oosql.notIn | public function notIn($item, array $list, $cond = null, $not = true)
{
return $this->in($item, $list, $cond, $not);
} | php | public function notIn($item, array $list, $cond = null, $not = true)
{
return $this->in($item, $list, $cond, $not);
} | [
"public",
"function",
"notIn",
"(",
"$",
"item",
",",
"array",
"$",
"list",
",",
"$",
"cond",
"=",
"null",
",",
"$",
"not",
"=",
"true",
")",
"{",
"return",
"$",
"this",
"->",
"in",
"(",
"$",
"item",
",",
"$",
"list",
",",
"$",
"cond",
",",
"... | Creates a NOT IN clause
@param mixed $item Subject of comparison
@param array $list A list of values
@param string $cond OR|AND
@param boolean $not | [
"Creates",
"a",
"NOT",
"IN",
"clause"
] | 2574249d49b6930a0123a310a32073a105cdd486 | https://github.com/ghousseyn/phiber/blob/2574249d49b6930a0123a310a32073a105cdd486/library/oosql/oosql.php#L1332-L1335 |
203,810 | ghousseyn/phiber | library/oosql/oosql.php | oosql.orIn | public function orIn($item, array $list, $cond = 'or', $not = false)
{
return $this->in($item, $list, $cond, $not);
} | php | public function orIn($item, array $list, $cond = 'or', $not = false)
{
return $this->in($item, $list, $cond, $not);
} | [
"public",
"function",
"orIn",
"(",
"$",
"item",
",",
"array",
"$",
"list",
",",
"$",
"cond",
"=",
"'or'",
",",
"$",
"not",
"=",
"false",
")",
"{",
"return",
"$",
"this",
"->",
"in",
"(",
"$",
"item",
",",
"$",
"list",
",",
"$",
"cond",
",",
"... | Creates a OR IN clause
@param mixed $item Subject of comparison
@param array $list A list of values
@param string $cond OR|AND
@param boolean $not | [
"Creates",
"a",
"OR",
"IN",
"clause"
] | 2574249d49b6930a0123a310a32073a105cdd486 | https://github.com/ghousseyn/phiber/blob/2574249d49b6930a0123a310a32073a105cdd486/library/oosql/oosql.php#L1344-L1347 |
203,811 | ghousseyn/phiber | library/oosql/oosql.php | oosql.orNotIn | public function orNotIn($item, array $list, $cond = 'or', $not = true)
{
return $this->in($item, $list, $cond, $not);
} | php | public function orNotIn($item, array $list, $cond = 'or', $not = true)
{
return $this->in($item, $list, $cond, $not);
} | [
"public",
"function",
"orNotIn",
"(",
"$",
"item",
",",
"array",
"$",
"list",
",",
"$",
"cond",
"=",
"'or'",
",",
"$",
"not",
"=",
"true",
")",
"{",
"return",
"$",
"this",
"->",
"in",
"(",
"$",
"item",
",",
"$",
"list",
",",
"$",
"cond",
",",
... | Creates an OR NOT IN clause
@param mixed $item Subject of comparison
@param array $list A list of values
@param string $cond OR|AND
@param boolean $not | [
"Creates",
"an",
"OR",
"NOT",
"IN",
"clause"
] | 2574249d49b6930a0123a310a32073a105cdd486 | https://github.com/ghousseyn/phiber/blob/2574249d49b6930a0123a310a32073a105cdd486/library/oosql/oosql.php#L1356-L1359 |
203,812 | ghousseyn/phiber | library/oosql/oosql.php | oosql.in | public function in($item, array $list, $cond = null, $not = false)
{
$inClause = '';
if (null == $this->oosql_where && null == $this->oosql_in && null == $this->oosql_between) {
$inClause .= ' WHERE ';
} else {
$cnd = ' AND ';
if (null != $cond) {
... | php | public function in($item, array $list, $cond = null, $not = false)
{
$inClause = '';
if (null == $this->oosql_where && null == $this->oosql_in && null == $this->oosql_between) {
$inClause .= ' WHERE ';
} else {
$cnd = ' AND ';
if (null != $cond) {
... | [
"public",
"function",
"in",
"(",
"$",
"item",
",",
"array",
"$",
"list",
",",
"$",
"cond",
"=",
"null",
",",
"$",
"not",
"=",
"false",
")",
"{",
"$",
"inClause",
"=",
"''",
";",
"if",
"(",
"null",
"==",
"$",
"this",
"->",
"oosql_where",
"&&",
"... | Creates an IN clause
@param mixed $item Subject of comparison
@param array $list A list of values
@param string $cond OR|AND
@param boolean $not | [
"Creates",
"an",
"IN",
"clause"
] | 2574249d49b6930a0123a310a32073a105cdd486 | https://github.com/ghousseyn/phiber/blob/2574249d49b6930a0123a310a32073a105cdd486/library/oosql/oosql.php#L1368-L1402 |
203,813 | ghousseyn/phiber | library/oosql/oosql.php | oosql.between | public function between($item, $low, $up, $cond = null, $not = false)
{
$bClause = '';
if (null == $this->oosql_where && null == $this->oosql_between && null == $this->oosql_in) {
$bClause .= ' WHERE ';
} else {
$cnd = ' AND ';
if (null != $cond) {
... | php | public function between($item, $low, $up, $cond = null, $not = false)
{
$bClause = '';
if (null == $this->oosql_where && null == $this->oosql_between && null == $this->oosql_in) {
$bClause .= ' WHERE ';
} else {
$cnd = ' AND ';
if (null != $cond) {
... | [
"public",
"function",
"between",
"(",
"$",
"item",
",",
"$",
"low",
",",
"$",
"up",
",",
"$",
"cond",
"=",
"null",
",",
"$",
"not",
"=",
"false",
")",
"{",
"$",
"bClause",
"=",
"''",
";",
"if",
"(",
"null",
"==",
"$",
"this",
"->",
"oosql_where... | Creates a BETWEEN clause
@param mixed $item
@param mixed $low
@param mixed $up
@param string $cond OR|AND
@param boolean $not
@return \Phiber\oosql\oosql | [
"Creates",
"a",
"BETWEEN",
"clause"
] | 2574249d49b6930a0123a310a32073a105cdd486 | https://github.com/ghousseyn/phiber/blob/2574249d49b6930a0123a310a32073a105cdd486/library/oosql/oosql.php#L1413-L1440 |
203,814 | ghousseyn/phiber | library/oosql/oosql.php | oosql.transactional | public static function transactional($fn)
{
$oosql = self::getInstance('oosql', 'void');
if (!$oosql->beginTransaction()) {
$msg = 'Could not start this transaction. BeginTransaction failed!';
throw new \Exception($msg, 9815, null);
}
if (is_callable($fn)) {
... | php | public static function transactional($fn)
{
$oosql = self::getInstance('oosql', 'void');
if (!$oosql->beginTransaction()) {
$msg = 'Could not start this transaction. BeginTransaction failed!';
throw new \Exception($msg, 9815, null);
}
if (is_callable($fn)) {
... | [
"public",
"static",
"function",
"transactional",
"(",
"$",
"fn",
")",
"{",
"$",
"oosql",
"=",
"self",
"::",
"getInstance",
"(",
"'oosql'",
",",
"'void'",
")",
";",
"if",
"(",
"!",
"$",
"oosql",
"->",
"beginTransaction",
"(",
")",
")",
"{",
"$",
"msg"... | Starts a transaction if current driver supports it
@param callable $fn A Closure
@throws \Exception
@return mixed Whatever the Closure returns is passed to the higher scope variable if any | [
"Starts",
"a",
"transaction",
"if",
"current",
"driver",
"supports",
"it"
] | 2574249d49b6930a0123a310a32073a105cdd486 | https://github.com/ghousseyn/phiber/blob/2574249d49b6930a0123a310a32073a105cdd486/library/oosql/oosql.php#L1474-L1487 |
203,815 | ghousseyn/phiber | library/oosql/oosql.php | oosql.getNamedLock | public function getNamedLock($name, $timeout = 15)
{
$stmt = $this->query('SELECT GET_LOCK("' . $name . '", '.$timeout .')');
return $stmt->fetch(self::FETCH_COLUMN);
} | php | public function getNamedLock($name, $timeout = 15)
{
$stmt = $this->query('SELECT GET_LOCK("' . $name . '", '.$timeout .')');
return $stmt->fetch(self::FETCH_COLUMN);
} | [
"public",
"function",
"getNamedLock",
"(",
"$",
"name",
",",
"$",
"timeout",
"=",
"15",
")",
"{",
"$",
"stmt",
"=",
"$",
"this",
"->",
"query",
"(",
"'SELECT GET_LOCK(\"'",
".",
"$",
"name",
".",
"'\", '",
".",
"$",
"timeout",
".",
"')'",
")",
";",
... | Try to obtain a named lock
@author Housseyn Guettaf
@param string $name - Lock name
@param int $timeout - Timeout
@return mixed | [
"Try",
"to",
"obtain",
"a",
"named",
"lock"
] | 2574249d49b6930a0123a310a32073a105cdd486 | https://github.com/ghousseyn/phiber/blob/2574249d49b6930a0123a310a32073a105cdd486/library/oosql/oosql.php#L1499-L1504 |
203,816 | ghousseyn/phiber | library/oosql/oosql.php | oosql.releaseNamedLock | public function releaseNamedLock($name)
{
$stmt = $this->query('SELECT RELEASE_LOCK("' . $name . '")');
return $stmt->fetch(self::FETCH_COLUMN);
} | php | public function releaseNamedLock($name)
{
$stmt = $this->query('SELECT RELEASE_LOCK("' . $name . '")');
return $stmt->fetch(self::FETCH_COLUMN);
} | [
"public",
"function",
"releaseNamedLock",
"(",
"$",
"name",
")",
"{",
"$",
"stmt",
"=",
"$",
"this",
"->",
"query",
"(",
"'SELECT RELEASE_LOCK(\"'",
".",
"$",
"name",
".",
"'\")'",
")",
";",
"return",
"$",
"stmt",
"->",
"fetch",
"(",
"self",
"::",
"FET... | releases a named lock
@author Housseyn Guettaf
@param string $name - Lock name
@return mixed | [
"releases",
"a",
"named",
"lock"
] | 2574249d49b6930a0123a310a32073a105cdd486 | https://github.com/ghousseyn/phiber/blob/2574249d49b6930a0123a310a32073a105cdd486/library/oosql/oosql.php#L1514-L1519 |
203,817 | zbox/UnifiedPush | src/Zbox/UnifiedPush/Notification/PayloadHandler/APNS.php | APNS.packPayload | public function packPayload($payload)
{
$payload = JsonEncoder::jsonEncode($payload);
/** @var APNSMessage $message */
$message = $this->message;
$recipientId = $message->getRecipientDeviceCollection()->current()->getIdentifier();
$messageRecipientId = $this->notificationI... | php | public function packPayload($payload)
{
$payload = JsonEncoder::jsonEncode($payload);
/** @var APNSMessage $message */
$message = $this->message;
$recipientId = $message->getRecipientDeviceCollection()->current()->getIdentifier();
$messageRecipientId = $this->notificationI... | [
"public",
"function",
"packPayload",
"(",
"$",
"payload",
")",
"{",
"$",
"payload",
"=",
"JsonEncoder",
"::",
"jsonEncode",
"(",
"$",
"payload",
")",
";",
"/** @var APNSMessage $message */",
"$",
"message",
"=",
"$",
"this",
"->",
"message",
";",
"$",
"recip... | Pack message body into binary string
@param array $payload
@return string | [
"Pack",
"message",
"body",
"into",
"binary",
"string"
] | 47da2d0577b18ac709cd947c68541014001e1866 | https://github.com/zbox/UnifiedPush/blob/47da2d0577b18ac709cd947c68541014001e1866/src/Zbox/UnifiedPush/Notification/PayloadHandler/APNS.php#L77-L99 |
203,818 | newestindustry/ginger-rest | src/Ginger/Routes.php | Routes.set | public static function set($uri, $path = false)
{
$route = new \Ginger\Route($uri, $path);
self::$routes[$route->route] = $route;
} | php | public static function set($uri, $path = false)
{
$route = new \Ginger\Route($uri, $path);
self::$routes[$route->route] = $route;
} | [
"public",
"static",
"function",
"set",
"(",
"$",
"uri",
",",
"$",
"path",
"=",
"false",
")",
"{",
"$",
"route",
"=",
"new",
"\\",
"Ginger",
"\\",
"Route",
"(",
"$",
"uri",
",",
"$",
"path",
")",
";",
"self",
"::",
"$",
"routes",
"[",
"$",
"rout... | set function.
@access public
@static
@param mixed $uri
@param bool $path (default: false)
@return void | [
"set",
"function",
"."
] | 482b77dc122a60ab0bf143a3c4a1e67168985c83 | https://github.com/newestindustry/ginger-rest/blob/482b77dc122a60ab0bf143a3c4a1e67168985c83/src/Ginger/Routes.php#L48-L52 |
203,819 | newestindustry/ginger-rest | src/Ginger/Routes.php | Routes.detect | public static function detect($uri)
{
$routes = self::get();
$found = false;
foreach($routes as $key => $route) {
$currentLength = strlen($route->route);
if(substr($uri, 0, $currentLength) == $route->route) {
$found = $route;
break;
... | php | public static function detect($uri)
{
$routes = self::get();
$found = false;
foreach($routes as $key => $route) {
$currentLength = strlen($route->route);
if(substr($uri, 0, $currentLength) == $route->route) {
$found = $route;
break;
... | [
"public",
"static",
"function",
"detect",
"(",
"$",
"uri",
")",
"{",
"$",
"routes",
"=",
"self",
"::",
"get",
"(",
")",
";",
"$",
"found",
"=",
"false",
";",
"foreach",
"(",
"$",
"routes",
"as",
"$",
"key",
"=>",
"$",
"route",
")",
"{",
"$",
"c... | detect function.
@access public
@static
@param string $uri
@return false|\Ginger\Route | [
"detect",
"function",
"."
] | 482b77dc122a60ab0bf143a3c4a1e67168985c83 | https://github.com/newestindustry/ginger-rest/blob/482b77dc122a60ab0bf143a3c4a1e67168985c83/src/Ginger/Routes.php#L74-L87 |
203,820 | schpill/thin | src/Html/Qwerly.php | Qwerly._lookUpBy | private function _lookUpBy($service, $data)
{
$batch = false;
$urlFormat = self::$URLS[$service];
if (is_array($data)) {
$data = implode(',', $data);
$batch = true;
}
$url = self::BASE_URL . sprintf($urlFormat, urlenco... | php | private function _lookUpBy($service, $data)
{
$batch = false;
$urlFormat = self::$URLS[$service];
if (is_array($data)) {
$data = implode(',', $data);
$batch = true;
}
$url = self::BASE_URL . sprintf($urlFormat, urlenco... | [
"private",
"function",
"_lookUpBy",
"(",
"$",
"service",
",",
"$",
"data",
")",
"{",
"$",
"batch",
"=",
"false",
";",
"$",
"urlFormat",
"=",
"self",
"::",
"$",
"URLS",
"[",
"$",
"service",
"]",
";",
"if",
"(",
"is_array",
"(",
"$",
"data",
")",
"... | Looks up an user using the given service data.
@param string $service Service to look up with.
@param mixed $data Data relevant to the service.
@return Qwerly_API_Response|null
@throws Qwerly_API_ErrorException
@throws Qwerly_API_NotFoundException | [
"Looks",
"up",
"an",
"user",
"using",
"the",
"given",
"service",
"data",
"."
] | a9102d9d6f70e8b0f6be93153f70849f46489ee1 | https://github.com/schpill/thin/blob/a9102d9d6f70e8b0f6be93153f70849f46489ee1/src/Html/Qwerly.php#L120-L154 |
203,821 | chilimatic/chilimatic-framework | lib/database/sql/mysql/Collection.php | Collection._checkdatabase | private function _checkdatabase($database)
{
if (count($this->_collection) == 0) {
$this->_collection[$database] = new $database();
return $this->_collection[$database];
}
$new = false;
foreach ($this->_collection as $db) {
if ($db === $database... | php | private function _checkdatabase($database)
{
if (count($this->_collection) == 0) {
$this->_collection[$database] = new $database();
return $this->_collection[$database];
}
$new = false;
foreach ($this->_collection as $db) {
if ($db === $database... | [
"private",
"function",
"_checkdatabase",
"(",
"$",
"database",
")",
"{",
"if",
"(",
"count",
"(",
"$",
"this",
"->",
"_collection",
")",
"==",
"0",
")",
"{",
"$",
"this",
"->",
"_collection",
"[",
"$",
"database",
"]",
"=",
"new",
"$",
"database",
"(... | checks if a database already exists
@param $database
@return $this | [
"checks",
"if",
"a",
"database",
"already",
"exists"
] | 8df7f12e75d75d3fd2197a58c80d39cbb4b9ff12 | https://github.com/chilimatic/chilimatic-framework/blob/8df7f12e75d75d3fd2197a58c80d39cbb4b9ff12/lib/database/sql/mysql/Collection.php#L79-L99 |
203,822 | acacha/forge-publish | src/Console/Commands/Traits/PossibleEmails.php | PossibleEmails.getPossibleEmails | protected function getPossibleEmails()
{
$this->checkGit();
$github_email = null;
$github_email = str_replace(array("\r", "\n"), '', shell_exec('git config user.email'));
if (filter_var($github_email, FILTER_VALIDATE_EMAIL)) {
return [ $github_email ];
} else {
... | php | protected function getPossibleEmails()
{
$this->checkGit();
$github_email = null;
$github_email = str_replace(array("\r", "\n"), '', shell_exec('git config user.email'));
if (filter_var($github_email, FILTER_VALIDATE_EMAIL)) {
return [ $github_email ];
} else {
... | [
"protected",
"function",
"getPossibleEmails",
"(",
")",
"{",
"$",
"this",
"->",
"checkGit",
"(",
")",
";",
"$",
"github_email",
"=",
"null",
";",
"$",
"github_email",
"=",
"str_replace",
"(",
"array",
"(",
"\"\\r\"",
",",
"\"\\n\"",
")",
",",
"''",
",",
... | Get possible emails
@return array | [
"Get",
"possible",
"emails"
] | 010779e3d2297c763b82dc3fbde992edffb3a6c6 | https://github.com/acacha/forge-publish/blob/010779e3d2297c763b82dc3fbde992edffb3a6c6/src/Console/Commands/Traits/PossibleEmails.php#L20-L31 |
203,823 | acacha/forge-publish | src/Console/Commands/PublishMySQLUsers.php | PublishMySQLUsers.createMySQLUser | protected function createMySQLUser()
{
$this->checkParameters();
$this->url = $this->obtainAPIURLEndpoint();
$this->http->post($this->url, [
'form_params' => $this->getData(),
'headers' => [
'X-Requested-With' => 'XMLHttpRequest',
... | php | protected function createMySQLUser()
{
$this->checkParameters();
$this->url = $this->obtainAPIURLEndpoint();
$this->http->post($this->url, [
'form_params' => $this->getData(),
'headers' => [
'X-Requested-With' => 'XMLHttpRequest',
... | [
"protected",
"function",
"createMySQLUser",
"(",
")",
"{",
"$",
"this",
"->",
"checkParameters",
"(",
")",
";",
"$",
"this",
"->",
"url",
"=",
"$",
"this",
"->",
"obtainAPIURLEndpoint",
"(",
")",
";",
"$",
"this",
"->",
"http",
"->",
"post",
"(",
"$",
... | Create MySQL user. | [
"Create",
"MySQL",
"user",
"."
] | 010779e3d2297c763b82dc3fbde992edffb3a6c6 | https://github.com/acacha/forge-publish/blob/010779e3d2297c763b82dc3fbde992edffb3a6c6/src/Console/Commands/PublishMySQLUsers.php#L75-L87 |
203,824 | acacha/forge-publish | src/Console/Commands/PublishMySQLUsers.php | PublishMySQLUsers.listMySQLUsers | protected function listMySQLUsers()
{
$this->url = $this->obtainAPIURLEndpointForList();
$response = $this->http->get($this->url, [
'headers' => [
'X-Requested-With' => 'XMLHttpRequest',
'Authorization' => 'Bearer ' . fp_env('ACACHA_FORGE_ACCES... | php | protected function listMySQLUsers()
{
$this->url = $this->obtainAPIURLEndpointForList();
$response = $this->http->get($this->url, [
'headers' => [
'X-Requested-With' => 'XMLHttpRequest',
'Authorization' => 'Bearer ' . fp_env('ACACHA_FORGE_ACCES... | [
"protected",
"function",
"listMySQLUsers",
"(",
")",
"{",
"$",
"this",
"->",
"url",
"=",
"$",
"this",
"->",
"obtainAPIURLEndpointForList",
"(",
")",
";",
"$",
"response",
"=",
"$",
"this",
"->",
"http",
"->",
"get",
"(",
"$",
"this",
"->",
"url",
",",
... | List MySQL users. | [
"List",
"MySQL",
"users",
"."
] | 010779e3d2297c763b82dc3fbde992edffb3a6c6 | https://github.com/acacha/forge-publish/blob/010779e3d2297c763b82dc3fbde992edffb3a6c6/src/Console/Commands/PublishMySQLUsers.php#L92-L129 |
203,825 | acacha/forge-publish | src/Console/Commands/Traits/InteractsWithEnvironment.php | InteractsWithEnvironment.addValueToEnv | protected function addValueToEnv($key, $value)
{
$env_path = base_path('.env');
$sed_command = "/bin/sed -i '/^$key=/d' " . $env_path;
passthru($sed_command);
File::append($env_path, "\n$key=$value\n");
} | php | protected function addValueToEnv($key, $value)
{
$env_path = base_path('.env');
$sed_command = "/bin/sed -i '/^$key=/d' " . $env_path;
passthru($sed_command);
File::append($env_path, "\n$key=$value\n");
} | [
"protected",
"function",
"addValueToEnv",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"$",
"env_path",
"=",
"base_path",
"(",
"'.env'",
")",
";",
"$",
"sed_command",
"=",
"\"/bin/sed -i '/^$key=/d' \"",
".",
"$",
"env_path",
";",
"passthru",
"(",
"$",
"s... | Add value to env.
@param $key
@param $value | [
"Add",
"value",
"to",
"env",
"."
] | 010779e3d2297c763b82dc3fbde992edffb3a6c6 | https://github.com/acacha/forge-publish/blob/010779e3d2297c763b82dc3fbde992edffb3a6c6/src/Console/Commands/Traits/InteractsWithEnvironment.php#L20-L26 |
203,826 | PlatoCreative/silverstripe-sections | code/models/Section.php | Section.Anchor | public function Anchor(){
if ($this->MenuTitle && $this->ShowInMenus) {
return strtolower(trim(preg_replace('/[^a-zA-Z0-9]+/', '-',$this->MenuTitle), '-'));
}
return false;
} | php | public function Anchor(){
if ($this->MenuTitle && $this->ShowInMenus) {
return strtolower(trim(preg_replace('/[^a-zA-Z0-9]+/', '-',$this->MenuTitle), '-'));
}
return false;
} | [
"public",
"function",
"Anchor",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"MenuTitle",
"&&",
"$",
"this",
"->",
"ShowInMenus",
")",
"{",
"return",
"strtolower",
"(",
"trim",
"(",
"preg_replace",
"(",
"'/[^a-zA-Z0-9]+/'",
",",
"'-'",
",",
"$",
"this",
... | Applies anchor to section in template.
@return string $classes | [
"Applies",
"anchor",
"to",
"section",
"in",
"template",
"."
] | 54c96146ea8cc625b00ee009753539658f10d01a | https://github.com/PlatoCreative/silverstripe-sections/blob/54c96146ea8cc625b00ee009753539658f10d01a/code/models/Section.php#L245-L250 |
203,827 | PlatoCreative/silverstripe-sections | code/models/Section.php | Section.Classes | public function Classes(){
$classes = array($this->config()->get('base_class'));
if ($this->Style) {
$classes[] = strtolower($this->Style).'-'.strtolower(preg_replace('/([a-z]+)([A-Z0-9])/', '$1-$2', get_called_class()));
}else{
$classes[] = strtolower(preg_replace('/([a-... | php | public function Classes(){
$classes = array($this->config()->get('base_class'));
if ($this->Style) {
$classes[] = strtolower($this->Style).'-'.strtolower(preg_replace('/([a-z]+)([A-Z0-9])/', '$1-$2', get_called_class()));
}else{
$classes[] = strtolower(preg_replace('/([a-... | [
"public",
"function",
"Classes",
"(",
")",
"{",
"$",
"classes",
"=",
"array",
"(",
"$",
"this",
"->",
"config",
"(",
")",
"->",
"get",
"(",
"'base_class'",
")",
")",
";",
"if",
"(",
"$",
"this",
"->",
"Style",
")",
"{",
"$",
"classes",
"[",
"]",
... | Applies classes to section in template.
@return string $classes | [
"Applies",
"classes",
"to",
"section",
"in",
"template",
"."
] | 54c96146ea8cc625b00ee009753539658f10d01a | https://github.com/PlatoCreative/silverstripe-sections/blob/54c96146ea8cc625b00ee009753539658f10d01a/code/models/Section.php#L269-L277 |
203,828 | smalldb/libSmalldb | class/Utils/Utils.php | Utils.write_json_file | static function write_json_file($filename, $json_array, array $whitelist = null, $json_options = null)
{
$stop_snippet = "<?php printf('_%c%c}%c',34,10,10);__halt_compiler();?>";
if ($whitelist === null) {
// Put stop snippet on begin.
$result = array_merge(array('_' => null), $json_array);
} else {
//... | php | static function write_json_file($filename, $json_array, array $whitelist = null, $json_options = null)
{
$stop_snippet = "<?php printf('_%c%c}%c',34,10,10);__halt_compiler();?>";
if ($whitelist === null) {
// Put stop snippet on begin.
$result = array_merge(array('_' => null), $json_array);
} else {
//... | [
"static",
"function",
"write_json_file",
"(",
"$",
"filename",
",",
"$",
"json_array",
",",
"array",
"$",
"whitelist",
"=",
"null",
",",
"$",
"json_options",
"=",
"null",
")",
"{",
"$",
"stop_snippet",
"=",
"\"<?php printf('_%c%c}%c',34,10,10);__halt_compiler();?>\"... | Encode array to JSON using json_encode, but insert PHP snippet to protect
sensitive data.
If $filename is set, JSON will be written to given file. Otherwise you are
expected to store returned string into *.json.php file.
Stop snippet: When JSON file is evaluated as PHP, stop snippet will
interrupt evaluation without ... | [
"Encode",
"array",
"to",
"JSON",
"using",
"json_encode",
"but",
"insert",
"PHP",
"snippet",
"to",
"protect",
"sensitive",
"data",
"."
] | b94d22af5014e8060d0530fc7043768cdc57b01a | https://github.com/smalldb/libSmalldb/blob/b94d22af5014e8060d0530fc7043768cdc57b01a/class/Utils/Utils.php#L262-L297 |
203,829 | SpoonX/SxBootstrap | src/SxBootstrap/Service/BootstrapFilter.php | BootstrapFilter.filterLoad | public function filterLoad(AssetInterface $asset)
{
$assetRoot = $asset->getSourceRoot();
$assetPath = $asset->getSourcePath();
$assetImportDir = dirname($assetRoot . '/' . $assetPath);
$importDir = $this->config->getBootstrapPath() . '/less';
$this->setupLoad... | php | public function filterLoad(AssetInterface $asset)
{
$assetRoot = $asset->getSourceRoot();
$assetPath = $asset->getSourcePath();
$assetImportDir = dirname($assetRoot . '/' . $assetPath);
$importDir = $this->config->getBootstrapPath() . '/less';
$this->setupLoad... | [
"public",
"function",
"filterLoad",
"(",
"AssetInterface",
"$",
"asset",
")",
"{",
"$",
"assetRoot",
"=",
"$",
"asset",
"->",
"getSourceRoot",
"(",
")",
";",
"$",
"assetPath",
"=",
"$",
"asset",
"->",
"getSourcePath",
"(",
")",
";",
"$",
"assetImportDir",
... | Sets the by-config generated imports on the asset.
{@inheritDoc} | [
"Sets",
"the",
"by",
"-",
"config",
"generated",
"imports",
"on",
"the",
"asset",
"."
] | 768b02e3b65f7dfe560e821cb0ff41ad3f86b3b6 | https://github.com/SpoonX/SxBootstrap/blob/768b02e3b65f7dfe560e821cb0ff41ad3f86b3b6/src/SxBootstrap/Service/BootstrapFilter.php#L86-L127 |
203,830 | SpoonX/SxBootstrap | src/SxBootstrap/Service/BootstrapFilter.php | BootstrapFilter.extractImports | protected function extractImports($importsFile)
{
$str = file_get_contents($importsFile);
preg_match_all('/@import "(?!variables)(?<imports>[\w-_\.]+)";/', $str, $matches);
return array_map('trim', $matches['imports']);
} | php | protected function extractImports($importsFile)
{
$str = file_get_contents($importsFile);
preg_match_all('/@import "(?!variables)(?<imports>[\w-_\.]+)";/', $str, $matches);
return array_map('trim', $matches['imports']);
} | [
"protected",
"function",
"extractImports",
"(",
"$",
"importsFile",
")",
"{",
"$",
"str",
"=",
"file_get_contents",
"(",
"$",
"importsFile",
")",
";",
"preg_match_all",
"(",
"'/@import \"(?!variables)(?<imports>[\\w-_\\.]+)\";/'",
",",
"$",
"str",
",",
"$",
"matches... | Extract the imports from the import file.
@param string $importsFile
@return array The extracted imports | [
"Extract",
"the",
"imports",
"from",
"the",
"import",
"file",
"."
] | 768b02e3b65f7dfe560e821cb0ff41ad3f86b3b6 | https://github.com/SpoonX/SxBootstrap/blob/768b02e3b65f7dfe560e821cb0ff41ad3f86b3b6/src/SxBootstrap/Service/BootstrapFilter.php#L136-L143 |
203,831 | SpoonX/SxBootstrap | src/SxBootstrap/Service/BootstrapFilter.php | BootstrapFilter.extractVariables | protected function extractVariables($variablesFile)
{
$str = file_get_contents($variablesFile);
$parts = explode(';', preg_replace('/(\/\/.*?\n|\s\n|\s{2,})/', '', $str));
$vars = array();
foreach ($parts as $part) {
$varMeta = explode(':', $part);
if (emp... | php | protected function extractVariables($variablesFile)
{
$str = file_get_contents($variablesFile);
$parts = explode(';', preg_replace('/(\/\/.*?\n|\s\n|\s{2,})/', '', $str));
$vars = array();
foreach ($parts as $part) {
$varMeta = explode(':', $part);
if (emp... | [
"protected",
"function",
"extractVariables",
"(",
"$",
"variablesFile",
")",
"{",
"$",
"str",
"=",
"file_get_contents",
"(",
"$",
"variablesFile",
")",
";",
"$",
"parts",
"=",
"explode",
"(",
"';'",
",",
"preg_replace",
"(",
"'/(\\/\\/.*?\\n|\\s\\n|\\s{2,})/'",
... | Extract the variables from the less file.
@param string $variablesFile The path to the less file
@return array The extracted variables | [
"Extract",
"the",
"variables",
"from",
"the",
"less",
"file",
"."
] | 768b02e3b65f7dfe560e821cb0ff41ad3f86b3b6 | https://github.com/SpoonX/SxBootstrap/blob/768b02e3b65f7dfe560e821cb0ff41ad3f86b3b6/src/SxBootstrap/Service/BootstrapFilter.php#L152-L167 |
203,832 | SpoonX/SxBootstrap | src/SxBootstrap/Service/BootstrapFilter.php | BootstrapFilter.filterImportFiles | protected function filterImportFiles(array $imports)
{
$config = $this->config;
$excludedComponents = $config->getExcludedComponents();
$includedComponents = $config->getIncludedComponents();
if (!empty($excludedComponents) && !empty($includedComponents)) {
t... | php | protected function filterImportFiles(array $imports)
{
$config = $this->config;
$excludedComponents = $config->getExcludedComponents();
$includedComponents = $config->getIncludedComponents();
if (!empty($excludedComponents) && !empty($includedComponents)) {
t... | [
"protected",
"function",
"filterImportFiles",
"(",
"array",
"$",
"imports",
")",
"{",
"$",
"config",
"=",
"$",
"this",
"->",
"config",
";",
"$",
"excludedComponents",
"=",
"$",
"config",
"->",
"getExcludedComponents",
"(",
")",
";",
"$",
"includedComponents",
... | Filter the import files needed.
@param array $imports
@throws \SxBootstrap\Exception\RuntimeException
@return array | [
"Filter",
"the",
"import",
"files",
"needed",
"."
] | 768b02e3b65f7dfe560e821cb0ff41ad3f86b3b6 | https://github.com/SpoonX/SxBootstrap/blob/768b02e3b65f7dfe560e821cb0ff41ad3f86b3b6/src/SxBootstrap/Service/BootstrapFilter.php#L177-L202 |
203,833 | 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 |
203,834 | 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 |
203,835 | 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 |
203,836 | 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 |
203,837 | 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 |
203,838 | 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 |
203,839 | 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 |
203,840 | 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 |
203,841 | 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 |
203,842 | 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 |
203,843 | 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 |
203,844 | 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 |
203,845 | 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 |
203,846 | 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 |
203,847 | 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 |
203,848 | 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 |
203,849 | 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 |
203,850 | 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 |
203,851 | 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 |
203,852 | 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 |
203,853 | 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 |
203,854 | 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 |
203,855 | 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 |
203,856 | 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 |
203,857 | 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 |
203,858 | 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 |
203,859 | 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 |
203,860 | 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 |
203,861 | 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 |
203,862 | 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 |
203,863 | 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 |
203,864 | 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 |
203,865 | 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 |
203,866 | 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 |
203,867 | 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 |
203,868 | 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 |
203,869 | 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 |
203,870 | 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 |
203,871 | 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 |
203,872 | 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 |
203,873 | 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 |
203,874 | 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 |
203,875 | 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 |
203,876 | 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 |
203,877 | 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 |
203,878 | 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 |
203,879 | 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 |
203,880 | 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 |
203,881 | 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 |
203,882 | 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 |
203,883 | 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 |
203,884 | 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 |
203,885 | 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 |
203,886 | 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 |
203,887 | 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 |
203,888 | 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 |
203,889 | 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 |
203,890 | 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 |
203,891 | 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 |
203,892 | 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 |
203,893 | 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 |
203,894 | 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 |
203,895 | 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 |
203,896 | 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 |
203,897 | 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 |
203,898 | 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 |
203,899 | 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 |
Subsets and Splits
Yii Code Samples
Gathers all records from test, train, and validation sets that contain the word 'yii', providing a basic filtered view of the dataset relevant to Yii-related content.