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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
22,200 | CalderaWP/metaplate-core | src/file_load.php | file_load.load | public static function load( $file ) {
add_filter( 'calderawp_file_locator_allow_extensions', function( $allowed, $context ) {
if ( self::$context === $context ) {
$allowed = array( 'html', 'htm' );
}
return $allowed;
}, 10, 2 );
$file = file_locator::locate( $file, self::$context, true );
if... | php | public static function load( $file ) {
add_filter( 'calderawp_file_locator_allow_extensions', function( $allowed, $context ) {
if ( self::$context === $context ) {
$allowed = array( 'html', 'htm' );
}
return $allowed;
}, 10, 2 );
$file = file_locator::locate( $file, self::$context, true );
if... | [
"public",
"static",
"function",
"load",
"(",
"$",
"file",
")",
"{",
"add_filter",
"(",
"'calderawp_file_locator_allow_extensions'",
",",
"function",
"(",
"$",
"allowed",
",",
"$",
"context",
")",
"{",
"if",
"(",
"self",
"::",
"$",
"context",
"===",
"$",
"c... | Attempts to load a file and if so, puts its contents in an array as expected by Metaplate
@param string $file File path. Can be relative to current theme or absolute. Must be .html or .htm
@return array|void Returns an array 'html' => file contents if possible. | [
"Attempts",
"to",
"load",
"a",
"file",
"and",
"if",
"so",
"puts",
"its",
"contents",
"in",
"an",
"array",
"as",
"expected",
"by",
"Metaplate"
] | 15ede9c4250ab23112a32f8e45d5393f8278bbb8 | https://github.com/CalderaWP/metaplate-core/blob/15ede9c4250ab23112a32f8e45d5393f8278bbb8/src/file_load.php#L38-L57 |
22,201 | Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Base/src/options.php | ezcBaseOptions.merge | public function merge( array $newOptions )
{
foreach ( $newOptions as $key => $value )
{
$this->__set( $key, $value );
}
} | php | public function merge( array $newOptions )
{
foreach ( $newOptions as $key => $value )
{
$this->__set( $key, $value );
}
} | [
"public",
"function",
"merge",
"(",
"array",
"$",
"newOptions",
")",
"{",
"foreach",
"(",
"$",
"newOptions",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"$",
"this",
"->",
"__set",
"(",
"$",
"key",
",",
"$",
"value",
")",
";",
"}",
"}"
] | Merge an array into the actual options object.
This method merges an array of new options into the actual options object.
@throws ezcBasePropertyNotFoundException
If trying to access a non existent property.
@throws ezcBaseValueException
If the value for a property is out of range.
@param array(string=>mixed) $newOpti... | [
"Merge",
"an",
"array",
"into",
"the",
"actual",
"options",
"object",
".",
"This",
"method",
"merges",
"an",
"array",
"of",
"new",
"options",
"into",
"the",
"actual",
"options",
"object",
"."
] | b0afc661105f0a2f65d49abac13956cc93c5188d | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Base/src/options.php#L56-L62 |
22,202 | brick/di | src/Injector.php | Injector.invoke | public function invoke(callable $function, array $parameters = [])
{
$reflection = $this->reflectionTools->getReflectionFunction($function);
$parameters = $this->getFunctionParameters($reflection, $parameters);
return call_user_func_array($function, $parameters);
} | php | public function invoke(callable $function, array $parameters = [])
{
$reflection = $this->reflectionTools->getReflectionFunction($function);
$parameters = $this->getFunctionParameters($reflection, $parameters);
return call_user_func_array($function, $parameters);
} | [
"public",
"function",
"invoke",
"(",
"callable",
"$",
"function",
",",
"array",
"$",
"parameters",
"=",
"[",
"]",
")",
"{",
"$",
"reflection",
"=",
"$",
"this",
"->",
"reflectionTools",
"->",
"getReflectionFunction",
"(",
"$",
"function",
")",
";",
"$",
... | Invokes a function after resolving its parameters.
If the given parameters match the function parameter names, the given values are used.
Otherwise, the function parameters are resolved using the ValueResolver.
@param callable $function The function to invoke.
@param array $parameters An associative array of val... | [
"Invokes",
"a",
"function",
"after",
"resolving",
"its",
"parameters",
"."
] | 6ced82ab3623b8f1470317d38cbd2de855e7aa3d | https://github.com/brick/di/blob/6ced82ab3623b8f1470317d38cbd2de855e7aa3d/src/Injector.php#L53-L59 |
22,203 | brick/di | src/Injector.php | Injector.instantiate | public function instantiate(string $class, array $parameters = [])
{
$class = new \ReflectionClass($class);
$instance = $class->newInstanceWithoutConstructor();
$this->inject($instance);
$constructor = $class->getConstructor();
if ($constructor) {
$parameters =... | php | public function instantiate(string $class, array $parameters = [])
{
$class = new \ReflectionClass($class);
$instance = $class->newInstanceWithoutConstructor();
$this->inject($instance);
$constructor = $class->getConstructor();
if ($constructor) {
$parameters =... | [
"public",
"function",
"instantiate",
"(",
"string",
"$",
"class",
",",
"array",
"$",
"parameters",
"=",
"[",
"]",
")",
"{",
"$",
"class",
"=",
"new",
"\\",
"ReflectionClass",
"(",
"$",
"class",
")",
";",
"$",
"instance",
"=",
"$",
"class",
"->",
"new... | Instantiates a class by resolving its constructor parameters, and injects dependencies in the resulting object.
If the given parameters match the constructor parameter names, the given values are used.
Otherwise, the constructor parameters are resolved using the ValueResolver.
@param string $class The name of th... | [
"Instantiates",
"a",
"class",
"by",
"resolving",
"its",
"constructor",
"parameters",
"and",
"injects",
"dependencies",
"in",
"the",
"resulting",
"object",
"."
] | 6ced82ab3623b8f1470317d38cbd2de855e7aa3d | https://github.com/brick/di/blob/6ced82ab3623b8f1470317d38cbd2de855e7aa3d/src/Injector.php#L74-L90 |
22,204 | brick/di | src/Injector.php | Injector.inject | public function inject($object) : void
{
$reflection = new \ReflectionObject($object);
$this->injectProperties($reflection, $object);
$this->injectMethods($reflection, $object);
} | php | public function inject($object) : void
{
$reflection = new \ReflectionObject($object);
$this->injectProperties($reflection, $object);
$this->injectMethods($reflection, $object);
} | [
"public",
"function",
"inject",
"(",
"$",
"object",
")",
":",
"void",
"{",
"$",
"reflection",
"=",
"new",
"\\",
"ReflectionObject",
"(",
"$",
"object",
")",
";",
"$",
"this",
"->",
"injectProperties",
"(",
"$",
"reflection",
",",
"$",
"object",
")",
";... | Injects dependencies in an object.
Properties are injected first, then methods.
@param object $object The object to inject dependencies in.
@return void | [
"Injects",
"dependencies",
"in",
"an",
"object",
"."
] | 6ced82ab3623b8f1470317d38cbd2de855e7aa3d | https://github.com/brick/di/blob/6ced82ab3623b8f1470317d38cbd2de855e7aa3d/src/Injector.php#L101-L107 |
22,205 | brick/di | src/Injector.php | Injector.getFunctionParameters | private function getFunctionParameters(\ReflectionFunctionAbstract $function, array $parameters = []) : array
{
$result = [];
foreach ($function->getParameters() as $parameter) {
$name = $parameter->getName();
if (array_key_exists($name, $parameters)) {
$val... | php | private function getFunctionParameters(\ReflectionFunctionAbstract $function, array $parameters = []) : array
{
$result = [];
foreach ($function->getParameters() as $parameter) {
$name = $parameter->getName();
if (array_key_exists($name, $parameters)) {
$val... | [
"private",
"function",
"getFunctionParameters",
"(",
"\\",
"ReflectionFunctionAbstract",
"$",
"function",
",",
"array",
"$",
"parameters",
"=",
"[",
"]",
")",
":",
"array",
"{",
"$",
"result",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"function",
"->",
"get... | Returns an associative array of parameters to call a given function.
The parameters are indexed by name, and returned in the same order as they are defined.
@param \ReflectionFunctionAbstract $function The reflection of the function.
@param array $parameters An optional array of parameters ind... | [
"Returns",
"an",
"associative",
"array",
"of",
"parameters",
"to",
"call",
"a",
"given",
"function",
"."
] | 6ced82ab3623b8f1470317d38cbd2de855e7aa3d | https://github.com/brick/di/blob/6ced82ab3623b8f1470317d38cbd2de855e7aa3d/src/Injector.php#L155-L176 |
22,206 | ajant/SimpleArrayLibrary | src/Categories/Checkers.php | Checkers.allElementsEqual | public static function allElementsEqual(array $haystack, $needle = null)
{
$return = true;
// if both arguments have been passed, use value argument (regardless of whether it is null or not
if (func_num_args() == 2) {
$compareAgainst = $needle;
} // only one argument has ... | php | public static function allElementsEqual(array $haystack, $needle = null)
{
$return = true;
// if both arguments have been passed, use value argument (regardless of whether it is null or not
if (func_num_args() == 2) {
$compareAgainst = $needle;
} // only one argument has ... | [
"public",
"static",
"function",
"allElementsEqual",
"(",
"array",
"$",
"haystack",
",",
"$",
"needle",
"=",
"null",
")",
"{",
"$",
"return",
"=",
"true",
";",
"// if both arguments have been passed, use value argument (regardless of whether it is null or not",
"if",
"(",
... | Checks if all elements of the array have same value
@param array $haystack
@param mixed $needle
@return boolean | [
"Checks",
"if",
"all",
"elements",
"of",
"the",
"array",
"have",
"same",
"value"
] | 374877c0f20a22a914eb3680eb1cf39e424071be | https://github.com/ajant/SimpleArrayLibrary/blob/374877c0f20a22a914eb3680eb1cf39e424071be/src/Categories/Checkers.php#L17-L35 |
22,207 | PHPPowertools/HTML5 | src/PowerTools/HTML5/Elements.php | HTML5_Elements.isA | public static function isA($name, $mask) {
if (!static::isElement($name)) {
return false;
}
return (static::element($name) & $mask) == $mask;
} | php | public static function isA($name, $mask) {
if (!static::isElement($name)) {
return false;
}
return (static::element($name) & $mask) == $mask;
} | [
"public",
"static",
"function",
"isA",
"(",
"$",
"name",
",",
"$",
"mask",
")",
"{",
"if",
"(",
"!",
"static",
"::",
"isElement",
"(",
"$",
"name",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"(",
"static",
"::",
"element",
"(",
"$",
"n... | Check whether the given element meets the given criterion.
Example:
Elements::isA('script', Elements::TEXT_RAW); // Returns true.
Elements::isA('script', Elements::TEXT_RCDATA); // Returns false.
@param string $name
The element name.
@param int $mask
One of the constants on this class.
@return boolean true if the e... | [
"Check",
"whether",
"the",
"given",
"element",
"meets",
"the",
"given",
"criterion",
"."
] | 4ea8caf5b2618a82ca5061dcbb7421b31065c1c7 | https://github.com/PHPPowertools/HTML5/blob/4ea8caf5b2618a82ca5061dcbb7421b31065c1c7/src/PowerTools/HTML5/Elements.php#L560-L566 |
22,208 | PHPPowertools/HTML5 | src/PowerTools/HTML5/Elements.php | HTML5_Elements.element | public static function element($name) {
if (isset(static::$html5[$name])) {
return static::$html5[$name];
}
if (isset(static::$svg[$name])) {
return static::$svg[$name];
}
if (isset(static::$mathml[$name])) {
return static::$mathml[$name];
... | php | public static function element($name) {
if (isset(static::$html5[$name])) {
return static::$html5[$name];
}
if (isset(static::$svg[$name])) {
return static::$svg[$name];
}
if (isset(static::$mathml[$name])) {
return static::$mathml[$name];
... | [
"public",
"static",
"function",
"element",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"isset",
"(",
"static",
"::",
"$",
"html5",
"[",
"$",
"name",
"]",
")",
")",
"{",
"return",
"static",
"::",
"$",
"html5",
"[",
"$",
"name",
"]",
";",
"}",
"if",
"... | Get the element mask for the given element name.
@param string $name
The name of the element.
@return int The element mask. | [
"Get",
"the",
"element",
"mask",
"for",
"the",
"given",
"element",
"name",
"."
] | 4ea8caf5b2618a82ca5061dcbb7421b31065c1c7 | https://github.com/PHPPowertools/HTML5/blob/4ea8caf5b2618a82ca5061dcbb7421b31065c1c7/src/PowerTools/HTML5/Elements.php#L631-L643 |
22,209 | PHPPowertools/HTML5 | src/PowerTools/HTML5/Elements.php | HTML5_Elements.normalizeSvgElement | public static function normalizeSvgElement($name) {
$name = strtolower($name);
if (isset(static::$svgCaseSensitiveElementMap[$name])) {
$name = static::$svgCaseSensitiveElementMap[$name];
}
return $name;
} | php | public static function normalizeSvgElement($name) {
$name = strtolower($name);
if (isset(static::$svgCaseSensitiveElementMap[$name])) {
$name = static::$svgCaseSensitiveElementMap[$name];
}
return $name;
} | [
"public",
"static",
"function",
"normalizeSvgElement",
"(",
"$",
"name",
")",
"{",
"$",
"name",
"=",
"strtolower",
"(",
"$",
"name",
")",
";",
"if",
"(",
"isset",
"(",
"static",
"::",
"$",
"svgCaseSensitiveElementMap",
"[",
"$",
"name",
"]",
")",
")",
... | Normalize a SVG element name to its proper case and form.
@param string $name
The name of the element.
@return string The normalized form of the element name. | [
"Normalize",
"a",
"SVG",
"element",
"name",
"to",
"its",
"proper",
"case",
"and",
"form",
"."
] | 4ea8caf5b2618a82ca5061dcbb7421b31065c1c7 | https://github.com/PHPPowertools/HTML5/blob/4ea8caf5b2618a82ca5061dcbb7421b31065c1c7/src/PowerTools/HTML5/Elements.php#L653-L660 |
22,210 | PHPPowertools/HTML5 | src/PowerTools/HTML5/Elements.php | HTML5_Elements.normalizeSvgAttribute | public static function normalizeSvgAttribute($name) {
$name = strtolower($name);
if (isset(static::$svgCaseSensitiveAttributeMap[$name])) {
$name = static::$svgCaseSensitiveAttributeMap[$name];
}
return $name;
} | php | public static function normalizeSvgAttribute($name) {
$name = strtolower($name);
if (isset(static::$svgCaseSensitiveAttributeMap[$name])) {
$name = static::$svgCaseSensitiveAttributeMap[$name];
}
return $name;
} | [
"public",
"static",
"function",
"normalizeSvgAttribute",
"(",
"$",
"name",
")",
"{",
"$",
"name",
"=",
"strtolower",
"(",
"$",
"name",
")",
";",
"if",
"(",
"isset",
"(",
"static",
"::",
"$",
"svgCaseSensitiveAttributeMap",
"[",
"$",
"name",
"]",
")",
")"... | Normalize a SVG attribute name to its proper case and form.
@param string $name
The name of the attribute.
@return string The normalized form of the attribute name. | [
"Normalize",
"a",
"SVG",
"attribute",
"name",
"to",
"its",
"proper",
"case",
"and",
"form",
"."
] | 4ea8caf5b2618a82ca5061dcbb7421b31065c1c7 | https://github.com/PHPPowertools/HTML5/blob/4ea8caf5b2618a82ca5061dcbb7421b31065c1c7/src/PowerTools/HTML5/Elements.php#L670-L677 |
22,211 | spiral-modules/listing | source/Listing/Filters/SearchFilter.php | SearchFilter.summarize | private function summarize(array $whereClause, $selector)
{
switch (count($whereClause)) {
case 1:
return $whereClause[0];
default:
if ($selector instanceof RecordSelector) {
return ['@OR' => $whereClause];
}
... | php | private function summarize(array $whereClause, $selector)
{
switch (count($whereClause)) {
case 1:
return $whereClause[0];
default:
if ($selector instanceof RecordSelector) {
return ['@OR' => $whereClause];
}
... | [
"private",
"function",
"summarize",
"(",
"array",
"$",
"whereClause",
",",
"$",
"selector",
")",
"{",
"switch",
"(",
"count",
"(",
"$",
"whereClause",
")",
")",
"{",
"case",
"1",
":",
"return",
"$",
"whereClause",
"[",
"0",
"]",
";",
"default",
":",
... | Summarize expression array.
@param array $whereClause
@param RecordSelector|DocumentSelector $selector
@return array | [
"Summarize",
"expression",
"array",
"."
] | 89abe8939ce91cbf61b51b99e93ce1e57c8af83c | https://github.com/spiral-modules/listing/blob/89abe8939ce91cbf61b51b99e93ce1e57c8af83c/source/Listing/Filters/SearchFilter.php#L171-L188 |
22,212 | nabab/bbn | src/bbn/x.php | x.log | public static function log($st, $file='misc'){
if ( \defined('BBN_DATA_PATH') ){
if ( !\is_string($file) ){
$file = 'misc';
}
$log_file = BBN_DATA_PATH.'logs/'.$file.'.log';
$backtrace = array_filter(debug_backtrace(), function($a){
return $a['function'] === 'log';
});
... | php | public static function log($st, $file='misc'){
if ( \defined('BBN_DATA_PATH') ){
if ( !\is_string($file) ){
$file = 'misc';
}
$log_file = BBN_DATA_PATH.'logs/'.$file.'.log';
$backtrace = array_filter(debug_backtrace(), function($a){
return $a['function'] === 'log';
});
... | [
"public",
"static",
"function",
"log",
"(",
"$",
"st",
",",
"$",
"file",
"=",
"'misc'",
")",
"{",
"if",
"(",
"\\",
"defined",
"(",
"'BBN_DATA_PATH'",
")",
")",
"{",
"if",
"(",
"!",
"\\",
"is_string",
"(",
"$",
"file",
")",
")",
"{",
"$",
"file",
... | Saves logs to a file.
```php
\bbn\x::log('My text', 'FileName');
```
@param mixed $st Item to log.
@param string $file Filename, default: "misc".
@return void | [
"Saves",
"logs",
"to",
"a",
"file",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/x.php#L75-L103 |
22,213 | nabab/bbn | src/bbn/x.php | x.log_error | public static function log_error($errno, $errstr, $errfile, $errline){
if ( \defined('BBN_DATA_PATH') ){
if ( is_dir(BBN_DATA_PATH.'logs') ){
$file = BBN_DATA_PATH.'logs/_php_error.json';
$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 20);
$r = false;
if ( is_file($f... | php | public static function log_error($errno, $errstr, $errfile, $errline){
if ( \defined('BBN_DATA_PATH') ){
if ( is_dir(BBN_DATA_PATH.'logs') ){
$file = BBN_DATA_PATH.'logs/_php_error.json';
$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 20);
$r = false;
if ( is_file($f... | [
"public",
"static",
"function",
"log_error",
"(",
"$",
"errno",
",",
"$",
"errstr",
",",
"$",
"errfile",
",",
"$",
"errline",
")",
"{",
"if",
"(",
"\\",
"defined",
"(",
"'BBN_DATA_PATH'",
")",
")",
"{",
"if",
"(",
"is_dir",
"(",
"BBN_DATA_PATH",
".",
... | Puts the PHP errors into a JSON file.
@param string $errno The text to save.
@param string $errstr The file's name, default: "misc".
@param $errfile
@param $errline
@return bool | [
"Puts",
"the",
"PHP",
"errors",
"into",
"a",
"JSON",
"file",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/x.php#L114-L164 |
22,214 | nabab/bbn | src/bbn/x.php | x.merge_objects | public static function merge_objects($o1, $o2){
$args = \func_get_args();
/* @todo check if it's working with more than 2 object arguments */
if ( \count($args) > 2 ){
for ( $i = \count($args) - 1; $i > 1; $i-- ){
$args[$i-1] = self::merge_arrays($args[$i-1], $args[$i]);
}
$o2 = $a... | php | public static function merge_objects($o1, $o2){
$args = \func_get_args();
/* @todo check if it's working with more than 2 object arguments */
if ( \count($args) > 2 ){
for ( $i = \count($args) - 1; $i > 1; $i-- ){
$args[$i-1] = self::merge_arrays($args[$i-1], $args[$i]);
}
$o2 = $a... | [
"public",
"static",
"function",
"merge_objects",
"(",
"$",
"o1",
",",
"$",
"o2",
")",
"{",
"$",
"args",
"=",
"\\",
"func_get_args",
"(",
")",
";",
"/* @todo check if it's working with more than 2 object arguments */",
"if",
"(",
"\\",
"count",
"(",
"$",
"args",
... | Returns to a merged object from two objects.
```php
class A {
public $a = 10;
public $b = 20;
};
class B {
public $c = 30;
public $d = 40;
};
$obj1 = new A;
$obj2 = new B;
\bbn\x::merge_objects($obj1, $obj2);
// object {'a': 10, 'b': 20, 'c': 30, 'd': 40}
```
@param object $o1 The first object to merge.
@param obj... | [
"Returns",
"to",
"a",
"merged",
"object",
"from",
"two",
"objects",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/x.php#L191-L204 |
22,215 | nabab/bbn | src/bbn/x.php | x.merge_arrays | public static function merge_arrays(array $a1, array $a2){
$args = \func_get_args();
if ( \count($args) > 2 ){
for ( $i = \count($args) - 1; $i > 1; $i-- ){
$args[$i-1] = self::merge_arrays($args[$i-1], $args[$i]);
}
$a2 = $args[1];
}
if ( (self::is_assoc($a1) || empty($a1)) &&... | php | public static function merge_arrays(array $a1, array $a2){
$args = \func_get_args();
if ( \count($args) > 2 ){
for ( $i = \count($args) - 1; $i > 1; $i-- ){
$args[$i-1] = self::merge_arrays($args[$i-1], $args[$i]);
}
$a2 = $args[1];
}
if ( (self::is_assoc($a1) || empty($a1)) &&... | [
"public",
"static",
"function",
"merge_arrays",
"(",
"array",
"$",
"a1",
",",
"array",
"$",
"a2",
")",
"{",
"$",
"args",
"=",
"\\",
"func_get_args",
"(",
")",
";",
"if",
"(",
"\\",
"count",
"(",
"$",
"args",
")",
">",
"2",
")",
"{",
"for",
"(",
... | Returns to a merged array from two or more arrays.
```php
\bbn\x::merge_arrays([1, 'Test'], [2, 'Example']);
// array [1, 'Test', 2, 'Example']
```
@param array $a1 The first array to merge.
@param array $a2 The second array to merge.
@return array The merged array. | [
"Returns",
"to",
"a",
"merged",
"array",
"from",
"two",
"or",
"more",
"arrays",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/x.php#L217-L247 |
22,216 | nabab/bbn | src/bbn/x.php | x.is_assoc | public static function is_assoc(array $r){
$keys = array_keys($r);
$c = \count($keys);
for ( $i = 0; $i < $c; $i++ ){
if ( $keys[$i] !== $i ){
return 1;
}
}
return false;
} | php | public static function is_assoc(array $r){
$keys = array_keys($r);
$c = \count($keys);
for ( $i = 0; $i < $c; $i++ ){
if ( $keys[$i] !== $i ){
return 1;
}
}
return false;
} | [
"public",
"static",
"function",
"is_assoc",
"(",
"array",
"$",
"r",
")",
"{",
"$",
"keys",
"=",
"array_keys",
"(",
"$",
"r",
")",
";",
"$",
"c",
"=",
"\\",
"count",
"(",
"$",
"keys",
")",
";",
"for",
"(",
"$",
"i",
"=",
"0",
";",
"$",
"i",
... | Checks if the given array is associative.
```php
\bbn\\x::is_assoc(['id' => 0, 'name' => 'Allison']);
\bbn\\x::is_assoc(['Allison', 'John', 'Bert']);
\bbn\\x::is_assoc([0 => "Allison", 1 => "John", 2 => "Bert"]);
\bbn\\x::is_assoc([0 => "Allison", 1 => "John", 3 => "Bert"]);
// boolean true
// boolean false
// boo... | [
"Checks",
"if",
"the",
"given",
"array",
"is",
"associative",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/x.php#L487-L496 |
22,217 | nabab/bbn | src/bbn/x.php | x.get_dump | public static function get_dump(){
$args = \func_get_args();
$st = '';
foreach ( $args as $a ){
$r = $a;
if ( \is_null($a) ){
$r = 'null';
}
else if ( $a === false ){
$r = 'false';
}
else if ( $a === true ){
$r = 'true';
}
else if ( $a ... | php | public static function get_dump(){
$args = \func_get_args();
$st = '';
foreach ( $args as $a ){
$r = $a;
if ( \is_null($a) ){
$r = 'null';
}
else if ( $a === false ){
$r = 'false';
}
else if ( $a === true ){
$r = 'true';
}
else if ( $a ... | [
"public",
"static",
"function",
"get_dump",
"(",
")",
"{",
"$",
"args",
"=",
"\\",
"func_get_args",
"(",
")",
";",
"$",
"st",
"=",
"''",
";",
"foreach",
"(",
"$",
"args",
"as",
"$",
"a",
")",
"{",
"$",
"r",
"=",
"$",
"a",
";",
"if",
"(",
"\\"... | Returns a dump of the given variable.
@param mixed
@return string | [
"Returns",
"a",
"dump",
"of",
"the",
"given",
"variable",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/x.php#L504-L554 |
22,218 | nabab/bbn | src/bbn/x.php | x.to_keypair | public static function to_keypair($arr, $protected = 1){
$num = \count($arr);
$res = [];
if ( ($num % 2) === 0 ){
$i = 0;
while ( isset($arr[$i]) ){
if ( !\is_string($arr[$i]) || ( !$protected && !preg_match('/[0-9A-z\-_]+/8', str::cast($arr[$i])) ) ){
return false;
}
... | php | public static function to_keypair($arr, $protected = 1){
$num = \count($arr);
$res = [];
if ( ($num % 2) === 0 ){
$i = 0;
while ( isset($arr[$i]) ){
if ( !\is_string($arr[$i]) || ( !$protected && !preg_match('/[0-9A-z\-_]+/8', str::cast($arr[$i])) ) ){
return false;
}
... | [
"public",
"static",
"function",
"to_keypair",
"(",
"$",
"arr",
",",
"$",
"protected",
"=",
"1",
")",
"{",
"$",
"num",
"=",
"\\",
"count",
"(",
"$",
"arr",
")",
";",
"$",
"res",
"=",
"[",
"]",
";",
"if",
"(",
"(",
"$",
"num",
"%",
"2",
")",
... | Converts a numeric array into an associative one, alternating key and value.
```php
\bbn\x::to_keypair(['Test', 'TestFile', 'Example', 'ExampleFile']);
// string ['Test' => 'TestFile', 'Example' => 'ExampleFile']
```
@param array $arr The array. It must contain an even number of values
@param bool $protected If false... | [
"Converts",
"a",
"numeric",
"array",
"into",
"an",
"associative",
"one",
"alternating",
"key",
"and",
"value",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/x.php#L653-L667 |
22,219 | nabab/bbn | src/bbn/x.php | x.min_with_key | public static function min_with_key($array, $key){
if (!\is_array($array) || \count($array) == 0) return false;
$min = $array[0][$key];
foreach($array as $a){
if($a[$key] < $min){
$min = $a[$key];
}
}
return $min;
} | php | public static function min_with_key($array, $key){
if (!\is_array($array) || \count($array) == 0) return false;
$min = $array[0][$key];
foreach($array as $a){
if($a[$key] < $min){
$min = $a[$key];
}
}
return $min;
} | [
"public",
"static",
"function",
"min_with_key",
"(",
"$",
"array",
",",
"$",
"key",
")",
"{",
"if",
"(",
"!",
"\\",
"is_array",
"(",
"$",
"array",
")",
"||",
"\\",
"count",
"(",
"$",
"array",
")",
"==",
"0",
")",
"return",
"false",
";",
"$",
"min... | Returns the minimum value of an index from a multidimensional array.
```php
\bbn\x::min_with_key([
['age' => 1, 'name' => 'Michelle'],
['age' => 8, 'name' => 'John'],
['age' => 45, 'name' => 'Sarah'],
['age' => 45, 'name' => 'Camilla'],
['age' => 2, 'name' => 'Allison']
], 'age');
// int 1
```
@param array $array A ... | [
"Returns",
"the",
"minimum",
"value",
"of",
"an",
"index",
"from",
"a",
"multidimensional",
"array",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/x.php#L722-L731 |
22,220 | nabab/bbn | src/bbn/x.php | x.debug | public static function debug($file=''){
$debug = array_map(function($a){
if ( isset($a['object']) ){
unset($a['object']);
}
return $a;
}, debug_backtrace());
if ( empty($file) ){
self::hdump($debug);
}
else{
self::log($debug, $file);
}
} | php | public static function debug($file=''){
$debug = array_map(function($a){
if ( isset($a['object']) ){
unset($a['object']);
}
return $a;
}, debug_backtrace());
if ( empty($file) ){
self::hdump($debug);
}
else{
self::log($debug, $file);
}
} | [
"public",
"static",
"function",
"debug",
"(",
"$",
"file",
"=",
"''",
")",
"{",
"$",
"debug",
"=",
"array_map",
"(",
"function",
"(",
"$",
"a",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"a",
"[",
"'object'",
"]",
")",
")",
"{",
"unset",
"(",
"$",... | Gets the backtrace and dumps or logs it into a file.
```php
\bbn\x::dump(\bbn\x::debug());
```
@param string $file The file to debug
@return void | [
"Gets",
"the",
"backtrace",
"and",
"dumps",
"or",
"logs",
"it",
"into",
"a",
"file",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/x.php#L742-L755 |
22,221 | nabab/bbn | src/bbn/x.php | x.find | public static function find(array $ar, array $where){
//die(var_dump($where));
if ( !empty($where) ){
foreach ( $ar as $i => $v ){
$ok = 1;
foreach ( $where as $k => $w ){
if ( !isset($v[$k]) || ($v[$k] !== $w) ){
$ok = false;
break;
}
}
... | php | public static function find(array $ar, array $where){
//die(var_dump($where));
if ( !empty($where) ){
foreach ( $ar as $i => $v ){
$ok = 1;
foreach ( $where as $k => $w ){
if ( !isset($v[$k]) || ($v[$k] !== $w) ){
$ok = false;
break;
}
}
... | [
"public",
"static",
"function",
"find",
"(",
"array",
"$",
"ar",
",",
"array",
"$",
"where",
")",
"{",
"//die(var_dump($where));",
"if",
"(",
"!",
"empty",
"(",
"$",
"where",
")",
")",
"{",
"foreach",
"(",
"$",
"ar",
"as",
"$",
"i",
"=>",
"$",
"v",... | Returns the array's first index, which satisfies the 'where' condition.
```php
\bbn\x::hdump(\bbn\x::find([[
'id' => 1,
'name' => 'Andrew',
'fname' => 'Williams'
], [
'id' => 2,
'name' => 'Albert',
'fname' => 'Taylor'
], [
'id' => 3,
'name' => 'Mike',
'fname' => 'Smith'
], [
'id' => 4,
'name' => 'John',
'fname' => 'Wh... | [
"Returns",
"the",
"array",
"s",
"first",
"index",
"which",
"satisfies",
"the",
"where",
"condition",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/x.php#L893-L910 |
22,222 | nabab/bbn | src/bbn/x.php | x.get_field | public static function get_field(array $r, array $where, string $field){
if ( ($res = self::get_row($r, $where)) && isset($res[$field]) ){
return $res[$field];
}
return false;
} | php | public static function get_field(array $r, array $where, string $field){
if ( ($res = self::get_row($r, $where)) && isset($res[$field]) ){
return $res[$field];
}
return false;
} | [
"public",
"static",
"function",
"get_field",
"(",
"array",
"$",
"r",
",",
"array",
"$",
"where",
",",
"string",
"$",
"field",
")",
"{",
"if",
"(",
"(",
"$",
"res",
"=",
"self",
"::",
"get_row",
"(",
"$",
"r",
",",
"$",
"where",
")",
")",
"&&",
... | Returns the first value of a specific field of an array.
```php
\bbn\x::dump(\bbn\x::get_row([[
'id' => 1,
'name' => 'Andrew',
'fname' => 'Williams'
], [
'id' => 2,
'name' => 'Albert',
'fname' => 'Taylor'
], [
'id' => 3,
'name' => 'Mike',
'fname' => 'Smith'
], [
'id' => 4,
'name' => 'John',
'fname' => 'White'
]], ['na... | [
"Returns",
"the",
"first",
"value",
"of",
"a",
"specific",
"field",
"of",
"an",
"array",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/x.php#L977-L982 |
22,223 | nabab/bbn | src/bbn/x.php | x.sort | public static function sort(&$ar){
usort($ar, function($a, $b){
if ( !str::is_number($a, $b) ){
$a = str_replace('.', '0', str_replace('_', '1', str::change_case($a, 'lower')));
$b = str_replace('.', '0', str_replace('_', '1', str::change_case($b, 'lower')));
return strcmp($a, $b);
... | php | public static function sort(&$ar){
usort($ar, function($a, $b){
if ( !str::is_number($a, $b) ){
$a = str_replace('.', '0', str_replace('_', '1', str::change_case($a, 'lower')));
$b = str_replace('.', '0', str_replace('_', '1', str::change_case($b, 'lower')));
return strcmp($a, $b);
... | [
"public",
"static",
"function",
"sort",
"(",
"&",
"$",
"ar",
")",
"{",
"usort",
"(",
"$",
"ar",
",",
"function",
"(",
"$",
"a",
",",
"$",
"b",
")",
"{",
"if",
"(",
"!",
"str",
"::",
"is_number",
"(",
"$",
"a",
",",
"$",
"b",
")",
")",
"{",
... | Sorts the items of an array.
```php
$var = [3, 2, 5, 6, 1];
\bbn\x::sort($var);
\bbn\x::hdump($var);
// array [1,2,3,5,6]
```
@param $ar array The reference of the array to sort
@return void | [
"Sorts",
"the",
"items",
"of",
"an",
"array",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/x.php#L1035-L1050 |
22,224 | nabab/bbn | src/bbn/x.php | x.curl | public static function curl(string $url, array $param = null, array $options = ['post' => 1]){
$ch = curl_init();
self::$last_curl = $ch;
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
if (\is_object($param) ){
$param = self::to_array($param);
}
if ( \defined('BBN_IS_SSL') && \defined('BBN_I... | php | public static function curl(string $url, array $param = null, array $options = ['post' => 1]){
$ch = curl_init();
self::$last_curl = $ch;
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
if (\is_object($param) ){
$param = self::to_array($param);
}
if ( \defined('BBN_IS_SSL') && \defined('BBN_I... | [
"public",
"static",
"function",
"curl",
"(",
"string",
"$",
"url",
",",
"array",
"$",
"param",
"=",
"null",
",",
"array",
"$",
"options",
"=",
"[",
"'post'",
"=>",
"1",
"]",
")",
"{",
"$",
"ch",
"=",
"curl_init",
"(",
")",
";",
"self",
"::",
"$",... | Makes a Curl call towards a URL and returns the result as a string.
```php
$url = 'https://www.omdbapi.com/';
$param = ['t'=>'la vita è bella'];
\bbn\x::hdump(\bbn\x::curl($url,$param, ['POST' => false]));
// object {"Title":"La vita è bella","Year":"1943","Rated":"N/A","Released":"26 May 1943","Runtime":"76 mi... | [
"Makes",
"a",
"Curl",
"call",
"towards",
"a",
"URL",
"and",
"returns",
"the",
"result",
"as",
"a",
"string",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/x.php#L1143-L1189 |
22,225 | nabab/bbn | src/bbn/x.php | x.get_tree | public static function get_tree($ar){
$res = [];
foreach ( $ar as $k => $a ){
$r = ['text' => $k];
if ( \is_object($a) ){
$a = self::to_array($a);
}
if ( \is_array($a) ){
$r['items'] = self::get_tree($a);
}
else if ( \is_null($a) ){
$r['text'] .= ': nu... | php | public static function get_tree($ar){
$res = [];
foreach ( $ar as $k => $a ){
$r = ['text' => $k];
if ( \is_object($a) ){
$a = self::to_array($a);
}
if ( \is_array($a) ){
$r['items'] = self::get_tree($a);
}
else if ( \is_null($a) ){
$r['text'] .= ': nu... | [
"public",
"static",
"function",
"get_tree",
"(",
"$",
"ar",
")",
"{",
"$",
"res",
"=",
"[",
"]",
";",
"foreach",
"(",
"$",
"ar",
"as",
"$",
"k",
"=>",
"$",
"a",
")",
"{",
"$",
"r",
"=",
"[",
"'text'",
"=>",
"$",
"k",
"]",
";",
"if",
"(",
... | Returns the given array or object as a tree structure ready for a JS tree.
```php
\bbn\x::hdump(\bbn\x::get_tree([['id' => 1,'name' => 'Andrew','fname' => 'Williams','children' =>[['name' => 'Emma','age' => 6],['name' => 'Giorgio','age' => 9]]], ['id' => 2,'name' => 'Albert','fname' => 'Taylor','children' =>[['name' =... | [
"Returns",
"the",
"given",
"array",
"or",
"object",
"as",
"a",
"tree",
"structure",
"ready",
"for",
"a",
"JS",
"tree",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/x.php#L1227-L1252 |
22,226 | nabab/bbn | src/bbn/x.php | x.is_same | public static function is_same(string $file1, string $file2, $strict = false){
if ( !is_file($file1) || !is_file($file2) ){
throw Exception("Boo! One of the files given to the x::is_same function doesn't exist");
}
else{
$same = filesize($file1) === filesize($file2);
if ( !$strict || !$sam... | php | public static function is_same(string $file1, string $file2, $strict = false){
if ( !is_file($file1) || !is_file($file2) ){
throw Exception("Boo! One of the files given to the x::is_same function doesn't exist");
}
else{
$same = filesize($file1) === filesize($file2);
if ( !$strict || !$sam... | [
"public",
"static",
"function",
"is_same",
"(",
"string",
"$",
"file1",
",",
"string",
"$",
"file2",
",",
"$",
"strict",
"=",
"false",
")",
"{",
"if",
"(",
"!",
"is_file",
"(",
"$",
"file1",
")",
"||",
"!",
"is_file",
"(",
"$",
"file2",
")",
")",
... | Checks if two files are the same.
@param string $file1
@param string $file2
@param bool $strict
@return bool | [
"Checks",
"if",
"two",
"files",
"are",
"the",
"same",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/x.php#L1385-L1396 |
22,227 | nabab/bbn | src/bbn/x.php | x.to_excel | public static function to_excel(array $data, string $file, bool $with_titles = true): bool
{
$checked = false;
$todo = [];
foreach ( $data as $d ){
if ( !$checked && self::is_assoc($d) ){
if ( $with_titles ){
$line1 = [];
$line2 = [];
foreach ( $d as $k => $v ){... | php | public static function to_excel(array $data, string $file, bool $with_titles = true): bool
{
$checked = false;
$todo = [];
foreach ( $data as $d ){
if ( !$checked && self::is_assoc($d) ){
if ( $with_titles ){
$line1 = [];
$line2 = [];
foreach ( $d as $k => $v ){... | [
"public",
"static",
"function",
"to_excel",
"(",
"array",
"$",
"data",
",",
"string",
"$",
"file",
",",
"bool",
"$",
"with_titles",
"=",
"true",
")",
":",
"bool",
"{",
"$",
"checked",
"=",
"false",
";",
"$",
"todo",
"=",
"[",
"]",
";",
"foreach",
"... | Creates an Excel file from a given array.
@param array $array The array to export
@param string $file The file path
@param bool $with_titles Set it to false if you don't want the columns titles. Default true
@return bool | [
"Creates",
"an",
"Excel",
"file",
"from",
"a",
"given",
"array",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/x.php#L1462-L1494 |
22,228 | nabab/bbn | src/bbn/x.php | x.make_uid | public static function make_uid($binary = false, $hyphens = false){
$tmp = sprintf($hyphens ? '%04x%04x-%04x-%04x-%04x-%04x%04x%04x' : '%04x%04x%04x%04x%04x%04x%04x%04x',
// 32 bits for "time_low"
mt_rand(0, 0xffff), mt_rand(0, 0xffff),
// 16 bits for "time_mid"
mt_rand(0, 0xffff),
... | php | public static function make_uid($binary = false, $hyphens = false){
$tmp = sprintf($hyphens ? '%04x%04x-%04x-%04x-%04x-%04x%04x%04x' : '%04x%04x%04x%04x%04x%04x%04x%04x',
// 32 bits for "time_low"
mt_rand(0, 0xffff), mt_rand(0, 0xffff),
// 16 bits for "time_mid"
mt_rand(0, 0xffff),
... | [
"public",
"static",
"function",
"make_uid",
"(",
"$",
"binary",
"=",
"false",
",",
"$",
"hyphens",
"=",
"false",
")",
"{",
"$",
"tmp",
"=",
"sprintf",
"(",
"$",
"hyphens",
"?",
"'%04x%04x-%04x-%04x-%04x-%04x%04x%04x'",
":",
"'%04x%04x%04x%04x%04x%04x%04x%04x'",
... | Makes a UID.
@param bool $binary Set it to true if you want a binary UID
@param bool $hypens Set it to true if you want hypens to seperate the UID
@return string|bynary | [
"Makes",
"a",
"UID",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/x.php#L1503-L1525 |
22,229 | nabab/bbn | src/bbn/x.php | x.convert_uids | public static function convert_uids($st){
if ( \is_array($st) || \is_object($st) ){
foreach ( $st as &$s ){
$s = self::convert_uids($s);
}
}
else if ( \bbn\str::is_uid($st) ){
$st = bin2hex($st);
}
return $st;
} | php | public static function convert_uids($st){
if ( \is_array($st) || \is_object($st) ){
foreach ( $st as &$s ){
$s = self::convert_uids($s);
}
}
else if ( \bbn\str::is_uid($st) ){
$st = bin2hex($st);
}
return $st;
} | [
"public",
"static",
"function",
"convert_uids",
"(",
"$",
"st",
")",
"{",
"if",
"(",
"\\",
"is_array",
"(",
"$",
"st",
")",
"||",
"\\",
"is_object",
"(",
"$",
"st",
")",
")",
"{",
"foreach",
"(",
"$",
"st",
"as",
"&",
"$",
"s",
")",
"{",
"$",
... | Converts a hex UID to a binary UID. You can also give an array or an object to convert the array's items or the object's properties.
@param string|array|object $st
@return string | [
"Converts",
"a",
"hex",
"UID",
"to",
"a",
"binary",
"UID",
".",
"You",
"can",
"also",
"give",
"an",
"array",
"or",
"an",
"object",
"to",
"convert",
"the",
"array",
"s",
"items",
"or",
"the",
"object",
"s",
"properties",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/x.php#L1532-L1542 |
22,230 | nabab/bbn | src/bbn/x.php | x.compare_floats | public static function compare_floats($v1, $v2, string $operator = '===', int $precision = 4): bool
{
$v1 = round((float)$v1 * pow(10, $precision));
$v2 = round((float)$v2 * pow(10, $precision));
switch ($operator ){
case '===':
return $v1 === $v2;
case '==':
return $v1 == $v2;... | php | public static function compare_floats($v1, $v2, string $operator = '===', int $precision = 4): bool
{
$v1 = round((float)$v1 * pow(10, $precision));
$v2 = round((float)$v2 * pow(10, $precision));
switch ($operator ){
case '===':
return $v1 === $v2;
case '==':
return $v1 == $v2;... | [
"public",
"static",
"function",
"compare_floats",
"(",
"$",
"v1",
",",
"$",
"v2",
",",
"string",
"$",
"operator",
"=",
"'==='",
",",
"int",
"$",
"precision",
"=",
"4",
")",
":",
"bool",
"{",
"$",
"v1",
"=",
"round",
"(",
"(",
"float",
")",
"$",
"... | Compares two float numbers with the given operator.
@param float $v1
@param float $v2
@param string $operator
@param int $precision
@return boolean | [
"Compares",
"two",
"float",
"numbers",
"with",
"the",
"given",
"operator",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/x.php#L1553-L1572 |
22,231 | nabab/bbn | src/bbn/x.php | x.json_base64_decode | public static function json_base64_decode($st): ?array
{
$res = \is_string($st) ? json_decode($st, true) : $st;
if ( \is_array($res) ){
foreach ( $res as $i => $a ){
if ( \is_array($a) ){
$res[$i] = self::json_base64_decode($a);
}
else if ( \is_string($a) ){
$... | php | public static function json_base64_decode($st): ?array
{
$res = \is_string($st) ? json_decode($st, true) : $st;
if ( \is_array($res) ){
foreach ( $res as $i => $a ){
if ( \is_array($a) ){
$res[$i] = self::json_base64_decode($a);
}
else if ( \is_string($a) ){
$... | [
"public",
"static",
"function",
"json_base64_decode",
"(",
"$",
"st",
")",
":",
"?",
"array",
"{",
"$",
"res",
"=",
"\\",
"is_string",
"(",
"$",
"st",
")",
"?",
"json_decode",
"(",
"$",
"st",
",",
"true",
")",
":",
"$",
"st",
";",
"if",
"(",
"\\"... | Decodes the base64 array's values. You can also give a JSON string of an array.
@param string|array $st
@result array | [
"Decodes",
"the",
"base64",
"array",
"s",
"values",
".",
"You",
"can",
"also",
"give",
"a",
"JSON",
"string",
"of",
"an",
"array",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/x.php#L1604-L1622 |
22,232 | nabab/bbn | src/bbn/x.php | x.index_by_first_val | public static function index_by_first_val(array $ar): array
{
if ( empty($ar) || !isset($ar[0]) || !\count($ar[0]) ){
return $ar;
}
$cols = array_keys($ar[0]);
$idx = array_shift($cols);
$num_cols = \count($cols);
$res = [];
foreach ( $ar as $d ){
$index = $d[$idx];
unset... | php | public static function index_by_first_val(array $ar): array
{
if ( empty($ar) || !isset($ar[0]) || !\count($ar[0]) ){
return $ar;
}
$cols = array_keys($ar[0]);
$idx = array_shift($cols);
$num_cols = \count($cols);
$res = [];
foreach ( $ar as $d ){
$index = $d[$idx];
unset... | [
"public",
"static",
"function",
"index_by_first_val",
"(",
"array",
"$",
"ar",
")",
":",
"array",
"{",
"if",
"(",
"empty",
"(",
"$",
"ar",
")",
"||",
"!",
"isset",
"(",
"$",
"ar",
"[",
"0",
"]",
")",
"||",
"!",
"\\",
"count",
"(",
"$",
"ar",
"[... | Creates an associative array based on the first array's value.
@param array $ar
@return array | [
"Creates",
"an",
"associative",
"array",
"based",
"on",
"the",
"first",
"array",
"s",
"value",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/x.php#L1629-L1644 |
22,233 | fkooman/php-lib-http | src/fkooman/Http/Url.php | Url.getQueryString | public function getQueryString()
{
$requestUri = $this->getRequestUri();
if (false !== $qPos = mb_strpos($requestUri, '?')) {
// has query string
return mb_substr($requestUri, $qPos + 1);
}
return '';
} | php | public function getQueryString()
{
$requestUri = $this->getRequestUri();
if (false !== $qPos = mb_strpos($requestUri, '?')) {
// has query string
return mb_substr($requestUri, $qPos + 1);
}
return '';
} | [
"public",
"function",
"getQueryString",
"(",
")",
"{",
"$",
"requestUri",
"=",
"$",
"this",
"->",
"getRequestUri",
"(",
")",
";",
"if",
"(",
"false",
"!==",
"$",
"qPos",
"=",
"mb_strpos",
"(",
"$",
"requestUri",
",",
"'?'",
")",
")",
"{",
"// has query... | The query string.
@return string the query string, or empty string if no query string
is available | [
"The",
"query",
"string",
"."
] | 94956a480459b7f6b880d61f21ef03e683deb995 | https://github.com/fkooman/php-lib-http/blob/94956a480459b7f6b880d61f21ef03e683deb995/src/fkooman/Http/Url.php#L151-L161 |
22,234 | fkooman/php-lib-http | src/fkooman/Http/Url.php | Url.getQueryStringAsArray | public function getQueryStringAsArray()
{
$queryString = $this->getQueryString();
if ('' === $queryString) {
return [];
}
$queryStringArray = [];
parse_str($queryString, $queryStringArray);
return $queryStringArray;
} | php | public function getQueryStringAsArray()
{
$queryString = $this->getQueryString();
if ('' === $queryString) {
return [];
}
$queryStringArray = [];
parse_str($queryString, $queryStringArray);
return $queryStringArray;
} | [
"public",
"function",
"getQueryStringAsArray",
"(",
")",
"{",
"$",
"queryString",
"=",
"$",
"this",
"->",
"getQueryString",
"(",
")",
";",
"if",
"(",
"''",
"===",
"$",
"queryString",
")",
"{",
"return",
"[",
"]",
";",
"}",
"$",
"queryStringArray",
"=",
... | The query string as array.
@return array the query string as array. The array will be empty if
the query string is empty | [
"The",
"query",
"string",
"as",
"array",
"."
] | 94956a480459b7f6b880d61f21ef03e683deb995 | https://github.com/fkooman/php-lib-http/blob/94956a480459b7f6b880d61f21ef03e683deb995/src/fkooman/Http/Url.php#L169-L181 |
22,235 | fkooman/php-lib-http | src/fkooman/Http/Url.php | Url.getQueryParameter | public function getQueryParameter($key)
{
$queryStringArray = $this->getQueryStringAsArray();
if (array_key_exists($key, $queryStringArray)) {
return $queryStringArray[$key];
}
return null;
} | php | public function getQueryParameter($key)
{
$queryStringArray = $this->getQueryStringAsArray();
if (array_key_exists($key, $queryStringArray)) {
return $queryStringArray[$key];
}
return null;
} | [
"public",
"function",
"getQueryParameter",
"(",
"$",
"key",
")",
"{",
"$",
"queryStringArray",
"=",
"$",
"this",
"->",
"getQueryStringAsArray",
"(",
")",
";",
"if",
"(",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"queryStringArray",
")",
")",
"{",
"ret... | Return a specific query string parameter value.
@param string $key the query parameter key to get
@return mixed the query parameter value if it is set, or null if the
parameter is not available | [
"Return",
"a",
"specific",
"query",
"string",
"parameter",
"value",
"."
] | 94956a480459b7f6b880d61f21ef03e683deb995 | https://github.com/fkooman/php-lib-http/blob/94956a480459b7f6b880d61f21ef03e683deb995/src/fkooman/Http/Url.php#L191-L200 |
22,236 | fkooman/php-lib-http | src/fkooman/Http/Url.php | Url.getRoot | public function getRoot()
{
$requestUri = $this->getRequestUri();
$pathInfo = $this->getPathInfo();
// remove query string from REQUEST_URI, if set
if (false !== $qPos = mb_strpos($requestUri, '?')) {
// has query string
$requestUri = mb_substr($requestUri, 0... | php | public function getRoot()
{
$requestUri = $this->getRequestUri();
$pathInfo = $this->getPathInfo();
// remove query string from REQUEST_URI, if set
if (false !== $qPos = mb_strpos($requestUri, '?')) {
// has query string
$requestUri = mb_substr($requestUri, 0... | [
"public",
"function",
"getRoot",
"(",
")",
"{",
"$",
"requestUri",
"=",
"$",
"this",
"->",
"getRequestUri",
"(",
")",
";",
"$",
"pathInfo",
"=",
"$",
"this",
"->",
"getPathInfo",
"(",
")",
";",
"// remove query string from REQUEST_URI, if set",
"if",
"(",
"f... | Get the REQUEST_URI without PATH_INFO and QUERY_STRING, taking server
rewriting in consideration.
Example (without URL rewriting):
https://www.example.org/foo/index.php/bar?a=b will return:
'/foo/index.php'
Example (with URL rewriting to index.php):
https://www.example.org/foo/bar?a=b will return:
'/foo'
Example (wi... | [
"Get",
"the",
"REQUEST_URI",
"without",
"PATH_INFO",
"and",
"QUERY_STRING",
"taking",
"server",
"rewriting",
"in",
"consideration",
"."
] | 94956a480459b7f6b880d61f21ef03e683deb995 | https://github.com/fkooman/php-lib-http/blob/94956a480459b7f6b880d61f21ef03e683deb995/src/fkooman/Http/Url.php#L218-L236 |
22,237 | fkooman/php-lib-http | src/fkooman/Http/Url.php | Url.getAuthority | public function getAuthority()
{
$scheme = $this->getScheme();
$serverName = $this->getHost();
$serverPort = $this->getPort();
$authority = sprintf('%s://%s', $scheme, $serverName);
if (('https' === $scheme && 443 !== $serverPort) || ('http' === $scheme && 80 !== $serverPort... | php | public function getAuthority()
{
$scheme = $this->getScheme();
$serverName = $this->getHost();
$serverPort = $this->getPort();
$authority = sprintf('%s://%s', $scheme, $serverName);
if (('https' === $scheme && 443 !== $serverPort) || ('http' === $scheme && 80 !== $serverPort... | [
"public",
"function",
"getAuthority",
"(",
")",
"{",
"$",
"scheme",
"=",
"$",
"this",
"->",
"getScheme",
"(",
")",
";",
"$",
"serverName",
"=",
"$",
"this",
"->",
"getHost",
"(",
")",
";",
"$",
"serverPort",
"=",
"$",
"this",
"->",
"getPort",
"(",
... | Get the authority part of the URL. That is, the scheme, host and
optional port if it is not a standard port.
@return string the authority part of the URL | [
"Get",
"the",
"authority",
"part",
"of",
"the",
"URL",
".",
"That",
"is",
"the",
"scheme",
"host",
"and",
"optional",
"port",
"if",
"it",
"is",
"not",
"a",
"standard",
"port",
"."
] | 94956a480459b7f6b880d61f21ef03e683deb995 | https://github.com/fkooman/php-lib-http/blob/94956a480459b7f6b880d61f21ef03e683deb995/src/fkooman/Http/Url.php#L252-L264 |
22,238 | gdbots/iam-php | src/Policy.php | Policy.isGranted | public function isGranted(string $action): bool
{
if (empty($this->allowed)) {
return false;
}
if (isset($this->denied[$action]) || isset($this->denied[self::WILDCARD])) {
return false;
}
$rules = $this->getRules($action);
foreach ($rules as... | php | public function isGranted(string $action): bool
{
if (empty($this->allowed)) {
return false;
}
if (isset($this->denied[$action]) || isset($this->denied[self::WILDCARD])) {
return false;
}
$rules = $this->getRules($action);
foreach ($rules as... | [
"public",
"function",
"isGranted",
"(",
"string",
"$",
"action",
")",
":",
"bool",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"allowed",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"denied",
"[",
... | Returns true if the policy should allow the action
to be carried out.
@param string $action
@return bool | [
"Returns",
"true",
"if",
"the",
"policy",
"should",
"allow",
"the",
"action",
"to",
"be",
"carried",
"out",
"."
] | 3dbfa602de183a7ac5fb5140304e8cf4c4b15ab3 | https://github.com/gdbots/iam-php/blob/3dbfa602de183a7ac5fb5140304e8cf4c4b15ab3/src/Policy.php#L61-L86 |
22,239 | gdbots/iam-php | src/Policy.php | Policy.getRules | private function getRules(string $action): array
{
$rules = [];
$parts = explode(self::DELIMITER, $action);
while (array_pop($parts)) {
$rules[] = implode(self::DELIMITER, $parts) . self::DELIMITER . self::WILDCARD;
}
$rules = array_reverse($rules);
$rul... | php | private function getRules(string $action): array
{
$rules = [];
$parts = explode(self::DELIMITER, $action);
while (array_pop($parts)) {
$rules[] = implode(self::DELIMITER, $parts) . self::DELIMITER . self::WILDCARD;
}
$rules = array_reverse($rules);
$rul... | [
"private",
"function",
"getRules",
"(",
"string",
"$",
"action",
")",
":",
"array",
"{",
"$",
"rules",
"=",
"[",
"]",
";",
"$",
"parts",
"=",
"explode",
"(",
"self",
"::",
"DELIMITER",
",",
"$",
"action",
")",
";",
"while",
"(",
"array_pop",
"(",
"... | Converts an action with potentially colon delimiters
into a set of permissions to check for.
@example
An action of "acme:blog:command:publish-article" becomes
an array of:
[
'*',
'acme:*',
'acme:blog:*',
'acme:blog:command:*',
'acme:blog:command:publish-article',
]
@param string $action
@return string[] | [
"Converts",
"an",
"action",
"with",
"potentially",
"colon",
"delimiters",
"into",
"a",
"set",
"of",
"permissions",
"to",
"check",
"for",
"."
] | 3dbfa602de183a7ac5fb5140304e8cf4c4b15ab3 | https://github.com/gdbots/iam-php/blob/3dbfa602de183a7ac5fb5140304e8cf4c4b15ab3/src/Policy.php#L127-L141 |
22,240 | rhosocial/yii2-user | models/log/UserLoginTrait.php | UserLoginTrait.getLoginLogs | public function getLoginLogs()
{
/* @var $this User */
$class = $this->loginLogClass;
try {
return $class::getLatests($this, Login::GET_ALL_LATESTS);
} catch (\Exception $ex) {
Yii::error($ex->getMessage(), __METHOD__);
return [];
}
} | php | public function getLoginLogs()
{
/* @var $this User */
$class = $this->loginLogClass;
try {
return $class::getLatests($this, Login::GET_ALL_LATESTS);
} catch (\Exception $ex) {
Yii::error($ex->getMessage(), __METHOD__);
return [];
}
} | [
"public",
"function",
"getLoginLogs",
"(",
")",
"{",
"/* @var $this User */",
"$",
"class",
"=",
"$",
"this",
"->",
"loginLogClass",
";",
"try",
"{",
"return",
"$",
"class",
"::",
"getLatests",
"(",
"$",
"this",
",",
"Login",
"::",
"GET_ALL_LATESTS",
")",
... | Get login logs.
@return Login[] | [
"Get",
"login",
"logs",
"."
] | 96737a9d8ca7e9c42cd2b7736d6c0a90ede6e5bc | https://github.com/rhosocial/yii2-user/blob/96737a9d8ca7e9c42cd2b7736d6c0a90ede6e5bc/models/log/UserLoginTrait.php#L35-L45 |
22,241 | rhosocial/yii2-user | models/log/UserLoginTrait.php | UserLoginTrait.recordLogin | public function recordLogin($config = [])
{
if (empty($this->loginLogClass)) {
return false;
}
$log = $this->create($this->loginLogClass, $config);
try {
return $log->save();
} catch (\Exception $ex) {
Yii::error($ex->getMessage(), __METHOD... | php | public function recordLogin($config = [])
{
if (empty($this->loginLogClass)) {
return false;
}
$log = $this->create($this->loginLogClass, $config);
try {
return $log->save();
} catch (\Exception $ex) {
Yii::error($ex->getMessage(), __METHOD... | [
"public",
"function",
"recordLogin",
"(",
"$",
"config",
"=",
"[",
"]",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"loginLogClass",
")",
")",
"{",
"return",
"false",
";",
"}",
"$",
"log",
"=",
"$",
"this",
"->",
"create",
"(",
"$",
"th... | Record login.
@param array $config
@return mixed | [
"Record",
"login",
"."
] | 96737a9d8ca7e9c42cd2b7736d6c0a90ede6e5bc | https://github.com/rhosocial/yii2-user/blob/96737a9d8ca7e9c42cd2b7736d6c0a90ede6e5bc/models/log/UserLoginTrait.php#L68-L79 |
22,242 | jnaxo/country-codes | src/Store/api/Collection.php | Collection.setData | public function setData($collection, $resource_name = '')
{
$this->collection = collect();
if (!$this->resource_name) {
$this->resource_name = empty($resource_name) ? 'undefined' : $resource_name;
}
$this->data = [];
foreach ($collection as $item) {
... | php | public function setData($collection, $resource_name = '')
{
$this->collection = collect();
if (!$this->resource_name) {
$this->resource_name = empty($resource_name) ? 'undefined' : $resource_name;
}
$this->data = [];
foreach ($collection as $item) {
... | [
"public",
"function",
"setData",
"(",
"$",
"collection",
",",
"$",
"resource_name",
"=",
"''",
")",
"{",
"$",
"this",
"->",
"collection",
"=",
"collect",
"(",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"resource_name",
")",
"{",
"$",
"this",
"->",
... | Set collection data
@param type $collection
@param string $resource_name | [
"Set",
"collection",
"data"
] | ab1f24886e1b49eef5fd4b4eb4fb37aa7faeacd9 | https://github.com/jnaxo/country-codes/blob/ab1f24886e1b49eef5fd4b4eb4fb37aa7faeacd9/src/Store/api/Collection.php#L87-L103 |
22,243 | sciactive/nymph-server | src/Nymph.php | Nymph.configure | public static function configure($config = []) {
$defaults = include dirname(__DIR__).'/conf/defaults.php';
self::$config = array_replace_recursive($defaults, $config);
if (isset(self::$driver)) {
if (self::$driver->connected) {
self::$driver->disconnect();
}
self::$driver = null;... | php | public static function configure($config = []) {
$defaults = include dirname(__DIR__).'/conf/defaults.php';
self::$config = array_replace_recursive($defaults, $config);
if (isset(self::$driver)) {
if (self::$driver->connected) {
self::$driver->disconnect();
}
self::$driver = null;... | [
"public",
"static",
"function",
"configure",
"(",
"$",
"config",
"=",
"[",
"]",
")",
"{",
"$",
"defaults",
"=",
"include",
"dirname",
"(",
"__DIR__",
")",
".",
"'/conf/defaults.php'",
";",
"self",
"::",
"$",
"config",
"=",
"array_replace_recursive",
"(",
"... | Apply configuration to Nymph.
$config should be an associative array of Nymph configuration. Use the
following form:
[
'driver' => 'MySQL',
'pubsub' => true,
'MySql' => [
'host' => '127.0.0.1'
]
]
@param array $config An associative array of Nymph's configuration. | [
"Apply",
"configuration",
"to",
"Nymph",
"."
] | 3c18dbf45c2750d07c798e14534dba87387beeba | https://github.com/sciactive/nymph-server/blob/3c18dbf45c2750d07c798e14534dba87387beeba/src/Nymph.php#L55-L76 |
22,244 | sciactive/nymph-server | src/Nymph.php | Nymph.checkData | public static function checkData(
&$data,
&$sdata,
$selectors,
$guid = null,
$tags = null,
$typesAlreadyChecked = [],
$dataValsAreadyChecked = []
) {
return self::$driver->checkData(
$data,
$sdata,
$selectors,
$guid,
$tags,
... | php | public static function checkData(
&$data,
&$sdata,
$selectors,
$guid = null,
$tags = null,
$typesAlreadyChecked = [],
$dataValsAreadyChecked = []
) {
return self::$driver->checkData(
$data,
$sdata,
$selectors,
$guid,
$tags,
... | [
"public",
"static",
"function",
"checkData",
"(",
"&",
"$",
"data",
",",
"&",
"$",
"sdata",
",",
"$",
"selectors",
",",
"$",
"guid",
"=",
"null",
",",
"$",
"tags",
"=",
"null",
",",
"$",
"typesAlreadyChecked",
"=",
"[",
"]",
",",
"$",
"dataValsAready... | Check entity data to see if it matches given selectors.
@param array $data An array of unserialized entity data. The data array
should contain the cdate and mdate.
@param array $sdata An array of serialized entity data. If a value here is
checked, it will be unserialized and placed in the
$data array.
@param array $se... | [
"Check",
"entity",
"data",
"to",
"see",
"if",
"it",
"matches",
"given",
"selectors",
"."
] | 3c18dbf45c2750d07c798e14534dba87387beeba | https://github.com/sciactive/nymph-server/blob/3c18dbf45c2750d07c798e14534dba87387beeba/src/Nymph.php#L101-L119 |
22,245 | sciactive/nymph-server | src/Nymph.php | Nymph.hsort | public static function hsort(
&$array,
$property = null,
$parentProperty = null,
$caseSensitive = false,
$reverse = false
) {
return self::$driver->hsort(
$array,
$property,
$parentProperty,
$caseSensitive,
$reverse
);
} | php | public static function hsort(
&$array,
$property = null,
$parentProperty = null,
$caseSensitive = false,
$reverse = false
) {
return self::$driver->hsort(
$array,
$property,
$parentProperty,
$caseSensitive,
$reverse
);
} | [
"public",
"static",
"function",
"hsort",
"(",
"&",
"$",
"array",
",",
"$",
"property",
"=",
"null",
",",
"$",
"parentProperty",
"=",
"null",
",",
"$",
"caseSensitive",
"=",
"false",
",",
"$",
"reverse",
"=",
"false",
")",
"{",
"return",
"self",
"::",
... | Sort an array of entities hierarchically by a specified property's value.
Entities will be placed immediately after their parents. The
$parentProperty property must hold either null, or the entity's parent.
@param array &$array The array of entities.
@param string|null $property The name of the property to sort entit... | [
"Sort",
"an",
"array",
"of",
"entities",
"hierarchically",
"by",
"a",
"specified",
"property",
"s",
"value",
"."
] | 3c18dbf45c2750d07c798e14534dba87387beeba | https://github.com/sciactive/nymph-server/blob/3c18dbf45c2750d07c798e14534dba87387beeba/src/Nymph.php#L160-L174 |
22,246 | sciactive/nymph-server | src/Nymph.php | Nymph.sort | public static function sort(
&$array,
$property = null,
$caseSensitive = false,
$reverse = false
) {
return self::$driver->sort(
$array,
$property,
$caseSensitive,
$reverse
);
} | php | public static function sort(
&$array,
$property = null,
$caseSensitive = false,
$reverse = false
) {
return self::$driver->sort(
$array,
$property,
$caseSensitive,
$reverse
);
} | [
"public",
"static",
"function",
"sort",
"(",
"&",
"$",
"array",
",",
"$",
"property",
"=",
"null",
",",
"$",
"caseSensitive",
"=",
"false",
",",
"$",
"reverse",
"=",
"false",
")",
"{",
"return",
"self",
"::",
"$",
"driver",
"->",
"sort",
"(",
"$",
... | Sort an array of entities by a specified property's value.
@param array &$array The array of entities.
@param string|null $property The name of the property to sort entities by.
@param bool $caseSensitive Sort case sensitively.
@param bool $reverse Reverse the sort order. | [
"Sort",
"an",
"array",
"of",
"entities",
"by",
"a",
"specified",
"property",
"s",
"value",
"."
] | 3c18dbf45c2750d07c798e14534dba87387beeba | https://github.com/sciactive/nymph-server/blob/3c18dbf45c2750d07c798e14534dba87387beeba/src/Nymph.php#L213-L225 |
22,247 | infusephp/infuse | src/SymfonyHttpBridge.php | SymfonyHttpBridge.convertSymfonyRequest | public function convertSymfonyRequest(SymfonyRequest $request)
{
$session = $request->getSession();
if ($session) {
$session = $session->all();
} else {
$session = [];
}
// decode request parameters
$parameters = $request->request->all();
... | php | public function convertSymfonyRequest(SymfonyRequest $request)
{
$session = $request->getSession();
if ($session) {
$session = $session->all();
} else {
$session = [];
}
// decode request parameters
$parameters = $request->request->all();
... | [
"public",
"function",
"convertSymfonyRequest",
"(",
"SymfonyRequest",
"$",
"request",
")",
"{",
"$",
"session",
"=",
"$",
"request",
"->",
"getSession",
"(",
")",
";",
"if",
"(",
"$",
"session",
")",
"{",
"$",
"session",
"=",
"$",
"session",
"->",
"all",... | Converts a Symfony request object into an Infuse request object.
@param SymfonyRequest $request
@return Request | [
"Converts",
"a",
"Symfony",
"request",
"object",
"into",
"an",
"Infuse",
"request",
"object",
"."
] | 7520b237c69f3d8a07d95d7481b26027ced2ed83 | https://github.com/infusephp/infuse/blob/7520b237c69f3d8a07d95d7481b26027ced2ed83/src/SymfonyHttpBridge.php#L22-L44 |
22,248 | infusephp/infuse | src/SymfonyHttpBridge.php | SymfonyHttpBridge.convertInfuseResponse | public function convertInfuseResponse(Response $res)
{
$response = new SymfonyResponse($res->getBody(), $res->getCode(), $res->headers());
// transfer cookies
foreach ($res->cookies() as $name => $params) {
list($value, $expire, $path, $domain, $secure, $httponly) = $params;
... | php | public function convertInfuseResponse(Response $res)
{
$response = new SymfonyResponse($res->getBody(), $res->getCode(), $res->headers());
// transfer cookies
foreach ($res->cookies() as $name => $params) {
list($value, $expire, $path, $domain, $secure, $httponly) = $params;
... | [
"public",
"function",
"convertInfuseResponse",
"(",
"Response",
"$",
"res",
")",
"{",
"$",
"response",
"=",
"new",
"SymfonyResponse",
"(",
"$",
"res",
"->",
"getBody",
"(",
")",
",",
"$",
"res",
"->",
"getCode",
"(",
")",
",",
"$",
"res",
"->",
"header... | Converts an Infuse response object into a Symfony response object.
@param Response $res
@return SymfonyResponse | [
"Converts",
"an",
"Infuse",
"response",
"object",
"into",
"a",
"Symfony",
"response",
"object",
"."
] | 7520b237c69f3d8a07d95d7481b26027ced2ed83 | https://github.com/infusephp/infuse/blob/7520b237c69f3d8a07d95d7481b26027ced2ed83/src/SymfonyHttpBridge.php#L53-L65 |
22,249 | nabab/bbn | src/bbn/user/preferences.php | preferences._init_user | private function _init_user(bbn\user $user): preferences
{
$this->user = $user;
$this->id_user = $this->user->get_id();
$this->id_group = $this->user->get_group();
return $this;
} | php | private function _init_user(bbn\user $user): preferences
{
$this->user = $user;
$this->id_user = $this->user->get_id();
$this->id_group = $this->user->get_group();
return $this;
} | [
"private",
"function",
"_init_user",
"(",
"bbn",
"\\",
"user",
"$",
"user",
")",
":",
"preferences",
"{",
"$",
"this",
"->",
"user",
"=",
"$",
"user",
";",
"$",
"this",
"->",
"id_user",
"=",
"$",
"this",
"->",
"user",
"->",
"get_id",
"(",
")",
";",... | Sets the user variables using a user object
@param bbn\user $user
@return preferences | [
"Sets",
"the",
"user",
"variables",
"using",
"a",
"user",
"object"
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/user/preferences.php#L84-L90 |
22,250 | nabab/bbn | src/bbn/user/preferences.php | preferences._insert | private function _insert(string $id_option, array $cfg): int
{
$json = ($tmp = $this->get_cfg(false, $cfg)) ? json_encode($tmp) : NULL;
return $this->db->insert($this->class_cfg['table'], [
$this->fields['id_option'] => $id_option,
$this->fields['num'] => $cfg[$this->fields['num']] ?? NULL,
... | php | private function _insert(string $id_option, array $cfg): int
{
$json = ($tmp = $this->get_cfg(false, $cfg)) ? json_encode($tmp) : NULL;
return $this->db->insert($this->class_cfg['table'], [
$this->fields['id_option'] => $id_option,
$this->fields['num'] => $cfg[$this->fields['num']] ?? NULL,
... | [
"private",
"function",
"_insert",
"(",
"string",
"$",
"id_option",
",",
"array",
"$",
"cfg",
")",
":",
"int",
"{",
"$",
"json",
"=",
"(",
"$",
"tmp",
"=",
"$",
"this",
"->",
"get_cfg",
"(",
"false",
",",
"$",
"cfg",
")",
")",
"?",
"json_encode",
... | Actually inserts a row into the preferences table
@param string $id_option
@param array $cfg
@return int | [
"Actually",
"inserts",
"a",
"row",
"into",
"the",
"preferences",
"table"
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/user/preferences.php#L119-L131 |
22,251 | nabab/bbn | src/bbn/user/preferences.php | preferences.retrieve_user_ids | public function retrieve_user_ids(string $id_option = null, string $id_user): ?array
{
return $this->_retrieve_ids($id_option, $id_user);
} | php | public function retrieve_user_ids(string $id_option = null, string $id_user): ?array
{
return $this->_retrieve_ids($id_option, $id_user);
} | [
"public",
"function",
"retrieve_user_ids",
"(",
"string",
"$",
"id_option",
"=",
"null",
",",
"string",
"$",
"id_user",
")",
":",
"?",
"array",
"{",
"return",
"$",
"this",
"->",
"_retrieve_ids",
"(",
"$",
"id_option",
",",
"$",
"id_user",
")",
";",
"}"
] | Returns preferences' IDs from the option's ID and the given user ID
@param null|string $id_option
@param string $id_user
@return array|null | [
"Returns",
"preferences",
"IDs",
"from",
"the",
"option",
"s",
"ID",
"and",
"the",
"given",
"user",
"ID"
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/user/preferences.php#L274-L277 |
22,252 | nabab/bbn | src/bbn/user/preferences.php | preferences.retrieve_group_ids | public function retrieve_group_ids(string $id_option = null, string $id_group): ?array
{
return $this->_retrieve_ids($id_option, null, $id_group);
} | php | public function retrieve_group_ids(string $id_option = null, string $id_group): ?array
{
return $this->_retrieve_ids($id_option, null, $id_group);
} | [
"public",
"function",
"retrieve_group_ids",
"(",
"string",
"$",
"id_option",
"=",
"null",
",",
"string",
"$",
"id_group",
")",
":",
"?",
"array",
"{",
"return",
"$",
"this",
"->",
"_retrieve_ids",
"(",
"$",
"id_option",
",",
"null",
",",
"$",
"id_group",
... | Returns preferences' IDs from the option's ID and the given group ID
@param null|string $id_option
@param string $id_group
@return array|null | [
"Returns",
"preferences",
"IDs",
"from",
"the",
"option",
"s",
"ID",
"and",
"the",
"given",
"group",
"ID"
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/user/preferences.php#L286-L289 |
22,253 | nabab/bbn | src/bbn/user/preferences.php | preferences.has | public function has(string $id_option = null, bool $force = false): bool
{
if ( !$force && $this->user->is_dev() ){
return true;
}
return (bool)$this->retrieve_ids($id_option);
} | php | public function has(string $id_option = null, bool $force = false): bool
{
if ( !$force && $this->user->is_dev() ){
return true;
}
return (bool)$this->retrieve_ids($id_option);
} | [
"public",
"function",
"has",
"(",
"string",
"$",
"id_option",
"=",
"null",
",",
"bool",
"$",
"force",
"=",
"false",
")",
":",
"bool",
"{",
"if",
"(",
"!",
"$",
"force",
"&&",
"$",
"this",
"->",
"user",
"->",
"is_dev",
"(",
")",
")",
"{",
"return"... | Returns true if the current user can access a preference, false otherwise
@param string|null $id_option
@param bool $force
@return bool | [
"Returns",
"true",
"if",
"the",
"current",
"user",
"can",
"access",
"a",
"preference",
"false",
"otherwise"
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/user/preferences.php#L298-L304 |
22,254 | nabab/bbn | src/bbn/user/preferences.php | preferences.user_has | public function user_has(string $id_option, string $id_user): bool
{
return (bool)$this->_retrieve_ids($id_option, $id_user);
} | php | public function user_has(string $id_option, string $id_user): bool
{
return (bool)$this->_retrieve_ids($id_option, $id_user);
} | [
"public",
"function",
"user_has",
"(",
"string",
"$",
"id_option",
",",
"string",
"$",
"id_user",
")",
":",
"bool",
"{",
"return",
"(",
"bool",
")",
"$",
"this",
"->",
"_retrieve_ids",
"(",
"$",
"id_option",
",",
"$",
"id_user",
")",
";",
"}"
] | Checks if a user has the given preference
@param string $id_option
@param string $id_user
@return bool | [
"Checks",
"if",
"a",
"user",
"has",
"the",
"given",
"preference"
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/user/preferences.php#L313-L316 |
22,255 | nabab/bbn | src/bbn/user/preferences.php | preferences.group_has | public function group_has(string $id_option, string $id_group): bool
{
return (bool)$this->_retrieve_ids($id_option, null, $id_group);
} | php | public function group_has(string $id_option, string $id_group): bool
{
return (bool)$this->_retrieve_ids($id_option, null, $id_group);
} | [
"public",
"function",
"group_has",
"(",
"string",
"$",
"id_option",
",",
"string",
"$",
"id_group",
")",
":",
"bool",
"{",
"return",
"(",
"bool",
")",
"$",
"this",
"->",
"_retrieve_ids",
"(",
"$",
"id_option",
",",
"null",
",",
"$",
"id_group",
")",
";... | Checks if a group has the given preference
@param string $id_option
@param string $id_group
@return bool | [
"Checks",
"if",
"a",
"group",
"has",
"the",
"given",
"preference"
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/user/preferences.php#L325-L328 |
22,256 | nabab/bbn | src/bbn/user/preferences.php | preferences.get | public function get(string $id, bool $with_config = true): ?array
{
if ( bbn\str::is_uid($id) ){
$cols = implode(', ', array_map(function($a){
return $a;
}, $this->fields));
$table = $this->db->tsn($this->class_cfg['table'], true);
$uid = $this->db->csn($this->fields['id'], true);
... | php | public function get(string $id, bool $with_config = true): ?array
{
if ( bbn\str::is_uid($id) ){
$cols = implode(', ', array_map(function($a){
return $a;
}, $this->fields));
$table = $this->db->tsn($this->class_cfg['table'], true);
$uid = $this->db->csn($this->fields['id'], true);
... | [
"public",
"function",
"get",
"(",
"string",
"$",
"id",
",",
"bool",
"$",
"with_config",
"=",
"true",
")",
":",
"?",
"array",
"{",
"if",
"(",
"bbn",
"\\",
"str",
"::",
"is_uid",
"(",
"$",
"id",
")",
")",
"{",
"$",
"cols",
"=",
"implode",
"(",
"'... | Returns the current user's preference based on the given id, his own profile and his group's
@param string $id
@param bool $with_config
@return array|null | [
"Returns",
"the",
"current",
"user",
"s",
"preference",
"based",
"on",
"the",
"given",
"id",
"his",
"own",
"profile",
"and",
"his",
"group",
"s"
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/user/preferences.php#L433-L462 |
22,257 | nabab/bbn | src/bbn/user/preferences.php | preferences.get_all | public function get_all(string $id_option = null, bool $with_config = true): ?array
{
if ( $id_option = $this->_get_id_option($id_option) ){
$fields = $this->fields;
if ( !$with_config ){
unset($fields['cfg']);
}
$table = $this->db->tsn($this->class_table, true);
$cols = imp... | php | public function get_all(string $id_option = null, bool $with_config = true): ?array
{
if ( $id_option = $this->_get_id_option($id_option) ){
$fields = $this->fields;
if ( !$with_config ){
unset($fields['cfg']);
}
$table = $this->db->tsn($this->class_table, true);
$cols = imp... | [
"public",
"function",
"get_all",
"(",
"string",
"$",
"id_option",
"=",
"null",
",",
"bool",
"$",
"with_config",
"=",
"true",
")",
":",
"?",
"array",
"{",
"if",
"(",
"$",
"id_option",
"=",
"$",
"this",
"->",
"_get_id_option",
"(",
"$",
"id_option",
")",... | Returns an array of the current user's preferences based on the given id_option, his own profile and his group's
@param null|string $id_option
@param bool $with_config
@return array|null | [
"Returns",
"an",
"array",
"of",
"the",
"current",
"user",
"s",
"preferences",
"based",
"on",
"the",
"given",
"id_option",
"his",
"own",
"profile",
"and",
"his",
"group",
"s"
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/user/preferences.php#L470-L513 |
22,258 | nabab/bbn | src/bbn/user/preferences.php | preferences.set_by_option | public function set_by_option(string $id_option, array $cfg): int
{
if ( $id = $this->retrieve_user_ids($id_option, $this->id_user) ){
return $this->set($id[0], $cfg);
}
return $this->_insert($id_option, $cfg);
} | php | public function set_by_option(string $id_option, array $cfg): int
{
if ( $id = $this->retrieve_user_ids($id_option, $this->id_user) ){
return $this->set($id[0], $cfg);
}
return $this->_insert($id_option, $cfg);
} | [
"public",
"function",
"set_by_option",
"(",
"string",
"$",
"id_option",
",",
"array",
"$",
"cfg",
")",
":",
"int",
"{",
"if",
"(",
"$",
"id",
"=",
"$",
"this",
"->",
"retrieve_user_ids",
"(",
"$",
"id_option",
",",
"$",
"this",
"->",
"id_user",
")",
... | Sets the permission row for the current user by the option's ID
@param string $id_option
@param array $cfg
@return int | [
"Sets",
"the",
"permission",
"row",
"for",
"the",
"current",
"user",
"by",
"the",
"option",
"s",
"ID"
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/user/preferences.php#L643-L649 |
22,259 | nabab/bbn | src/bbn/user/preferences.php | preferences.set | public function set(string $id, array $cfg = null): int
{
return $this->db->update($this->class_cfg['table'], [
$this->fields['cfg'] => $cfg ? json_encode($this->get_cfg(false, $cfg)) : null
], [
$this->fields['id'] => $id
]);
} | php | public function set(string $id, array $cfg = null): int
{
return $this->db->update($this->class_cfg['table'], [
$this->fields['cfg'] => $cfg ? json_encode($this->get_cfg(false, $cfg)) : null
], [
$this->fields['id'] => $id
]);
} | [
"public",
"function",
"set",
"(",
"string",
"$",
"id",
",",
"array",
"$",
"cfg",
"=",
"null",
")",
":",
"int",
"{",
"return",
"$",
"this",
"->",
"db",
"->",
"update",
"(",
"$",
"this",
"->",
"class_cfg",
"[",
"'table'",
"]",
",",
"[",
"$",
"this"... | Sets the permission config for the current user by the preference's ID
@param string $id
@param array $cfg
@return int | [
"Sets",
"the",
"permission",
"config",
"for",
"the",
"current",
"user",
"by",
"the",
"preference",
"s",
"ID"
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/user/preferences.php#L658-L665 |
22,260 | nabab/bbn | src/bbn/user/preferences.php | preferences.update | public function update(string $id, array $cfg): int
{
return $this->db->update($this->class_cfg['table'], [
$this->fields['text'] => $cfg[$this->fields['text']] ?? NULL,
$this->fields['num'] => $cfg[$this->fields['num']] ?? NULL,
$this->fields['id_link'] => $cfg[$this->fields['id_link']] ?? NULL... | php | public function update(string $id, array $cfg): int
{
return $this->db->update($this->class_cfg['table'], [
$this->fields['text'] => $cfg[$this->fields['text']] ?? NULL,
$this->fields['num'] => $cfg[$this->fields['num']] ?? NULL,
$this->fields['id_link'] => $cfg[$this->fields['id_link']] ?? NULL... | [
"public",
"function",
"update",
"(",
"string",
"$",
"id",
",",
"array",
"$",
"cfg",
")",
":",
"int",
"{",
"return",
"$",
"this",
"->",
"db",
"->",
"update",
"(",
"$",
"this",
"->",
"class_cfg",
"[",
"'table'",
"]",
",",
"[",
"$",
"this",
"->",
"f... | Sets the permission row for the current user by the preference's ID
@param string $id
@param array $cfg
@return int | [
"Sets",
"the",
"permission",
"row",
"for",
"the",
"current",
"user",
"by",
"the",
"preference",
"s",
"ID"
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/user/preferences.php#L674-L686 |
22,261 | nabab/bbn | src/bbn/user/preferences.php | preferences.add | public function add(string $id_option = null, array $cfg): ?string
{
return (
($id_option = $this->_get_id_option($id_option)) &&
$this->_insert($id_option, $cfg)
) ? $this->db->last_id() : null;
} | php | public function add(string $id_option = null, array $cfg): ?string
{
return (
($id_option = $this->_get_id_option($id_option)) &&
$this->_insert($id_option, $cfg)
) ? $this->db->last_id() : null;
} | [
"public",
"function",
"add",
"(",
"string",
"$",
"id_option",
"=",
"null",
",",
"array",
"$",
"cfg",
")",
":",
"?",
"string",
"{",
"return",
"(",
"(",
"$",
"id_option",
"=",
"$",
"this",
"->",
"_get_id_option",
"(",
"$",
"id_option",
")",
")",
"&&",
... | Adds a new preference for the given option for the current user.
@param null|string $id_option
@param array $cfg
@return null|string | [
"Adds",
"a",
"new",
"preference",
"for",
"the",
"given",
"option",
"for",
"the",
"current",
"user",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/user/preferences.php#L703-L709 |
22,262 | nabab/bbn | src/bbn/user/preferences.php | preferences.delete | public function delete($id): ?int
{
return $this->db->delete($this->class_cfg['table'], [$this->fields['id'] => $id]);
} | php | public function delete($id): ?int
{
return $this->db->delete($this->class_cfg['table'], [$this->fields['id'] => $id]);
} | [
"public",
"function",
"delete",
"(",
"$",
"id",
")",
":",
"?",
"int",
"{",
"return",
"$",
"this",
"->",
"db",
"->",
"delete",
"(",
"$",
"this",
"->",
"class_cfg",
"[",
"'table'",
"]",
",",
"[",
"$",
"this",
"->",
"fields",
"[",
"'id'",
"]",
"=>",... | Deletes the given permission
@param $id
@return int|null | [
"Deletes",
"the",
"given",
"permission"
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/user/preferences.php#L717-L720 |
22,263 | nabab/bbn | src/bbn/user/preferences.php | preferences.delete_user_option | public function delete_user_option(string $id_option, string $id_user = null): ?int
{
if ( $id_option = $this->_get_id_option($id_option) ){
return $this->db->delete($this->class_cfg['table'], [
$this->fields['id_option'] => $id_option,
$this->fields['id_user'] => $id_user ?: $this->id_user
... | php | public function delete_user_option(string $id_option, string $id_user = null): ?int
{
if ( $id_option = $this->_get_id_option($id_option) ){
return $this->db->delete($this->class_cfg['table'], [
$this->fields['id_option'] => $id_option,
$this->fields['id_user'] => $id_user ?: $this->id_user
... | [
"public",
"function",
"delete_user_option",
"(",
"string",
"$",
"id_option",
",",
"string",
"$",
"id_user",
"=",
"null",
")",
":",
"?",
"int",
"{",
"if",
"(",
"$",
"id_option",
"=",
"$",
"this",
"->",
"_get_id_option",
"(",
"$",
"id_option",
")",
")",
... | Deletes all the given or current user's permissions for the given option
@param null|string $id_option
@param null|string $id_user
@return null|int | [
"Deletes",
"all",
"the",
"given",
"or",
"current",
"user",
"s",
"permissions",
"for",
"the",
"given",
"option"
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/user/preferences.php#L729-L738 |
22,264 | nabab/bbn | src/bbn/user/preferences.php | preferences.delete_group_option | public function delete_group_option(string $id_option, string $id_group): ?int
{
if ( $id_option = $this->_get_id_option($id_option) ){
return $this->db->delete($this->class_cfg['table'], [
$this->fields['id_option'] => $id_option,
$this->fields['id_group'] => $id_group
]);
}
r... | php | public function delete_group_option(string $id_option, string $id_group): ?int
{
if ( $id_option = $this->_get_id_option($id_option) ){
return $this->db->delete($this->class_cfg['table'], [
$this->fields['id_option'] => $id_option,
$this->fields['id_group'] => $id_group
]);
}
r... | [
"public",
"function",
"delete_group_option",
"(",
"string",
"$",
"id_option",
",",
"string",
"$",
"id_group",
")",
":",
"?",
"int",
"{",
"if",
"(",
"$",
"id_option",
"=",
"$",
"this",
"->",
"_get_id_option",
"(",
"$",
"id_option",
")",
")",
"{",
"return"... | Deletes all the given group's permissions for the given option
@param null|string $id_option
@param string $id_group
@return int|null | [
"Deletes",
"all",
"the",
"given",
"group",
"s",
"permissions",
"for",
"the",
"given",
"option"
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/user/preferences.php#L747-L756 |
22,265 | nabab/bbn | src/bbn/user/preferences.php | preferences.get_shared | public function get_shared(string $id): ?array
{
if ( bbn\str::is_uid($id) ){
return $this->db->rselect_all($this->class_table, [
$this->fields['id'],
$this->fields['id_user'],
$this->fields['id_group']
], [
$this->fields['id_alias'] => $id
]);
}
return nu... | php | public function get_shared(string $id): ?array
{
if ( bbn\str::is_uid($id) ){
return $this->db->rselect_all($this->class_table, [
$this->fields['id'],
$this->fields['id_user'],
$this->fields['id_group']
], [
$this->fields['id_alias'] => $id
]);
}
return nu... | [
"public",
"function",
"get_shared",
"(",
"string",
"$",
"id",
")",
":",
"?",
"array",
"{",
"if",
"(",
"bbn",
"\\",
"str",
"::",
"is_uid",
"(",
"$",
"id",
")",
")",
"{",
"return",
"$",
"this",
"->",
"db",
"->",
"rselect_all",
"(",
"$",
"this",
"->... | Returns an array
@param string $id
@return array|null | [
"Returns",
"an",
"array"
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/user/preferences.php#L849-L861 |
22,266 | nabab/bbn | src/bbn/user/preferences.php | preferences.add_bit | public function add_bit(string $id_usr_opt, array $cfg): ?string
{
if (
($id_usr_opt = $this->_get_id_option($id_usr_opt)) &&
($c = $this->class_cfg['arch']['user_options_bits'])
){
$to_cfg = $this->get_bit_cfg(null, $cfg);
if ( isset($to_cfg['items']) ){
unset($to_cfg['items']... | php | public function add_bit(string $id_usr_opt, array $cfg): ?string
{
if (
($id_usr_opt = $this->_get_id_option($id_usr_opt)) &&
($c = $this->class_cfg['arch']['user_options_bits'])
){
$to_cfg = $this->get_bit_cfg(null, $cfg);
if ( isset($to_cfg['items']) ){
unset($to_cfg['items']... | [
"public",
"function",
"add_bit",
"(",
"string",
"$",
"id_usr_opt",
",",
"array",
"$",
"cfg",
")",
":",
"?",
"string",
"{",
"if",
"(",
"(",
"$",
"id_usr_opt",
"=",
"$",
"this",
"->",
"_get_id_option",
"(",
"$",
"id_usr_opt",
")",
")",
"&&",
"(",
"$",
... | Adds a bit to a preference
@param string $id_usr_opt The preference's ID
@param array $cfg The bit's values
@return string|null | [
"Adds",
"a",
"bit",
"to",
"a",
"preference"
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/user/preferences.php#L948-L987 |
22,267 | nabab/bbn | src/bbn/user/preferences.php | preferences.delete_bit | public function delete_bit(string $id): ?int
{
if ( \bbn\str::is_uid($id) ){
return $this->db->delete($this->class_cfg['tables']['user_options_bits'], [
$this->class_cfg['arch']['user_options_bits']['id'] => $id
]);
}
return null;
} | php | public function delete_bit(string $id): ?int
{
if ( \bbn\str::is_uid($id) ){
return $this->db->delete($this->class_cfg['tables']['user_options_bits'], [
$this->class_cfg['arch']['user_options_bits']['id'] => $id
]);
}
return null;
} | [
"public",
"function",
"delete_bit",
"(",
"string",
"$",
"id",
")",
":",
"?",
"int",
"{",
"if",
"(",
"\\",
"bbn",
"\\",
"str",
"::",
"is_uid",
"(",
"$",
"id",
")",
")",
"{",
"return",
"$",
"this",
"->",
"db",
"->",
"delete",
"(",
"$",
"this",
"-... | Deletes a preference's bit
@param string The bit's ID
@return int|null | [
"Deletes",
"a",
"preference",
"s",
"bit"
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/user/preferences.php#L996-L1004 |
22,268 | nabab/bbn | src/bbn/user/preferences.php | preferences.update_bit | public function update_bit(string $id, array $cfg, $merge_config = false): ?int
{
if ( \bbn\str::is_uid($id) ){
$c = $this->class_cfg['arch']['user_options_bits'];
$fields = array_values($c);
if ( \array_key_exists($c['id'], $cfg) ){
unset($cfg[$c['id']]);
}
$to_cfg = $this->... | php | public function update_bit(string $id, array $cfg, $merge_config = false): ?int
{
if ( \bbn\str::is_uid($id) ){
$c = $this->class_cfg['arch']['user_options_bits'];
$fields = array_values($c);
if ( \array_key_exists($c['id'], $cfg) ){
unset($cfg[$c['id']]);
}
$to_cfg = $this->... | [
"public",
"function",
"update_bit",
"(",
"string",
"$",
"id",
",",
"array",
"$",
"cfg",
",",
"$",
"merge_config",
"=",
"false",
")",
":",
"?",
"int",
"{",
"if",
"(",
"\\",
"bbn",
"\\",
"str",
"::",
"is_uid",
"(",
"$",
"id",
")",
")",
"{",
"$",
... | Updates a preference's bit
@param string $id The bit's ID
@param array The bit's values
@return int|null | [
"Updates",
"a",
"preference",
"s",
"bit"
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/user/preferences.php#L1013-L1053 |
22,269 | nabab/bbn | src/bbn/user/preferences.php | preferences.get_bit | public function get_bit(string $id, bool $with_config = true): array
{
if (
\bbn\str::is_uid($id) &&
($bit = $this->db->rselect($this->class_cfg['tables']['user_options_bits'], [], [
$this->class_cfg['arch']['user_options_bits']['id'] => $id
]))
){
if ( !empty($with_config) ){
... | php | public function get_bit(string $id, bool $with_config = true): array
{
if (
\bbn\str::is_uid($id) &&
($bit = $this->db->rselect($this->class_cfg['tables']['user_options_bits'], [], [
$this->class_cfg['arch']['user_options_bits']['id'] => $id
]))
){
if ( !empty($with_config) ){
... | [
"public",
"function",
"get_bit",
"(",
"string",
"$",
"id",
",",
"bool",
"$",
"with_config",
"=",
"true",
")",
":",
"array",
"{",
"if",
"(",
"\\",
"bbn",
"\\",
"str",
"::",
"is_uid",
"(",
"$",
"id",
")",
"&&",
"(",
"$",
"bit",
"=",
"$",
"this",
... | Returns a single preference's bit
@param string $id The bit's ID
@return array | [
"Returns",
"a",
"single",
"preference",
"s",
"bit"
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/user/preferences.php#L1061-L1075 |
22,270 | nabab/bbn | src/bbn/user/preferences.php | preferences.get_bits | public function get_bits(string $id_usr_opt, $id_parent = false, bool $with_config = true): array
{
$c = $this->class_cfg['arch']['user_options_bits'];
$t = $this;
$where = [
$c['id_user_option'] => $id_usr_opt
];
if ( is_null($id_parent) || \bbn\str::is_uid($id_parent) ){
$where[$c['i... | php | public function get_bits(string $id_usr_opt, $id_parent = false, bool $with_config = true): array
{
$c = $this->class_cfg['arch']['user_options_bits'];
$t = $this;
$where = [
$c['id_user_option'] => $id_usr_opt
];
if ( is_null($id_parent) || \bbn\str::is_uid($id_parent) ){
$where[$c['i... | [
"public",
"function",
"get_bits",
"(",
"string",
"$",
"id_usr_opt",
",",
"$",
"id_parent",
"=",
"false",
",",
"bool",
"$",
"with_config",
"=",
"true",
")",
":",
"array",
"{",
"$",
"c",
"=",
"$",
"this",
"->",
"class_cfg",
"[",
"'arch'",
"]",
"[",
"'u... | Returns the bits list of a preference
@param string $id The preference's ID
@param null|string $id_parent The bits'parent ID
@return array | [
"Returns",
"the",
"bits",
"list",
"of",
"a",
"preference"
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/user/preferences.php#L1084-L1106 |
22,271 | nabab/bbn | src/bbn/user/preferences.php | preferences.get_full_bits | public function get_full_bits(string $id_usr_opt, string $id_parent = null, bool $with_config = true): array
{
if ( \bbn\str::is_uid($id_usr_opt) ){
$c = $this->class_cfg['arch']['user_options_bits'];
$t = $this;
return array_map(function($b) use($t, $c, $id_usr_opt, $with_config){
if ( ... | php | public function get_full_bits(string $id_usr_opt, string $id_parent = null, bool $with_config = true): array
{
if ( \bbn\str::is_uid($id_usr_opt) ){
$c = $this->class_cfg['arch']['user_options_bits'];
$t = $this;
return array_map(function($b) use($t, $c, $id_usr_opt, $with_config){
if ( ... | [
"public",
"function",
"get_full_bits",
"(",
"string",
"$",
"id_usr_opt",
",",
"string",
"$",
"id_parent",
"=",
"null",
",",
"bool",
"$",
"with_config",
"=",
"true",
")",
":",
"array",
"{",
"if",
"(",
"\\",
"bbn",
"\\",
"str",
"::",
"is_uid",
"(",
"$",
... | Returns the hierarchical bits list of a preference
@param string $id_usr_opt The preference's ID
@param string $id_parent The parent's ID of a bit. Default: null
@param bool $with_config Set it to false if you don't want the preference's cfg field values on the results.
@return array | [
"Returns",
"the",
"hierarchical",
"bits",
"list",
"of",
"a",
"preference"
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/user/preferences.php#L1116-L1143 |
22,272 | nabab/bbn | src/bbn/user/preferences.php | preferences.get_tree | public function get_tree(string $id, bool $with_config = true): array
{
if (
\bbn\str::is_uid($id) &&
($p = $this->get($id, $with_config))
){
$p['items'] = $this->get_full_bits($id, null, $with_config);
return $p;
}
return [];
} | php | public function get_tree(string $id, bool $with_config = true): array
{
if (
\bbn\str::is_uid($id) &&
($p = $this->get($id, $with_config))
){
$p['items'] = $this->get_full_bits($id, null, $with_config);
return $p;
}
return [];
} | [
"public",
"function",
"get_tree",
"(",
"string",
"$",
"id",
",",
"bool",
"$",
"with_config",
"=",
"true",
")",
":",
"array",
"{",
"if",
"(",
"\\",
"bbn",
"\\",
"str",
"::",
"is_uid",
"(",
"$",
"id",
")",
"&&",
"(",
"$",
"p",
"=",
"$",
"this",
"... | Returns a preference and its hierarchical bits list
@param string $id The preference's ID
@param bool $with_config Set it to false if you don't want the preference's cfg field values on the results. | [
"Returns",
"a",
"preference",
"and",
"its",
"hierarchical",
"bits",
"list"
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/user/preferences.php#L1151-L1161 |
22,273 | nabab/bbn | src/bbn/user/preferences.php | preferences.order_bit | public function order_bit(string $id, int $pos): ?bool
{
if (
\bbn\str::is_uid($id) &&
($cf = $this->get_class_cfg()) &&
($cfg = $cf['arch']['user_options_bits']) &&
($bit = $this->get_bit($id)) &&
($old = (int)$bit[$cfg['num']]) &&
!empty($pos) &&
($old !== $pos) &&
... | php | public function order_bit(string $id, int $pos): ?bool
{
if (
\bbn\str::is_uid($id) &&
($cf = $this->get_class_cfg()) &&
($cfg = $cf['arch']['user_options_bits']) &&
($bit = $this->get_bit($id)) &&
($old = (int)$bit[$cfg['num']]) &&
!empty($pos) &&
($old !== $pos) &&
... | [
"public",
"function",
"order_bit",
"(",
"string",
"$",
"id",
",",
"int",
"$",
"pos",
")",
":",
"?",
"bool",
"{",
"if",
"(",
"\\",
"bbn",
"\\",
"str",
"::",
"is_uid",
"(",
"$",
"id",
")",
"&&",
"(",
"$",
"cf",
"=",
"$",
"this",
"->",
"get_class_... | Orders a bit.
@param string $id The bit's ID
@param int $pos The new position
@return bool|null | [
"Orders",
"a",
"bit",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/user/preferences.php#L1237-L1280 |
22,274 | nabab/bbn | src/bbn/user/preferences.php | preferences.move_bit | public function move_bit(string $id, string $id_parent = null): ?bool
{
if (
\bbn\str::is_uid($id) &&
(
(\bbn\str::is_uid($id_parent) && $this->get_bit($id_parent)) ||
\is_null($id_parent)
) &&
($bit = $this->get_bit($id)) &&
($cf = $this->get_class_cfg()) &&
... | php | public function move_bit(string $id, string $id_parent = null): ?bool
{
if (
\bbn\str::is_uid($id) &&
(
(\bbn\str::is_uid($id_parent) && $this->get_bit($id_parent)) ||
\is_null($id_parent)
) &&
($bit = $this->get_bit($id)) &&
($cf = $this->get_class_cfg()) &&
... | [
"public",
"function",
"move_bit",
"(",
"string",
"$",
"id",
",",
"string",
"$",
"id_parent",
"=",
"null",
")",
":",
"?",
"bool",
"{",
"if",
"(",
"\\",
"bbn",
"\\",
"str",
"::",
"is_uid",
"(",
"$",
"id",
")",
"&&",
"(",
"(",
"\\",
"bbn",
"\\",
"... | Moves a bit.
@param string $id The bit's ID
@param string|null The new parent's ID
@return bool|null | [
"Moves",
"a",
"bit",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/user/preferences.php#L1289-L1308 |
22,275 | nabab/bbn | src/bbn/user/preferences.php | preferences.get_max_bit_num | public function get_max_bit_num(string $id_user_option, string $id_parent = null, bool $incr = false): int
{
if (
\bbn\str::is_uid($id_user_option) &&
(\bbn\str::is_uid($id_parent) || is_null($id_parent)) &&
($cf = $this->get_class_cfg()) &&
($cfg = $cf['arch']['user_options_bits'])
... | php | public function get_max_bit_num(string $id_user_option, string $id_parent = null, bool $incr = false): int
{
if (
\bbn\str::is_uid($id_user_option) &&
(\bbn\str::is_uid($id_parent) || is_null($id_parent)) &&
($cf = $this->get_class_cfg()) &&
($cfg = $cf['arch']['user_options_bits'])
... | [
"public",
"function",
"get_max_bit_num",
"(",
"string",
"$",
"id_user_option",
",",
"string",
"$",
"id_parent",
"=",
"null",
",",
"bool",
"$",
"incr",
"=",
"false",
")",
":",
"int",
"{",
"if",
"(",
"\\",
"bbn",
"\\",
"str",
"::",
"is_uid",
"(",
"$",
... | Gets the maximum num value of the user option's bits.
@param string $id_user_option The user option's ID
@param string|null $id_parent The parent's ID
@param bool $incr Set it to true if you want the result increased by 1
@return int | [
"Gets",
"the",
"maximum",
"num",
"value",
"of",
"the",
"user",
"option",
"s",
"bits",
"."
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/user/preferences.php#L1318-L1344 |
22,276 | nabab/bbn | src/bbn/user/preferences.php | preferences.get_by_bit | public function get_by_bit(string $id): ?array
{
$t =& $this;
if ( \bbn\str::is_uid($id) ){
return $this->db->rselect([
'table' => $this->class_cfg['table'],
'fields' => array_map(function($v) use($t){
return $this->class_cfg['table'].'.'.$v;
}, array_values($this->clas... | php | public function get_by_bit(string $id): ?array
{
$t =& $this;
if ( \bbn\str::is_uid($id) ){
return $this->db->rselect([
'table' => $this->class_cfg['table'],
'fields' => array_map(function($v) use($t){
return $this->class_cfg['table'].'.'.$v;
}, array_values($this->clas... | [
"public",
"function",
"get_by_bit",
"(",
"string",
"$",
"id",
")",
":",
"?",
"array",
"{",
"$",
"t",
"=",
"&",
"$",
"this",
";",
"if",
"(",
"\\",
"bbn",
"\\",
"str",
"::",
"is_uid",
"(",
"$",
"id",
")",
")",
"{",
"return",
"$",
"this",
"->",
... | Gets a preference row from a bit ID
@param string $id The bit's ID
@return array | [
"Gets",
"a",
"preference",
"row",
"from",
"a",
"bit",
"ID"
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/user/preferences.php#L1355-L1378 |
22,277 | nabab/bbn | src/bbn/user/preferences.php | preferences.get_id_by_bit | public function get_id_by_bit(string $id): ?string
{
if ( \bbn\str::is_uid($id) && ($p = $this->get_by_bit($id)) ){
return $p[$this->fields['id']];
}
return null;
} | php | public function get_id_by_bit(string $id): ?string
{
if ( \bbn\str::is_uid($id) && ($p = $this->get_by_bit($id)) ){
return $p[$this->fields['id']];
}
return null;
} | [
"public",
"function",
"get_id_by_bit",
"(",
"string",
"$",
"id",
")",
":",
"?",
"string",
"{",
"if",
"(",
"\\",
"bbn",
"\\",
"str",
"::",
"is_uid",
"(",
"$",
"id",
")",
"&&",
"(",
"$",
"p",
"=",
"$",
"this",
"->",
"get_by_bit",
"(",
"$",
"id",
... | Gets the preference's ID from a bit ID
@param string $id The bit's ID
@return string | [
"Gets",
"the",
"preference",
"s",
"ID",
"from",
"a",
"bit",
"ID"
] | 439fea2faa0de22fdaae2611833bab8061f40c37 | https://github.com/nabab/bbn/blob/439fea2faa0de22fdaae2611833bab8061f40c37/src/bbn/user/preferences.php#L1386-L1392 |
22,278 | mothership-ec/composer | src/Composer/Repository/Pear/ChannelReader.php | ChannelReader.selectRestVersion | private function selectRestVersion($channelXml, $supportedVersions)
{
$channelXml->registerXPathNamespace('ns', self::CHANNEL_NS);
foreach ($supportedVersions as $version) {
$xpathTest = "ns:servers/ns:primary/ns:rest/ns:baseurl[@type='{$version}']";
$testResult = $channelXm... | php | private function selectRestVersion($channelXml, $supportedVersions)
{
$channelXml->registerXPathNamespace('ns', self::CHANNEL_NS);
foreach ($supportedVersions as $version) {
$xpathTest = "ns:servers/ns:primary/ns:rest/ns:baseurl[@type='{$version}']";
$testResult = $channelXm... | [
"private",
"function",
"selectRestVersion",
"(",
"$",
"channelXml",
",",
"$",
"supportedVersions",
")",
"{",
"$",
"channelXml",
"->",
"registerXPathNamespace",
"(",
"'ns'",
",",
"self",
"::",
"CHANNEL_NS",
")",
";",
"foreach",
"(",
"$",
"supportedVersions",
"as"... | Reads channel supported REST interfaces and selects one of them
@param $channelXml \SimpleXMLElement
@param $supportedVersions string[] supported PEAR REST protocols
@return array|null hash with selected version and baseUrl | [
"Reads",
"channel",
"supported",
"REST",
"interfaces",
"and",
"selects",
"one",
"of",
"them"
] | fa6ad031a939d8d33b211e428fdbdd28cfce238c | https://github.com/mothership-ec/composer/blob/fa6ad031a939d8d33b211e428fdbdd28cfce238c/src/Composer/Repository/Pear/ChannelReader.php#L78-L91 |
22,279 | odiaseo/pagebuilder | src/PageBuilder/Controller/TemplateSectionController.php | TemplateSectionController.get | public function get($id)
{
return $this->_sendPayload(
$this->_getService($this->_pageServiceKey)->getActiveTemplateSections($id)
);
} | php | public function get($id)
{
return $this->_sendPayload(
$this->_getService($this->_pageServiceKey)->getActiveTemplateSections($id)
);
} | [
"public",
"function",
"get",
"(",
"$",
"id",
")",
"{",
"return",
"$",
"this",
"->",
"_sendPayload",
"(",
"$",
"this",
"->",
"_getService",
"(",
"$",
"this",
"->",
"_pageServiceKey",
")",
"->",
"getActiveTemplateSections",
"(",
"$",
"id",
")",
")",
";",
... | Get template sections
@param mixed $id
@return mixed|\Zend\View\Model\ModelInterface | [
"Get",
"template",
"sections"
] | 88ef7cccf305368561307efe4ca07fac8e5774f3 | https://github.com/odiaseo/pagebuilder/blob/88ef7cccf305368561307efe4ca07fac8e5774f3/src/PageBuilder/Controller/TemplateSectionController.php#L18-L23 |
22,280 | odiaseo/pagebuilder | src/PageBuilder/Controller/TemplateSectionController.php | TemplateSectionController.update | public function update($id, $data)
{
$sections = empty($data['sections']) ? [] : $data['sections'];
return $this->_sendPayload(
$this->_getService($this->_pageServiceKey)->updateTemplateSections($id, $sections)
);
} | php | public function update($id, $data)
{
$sections = empty($data['sections']) ? [] : $data['sections'];
return $this->_sendPayload(
$this->_getService($this->_pageServiceKey)->updateTemplateSections($id, $sections)
);
} | [
"public",
"function",
"update",
"(",
"$",
"id",
",",
"$",
"data",
")",
"{",
"$",
"sections",
"=",
"empty",
"(",
"$",
"data",
"[",
"'sections'",
"]",
")",
"?",
"[",
"]",
":",
"$",
"data",
"[",
"'sections'",
"]",
";",
"return",
"$",
"this",
"->",
... | Update section details
@param mixed $id
@param mixed $data
@return mixed|\Zend\View\Model\ModelInterface | [
"Update",
"section",
"details"
] | 88ef7cccf305368561307efe4ca07fac8e5774f3 | https://github.com/odiaseo/pagebuilder/blob/88ef7cccf305368561307efe4ca07fac8e5774f3/src/PageBuilder/Controller/TemplateSectionController.php#L33-L40 |
22,281 | AOEpeople/Aoe_Layout | app/code/local/Aoe/Layout/Block/Widget/Grid.php | Aoe_Layout_Block_Widget_Grid.getRowUrl | public function getRowUrl($item)
{
if (!$item instanceof Varien_Object) {
return parent::getRowUrl($item);
}
$rowUrlRoute = trim($this->getRowUrlRoute());
if (empty($rowUrlRoute)) {
return parent::getRowUrl($item);
}
$params = [];
$r... | php | public function getRowUrl($item)
{
if (!$item instanceof Varien_Object) {
return parent::getRowUrl($item);
}
$rowUrlRoute = trim($this->getRowUrlRoute());
if (empty($rowUrlRoute)) {
return parent::getRowUrl($item);
}
$params = [];
$r... | [
"public",
"function",
"getRowUrl",
"(",
"$",
"item",
")",
"{",
"if",
"(",
"!",
"$",
"item",
"instanceof",
"Varien_Object",
")",
"{",
"return",
"parent",
"::",
"getRowUrl",
"(",
"$",
"item",
")",
";",
"}",
"$",
"rowUrlRoute",
"=",
"trim",
"(",
"$",
"t... | Return row url for js event handlers
@param Varien_Object
@return string | [
"Return",
"row",
"url",
"for",
"js",
"event",
"handlers"
] | d88ba3406cf12dbaf09548477133c3cb27d155ed | https://github.com/AOEpeople/Aoe_Layout/blob/d88ba3406cf12dbaf09548477133c3cb27d155ed/app/code/local/Aoe/Layout/Block/Widget/Grid.php#L49-L84 |
22,282 | AOEpeople/Aoe_Layout | app/code/local/Aoe/Layout/Block/Widget/Grid.php | Aoe_Layout_Block_Widget_Grid.sortColumnsByOrder | public function sortColumnsByOrder()
{
$columns = $this->_columns;
foreach ($this->getColumnsOrder() as $columnId => $after) {
if ($after[0] === '-') {
$before = substr($after, 1);
$after = null;
} else {
$before = null;
... | php | public function sortColumnsByOrder()
{
$columns = $this->_columns;
foreach ($this->getColumnsOrder() as $columnId => $after) {
if ($after[0] === '-') {
$before = substr($after, 1);
$after = null;
} else {
$before = null;
... | [
"public",
"function",
"sortColumnsByOrder",
"(",
")",
"{",
"$",
"columns",
"=",
"$",
"this",
"->",
"_columns",
";",
"foreach",
"(",
"$",
"this",
"->",
"getColumnsOrder",
"(",
")",
"as",
"$",
"columnId",
"=>",
"$",
"after",
")",
"{",
"if",
"(",
"$",
"... | Sort columns by predefined order
@return Mage_Adminhtml_Block_Widget_Grid | [
"Sort",
"columns",
"by",
"predefined",
"order"
] | d88ba3406cf12dbaf09548477133c3cb27d155ed | https://github.com/AOEpeople/Aoe_Layout/blob/d88ba3406cf12dbaf09548477133c3cb27d155ed/app/code/local/Aoe/Layout/Block/Widget/Grid.php#L97-L127 |
22,283 | AOEpeople/Aoe_Layout | app/code/local/Aoe/Layout/Block/Widget/Grid.php | Aoe_Layout_Block_Widget_Grid.updateColumn | public function updateColumn($columnId, $key, $value)
{
if (isset($this->_columns[$columnId]) && $this->_columns[$columnId] instanceof Varien_Object) {
$this->_columns[$columnId]->setData($key, $value);
}
return $this;
} | php | public function updateColumn($columnId, $key, $value)
{
if (isset($this->_columns[$columnId]) && $this->_columns[$columnId] instanceof Varien_Object) {
$this->_columns[$columnId]->setData($key, $value);
}
return $this;
} | [
"public",
"function",
"updateColumn",
"(",
"$",
"columnId",
",",
"$",
"key",
",",
"$",
"value",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"_columns",
"[",
"$",
"columnId",
"]",
")",
"&&",
"$",
"this",
"->",
"_columns",
"[",
"$",
"column... | Modify grid column
@param $columnId
@param $key
@param $value
@return $this | [
"Modify",
"grid",
"column"
] | d88ba3406cf12dbaf09548477133c3cb27d155ed | https://github.com/AOEpeople/Aoe_Layout/blob/d88ba3406cf12dbaf09548477133c3cb27d155ed/app/code/local/Aoe/Layout/Block/Widget/Grid.php#L138-L145 |
22,284 | HedronDev/hedron | src/ProjectTypeDictionary.php | ProjectTypeDictionary.getCurrentProject | public function getCurrentProject() {
return $this->createInstance($this->environment->getProjectType(), $this->environment, $this->configuration, $this->fileSystem);
} | php | public function getCurrentProject() {
return $this->createInstance($this->environment->getProjectType(), $this->environment, $this->configuration, $this->fileSystem);
} | [
"public",
"function",
"getCurrentProject",
"(",
")",
"{",
"return",
"$",
"this",
"->",
"createInstance",
"(",
"$",
"this",
"->",
"environment",
"->",
"getProjectType",
"(",
")",
",",
"$",
"this",
"->",
"environment",
",",
"$",
"this",
"->",
"configuration",
... | Get a project plugin for the current environment settings.
@return \Hedron\ProjectTypeInterface | [
"Get",
"a",
"project",
"plugin",
"for",
"the",
"current",
"environment",
"settings",
"."
] | 3b4adec4912f2d7c0b7e7262dc36515fbc2e8e00 | https://github.com/HedronDev/hedron/blob/3b4adec4912f2d7c0b7e7262dc36515fbc2e8e00/src/ProjectTypeDictionary.php#L55-L57 |
22,285 | Erdiko/core | src/Response.php | Response.getKeyValue | public function getKeyValue($key)
{
return empty($this->_data[$key]) ? null: $this->_data[$key];
} | php | public function getKeyValue($key)
{
return empty($this->_data[$key]) ? null: $this->_data[$key];
} | [
"public",
"function",
"getKeyValue",
"(",
"$",
"key",
")",
"{",
"return",
"empty",
"(",
"$",
"this",
"->",
"_data",
"[",
"$",
"key",
"]",
")",
"?",
"null",
":",
"$",
"this",
"->",
"_data",
"[",
"$",
"key",
"]",
";",
"}"
] | Get data value by key
@param mixed $key
@return mixed | [
"Get",
"data",
"value",
"by",
"key"
] | c7947ee973b0ad2fd05a6d1d8ce45696618c8fa6 | https://github.com/Erdiko/core/blob/c7947ee973b0ad2fd05a6d1d8ce45696618c8fa6/src/Response.php#L55-L58 |
22,286 | Erdiko/core | src/Response.php | Response.setThemeTemplate | public function setThemeTemplate($template)
{
$this->_themeTemplate = $template;
if ($this->getTheme() != null) {
$this->getTheme()->setTemplate($this->_themeTemplate);
}
} | php | public function setThemeTemplate($template)
{
$this->_themeTemplate = $template;
if ($this->getTheme() != null) {
$this->getTheme()->setTemplate($this->_themeTemplate);
}
} | [
"public",
"function",
"setThemeTemplate",
"(",
"$",
"template",
")",
"{",
"$",
"this",
"->",
"_themeTemplate",
"=",
"$",
"template",
";",
"if",
"(",
"$",
"this",
"->",
"getTheme",
"(",
")",
"!=",
"null",
")",
"{",
"$",
"this",
"->",
"getTheme",
"(",
... | Set Theme Template
@param string $tamplate | [
"Set",
"Theme",
"Template"
] | c7947ee973b0ad2fd05a6d1d8ce45696618c8fa6 | https://github.com/Erdiko/core/blob/c7947ee973b0ad2fd05a6d1d8ce45696618c8fa6/src/Response.php#L127-L133 |
22,287 | GrupaZero/api | src/Gzero/Api/UrlParamsProcessor.php | UrlParamsProcessor.getProcessedFields | public function getProcessedFields()
{
return [
'page' => $this->getPage(),
'perPage' => $this->getPerPage(),
'filter' => $this->filter,
'orderBy' => $this->orderBy,
'query' => $this->searchQuery
];
} | php | public function getProcessedFields()
{
return [
'page' => $this->getPage(),
'perPage' => $this->getPerPage(),
'filter' => $this->filter,
'orderBy' => $this->orderBy,
'query' => $this->searchQuery
];
} | [
"public",
"function",
"getProcessedFields",
"(",
")",
"{",
"return",
"[",
"'page'",
"=>",
"$",
"this",
"->",
"getPage",
"(",
")",
",",
"'perPage'",
"=>",
"$",
"this",
"->",
"getPerPage",
"(",
")",
",",
"'filter'",
"=>",
"$",
"this",
"->",
"filter",
","... | Returns array with all processed fields
@return array | [
"Returns",
"array",
"with",
"all",
"processed",
"fields"
] | fc544bb6057274e9d5e7b617346c3f854ea5effd | https://github.com/GrupaZero/api/blob/fc544bb6057274e9d5e7b617346c3f854ea5effd/src/Gzero/Api/UrlParamsProcessor.php#L100-L109 |
22,288 | GrupaZero/api | src/Gzero/Api/UrlParamsProcessor.php | UrlParamsProcessor.processFilterParams | private function processFilterParams($key, $param)
{
$this->filter[] = [
$key,
'=',
(is_numeric($param)) ? (float) $param : $param
];
} | php | private function processFilterParams($key, $param)
{
$this->filter[] = [
$key,
'=',
(is_numeric($param)) ? (float) $param : $param
];
} | [
"private",
"function",
"processFilterParams",
"(",
"$",
"key",
",",
"$",
"param",
")",
"{",
"$",
"this",
"->",
"filter",
"[",
"]",
"=",
"[",
"$",
"key",
",",
"'='",
",",
"(",
"is_numeric",
"(",
"$",
"param",
")",
")",
"?",
"(",
"float",
")",
"$",... | Process filter params
@param string $key Param name
@param string $param Param value
@return void | [
"Process",
"filter",
"params"
] | fc544bb6057274e9d5e7b617346c3f854ea5effd | https://github.com/GrupaZero/api/blob/fc544bb6057274e9d5e7b617346c3f854ea5effd/src/Gzero/Api/UrlParamsProcessor.php#L180-L187 |
22,289 | surebert/surebert-framework | src/sb/String/Image.php | Image.draw | public function draw($text, $size=12, $x=0, $y=0)
{
imagettftext($this->image, $size, $this->rotation, $x, $y, $this->text_color, $this->font, $text);
return $this->image;
} | php | public function draw($text, $size=12, $x=0, $y=0)
{
imagettftext($this->image, $size, $this->rotation, $x, $y, $this->text_color, $this->font, $text);
return $this->image;
} | [
"public",
"function",
"draw",
"(",
"$",
"text",
",",
"$",
"size",
"=",
"12",
",",
"$",
"x",
"=",
"0",
",",
"$",
"y",
"=",
"0",
")",
"{",
"imagettftext",
"(",
"$",
"this",
"->",
"image",
",",
"$",
"size",
",",
"$",
"this",
"->",
"rotation",
",... | Draws the text onto the image
@param string $text The text to write on the image
@param integer $size The font size to use
@param integer $x The x position to start draiwng on the image
@param integer $y The y position to start drawing on the image
@return resource A png image resource that can be used by imagepn... | [
"Draws",
"the",
"text",
"onto",
"the",
"image"
] | f2f32eb693bd39385ceb93355efb5b2a429f27ce | https://github.com/surebert/surebert-framework/blob/f2f32eb693bd39385ceb93355efb5b2a429f27ce/src/sb/String/Image.php#L84-L91 |
22,290 | hametuha/wpametu | src/WPametu/Pattern/Singleton.php | Singleton.get_instance | final public static function get_instance( array $setting = [] ) {
$class_name = get_called_class();
if ( ! isset( self::$instances[ $class_name ] ) ) {
self::$instances[ $class_name ] = new $class_name( $setting );
}
return self::$instances[ $class_name ];
} | php | final public static function get_instance( array $setting = [] ) {
$class_name = get_called_class();
if ( ! isset( self::$instances[ $class_name ] ) ) {
self::$instances[ $class_name ] = new $class_name( $setting );
}
return self::$instances[ $class_name ];
} | [
"final",
"public",
"static",
"function",
"get_instance",
"(",
"array",
"$",
"setting",
"=",
"[",
"]",
")",
"{",
"$",
"class_name",
"=",
"get_called_class",
"(",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"self",
"::",
"$",
"instances",
"[",
"$",
"class_na... | Singleton initialize method
@param array $setting
@return static | [
"Singleton",
"initialize",
"method"
] | 0939373800815a8396291143d2a57967340da5aa | https://github.com/hametuha/wpametu/blob/0939373800815a8396291143d2a57967340da5aa/src/WPametu/Pattern/Singleton.php#L32-L39 |
22,291 | ajant/SimpleArrayLibrary | src/Categories/Getters.php | Getters.getColumns | public static function getColumns(array $array, array $columns, $allRowsMustHaveAllColumns = false)
{
// validation
foreach ($array as $key => $row) {
if (!is_array($row)) {
throw new UnexpectedValueException('Array element "' . $key . '" is not an array');
}
... | php | public static function getColumns(array $array, array $columns, $allRowsMustHaveAllColumns = false)
{
// validation
foreach ($array as $key => $row) {
if (!is_array($row)) {
throw new UnexpectedValueException('Array element "' . $key . '" is not an array');
}
... | [
"public",
"static",
"function",
"getColumns",
"(",
"array",
"$",
"array",
",",
"array",
"$",
"columns",
",",
"$",
"allRowsMustHaveAllColumns",
"=",
"false",
")",
"{",
"// validation",
"foreach",
"(",
"$",
"array",
"as",
"$",
"key",
"=>",
"$",
"row",
")",
... | Extracts a column from an array
@param array $array
@param array $columns
@param bool $allRowsMustHaveAllColumns
@return array
@throws UnexpectedValueException | [
"Extracts",
"a",
"column",
"from",
"an",
"array"
] | 374877c0f20a22a914eb3680eb1cf39e424071be | https://github.com/ajant/SimpleArrayLibrary/blob/374877c0f20a22a914eb3680eb1cf39e424071be/src/Categories/Getters.php#L20-L49 |
22,292 | ajant/SimpleArrayLibrary | src/Categories/Getters.php | Getters.getRectangularDimensions | public static function getRectangularDimensions(array $array)
{
$return = -1;
$allArrays = array_map('is_array', $array);
// all elements are arrays, iterate through them and call the static function recursively
if (self::allElementsEqual($allArrays, true)) {
$elementsPer... | php | public static function getRectangularDimensions(array $array)
{
$return = -1;
$allArrays = array_map('is_array', $array);
// all elements are arrays, iterate through them and call the static function recursively
if (self::allElementsEqual($allArrays, true)) {
$elementsPer... | [
"public",
"static",
"function",
"getRectangularDimensions",
"(",
"array",
"$",
"array",
")",
"{",
"$",
"return",
"=",
"-",
"1",
";",
"$",
"allArrays",
"=",
"array_map",
"(",
"'is_array'",
",",
"$",
"array",
")",
";",
"// all elements are arrays, iterate through ... | Checks if an array is rectangular array and returns dimensions or -1 if it's not rectangular
@param array $array
@return int|array | [
"Checks",
"if",
"an",
"array",
"is",
"rectangular",
"array",
"and",
"returns",
"dimensions",
"or",
"-",
"1",
"if",
"it",
"s",
"not",
"rectangular"
] | 374877c0f20a22a914eb3680eb1cf39e424071be | https://github.com/ajant/SimpleArrayLibrary/blob/374877c0f20a22a914eb3680eb1cf39e424071be/src/Categories/Getters.php#L58-L84 |
22,293 | ajant/SimpleArrayLibrary | src/Categories/Getters.php | Getters.selectRandomArrayElements | public static function selectRandomArrayElements(array $array, $numberOfRequiredElements)
{
// validation, must be positive int or 0
if (!self::isLogicallyCastableToInt($numberOfRequiredElements)) {
throw new InvalidArgumentException('Number of requested elements parameter must be a posi... | php | public static function selectRandomArrayElements(array $array, $numberOfRequiredElements)
{
// validation, must be positive int or 0
if (!self::isLogicallyCastableToInt($numberOfRequiredElements)) {
throw new InvalidArgumentException('Number of requested elements parameter must be a posi... | [
"public",
"static",
"function",
"selectRandomArrayElements",
"(",
"array",
"$",
"array",
",",
"$",
"numberOfRequiredElements",
")",
"{",
"// validation, must be positive int or 0",
"if",
"(",
"!",
"self",
"::",
"isLogicallyCastableToInt",
"(",
"$",
"numberOfRequiredElemen... | Selects random sub array
@param array $array
@param int $numberOfRequiredElements
@return array
@throws InvalidArgumentException | [
"Selects",
"random",
"sub",
"array"
] | 374877c0f20a22a914eb3680eb1cf39e424071be | https://github.com/ajant/SimpleArrayLibrary/blob/374877c0f20a22a914eb3680eb1cf39e424071be/src/Categories/Getters.php#L95-L115 |
22,294 | lukasz-adamski/teamspeak3-framework | src/TeamSpeak3/Helper/Uri.php | Uri.parseUri | protected function parseUri($uriString = '')
{
$status = @preg_match("~^((//)([^/?#]*))([^?#]*)(\?([^#]*))?(#(.*))?$~", $uriString, $matches);
if($status === FALSE)
{
throw new Exception("URI scheme-specific decomposition failed");
}
if(!$status) return;
$this->path = (isset($matches[... | php | protected function parseUri($uriString = '')
{
$status = @preg_match("~^((//)([^/?#]*))([^?#]*)(\?([^#]*))?(#(.*))?$~", $uriString, $matches);
if($status === FALSE)
{
throw new Exception("URI scheme-specific decomposition failed");
}
if(!$status) return;
$this->path = (isset($matches[... | [
"protected",
"function",
"parseUri",
"(",
"$",
"uriString",
"=",
"''",
")",
"{",
"$",
"status",
"=",
"@",
"preg_match",
"(",
"\"~^((//)([^/?#]*))([^?#]*)(\\?([^#]*))?(#(.*))?$~\"",
",",
"$",
"uriString",
",",
"$",
"matches",
")",
";",
"if",
"(",
"$",
"status",... | Parses the scheme-specific portion of the URI and place its parts into instance variables.
@throws Exception
@return void | [
"Parses",
"the",
"scheme",
"-",
"specific",
"portion",
"of",
"the",
"URI",
"and",
"place",
"its",
"parts",
"into",
"instance",
"variables",
"."
] | 39a56eca608da6b56b6aa386a7b5b31dc576c41a | https://github.com/lukasz-adamski/teamspeak3-framework/blob/39a56eca608da6b56b6aa386a7b5b31dc576c41a/src/TeamSpeak3/Helper/Uri.php#L145-L173 |
22,295 | lukasz-adamski/teamspeak3-framework | src/TeamSpeak3/Helper/Uri.php | Uri.check | public static function check($uri)
{
try
{
$uri = new self(strval($uri));
}
catch(\Exception $e)
{
return FALSE;
}
return $uri->valid();
} | php | public static function check($uri)
{
try
{
$uri = new self(strval($uri));
}
catch(\Exception $e)
{
return FALSE;
}
return $uri->valid();
} | [
"public",
"static",
"function",
"check",
"(",
"$",
"uri",
")",
"{",
"try",
"{",
"$",
"uri",
"=",
"new",
"self",
"(",
"strval",
"(",
"$",
"uri",
")",
")",
";",
"}",
"catch",
"(",
"\\",
"Exception",
"$",
"e",
")",
"{",
"return",
"FALSE",
";",
"}"... | Returns TRUE if a given URI is valid.
@param string $uri
@return boolean | [
"Returns",
"TRUE",
"if",
"a",
"given",
"URI",
"is",
"valid",
"."
] | 39a56eca608da6b56b6aa386a7b5b31dc576c41a | https://github.com/lukasz-adamski/teamspeak3-framework/blob/39a56eca608da6b56b6aa386a7b5b31dc576c41a/src/TeamSpeak3/Helper/Uri.php#L191-L203 |
22,296 | lukasz-adamski/teamspeak3-framework | src/TeamSpeak3/Helper/Uri.php | Uri.checkPath | public function checkPath($path = null)
{
if($path === null)
{
$path = $this->path;
}
if(strlen($path) == 0)
{
return TRUE;
}
$pattern = "/^" . $this->regex["path"] . "$/";
$status = @preg_match($pattern, $path);
if($status === FALSE)
{
throw new Exception(... | php | public function checkPath($path = null)
{
if($path === null)
{
$path = $this->path;
}
if(strlen($path) == 0)
{
return TRUE;
}
$pattern = "/^" . $this->regex["path"] . "$/";
$status = @preg_match($pattern, $path);
if($status === FALSE)
{
throw new Exception(... | [
"public",
"function",
"checkPath",
"(",
"$",
"path",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"path",
"===",
"null",
")",
"{",
"$",
"path",
"=",
"$",
"this",
"->",
"path",
";",
"}",
"if",
"(",
"strlen",
"(",
"$",
"path",
")",
"==",
"0",
")",
"{... | Returns TRUE if the path is valid.
@param string $path
@throws Exception
@return boolean | [
"Returns",
"TRUE",
"if",
"the",
"path",
"is",
"valid",
"."
] | 39a56eca608da6b56b6aa386a7b5b31dc576c41a | https://github.com/lukasz-adamski/teamspeak3-framework/blob/39a56eca608da6b56b6aa386a7b5b31dc576c41a/src/TeamSpeak3/Helper/Uri.php#L414-L435 |
22,297 | lukasz-adamski/teamspeak3-framework | src/TeamSpeak3/Helper/Uri.php | Uri.getHostUri | public static function getHostUri()
{
$sheme = (self::getHostParam("HTTPS") == "on") ? "https" : "http";
$serverName = new Str(self::getHostParam("HTTP_HOST"));
$serverPort = self::getHostParam("SERVER_PORT");
$serverPort = ($serverPort != 80 && $serverPort != 443) ? ":" . $serverPort : "";
if($... | php | public static function getHostUri()
{
$sheme = (self::getHostParam("HTTPS") == "on") ? "https" : "http";
$serverName = new Str(self::getHostParam("HTTP_HOST"));
$serverPort = self::getHostParam("SERVER_PORT");
$serverPort = ($serverPort != 80 && $serverPort != 443) ? ":" . $serverPort : "";
if($... | [
"public",
"static",
"function",
"getHostUri",
"(",
")",
"{",
"$",
"sheme",
"=",
"(",
"self",
"::",
"getHostParam",
"(",
"\"HTTPS\"",
")",
"==",
"\"on\"",
")",
"?",
"\"https\"",
":",
"\"http\"",
";",
"$",
"serverName",
"=",
"new",
"Str",
"(",
"self",
":... | Returns the applications host address.
@return Str | [
"Returns",
"the",
"applications",
"host",
"address",
"."
] | 39a56eca608da6b56b6aa386a7b5b31dc576c41a | https://github.com/lukasz-adamski/teamspeak3-framework/blob/39a56eca608da6b56b6aa386a7b5b31dc576c41a/src/TeamSpeak3/Helper/Uri.php#L677-L691 |
22,298 | Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Mail/src/parser/parts/text_parser.php | ezcMailTextParser.parseBody | public function parseBody( $line )
{
$line = rtrim( $line, "\r\n" );
if ( $this->text === null )
{
$this->text = $line;
}
else
{
$this->text .= "\n" . $line;
}
} | php | public function parseBody( $line )
{
$line = rtrim( $line, "\r\n" );
if ( $this->text === null )
{
$this->text = $line;
}
else
{
$this->text .= "\n" . $line;
}
} | [
"public",
"function",
"parseBody",
"(",
"$",
"line",
")",
"{",
"$",
"line",
"=",
"rtrim",
"(",
"$",
"line",
",",
"\"\\r\\n\"",
")",
";",
"if",
"(",
"$",
"this",
"->",
"text",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"text",
"=",
"$",
"line",
... | Adds each line to the body of the text part.
@param string $line | [
"Adds",
"each",
"line",
"to",
"the",
"body",
"of",
"the",
"text",
"part",
"."
] | b0afc661105f0a2f65d49abac13956cc93c5188d | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Mail/src/parser/parts/text_parser.php#L59-L70 |
22,299 | Eresus/EresusCMS | src/core/framework/core/3rdparty/ezcomponents/Mail/src/parser/parts/text_parser.php | ezcMailTextParser.finish | public function finish()
{
$charset = "us-ascii"; // RFC 2822 default
if ( isset( $this->headers['Content-Type'] ) )
{
preg_match( '/\s*charset\s?=\s?"?([^;"\s]*);?/',
$this->headers['Content-Type'],
$parameters );
... | php | public function finish()
{
$charset = "us-ascii"; // RFC 2822 default
if ( isset( $this->headers['Content-Type'] ) )
{
preg_match( '/\s*charset\s?=\s?"?([^;"\s]*);?/',
$this->headers['Content-Type'],
$parameters );
... | [
"public",
"function",
"finish",
"(",
")",
"{",
"$",
"charset",
"=",
"\"us-ascii\"",
";",
"// RFC 2822 default",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"headers",
"[",
"'Content-Type'",
"]",
")",
")",
"{",
"preg_match",
"(",
"'/\\s*charset\\s?=\\s?\"?([^;\... | Returns the ezcMailText part corresponding to the parsed message.
@return ezcMailText | [
"Returns",
"the",
"ezcMailText",
"part",
"corresponding",
"to",
"the",
"parsed",
"message",
"."
] | b0afc661105f0a2f65d49abac13956cc93c5188d | https://github.com/Eresus/EresusCMS/blob/b0afc661105f0a2f65d49abac13956cc93c5188d/src/core/framework/core/3rdparty/ezcomponents/Mail/src/parser/parts/text_parser.php#L77-L109 |
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.