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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
199,300 | wb-crowdfusion/crowdfusion | system/core/classes/mvc/filters/DisplayFilterer.php | DisplayFilterer.wordCount | public function wordCount()
{
$count = 0;
foreach ($this->getParameters() as $value)
$count += str_word_count(strip_tags($value));
return $count;
} | php | public function wordCount()
{
$count = 0;
foreach ($this->getParameters() as $value)
$count += str_word_count(strip_tags($value));
return $count;
} | [
"public",
"function",
"wordCount",
"(",
")",
"{",
"$",
"count",
"=",
"0",
";",
"foreach",
"(",
"$",
"this",
"->",
"getParameters",
"(",
")",
"as",
"$",
"value",
")",
"$",
"count",
"+=",
"str_word_count",
"(",
"strip_tags",
"(",
"$",
"value",
")",
")"... | Returns the total count of all words in all params passed
@return integer | [
"Returns",
"the",
"total",
"count",
"of",
"all",
"words",
"in",
"all",
"params",
"passed"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/mvc/filters/DisplayFilterer.php#L373-L381 |
199,301 | wb-crowdfusion/crowdfusion | system/core/classes/mvc/filters/DisplayFilterer.php | DisplayFilterer.charCount | public function charCount()
{
$count = 0;
foreach ($this->getParameters() as $value)
$count += strlen(strip_tags($value));
return $count;
} | php | public function charCount()
{
$count = 0;
foreach ($this->getParameters() as $value)
$count += strlen(strip_tags($value));
return $count;
} | [
"public",
"function",
"charCount",
"(",
")",
"{",
"$",
"count",
"=",
"0",
";",
"foreach",
"(",
"$",
"this",
"->",
"getParameters",
"(",
")",
"as",
"$",
"value",
")",
"$",
"count",
"+=",
"strlen",
"(",
"strip_tags",
"(",
"$",
"value",
")",
")",
";",... | Returns the total count of all characters in all params passed
@return integer | [
"Returns",
"the",
"total",
"count",
"of",
"all",
"characters",
"in",
"all",
"params",
"passed"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/mvc/filters/DisplayFilterer.php#L388-L396 |
199,302 | wb-crowdfusion/crowdfusion | system/core/classes/mvc/filters/DisplayFilterer.php | DisplayFilterer.pluralize | public function pluralize()
{
if($this->getParameter('upperCaseFirst') == 'true')
return ucfirst(StringUtils::pluralize($this->getParameter('value')));
return StringUtils::pluralize($this->getParameter('value'));
} | php | public function pluralize()
{
if($this->getParameter('upperCaseFirst') == 'true')
return ucfirst(StringUtils::pluralize($this->getParameter('value')));
return StringUtils::pluralize($this->getParameter('value'));
} | [
"public",
"function",
"pluralize",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getParameter",
"(",
"'upperCaseFirst'",
")",
"==",
"'true'",
")",
"return",
"ucfirst",
"(",
"StringUtils",
"::",
"pluralize",
"(",
"$",
"this",
"->",
"getParameter",
"(",
"'va... | Returns the plural version of the parameter in 'value'
Expected Params:
value string the string to pluralize
upperCaseFirst string if set to 'true' then the result string will be Capitalized
@return string | [
"Returns",
"the",
"plural",
"version",
"of",
"the",
"parameter",
"in",
"value"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/mvc/filters/DisplayFilterer.php#L457-L463 |
199,303 | wb-crowdfusion/crowdfusion | system/core/classes/mvc/filters/DisplayFilterer.php | DisplayFilterer.repeat | public function repeat()
{
if ($this->getParameter('value') == null)
return;
$value = $this->getParameter('value');
$multiplier = $this->getParameter('multiplier');
$offset = $this->getParameter('offset');
return str_repeat($value, (int)$multiplier + (int)$offset... | php | public function repeat()
{
if ($this->getParameter('value') == null)
return;
$value = $this->getParameter('value');
$multiplier = $this->getParameter('multiplier');
$offset = $this->getParameter('offset');
return str_repeat($value, (int)$multiplier + (int)$offset... | [
"public",
"function",
"repeat",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"getParameter",
"(",
"'value'",
")",
"==",
"null",
")",
"return",
";",
"$",
"value",
"=",
"$",
"this",
"->",
"getParameter",
"(",
"'value'",
")",
";",
"$",
"multiplier",
"="... | Returns the supplied snippet repeated X times
Expected Params:
value string the string to repeat
multiplier int the number of times to repeat the value
@return string | [
"Returns",
"the",
"supplied",
"snippet",
"repeated",
"X",
"times"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/mvc/filters/DisplayFilterer.php#L483-L492 |
199,304 | wb-crowdfusion/crowdfusion | system/core/classes/mvc/filters/DisplayFilterer.php | DisplayFilterer.implode | public function implode()
{
if (!is_array($this->getParameter('value'))) {
return $this->getParameter('value');
}
$glue = $this->getParameter('glue');
if ($glue === null) {
$glue = ' ';
}
return implode($glue, $this->getParameter('value'... | php | public function implode()
{
if (!is_array($this->getParameter('value'))) {
return $this->getParameter('value');
}
$glue = $this->getParameter('glue');
if ($glue === null) {
$glue = ' ';
}
return implode($glue, $this->getParameter('value'... | [
"public",
"function",
"implode",
"(",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"this",
"->",
"getParameter",
"(",
"'value'",
")",
")",
")",
"{",
"return",
"$",
"this",
"->",
"getParameter",
"(",
"'value'",
")",
";",
"}",
"$",
"glue",
"=",
"$... | Implode Array to String
@return string | [
"Implode",
"Array",
"to",
"String"
] | 8cad7988f046a6fefbed07d026cb4ae6706c1217 | https://github.com/wb-crowdfusion/crowdfusion/blob/8cad7988f046a6fefbed07d026cb4ae6706c1217/system/core/classes/mvc/filters/DisplayFilterer.php#L528-L541 |
199,305 | Vectrex/vxPHP | src/Orm/Query.php | Query.sortBy | public function sortBy($columnName, $asc = TRUE) {
$sort = new \stdClass();
$sort->column = $columnName;
$sort->asc = !!$asc;
$this->columnSorts[] = $sort;
return $this;
} | php | public function sortBy($columnName, $asc = TRUE) {
$sort = new \stdClass();
$sort->column = $columnName;
$sort->asc = !!$asc;
$this->columnSorts[] = $sort;
return $this;
} | [
"public",
"function",
"sortBy",
"(",
"$",
"columnName",
",",
"$",
"asc",
"=",
"TRUE",
")",
"{",
"$",
"sort",
"=",
"new",
"\\",
"stdClass",
"(",
")",
";",
"$",
"sort",
"->",
"column",
"=",
"$",
"columnName",
";",
"$",
"sort",
"->",
"asc",
"=",
"!"... | add ORDER BY clause
@param string $columnName
@param boolean $asc
@return \vxPHP\Orm\Query | [
"add",
"ORDER",
"BY",
"clause"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Orm/Query.php#L128-L139 |
199,306 | Vectrex/vxPHP | src/Orm/Query.php | Query.buildQueryString | protected function buildQueryString() {
$w = [];
$s = [];
$qc = $this->quoteChar;
// start SQL statement
$this->sql = 'SELECT ';
// add columns
if(!$this->columns || !count($this->columns)) {
$this->sql .= '*';
}
else {
$this->sql .= $qc . str_replace('.', $qc . '.' . $qc, implode($qc ... | php | protected function buildQueryString() {
$w = [];
$s = [];
$qc = $this->quoteChar;
// start SQL statement
$this->sql = 'SELECT ';
// add columns
if(!$this->columns || !count($this->columns)) {
$this->sql .= '*';
}
else {
$this->sql .= $qc . str_replace('.', $qc . '.' . $qc, implode($qc ... | [
"protected",
"function",
"buildQueryString",
"(",
")",
"{",
"$",
"w",
"=",
"[",
"]",
";",
"$",
"s",
"=",
"[",
"]",
";",
"$",
"qc",
"=",
"$",
"this",
"->",
"quoteChar",
";",
"// start SQL statement",
"$",
"this",
"->",
"sql",
"=",
"'SELECT '",
";",
... | builds query string by parsing WHERE and ORDER BY clauses
@todo column names are currently masked in MySQL style
@todo incomplete masking (e.g. ON clauses) | [
"builds",
"query",
"string",
"by",
"parsing",
"WHERE",
"and",
"ORDER",
"BY",
"clauses"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Orm/Query.php#L225-L308 |
199,307 | Vectrex/vxPHP | src/Orm/Query.php | Query.buildValuesArray | protected function buildValuesArray() {
foreach($this->whereClauses as $where) {
if(is_null($where->value)) {
continue;
}
if(is_array($where->value)) {
$this->valuesToBind = array_merge($this->valuesToBind, $where->value);
}
else {
$this->valuesToBind[] = $where->value;
}
}
} | php | protected function buildValuesArray() {
foreach($this->whereClauses as $where) {
if(is_null($where->value)) {
continue;
}
if(is_array($where->value)) {
$this->valuesToBind = array_merge($this->valuesToBind, $where->value);
}
else {
$this->valuesToBind[] = $where->value;
}
}
} | [
"protected",
"function",
"buildValuesArray",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"whereClauses",
"as",
"$",
"where",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"where",
"->",
"value",
")",
")",
"{",
"continue",
";",
"}",
"if",
"(",
"is_a... | prepares array containing values which must be bound to prepared statement | [
"prepares",
"array",
"containing",
"values",
"which",
"must",
"be",
"bound",
"to",
"prepared",
"statement"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Orm/Query.php#L313-L329 |
199,308 | Vectrex/vxPHP | src/Orm/Query.php | Query.executeQuery | protected function executeQuery() {
$this->lastQuerySql = $this->sql;
return $this->dbConnection->doPreparedQuery($this->sql, $this->valuesToBind);
} | php | protected function executeQuery() {
$this->lastQuerySql = $this->sql;
return $this->dbConnection->doPreparedQuery($this->sql, $this->valuesToBind);
} | [
"protected",
"function",
"executeQuery",
"(",
")",
"{",
"$",
"this",
"->",
"lastQuerySql",
"=",
"$",
"this",
"->",
"sql",
";",
"return",
"$",
"this",
"->",
"dbConnection",
"->",
"doPreparedQuery",
"(",
"$",
"this",
"->",
"sql",
",",
"$",
"this",
"->",
... | bind values and execute the SQL statement
returns array of records
@todo caching/do not prepare statement again, if query hasn't changed
@return array | [
"bind",
"values",
"and",
"execute",
"the",
"SQL",
"statement",
"returns",
"array",
"of",
"records"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Orm/Query.php#L339-L344 |
199,309 | moaction/jsonrpc-common | src/Moaction/Jsonrpc/Common/Error.php | Error.fromArray | public static function fromArray(array $data)
{
return new self(
!empty($data['code']) ? $data['code'] : null,
!empty($data['message']) ? $data['message'] : null,
!empty($data['data']) ? $data['data'] : null
);
} | php | public static function fromArray(array $data)
{
return new self(
!empty($data['code']) ? $data['code'] : null,
!empty($data['message']) ? $data['message'] : null,
!empty($data['data']) ? $data['data'] : null
);
} | [
"public",
"static",
"function",
"fromArray",
"(",
"array",
"$",
"data",
")",
"{",
"return",
"new",
"self",
"(",
"!",
"empty",
"(",
"$",
"data",
"[",
"'code'",
"]",
")",
"?",
"$",
"data",
"[",
"'code'",
"]",
":",
"null",
",",
"!",
"empty",
"(",
"$... | Create object from array
@param array $data
@return self | [
"Create",
"object",
"from",
"array"
] | 05692a2c58d647f20f11b6f7b9568c8fff2d5f8c | https://github.com/moaction/jsonrpc-common/blob/05692a2c58d647f20f11b6f7b9568c8fff2d5f8c/src/Moaction/Jsonrpc/Common/Error.php#L97-L104 |
199,310 | moaction/jsonrpc-common | src/Moaction/Jsonrpc/Common/Error.php | Error.toArray | public function toArray()
{
$error = array(
'code' => $this->getCode(),
'message' => $this->getMessage(),
);
if ($this->getData()) {
$error['data'] = $this->getData();
}
return $error;
} | php | public function toArray()
{
$error = array(
'code' => $this->getCode(),
'message' => $this->getMessage(),
);
if ($this->getData()) {
$error['data'] = $this->getData();
}
return $error;
} | [
"public",
"function",
"toArray",
"(",
")",
"{",
"$",
"error",
"=",
"array",
"(",
"'code'",
"=>",
"$",
"this",
"->",
"getCode",
"(",
")",
",",
"'message'",
"=>",
"$",
"this",
"->",
"getMessage",
"(",
")",
",",
")",
";",
"if",
"(",
"$",
"this",
"->... | Transform object to array
@return array | [
"Transform",
"object",
"to",
"array"
] | 05692a2c58d647f20f11b6f7b9568c8fff2d5f8c | https://github.com/moaction/jsonrpc-common/blob/05692a2c58d647f20f11b6f7b9568c8fff2d5f8c/src/Moaction/Jsonrpc/Common/Error.php#L111-L123 |
199,311 | moaction/jsonrpc-common | src/Moaction/Jsonrpc/Common/Error.php | Error.getMessageString | public function getMessageString($errorCode)
{
return isset($this->errorMessages[$errorCode]) ? $this->errorMessages[$errorCode] : null;
} | php | public function getMessageString($errorCode)
{
return isset($this->errorMessages[$errorCode]) ? $this->errorMessages[$errorCode] : null;
} | [
"public",
"function",
"getMessageString",
"(",
"$",
"errorCode",
")",
"{",
"return",
"isset",
"(",
"$",
"this",
"->",
"errorMessages",
"[",
"$",
"errorCode",
"]",
")",
"?",
"$",
"this",
"->",
"errorMessages",
"[",
"$",
"errorCode",
"]",
":",
"null",
";",... | Return message string by code
@param $errorCode
@return string|null | [
"Return",
"message",
"string",
"by",
"code"
] | 05692a2c58d647f20f11b6f7b9568c8fff2d5f8c | https://github.com/moaction/jsonrpc-common/blob/05692a2c58d647f20f11b6f7b9568c8fff2d5f8c/src/Moaction/Jsonrpc/Common/Error.php#L131-L134 |
199,312 | squareproton/Bond | src/Bond/BackTrace.php | BackTrace.getSane | public function getSane( $shift = 1, $limitOrFilter = null )
{
$backtrace = $this->trace;
while( $shift-- > 0 ) {
array_shift( $backtrace );
}
if( is_numeric( $limitOrFilter ) ){
$backtrace = array_slice( $backtrace, 0, (int) $limitOrFilter );
... | php | public function getSane( $shift = 1, $limitOrFilter = null )
{
$backtrace = $this->trace;
while( $shift-- > 0 ) {
array_shift( $backtrace );
}
if( is_numeric( $limitOrFilter ) ){
$backtrace = array_slice( $backtrace, 0, (int) $limitOrFilter );
... | [
"public",
"function",
"getSane",
"(",
"$",
"shift",
"=",
"1",
",",
"$",
"limitOrFilter",
"=",
"null",
")",
"{",
"$",
"backtrace",
"=",
"$",
"this",
"->",
"trace",
";",
"while",
"(",
"$",
"shift",
"--",
">",
"0",
")",
"{",
"array_shift",
"(",
"$",
... | Shift trace, filter as required and fix the arguments object
@return array | [
"Shift",
"trace",
"filter",
"as",
"required",
"and",
"fix",
"the",
"arguments",
"object"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/BackTrace.php#L76-L112 |
199,313 | squareproton/Bond | src/Bond/BackTrace.php | BackTrace.traceComponentMakeSane | private function traceComponentMakeSane( $trace )
{
// debugging wondering why some traces's don't have a args object set
if( isset( $trace['args'] ) ) {
$trace['args'] = array_map(
function($arg){
switch(true) {
case is_object(... | php | private function traceComponentMakeSane( $trace )
{
// debugging wondering why some traces's don't have a args object set
if( isset( $trace['args'] ) ) {
$trace['args'] = array_map(
function($arg){
switch(true) {
case is_object(... | [
"private",
"function",
"traceComponentMakeSane",
"(",
"$",
"trace",
")",
"{",
"// debugging wondering why some traces's don't have a args object set",
"if",
"(",
"isset",
"(",
"$",
"trace",
"[",
"'args'",
"]",
")",
")",
"{",
"$",
"trace",
"[",
"'args'",
"]",
"=",
... | Format a trace into a more managable output when massive objects are involved
@param array $trace
@return array | [
"Format",
"a",
"trace",
"into",
"a",
"more",
"managable",
"output",
"when",
"massive",
"objects",
"are",
"involved"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/BackTrace.php#L119-L167 |
199,314 | net-tools/core | src/Containers/Pool.php | Pool.release | public function release($item)
{
// search the item in the used items array
$k = array_search($item, $this->_inUseItems);
if ( $k === FALSE )
return;
// remove it from the used items and adding it to the pool
unset($this->_inUseItems[$k]);
$this->_poolItems[] = $item;
} | php | public function release($item)
{
// search the item in the used items array
$k = array_search($item, $this->_inUseItems);
if ( $k === FALSE )
return;
// remove it from the used items and adding it to the pool
unset($this->_inUseItems[$k]);
$this->_poolItems[] = $item;
} | [
"public",
"function",
"release",
"(",
"$",
"item",
")",
"{",
"// search the item in the used items array",
"$",
"k",
"=",
"array_search",
"(",
"$",
"item",
",",
"$",
"this",
"->",
"_inUseItems",
")",
";",
"if",
"(",
"$",
"k",
"===",
"FALSE",
")",
"return",... | Free an item, and replace it in the pool
@param object $item Item to release and replace in the pool | [
"Free",
"an",
"item",
"and",
"replace",
"it",
"in",
"the",
"pool"
] | 51446641cee22c0cf53d2b409c76cc8bd1a187e7 | https://github.com/net-tools/core/blob/51446641cee22c0cf53d2b409c76cc8bd1a187e7/src/Containers/Pool.php#L98-L108 |
199,315 | phossa/phossa-logger | src/Phossa/Logger/LogLevel.php | LogLevel.getLevelCode | public static function getLevelCode(
/*# string */ $level
)/*# : int */ {
if (is_string($level) &&
isset(self::$levels[$level])) {
return self::$levels[$level];
}
throw new Exception\InvalidArgumentException(
Message::get(
Message:... | php | public static function getLevelCode(
/*# string */ $level
)/*# : int */ {
if (is_string($level) &&
isset(self::$levels[$level])) {
return self::$levels[$level];
}
throw new Exception\InvalidArgumentException(
Message::get(
Message:... | [
"public",
"static",
"function",
"getLevelCode",
"(",
"/*# string */",
"$",
"level",
")",
"/*# : int */",
"{",
"if",
"(",
"is_string",
"(",
"$",
"level",
")",
"&&",
"isset",
"(",
"self",
"::",
"$",
"levels",
"[",
"$",
"level",
"]",
")",
")",
"{",
"retur... | Get level code by name
@param string $level level name
@return int
@access public
@throws Exception\InvalidArgumentException
if $throwException and not the right level name
@static
@api | [
"Get",
"level",
"code",
"by",
"name"
] | dfec8a1e6015c66d2aa77134077902fd3d49e41d | https://github.com/phossa/phossa-logger/blob/dfec8a1e6015c66d2aa77134077902fd3d49e41d/src/Phossa/Logger/LogLevel.php#L63-L78 |
199,316 | Subscribo/klarna-invoice-sdk-wrapped | src/klarnacalc.php | KlarnaCalc._irr | private static function _irr($pval, $payarray, $fromdayone)
{
$low = 0.0;
$high = 100.0;
$lowval = self::_npv($pval, $payarray, $low, $fromdayone);
$highval = self::_npv($pval, $payarray, $high, $fromdayone);
// The sum of $payarray is smaller than $pval, impossible!
... | php | private static function _irr($pval, $payarray, $fromdayone)
{
$low = 0.0;
$high = 100.0;
$lowval = self::_npv($pval, $payarray, $low, $fromdayone);
$highval = self::_npv($pval, $payarray, $high, $fromdayone);
// The sum of $payarray is smaller than $pval, impossible!
... | [
"private",
"static",
"function",
"_irr",
"(",
"$",
"pval",
",",
"$",
"payarray",
",",
"$",
"fromdayone",
")",
"{",
"$",
"low",
"=",
"0.0",
";",
"$",
"high",
"=",
"100.0",
";",
"$",
"lowval",
"=",
"self",
"::",
"_npv",
"(",
"$",
"pval",
",",
"$",
... | This function uses divide and conquer to numerically find the IRR,
Internal Rate of Return. It starts of by trying a low of 0% and a
high of 100%. If this isn't enough it will double the interval up
to 1000000%. Note that this is insanely high, and if you try to convert
an IRR that high to an APR you will get even more... | [
"This",
"function",
"uses",
"divide",
"and",
"conquer",
"to",
"numerically",
"find",
"the",
"IRR",
"Internal",
"Rate",
"of",
"Return",
".",
"It",
"starts",
"of",
"by",
"trying",
"a",
"low",
"of",
"0%",
"and",
"a",
"high",
"of",
"100%",
".",
"If",
"this... | 4a45ddd9ec444f5a6d02628ad65e635a3e12611c | https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/klarnacalc.php#L114-L153 |
199,317 | Subscribo/klarna-invoice-sdk-wrapped | src/klarnacalc.php | KlarnaCalc._fulpacc | private static function _fulpacc(
$pval, $rate, $fee, $minpay, $payment, $months, $base
) {
$bal = $pval;
$payarray = array();
while (($months != 0) && ($bal > self::$accuracy)) {
$interest = $bal * $rate / (100.0 * 12);
$newbal = $bal + $interest + $fee;
... | php | private static function _fulpacc(
$pval, $rate, $fee, $minpay, $payment, $months, $base
) {
$bal = $pval;
$payarray = array();
while (($months != 0) && ($bal > self::$accuracy)) {
$interest = $bal * $rate / (100.0 * 12);
$newbal = $bal + $interest + $fee;
... | [
"private",
"static",
"function",
"_fulpacc",
"(",
"$",
"pval",
",",
"$",
"rate",
",",
"$",
"fee",
",",
"$",
"minpay",
",",
"$",
"payment",
",",
"$",
"months",
",",
"$",
"base",
")",
"{",
"$",
"bal",
"=",
"$",
"pval",
";",
"$",
"payarray",
"=",
... | This is a simplified model of how our paccengine works if
a client always pays their bills. It adds interest and fees
and checks minimum payments. It will run until the value
of the account reaches 0, and return an array of all the
individual payments. Months is the amount of months to run
the simulation. Important! Do... | [
"This",
"is",
"a",
"simplified",
"model",
"of",
"how",
"our",
"paccengine",
"works",
"if",
"a",
"client",
"always",
"pays",
"their",
"bills",
".",
"It",
"adds",
"interest",
"and",
"fees",
"and",
"checks",
"minimum",
"payments",
".",
"It",
"will",
"run",
... | 4a45ddd9ec444f5a6d02628ad65e635a3e12611c | https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/klarnacalc.php#L209-L234 |
199,318 | Subscribo/klarna-invoice-sdk-wrapped | src/klarnacalc.php | KlarnaCalc._aprAnnuity | private static function _aprAnnuity($pval, $months, $rate, $fee, $minpay)
{
$payment = self::_annuity($pval, $months, $rate) + $fee;
if ($payment < 0) {
return $payment;
}
$payarray = self::_fulpacc(
$pval, $rate, $fee, $minpay, $payment, $months, false
... | php | private static function _aprAnnuity($pval, $months, $rate, $fee, $minpay)
{
$payment = self::_annuity($pval, $months, $rate) + $fee;
if ($payment < 0) {
return $payment;
}
$payarray = self::_fulpacc(
$pval, $rate, $fee, $minpay, $payment, $months, false
... | [
"private",
"static",
"function",
"_aprAnnuity",
"(",
"$",
"pval",
",",
"$",
"months",
",",
"$",
"rate",
",",
"$",
"fee",
",",
"$",
"minpay",
")",
"{",
"$",
"payment",
"=",
"self",
"::",
"_annuity",
"(",
"$",
"pval",
",",
"$",
"months",
",",
"$",
... | Calculate the APR for an annuity given the following inputs.
If you give it bad inputs, it will return negative values.
@param float $pval principal value
@param int $months months to pay off in
@param float $rate interest rate in % as before
@param float $fee monthly fee
@param float $minpay minimum payment... | [
"Calculate",
"the",
"APR",
"for",
"an",
"annuity",
"given",
"the",
"following",
"inputs",
"."
] | 4a45ddd9ec444f5a6d02628ad65e635a3e12611c | https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/klarnacalc.php#L278-L290 |
199,319 | Subscribo/klarna-invoice-sdk-wrapped | src/klarnacalc.php | KlarnaCalc._getPayArray | private static function _getPayArray($sum, $pclass, $flags)
{
$monthsfee = 0;
if ($flags === KlarnaFlags::CHECKOUT_PAGE) {
$monthsfee = $pclass->getInvoiceFee();
}
$startfee = 0;
if ($flags === KlarnaFlags::CHECKOUT_PAGE) {
$startfee = $pclass->getStar... | php | private static function _getPayArray($sum, $pclass, $flags)
{
$monthsfee = 0;
if ($flags === KlarnaFlags::CHECKOUT_PAGE) {
$monthsfee = $pclass->getInvoiceFee();
}
$startfee = 0;
if ($flags === KlarnaFlags::CHECKOUT_PAGE) {
$startfee = $pclass->getStar... | [
"private",
"static",
"function",
"_getPayArray",
"(",
"$",
"sum",
",",
"$",
"pclass",
",",
"$",
"flags",
")",
"{",
"$",
"monthsfee",
"=",
"0",
";",
"if",
"(",
"$",
"flags",
"===",
"KlarnaFlags",
"::",
"CHECKOUT_PAGE",
")",
"{",
"$",
"monthsfee",
"=",
... | Grabs the array of all monthly payments for specified PClass.
<b>Flags can be either</b>:<br>
{@link KlarnaFlags::CHECKOUT_PAGE}<br>
{@link KlarnaFlags::PRODUCT_PAGE}<br>
@param float $sum The sum for the order/product.
@param KlarnaPClass $pclass KlarnaPClass used to calculate the APR.
@param int ... | [
"Grabs",
"the",
"array",
"of",
"all",
"monthly",
"payments",
"for",
"specified",
"PClass",
"."
] | 4a45ddd9ec444f5a6d02628ad65e635a3e12611c | https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/klarnacalc.php#L306-L347 |
199,320 | Subscribo/klarna-invoice-sdk-wrapped | src/klarnacalc.php | KlarnaCalc.pRound | public static function pRound($value, $country)
{
$multiply = 1; //Round to closest integer
$country = KlarnaCountry::getCode($country);
switch($country) {
case "FI":
case "DE":
case "NL":
case "AT":
$multiply = 10; //Round to closest decimal
... | php | public static function pRound($value, $country)
{
$multiply = 1; //Round to closest integer
$country = KlarnaCountry::getCode($country);
switch($country) {
case "FI":
case "DE":
case "NL":
case "AT":
$multiply = 10; //Round to closest decimal
... | [
"public",
"static",
"function",
"pRound",
"(",
"$",
"value",
",",
"$",
"country",
")",
"{",
"$",
"multiply",
"=",
"1",
";",
"//Round to closest integer",
"$",
"country",
"=",
"KlarnaCountry",
"::",
"getCode",
"(",
"$",
"country",
")",
";",
"switch",
"(",
... | Rounds a value depending on the specified country.
@param int|float $value The value to be rounded.
@param int $country KlarnaCountry constant.
@return float|int | [
"Rounds",
"a",
"value",
"depending",
"on",
"the",
"specified",
"country",
"."
] | 4a45ddd9ec444f5a6d02628ad65e635a3e12611c | https://github.com/Subscribo/klarna-invoice-sdk-wrapped/blob/4a45ddd9ec444f5a6d02628ad65e635a3e12611c/src/klarnacalc.php#L638-L652 |
199,321 | mossphp/moss-storage | Moss/Storage/Query/Relation/AbstractRelation.php | AbstractRelation.where | public function where($field, $value, $comparison = '==', $logical = 'and')
{
$this->conditions[] = [$field, $value, $comparison, $logical];
return $this;
} | php | public function where($field, $value, $comparison = '==', $logical = 'and')
{
$this->conditions[] = [$field, $value, $comparison, $logical];
return $this;
} | [
"public",
"function",
"where",
"(",
"$",
"field",
",",
"$",
"value",
",",
"$",
"comparison",
"=",
"'=='",
",",
"$",
"logical",
"=",
"'and'",
")",
"{",
"$",
"this",
"->",
"conditions",
"[",
"]",
"=",
"[",
"$",
"field",
",",
"$",
"value",
",",
"$",... | Adds where condition to relation
@param mixed $field
@param mixed $value
@param string $comparison
@param string $logical
@return $this | [
"Adds",
"where",
"condition",
"to",
"relation"
] | 0d123e7ae6bbfce1e2a18e73bf70997277b430c1 | https://github.com/mossphp/moss-storage/blob/0d123e7ae6bbfce1e2a18e73bf70997277b430c1/Moss/Storage/Query/Relation/AbstractRelation.php#L116-L121 |
199,322 | mossphp/moss-storage | Moss/Storage/Query/Relation/AbstractRelation.php | AbstractRelation.buildLocalKey | protected function buildLocalKey($entity, array $pairs)
{
$keys = array_keys($pairs);
return $this->buildKey($entity, array_combine($keys, $keys));
} | php | protected function buildLocalKey($entity, array $pairs)
{
$keys = array_keys($pairs);
return $this->buildKey($entity, array_combine($keys, $keys));
} | [
"protected",
"function",
"buildLocalKey",
"(",
"$",
"entity",
",",
"array",
"$",
"pairs",
")",
"{",
"$",
"keys",
"=",
"array_keys",
"(",
"$",
"pairs",
")",
";",
"return",
"$",
"this",
"->",
"buildKey",
"(",
"$",
"entity",
",",
"array_combine",
"(",
"$"... | Builds local key from field property pairs
@param mixed $entity
@param array $pairs
@return string | [
"Builds",
"local",
"key",
"from",
"field",
"property",
"pairs"
] | 0d123e7ae6bbfce1e2a18e73bf70997277b430c1 | https://github.com/mossphp/moss-storage/blob/0d123e7ae6bbfce1e2a18e73bf70997277b430c1/Moss/Storage/Query/Relation/AbstractRelation.php#L162-L167 |
199,323 | mossphp/moss-storage | Moss/Storage/Query/Relation/AbstractRelation.php | AbstractRelation.buildKey | protected function buildKey($entity, array $pairs)
{
$key = [];
foreach ($pairs as $local => $refer) {
$key[] = $local . ':' . $this->accessor->getPropertyValue($entity, $refer);
}
return implode('-', $key);
} | php | protected function buildKey($entity, array $pairs)
{
$key = [];
foreach ($pairs as $local => $refer) {
$key[] = $local . ':' . $this->accessor->getPropertyValue($entity, $refer);
}
return implode('-', $key);
} | [
"protected",
"function",
"buildKey",
"(",
"$",
"entity",
",",
"array",
"$",
"pairs",
")",
"{",
"$",
"key",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"pairs",
"as",
"$",
"local",
"=>",
"$",
"refer",
")",
"{",
"$",
"key",
"[",
"]",
"=",
"$",
"loca... | Builds key from key-value pairs
@param mixed $entity
@param array $pairs
@return string | [
"Builds",
"key",
"from",
"key",
"-",
"value",
"pairs"
] | 0d123e7ae6bbfce1e2a18e73bf70997277b430c1 | https://github.com/mossphp/moss-storage/blob/0d123e7ae6bbfce1e2a18e73bf70997277b430c1/Moss/Storage/Query/Relation/AbstractRelation.php#L190-L198 |
199,324 | mossphp/moss-storage | Moss/Storage/Query/Relation/AbstractRelation.php | AbstractRelation.fetch | protected function fetch($entityName, array $conditions, $result = false)
{
$query = $this->storage->read($entityName);
foreach ($conditions as $field => $values) {
$query->where($field, $values);
}
if (!$result) {
return $query->execute();
}
... | php | protected function fetch($entityName, array $conditions, $result = false)
{
$query = $this->storage->read($entityName);
foreach ($conditions as $field => $values) {
$query->where($field, $values);
}
if (!$result) {
return $query->execute();
}
... | [
"protected",
"function",
"fetch",
"(",
"$",
"entityName",
",",
"array",
"$",
"conditions",
",",
"$",
"result",
"=",
"false",
")",
"{",
"$",
"query",
"=",
"$",
"this",
"->",
"storage",
"->",
"read",
"(",
"$",
"entityName",
")",
";",
"foreach",
"(",
"$... | Fetches collection of entities matching set conditions
Optionally sorts it and limits it
@param string $entityName
@param array $conditions
@param bool $result
@return array | [
"Fetches",
"collection",
"of",
"entities",
"matching",
"set",
"conditions",
"Optionally",
"sorts",
"it",
"and",
"limits",
"it"
] | 0d123e7ae6bbfce1e2a18e73bf70997277b430c1 | https://github.com/mossphp/moss-storage/blob/0d123e7ae6bbfce1e2a18e73bf70997277b430c1/Moss/Storage/Query/Relation/AbstractRelation.php#L210-L239 |
199,325 | mossphp/moss-storage | Moss/Storage/Query/Relation/AbstractRelation.php | AbstractRelation.assertInstance | protected function assertInstance($entity)
{
$entityClass = $this->definition->entity();
if (!$entity instanceof $entityClass) {
throw new RelationException(sprintf('Relation entity must be instance of %s, got %s', $entityClass, $this->getType($entity)));
}
return true;
... | php | protected function assertInstance($entity)
{
$entityClass = $this->definition->entity();
if (!$entity instanceof $entityClass) {
throw new RelationException(sprintf('Relation entity must be instance of %s, got %s', $entityClass, $this->getType($entity)));
}
return true;
... | [
"protected",
"function",
"assertInstance",
"(",
"$",
"entity",
")",
"{",
"$",
"entityClass",
"=",
"$",
"this",
"->",
"definition",
"->",
"entity",
"(",
")",
";",
"if",
"(",
"!",
"$",
"entity",
"instanceof",
"$",
"entityClass",
")",
"{",
"throw",
"new",
... | Throws exception when entity is not required instance
@param mixed $entity
@return bool
@throws RelationException | [
"Throws",
"exception",
"when",
"entity",
"is",
"not",
"required",
"instance"
] | 0d123e7ae6bbfce1e2a18e73bf70997277b430c1 | https://github.com/mossphp/moss-storage/blob/0d123e7ae6bbfce1e2a18e73bf70997277b430c1/Moss/Storage/Query/Relation/AbstractRelation.php#L249-L257 |
199,326 | mossphp/moss-storage | Moss/Storage/Query/Relation/AbstractRelation.php | AbstractRelation.cleanup | protected function cleanup($entityName, array $collection, array $conditions)
{
if (!$existing = $this->isCleanupNecessary($entityName, $conditions)) {
return;
}
$identifiers = [];
foreach ($collection as $instance) {
$identifiers[] = $this->identifyEntity($i... | php | protected function cleanup($entityName, array $collection, array $conditions)
{
if (!$existing = $this->isCleanupNecessary($entityName, $conditions)) {
return;
}
$identifiers = [];
foreach ($collection as $instance) {
$identifiers[] = $this->identifyEntity($i... | [
"protected",
"function",
"cleanup",
"(",
"$",
"entityName",
",",
"array",
"$",
"collection",
",",
"array",
"$",
"conditions",
")",
"{",
"if",
"(",
"!",
"$",
"existing",
"=",
"$",
"this",
"->",
"isCleanupNecessary",
"(",
"$",
"entityName",
",",
"$",
"cond... | Removes obsolete entities that match conditions but don't exist in collection
@param string $entityName
@param array $collection
@param array $conditions | [
"Removes",
"obsolete",
"entities",
"that",
"match",
"conditions",
"but",
"don",
"t",
"exist",
"in",
"collection"
] | 0d123e7ae6bbfce1e2a18e73bf70997277b430c1 | https://github.com/mossphp/moss-storage/blob/0d123e7ae6bbfce1e2a18e73bf70997277b430c1/Moss/Storage/Query/Relation/AbstractRelation.php#L266-L286 |
199,327 | mossphp/moss-storage | Moss/Storage/Query/Relation/AbstractRelation.php | AbstractRelation.isCleanupNecessary | private function isCleanupNecessary($entityName, $conditions)
{
if (empty($conditions)) {
return false;
}
$existing = $this->fetch($entityName, $conditions);
if (empty($existing)) {
return false;
}
return $existing;
} | php | private function isCleanupNecessary($entityName, $conditions)
{
if (empty($conditions)) {
return false;
}
$existing = $this->fetch($entityName, $conditions);
if (empty($existing)) {
return false;
}
return $existing;
} | [
"private",
"function",
"isCleanupNecessary",
"(",
"$",
"entityName",
",",
"$",
"conditions",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"conditions",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"existing",
"=",
"$",
"this",
"->",
"fetch",
"(",
"$",
... | Returns array with entities that should be deleted or false otherwise
@param string $entityName
@param array $conditions
@return array|bool | [
"Returns",
"array",
"with",
"entities",
"that",
"should",
"be",
"deleted",
"or",
"false",
"otherwise"
] | 0d123e7ae6bbfce1e2a18e73bf70997277b430c1 | https://github.com/mossphp/moss-storage/blob/0d123e7ae6bbfce1e2a18e73bf70997277b430c1/Moss/Storage/Query/Relation/AbstractRelation.php#L296-L309 |
199,328 | mossphp/moss-storage | Moss/Storage/Query/Relation/AbstractRelation.php | AbstractRelation.identifyEntity | protected function identifyEntity($instance, $entityName)
{
$fields = $this->models->get($entityName)->primaryFields();
$id = [];
foreach ($fields as $field) {
$id[] = $this->accessor->getPropertyValue($instance, $field->name());
}
return implode(':', $id);
... | php | protected function identifyEntity($instance, $entityName)
{
$fields = $this->models->get($entityName)->primaryFields();
$id = [];
foreach ($fields as $field) {
$id[] = $this->accessor->getPropertyValue($instance, $field->name());
}
return implode(':', $id);
... | [
"protected",
"function",
"identifyEntity",
"(",
"$",
"instance",
",",
"$",
"entityName",
")",
"{",
"$",
"fields",
"=",
"$",
"this",
"->",
"models",
"->",
"get",
"(",
"$",
"entityName",
")",
"->",
"primaryFields",
"(",
")",
";",
"$",
"id",
"=",
"[",
"... | Returns entity identifier
If more than one primary keys, entity will not be identified
@param object $instance
@param string $entityName
@return string | [
"Returns",
"entity",
"identifier",
"If",
"more",
"than",
"one",
"primary",
"keys",
"entity",
"will",
"not",
"be",
"identified"
] | 0d123e7ae6bbfce1e2a18e73bf70997277b430c1 | https://github.com/mossphp/moss-storage/blob/0d123e7ae6bbfce1e2a18e73bf70997277b430c1/Moss/Storage/Query/Relation/AbstractRelation.php#L320-L330 |
199,329 | mossphp/moss-storage | Moss/Storage/Query/Relation/AbstractRelation.php | AbstractRelation.assertArrayAccess | protected function assertArrayAccess($container)
{
if (!$container instanceof \Traversable && !is_array($container)) {
throw new RelationException(sprintf('Relation container must be array or instance of ArrayAccess, got %s', $this->getType($container)));
}
} | php | protected function assertArrayAccess($container)
{
if (!$container instanceof \Traversable && !is_array($container)) {
throw new RelationException(sprintf('Relation container must be array or instance of ArrayAccess, got %s', $this->getType($container)));
}
} | [
"protected",
"function",
"assertArrayAccess",
"(",
"$",
"container",
")",
"{",
"if",
"(",
"!",
"$",
"container",
"instanceof",
"\\",
"Traversable",
"&&",
"!",
"is_array",
"(",
"$",
"container",
")",
")",
"{",
"throw",
"new",
"RelationException",
"(",
"sprint... | Checks if container has array access
@param $container
@throws RelationException | [
"Checks",
"if",
"container",
"has",
"array",
"access"
] | 0d123e7ae6bbfce1e2a18e73bf70997277b430c1 | https://github.com/mossphp/moss-storage/blob/0d123e7ae6bbfce1e2a18e73bf70997277b430c1/Moss/Storage/Query/Relation/AbstractRelation.php#L339-L344 |
199,330 | SlaxWeb/Database | src/BaseModelResult.php | BaseModelResult.row | public function row(int $row): bool
{
$this->resultExists();
return $this->result->row($row);
} | php | public function row(int $row): bool
{
$this->resultExists();
return $this->result->row($row);
} | [
"public",
"function",
"row",
"(",
"int",
"$",
"row",
")",
":",
"bool",
"{",
"$",
"this",
"->",
"resultExists",
"(",
")",
";",
"return",
"$",
"this",
"->",
"result",
"->",
"row",
"(",
"$",
"row",
")",
";",
"}"
] | Jump to row
Check if the Result object has been set and forwards the call to the 'row'
method in the Result object.
@param int $row Row number
@return bool | [
"Jump",
"to",
"row"
] | 75fb701cda426eccb99e7604f6c7ddb0eb81a572 | https://github.com/SlaxWeb/Database/blob/75fb701cda426eccb99e7604f6c7ddb0eb81a572/src/BaseModelResult.php#L80-L84 |
199,331 | Torann/skosh-generator | src/AssetManifest.php | AssetManifest.load | public function load()
{
$file = BASE_PATH . '/rev-manifest.json';
if (file_exists($file)) {
$this->manifest = json_decode(file_get_contents($file), true);
}
} | php | public function load()
{
$file = BASE_PATH . '/rev-manifest.json';
if (file_exists($file)) {
$this->manifest = json_decode(file_get_contents($file), true);
}
} | [
"public",
"function",
"load",
"(",
")",
"{",
"$",
"file",
"=",
"BASE_PATH",
".",
"'/rev-manifest.json'",
";",
"if",
"(",
"file_exists",
"(",
"$",
"file",
")",
")",
"{",
"$",
"this",
"->",
"manifest",
"=",
"json_decode",
"(",
"file_get_contents",
"(",
"$"... | Load manifest file | [
"Load",
"manifest",
"file"
] | ea60e037d92398d7c146eb2349735d5692e3c48c | https://github.com/Torann/skosh-generator/blob/ea60e037d92398d7c146eb2349735d5692e3c48c/src/AssetManifest.php#L38-L45 |
199,332 | balintsera/evista-perform | src/ValueObject/UploadedFile.php | UploadedFile.findRealType | public function findRealType()
{
$finfo = new \finfo();
// Move file to the upload folder for checking
$fileName = md5(microtime());
$destination = $this->uploadDir;
move_uploaded_file($this->tmpName, $destination.'/'.$fileName);
$this->realType = $finfo->file($destin... | php | public function findRealType()
{
$finfo = new \finfo();
// Move file to the upload folder for checking
$fileName = md5(microtime());
$destination = $this->uploadDir;
move_uploaded_file($this->tmpName, $destination.'/'.$fileName);
$this->realType = $finfo->file($destin... | [
"public",
"function",
"findRealType",
"(",
")",
"{",
"$",
"finfo",
"=",
"new",
"\\",
"finfo",
"(",
")",
";",
"// Move file to the upload folder for checking",
"$",
"fileName",
"=",
"md5",
"(",
"microtime",
"(",
")",
")",
";",
"$",
"destination",
"=",
"$",
... | adds real file type
@return [type] [description] | [
"adds",
"real",
"file",
"type"
] | 2b8723852ebe824ed721f30293e1e0d2c14f4b21 | https://github.com/balintsera/evista-perform/blob/2b8723852ebe824ed721f30293e1e0d2c14f4b21/src/ValueObject/UploadedFile.php#L121-L133 |
199,333 | pMatviienko/zf2-common | SbxCommon/src/SbxCommon/Form/View/Helper/Bootstrap/FormRow.php | FormRow.getElementErrorsHelper | protected function getElementErrorsHelper()
{
if ($this->elementErrorsHelper) {
return $this->elementErrorsHelper;
}
if (method_exists($this->view, 'plugin')) {
$this->elementErrorsHelper = $this->view->plugin('bootstrap_form_element_errors');
}
if (... | php | protected function getElementErrorsHelper()
{
if ($this->elementErrorsHelper) {
return $this->elementErrorsHelper;
}
if (method_exists($this->view, 'plugin')) {
$this->elementErrorsHelper = $this->view->plugin('bootstrap_form_element_errors');
}
if (... | [
"protected",
"function",
"getElementErrorsHelper",
"(",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"elementErrorsHelper",
")",
"{",
"return",
"$",
"this",
"->",
"elementErrorsHelper",
";",
"}",
"if",
"(",
"method_exists",
"(",
"$",
"this",
"->",
"view",
",",
... | Retrieve the FormElementErrors helper
@return FormElementErrors | [
"Retrieve",
"the",
"FormElementErrors",
"helper"
] | e59aa9b1eece72437cf0fd7c8466c0daeffcc481 | https://github.com/pMatviienko/zf2-common/blob/e59aa9b1eece72437cf0fd7c8466c0daeffcc481/SbxCommon/src/SbxCommon/Form/View/Helper/Bootstrap/FormRow.php#L128-L143 |
199,334 | olobu/olobu | core/loader.php | O_Loader.database | function database($params='', $return=TRUE)
{
$O =& get_instance();
if (class_exists('O_Db_driver') and $return === FALSE and isset($O->db) and is_object($O->db)) {
throw new \Zanda\Orgasm\Fatal('Untuk sambungan ke database tambahan, harus menambahkan parameter $return bernilai TRUE');
}
require_once(BASE... | php | function database($params='', $return=TRUE)
{
$O =& get_instance();
if (class_exists('O_Db_driver') and $return === FALSE and isset($O->db) and is_object($O->db)) {
throw new \Zanda\Orgasm\Fatal('Untuk sambungan ke database tambahan, harus menambahkan parameter $return bernilai TRUE');
}
require_once(BASE... | [
"function",
"database",
"(",
"$",
"params",
"=",
"''",
",",
"$",
"return",
"=",
"TRUE",
")",
"{",
"$",
"O",
"=",
"&",
"get_instance",
"(",
")",
";",
"if",
"(",
"class_exists",
"(",
"'O_Db_driver'",
")",
"and",
"$",
"return",
"===",
"FALSE",
"and",
... | default kalo ada pangge ini, berarti koneksi tambahan | [
"default",
"kalo",
"ada",
"pangge",
"ini",
"berarti",
"koneksi",
"tambahan"
] | 05bea2bff63d3e38b458fb42e8f07f1d850ae211 | https://github.com/olobu/olobu/blob/05bea2bff63d3e38b458fb42e8f07f1d850ae211/core/loader.php#L325-L341 |
199,335 | AlexyaFramework/Tools | Alexya/Tools/Collection.php | Collection.map | public function map(callable $callback) : Collection
{
$result = array_map($callback, array_keys($this->_data), $this->_data);
return new static($result);
} | php | public function map(callable $callback) : Collection
{
$result = array_map($callback, array_keys($this->_data), $this->_data);
return new static($result);
} | [
"public",
"function",
"map",
"(",
"callable",
"$",
"callback",
")",
":",
"Collection",
"{",
"$",
"result",
"=",
"array_map",
"(",
"$",
"callback",
",",
"array_keys",
"(",
"$",
"this",
"->",
"_data",
")",
",",
"$",
"this",
"->",
"_data",
")",
";",
"re... | Maps the array and returns a new object of this class.
Example:
```php
$arr = new \Alexya\Tools\Collection([
"test",
"foo",
"bar",
"tests"
]);
$newArr = $arr->map(function($key, $value) {
$value = strtoupper($value);
return $value;
});
// $newArr = new \Alexya\Tools\Collection([
// "TEST",
// "FOO",
// ... | [
"Maps",
"the",
"array",
"and",
"returns",
"a",
"new",
"object",
"of",
"this",
"class",
"."
] | 2ae7c91cde0517579b926dd872eaf7ea324fd1e4 | https://github.com/AlexyaFramework/Tools/blob/2ae7c91cde0517579b926dd872eaf7ea324fd1e4/Alexya/Tools/Collection.php#L201-L206 |
199,336 | AlexyaFramework/Tools | Alexya/Tools/Collection.php | Collection.walk | public function walk(callable $callback) : void
{
$newData = [];
foreach($this->_data as $key => $value) {
$ret = $callback($key, $value);
$newData[$ret[0]] = $ret[1];
}
$this->_data = $newData;
} | php | public function walk(callable $callback) : void
{
$newData = [];
foreach($this->_data as $key => $value) {
$ret = $callback($key, $value);
$newData[$ret[0]] = $ret[1];
}
$this->_data = $newData;
} | [
"public",
"function",
"walk",
"(",
"callable",
"$",
"callback",
")",
":",
"void",
"{",
"$",
"newData",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"this",
"->",
"_data",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"ret",
"=",
"$",
"callback... | Walks through the array.
The difference between this method and `map` is that
the callback must return an array with two indexes:
* The new key of the item.
* The new value of the item.
This will override the current array while `map` will only loop
through the array and call the callback with the item key and value... | [
"Walks",
"through",
"the",
"array",
"."
] | 2ae7c91cde0517579b926dd872eaf7ea324fd1e4 | https://github.com/AlexyaFramework/Tools/blob/2ae7c91cde0517579b926dd872eaf7ea324fd1e4/Alexya/Tools/Collection.php#L245-L255 |
199,337 | AlexyaFramework/Tools | Alexya/Tools/Collection.php | Collection.accumulate | public function accumulate(callable $callback, $accumulator = "")
{
foreach($this->_data as $key => $value) {
$accumulator = $callback($key, $value, $accumulator);
}
return $accumulator;
} | php | public function accumulate(callable $callback, $accumulator = "")
{
foreach($this->_data as $key => $value) {
$accumulator = $callback($key, $value, $accumulator);
}
return $accumulator;
} | [
"public",
"function",
"accumulate",
"(",
"callable",
"$",
"callback",
",",
"$",
"accumulator",
"=",
"\"\"",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"_data",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"accumulator",
"=",
"$",
"callback",
... | Performs a `array_reduce` action with the array.
This method loops through the array and executes the callback
on each element.
The difference between `accumulate` and `map` and `filter` is that
this method sends the result of each call to the callback as
a second parameter to the callback.
Example:
```php
$arr = n... | [
"Performs",
"a",
"array_reduce",
"action",
"with",
"the",
"array",
"."
] | 2ae7c91cde0517579b926dd872eaf7ea324fd1e4 | https://github.com/AlexyaFramework/Tools/blob/2ae7c91cde0517579b926dd872eaf7ea324fd1e4/Alexya/Tools/Collection.php#L293-L300 |
199,338 | AlexyaFramework/Tools | Alexya/Tools/Collection.php | Collection.combine | public function combine($arr) : Collection
{
if($arr instanceof Collection) {
$arr = $arr->getAll();
}
if(!is_array($arr)) {
return new static([]);
}
return new static(array_combine($this->_data, $arr));
} | php | public function combine($arr) : Collection
{
if($arr instanceof Collection) {
$arr = $arr->getAll();
}
if(!is_array($arr)) {
return new static([]);
}
return new static(array_combine($this->_data, $arr));
} | [
"public",
"function",
"combine",
"(",
"$",
"arr",
")",
":",
"Collection",
"{",
"if",
"(",
"$",
"arr",
"instanceof",
"Collection",
")",
"{",
"$",
"arr",
"=",
"$",
"arr",
"->",
"getAll",
"(",
")",
";",
"}",
"if",
"(",
"!",
"is_array",
"(",
"$",
"ar... | Combines this and another array and returns a new object.
The resulting array will contain the values of this array as key and the values
of the parameter as values:
```php
$keys = new Collection([
"foo" => "bar"
]);
$values = new Collection([
"test" => "test"
]);
$newCollection = $keys->combine($values);
// $newCol... | [
"Combines",
"this",
"and",
"another",
"array",
"and",
"returns",
"a",
"new",
"object",
"."
] | 2ae7c91cde0517579b926dd872eaf7ea324fd1e4 | https://github.com/AlexyaFramework/Tools/blob/2ae7c91cde0517579b926dd872eaf7ea324fd1e4/Alexya/Tools/Collection.php#L326-L337 |
199,339 | AlexyaFramework/Tools | Alexya/Tools/Collection.php | Collection.append | public function append($arr) : void
{
if($arr instanceof Collection) {
$arr = $arr->getAll();
}
if(!is_array($arr)) {
return;
}
foreach($arr as $key => $value) {
$this->_data[$key] = $value;
}
} | php | public function append($arr) : void
{
if($arr instanceof Collection) {
$arr = $arr->getAll();
}
if(!is_array($arr)) {
return;
}
foreach($arr as $key => $value) {
$this->_data[$key] = $value;
}
} | [
"public",
"function",
"append",
"(",
"$",
"arr",
")",
":",
"void",
"{",
"if",
"(",
"$",
"arr",
"instanceof",
"Collection",
")",
"{",
"$",
"arr",
"=",
"$",
"arr",
"->",
"getAll",
"(",
")",
";",
"}",
"if",
"(",
"!",
"is_array",
"(",
"$",
"arr",
"... | Appends the contents of an array to this array.
The indexes with same key will be overwritten.
@param array|Collection $arr Array to append. | [
"Appends",
"the",
"contents",
"of",
"an",
"array",
"to",
"this",
"array",
"."
] | 2ae7c91cde0517579b926dd872eaf7ea324fd1e4 | https://github.com/AlexyaFramework/Tools/blob/2ae7c91cde0517579b926dd872eaf7ea324fd1e4/Alexya/Tools/Collection.php#L346-L359 |
199,340 | AlexyaFramework/Tools | Alexya/Tools/Collection.php | Collection.valueExists | public function valueExists($value, bool $strict = true) : bool
{
foreach($this->_data as $data) {
$ret = ($strict) ? ($data === $value)
: ($data == $value);
if($ret) {
return true;
}
}
return false;
} | php | public function valueExists($value, bool $strict = true) : bool
{
foreach($this->_data as $data) {
$ret = ($strict) ? ($data === $value)
: ($data == $value);
if($ret) {
return true;
}
}
return false;
} | [
"public",
"function",
"valueExists",
"(",
"$",
"value",
",",
"bool",
"$",
"strict",
"=",
"true",
")",
":",
"bool",
"{",
"foreach",
"(",
"$",
"this",
"->",
"_data",
"as",
"$",
"data",
")",
"{",
"$",
"ret",
"=",
"(",
"$",
"strict",
")",
"?",
"(",
... | Checks that a value exists in the array.
@param mixed $value Index value.
@param bool $strict Flag indicating that the value must be exactly the same or not (default = `true`).
@return bool `true` if `$value` exists as a value in the array, `false` if not. | [
"Checks",
"that",
"a",
"value",
"exists",
"in",
"the",
"array",
"."
] | 2ae7c91cde0517579b926dd872eaf7ea324fd1e4 | https://github.com/AlexyaFramework/Tools/blob/2ae7c91cde0517579b926dd872eaf7ea324fd1e4/Alexya/Tools/Collection.php#L502-L514 |
199,341 | AlexyaFramework/Tools | Alexya/Tools/Collection.php | Collection.deleteByValue | public function deleteByValue($value, bool $strict = true) : void
{
foreach($this->_data as $data) {
$exists = ($strict) ? ($data === $value)
: ($data == $value);
if($exists) {
unset($this->_data[$value]);
}
}
} | php | public function deleteByValue($value, bool $strict = true) : void
{
foreach($this->_data as $data) {
$exists = ($strict) ? ($data === $value)
: ($data == $value);
if($exists) {
unset($this->_data[$value]);
}
}
} | [
"public",
"function",
"deleteByValue",
"(",
"$",
"value",
",",
"bool",
"$",
"strict",
"=",
"true",
")",
":",
"void",
"{",
"foreach",
"(",
"$",
"this",
"->",
"_data",
"as",
"$",
"data",
")",
"{",
"$",
"exists",
"=",
"(",
"$",
"strict",
")",
"?",
"... | Deletes an index in the array by its value.
@param mixed $value Index value.
@param bool $strict Flag indicating that the value must be exactly the same or not (default = `true`). | [
"Deletes",
"an",
"index",
"in",
"the",
"array",
"by",
"its",
"value",
"."
] | 2ae7c91cde0517579b926dd872eaf7ea324fd1e4 | https://github.com/AlexyaFramework/Tools/blob/2ae7c91cde0517579b926dd872eaf7ea324fd1e4/Alexya/Tools/Collection.php#L532-L542 |
199,342 | mvccore/ext-router-media | src/MvcCore/Ext/Routers/Media/Preparing.php | Preparing.prepareRequestMediaVersionFromUrl | protected function prepareRequestMediaVersionFromUrl () {
$this->prepareRequestMediaVersionFromUrlQueryString();
if ($this->requestMediaSiteVersion === NULL && $this->anyRoutesConfigured)
$this->prepareRequestMediaVersionFromUrlPath();
if ($this->requestMediaSiteVersion === NULL)
$this->requestMediaSiteVe... | php | protected function prepareRequestMediaVersionFromUrl () {
$this->prepareRequestMediaVersionFromUrlQueryString();
if ($this->requestMediaSiteVersion === NULL && $this->anyRoutesConfigured)
$this->prepareRequestMediaVersionFromUrlPath();
if ($this->requestMediaSiteVersion === NULL)
$this->requestMediaSiteVe... | [
"protected",
"function",
"prepareRequestMediaVersionFromUrl",
"(",
")",
"{",
"$",
"this",
"->",
"prepareRequestMediaVersionFromUrlQueryString",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"requestMediaSiteVersion",
"===",
"NULL",
"&&",
"$",
"this",
"->",
"anyRoutes... | Try to set up into `\MvcCore\Request` object new
media site version detected from requested url by url query string param
or by url path prefix. If there is caught any valid media site
version - set this value into request object. If there is nothing caught,
set into request object full media site version anyway.
@retu... | [
"Try",
"to",
"set",
"up",
"into",
"\\",
"MvcCore",
"\\",
"Request",
"object",
"new",
"media",
"site",
"version",
"detected",
"from",
"requested",
"url",
"by",
"url",
"query",
"string",
"param",
"or",
"by",
"url",
"path",
"prefix",
".",
"If",
"there",
"is... | 976e83290cf25ad6bc32e4824790b5e0d5d4c08b | https://github.com/mvccore/ext-router-media/blob/976e83290cf25ad6bc32e4824790b5e0d5d4c08b/src/MvcCore/Ext/Routers/Media/Preparing.php#L64-L70 |
199,343 | mvccore/ext-router-media | src/MvcCore/Ext/Routers/Media/Preparing.php | Preparing.prepareRequestMediaVersionFromUrlPath | protected function prepareRequestMediaVersionFromUrlPath () {
$requestPath = $this->request->GetPath(TRUE);
$requestPathExploded = explode('/', trim($requestPath, '/'));
$requestPathFirstPart = mb_strtolower($requestPathExploded[0]);
foreach ($this->allowedMediaVersionsAndUrlValues as $mediaSiteVersion => $medi... | php | protected function prepareRequestMediaVersionFromUrlPath () {
$requestPath = $this->request->GetPath(TRUE);
$requestPathExploded = explode('/', trim($requestPath, '/'));
$requestPathFirstPart = mb_strtolower($requestPathExploded[0]);
foreach ($this->allowedMediaVersionsAndUrlValues as $mediaSiteVersion => $medi... | [
"protected",
"function",
"prepareRequestMediaVersionFromUrlPath",
"(",
")",
"{",
"$",
"requestPath",
"=",
"$",
"this",
"->",
"request",
"->",
"GetPath",
"(",
"TRUE",
")",
";",
"$",
"requestPathExploded",
"=",
"explode",
"(",
"'/'",
",",
"trim",
"(",
"$",
"re... | Try to set up media site version from request path as request media site
version. If there is any request path detected, remove media site version
from request path and store detected media site version in local context.
@return void | [
"Try",
"to",
"set",
"up",
"media",
"site",
"version",
"from",
"request",
"path",
"as",
"request",
"media",
"site",
"version",
".",
"If",
"there",
"is",
"any",
"request",
"path",
"detected",
"remove",
"media",
"site",
"version",
"from",
"request",
"path",
"... | 976e83290cf25ad6bc32e4824790b5e0d5d4c08b | https://github.com/mvccore/ext-router-media/blob/976e83290cf25ad6bc32e4824790b5e0d5d4c08b/src/MvcCore/Ext/Routers/Media/Preparing.php#L88-L104 |
199,344 | jabernardo/lollipop-php | Library/DOM/Scraper.php | Scraper.getContentsByAttr | public function getContentsByAttr($attr, $attr_value) {
$nodes = $this->_dom_x_path->query("//*[contains(@{$attr}, '{$attr_value}')]");
$contents = [];
foreach ($nodes as $node) {
array_push($contents, $node->nodeValue);
}
return $contents;
... | php | public function getContentsByAttr($attr, $attr_value) {
$nodes = $this->_dom_x_path->query("//*[contains(@{$attr}, '{$attr_value}')]");
$contents = [];
foreach ($nodes as $node) {
array_push($contents, $node->nodeValue);
}
return $contents;
... | [
"public",
"function",
"getContentsByAttr",
"(",
"$",
"attr",
",",
"$",
"attr_value",
")",
"{",
"$",
"nodes",
"=",
"$",
"this",
"->",
"_dom_x_path",
"->",
"query",
"(",
"\"//*[contains(@{$attr}, '{$attr_value}')]\"",
")",
";",
"$",
"contents",
"=",
"[",
"]",
... | Get contents of an element by using attributes
@example getContentsByAttr('class', 'thumbnail');
@param string $attr Element attribute
@param string $attr_value Value of element attribute
@return array | [
"Get",
"contents",
"of",
"an",
"element",
"by",
"using",
"attributes"
] | 004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5 | https://github.com/jabernardo/lollipop-php/blob/004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5/Library/DOM/Scraper.php#L112-L122 |
199,345 | jabernardo/lollipop-php | Library/DOM/Scraper.php | Scraper.getContentsByElem | public function getContentsByElem($elem) {
$nodes = $this->_dom_x_path->query("//$elem");
$contents = [];
foreach ($nodes as $node) {
array_push($contents, $node->nodeValue);
}
return $contents;
} | php | public function getContentsByElem($elem) {
$nodes = $this->_dom_x_path->query("//$elem");
$contents = [];
foreach ($nodes as $node) {
array_push($contents, $node->nodeValue);
}
return $contents;
} | [
"public",
"function",
"getContentsByElem",
"(",
"$",
"elem",
")",
"{",
"$",
"nodes",
"=",
"$",
"this",
"->",
"_dom_x_path",
"->",
"query",
"(",
"\"//$elem\"",
")",
";",
"$",
"contents",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"nodes",
"as",
"$",
"no... | Get contents of an element by using element name
@example getContentsByElem('div');
@param string $elem Element name
@return array | [
"Get",
"contents",
"of",
"an",
"element",
"by",
"using",
"element",
"name"
] | 004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5 | https://github.com/jabernardo/lollipop-php/blob/004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5/Library/DOM/Scraper.php#L134-L144 |
199,346 | jabernardo/lollipop-php | Library/DOM/Scraper.php | Scraper.getAttrByAttr | public function getAttrByAttr($attr, $attr_value, $attr_to_get) {
$nodes = $this->_dom_x_path->query("//*[contains(@{$attr}, '{$attr_value}')]");
$contents = [];
foreach ($nodes as $node) {
array_push($contents, $node->getAttribute($attr_to_get));
}
... | php | public function getAttrByAttr($attr, $attr_value, $attr_to_get) {
$nodes = $this->_dom_x_path->query("//*[contains(@{$attr}, '{$attr_value}')]");
$contents = [];
foreach ($nodes as $node) {
array_push($contents, $node->getAttribute($attr_to_get));
}
... | [
"public",
"function",
"getAttrByAttr",
"(",
"$",
"attr",
",",
"$",
"attr_value",
",",
"$",
"attr_to_get",
")",
"{",
"$",
"nodes",
"=",
"$",
"this",
"->",
"_dom_x_path",
"->",
"query",
"(",
"\"//*[contains(@{$attr}, '{$attr_value}')]\"",
")",
";",
"$",
"content... | Get attribute value using other attributes
@example getAttrByAttr('class', 'thumbnail', 'href')
@param string @attr Element attribute
@param string @attr_value Element attribute value
@param string @attr_to_get Name of attribute to get
@return array | [
"Get",
"attribute",
"value",
"using",
"other",
"attributes"
] | 004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5 | https://github.com/jabernardo/lollipop-php/blob/004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5/Library/DOM/Scraper.php#L158-L168 |
199,347 | jabernardo/lollipop-php | Library/DOM/Scraper.php | Scraper.getAttrByElem | public function getAttrByElem($element) {
$nodes = $this->_dom_x_path->query("//{$element}");
$contents = [];
$attrs = [];
foreach ($nodes as $node) {
$attrs = [];
foreach ($node->attributes as $attr) {
$... | php | public function getAttrByElem($element) {
$nodes = $this->_dom_x_path->query("//{$element}");
$contents = [];
$attrs = [];
foreach ($nodes as $node) {
$attrs = [];
foreach ($node->attributes as $attr) {
$... | [
"public",
"function",
"getAttrByElem",
"(",
"$",
"element",
")",
"{",
"$",
"nodes",
"=",
"$",
"this",
"->",
"_dom_x_path",
"->",
"query",
"(",
"\"//{$element}\"",
")",
";",
"$",
"contents",
"=",
"[",
"]",
";",
"$",
"attrs",
"=",
"[",
"]",
";",
"forea... | Get attributes of elements
@example
getAttrByElemWithAttr('a');
Output:
Array
(
[0] => Array
(
[href] => www.sample.com
[class] => thumbnail
)
)
@param string $element Element (e.g. a, div, img)
@return array | [
"Get",
"attributes",
"of",
"elements"
] | 004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5 | https://github.com/jabernardo/lollipop-php/blob/004d80b21f7246bb3e08c7b9f74a165b0d3ca0f5/Library/DOM/Scraper.php#L193-L212 |
199,348 | Vectrex/vxPHP | src/Webpage/MenuGenerator.php | MenuGenerator.create | public static function create($id = null, $level = false, $forceActiveMenu = null, $decorator = null, $renderArgs = null) {
return new static($id, $level, $forceActiveMenu, $decorator, $renderArgs);
} | php | public static function create($id = null, $level = false, $forceActiveMenu = null, $decorator = null, $renderArgs = null) {
return new static($id, $level, $forceActiveMenu, $decorator, $renderArgs);
} | [
"public",
"static",
"function",
"create",
"(",
"$",
"id",
"=",
"null",
",",
"$",
"level",
"=",
"false",
",",
"$",
"forceActiveMenu",
"=",
"null",
",",
"$",
"decorator",
"=",
"null",
",",
"$",
"renderArgs",
"=",
"null",
")",
"{",
"return",
"new",
"sta... | convenience method to allow chaining
@param string $id
@param bool $level (if NULL, the full menu tree is printed)
@param bool $forceActiveMenu
@param string $decorator
@param mixed $renderArgs
@return MenuGenerator
@throws MenuGeneratorException
@throws \vxPHP\Application\Exception\ApplicationException | [
"convenience",
"method",
"to",
"allow",
"chaining"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Webpage/MenuGenerator.php#L185-L189 |
199,349 | Vectrex/vxPHP | src/Webpage/MenuGenerator.php | MenuGenerator.completeMenu | protected function completeMenu(Menu $m) {
if($m->getType() === 'dynamic') {
// invoke service to build menu entries
Application::getInstance()->getService($m->getServiceId())->appendMenuEntries($m);
}
foreach($m->getEntries() as $entry) {
if(($m = $entry->getSubMenu())) {
$this->comple... | php | protected function completeMenu(Menu $m) {
if($m->getType() === 'dynamic') {
// invoke service to build menu entries
Application::getInstance()->getService($m->getServiceId())->appendMenuEntries($m);
}
foreach($m->getEntries() as $entry) {
if(($m = $entry->getSubMenu())) {
$this->comple... | [
"protected",
"function",
"completeMenu",
"(",
"Menu",
"$",
"m",
")",
"{",
"if",
"(",
"$",
"m",
"->",
"getType",
"(",
")",
"===",
"'dynamic'",
")",
"{",
"// invoke service to build menu entries",
"Application",
"::",
"getInstance",
"(",
")",
"->",
"getService",... | walk the menu tree
and invoke service to append dynamic menu entries
@param Menu $m
@throws \vxPHP\Application\Exception\ApplicationException | [
"walk",
"the",
"menu",
"tree",
"and",
"invoke",
"service",
"to",
"append",
"dynamic",
"menu",
"entries"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Webpage/MenuGenerator.php#L349-L366 |
199,350 | Vectrex/vxPHP | src/Webpage/MenuGenerator.php | MenuGenerator.clearSelectedMenuEntries | protected function clearSelectedMenuEntries(Menu $menu) {
while(($e = $menu->getSelectedEntry())) {
// dynamic menus come either with unselected entry or have a selected entry explicitly set
if($menu->getType() == 'static') {
$menu->clearSelectedEntry();
}
if(!($menu = $e->getSubMenu())) {
brea... | php | protected function clearSelectedMenuEntries(Menu $menu) {
while(($e = $menu->getSelectedEntry())) {
// dynamic menus come either with unselected entry or have a selected entry explicitly set
if($menu->getType() == 'static') {
$menu->clearSelectedEntry();
}
if(!($menu = $e->getSubMenu())) {
brea... | [
"protected",
"function",
"clearSelectedMenuEntries",
"(",
"Menu",
"$",
"menu",
")",
"{",
"while",
"(",
"(",
"$",
"e",
"=",
"$",
"menu",
"->",
"getSelectedEntry",
"(",
")",
")",
")",
"{",
"// dynamic menus come either with unselected entry or have a selected entry expl... | walks menu tree and clears all previously selected entries
@param Menu $menu | [
"walks",
"menu",
"tree",
"and",
"clears",
"all",
"previously",
"selected",
"entries"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Webpage/MenuGenerator.php#L428-L441 |
199,351 | Vectrex/vxPHP | src/Webpage/MenuGenerator.php | MenuGenerator.authenticateMenu | protected function authenticateMenu(Menu $menu) {
if(!self::$authenticator) {
self::$authenticator = new DefaultMenuAuthenticator();
}
return self::$authenticator->authenticate($menu, Application::getInstance()->getCurrentUser());
} | php | protected function authenticateMenu(Menu $menu) {
if(!self::$authenticator) {
self::$authenticator = new DefaultMenuAuthenticator();
}
return self::$authenticator->authenticate($menu, Application::getInstance()->getCurrentUser());
} | [
"protected",
"function",
"authenticateMenu",
"(",
"Menu",
"$",
"menu",
")",
"{",
"if",
"(",
"!",
"self",
"::",
"$",
"authenticator",
")",
"{",
"self",
"::",
"$",
"authenticator",
"=",
"new",
"DefaultMenuAuthenticator",
"(",
")",
";",
"}",
"return",
"self",... | authenticates the complete menu
invokes a previously set authenticator class or falls back
to a default menu authenticator
@param Menu $menu
@return boolean
@throws \vxPHP\Application\Exception\ApplicationException | [
"authenticates",
"the",
"complete",
"menu",
"invokes",
"a",
"previously",
"set",
"authenticator",
"class",
"or",
"falls",
"back",
"to",
"a",
"default",
"menu",
"authenticator"
] | 295c21b00e7ef6085efcdf5b64fabb28d499b5a6 | https://github.com/Vectrex/vxPHP/blob/295c21b00e7ef6085efcdf5b64fabb28d499b5a6/src/Webpage/MenuGenerator.php#L452-L462 |
199,352 | shgysk8zer0/core_api | traits/curl.php | cURL.curlSetOpt | final public function curlSetOpt($opt, $value)
{
if (is_string($opt)) {
$opt = 'CURLOPT_' . strtoupper($opt);
if (defined($opt)) {
$opt = constant($opt);
curl_setopt($this->curl_handle, $opt, $value);
} else {
throw new \InvalidArgumentException(
sprintf('%s is not a valid cURL option', fun... | php | final public function curlSetOpt($opt, $value)
{
if (is_string($opt)) {
$opt = 'CURLOPT_' . strtoupper($opt);
if (defined($opt)) {
$opt = constant($opt);
curl_setopt($this->curl_handle, $opt, $value);
} else {
throw new \InvalidArgumentException(
sprintf('%s is not a valid cURL option', fun... | [
"final",
"public",
"function",
"curlSetOpt",
"(",
"$",
"opt",
",",
"$",
"value",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"opt",
")",
")",
"{",
"$",
"opt",
"=",
"'CURLOPT_'",
".",
"strtoupper",
"(",
"$",
"opt",
")",
";",
"if",
"(",
"defined",
... | Set an option for a cURL transfer
@param int $opt The CURLOPT_XXX option to set.
@param mixed $value The value to be set on option.
@return self
@see http://php.net/manual/en/function.curl-setopt.php | [
"Set",
"an",
"option",
"for",
"a",
"cURL",
"transfer"
] | 9e9b8baf761af874b95256ad2462e55fbb2b2e58 | https://github.com/shgysk8zer0/core_api/blob/9e9b8baf761af874b95256ad2462e55fbb2b2e58/traits/curl.php#L108-L134 |
199,353 | shgysk8zer0/core_api | traits/curl.php | cURL.curlSetOptArray | final public function curlSetOptArray(array $options = array())
{
$this->curlFilterOpts($options);
curl_setopt_array($this->curl_handle, $options);
return $this;
} | php | final public function curlSetOptArray(array $options = array())
{
$this->curlFilterOpts($options);
curl_setopt_array($this->curl_handle, $options);
return $this;
} | [
"final",
"public",
"function",
"curlSetOptArray",
"(",
"array",
"$",
"options",
"=",
"array",
"(",
")",
")",
"{",
"$",
"this",
"->",
"curlFilterOpts",
"(",
"$",
"options",
")",
";",
"curl_setopt_array",
"(",
"$",
"this",
"->",
"curl_handle",
",",
"$",
"o... | Set multiple options for a cURL transfer
@param array $options An array specifying which options to set and their values.
@return self | [
"Set",
"multiple",
"options",
"for",
"a",
"cURL",
"transfer"
] | 9e9b8baf761af874b95256ad2462e55fbb2b2e58 | https://github.com/shgysk8zer0/core_api/blob/9e9b8baf761af874b95256ad2462e55fbb2b2e58/traits/curl.php#L142-L147 |
199,354 | shgysk8zer0/core_api | traits/curl.php | cURL.curlFileCreate | final public function curlFileCreate(
$filename,
$mimetype = null,
$postname = null
)
{
$file = new \CURLFile($fname, $mime, $name);
return [$file->getPostFilename(), $file];
} | php | final public function curlFileCreate(
$filename,
$mimetype = null,
$postname = null
)
{
$file = new \CURLFile($fname, $mime, $name);
return [$file->getPostFilename(), $file];
} | [
"final",
"public",
"function",
"curlFileCreate",
"(",
"$",
"filename",
",",
"$",
"mimetype",
"=",
"null",
",",
"$",
"postname",
"=",
"null",
")",
"{",
"$",
"file",
"=",
"new",
"\\",
"CURLFile",
"(",
"$",
"fname",
",",
"$",
"mime",
",",
"$",
"name",
... | Can be used to upload a file with CURLOPT_POSTFIELDS.
@param string $filename Filename of file
@param string $mimetype MIME type of file
@param string $postname Name of file for post data
@see https://php.net/manual/en/class.curlfile.php | [
"Can",
"be",
"used",
"to",
"upload",
"a",
"file",
"with",
"CURLOPT_POSTFIELDS",
"."
] | 9e9b8baf761af874b95256ad2462e55fbb2b2e58 | https://github.com/shgysk8zer0/core_api/blob/9e9b8baf761af874b95256ad2462e55fbb2b2e58/traits/curl.php#L179-L187 |
199,355 | Talesoft/tale-framework | src/Tale/ClassLoader.php | ClassLoader.load | public function load($className)
{
$name = $className;
if ($this->_nameSpace) {
$ns = rtrim($this->_nameSpace, '\\').'\\';
$nameLen = strlen($className);
$nsLen = strlen($ns);
if ($nameLen < $nsLen || substr($className, 0, $nsLen) !== $ns)
... | php | public function load($className)
{
$name = $className;
if ($this->_nameSpace) {
$ns = rtrim($this->_nameSpace, '\\').'\\';
$nameLen = strlen($className);
$nsLen = strlen($ns);
if ($nameLen < $nsLen || substr($className, 0, $nsLen) !== $ns)
... | [
"public",
"function",
"load",
"(",
"$",
"className",
")",
"{",
"$",
"name",
"=",
"$",
"className",
";",
"if",
"(",
"$",
"this",
"->",
"_nameSpace",
")",
"{",
"$",
"ns",
"=",
"rtrim",
"(",
"$",
"this",
"->",
"_nameSpace",
",",
"'\\\\'",
")",
".",
... | Loads a class based on its class name
If it's not found, it's simply ignored in order to let another loader try to load it
If it's the only loader, an error will be thrown after a failed loading
There's no loader recursion, the final check uses the second parameter of class_exists() to
not trigger another autoloader i... | [
"Loads",
"a",
"class",
"based",
"on",
"its",
"class",
"name",
"If",
"it",
"s",
"not",
"found",
"it",
"s",
"simply",
"ignored",
"in",
"order",
"to",
"let",
"another",
"loader",
"try",
"to",
"load",
"it",
"If",
"it",
"s",
"the",
"only",
"loader",
"an",... | 739a7011c6dad409a51c4bcfbcf4b4ffbc8cba49 | https://github.com/Talesoft/tale-framework/blob/739a7011c6dad409a51c4bcfbcf4b4ffbc8cba49/src/Tale/ClassLoader.php#L235-L260 |
199,356 | valu-digital/valusetup | src/ValuSetup/Setup/SoftwareVersion.php | SoftwareVersion.setVersion | public function setVersion ($version)
{
$version = strtolower(strval($version));
if (! self::isValid($version)) {
$version = self::DEFAULT_UNRESOLVED_VERSION;
}
$this->numbers = self::parse($version);
$this->version = $version;
return $this;
} | php | public function setVersion ($version)
{
$version = strtolower(strval($version));
if (! self::isValid($version)) {
$version = self::DEFAULT_UNRESOLVED_VERSION;
}
$this->numbers = self::parse($version);
$this->version = $version;
return $this;
} | [
"public",
"function",
"setVersion",
"(",
"$",
"version",
")",
"{",
"$",
"version",
"=",
"strtolower",
"(",
"strval",
"(",
"$",
"version",
")",
")",
";",
"if",
"(",
"!",
"self",
"::",
"isValid",
"(",
"$",
"version",
")",
")",
"{",
"$",
"version",
"=... | Set current version
@param $version string|int
Version (float/integer is casted to string)
@return SoftwareVersion | [
"Set",
"current",
"version"
] | db1a0bfe1262d555eb11cd0d99625b9ee43d6744 | https://github.com/valu-digital/valusetup/blob/db1a0bfe1262d555eb11cd0d99625b9ee43d6744/src/ValuSetup/Setup/SoftwareVersion.php#L55-L65 |
199,357 | valu-digital/valusetup | src/ValuSetup/Setup/SoftwareVersion.php | SoftwareVersion.compareTo | public function compareTo($version)
{
$cmp = self::parse($version);
$result = $this->cmp($cmp, $this->numbers);
if ($result === 0) {
$result = $this->cmp($this->numbers, $cmp);
$result = - $result;
} else {
return $result;
}
return ... | php | public function compareTo($version)
{
$cmp = self::parse($version);
$result = $this->cmp($cmp, $this->numbers);
if ($result === 0) {
$result = $this->cmp($this->numbers, $cmp);
$result = - $result;
} else {
return $result;
}
return ... | [
"public",
"function",
"compareTo",
"(",
"$",
"version",
")",
"{",
"$",
"cmp",
"=",
"self",
"::",
"parse",
"(",
"$",
"version",
")",
";",
"$",
"result",
"=",
"$",
"this",
"->",
"cmp",
"(",
"$",
"cmp",
",",
"$",
"this",
"->",
"numbers",
")",
";",
... | Compare current version to given version and
return -1 if current is less and +1 if current
version is greater than given version
@param $version string
@return array | [
"Compare",
"current",
"version",
"to",
"given",
"version",
"and",
"return",
"-",
"1",
"if",
"current",
"is",
"less",
"and",
"+",
"1",
"if",
"current",
"version",
"is",
"greater",
"than",
"given",
"version"
] | db1a0bfe1262d555eb11cd0d99625b9ee43d6744 | https://github.com/valu-digital/valusetup/blob/db1a0bfe1262d555eb11cd0d99625b9ee43d6744/src/ValuSetup/Setup/SoftwareVersion.php#L161-L172 |
199,358 | valu-digital/valusetup | src/ValuSetup/Setup/SoftwareVersion.php | SoftwareVersion.parse | public static function parse ($version)
{
$nums = explode(self::DELIMITER, $version);
$numbers = array();
foreach ($nums as $num) {
if (preg_match('/^0*([0-9]+)/', $num, $matches)) {
if (isset($matches[1])) {
$numbers[] = $matches[1];
... | php | public static function parse ($version)
{
$nums = explode(self::DELIMITER, $version);
$numbers = array();
foreach ($nums as $num) {
if (preg_match('/^0*([0-9]+)/', $num, $matches)) {
if (isset($matches[1])) {
$numbers[] = $matches[1];
... | [
"public",
"static",
"function",
"parse",
"(",
"$",
"version",
")",
"{",
"$",
"nums",
"=",
"explode",
"(",
"self",
"::",
"DELIMITER",
",",
"$",
"version",
")",
";",
"$",
"numbers",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"nums",
"as",
"$",... | Parse array of integers based on version
number
Non-integer values and preceeding zeros are
dropped.
@param $version string
@return array | [
"Parse",
"array",
"of",
"integers",
"based",
"on",
"version",
"number"
] | db1a0bfe1262d555eb11cd0d99625b9ee43d6744 | https://github.com/valu-digital/valusetup/blob/db1a0bfe1262d555eb11cd0d99625b9ee43d6744/src/ValuSetup/Setup/SoftwareVersion.php#L208-L227 |
199,359 | valu-digital/valusetup | src/ValuSetup/Setup/SoftwareVersion.php | SoftwareVersion.isValid | public static function isValid ($version)
{
if (self::isDev($version)) {
return true;
} else {
return (boolean) preg_match('/' . self::$validPattern . '/i', $version);
}
} | php | public static function isValid ($version)
{
if (self::isDev($version)) {
return true;
} else {
return (boolean) preg_match('/' . self::$validPattern . '/i', $version);
}
} | [
"public",
"static",
"function",
"isValid",
"(",
"$",
"version",
")",
"{",
"if",
"(",
"self",
"::",
"isDev",
"(",
"$",
"version",
")",
")",
"{",
"return",
"true",
";",
"}",
"else",
"{",
"return",
"(",
"boolean",
")",
"preg_match",
"(",
"'/'",
".",
"... | Test if version is valid
@return boolean | [
"Test",
"if",
"version",
"is",
"valid"
] | db1a0bfe1262d555eb11cd0d99625b9ee43d6744 | https://github.com/valu-digital/valusetup/blob/db1a0bfe1262d555eb11cd0d99625b9ee43d6744/src/ValuSetup/Setup/SoftwareVersion.php#L234-L241 |
199,360 | wasinger/adaptimage | src/Output/OutputTypeMap.php | OutputTypeMap.getOutputTypeOptions | public function getOutputTypeOptions($input_type)
{
if (!in_array($input_type, $this->types)) {
$input_type = $this->default_type;
}
return $this->map[$input_type];
} | php | public function getOutputTypeOptions($input_type)
{
if (!in_array($input_type, $this->types)) {
$input_type = $this->default_type;
}
return $this->map[$input_type];
} | [
"public",
"function",
"getOutputTypeOptions",
"(",
"$",
"input_type",
")",
"{",
"if",
"(",
"!",
"in_array",
"(",
"$",
"input_type",
",",
"$",
"this",
"->",
"types",
")",
")",
"{",
"$",
"input_type",
"=",
"$",
"this",
"->",
"default_type",
";",
"}",
"re... | Get OutputTypeOptions for given input type
@param int $input_type One of the IMAGETYPE_XX constants
@return OutputTypeOptionsInterface | [
"Get",
"OutputTypeOptions",
"for",
"given",
"input",
"type"
] | 7b529b25081b399451c8bbd56d0cef7daaa83ec4 | https://github.com/wasinger/adaptimage/blob/7b529b25081b399451c8bbd56d0cef7daaa83ec4/src/Output/OutputTypeMap.php#L30-L36 |
199,361 | wasinger/adaptimage | src/Output/OutputTypeMap.php | OutputTypeMap.setOutputTypeOptions | public function setOutputTypeOptions($input_type, OutputTypeOptionsInterface $options)
{
$this->map[$input_type] = $options;
$this->types = array_keys($this->map);
return $this;
} | php | public function setOutputTypeOptions($input_type, OutputTypeOptionsInterface $options)
{
$this->map[$input_type] = $options;
$this->types = array_keys($this->map);
return $this;
} | [
"public",
"function",
"setOutputTypeOptions",
"(",
"$",
"input_type",
",",
"OutputTypeOptionsInterface",
"$",
"options",
")",
"{",
"$",
"this",
"->",
"map",
"[",
"$",
"input_type",
"]",
"=",
"$",
"options",
";",
"$",
"this",
"->",
"types",
"=",
"array_keys",... | Set an OutputTypeOptionsInterface object for a given input type
@param int $input_type One of the IMAGETYPE_XX constants
@param OutputTypeOptionsInterface $options
@return OutputTypeMap | [
"Set",
"an",
"OutputTypeOptionsInterface",
"object",
"for",
"a",
"given",
"input",
"type"
] | 7b529b25081b399451c8bbd56d0cef7daaa83ec4 | https://github.com/wasinger/adaptimage/blob/7b529b25081b399451c8bbd56d0cef7daaa83ec4/src/Output/OutputTypeMap.php#L45-L50 |
199,362 | Eden-PHP/Block | Base.php | Base.getHelpers | protected function getHelpers()
{
$cdnRoot = eden('block')->getAssetRoot();
$language = eden('block')->getLanguage();
return array(
'cdn' => function() use ($cdnRoot) {
echo $cdnRoot;
},
'_' => function($key) use ($language) {
if($language instanceof Eden\Language\Base) {
echo $lan... | php | protected function getHelpers()
{
$cdnRoot = eden('block')->getAssetRoot();
$language = eden('block')->getLanguage();
return array(
'cdn' => function() use ($cdnRoot) {
echo $cdnRoot;
},
'_' => function($key) use ($language) {
if($language instanceof Eden\Language\Base) {
echo $lan... | [
"protected",
"function",
"getHelpers",
"(",
")",
"{",
"$",
"cdnRoot",
"=",
"eden",
"(",
"'block'",
")",
"->",
"getAssetRoot",
"(",
")",
";",
"$",
"language",
"=",
"eden",
"(",
"'block'",
")",
"->",
"getLanguage",
"(",
")",
";",
"return",
"array",
"(",
... | Returns helper methods
@return array | [
"Returns",
"helper",
"methods"
] | 681b9f01dd118612d0fced84d2f702167b52109b | https://github.com/Eden-PHP/Block/blob/681b9f01dd118612d0fced84d2f702167b52109b/Base.php#L85-L102 |
199,363 | squareproton/Bond | src/Bond/Entity/Types/DateInterval.php | DateInterval.init | public static function init($time = null)
{
try {
$interval = new self( $time );
return $interval;
} catch( \Exception $e ) {
return null;
}
} | php | public static function init($time = null)
{
try {
$interval = new self( $time );
return $interval;
} catch( \Exception $e ) {
return null;
}
} | [
"public",
"static",
"function",
"init",
"(",
"$",
"time",
"=",
"null",
")",
"{",
"try",
"{",
"$",
"interval",
"=",
"new",
"self",
"(",
"$",
"time",
")",
";",
"return",
"$",
"interval",
";",
"}",
"catch",
"(",
"\\",
"Exception",
"$",
"e",
")",
"{"... | Standard initalise. Useful for array_map
@param $time
@return DateInterval|null | [
"Standard",
"initalise",
".",
"Useful",
"for",
"array_map"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Entity/Types/DateInterval.php#L89-L97 |
199,364 | squareproton/Bond | src/Bond/Entity/Types/DateInterval.php | DateInterval.isEmpty | public function isEmpty()
{
return $this->y === 0 && $this->m === 0 && $this->d === 0 && $this->h === 0 && $this->i === 0 && $this->s === 0;
} | php | public function isEmpty()
{
return $this->y === 0 && $this->m === 0 && $this->d === 0 && $this->h === 0 && $this->i === 0 && $this->s === 0;
} | [
"public",
"function",
"isEmpty",
"(",
")",
"{",
"return",
"$",
"this",
"->",
"y",
"===",
"0",
"&&",
"$",
"this",
"->",
"m",
"===",
"0",
"&&",
"$",
"this",
"->",
"d",
"===",
"0",
"&&",
"$",
"this",
"->",
"h",
"===",
"0",
"&&",
"$",
"this",
"->... | Is this interval empty?
@return bool | [
"Is",
"this",
"interval",
"empty?"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Entity/Types/DateInterval.php#L103-L106 |
199,365 | squareproton/Bond | src/Bond/Entity/Types/DateInterval.php | DateInterval.toArray | public function toArray()
{
return array(
'year' => $this->y,
'month' => $this->m,
'day' => $this->d,
'hour' => $this->h,
'minute' => $this->i,
'second' => $this->s,
);
} | php | public function toArray()
{
return array(
'year' => $this->y,
'month' => $this->m,
'day' => $this->d,
'hour' => $this->h,
'minute' => $this->i,
'second' => $this->s,
);
} | [
"public",
"function",
"toArray",
"(",
")",
"{",
"return",
"array",
"(",
"'year'",
"=>",
"$",
"this",
"->",
"y",
",",
"'month'",
"=>",
"$",
"this",
"->",
"m",
",",
"'day'",
"=>",
"$",
"this",
"->",
"d",
",",
"'hour'",
"=>",
"$",
"this",
"->",
"h",... | Return a array representing interval information
@return array | [
"Return",
"a",
"array",
"representing",
"interval",
"information"
] | a04ad9dd1a35adeaec98237716c2a41ce02b4f1a | https://github.com/squareproton/Bond/blob/a04ad9dd1a35adeaec98237716c2a41ce02b4f1a/src/Bond/Entity/Types/DateInterval.php#L112-L122 |
199,366 | rutger-speksnijder/restphp | src/RestPHP/Request/Request.php | Request.sanitize | final protected function sanitize($data)
{
// Recursively loop through the data array and return the sanitized data
$sanitized = [];
if (is_array($data)) {
foreach ($data as $key => $value) {
$sanitized[$key] = $this->sanitize($value);
}
} else... | php | final protected function sanitize($data)
{
// Recursively loop through the data array and return the sanitized data
$sanitized = [];
if (is_array($data)) {
foreach ($data as $key => $value) {
$sanitized[$key] = $this->sanitize($value);
}
} else... | [
"final",
"protected",
"function",
"sanitize",
"(",
"$",
"data",
")",
"{",
"// Recursively loop through the data array and return the sanitized data",
"$",
"sanitized",
"=",
"[",
"]",
";",
"if",
"(",
"is_array",
"(",
"$",
"data",
")",
")",
"{",
"foreach",
"(",
"$... | Sanitizes an array with data.
@param array $data The input data.
@return array A sanitized array. | [
"Sanitizes",
"an",
"array",
"with",
"data",
"."
] | 326a7c0d79b266bbdd8a27ff1c8021caf9d28a3d | https://github.com/rutger-speksnijder/restphp/blob/326a7c0d79b266bbdd8a27ff1c8021caf9d28a3d/src/RestPHP/Request/Request.php#L52-L64 |
199,367 | ammarfaizi2/icetea-framework | src/System/Crayner/Cookie/Cookie.php | Cookie.get | public function get($name)
{
$this->toString = isset($_COOKIE[$name]) ? $_COOKIE[$name] : "";
return new InputUtilities($this->toString);
} | php | public function get($name)
{
$this->toString = isset($_COOKIE[$name]) ? $_COOKIE[$name] : "";
return new InputUtilities($this->toString);
} | [
"public",
"function",
"get",
"(",
"$",
"name",
")",
"{",
"$",
"this",
"->",
"toString",
"=",
"isset",
"(",
"$",
"_COOKIE",
"[",
"$",
"name",
"]",
")",
"?",
"$",
"_COOKIE",
"[",
"$",
"name",
"]",
":",
"\"\"",
";",
"return",
"new",
"InputUtilities",
... | Get cookie value.
@param string $name
@return string | [
"Get",
"cookie",
"value",
"."
] | dedd832846c3e69b429b18b8612fae50881af180 | https://github.com/ammarfaizi2/icetea-framework/blob/dedd832846c3e69b429b18b8612fae50881af180/src/System/Crayner/Cookie/Cookie.php#L71-L75 |
199,368 | ammarfaizi2/icetea-framework | src/System/Crayner/Cookie/Cookie.php | Cookie.delete | public function delete($name)
{
$this->func = function () use ($name) {
setcookie($name, null, 0);
return $name;
};
return new CookieFlush($this->func);
} | php | public function delete($name)
{
$this->func = function () use ($name) {
setcookie($name, null, 0);
return $name;
};
return new CookieFlush($this->func);
} | [
"public",
"function",
"delete",
"(",
"$",
"name",
")",
"{",
"$",
"this",
"->",
"func",
"=",
"function",
"(",
")",
"use",
"(",
"$",
"name",
")",
"{",
"setcookie",
"(",
"$",
"name",
",",
"null",
",",
"0",
")",
";",
"return",
"$",
"name",
";",
"}"... | Delete cookie.
@param string $name
@return bool | [
"Delete",
"cookie",
"."
] | dedd832846c3e69b429b18b8612fae50881af180 | https://github.com/ammarfaizi2/icetea-framework/blob/dedd832846c3e69b429b18b8612fae50881af180/src/System/Crayner/Cookie/Cookie.php#L83-L90 |
199,369 | wearenolte/wp-endpoints-static | src/StaticApi/Widgets.php | Widgets.get_all_areas | public static function get_all_areas() {
global $sidebars_widgets;
$widget_areas = [];
foreach ( $sidebars_widgets as $widget_area => $widgets ) {
if ( 'wp_inactive_widgets' === $widget_area ) {
continue;
}
$widget_areas[ $widget_area ] = [];
if ( empty( $widgets ) ) {
continue;
}
f... | php | public static function get_all_areas() {
global $sidebars_widgets;
$widget_areas = [];
foreach ( $sidebars_widgets as $widget_area => $widgets ) {
if ( 'wp_inactive_widgets' === $widget_area ) {
continue;
}
$widget_areas[ $widget_area ] = [];
if ( empty( $widgets ) ) {
continue;
}
f... | [
"public",
"static",
"function",
"get_all_areas",
"(",
")",
"{",
"global",
"$",
"sidebars_widgets",
";",
"$",
"widget_areas",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"sidebars_widgets",
"as",
"$",
"widget_area",
"=>",
"$",
"widgets",
")",
"{",
"if",
"(",
... | Returns an array of widget areas, with the assigned widgets in each.
@return array | [
"Returns",
"an",
"array",
"of",
"widget",
"areas",
"with",
"the",
"assigned",
"widgets",
"in",
"each",
"."
] | 23258bba9b65d55b78b3dc3edc123d75009b0825 | https://github.com/wearenolte/wp-endpoints-static/blob/23258bba9b65d55b78b3dc3edc123d75009b0825/src/StaticApi/Widgets.php#L16-L47 |
199,370 | concordat/console | src/Commands/AbstractCommand.php | AbstractCommand.iterator | protected function iterator($framework, $source)
{
$source = $source . DIRECTORY_SEPARATOR . ucfirst($framework);
$directory = new \RecursiveDirectoryIterator($source, 4096);
return new \RecursiveIteratorIterator($directory, 1);
} | php | protected function iterator($framework, $source)
{
$source = $source . DIRECTORY_SEPARATOR . ucfirst($framework);
$directory = new \RecursiveDirectoryIterator($source, 4096);
return new \RecursiveIteratorIterator($directory, 1);
} | [
"protected",
"function",
"iterator",
"(",
"$",
"framework",
",",
"$",
"source",
")",
"{",
"$",
"source",
"=",
"$",
"source",
".",
"DIRECTORY_SEPARATOR",
".",
"ucfirst",
"(",
"$",
"framework",
")",
";",
"$",
"directory",
"=",
"new",
"\\",
"RecursiveDirector... | Returns a \RecursiveIteratorIterator instance.
@param string $framework
@param string $source
@return \RecursiveIteratorIterator | [
"Returns",
"a",
"\\",
"RecursiveIteratorIterator",
"instance",
"."
] | bac3da80cb3d1abd26f9f2f5bd3ec8f1479f92d3 | https://github.com/concordat/console/blob/bac3da80cb3d1abd26f9f2f5bd3ec8f1479f92d3/src/Commands/AbstractCommand.php#L97-L104 |
199,371 | concordat/console | src/Commands/AbstractCommand.php | AbstractCommand.migrate | protected function migrate(OutputInterface $output, $source, $path, $framework)
{
foreach ($this->iterator($framework, $source) as $item) {
$name = strtolower(str_replace($source, '', $item->getRealpath()));
if ((boolean) $item->isDir() === false) {
$date = date($thi... | php | protected function migrate(OutputInterface $output, $source, $path, $framework)
{
foreach ($this->iterator($framework, $source) as $item) {
$name = strtolower(str_replace($source, '', $item->getRealpath()));
if ((boolean) $item->isDir() === false) {
$date = date($thi... | [
"protected",
"function",
"migrate",
"(",
"OutputInterface",
"$",
"output",
",",
"$",
"source",
",",
"$",
"path",
",",
"$",
"framework",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"iterator",
"(",
"$",
"framework",
",",
"$",
"source",
")",
"as",
"$",
... | Creates a copy of database files to the specified path.
@param \Symfony\Component\Console\Output\OutputInterface $output
@param string $source
@param string $path
@param string $framewor... | [
"Creates",
"a",
"copy",
"of",
"database",
"files",
"to",
"the",
"specified",
"path",
"."
] | bac3da80cb3d1abd26f9f2f5bd3ec8f1479f92d3 | https://github.com/concordat/console/blob/bac3da80cb3d1abd26f9f2f5bd3ec8f1479f92d3/src/Commands/AbstractCommand.php#L115-L134 |
199,372 | concordat/console | src/Commands/AbstractCommand.php | AbstractCommand.package | protected function package($name)
{
$exists = in_array($name, array_keys($this->packages));
if ($exists === false || ! class_exists($this->packages[$name])) {
$message = 'Package "' . $name . '" does not exists!';
throw new \InvalidArgumentException((string) $message);
... | php | protected function package($name)
{
$exists = in_array($name, array_keys($this->packages));
if ($exists === false || ! class_exists($this->packages[$name])) {
$message = 'Package "' . $name . '" does not exists!';
throw new \InvalidArgumentException((string) $message);
... | [
"protected",
"function",
"package",
"(",
"$",
"name",
")",
"{",
"$",
"exists",
"=",
"in_array",
"(",
"$",
"name",
",",
"array_keys",
"(",
"$",
"this",
"->",
"packages",
")",
")",
";",
"if",
"(",
"$",
"exists",
"===",
"false",
"||",
"!",
"class_exists... | Return the value of the required type from the specified package.
@param string $package
@return string | [
"Return",
"the",
"value",
"of",
"the",
"required",
"type",
"from",
"the",
"specified",
"package",
"."
] | bac3da80cb3d1abd26f9f2f5bd3ec8f1479f92d3 | https://github.com/concordat/console/blob/bac3da80cb3d1abd26f9f2f5bd3ec8f1479f92d3/src/Commands/AbstractCommand.php#L142-L163 |
199,373 | XetaIO/Xetaravel-IpTraceable | src/Providers/IpTraceableServiceProvider.php | IpTraceableServiceProvider.boot | public function boot()
{
foreach ($this->subscribe as $subscriber) {
Event::subscribe($subscriber);
}
$this->publishes([
__DIR__ . '/../../config/iptraceable.php' => config_path('iptraceable.php'),
], 'config');
} | php | public function boot()
{
foreach ($this->subscribe as $subscriber) {
Event::subscribe($subscriber);
}
$this->publishes([
__DIR__ . '/../../config/iptraceable.php' => config_path('iptraceable.php'),
], 'config');
} | [
"public",
"function",
"boot",
"(",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"subscribe",
"as",
"$",
"subscriber",
")",
"{",
"Event",
"::",
"subscribe",
"(",
"$",
"subscriber",
")",
";",
"}",
"$",
"this",
"->",
"publishes",
"(",
"[",
"__DIR__",
".... | Register the application's event listeners and publish the config file.
@return void | [
"Register",
"the",
"application",
"s",
"event",
"listeners",
"and",
"publish",
"the",
"config",
"file",
"."
] | e1c57592d45f240c55e827fd6b756e5143c892b5 | https://github.com/XetaIO/Xetaravel-IpTraceable/blob/e1c57592d45f240c55e827fd6b756e5143c892b5/src/Providers/IpTraceableServiceProvider.php#L24-L33 |
199,374 | ekyna/SettingBundle | Controller/HelperController.php | HelperController.fetchAction | public function fetchAction(Request $request)
{
$reference = strtoupper($request->query->get('reference', null));
$remote = (bool)$request->query->get('remote', 1);
if (0 < strlen($reference) && $remote) {
$remoteEndPoints = $this->container->getParameter('ekyna_setting.helper_r... | php | public function fetchAction(Request $request)
{
$reference = strtoupper($request->query->get('reference', null));
$remote = (bool)$request->query->get('remote', 1);
if (0 < strlen($reference) && $remote) {
$remoteEndPoints = $this->container->getParameter('ekyna_setting.helper_r... | [
"public",
"function",
"fetchAction",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"reference",
"=",
"strtoupper",
"(",
"$",
"request",
"->",
"query",
"->",
"get",
"(",
"'reference'",
",",
"null",
")",
")",
";",
"$",
"remote",
"=",
"(",
"bool",
")",
... | Fetches the helper content.
@param Request $request
@return \Symfony\Component\HttpFoundation\Response | [
"Fetches",
"the",
"helper",
"content",
"."
] | df58f83eb3a01ef56cd76ea73639322c581e75c1 | https://github.com/ekyna/SettingBundle/blob/df58f83eb3a01ef56cd76ea73639322c581e75c1/Controller/HelperController.php#L23-L68 |
199,375 | rzajac/phptools | src/Traits/Error.php | Error.addError | public function addError($error, $key = null)
{
if (is_string($error)) {
$error = new Exception($error);
} elseif ($error instanceof Exception) {
// Nothing to do
} else {
throw new Exception('only string errors or instances of Exception can be added');
... | php | public function addError($error, $key = null)
{
if (is_string($error)) {
$error = new Exception($error);
} elseif ($error instanceof Exception) {
// Nothing to do
} else {
throw new Exception('only string errors or instances of Exception can be added');
... | [
"public",
"function",
"addError",
"(",
"$",
"error",
",",
"$",
"key",
"=",
"null",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"error",
")",
")",
"{",
"$",
"error",
"=",
"new",
"Exception",
"(",
"$",
"error",
")",
";",
"}",
"elseif",
"(",
"$",
... | Add error.
If the key is not provided the method will just
add another element to the array.
@param Exception|string $error The error
@param string $key The associative array key
@throws Exception
@return bool Always returns false | [
"Add",
"error",
"."
] | 3cbece7645942d244603c14ba897d8a676ee3088 | https://github.com/rzajac/phptools/blob/3cbece7645942d244603c14ba897d8a676ee3088/src/Traits/Error.php#L49-L66 |
199,376 | jaredchu/JCRequest | src/JCRequest.php | JCRequest.combineUrl | protected static function combineUrl($url, $params = [])
{
$urlObject = Url::parse($url);
$queryData = array_merge($urlObject->query->getData(), $params);
$urlObject->query->setData($queryData);
return $urlObject->getUrl();
} | php | protected static function combineUrl($url, $params = [])
{
$urlObject = Url::parse($url);
$queryData = array_merge($urlObject->query->getData(), $params);
$urlObject->query->setData($queryData);
return $urlObject->getUrl();
} | [
"protected",
"static",
"function",
"combineUrl",
"(",
"$",
"url",
",",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"$",
"urlObject",
"=",
"Url",
"::",
"parse",
"(",
"$",
"url",
")",
";",
"$",
"queryData",
"=",
"array_merge",
"(",
"$",
"urlObject",
"->",
... | Manipulate the url & params for GET request
@param string $url
@param array $params
@return string | [
"Manipulate",
"the",
"url",
"&",
"params",
"for",
"GET",
"request"
] | d6b2fb2096f1cac9b625481be920fbccb4edae92 | https://github.com/jaredchu/JCRequest/blob/d6b2fb2096f1cac9b625481be920fbccb4edae92/src/JCRequest.php#L71-L78 |
199,377 | Torann/skosh-generator | src/Console/PublishCommand.php | PublishCommand.validateServer | protected function validateServer($server)
{
if (in_array($server, array_keys($this->servers)))
{
// Get server options
$options = $this->config->get($server);
if (!$options || $options['host'] === 'yoursite') {
throw new \Exception("Remote server... | php | protected function validateServer($server)
{
if (in_array($server, array_keys($this->servers)))
{
// Get server options
$options = $this->config->get($server);
if (!$options || $options['host'] === 'yoursite') {
throw new \Exception("Remote server... | [
"protected",
"function",
"validateServer",
"(",
"$",
"server",
")",
"{",
"if",
"(",
"in_array",
"(",
"$",
"server",
",",
"array_keys",
"(",
"$",
"this",
"->",
"servers",
")",
")",
")",
"{",
"// Get server options",
"$",
"options",
"=",
"$",
"this",
"->",... | Check existence of remote server.
@param string $server
@return bool
@throws \Exception | [
"Check",
"existence",
"of",
"remote",
"server",
"."
] | ea60e037d92398d7c146eb2349735d5692e3c48c | https://github.com/Torann/skosh-generator/blob/ea60e037d92398d7c146eb2349735d5692e3c48c/src/Console/PublishCommand.php#L89-L108 |
199,378 | Torann/skosh-generator | src/Console/PublishCommand.php | PublishCommand.publish_ssh | protected function publish_ssh(OutputInterface $output, $target)
{
// Get FTP config
$config = $this->config->get('ssh');
// Ensure there isn't a leading slash
$remote_dir = ltrim($config['remote_dir'], '/');
// Shell command
$output->writeln(shell_exec("rsync -avze... | php | protected function publish_ssh(OutputInterface $output, $target)
{
// Get FTP config
$config = $this->config->get('ssh');
// Ensure there isn't a leading slash
$remote_dir = ltrim($config['remote_dir'], '/');
// Shell command
$output->writeln(shell_exec("rsync -avze... | [
"protected",
"function",
"publish_ssh",
"(",
"OutputInterface",
"$",
"output",
",",
"$",
"target",
")",
"{",
"// Get FTP config",
"$",
"config",
"=",
"$",
"this",
"->",
"config",
"->",
"get",
"(",
"'ssh'",
")",
";",
"// Ensure there isn't a leading slash",
"$",
... | Publish using SSH.
@param OutputInterface $output
@param string $target
@return bool
@throws \Exception | [
"Publish",
"using",
"SSH",
"."
] | ea60e037d92398d7c146eb2349735d5692e3c48c | https://github.com/Torann/skosh-generator/blob/ea60e037d92398d7c146eb2349735d5692e3c48c/src/Console/PublishCommand.php#L118-L130 |
199,379 | Danack/Jig | src/Jig/JigConfig.php | JigConfig.getCompiledFilenameFromClassname | public function getCompiledFilenameFromClassname($fqcn)
{
$filename = $this->templateCompileDirectory.'/'.$fqcn.'.php';
$filename = str_replace('\\', '/', $filename);
return $filename;
} | php | public function getCompiledFilenameFromClassname($fqcn)
{
$filename = $this->templateCompileDirectory.'/'.$fqcn.'.php';
$filename = str_replace('\\', '/', $filename);
return $filename;
} | [
"public",
"function",
"getCompiledFilenameFromClassname",
"(",
"$",
"fqcn",
")",
"{",
"$",
"filename",
"=",
"$",
"this",
"->",
"templateCompileDirectory",
".",
"'/'",
".",
"$",
"fqcn",
".",
"'.php'",
";",
"$",
"filename",
"=",
"str_replace",
"(",
"'\\\\'",
"... | Returns the fully pathed filename for a compiled class.
@param $fqcn
@return string | [
"Returns",
"the",
"fully",
"pathed",
"filename",
"for",
"a",
"compiled",
"class",
"."
] | b11106bc7d634add9873bf246eda1dadb059ed7a | https://github.com/Danack/Jig/blob/b11106bc7d634add9873bf246eda1dadb059ed7a/src/Jig/JigConfig.php#L57-L63 |
199,380 | Danack/Jig | src/Jig/JigConfig.php | JigConfig.getFQCNFromTemplateName | public function getFQCNFromTemplateName($templateName)
{
$classname = $this->compiledNamespace."\\".$templateName;
$classname = str_replace('/', '\\', $classname);
$classname .= "Jig";
return $classname;
} | php | public function getFQCNFromTemplateName($templateName)
{
$classname = $this->compiledNamespace."\\".$templateName;
$classname = str_replace('/', '\\', $classname);
$classname .= "Jig";
return $classname;
} | [
"public",
"function",
"getFQCNFromTemplateName",
"(",
"$",
"templateName",
")",
"{",
"$",
"classname",
"=",
"$",
"this",
"->",
"compiledNamespace",
".",
"\"\\\\\"",
".",
"$",
"templateName",
";",
"$",
"classname",
"=",
"str_replace",
"(",
"'/'",
",",
"'\\\\'",... | Generate the full class name for the compiled version of a template..
@param $templateName
@return string | [
"Generate",
"the",
"full",
"class",
"name",
"for",
"the",
"compiled",
"version",
"of",
"a",
"template",
".."
] | b11106bc7d634add9873bf246eda1dadb059ed7a | https://github.com/Danack/Jig/blob/b11106bc7d634add9873bf246eda1dadb059ed7a/src/Jig/JigConfig.php#L70-L77 |
199,381 | FuzeWorks/Core | src/Libraries/Zip.php | FW_Zip.read_file | public function read_file($path, $archive_filepath = FALSE)
{
if (file_exists($path) && FALSE !== ($data = file_get_contents($path)))
{
if (is_string($archive_filepath))
{
$name = str_replace('\\', '/', $archive_filepath);
}
else
{
$name = str_replace('\\', '/', $path);
if ($archive_fil... | php | public function read_file($path, $archive_filepath = FALSE)
{
if (file_exists($path) && FALSE !== ($data = file_get_contents($path)))
{
if (is_string($archive_filepath))
{
$name = str_replace('\\', '/', $archive_filepath);
}
else
{
$name = str_replace('\\', '/', $path);
if ($archive_fil... | [
"public",
"function",
"read_file",
"(",
"$",
"path",
",",
"$",
"archive_filepath",
"=",
"FALSE",
")",
"{",
"if",
"(",
"file_exists",
"(",
"$",
"path",
")",
"&&",
"FALSE",
"!==",
"(",
"$",
"data",
"=",
"file_get_contents",
"(",
"$",
"path",
")",
")",
... | Read the contents of a file and add it to the zip
@param string $path
@param bool $archive_filepath
@return bool | [
"Read",
"the",
"contents",
"of",
"a",
"file",
"and",
"add",
"it",
"to",
"the",
"zip"
] | 051c64fdaa3a648174cbd54557d05ad553dd826b | https://github.com/FuzeWorks/Core/blob/051c64fdaa3a648174cbd54557d05ad553dd826b/src/Libraries/Zip.php#L312-L335 |
199,382 | FuzeWorks/Core | src/Libraries/Zip.php | FW_Zip.read_dir | public function read_dir($path, $preserve_filepath = TRUE, $root_path = NULL)
{
$path = rtrim($path, '/\\').DIRECTORY_SEPARATOR;
if ( ! $fp = @opendir($path))
{
return FALSE;
}
// Set the original directory root for child dir's to use as relative
if ($root_path === NULL)
{
$root_path = str_replace... | php | public function read_dir($path, $preserve_filepath = TRUE, $root_path = NULL)
{
$path = rtrim($path, '/\\').DIRECTORY_SEPARATOR;
if ( ! $fp = @opendir($path))
{
return FALSE;
}
// Set the original directory root for child dir's to use as relative
if ($root_path === NULL)
{
$root_path = str_replace... | [
"public",
"function",
"read_dir",
"(",
"$",
"path",
",",
"$",
"preserve_filepath",
"=",
"TRUE",
",",
"$",
"root_path",
"=",
"NULL",
")",
"{",
"$",
"path",
"=",
"rtrim",
"(",
"$",
"path",
",",
"'/\\\\'",
")",
".",
"DIRECTORY_SEPARATOR",
";",
"if",
"(",
... | Read a directory and add it to the zip.
This function recursively reads a folder and everything it contains (including
sub-folders) and creates a zip based on it. Whatever directory structure
is in the original file path will be recreated in the zip file.
@param string $path path to source directory
@param bool $pres... | [
"Read",
"a",
"directory",
"and",
"add",
"it",
"to",
"the",
"zip",
"."
] | 051c64fdaa3a648174cbd54557d05ad553dd826b | https://github.com/FuzeWorks/Core/blob/051c64fdaa3a648174cbd54557d05ad553dd826b/src/Libraries/Zip.php#L351-L390 |
199,383 | FuzeWorks/Core | src/Libraries/Zip.php | FW_Zip.get_zip | public function get_zip()
{
// Is there any data to return?
if ($this->entries === 0)
{
return FALSE;
}
return $this->zipdata
.$this->directory."\x50\x4b\x05\x06\x00\x00\x00\x00"
.pack('v', $this->entries) // total # of entries "on this disk"
.pack('v', $this->entries) // total # of entries over... | php | public function get_zip()
{
// Is there any data to return?
if ($this->entries === 0)
{
return FALSE;
}
return $this->zipdata
.$this->directory."\x50\x4b\x05\x06\x00\x00\x00\x00"
.pack('v', $this->entries) // total # of entries "on this disk"
.pack('v', $this->entries) // total # of entries over... | [
"public",
"function",
"get_zip",
"(",
")",
"{",
"// Is there any data to return?",
"if",
"(",
"$",
"this",
"->",
"entries",
"===",
"0",
")",
"{",
"return",
"FALSE",
";",
"}",
"return",
"$",
"this",
"->",
"zipdata",
".",
"$",
"this",
"->",
"directory",
".... | Get the Zip file
@return string (binary encoded) | [
"Get",
"the",
"Zip",
"file"
] | 051c64fdaa3a648174cbd54557d05ad553dd826b | https://github.com/FuzeWorks/Core/blob/051c64fdaa3a648174cbd54557d05ad553dd826b/src/Libraries/Zip.php#L399-L414 |
199,384 | FuzeWorks/Core | src/Libraries/Zip.php | FW_Zip.archive | public function archive($filepath)
{
if ( ! ($fp = @fopen($filepath, 'w+b')))
{
return FALSE;
}
flock($fp, LOCK_EX);
for ($result = $written = 0, $data = $this->get_zip(), $length = strlen($data); $written < $length; $written += $result)
{
if (($result = fwrite($fp, substr($data, $written))) === FA... | php | public function archive($filepath)
{
if ( ! ($fp = @fopen($filepath, 'w+b')))
{
return FALSE;
}
flock($fp, LOCK_EX);
for ($result = $written = 0, $data = $this->get_zip(), $length = strlen($data); $written < $length; $written += $result)
{
if (($result = fwrite($fp, substr($data, $written))) === FA... | [
"public",
"function",
"archive",
"(",
"$",
"filepath",
")",
"{",
"if",
"(",
"!",
"(",
"$",
"fp",
"=",
"@",
"fopen",
"(",
"$",
"filepath",
",",
"'w+b'",
")",
")",
")",
"{",
"return",
"FALSE",
";",
"}",
"flock",
"(",
"$",
"fp",
",",
"LOCK_EX",
")... | Write File to the specified directory
Lets you write a file
@param string $filepath the file name
@return bool | [
"Write",
"File",
"to",
"the",
"specified",
"directory"
] | 051c64fdaa3a648174cbd54557d05ad553dd826b | https://github.com/FuzeWorks/Core/blob/051c64fdaa3a648174cbd54557d05ad553dd826b/src/Libraries/Zip.php#L426-L447 |
199,385 | covex-nn/JooS | src/JooS/Log/Log/Event.php | Log_Event.validateMessage | public function validateMessage($value)
{
if (is_string($value)) {
$result = true;
} elseif (is_object($value) && method_exists($value, "__toString")) {
$result = true;
} else {
$result = false;
}
return $result;
} | php | public function validateMessage($value)
{
if (is_string($value)) {
$result = true;
} elseif (is_object($value) && method_exists($value, "__toString")) {
$result = true;
} else {
$result = false;
}
return $result;
} | [
"public",
"function",
"validateMessage",
"(",
"$",
"value",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"value",
")",
")",
"{",
"$",
"result",
"=",
"true",
";",
"}",
"elseif",
"(",
"is_object",
"(",
"$",
"value",
")",
"&&",
"method_exists",
"(",
"$",... | Validator for 'message' property
@param string $value Message
@return boolean | [
"Validator",
"for",
"message",
"property"
] | 8dfb94edccecaf307787d4091ba7f20a674b7792 | https://github.com/covex-nn/JooS/blob/8dfb94edccecaf307787d4091ba7f20a674b7792/src/JooS/Log/Log/Event.php#L29-L40 |
199,386 | locomotivemtl/charcoal-config | src/Charcoal/Config/AbstractEntity.php | AbstractEntity.data | public function data(array $keys = null)
{
if ($keys === null) {
$keys = $this->keys();
}
$data = [];
foreach ($keys as $key) {
if (strtolower($key) === 'data') {
/** @internal Edge Case: Avoid recursive call */
continue;
... | php | public function data(array $keys = null)
{
if ($keys === null) {
$keys = $this->keys();
}
$data = [];
foreach ($keys as $key) {
if (strtolower($key) === 'data') {
/** @internal Edge Case: Avoid recursive call */
continue;
... | [
"public",
"function",
"data",
"(",
"array",
"$",
"keys",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"keys",
"===",
"null",
")",
"{",
"$",
"keys",
"=",
"$",
"this",
"->",
"keys",
"(",
")",
";",
"}",
"$",
"data",
"=",
"[",
"]",
";",
"foreach",
"(",... | Gets all data, or a subset, from this entity.
@uses self::offsetExists()
@uses self::offsetGet()
@param string[] $keys Optional. Extracts only the requested data.
@return array Key-value array of data, excluding pairs with NULL values. | [
"Gets",
"all",
"data",
"or",
"a",
"subset",
"from",
"this",
"entity",
"."
] | 722b34955360c287dea8fffb3b5491866ce5f6cb | https://github.com/locomotivemtl/charcoal-config/blob/722b34955360c287dea8fffb3b5491866ce5f6cb/src/Charcoal/Config/AbstractEntity.php#L47-L65 |
199,387 | locomotivemtl/charcoal-config | src/Charcoal/Config/AbstractEntity.php | AbstractEntity.offsetExists | public function offsetExists($key)
{
if (is_numeric($key)) {
throw new InvalidArgumentException(
'Entity array access only supports non-numeric keys'
);
}
$key = $this->camelize($key);
/** @internal Edge Case: "_" → "" */
if ($key ===... | php | public function offsetExists($key)
{
if (is_numeric($key)) {
throw new InvalidArgumentException(
'Entity array access only supports non-numeric keys'
);
}
$key = $this->camelize($key);
/** @internal Edge Case: "_" → "" */
if ($key ===... | [
"public",
"function",
"offsetExists",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"is_numeric",
"(",
"$",
"key",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'Entity array access only supports non-numeric keys'",
")",
";",
"}",
"$",
"key",
"=",
"... | Determines if this entity contains the specified key and if its value is not NULL.
Routine:
- If the entity has a getter method (e.g., "foo_bar" → `fooBar()`),
its called and its value is checked;
- If the entity has a property (e.g., `$fooBar`), its value is checked;
- If the entity has neither, FALSE is returned.
@... | [
"Determines",
"if",
"this",
"entity",
"contains",
"the",
"specified",
"key",
"and",
"if",
"its",
"value",
"is",
"not",
"NULL",
"."
] | 722b34955360c287dea8fffb3b5491866ce5f6cb | https://github.com/locomotivemtl/charcoal-config/blob/722b34955360c287dea8fffb3b5491866ce5f6cb/src/Charcoal/Config/AbstractEntity.php#L139-L164 |
199,388 | locomotivemtl/charcoal-config | src/Charcoal/Config/AbstractEntity.php | AbstractEntity.offsetSet | public function offsetSet($key, $value)
{
if (is_numeric($key)) {
throw new InvalidArgumentException(
'Entity array access only supports non-numeric keys'
);
}
$key = $this->camelize($key);
/** @internal Edge Case: "_" → "" */
if ($ke... | php | public function offsetSet($key, $value)
{
if (is_numeric($key)) {
throw new InvalidArgumentException(
'Entity array access only supports non-numeric keys'
);
}
$key = $this->camelize($key);
/** @internal Edge Case: "_" → "" */
if ($ke... | [
"public",
"function",
"offsetSet",
"(",
"$",
"key",
",",
"$",
"value",
")",
"{",
"if",
"(",
"is_numeric",
"(",
"$",
"key",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'Entity array access only supports non-numeric keys'",
")",
";",
"}",
"$... | Assigns the value to the specified key on this entity.
Routine:
- The data key is added to the {@see self::$keys entity's key pool}.
- If the entity has a setter method (e.g., "foo_bar" → `setFooBar()`),
its called and passed the value;
- If the entity has NO setter method, the value is assigned to a property (e.g., `... | [
"Assigns",
"the",
"value",
"to",
"the",
"specified",
"key",
"on",
"this",
"entity",
"."
] | 722b34955360c287dea8fffb3b5491866ce5f6cb | https://github.com/locomotivemtl/charcoal-config/blob/722b34955360c287dea8fffb3b5491866ce5f6cb/src/Charcoal/Config/AbstractEntity.php#L221-L244 |
199,389 | locomotivemtl/charcoal-config | src/Charcoal/Config/AbstractEntity.php | AbstractEntity.offsetUnset | public function offsetUnset($key)
{
if (is_numeric($key)) {
throw new InvalidArgumentException(
'Entity array access only supports non-numeric keys'
);
}
$key = $this->camelize($key);
/** @internal Edge Case: "_" → "" */
if ($key === ... | php | public function offsetUnset($key)
{
if (is_numeric($key)) {
throw new InvalidArgumentException(
'Entity array access only supports non-numeric keys'
);
}
$key = $this->camelize($key);
/** @internal Edge Case: "_" → "" */
if ($key === ... | [
"public",
"function",
"offsetUnset",
"(",
"$",
"key",
")",
"{",
"if",
"(",
"is_numeric",
"(",
"$",
"key",
")",
")",
"{",
"throw",
"new",
"InvalidArgumentException",
"(",
"'Entity array access only supports non-numeric keys'",
")",
";",
"}",
"$",
"key",
"=",
"$... | Removes the value from the specified key on this entity.
Routine:
- The data key is removed from the {@see self::$keys entity's key pool}.
- NULL is {@see self::offsetSet() assigned} to the entity.
@see \ArrayAccess
@uses self::offsetSet()
@param string $key The data key to remove.
@throws InvalidArgumentExcept... | [
"Removes",
"the",
"value",
"from",
"the",
"specified",
"key",
"on",
"this",
"entity",
"."
] | 722b34955360c287dea8fffb3b5491866ce5f6cb | https://github.com/locomotivemtl/charcoal-config/blob/722b34955360c287dea8fffb3b5491866ce5f6cb/src/Charcoal/Config/AbstractEntity.php#L259-L276 |
199,390 | locomotivemtl/charcoal-config | src/Charcoal/Config/AbstractEntity.php | AbstractEntity.camelize | final protected function camelize($str)
{
if (strstr($str, '_') === false) {
return $str;
}
return lcfirst(implode('', array_map('ucfirst', explode('_', $str))));
} | php | final protected function camelize($str)
{
if (strstr($str, '_') === false) {
return $str;
}
return lcfirst(implode('', array_map('ucfirst', explode('_', $str))));
} | [
"final",
"protected",
"function",
"camelize",
"(",
"$",
"str",
")",
"{",
"if",
"(",
"strstr",
"(",
"$",
"str",
",",
"'_'",
")",
"===",
"false",
")",
"{",
"return",
"$",
"str",
";",
"}",
"return",
"lcfirst",
"(",
"implode",
"(",
"''",
",",
"array_ma... | Transform a string from "snake_case" to "camelCase".
@param string $str The string to camelize.
@return string The camelized string. | [
"Transform",
"a",
"string",
"from",
"snake_case",
"to",
"camelCase",
"."
] | 722b34955360c287dea8fffb3b5491866ce5f6cb | https://github.com/locomotivemtl/charcoal-config/blob/722b34955360c287dea8fffb3b5491866ce5f6cb/src/Charcoal/Config/AbstractEntity.php#L319-L325 |
199,391 | midnightLuke/group-security-bundle | Security/GroupRoleVoter.php | GroupRoleVoter.extractRoles | public function extractRoles(GroupMembershipInterface $membership)
{
$roles = [];
foreach ($membership->getRoles() as $role) {
$roles[] = new Role($role);
}
return $roles;
} | php | public function extractRoles(GroupMembershipInterface $membership)
{
$roles = [];
foreach ($membership->getRoles() as $role) {
$roles[] = new Role($role);
}
return $roles;
} | [
"public",
"function",
"extractRoles",
"(",
"GroupMembershipInterface",
"$",
"membership",
")",
"{",
"$",
"roles",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"membership",
"->",
"getRoles",
"(",
")",
"as",
"$",
"role",
")",
"{",
"$",
"roles",
"[",
"]",
"=... | Returns the roles for this membership. | [
"Returns",
"the",
"roles",
"for",
"this",
"membership",
"."
] | b7e497939dc3fd9bc205b4595d29e2aa8f6e62c0 | https://github.com/midnightLuke/group-security-bundle/blob/b7e497939dc3fd9bc205b4595d29e2aa8f6e62c0/Security/GroupRoleVoter.php#L68-L75 |
199,392 | Torann/skosh-generator | src/Content/Post.php | Post.getExcerpt | protected function getExcerpt($content)
{
// Check for excerpt tags
$pattern = '#(\<\!\-\-\s?excerpt\s?\-\-\>)(.*)(\<\!\-\-\s?endexcerpt\s?\-\-\>)#si';
if (preg_match($pattern, $content, $matches)) {
return $matches[2];
}
// If all else get the content from the f... | php | protected function getExcerpt($content)
{
// Check for excerpt tags
$pattern = '#(\<\!\-\-\s?excerpt\s?\-\-\>)(.*)(\<\!\-\-\s?endexcerpt\s?\-\-\>)#si';
if (preg_match($pattern, $content, $matches)) {
return $matches[2];
}
// If all else get the content from the f... | [
"protected",
"function",
"getExcerpt",
"(",
"$",
"content",
")",
"{",
"// Check for excerpt tags",
"$",
"pattern",
"=",
"'#(\\<\\!\\-\\-\\s?excerpt\\s?\\-\\-\\>)(.*)(\\<\\!\\-\\-\\s?endexcerpt\\s?\\-\\-\\>)#si'",
";",
"if",
"(",
"preg_match",
"(",
"$",
"pattern",
",",
"$",
... | Get excerpt from between excerpt tags or
first paragraph.
@param string $content
@return string | [
"Get",
"excerpt",
"from",
"between",
"excerpt",
"tags",
"or",
"first",
"paragraph",
"."
] | ea60e037d92398d7c146eb2349735d5692e3c48c | https://github.com/Torann/skosh-generator/blob/ea60e037d92398d7c146eb2349735d5692e3c48c/src/Content/Post.php#L74-L84 |
199,393 | Torann/skosh-generator | src/Content/Post.php | Post.getTagClassNames | protected function getTagClassNames()
{
$tags = array_map(function($tag) {
return slugify($tag);
}, explode('|', $this->get('tags')));
return implode(' ', $tags);
} | php | protected function getTagClassNames()
{
$tags = array_map(function($tag) {
return slugify($tag);
}, explode('|', $this->get('tags')));
return implode(' ', $tags);
} | [
"protected",
"function",
"getTagClassNames",
"(",
")",
"{",
"$",
"tags",
"=",
"array_map",
"(",
"function",
"(",
"$",
"tag",
")",
"{",
"return",
"slugify",
"(",
"$",
"tag",
")",
";",
"}",
",",
"explode",
"(",
"'|'",
",",
"$",
"this",
"->",
"get",
"... | Get human readable tags.
@return string | [
"Get",
"human",
"readable",
"tags",
"."
] | ea60e037d92398d7c146eb2349735d5692e3c48c | https://github.com/Torann/skosh-generator/blob/ea60e037d92398d7c146eb2349735d5692e3c48c/src/Content/Post.php#L113-L120 |
199,394 | vdhicts/dicms-html-element | src/Element.php | Element.getAttribute | public function getAttribute(string $attribute): array
{
// Determine if the attribute is present
if (! array_key_exists($attribute, $this->attributes)) {
return [];
}
// Return the value of the attribute
return $this->attributes[$attribute];
} | php | public function getAttribute(string $attribute): array
{
// Determine if the attribute is present
if (! array_key_exists($attribute, $this->attributes)) {
return [];
}
// Return the value of the attribute
return $this->attributes[$attribute];
} | [
"public",
"function",
"getAttribute",
"(",
"string",
"$",
"attribute",
")",
":",
"array",
"{",
"// Determine if the attribute is present",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"attribute",
",",
"$",
"this",
"->",
"attributes",
")",
")",
"{",
"return",
... | Returns the value of the attribute. If the value isn't set, it returns the fallback;
@param string $attribute
@return array | [
"Returns",
"the",
"value",
"of",
"the",
"attribute",
".",
"If",
"the",
"value",
"isn",
"t",
"set",
"it",
"returns",
"the",
"fallback",
";"
] | 4b1013c78cd8d1bc677508ec732a1ba5305e7e4e | https://github.com/vdhicts/dicms-html-element/blob/4b1013c78cd8d1bc677508ec732a1ba5305e7e4e/src/Element.php#L86-L95 |
199,395 | vdhicts/dicms-html-element | src/Element.php | Element.setAttributes | public function setAttributes(array $attributesValues): self
{
foreach ($attributesValues as $attribute => $value) {
$this->setAttribute($attribute, $value);
}
return $this;
} | php | public function setAttributes(array $attributesValues): self
{
foreach ($attributesValues as $attribute => $value) {
$this->setAttribute($attribute, $value);
}
return $this;
} | [
"public",
"function",
"setAttributes",
"(",
"array",
"$",
"attributesValues",
")",
":",
"self",
"{",
"foreach",
"(",
"$",
"attributesValues",
"as",
"$",
"attribute",
"=>",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"setAttribute",
"(",
"$",
"attribute",
",... | Set the value of multiple attributes at once.
@param array $attributesValues
@return $this | [
"Set",
"the",
"value",
"of",
"multiple",
"attributes",
"at",
"once",
"."
] | 4b1013c78cd8d1bc677508ec732a1ba5305e7e4e | https://github.com/vdhicts/dicms-html-element/blob/4b1013c78cd8d1bc677508ec732a1ba5305e7e4e/src/Element.php#L102-L109 |
199,396 | vdhicts/dicms-html-element | src/Element.php | Element.setAttribute | public function setAttribute(string $attribute, $value = []): self
{
$this->attributes[$attribute] = $this->wrap($value);
return $this;
} | php | public function setAttribute(string $attribute, $value = []): self
{
$this->attributes[$attribute] = $this->wrap($value);
return $this;
} | [
"public",
"function",
"setAttribute",
"(",
"string",
"$",
"attribute",
",",
"$",
"value",
"=",
"[",
"]",
")",
":",
"self",
"{",
"$",
"this",
"->",
"attributes",
"[",
"$",
"attribute",
"]",
"=",
"$",
"this",
"->",
"wrap",
"(",
"$",
"value",
")",
";"... | Sets the value of an attribute. If the attribute is already set, it overwrites the current value.
@param string $attribute
@param array|string $value
@return $this | [
"Sets",
"the",
"value",
"of",
"an",
"attribute",
".",
"If",
"the",
"attribute",
"is",
"already",
"set",
"it",
"overwrites",
"the",
"current",
"value",
"."
] | 4b1013c78cd8d1bc677508ec732a1ba5305e7e4e | https://github.com/vdhicts/dicms-html-element/blob/4b1013c78cd8d1bc677508ec732a1ba5305e7e4e/src/Element.php#L117-L122 |
199,397 | vdhicts/dicms-html-element | src/Element.php | Element.addAttributeValue | public function addAttributeValue(string $attribute, string $value = ''): self
{
// Retrieve the current values of the attribute
$values = $this->getAttribute($attribute);
// Merge the values
if (! in_array($value, $values)) {
$values[] = $value;
}
// St... | php | public function addAttributeValue(string $attribute, string $value = ''): self
{
// Retrieve the current values of the attribute
$values = $this->getAttribute($attribute);
// Merge the values
if (! in_array($value, $values)) {
$values[] = $value;
}
// St... | [
"public",
"function",
"addAttributeValue",
"(",
"string",
"$",
"attribute",
",",
"string",
"$",
"value",
"=",
"''",
")",
":",
"self",
"{",
"// Retrieve the current values of the attribute",
"$",
"values",
"=",
"$",
"this",
"->",
"getAttribute",
"(",
"$",
"attrib... | Adds a value to the attribute.
@param string $attribute
@param string $value
@return $this | [
"Adds",
"a",
"value",
"to",
"the",
"attribute",
"."
] | 4b1013c78cd8d1bc677508ec732a1ba5305e7e4e | https://github.com/vdhicts/dicms-html-element/blob/4b1013c78cd8d1bc677508ec732a1ba5305e7e4e/src/Element.php#L130-L144 |
199,398 | vdhicts/dicms-html-element | src/Element.php | Element.removeAttributeValue | public function removeAttributeValue(string $attribute, string $value): self
{
// Only remove value if attribute is present
if (! array_key_exists($attribute, $this->attributes)) {
return $this;
}
// Remove the value from the attribute
$values = array_filter(
... | php | public function removeAttributeValue(string $attribute, string $value): self
{
// Only remove value if attribute is present
if (! array_key_exists($attribute, $this->attributes)) {
return $this;
}
// Remove the value from the attribute
$values = array_filter(
... | [
"public",
"function",
"removeAttributeValue",
"(",
"string",
"$",
"attribute",
",",
"string",
"$",
"value",
")",
":",
"self",
"{",
"// Only remove value if attribute is present",
"if",
"(",
"!",
"array_key_exists",
"(",
"$",
"attribute",
",",
"$",
"this",
"->",
... | Removes a value from the attribute.
@param string $attribute
@param string $value
@return $this | [
"Removes",
"a",
"value",
"from",
"the",
"attribute",
"."
] | 4b1013c78cd8d1bc677508ec732a1ba5305e7e4e | https://github.com/vdhicts/dicms-html-element/blob/4b1013c78cd8d1bc677508ec732a1ba5305e7e4e/src/Element.php#L178-L197 |
199,399 | vdhicts/dicms-html-element | src/Element.php | Element.generateAttribute | private function generateAttribute(string $attribute, array $values = []): string
{
if (! is_numeric($attribute)) {
return sprintf(
'%s="%s"',
$attribute,
htmlentities(trim(implode(' ', $values)))
);
}
return implode(' ... | php | private function generateAttribute(string $attribute, array $values = []): string
{
if (! is_numeric($attribute)) {
return sprintf(
'%s="%s"',
$attribute,
htmlentities(trim(implode(' ', $values)))
);
}
return implode(' ... | [
"private",
"function",
"generateAttribute",
"(",
"string",
"$",
"attribute",
",",
"array",
"$",
"values",
"=",
"[",
"]",
")",
":",
"string",
"{",
"if",
"(",
"!",
"is_numeric",
"(",
"$",
"attribute",
")",
")",
"{",
"return",
"sprintf",
"(",
"'%s=\"%s\"'",... | Generates the HTML for the attribute.
@param string $attribute
@param array $values
@return string | [
"Generates",
"the",
"HTML",
"for",
"the",
"attribute",
"."
] | 4b1013c78cd8d1bc677508ec732a1ba5305e7e4e | https://github.com/vdhicts/dicms-html-element/blob/4b1013c78cd8d1bc677508ec732a1ba5305e7e4e/src/Element.php#L264-L275 |
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.