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
|
---|---|---|---|---|---|---|---|---|---|---|---|
18,000 | ClanCats/Core | src/classes/CCArr.php | CCArr.add | public static function add( $key, $item, &$arr )
{
if( !is_array( $arr ) )
{
throw new \InvalidArgumentException('CCArr::add - second argument has to be an array.');
}
if ( !is_array( static::get( $key, $arr ) ) )
{
return static::set( $key, array( $item ), $arr );
}
return static::set( $key, static::push( $item, static::get( $key, $arr ) ), $arr );
} | php | public static function add( $key, $item, &$arr )
{
if( !is_array( $arr ) )
{
throw new \InvalidArgumentException('CCArr::add - second argument has to be an array.');
}
if ( !is_array( static::get( $key, $arr ) ) )
{
return static::set( $key, array( $item ), $arr );
}
return static::set( $key, static::push( $item, static::get( $key, $arr ) ), $arr );
} | [
"public",
"static",
"function",
"add",
"(",
"$",
"key",
",",
"$",
"item",
",",
"&",
"$",
"arr",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"arr",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'CCArr::add - second argument has to be an array.'",
")",
";",
"}",
"if",
"(",
"!",
"is_array",
"(",
"static",
"::",
"get",
"(",
"$",
"key",
",",
"$",
"arr",
")",
")",
")",
"{",
"return",
"static",
"::",
"set",
"(",
"$",
"key",
",",
"array",
"(",
"$",
"item",
")",
",",
"$",
"arr",
")",
";",
"}",
"return",
"static",
"::",
"set",
"(",
"$",
"key",
",",
"static",
"::",
"push",
"(",
"$",
"item",
",",
"static",
"::",
"get",
"(",
"$",
"key",
",",
"$",
"arr",
")",
")",
",",
"$",
"arr",
")",
";",
"}"
]
| Adds an item to an element in the array
Example:
CCArr::add( 'foo.bar', 'test' );
Results:
array( 'foo' => array( 'bar' => array( 'test' ) ) )
@param string $key
@param mixed $item The item you would like to add to the array
@param array $array
@return array | [
"Adds",
"an",
"item",
"to",
"an",
"element",
"in",
"the",
"array"
]
| 9f6ec72c1a439de4b253d0223f1029f7f85b6ef8 | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCArr.php#L85-L98 |
18,001 | ClanCats/Core | src/classes/CCArr.php | CCArr.sum | public static function sum( $arr, $key = null )
{
if( !is_array( $arr ) )
{
throw new \InvalidArgumentException('CCArr::sum - first argument has to be an array.');
}
$sum = 0;
if ( is_string( $key ) && CCArr::is_multi( $arr ) )
{
$arr = CCArr::pick( $key, $arr );
}
foreach ( $arr as $item )
{
if ( is_numeric( $item ) )
{
$sum += $item;
}
}
return $sum;
} | php | public static function sum( $arr, $key = null )
{
if( !is_array( $arr ) )
{
throw new \InvalidArgumentException('CCArr::sum - first argument has to be an array.');
}
$sum = 0;
if ( is_string( $key ) && CCArr::is_multi( $arr ) )
{
$arr = CCArr::pick( $key, $arr );
}
foreach ( $arr as $item )
{
if ( is_numeric( $item ) )
{
$sum += $item;
}
}
return $sum;
} | [
"public",
"static",
"function",
"sum",
"(",
"$",
"arr",
",",
"$",
"key",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"arr",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'CCArr::sum - first argument has to be an array.'",
")",
";",
"}",
"$",
"sum",
"=",
"0",
";",
"if",
"(",
"is_string",
"(",
"$",
"key",
")",
"&&",
"CCArr",
"::",
"is_multi",
"(",
"$",
"arr",
")",
")",
"{",
"$",
"arr",
"=",
"CCArr",
"::",
"pick",
"(",
"$",
"key",
",",
"$",
"arr",
")",
";",
"}",
"foreach",
"(",
"$",
"arr",
"as",
"$",
"item",
")",
"{",
"if",
"(",
"is_numeric",
"(",
"$",
"item",
")",
")",
"{",
"$",
"sum",
"+=",
"$",
"item",
";",
"}",
"}",
"return",
"$",
"sum",
";",
"}"
]
| sum items in an array or use special item in the array
@param array[array] $arr
@param string $key | [
"sum",
"items",
"in",
"an",
"array",
"or",
"use",
"special",
"item",
"in",
"the",
"array"
]
| 9f6ec72c1a439de4b253d0223f1029f7f85b6ef8 | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCArr.php#L192-L215 |
18,002 | ClanCats/Core | src/classes/CCArr.php | CCArr.average | public static function average( $arr, $key = null )
{
if( !is_array( $arr ) )
{
throw new \InvalidArgumentException('CCArr::average - first argunent has to be an array.');
}
if ( is_string( $key ) && CCArr::is_multi( $arr ) )
{
$arr = CCArr::pick( $key, $arr );
}
return ( static::sum( $arr ) / count( $arr ) );
} | php | public static function average( $arr, $key = null )
{
if( !is_array( $arr ) )
{
throw new \InvalidArgumentException('CCArr::average - first argunent has to be an array.');
}
if ( is_string( $key ) && CCArr::is_multi( $arr ) )
{
$arr = CCArr::pick( $key, $arr );
}
return ( static::sum( $arr ) / count( $arr ) );
} | [
"public",
"static",
"function",
"average",
"(",
"$",
"arr",
",",
"$",
"key",
"=",
"null",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"arr",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'CCArr::average - first argunent has to be an array.'",
")",
";",
"}",
"if",
"(",
"is_string",
"(",
"$",
"key",
")",
"&&",
"CCArr",
"::",
"is_multi",
"(",
"$",
"arr",
")",
")",
"{",
"$",
"arr",
"=",
"CCArr",
"::",
"pick",
"(",
"$",
"key",
",",
"$",
"arr",
")",
";",
"}",
"return",
"(",
"static",
"::",
"sum",
"(",
"$",
"arr",
")",
"/",
"count",
"(",
"$",
"arr",
")",
")",
";",
"}"
]
| get the average of the items
@param array[array] $arr
@param string $key | [
"get",
"the",
"average",
"of",
"the",
"items"
]
| 9f6ec72c1a439de4b253d0223f1029f7f85b6ef8 | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCArr.php#L223-L236 |
18,003 | ClanCats/Core | src/classes/CCArr.php | CCArr.object | public static function object( $arr )
{
if( !is_array( $arr ) )
{
throw new \InvalidArgumentException("CCArr::object - only arrays can be passed.");
}
$object = new \stdClass();
if ( !empty( $arr ) )
{
foreach ( $arr as $name => $value)
{
if ( is_array( $value ) )
{
$value = static::object( $value );
}
$object->$name = $value;
}
}
return $object;
} | php | public static function object( $arr )
{
if( !is_array( $arr ) )
{
throw new \InvalidArgumentException("CCArr::object - only arrays can be passed.");
}
$object = new \stdClass();
if ( !empty( $arr ) )
{
foreach ( $arr as $name => $value)
{
if ( is_array( $value ) )
{
$value = static::object( $value );
}
$object->$name = $value;
}
}
return $object;
} | [
"public",
"static",
"function",
"object",
"(",
"$",
"arr",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"arr",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"\"CCArr::object - only arrays can be passed.\"",
")",
";",
"}",
"$",
"object",
"=",
"new",
"\\",
"stdClass",
"(",
")",
";",
"if",
"(",
"!",
"empty",
"(",
"$",
"arr",
")",
")",
"{",
"foreach",
"(",
"$",
"arr",
"as",
"$",
"name",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"value",
")",
")",
"{",
"$",
"value",
"=",
"static",
"::",
"object",
"(",
"$",
"value",
")",
";",
"}",
"$",
"object",
"->",
"$",
"name",
"=",
"$",
"value",
";",
"}",
"}",
"return",
"$",
"object",
";",
"}"
]
| create an object from an array
@param array $array
@return object | [
"create",
"an",
"object",
"from",
"an",
"array"
]
| 9f6ec72c1a439de4b253d0223f1029f7f85b6ef8 | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCArr.php#L244-L266 |
18,004 | ClanCats/Core | src/classes/CCArr.php | CCArr.merge | public static function merge()
{
// get all arguments
$arrs = func_get_args();
$return = array();
foreach ( $arrs as $arr )
{
if ( !is_array( $arr ) )
{
throw new \InvalidArgumentException('CCArr::merge - all arguments have to be arrays.');
}
foreach ( $arr as $key => $value )
{
if ( array_key_exists( $key, $return ) )
{
if ( is_array( $value ) && is_array( $return[$key] ) )
{
$value = static::merge( $return[$key], $value );
}
}
$return[$key] = $value;
}
}
return $return;
} | php | public static function merge()
{
// get all arguments
$arrs = func_get_args();
$return = array();
foreach ( $arrs as $arr )
{
if ( !is_array( $arr ) )
{
throw new \InvalidArgumentException('CCArr::merge - all arguments have to be arrays.');
}
foreach ( $arr as $key => $value )
{
if ( array_key_exists( $key, $return ) )
{
if ( is_array( $value ) && is_array( $return[$key] ) )
{
$value = static::merge( $return[$key], $value );
}
}
$return[$key] = $value;
}
}
return $return;
} | [
"public",
"static",
"function",
"merge",
"(",
")",
"{",
"// get all arguments",
"$",
"arrs",
"=",
"func_get_args",
"(",
")",
";",
"$",
"return",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"arrs",
"as",
"$",
"arr",
")",
"{",
"if",
"(",
"!",
"is_array",
"(",
"$",
"arr",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"'CCArr::merge - all arguments have to be arrays.'",
")",
";",
"}",
"foreach",
"(",
"$",
"arr",
"as",
"$",
"key",
"=>",
"$",
"value",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"return",
")",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"value",
")",
"&&",
"is_array",
"(",
"$",
"return",
"[",
"$",
"key",
"]",
")",
")",
"{",
"$",
"value",
"=",
"static",
"::",
"merge",
"(",
"$",
"return",
"[",
"$",
"key",
"]",
",",
"$",
"value",
")",
";",
"}",
"}",
"$",
"return",
"[",
"$",
"key",
"]",
"=",
"$",
"value",
";",
"}",
"}",
"return",
"$",
"return",
";",
"}"
]
| merge arrays recursivly together
@param array $array ...
@return array | [
"merge",
"arrays",
"recursivly",
"together"
]
| 9f6ec72c1a439de4b253d0223f1029f7f85b6ef8 | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCArr.php#L274-L301 |
18,005 | ClanCats/Core | src/classes/CCArr.php | CCArr.get | public static function get( $key, $arr, $default = null )
{
if ( isset( $arr[$key] ) )
{
return $arr[$key];
}
if ( strpos( $key, '.' ) !== false )
{
$kp = explode( '.', $key );
switch ( count( $kp ) )
{
case 2:
if ( isset( $arr[$kp[0]][$kp[1]] ) )
{
return $arr[$kp[0]][$kp[1]];
}
break;
case 3:
if ( isset( $arr[$kp[0]][$kp[1]][$kp[2]] ) )
{
return $arr[$kp[0]][$kp[1]][$kp[2]];
}
break;
case 4:
if ( isset( $arr[$kp[0]][$kp[1]][$kp[2]][$kp[3]] ) )
{
return $arr[$kp[0]][$kp[1]][$kp[2]][$kp[3]];
}
break;
// if there are more then 4 parts loop trough them
default:
$curr = $arr;
foreach( $kp as $k )
{
if ( isset( $curr[$k] ) ) {
$curr = $curr[$k];
} else {
return $default;
}
}
return $curr;
break;
}
}
return $default;
} | php | public static function get( $key, $arr, $default = null )
{
if ( isset( $arr[$key] ) )
{
return $arr[$key];
}
if ( strpos( $key, '.' ) !== false )
{
$kp = explode( '.', $key );
switch ( count( $kp ) )
{
case 2:
if ( isset( $arr[$kp[0]][$kp[1]] ) )
{
return $arr[$kp[0]][$kp[1]];
}
break;
case 3:
if ( isset( $arr[$kp[0]][$kp[1]][$kp[2]] ) )
{
return $arr[$kp[0]][$kp[1]][$kp[2]];
}
break;
case 4:
if ( isset( $arr[$kp[0]][$kp[1]][$kp[2]][$kp[3]] ) )
{
return $arr[$kp[0]][$kp[1]][$kp[2]][$kp[3]];
}
break;
// if there are more then 4 parts loop trough them
default:
$curr = $arr;
foreach( $kp as $k )
{
if ( isset( $curr[$k] ) ) {
$curr = $curr[$k];
} else {
return $default;
}
}
return $curr;
break;
}
}
return $default;
} | [
"public",
"static",
"function",
"get",
"(",
"$",
"key",
",",
"$",
"arr",
",",
"$",
"default",
"=",
"null",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"arr",
"[",
"$",
"key",
"]",
")",
")",
"{",
"return",
"$",
"arr",
"[",
"$",
"key",
"]",
";",
"}",
"if",
"(",
"strpos",
"(",
"$",
"key",
",",
"'.'",
")",
"!==",
"false",
")",
"{",
"$",
"kp",
"=",
"explode",
"(",
"'.'",
",",
"$",
"key",
")",
";",
"switch",
"(",
"count",
"(",
"$",
"kp",
")",
")",
"{",
"case",
"2",
":",
"if",
"(",
"isset",
"(",
"$",
"arr",
"[",
"$",
"kp",
"[",
"0",
"]",
"]",
"[",
"$",
"kp",
"[",
"1",
"]",
"]",
")",
")",
"{",
"return",
"$",
"arr",
"[",
"$",
"kp",
"[",
"0",
"]",
"]",
"[",
"$",
"kp",
"[",
"1",
"]",
"]",
";",
"}",
"break",
";",
"case",
"3",
":",
"if",
"(",
"isset",
"(",
"$",
"arr",
"[",
"$",
"kp",
"[",
"0",
"]",
"]",
"[",
"$",
"kp",
"[",
"1",
"]",
"]",
"[",
"$",
"kp",
"[",
"2",
"]",
"]",
")",
")",
"{",
"return",
"$",
"arr",
"[",
"$",
"kp",
"[",
"0",
"]",
"]",
"[",
"$",
"kp",
"[",
"1",
"]",
"]",
"[",
"$",
"kp",
"[",
"2",
"]",
"]",
";",
"}",
"break",
";",
"case",
"4",
":",
"if",
"(",
"isset",
"(",
"$",
"arr",
"[",
"$",
"kp",
"[",
"0",
"]",
"]",
"[",
"$",
"kp",
"[",
"1",
"]",
"]",
"[",
"$",
"kp",
"[",
"2",
"]",
"]",
"[",
"$",
"kp",
"[",
"3",
"]",
"]",
")",
")",
"{",
"return",
"$",
"arr",
"[",
"$",
"kp",
"[",
"0",
"]",
"]",
"[",
"$",
"kp",
"[",
"1",
"]",
"]",
"[",
"$",
"kp",
"[",
"2",
"]",
"]",
"[",
"$",
"kp",
"[",
"3",
"]",
"]",
";",
"}",
"break",
";",
"// if there are more then 4 parts loop trough them",
"default",
":",
"$",
"curr",
"=",
"$",
"arr",
";",
"foreach",
"(",
"$",
"kp",
"as",
"$",
"k",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"curr",
"[",
"$",
"k",
"]",
")",
")",
"{",
"$",
"curr",
"=",
"$",
"curr",
"[",
"$",
"k",
"]",
";",
"}",
"else",
"{",
"return",
"$",
"default",
";",
"}",
"}",
"return",
"$",
"curr",
";",
"break",
";",
"}",
"}",
"return",
"$",
"default",
";",
"}"
]
| return an item from an array with dottet dimensions
@param string $key
@param array $arr
@param mixed $default
@return mixed | [
"return",
"an",
"item",
"from",
"an",
"array",
"with",
"dottet",
"dimensions"
]
| 9f6ec72c1a439de4b253d0223f1029f7f85b6ef8 | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCArr.php#L311-L360 |
18,006 | ClanCats/Core | src/classes/CCArr.php | CCArr.has | public static function has( $key, $arr )
{
if ( isset( $arr[$key] ) )
{
return true;
}
if ( strpos( $key, '.' ) !== false )
{
$kp = explode( '.', $key );
switch ( count( $kp ) ) {
case 2:
return isset( $arr[$kp[0]][$kp[1]] ); break;
case 3:
return isset( $arr[$kp[0]][$kp[1]][$kp[2]] ); break;
case 4:
return isset( $arr[$kp[0]][$kp[1]][$kp[2]][$kp[3]] ); break;
// if there are more then 4 parts loop trough them
default:
$curr = $arr;
foreach( $kp as $k )
{
if ( isset( $curr[$k] ) ) {
$curr = $curr[$k];
} else {
return false;
}
}
return true;
break;
}
}
return false;
} | php | public static function has( $key, $arr )
{
if ( isset( $arr[$key] ) )
{
return true;
}
if ( strpos( $key, '.' ) !== false )
{
$kp = explode( '.', $key );
switch ( count( $kp ) ) {
case 2:
return isset( $arr[$kp[0]][$kp[1]] ); break;
case 3:
return isset( $arr[$kp[0]][$kp[1]][$kp[2]] ); break;
case 4:
return isset( $arr[$kp[0]][$kp[1]][$kp[2]][$kp[3]] ); break;
// if there are more then 4 parts loop trough them
default:
$curr = $arr;
foreach( $kp as $k )
{
if ( isset( $curr[$k] ) ) {
$curr = $curr[$k];
} else {
return false;
}
}
return true;
break;
}
}
return false;
} | [
"public",
"static",
"function",
"has",
"(",
"$",
"key",
",",
"$",
"arr",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"arr",
"[",
"$",
"key",
"]",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"strpos",
"(",
"$",
"key",
",",
"'.'",
")",
"!==",
"false",
")",
"{",
"$",
"kp",
"=",
"explode",
"(",
"'.'",
",",
"$",
"key",
")",
";",
"switch",
"(",
"count",
"(",
"$",
"kp",
")",
")",
"{",
"case",
"2",
":",
"return",
"isset",
"(",
"$",
"arr",
"[",
"$",
"kp",
"[",
"0",
"]",
"]",
"[",
"$",
"kp",
"[",
"1",
"]",
"]",
")",
";",
"break",
";",
"case",
"3",
":",
"return",
"isset",
"(",
"$",
"arr",
"[",
"$",
"kp",
"[",
"0",
"]",
"]",
"[",
"$",
"kp",
"[",
"1",
"]",
"]",
"[",
"$",
"kp",
"[",
"2",
"]",
"]",
")",
";",
"break",
";",
"case",
"4",
":",
"return",
"isset",
"(",
"$",
"arr",
"[",
"$",
"kp",
"[",
"0",
"]",
"]",
"[",
"$",
"kp",
"[",
"1",
"]",
"]",
"[",
"$",
"kp",
"[",
"2",
"]",
"]",
"[",
"$",
"kp",
"[",
"3",
"]",
"]",
")",
";",
"break",
";",
"// if there are more then 4 parts loop trough them",
"default",
":",
"$",
"curr",
"=",
"$",
"arr",
";",
"foreach",
"(",
"$",
"kp",
"as",
"$",
"k",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"curr",
"[",
"$",
"k",
"]",
")",
")",
"{",
"$",
"curr",
"=",
"$",
"curr",
"[",
"$",
"k",
"]",
";",
"}",
"else",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"break",
";",
"}",
"}",
"return",
"false",
";",
"}"
]
| checks if the array has an item with dottet dimensions
@param string $key
@param array $arr
@return bool | [
"checks",
"if",
"the",
"array",
"has",
"an",
"item",
"with",
"dottet",
"dimensions"
]
| 9f6ec72c1a439de4b253d0223f1029f7f85b6ef8 | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCArr.php#L369-L404 |
18,007 | ClanCats/Core | src/classes/CCArr.php | CCArr.set | public static function set( $key, $value, &$arr )
{
if ( strpos( $key, '.' ) === false )
{
$arr[$key] = $value;
}
else
{
$kp = explode( '.', $key );
switch ( count( $kp ) )
{
case 2:
$arr[$kp[0]][$kp[1]] = $value; break;
case 3:
$arr[$kp[0]][$kp[1]][$kp[2]] = $value; break;
case 4:
$arr[$kp[0]][$kp[1]][$kp[2]][$kp[3]] = $value; break;
// if there are more then 4 parts loop trough them
default:
$kp = array_reverse( $kp );
$curr = $value;
foreach( $kp as $k )
{
$curr = array( $k => $curr );
}
$arr = static::merge( $arr, $curr );
break;
}
}
return $arr;
} | php | public static function set( $key, $value, &$arr )
{
if ( strpos( $key, '.' ) === false )
{
$arr[$key] = $value;
}
else
{
$kp = explode( '.', $key );
switch ( count( $kp ) )
{
case 2:
$arr[$kp[0]][$kp[1]] = $value; break;
case 3:
$arr[$kp[0]][$kp[1]][$kp[2]] = $value; break;
case 4:
$arr[$kp[0]][$kp[1]][$kp[2]][$kp[3]] = $value; break;
// if there are more then 4 parts loop trough them
default:
$kp = array_reverse( $kp );
$curr = $value;
foreach( $kp as $k )
{
$curr = array( $k => $curr );
}
$arr = static::merge( $arr, $curr );
break;
}
}
return $arr;
} | [
"public",
"static",
"function",
"set",
"(",
"$",
"key",
",",
"$",
"value",
",",
"&",
"$",
"arr",
")",
"{",
"if",
"(",
"strpos",
"(",
"$",
"key",
",",
"'.'",
")",
"===",
"false",
")",
"{",
"$",
"arr",
"[",
"$",
"key",
"]",
"=",
"$",
"value",
";",
"}",
"else",
"{",
"$",
"kp",
"=",
"explode",
"(",
"'.'",
",",
"$",
"key",
")",
";",
"switch",
"(",
"count",
"(",
"$",
"kp",
")",
")",
"{",
"case",
"2",
":",
"$",
"arr",
"[",
"$",
"kp",
"[",
"0",
"]",
"]",
"[",
"$",
"kp",
"[",
"1",
"]",
"]",
"=",
"$",
"value",
";",
"break",
";",
"case",
"3",
":",
"$",
"arr",
"[",
"$",
"kp",
"[",
"0",
"]",
"]",
"[",
"$",
"kp",
"[",
"1",
"]",
"]",
"[",
"$",
"kp",
"[",
"2",
"]",
"]",
"=",
"$",
"value",
";",
"break",
";",
"case",
"4",
":",
"$",
"arr",
"[",
"$",
"kp",
"[",
"0",
"]",
"]",
"[",
"$",
"kp",
"[",
"1",
"]",
"]",
"[",
"$",
"kp",
"[",
"2",
"]",
"]",
"[",
"$",
"kp",
"[",
"3",
"]",
"]",
"=",
"$",
"value",
";",
"break",
";",
"// if there are more then 4 parts loop trough them",
"default",
":",
"$",
"kp",
"=",
"array_reverse",
"(",
"$",
"kp",
")",
";",
"$",
"curr",
"=",
"$",
"value",
";",
"foreach",
"(",
"$",
"kp",
"as",
"$",
"k",
")",
"{",
"$",
"curr",
"=",
"array",
"(",
"$",
"k",
"=>",
"$",
"curr",
")",
";",
"}",
"$",
"arr",
"=",
"static",
"::",
"merge",
"(",
"$",
"arr",
",",
"$",
"curr",
")",
";",
"break",
";",
"}",
"}",
"return",
"$",
"arr",
";",
"}"
]
| sets an item from an array with dottet dimensions
@param string $key
@param mixed $value
@param array $arr
@return array | [
"sets",
"an",
"item",
"from",
"an",
"array",
"with",
"dottet",
"dimensions"
]
| 9f6ec72c1a439de4b253d0223f1029f7f85b6ef8 | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCArr.php#L414-L449 |
18,008 | ClanCats/Core | src/classes/CCArr.php | CCArr.delete | public static function delete( $key, &$arr )
{
if ( isset( $arr[$key] ) )
{
unset( $arr[$key] ); return;
}
if ( strpos( $key, '.' ) !== false )
{
$kp = explode( '.', $key );
switch ( count( $kp ) ) {
case 2:
unset( $arr[$kp[0]][$kp[1]] ); return; break;
case 3:
unset( $arr[$kp[0]][$kp[1]][$kp[2]] ); return; break;
case 4:
unset( $arr[$kp[0]][$kp[1]][$kp[2]][$kp[3]] ); return; break;
}
}
} | php | public static function delete( $key, &$arr )
{
if ( isset( $arr[$key] ) )
{
unset( $arr[$key] ); return;
}
if ( strpos( $key, '.' ) !== false )
{
$kp = explode( '.', $key );
switch ( count( $kp ) ) {
case 2:
unset( $arr[$kp[0]][$kp[1]] ); return; break;
case 3:
unset( $arr[$kp[0]][$kp[1]][$kp[2]] ); return; break;
case 4:
unset( $arr[$kp[0]][$kp[1]][$kp[2]][$kp[3]] ); return; break;
}
}
} | [
"public",
"static",
"function",
"delete",
"(",
"$",
"key",
",",
"&",
"$",
"arr",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"arr",
"[",
"$",
"key",
"]",
")",
")",
"{",
"unset",
"(",
"$",
"arr",
"[",
"$",
"key",
"]",
")",
";",
"return",
";",
"}",
"if",
"(",
"strpos",
"(",
"$",
"key",
",",
"'.'",
")",
"!==",
"false",
")",
"{",
"$",
"kp",
"=",
"explode",
"(",
"'.'",
",",
"$",
"key",
")",
";",
"switch",
"(",
"count",
"(",
"$",
"kp",
")",
")",
"{",
"case",
"2",
":",
"unset",
"(",
"$",
"arr",
"[",
"$",
"kp",
"[",
"0",
"]",
"]",
"[",
"$",
"kp",
"[",
"1",
"]",
"]",
")",
";",
"return",
";",
"break",
";",
"case",
"3",
":",
"unset",
"(",
"$",
"arr",
"[",
"$",
"kp",
"[",
"0",
"]",
"]",
"[",
"$",
"kp",
"[",
"1",
"]",
"]",
"[",
"$",
"kp",
"[",
"2",
"]",
"]",
")",
";",
"return",
";",
"break",
";",
"case",
"4",
":",
"unset",
"(",
"$",
"arr",
"[",
"$",
"kp",
"[",
"0",
"]",
"]",
"[",
"$",
"kp",
"[",
"1",
"]",
"]",
"[",
"$",
"kp",
"[",
"2",
"]",
"]",
"[",
"$",
"kp",
"[",
"3",
"]",
"]",
")",
";",
"return",
";",
"break",
";",
"}",
"}",
"}"
]
| deletes an item from an array with dottet dimensions
@param string $key
@param array $arr
@return void | [
"deletes",
"an",
"item",
"from",
"an",
"array",
"with",
"dottet",
"dimensions"
]
| 9f6ec72c1a439de4b253d0223f1029f7f85b6ef8 | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCArr.php#L458-L478 |
18,009 | webforge-labs/psc-cms | lib/Psc/Net/RequestMatcher.php | RequestMatcher.matchOrderBy | public function matchOrderBy($orderByValue, Array $mappings, Array $default = array()) {
if (is_string($orderByValue)) {
$orderByValue = array($orderByValue => 'ASC');
}
$orderBy = array();
if (is_array($orderByValue)) {
foreach ($orderByValue as $key => $sort) {
$sort = mb_stripos($sort, 'desc') !== FALSE ? 'DESC' : 'ASC';
if (array_key_exists($key, $mappings)) {
$alias = $mappings[$key] ?: $key;
$orderBy[$alias] = $sort;
}
}
}
if (empty($orderBy)) {
return $default;
}
return $orderBy;
} | php | public function matchOrderBy($orderByValue, Array $mappings, Array $default = array()) {
if (is_string($orderByValue)) {
$orderByValue = array($orderByValue => 'ASC');
}
$orderBy = array();
if (is_array($orderByValue)) {
foreach ($orderByValue as $key => $sort) {
$sort = mb_stripos($sort, 'desc') !== FALSE ? 'DESC' : 'ASC';
if (array_key_exists($key, $mappings)) {
$alias = $mappings[$key] ?: $key;
$orderBy[$alias] = $sort;
}
}
}
if (empty($orderBy)) {
return $default;
}
return $orderBy;
} | [
"public",
"function",
"matchOrderBy",
"(",
"$",
"orderByValue",
",",
"Array",
"$",
"mappings",
",",
"Array",
"$",
"default",
"=",
"array",
"(",
")",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"orderByValue",
")",
")",
"{",
"$",
"orderByValue",
"=",
"array",
"(",
"$",
"orderByValue",
"=>",
"'ASC'",
")",
";",
"}",
"$",
"orderBy",
"=",
"array",
"(",
")",
";",
"if",
"(",
"is_array",
"(",
"$",
"orderByValue",
")",
")",
"{",
"foreach",
"(",
"$",
"orderByValue",
"as",
"$",
"key",
"=>",
"$",
"sort",
")",
"{",
"$",
"sort",
"=",
"mb_stripos",
"(",
"$",
"sort",
",",
"'desc'",
")",
"!==",
"FALSE",
"?",
"'DESC'",
":",
"'ASC'",
";",
"if",
"(",
"array_key_exists",
"(",
"$",
"key",
",",
"$",
"mappings",
")",
")",
"{",
"$",
"alias",
"=",
"$",
"mappings",
"[",
"$",
"key",
"]",
"?",
":",
"$",
"key",
";",
"$",
"orderBy",
"[",
"$",
"alias",
"]",
"=",
"$",
"sort",
";",
"}",
"}",
"}",
"if",
"(",
"empty",
"(",
"$",
"orderBy",
")",
")",
"{",
"return",
"$",
"default",
";",
"}",
"return",
"$",
"orderBy",
";",
"}"
]
| Matches a value as it is meant to be a order by value
returns an orderby-array if the value can be parsed
returns the $default if the value cannot be parsed
the orderby array is like
array (string $field => string ASC|DESC, string $field2 => string ASC|DESC);
lowercase asc or desc will be converted. Other values will be expanded to ASC
if only string is given as value it is treated as $field and the sort is default to ASC | [
"Matches",
"a",
"value",
"as",
"it",
"is",
"meant",
"to",
"be",
"a",
"order",
"by",
"value"
]
| 467bfa2547e6b4fa487d2d7f35fa6cc618dbc763 | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/Net/RequestMatcher.php#L176-L199 |
18,010 | lode/fem | src/bootstrap.php | bootstrap.set_custom_library | public static function set_custom_library($name, $custom_class) {
if (class_exists('\\alsvanzelf\\fem\\'.$name) == false) {
throw new exception('library does not exist in fem');
}
self::$custom_libraries[$name] = $custom_class;
} | php | public static function set_custom_library($name, $custom_class) {
if (class_exists('\\alsvanzelf\\fem\\'.$name) == false) {
throw new exception('library does not exist in fem');
}
self::$custom_libraries[$name] = $custom_class;
} | [
"public",
"static",
"function",
"set_custom_library",
"(",
"$",
"name",
",",
"$",
"custom_class",
")",
"{",
"if",
"(",
"class_exists",
"(",
"'\\\\alsvanzelf\\\\fem\\\\'",
".",
"$",
"name",
")",
"==",
"false",
")",
"{",
"throw",
"new",
"exception",
"(",
"'library does not exist in fem'",
")",
";",
"}",
"self",
"::",
"$",
"custom_libraries",
"[",
"$",
"name",
"]",
"=",
"$",
"custom_class",
";",
"}"
]
| set a custom library for usage by other fem libraries
use this when extending a fem library
without this, fem will call the non-extended library in its own calls
@param string $name the name of the fem class, i.e. 'page'
@param string $custom_class the (fully qualified) name of the extending class
@return void | [
"set",
"a",
"custom",
"library",
"for",
"usage",
"by",
"other",
"fem",
"libraries",
"use",
"this",
"when",
"extending",
"a",
"fem",
"library",
"without",
"this",
"fem",
"will",
"call",
"the",
"non",
"-",
"extended",
"library",
"in",
"its",
"own",
"calls"
]
| c1c466c1a904d99452b341c5ae7cbc3e22b106e1 | https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/bootstrap.php#L35-L41 |
18,011 | lode/fem | src/bootstrap.php | bootstrap.get_library | public static function get_library($name) {
if (class_exists('\\alsvanzelf\\fem\\'.$name) == false) {
throw new exception('library does not exist in fem');
}
if (isset(self::$custom_libraries[$name])) {
return self::$custom_libraries[$name];
}
return '\\alsvanzelf\\fem\\'.$name;
} | php | public static function get_library($name) {
if (class_exists('\\alsvanzelf\\fem\\'.$name) == false) {
throw new exception('library does not exist in fem');
}
if (isset(self::$custom_libraries[$name])) {
return self::$custom_libraries[$name];
}
return '\\alsvanzelf\\fem\\'.$name;
} | [
"public",
"static",
"function",
"get_library",
"(",
"$",
"name",
")",
"{",
"if",
"(",
"class_exists",
"(",
"'\\\\alsvanzelf\\\\fem\\\\'",
".",
"$",
"name",
")",
"==",
"false",
")",
"{",
"throw",
"new",
"exception",
"(",
"'library does not exist in fem'",
")",
";",
"}",
"if",
"(",
"isset",
"(",
"self",
"::",
"$",
"custom_libraries",
"[",
"$",
"name",
"]",
")",
")",
"{",
"return",
"self",
"::",
"$",
"custom_libraries",
"[",
"$",
"name",
"]",
";",
"}",
"return",
"'\\\\alsvanzelf\\\\fem\\\\'",
".",
"$",
"name",
";",
"}"
]
| get the class name which should be used for a certain fem library
used internally to determine whether a custom library has been set
returns the fem class name if no custom library is set
@param string $name the name of the fem class, i.e. 'page'
@return string the (fully qualified) name of the class which should be used | [
"get",
"the",
"class",
"name",
"which",
"should",
"be",
"used",
"for",
"a",
"certain",
"fem",
"library",
"used",
"internally",
"to",
"determine",
"whether",
"a",
"custom",
"library",
"has",
"been",
"set",
"returns",
"the",
"fem",
"class",
"name",
"if",
"no",
"custom",
"library",
"is",
"set"
]
| c1c466c1a904d99452b341c5ae7cbc3e22b106e1 | https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/bootstrap.php#L51-L61 |
18,012 | lode/fem | src/bootstrap.php | bootstrap.environment | private static function environment() {
$environment = getenv('APP_ENV') ?: 'production';
define('alsvanzelf\fem\ENVIRONMENT', $environment);
define('alsvanzelf\fem\ROOT_DIR', realpath(__DIR__.'/../../../../').'/');
define('alsvanzelf\fem\ROOT_DIR_APP', \alsvanzelf\fem\ROOT_DIR.'application/');
define('alsvanzelf\fem\CLI', (strpos(php_sapi_name(), 'cli') !== false || defined('STDIN')));
if (constant('\alsvanzelf\fem\ENVIRONMENT') == false) {
echo 'no environment set';
exit;
}
} | php | private static function environment() {
$environment = getenv('APP_ENV') ?: 'production';
define('alsvanzelf\fem\ENVIRONMENT', $environment);
define('alsvanzelf\fem\ROOT_DIR', realpath(__DIR__.'/../../../../').'/');
define('alsvanzelf\fem\ROOT_DIR_APP', \alsvanzelf\fem\ROOT_DIR.'application/');
define('alsvanzelf\fem\CLI', (strpos(php_sapi_name(), 'cli') !== false || defined('STDIN')));
if (constant('\alsvanzelf\fem\ENVIRONMENT') == false) {
echo 'no environment set';
exit;
}
} | [
"private",
"static",
"function",
"environment",
"(",
")",
"{",
"$",
"environment",
"=",
"getenv",
"(",
"'APP_ENV'",
")",
"?",
":",
"'production'",
";",
"define",
"(",
"'alsvanzelf\\fem\\ENVIRONMENT'",
",",
"$",
"environment",
")",
";",
"define",
"(",
"'alsvanzelf\\fem\\ROOT_DIR'",
",",
"realpath",
"(",
"__DIR__",
".",
"'/../../../../'",
")",
".",
"'/'",
")",
";",
"define",
"(",
"'alsvanzelf\\fem\\ROOT_DIR_APP'",
",",
"\\",
"alsvanzelf",
"\\",
"fem",
"\\",
"ROOT_DIR",
".",
"'application/'",
")",
";",
"define",
"(",
"'alsvanzelf\\fem\\CLI'",
",",
"(",
"strpos",
"(",
"php_sapi_name",
"(",
")",
",",
"'cli'",
")",
"!==",
"false",
"||",
"defined",
"(",
"'STDIN'",
")",
")",
")",
";",
"if",
"(",
"constant",
"(",
"'\\alsvanzelf\\fem\\ENVIRONMENT'",
")",
"==",
"false",
")",
"{",
"echo",
"'no environment set'",
";",
"exit",
";",
"}",
"}"
]
| environmental check
defines environment and root dir | [
"environmental",
"check",
"defines",
"environment",
"and",
"root",
"dir"
]
| c1c466c1a904d99452b341c5ae7cbc3e22b106e1 | https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/bootstrap.php#L67-L79 |
18,013 | lode/fem | src/bootstrap.php | bootstrap.uncertain | private static function uncertain() {
ini_set('display_startup_errors', 0);
ini_set('display_errors', 0);
error_reporting(0);
if (\alsvanzelf\fem\ENVIRONMENT == 'development') {
ini_set('display_startup_errors', 1);
ini_set('display_errors', 1);
error_reporting(-1);
}
$error_handler = function($level, $message, $file, $line, $context) {
throw new \ErrorException($message, $code=0, $level, $file, $line);
};
set_error_handler($error_handler);
} | php | private static function uncertain() {
ini_set('display_startup_errors', 0);
ini_set('display_errors', 0);
error_reporting(0);
if (\alsvanzelf\fem\ENVIRONMENT == 'development') {
ini_set('display_startup_errors', 1);
ini_set('display_errors', 1);
error_reporting(-1);
}
$error_handler = function($level, $message, $file, $line, $context) {
throw new \ErrorException($message, $code=0, $level, $file, $line);
};
set_error_handler($error_handler);
} | [
"private",
"static",
"function",
"uncertain",
"(",
")",
"{",
"ini_set",
"(",
"'display_startup_errors'",
",",
"0",
")",
";",
"ini_set",
"(",
"'display_errors'",
",",
"0",
")",
";",
"error_reporting",
"(",
"0",
")",
";",
"if",
"(",
"\\",
"alsvanzelf",
"\\",
"fem",
"\\",
"ENVIRONMENT",
"==",
"'development'",
")",
"{",
"ini_set",
"(",
"'display_startup_errors'",
",",
"1",
")",
";",
"ini_set",
"(",
"'display_errors'",
",",
"1",
")",
";",
"error_reporting",
"(",
"-",
"1",
")",
";",
"}",
"$",
"error_handler",
"=",
"function",
"(",
"$",
"level",
",",
"$",
"message",
",",
"$",
"file",
",",
"$",
"line",
",",
"$",
"context",
")",
"{",
"throw",
"new",
"\\",
"ErrorException",
"(",
"$",
"message",
",",
"$",
"code",
"=",
"0",
",",
"$",
"level",
",",
"$",
"file",
",",
"$",
"line",
")",
";",
"}",
";",
"set_error_handler",
"(",
"$",
"error_handler",
")",
";",
"}"
]
| error handling
know when to say what depending on environment
and passes errors to exceptions | [
"error",
"handling",
"know",
"when",
"to",
"say",
"what",
"depending",
"on",
"environment",
"and",
"passes",
"errors",
"to",
"exceptions"
]
| c1c466c1a904d99452b341c5ae7cbc3e22b106e1 | https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/bootstrap.php#L96-L110 |
18,014 | lode/fem | src/bootstrap.php | bootstrap.secure | private static function secure() {
if (\alsvanzelf\fem\CLI) {
return;
}
header_remove('X-Powered-By');
ini_set('session.use_trans_sid', 0);
ini_set('session.use_only_cookies', 1);
ini_set('session.cookie_httponly', 1);
ini_set('session.use_strict_mode', 1); // @note this is only effective from 5.5.2
ini_set('session.entropy_file', '/dev/urandom');
} | php | private static function secure() {
if (\alsvanzelf\fem\CLI) {
return;
}
header_remove('X-Powered-By');
ini_set('session.use_trans_sid', 0);
ini_set('session.use_only_cookies', 1);
ini_set('session.cookie_httponly', 1);
ini_set('session.use_strict_mode', 1); // @note this is only effective from 5.5.2
ini_set('session.entropy_file', '/dev/urandom');
} | [
"private",
"static",
"function",
"secure",
"(",
")",
"{",
"if",
"(",
"\\",
"alsvanzelf",
"\\",
"fem",
"\\",
"CLI",
")",
"{",
"return",
";",
"}",
"header_remove",
"(",
"'X-Powered-By'",
")",
";",
"ini_set",
"(",
"'session.use_trans_sid'",
",",
"0",
")",
";",
"ini_set",
"(",
"'session.use_only_cookies'",
",",
"1",
")",
";",
"ini_set",
"(",
"'session.cookie_httponly'",
",",
"1",
")",
";",
"ini_set",
"(",
"'session.use_strict_mode'",
",",
"1",
")",
";",
"// @note this is only effective from 5.5.2",
"ini_set",
"(",
"'session.entropy_file'",
",",
"'/dev/urandom'",
")",
";",
"}"
]
| basic security
stops outputting of php header
and help against session fixation | [
"basic",
"security",
"stops",
"outputting",
"of",
"php",
"header",
"and",
"help",
"against",
"session",
"fixation"
]
| c1c466c1a904d99452b341c5ae7cbc3e22b106e1 | https://github.com/lode/fem/blob/c1c466c1a904d99452b341c5ae7cbc3e22b106e1/src/bootstrap.php#L117-L129 |
18,015 | phpsess/session-handler | src/SessionHandler.php | SessionHandler.warnInsecureSettings | private function warnInsecureSettings(): void
{
if (!self::$warnInsecureSettings) {
return;
}
if (!ini_get('session.use_cookies')) {
$errorMessage = 'The ini setting session.use_cookies should be set to true.';
throw new InsecureSettingsException($errorMessage);
}
if (!ini_get('session.use_only_cookies')) {
$errorMessage = 'The ini setting session.use_only_cookies should be set to true.';
throw new InsecureSettingsException($errorMessage);
}
if (ini_get('session.use_trans_sid')) {
$errorMessage = 'The ini setting session.use_trans_id should be set to false.';
throw new InsecureSettingsException($errorMessage);
}
if (!ini_get('session.use_strict_mode')) {
$errorMessage = 'The ini setting session.use_strict_mode should be set to true.';
throw new InsecureSettingsException($errorMessage);
}
} | php | private function warnInsecureSettings(): void
{
if (!self::$warnInsecureSettings) {
return;
}
if (!ini_get('session.use_cookies')) {
$errorMessage = 'The ini setting session.use_cookies should be set to true.';
throw new InsecureSettingsException($errorMessage);
}
if (!ini_get('session.use_only_cookies')) {
$errorMessage = 'The ini setting session.use_only_cookies should be set to true.';
throw new InsecureSettingsException($errorMessage);
}
if (ini_get('session.use_trans_sid')) {
$errorMessage = 'The ini setting session.use_trans_id should be set to false.';
throw new InsecureSettingsException($errorMessage);
}
if (!ini_get('session.use_strict_mode')) {
$errorMessage = 'The ini setting session.use_strict_mode should be set to true.';
throw new InsecureSettingsException($errorMessage);
}
} | [
"private",
"function",
"warnInsecureSettings",
"(",
")",
":",
"void",
"{",
"if",
"(",
"!",
"self",
"::",
"$",
"warnInsecureSettings",
")",
"{",
"return",
";",
"}",
"if",
"(",
"!",
"ini_get",
"(",
"'session.use_cookies'",
")",
")",
"{",
"$",
"errorMessage",
"=",
"'The ini setting session.use_cookies should be set to true.'",
";",
"throw",
"new",
"InsecureSettingsException",
"(",
"$",
"errorMessage",
")",
";",
"}",
"if",
"(",
"!",
"ini_get",
"(",
"'session.use_only_cookies'",
")",
")",
"{",
"$",
"errorMessage",
"=",
"'The ini setting session.use_only_cookies should be set to true.'",
";",
"throw",
"new",
"InsecureSettingsException",
"(",
"$",
"errorMessage",
")",
";",
"}",
"if",
"(",
"ini_get",
"(",
"'session.use_trans_sid'",
")",
")",
"{",
"$",
"errorMessage",
"=",
"'The ini setting session.use_trans_id should be set to false.'",
";",
"throw",
"new",
"InsecureSettingsException",
"(",
"$",
"errorMessage",
")",
";",
"}",
"if",
"(",
"!",
"ini_get",
"(",
"'session.use_strict_mode'",
")",
")",
"{",
"$",
"errorMessage",
"=",
"'The ini setting session.use_strict_mode should be set to true.'",
";",
"throw",
"new",
"InsecureSettingsException",
"(",
"$",
"errorMessage",
")",
";",
"}",
"}"
]
| Throws exceptions when insecure INI settings are detected.
@throws InsecureSettingsException
@return void | [
"Throws",
"exceptions",
"when",
"insecure",
"INI",
"settings",
"are",
"detected",
"."
]
| 8b4e60e6a8d2da1c7cba0760523592f8952ef2fa | https://github.com/phpsess/session-handler/blob/8b4e60e6a8d2da1c7cba0760523592f8952ef2fa/src/SessionHandler.php#L73-L98 |
18,016 | phpsess/session-handler | src/SessionHandler.php | SessionHandler.handleStrict | private function handleStrict(): void
{
if (!ini_get('session.use_strict_mode') || headers_sent()) {
return;
}
$cookieName = session_name();
if (empty($_COOKIE[$cookieName])) {
return;
}
$sessionId = $_COOKIE[$cookieName];
$identifier = $this->cryptProvider->makeSessionIdentifier($sessionId);
if ($this->storageDriver->sessionExists($identifier)) {
return;
}
$newSessionId = session_create_id();
session_id($newSessionId);
} | php | private function handleStrict(): void
{
if (!ini_get('session.use_strict_mode') || headers_sent()) {
return;
}
$cookieName = session_name();
if (empty($_COOKIE[$cookieName])) {
return;
}
$sessionId = $_COOKIE[$cookieName];
$identifier = $this->cryptProvider->makeSessionIdentifier($sessionId);
if ($this->storageDriver->sessionExists($identifier)) {
return;
}
$newSessionId = session_create_id();
session_id($newSessionId);
} | [
"private",
"function",
"handleStrict",
"(",
")",
":",
"void",
"{",
"if",
"(",
"!",
"ini_get",
"(",
"'session.use_strict_mode'",
")",
"||",
"headers_sent",
"(",
")",
")",
"{",
"return",
";",
"}",
"$",
"cookieName",
"=",
"session_name",
"(",
")",
";",
"if",
"(",
"empty",
"(",
"$",
"_COOKIE",
"[",
"$",
"cookieName",
"]",
")",
")",
"{",
"return",
";",
"}",
"$",
"sessionId",
"=",
"$",
"_COOKIE",
"[",
"$",
"cookieName",
"]",
";",
"$",
"identifier",
"=",
"$",
"this",
"->",
"cryptProvider",
"->",
"makeSessionIdentifier",
"(",
"$",
"sessionId",
")",
";",
"if",
"(",
"$",
"this",
"->",
"storageDriver",
"->",
"sessionExists",
"(",
"$",
"identifier",
")",
")",
"{",
"return",
";",
"}",
"$",
"newSessionId",
"=",
"session_create_id",
"(",
")",
";",
"session_id",
"(",
"$",
"newSessionId",
")",
";",
"}"
]
| Rejects arbitrary session ids.
@SuppressWarnings(PHPMD.Superglobals)
@see http://php.net/manual/en/features.session.security.management.php#features.session.security.management.non-adaptive-session Why this security measure is important.
@return void | [
"Rejects",
"arbitrary",
"session",
"ids",
"."
]
| 8b4e60e6a8d2da1c7cba0760523592f8952ef2fa | https://github.com/phpsess/session-handler/blob/8b4e60e6a8d2da1c7cba0760523592f8952ef2fa/src/SessionHandler.php#L108-L129 |
18,017 | phpsess/session-handler | src/SessionHandler.php | SessionHandler.open | public function open($savePath, $sessionName): bool
{
$sessionId = session_id();
$identifier = $this->cryptProvider->makeSessionIdentifier($sessionId);
while (!$this->storageDriver->lock($identifier)) {
usleep(1000);
}
return true;
} | php | public function open($savePath, $sessionName): bool
{
$sessionId = session_id();
$identifier = $this->cryptProvider->makeSessionIdentifier($sessionId);
while (!$this->storageDriver->lock($identifier)) {
usleep(1000);
}
return true;
} | [
"public",
"function",
"open",
"(",
"$",
"savePath",
",",
"$",
"sessionName",
")",
":",
"bool",
"{",
"$",
"sessionId",
"=",
"session_id",
"(",
")",
";",
"$",
"identifier",
"=",
"$",
"this",
"->",
"cryptProvider",
"->",
"makeSessionIdentifier",
"(",
"$",
"sessionId",
")",
";",
"while",
"(",
"!",
"$",
"this",
"->",
"storageDriver",
"->",
"lock",
"(",
"$",
"identifier",
")",
")",
"{",
"usleep",
"(",
"1000",
")",
";",
"}",
"return",
"true",
";",
"}"
]
| Opens the session.
@SuppressWarnings(PHPMD.UnusedFormalParameter)
@param string $savePath The path where the session files will be saved.
@param string $sessionName The name of the session
@return bool | [
"Opens",
"the",
"session",
"."
]
| 8b4e60e6a8d2da1c7cba0760523592f8952ef2fa | https://github.com/phpsess/session-handler/blob/8b4e60e6a8d2da1c7cba0760523592f8952ef2fa/src/SessionHandler.php#L140-L151 |
18,018 | phpsess/session-handler | src/SessionHandler.php | SessionHandler.close | public function close(): bool
{
$sessionId = session_id();
$identifier = $this->cryptProvider->makeSessionIdentifier($sessionId);
$this->storageDriver->unlock($identifier);
return true;
} | php | public function close(): bool
{
$sessionId = session_id();
$identifier = $this->cryptProvider->makeSessionIdentifier($sessionId);
$this->storageDriver->unlock($identifier);
return true;
} | [
"public",
"function",
"close",
"(",
")",
":",
"bool",
"{",
"$",
"sessionId",
"=",
"session_id",
"(",
")",
";",
"$",
"identifier",
"=",
"$",
"this",
"->",
"cryptProvider",
"->",
"makeSessionIdentifier",
"(",
"$",
"sessionId",
")",
";",
"$",
"this",
"->",
"storageDriver",
"->",
"unlock",
"(",
"$",
"identifier",
")",
";",
"return",
"true",
";",
"}"
]
| Closes the session
@return bool | [
"Closes",
"the",
"session"
]
| 8b4e60e6a8d2da1c7cba0760523592f8952ef2fa | https://github.com/phpsess/session-handler/blob/8b4e60e6a8d2da1c7cba0760523592f8952ef2fa/src/SessionHandler.php#L158-L167 |
18,019 | phpsess/session-handler | src/SessionHandler.php | SessionHandler.write | public function write($sessionId, $sessionData): bool
{
$identifier = $this->cryptProvider->makeSessionIdentifier($sessionId);
$content = $this->cryptProvider->encryptSessionData($sessionId, $sessionData);
try {
$this->storageDriver->save($identifier, $content);
return true;
} catch (Exception $e) {
return false;
}
} | php | public function write($sessionId, $sessionData): bool
{
$identifier = $this->cryptProvider->makeSessionIdentifier($sessionId);
$content = $this->cryptProvider->encryptSessionData($sessionId, $sessionData);
try {
$this->storageDriver->save($identifier, $content);
return true;
} catch (Exception $e) {
return false;
}
} | [
"public",
"function",
"write",
"(",
"$",
"sessionId",
",",
"$",
"sessionData",
")",
":",
"bool",
"{",
"$",
"identifier",
"=",
"$",
"this",
"->",
"cryptProvider",
"->",
"makeSessionIdentifier",
"(",
"$",
"sessionId",
")",
";",
"$",
"content",
"=",
"$",
"this",
"->",
"cryptProvider",
"->",
"encryptSessionData",
"(",
"$",
"sessionId",
",",
"$",
"sessionData",
")",
";",
"try",
"{",
"$",
"this",
"->",
"storageDriver",
"->",
"save",
"(",
"$",
"identifier",
",",
"$",
"content",
")",
";",
"return",
"true",
";",
"}",
"catch",
"(",
"Exception",
"$",
"e",
")",
"{",
"return",
"false",
";",
"}",
"}"
]
| Encrypts the session data and saves to the storage;
@param string $sessionId Id of the session
@param string $sessionData Unencrypted session data
@return boolean | [
"Encrypts",
"the",
"session",
"data",
"and",
"saves",
"to",
"the",
"storage",
";"
]
| 8b4e60e6a8d2da1c7cba0760523592f8952ef2fa | https://github.com/phpsess/session-handler/blob/8b4e60e6a8d2da1c7cba0760523592f8952ef2fa/src/SessionHandler.php#L198-L210 |
18,020 | phpsess/session-handler | src/SessionHandler.php | SessionHandler.gc | public function gc($maxLife): bool
{
try {
$this->storageDriver->clearOld($maxLife * 1000000);
return true;
} catch (Exception $e) {
return false;
}
} | php | public function gc($maxLife): bool
{
try {
$this->storageDriver->clearOld($maxLife * 1000000);
return true;
} catch (Exception $e) {
return false;
}
} | [
"public",
"function",
"gc",
"(",
"$",
"maxLife",
")",
":",
"bool",
"{",
"try",
"{",
"$",
"this",
"->",
"storageDriver",
"->",
"clearOld",
"(",
"$",
"maxLife",
"*",
"1000000",
")",
";",
"return",
"true",
";",
"}",
"catch",
"(",
"Exception",
"$",
"e",
")",
"{",
"return",
"false",
";",
"}",
"}"
]
| Removes the expired sessions from the storage.
(GC stands for Garbage Collector)
@SuppressWarnings(PHPMD.ShortMethodName)
@param int $maxLife The maximum time (in seconds) that a session must be kept.
@return bool | [
"Removes",
"the",
"expired",
"sessions",
"from",
"the",
"storage",
"."
]
| 8b4e60e6a8d2da1c7cba0760523592f8952ef2fa | https://github.com/phpsess/session-handler/blob/8b4e60e6a8d2da1c7cba0760523592f8952ef2fa/src/SessionHandler.php#L240-L248 |
18,021 | slashworks/control-bundle | src/Slashworks/AppBundle/Model/om/BaseUserCustomerRelation.php | BaseUserCustomerRelation.setCustomer | public function setCustomer(Customer $v = null)
{
if ($v === null) {
$this->setCustomerId(NULL);
} else {
$this->setCustomerId($v->getId());
}
$this->aCustomer = $v;
// Add binding for other direction of this n:n relationship.
// If this object has already been added to the Customer object, it will not be re-added.
if ($v !== null) {
$v->addUserCustomerRelation($this);
}
return $this;
} | php | public function setCustomer(Customer $v = null)
{
if ($v === null) {
$this->setCustomerId(NULL);
} else {
$this->setCustomerId($v->getId());
}
$this->aCustomer = $v;
// Add binding for other direction of this n:n relationship.
// If this object has already been added to the Customer object, it will not be re-added.
if ($v !== null) {
$v->addUserCustomerRelation($this);
}
return $this;
} | [
"public",
"function",
"setCustomer",
"(",
"Customer",
"$",
"v",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"v",
"===",
"null",
")",
"{",
"$",
"this",
"->",
"setCustomerId",
"(",
"NULL",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"setCustomerId",
"(",
"$",
"v",
"->",
"getId",
"(",
")",
")",
";",
"}",
"$",
"this",
"->",
"aCustomer",
"=",
"$",
"v",
";",
"// Add binding for other direction of this n:n relationship.",
"// If this object has already been added to the Customer object, it will not be re-added.",
"if",
"(",
"$",
"v",
"!==",
"null",
")",
"{",
"$",
"v",
"->",
"addUserCustomerRelation",
"(",
"$",
"this",
")",
";",
"}",
"return",
"$",
"this",
";",
"}"
]
| Declares an association between this object and a Customer object.
@param Customer $v
@return UserCustomerRelation The current object (for fluent API support)
@throws PropelException | [
"Declares",
"an",
"association",
"between",
"this",
"object",
"and",
"a",
"Customer",
"object",
"."
]
| 2ba86d96f1f41f9424e2229c4e2b13017e973f89 | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseUserCustomerRelation.php#L979-L997 |
18,022 | slashworks/control-bundle | src/Slashworks/AppBundle/Model/om/BaseUserCustomerRelation.php | BaseUserCustomerRelation.getCustomer | public function getCustomer(PropelPDO $con = null, $doQuery = true)
{
if ($this->aCustomer === null && ($this->customer_id !== null) && $doQuery) {
$this->aCustomer = CustomerQuery::create()->findPk($this->customer_id, $con);
/* The following can be used additionally to
guarantee the related object contains a reference
to this object. This level of coupling may, however, be
undesirable since it could result in an only partially populated collection
in the referenced object.
$this->aCustomer->addUserCustomerRelations($this);
*/
}
return $this->aCustomer;
} | php | public function getCustomer(PropelPDO $con = null, $doQuery = true)
{
if ($this->aCustomer === null && ($this->customer_id !== null) && $doQuery) {
$this->aCustomer = CustomerQuery::create()->findPk($this->customer_id, $con);
/* The following can be used additionally to
guarantee the related object contains a reference
to this object. This level of coupling may, however, be
undesirable since it could result in an only partially populated collection
in the referenced object.
$this->aCustomer->addUserCustomerRelations($this);
*/
}
return $this->aCustomer;
} | [
"public",
"function",
"getCustomer",
"(",
"PropelPDO",
"$",
"con",
"=",
"null",
",",
"$",
"doQuery",
"=",
"true",
")",
"{",
"if",
"(",
"$",
"this",
"->",
"aCustomer",
"===",
"null",
"&&",
"(",
"$",
"this",
"->",
"customer_id",
"!==",
"null",
")",
"&&",
"$",
"doQuery",
")",
"{",
"$",
"this",
"->",
"aCustomer",
"=",
"CustomerQuery",
"::",
"create",
"(",
")",
"->",
"findPk",
"(",
"$",
"this",
"->",
"customer_id",
",",
"$",
"con",
")",
";",
"/* The following can be used additionally to\n guarantee the related object contains a reference\n to this object. This level of coupling may, however, be\n undesirable since it could result in an only partially populated collection\n in the referenced object.\n $this->aCustomer->addUserCustomerRelations($this);\n */",
"}",
"return",
"$",
"this",
"->",
"aCustomer",
";",
"}"
]
| Get the associated Customer object
@param PropelPDO $con Optional Connection object.
@param $doQuery Executes a query to get the object if required
@return Customer The associated Customer object.
@throws PropelException | [
"Get",
"the",
"associated",
"Customer",
"object"
]
| 2ba86d96f1f41f9424e2229c4e2b13017e973f89 | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseUserCustomerRelation.php#L1008-L1022 |
18,023 | SAREhub/PHP_Commons | src/SAREhub/Commons/Process/PcntlSignals.php | PcntlSignals.create | public static function create($install = true)
{
$instance = new PcntlSignals();
if ($install) {
$instance->install(self::getDefaultInstalledSignals());
}
return $instance;
} | php | public static function create($install = true)
{
$instance = new PcntlSignals();
if ($install) {
$instance->install(self::getDefaultInstalledSignals());
}
return $instance;
} | [
"public",
"static",
"function",
"create",
"(",
"$",
"install",
"=",
"true",
")",
"{",
"$",
"instance",
"=",
"new",
"PcntlSignals",
"(",
")",
";",
"if",
"(",
"$",
"install",
")",
"{",
"$",
"instance",
"->",
"install",
"(",
"self",
"::",
"getDefaultInstalledSignals",
"(",
")",
")",
";",
"}",
"return",
"$",
"instance",
";",
"}"
]
| Factory method, can install default signals.
@param bool $install When true installs signals.
@return PcntlSignals | [
"Factory",
"method",
"can",
"install",
"default",
"signals",
"."
]
| 4e1769ab6411a584112df1151dcc90e6b82fe2bb | https://github.com/SAREhub/PHP_Commons/blob/4e1769ab6411a584112df1151dcc90e6b82fe2bb/src/SAREhub/Commons/Process/PcntlSignals.php#L32-L39 |
18,024 | SAREhub/PHP_Commons | src/SAREhub/Commons/Process/PcntlSignals.php | PcntlSignals.install | public function install(array $signals)
{
if (self::isSupported()) {
$callback = [$this, 'dispatchSignal'];
foreach ($signals as $signal) {
\pcntl_signal($signal, $callback);
}
};
} | php | public function install(array $signals)
{
if (self::isSupported()) {
$callback = [$this, 'dispatchSignal'];
foreach ($signals as $signal) {
\pcntl_signal($signal, $callback);
}
};
} | [
"public",
"function",
"install",
"(",
"array",
"$",
"signals",
")",
"{",
"if",
"(",
"self",
"::",
"isSupported",
"(",
")",
")",
"{",
"$",
"callback",
"=",
"[",
"$",
"this",
",",
"'dispatchSignal'",
"]",
";",
"foreach",
"(",
"$",
"signals",
"as",
"$",
"signal",
")",
"{",
"\\",
"pcntl_signal",
"(",
"$",
"signal",
",",
"$",
"callback",
")",
";",
"}",
"}",
";",
"}"
]
| Installs selected signal
@param array $signals | [
"Installs",
"selected",
"signal"
]
| 4e1769ab6411a584112df1151dcc90e6b82fe2bb | https://github.com/SAREhub/PHP_Commons/blob/4e1769ab6411a584112df1151dcc90e6b82fe2bb/src/SAREhub/Commons/Process/PcntlSignals.php#L50-L58 |
18,025 | SAREhub/PHP_Commons | src/SAREhub/Commons/Process/PcntlSignals.php | PcntlSignals.handle | public function handle($signal, $handler, $namespace = self::DEFAULT_NAMESPACE)
{
if (empty($this->handlers[$signal])) {
$this->handlers[$signal] = [];
}
if (empty($this->handlers[$signal][$namespace])) {
$this->handlers[$signal][$namespace] = [];
}
$this->handlers[$signal][$namespace][] = $handler;
return $this;
} | php | public function handle($signal, $handler, $namespace = self::DEFAULT_NAMESPACE)
{
if (empty($this->handlers[$signal])) {
$this->handlers[$signal] = [];
}
if (empty($this->handlers[$signal][$namespace])) {
$this->handlers[$signal][$namespace] = [];
}
$this->handlers[$signal][$namespace][] = $handler;
return $this;
} | [
"public",
"function",
"handle",
"(",
"$",
"signal",
",",
"$",
"handler",
",",
"$",
"namespace",
"=",
"self",
"::",
"DEFAULT_NAMESPACE",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"handlers",
"[",
"$",
"signal",
"]",
")",
")",
"{",
"$",
"this",
"->",
"handlers",
"[",
"$",
"signal",
"]",
"=",
"[",
"]",
";",
"}",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"handlers",
"[",
"$",
"signal",
"]",
"[",
"$",
"namespace",
"]",
")",
")",
"{",
"$",
"this",
"->",
"handlers",
"[",
"$",
"signal",
"]",
"[",
"$",
"namespace",
"]",
"=",
"[",
"]",
";",
"}",
"$",
"this",
"->",
"handlers",
"[",
"$",
"signal",
"]",
"[",
"$",
"namespace",
"]",
"[",
"]",
"=",
"$",
"handler",
";",
"return",
"$",
"this",
";",
"}"
]
| Registers handler for signal in selected namespace.
@param int $signal Signal id (\SIG* constants)
@param callable $handler Handler callback
@param string $namespace
@return $this | [
"Registers",
"handler",
"for",
"signal",
"in",
"selected",
"namespace",
"."
]
| 4e1769ab6411a584112df1151dcc90e6b82fe2bb | https://github.com/SAREhub/PHP_Commons/blob/4e1769ab6411a584112df1151dcc90e6b82fe2bb/src/SAREhub/Commons/Process/PcntlSignals.php#L67-L80 |
18,026 | SAREhub/PHP_Commons | src/SAREhub/Commons/Process/PcntlSignals.php | PcntlSignals.dispatchSignal | public function dispatchSignal($signal)
{
if (isset($this->handlers[$signal])) {
foreach ($this->handlers[$signal] as $namespaceHandlers) {
foreach ($namespaceHandlers as $handler) {
$handler();
}
}
}
return $this;
} | php | public function dispatchSignal($signal)
{
if (isset($this->handlers[$signal])) {
foreach ($this->handlers[$signal] as $namespaceHandlers) {
foreach ($namespaceHandlers as $handler) {
$handler();
}
}
}
return $this;
} | [
"public",
"function",
"dispatchSignal",
"(",
"$",
"signal",
")",
"{",
"if",
"(",
"isset",
"(",
"$",
"this",
"->",
"handlers",
"[",
"$",
"signal",
"]",
")",
")",
"{",
"foreach",
"(",
"$",
"this",
"->",
"handlers",
"[",
"$",
"signal",
"]",
"as",
"$",
"namespaceHandlers",
")",
"{",
"foreach",
"(",
"$",
"namespaceHandlers",
"as",
"$",
"handler",
")",
"{",
"$",
"handler",
"(",
")",
";",
"}",
"}",
"}",
"return",
"$",
"this",
";",
"}"
]
| Dispatch signal on registered handlers.
@param int $signal
@return $this | [
"Dispatch",
"signal",
"on",
"registered",
"handlers",
"."
]
| 4e1769ab6411a584112df1151dcc90e6b82fe2bb | https://github.com/SAREhub/PHP_Commons/blob/4e1769ab6411a584112df1151dcc90e6b82fe2bb/src/SAREhub/Commons/Process/PcntlSignals.php#L87-L98 |
18,027 | SachaMorard/phalcon-console-migration | Library/Phalcon/Migrations/MigrationScript.php | MigrationScript.batchInsert | public function batchInsert(\Phalcon\Db\Adapter $connection, $tableName, $fields)
{
$migrationData = $this->migrationsDir . '/' . $this->version . '/' . $tableName . '.dat';
if (file_exists($migrationData)) {
$connection->begin();
$batchHandler = fopen($migrationData, 'r');
while (($line = fgets($batchHandler)) !== false) {
$connection->insert($tableName, explode('|', rtrim($line)), $fields, false);
unset($line);
}
fclose($batchHandler);
$connection->commit();
}
} | php | public function batchInsert(\Phalcon\Db\Adapter $connection, $tableName, $fields)
{
$migrationData = $this->migrationsDir . '/' . $this->version . '/' . $tableName . '.dat';
if (file_exists($migrationData)) {
$connection->begin();
$batchHandler = fopen($migrationData, 'r');
while (($line = fgets($batchHandler)) !== false) {
$connection->insert($tableName, explode('|', rtrim($line)), $fields, false);
unset($line);
}
fclose($batchHandler);
$connection->commit();
}
} | [
"public",
"function",
"batchInsert",
"(",
"\\",
"Phalcon",
"\\",
"Db",
"\\",
"Adapter",
"$",
"connection",
",",
"$",
"tableName",
",",
"$",
"fields",
")",
"{",
"$",
"migrationData",
"=",
"$",
"this",
"->",
"migrationsDir",
".",
"'/'",
".",
"$",
"this",
"->",
"version",
".",
"'/'",
".",
"$",
"tableName",
".",
"'.dat'",
";",
"if",
"(",
"file_exists",
"(",
"$",
"migrationData",
")",
")",
"{",
"$",
"connection",
"->",
"begin",
"(",
")",
";",
"$",
"batchHandler",
"=",
"fopen",
"(",
"$",
"migrationData",
",",
"'r'",
")",
";",
"while",
"(",
"(",
"$",
"line",
"=",
"fgets",
"(",
"$",
"batchHandler",
")",
")",
"!==",
"false",
")",
"{",
"$",
"connection",
"->",
"insert",
"(",
"$",
"tableName",
",",
"explode",
"(",
"'|'",
",",
"rtrim",
"(",
"$",
"line",
")",
")",
",",
"$",
"fields",
",",
"false",
")",
";",
"unset",
"(",
"$",
"line",
")",
";",
"}",
"fclose",
"(",
"$",
"batchHandler",
")",
";",
"$",
"connection",
"->",
"commit",
"(",
")",
";",
"}",
"}"
]
| Inserts data from a data migration file in a table
@param string $tableName
@param string $fields | [
"Inserts",
"data",
"from",
"a",
"data",
"migration",
"file",
"in",
"a",
"table"
]
| 6b79ecb04f3790844eae04d33e3489a98f4f1214 | https://github.com/SachaMorard/phalcon-console-migration/blob/6b79ecb04f3790844eae04d33e3489a98f4f1214/Library/Phalcon/Migrations/MigrationScript.php#L103-L116 |
18,028 | shiftio/safestream-php-sdk | src/Watermark/WatermarkClient.php | WatermarkClient.create | public function create($videoKey, $watermarkConfiguration, $timeout = 90000) {
$this->validateVideoKey($videoKey);
$this->validateWatermarkConfiguration($watermarkConfiguration);
$this->validateTimeout($timeout);
$config = is_array($watermarkConfiguration) ? $watermarkConfiguration : array($watermarkConfiguration);
$payload = array("key" => $videoKey, "settings" => $config);
return $this->createAPI($payload, $timeout);
} | php | public function create($videoKey, $watermarkConfiguration, $timeout = 90000) {
$this->validateVideoKey($videoKey);
$this->validateWatermarkConfiguration($watermarkConfiguration);
$this->validateTimeout($timeout);
$config = is_array($watermarkConfiguration) ? $watermarkConfiguration : array($watermarkConfiguration);
$payload = array("key" => $videoKey, "settings" => $config);
return $this->createAPI($payload, $timeout);
} | [
"public",
"function",
"create",
"(",
"$",
"videoKey",
",",
"$",
"watermarkConfiguration",
",",
"$",
"timeout",
"=",
"90000",
")",
"{",
"$",
"this",
"->",
"validateVideoKey",
"(",
"$",
"videoKey",
")",
";",
"$",
"this",
"->",
"validateWatermarkConfiguration",
"(",
"$",
"watermarkConfiguration",
")",
";",
"$",
"this",
"->",
"validateTimeout",
"(",
"$",
"timeout",
")",
";",
"$",
"config",
"=",
"is_array",
"(",
"$",
"watermarkConfiguration",
")",
"?",
"$",
"watermarkConfiguration",
":",
"array",
"(",
"$",
"watermarkConfiguration",
")",
";",
"$",
"payload",
"=",
"array",
"(",
"\"key\"",
"=>",
"$",
"videoKey",
",",
"\"settings\"",
"=>",
"$",
"config",
")",
";",
"return",
"$",
"this",
"->",
"createAPI",
"(",
"$",
"payload",
",",
"$",
"timeout",
")",
";",
"}"
]
| Watermarks a video
@param $videoKey
The unique key for the video to watermark. The key is a property on the video
defined at ingest time. @see http://docs.safestream.com/docs/video
@param $watermarkConfiguration
A single configuration object OR an array of configuration object
@see WatermarkConfiguration
@param int $timeout The length of time to wait for the watermarking to complete. Most
videos will complete in less than 60 seconds.
A value greater than 0 will cause the function to wait for the watermarking to
complete until the timeout is reached. Otherwise the function will return
immediately
@return mixed
@throws WatermarkClientException
@throws WatermarkConfigurationException
@throws WatermarkingException | [
"Watermarks",
"a",
"video"
]
| 1957cd5574725b24da1bbff9059aa30a9ca123c2 | https://github.com/shiftio/safestream-php-sdk/blob/1957cd5574725b24da1bbff9059aa30a9ca123c2/src/Watermark/WatermarkClient.php#L88-L97 |
18,029 | webforge-labs/psc-cms | lib/Psc/PHPExcel/Exporter.php | Exporter.createSheet | protected function createSheet($name) {
$name = \Psc\PHPExcel\Helper::sanitizeSheetTitle($name);
$this->excel->addSheet(new PHPExcel_Worksheet($this->excel, $name));
$this->excel->setActiveSheetIndexByName($name);
$this->sheet = $this->excel->getActiveSheet();
$this->setRow(1);
} | php | protected function createSheet($name) {
$name = \Psc\PHPExcel\Helper::sanitizeSheetTitle($name);
$this->excel->addSheet(new PHPExcel_Worksheet($this->excel, $name));
$this->excel->setActiveSheetIndexByName($name);
$this->sheet = $this->excel->getActiveSheet();
$this->setRow(1);
} | [
"protected",
"function",
"createSheet",
"(",
"$",
"name",
")",
"{",
"$",
"name",
"=",
"\\",
"Psc",
"\\",
"PHPExcel",
"\\",
"Helper",
"::",
"sanitizeSheetTitle",
"(",
"$",
"name",
")",
";",
"$",
"this",
"->",
"excel",
"->",
"addSheet",
"(",
"new",
"PHPExcel_Worksheet",
"(",
"$",
"this",
"->",
"excel",
",",
"$",
"name",
")",
")",
";",
"$",
"this",
"->",
"excel",
"->",
"setActiveSheetIndexByName",
"(",
"$",
"name",
")",
";",
"$",
"this",
"->",
"sheet",
"=",
"$",
"this",
"->",
"excel",
"->",
"getActiveSheet",
"(",
")",
";",
"$",
"this",
"->",
"setRow",
"(",
"1",
")",
";",
"}"
]
| Setzt this->sheet auf das gerade erstellte Sheet
und die Row auf Zeile 1 | [
"Setzt",
"this",
"-",
">",
"sheet",
"auf",
"das",
"gerade",
"erstellte",
"Sheet",
"und",
"die",
"Row",
"auf",
"Zeile",
"1"
]
| 467bfa2547e6b4fa487d2d7f35fa6cc618dbc763 | https://github.com/webforge-labs/psc-cms/blob/467bfa2547e6b4fa487d2d7f35fa6cc618dbc763/lib/Psc/PHPExcel/Exporter.php#L79-L86 |
18,030 | iamapen/dbunit-ExcelFriendlyDataSet | src/lib/Iamapen/ExcelFriendlyDataSet/Database/DataSet/ExcelCsvDataSet.php | ExcelCsvDataSet.addTable | public function addTable($tableName, $csvFile)
{
if (!is_file($csvFile)) {
throw new \InvalidArgumentException("Could not find csv file: {$csvFile}");
}
if (!is_readable($csvFile)) {
throw new \InvalidArgumentException("Could not read csv file: {$csvFile}");
}
$fh = fopen($csvFile, 'rb');
fseek($fh, 2); // after BOM
// TODO chunk
$tmpFp = fopen('php://temp', 'w+b');
fwrite($tmpFp, mb_convert_encoding(stream_get_contents($fh), 'UTF-8', 'UTF-16LE'));
rewind($tmpFp);
$columns = $this->getCsvRow($tmpFp);
if ($columns === FALSE)
{
throw new \InvalidArgumentException("Could not determine the headers from the given file {$csvFile}");
}
$metaData = new \PHPUnit_Extensions_Database_DataSet_DefaultTableMetaData($tableName, $columns);
$table = new \PHPUnit_Extensions_Database_DataSet_DefaultTable($metaData);
while (($row = $this->getCsvRow($tmpFp)) !== FALSE)
{
$table->addRow(array_combine($columns, $row));
}
$this->tables[$tableName] = $table;
} | php | public function addTable($tableName, $csvFile)
{
if (!is_file($csvFile)) {
throw new \InvalidArgumentException("Could not find csv file: {$csvFile}");
}
if (!is_readable($csvFile)) {
throw new \InvalidArgumentException("Could not read csv file: {$csvFile}");
}
$fh = fopen($csvFile, 'rb');
fseek($fh, 2); // after BOM
// TODO chunk
$tmpFp = fopen('php://temp', 'w+b');
fwrite($tmpFp, mb_convert_encoding(stream_get_contents($fh), 'UTF-8', 'UTF-16LE'));
rewind($tmpFp);
$columns = $this->getCsvRow($tmpFp);
if ($columns === FALSE)
{
throw new \InvalidArgumentException("Could not determine the headers from the given file {$csvFile}");
}
$metaData = new \PHPUnit_Extensions_Database_DataSet_DefaultTableMetaData($tableName, $columns);
$table = new \PHPUnit_Extensions_Database_DataSet_DefaultTable($metaData);
while (($row = $this->getCsvRow($tmpFp)) !== FALSE)
{
$table->addRow(array_combine($columns, $row));
}
$this->tables[$tableName] = $table;
} | [
"public",
"function",
"addTable",
"(",
"$",
"tableName",
",",
"$",
"csvFile",
")",
"{",
"if",
"(",
"!",
"is_file",
"(",
"$",
"csvFile",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"\"Could not find csv file: {$csvFile}\"",
")",
";",
"}",
"if",
"(",
"!",
"is_readable",
"(",
"$",
"csvFile",
")",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"\"Could not read csv file: {$csvFile}\"",
")",
";",
"}",
"$",
"fh",
"=",
"fopen",
"(",
"$",
"csvFile",
",",
"'rb'",
")",
";",
"fseek",
"(",
"$",
"fh",
",",
"2",
")",
";",
"// after BOM",
"// TODO chunk",
"$",
"tmpFp",
"=",
"fopen",
"(",
"'php://temp'",
",",
"'w+b'",
")",
";",
"fwrite",
"(",
"$",
"tmpFp",
",",
"mb_convert_encoding",
"(",
"stream_get_contents",
"(",
"$",
"fh",
")",
",",
"'UTF-8'",
",",
"'UTF-16LE'",
")",
")",
";",
"rewind",
"(",
"$",
"tmpFp",
")",
";",
"$",
"columns",
"=",
"$",
"this",
"->",
"getCsvRow",
"(",
"$",
"tmpFp",
")",
";",
"if",
"(",
"$",
"columns",
"===",
"FALSE",
")",
"{",
"throw",
"new",
"\\",
"InvalidArgumentException",
"(",
"\"Could not determine the headers from the given file {$csvFile}\"",
")",
";",
"}",
"$",
"metaData",
"=",
"new",
"\\",
"PHPUnit_Extensions_Database_DataSet_DefaultTableMetaData",
"(",
"$",
"tableName",
",",
"$",
"columns",
")",
";",
"$",
"table",
"=",
"new",
"\\",
"PHPUnit_Extensions_Database_DataSet_DefaultTable",
"(",
"$",
"metaData",
")",
";",
"while",
"(",
"(",
"$",
"row",
"=",
"$",
"this",
"->",
"getCsvRow",
"(",
"$",
"tmpFp",
")",
")",
"!==",
"FALSE",
")",
"{",
"$",
"table",
"->",
"addRow",
"(",
"array_combine",
"(",
"$",
"columns",
",",
"$",
"row",
")",
")",
";",
"}",
"$",
"this",
"->",
"tables",
"[",
"$",
"tableName",
"]",
"=",
"$",
"table",
";",
"}"
]
| Adds a table to the dataset
The table will be given the passed name. $csvFile should be a path to
a valid csv file (based on the arguments passed to the constructor.)
@param string $tableName
@param string $csvFile | [
"Adds",
"a",
"table",
"to",
"the",
"dataset"
]
| 036103cb2a2a75608f0a00448301cd3f4a5c4e19 | https://github.com/iamapen/dbunit-ExcelFriendlyDataSet/blob/036103cb2a2a75608f0a00448301cd3f4a5c4e19/src/lib/Iamapen/ExcelFriendlyDataSet/Database/DataSet/ExcelCsvDataSet.php#L44-L78 |
18,031 | 2amigos/yiifoundation | widgets/Clearing.php | Clearing.renderClearing | public function renderClearing()
{
if (empty($this->items)) {
return true;
}
$list = array();
foreach ($this->items as $item) {
$list[] = $this->renderItem($item);
}
return \CHtml::tag('ul', $this->htmlOptions, implode("\n", $list));
} | php | public function renderClearing()
{
if (empty($this->items)) {
return true;
}
$list = array();
foreach ($this->items as $item) {
$list[] = $this->renderItem($item);
}
return \CHtml::tag('ul', $this->htmlOptions, implode("\n", $list));
} | [
"public",
"function",
"renderClearing",
"(",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"this",
"->",
"items",
")",
")",
"{",
"return",
"true",
";",
"}",
"$",
"list",
"=",
"array",
"(",
")",
";",
"foreach",
"(",
"$",
"this",
"->",
"items",
"as",
"$",
"item",
")",
"{",
"$",
"list",
"[",
"]",
"=",
"$",
"this",
"->",
"renderItem",
"(",
"$",
"item",
")",
";",
"}",
"return",
"\\",
"CHtml",
"::",
"tag",
"(",
"'ul'",
",",
"$",
"this",
"->",
"htmlOptions",
",",
"implode",
"(",
"\"\\n\"",
",",
"$",
"list",
")",
")",
";",
"}"
]
| Renders the clearing widget
@return bool|string the resulting element | [
"Renders",
"the",
"clearing",
"widget"
]
| 49bed0d3ca1a9bac9299000e48a2661bdc8f9a29 | https://github.com/2amigos/yiifoundation/blob/49bed0d3ca1a9bac9299000e48a2661bdc8f9a29/widgets/Clearing.php#L67-L77 |
18,032 | kevintweber/phpunit-markup-validators | src/Kevintweber/PhpunitMarkupValidators/Assert/AssertHTML5.php | AssertHTML5.isValidMarkup | public static function isValidMarkup($html,
$message = '',
ConnectorInterface $connector = null)
{
// Check that $html is a string.
if (empty($html) || !is_string($html)) {
throw \PHPUnit_Util_InvalidArgumentHelper::factory(1, 'string');
}
// Assign connector if there isn't one already.
if ($connector === null) {
$connector = new HTML5ValidatorNuConnector();
}
// Validate the html.
$connector->setInput($html);
$response = $connector->execute('markup');
// Tell PHPUnit of the results.
$constraint = new GenericConstraint($connector);
self::assertThat($response, $constraint, $message);
} | php | public static function isValidMarkup($html,
$message = '',
ConnectorInterface $connector = null)
{
// Check that $html is a string.
if (empty($html) || !is_string($html)) {
throw \PHPUnit_Util_InvalidArgumentHelper::factory(1, 'string');
}
// Assign connector if there isn't one already.
if ($connector === null) {
$connector = new HTML5ValidatorNuConnector();
}
// Validate the html.
$connector->setInput($html);
$response = $connector->execute('markup');
// Tell PHPUnit of the results.
$constraint = new GenericConstraint($connector);
self::assertThat($response, $constraint, $message);
} | [
"public",
"static",
"function",
"isValidMarkup",
"(",
"$",
"html",
",",
"$",
"message",
"=",
"''",
",",
"ConnectorInterface",
"$",
"connector",
"=",
"null",
")",
"{",
"// Check that $html is a string.",
"if",
"(",
"empty",
"(",
"$",
"html",
")",
"||",
"!",
"is_string",
"(",
"$",
"html",
")",
")",
"{",
"throw",
"\\",
"PHPUnit_Util_InvalidArgumentHelper",
"::",
"factory",
"(",
"1",
",",
"'string'",
")",
";",
"}",
"// Assign connector if there isn't one already.",
"if",
"(",
"$",
"connector",
"===",
"null",
")",
"{",
"$",
"connector",
"=",
"new",
"HTML5ValidatorNuConnector",
"(",
")",
";",
"}",
"// Validate the html.",
"$",
"connector",
"->",
"setInput",
"(",
"$",
"html",
")",
";",
"$",
"response",
"=",
"$",
"connector",
"->",
"execute",
"(",
"'markup'",
")",
";",
"// Tell PHPUnit of the results.",
"$",
"constraint",
"=",
"new",
"GenericConstraint",
"(",
"$",
"connector",
")",
";",
"self",
"::",
"assertThat",
"(",
"$",
"response",
",",
"$",
"constraint",
",",
"$",
"message",
")",
";",
"}"
]
| Asserts that the HTML5 string is valid.
@param string $html The markup to be validated.
@param string $message Test message.
@param ConnectorInterface $connector Connector to HTML5 validation service. | [
"Asserts",
"that",
"the",
"HTML5",
"string",
"is",
"valid",
"."
]
| bee48f48c7c1c9e811d1a4bedeca8f413d049cb3 | https://github.com/kevintweber/phpunit-markup-validators/blob/bee48f48c7c1c9e811d1a4bedeca8f413d049cb3/src/Kevintweber/PhpunitMarkupValidators/Assert/AssertHTML5.php#L27-L48 |
18,033 | kevintweber/phpunit-markup-validators | src/Kevintweber/PhpunitMarkupValidators/Assert/AssertHTML5.php | AssertHTML5.isValidFile | public static function isValidFile($path,
$message = '',
ConnectorInterface $connector = null)
{
// Check that $path is exists.
if (!file_exists($path)) {
throw new \PHPUnit_Framework_Exception(
sprintf('File "%s" does not exist.'."\n", $path)
);
}
// Get file contents.
$html = file_get_contents($path);
if ($html === false) {
throw new \PHPUnit_Framework_Exception(
sprintf('Cannot read file "%s".'."\n", $path)
);
}
// Assign connector if there isn't one already.
if ($connector === null) {
$connector = new HTML5ValidatorNuConnector();
}
// Parse the html.
$connector->setInput($html);
$response = $connector->execute('file');
// Tell PHPUnit of the results.
$constraint = new GenericConstraint($connector);
self::assertThat($response, $constraint, $message);
} | php | public static function isValidFile($path,
$message = '',
ConnectorInterface $connector = null)
{
// Check that $path is exists.
if (!file_exists($path)) {
throw new \PHPUnit_Framework_Exception(
sprintf('File "%s" does not exist.'."\n", $path)
);
}
// Get file contents.
$html = file_get_contents($path);
if ($html === false) {
throw new \PHPUnit_Framework_Exception(
sprintf('Cannot read file "%s".'."\n", $path)
);
}
// Assign connector if there isn't one already.
if ($connector === null) {
$connector = new HTML5ValidatorNuConnector();
}
// Parse the html.
$connector->setInput($html);
$response = $connector->execute('file');
// Tell PHPUnit of the results.
$constraint = new GenericConstraint($connector);
self::assertThat($response, $constraint, $message);
} | [
"public",
"static",
"function",
"isValidFile",
"(",
"$",
"path",
",",
"$",
"message",
"=",
"''",
",",
"ConnectorInterface",
"$",
"connector",
"=",
"null",
")",
"{",
"// Check that $path is exists.",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"path",
")",
")",
"{",
"throw",
"new",
"\\",
"PHPUnit_Framework_Exception",
"(",
"sprintf",
"(",
"'File \"%s\" does not exist.'",
".",
"\"\\n\"",
",",
"$",
"path",
")",
")",
";",
"}",
"// Get file contents.",
"$",
"html",
"=",
"file_get_contents",
"(",
"$",
"path",
")",
";",
"if",
"(",
"$",
"html",
"===",
"false",
")",
"{",
"throw",
"new",
"\\",
"PHPUnit_Framework_Exception",
"(",
"sprintf",
"(",
"'Cannot read file \"%s\".'",
".",
"\"\\n\"",
",",
"$",
"path",
")",
")",
";",
"}",
"// Assign connector if there isn't one already.",
"if",
"(",
"$",
"connector",
"===",
"null",
")",
"{",
"$",
"connector",
"=",
"new",
"HTML5ValidatorNuConnector",
"(",
")",
";",
"}",
"// Parse the html.",
"$",
"connector",
"->",
"setInput",
"(",
"$",
"html",
")",
";",
"$",
"response",
"=",
"$",
"connector",
"->",
"execute",
"(",
"'file'",
")",
";",
"// Tell PHPUnit of the results.",
"$",
"constraint",
"=",
"new",
"GenericConstraint",
"(",
"$",
"connector",
")",
";",
"self",
"::",
"assertThat",
"(",
"$",
"response",
",",
"$",
"constraint",
",",
"$",
"message",
")",
";",
"}"
]
| Asserts that the HTML5 file is valid.
@param string $path The file path to be validated.
@param string $message Test message.
@param ConnectorInterface $connector Connector to HTML5 validation service. | [
"Asserts",
"that",
"the",
"HTML5",
"file",
"is",
"valid",
"."
]
| bee48f48c7c1c9e811d1a4bedeca8f413d049cb3 | https://github.com/kevintweber/phpunit-markup-validators/blob/bee48f48c7c1c9e811d1a4bedeca8f413d049cb3/src/Kevintweber/PhpunitMarkupValidators/Assert/AssertHTML5.php#L57-L88 |
18,034 | kevintweber/phpunit-markup-validators | src/Kevintweber/PhpunitMarkupValidators/Assert/AssertHTML5.php | AssertHTML5.isValidURL | public static function isValidURL($url,
$message = '',
ConnectorInterface $connector = null)
{
// Check that $url is a string.
if (empty($url) || !is_string($url)) {
throw \PHPUnit_Util_InvalidArgumentHelper::factory(1, 'string');
}
// Check that $url is a valid url.
if (filter_var($url, FILTER_VALIDATE_URL) === false) {
throw new \PHPUnit_Framework_Exception("Url is not valid.\n");
}
// Assign connector if there isn't one already.
if ($connector === null) {
$connector = new HTML5ValidatorNuConnector();
}
// Parse the html.
$connector->setInput($url);
$response = $connector->execute('url');
// Tell PHPUnit of the results.
$constraint = new GenericConstraint($connector);
self::assertThat($response, $constraint, $message);
} | php | public static function isValidURL($url,
$message = '',
ConnectorInterface $connector = null)
{
// Check that $url is a string.
if (empty($url) || !is_string($url)) {
throw \PHPUnit_Util_InvalidArgumentHelper::factory(1, 'string');
}
// Check that $url is a valid url.
if (filter_var($url, FILTER_VALIDATE_URL) === false) {
throw new \PHPUnit_Framework_Exception("Url is not valid.\n");
}
// Assign connector if there isn't one already.
if ($connector === null) {
$connector = new HTML5ValidatorNuConnector();
}
// Parse the html.
$connector->setInput($url);
$response = $connector->execute('url');
// Tell PHPUnit of the results.
$constraint = new GenericConstraint($connector);
self::assertThat($response, $constraint, $message);
} | [
"public",
"static",
"function",
"isValidURL",
"(",
"$",
"url",
",",
"$",
"message",
"=",
"''",
",",
"ConnectorInterface",
"$",
"connector",
"=",
"null",
")",
"{",
"// Check that $url is a string.",
"if",
"(",
"empty",
"(",
"$",
"url",
")",
"||",
"!",
"is_string",
"(",
"$",
"url",
")",
")",
"{",
"throw",
"\\",
"PHPUnit_Util_InvalidArgumentHelper",
"::",
"factory",
"(",
"1",
",",
"'string'",
")",
";",
"}",
"// Check that $url is a valid url.",
"if",
"(",
"filter_var",
"(",
"$",
"url",
",",
"FILTER_VALIDATE_URL",
")",
"===",
"false",
")",
"{",
"throw",
"new",
"\\",
"PHPUnit_Framework_Exception",
"(",
"\"Url is not valid.\\n\"",
")",
";",
"}",
"// Assign connector if there isn't one already.",
"if",
"(",
"$",
"connector",
"===",
"null",
")",
"{",
"$",
"connector",
"=",
"new",
"HTML5ValidatorNuConnector",
"(",
")",
";",
"}",
"// Parse the html.",
"$",
"connector",
"->",
"setInput",
"(",
"$",
"url",
")",
";",
"$",
"response",
"=",
"$",
"connector",
"->",
"execute",
"(",
"'url'",
")",
";",
"// Tell PHPUnit of the results.",
"$",
"constraint",
"=",
"new",
"GenericConstraint",
"(",
"$",
"connector",
")",
";",
"self",
"::",
"assertThat",
"(",
"$",
"response",
",",
"$",
"constraint",
",",
"$",
"message",
")",
";",
"}"
]
| Asserts that the HTML5 url is valid.
@param string $url The external url to be validated.
@param string $message Test message.
@param ConnectorInterface $connector Connector to HTML5 validation service. | [
"Asserts",
"that",
"the",
"HTML5",
"url",
"is",
"valid",
"."
]
| bee48f48c7c1c9e811d1a4bedeca8f413d049cb3 | https://github.com/kevintweber/phpunit-markup-validators/blob/bee48f48c7c1c9e811d1a4bedeca8f413d049cb3/src/Kevintweber/PhpunitMarkupValidators/Assert/AssertHTML5.php#L97-L123 |
18,035 | slashworks/control-bundle | src/Slashworks/AppBundle/Model/om/BaseRemoteAppQuery.php | BaseRemoteAppQuery.create | public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof RemoteAppQuery) {
return $criteria;
}
$query = new RemoteAppQuery(null, null, $modelAlias);
if ($criteria instanceof Criteria) {
$query->mergeWith($criteria);
}
return $query;
} | php | public static function create($modelAlias = null, $criteria = null)
{
if ($criteria instanceof RemoteAppQuery) {
return $criteria;
}
$query = new RemoteAppQuery(null, null, $modelAlias);
if ($criteria instanceof Criteria) {
$query->mergeWith($criteria);
}
return $query;
} | [
"public",
"static",
"function",
"create",
"(",
"$",
"modelAlias",
"=",
"null",
",",
"$",
"criteria",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"criteria",
"instanceof",
"RemoteAppQuery",
")",
"{",
"return",
"$",
"criteria",
";",
"}",
"$",
"query",
"=",
"new",
"RemoteAppQuery",
"(",
"null",
",",
"null",
",",
"$",
"modelAlias",
")",
";",
"if",
"(",
"$",
"criteria",
"instanceof",
"Criteria",
")",
"{",
"$",
"query",
"->",
"mergeWith",
"(",
"$",
"criteria",
")",
";",
"}",
"return",
"$",
"query",
";",
"}"
]
| Returns a new RemoteAppQuery object.
@param string $modelAlias The alias of a model in the query
@param RemoteAppQuery|Criteria $criteria Optional Criteria to build the query from
@return RemoteAppQuery | [
"Returns",
"a",
"new",
"RemoteAppQuery",
"object",
"."
]
| 2ba86d96f1f41f9424e2229c4e2b13017e973f89 | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteAppQuery.php#L173-L185 |
18,036 | slashworks/control-bundle | src/Slashworks/AppBundle/Model/om/BaseRemoteAppQuery.php | BaseRemoteAppQuery.findPkComplex | protected function findPkComplex($key, $con)
{
// As the query uses a PK condition, no limit(1) is necessary.
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKey($key)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
} | php | protected function findPkComplex($key, $con)
{
// As the query uses a PK condition, no limit(1) is necessary.
$criteria = $this->isKeepQuery() ? clone $this : $this;
$stmt = $criteria
->filterByPrimaryKey($key)
->doSelect($con);
return $criteria->getFormatter()->init($criteria)->formatOne($stmt);
} | [
"protected",
"function",
"findPkComplex",
"(",
"$",
"key",
",",
"$",
"con",
")",
"{",
"// As the query uses a PK condition, no limit(1) is necessary.",
"$",
"criteria",
"=",
"$",
"this",
"->",
"isKeepQuery",
"(",
")",
"?",
"clone",
"$",
"this",
":",
"$",
"this",
";",
"$",
"stmt",
"=",
"$",
"criteria",
"->",
"filterByPrimaryKey",
"(",
"$",
"key",
")",
"->",
"doSelect",
"(",
"$",
"con",
")",
";",
"return",
"$",
"criteria",
"->",
"getFormatter",
"(",
")",
"->",
"init",
"(",
"$",
"criteria",
")",
"->",
"formatOne",
"(",
"$",
"stmt",
")",
";",
"}"
]
| Find object by primary key.
@param mixed $key Primary key to use for the query
@param PropelPDO $con A connection object
@return RemoteApp|RemoteApp[]|mixed the result, formatted by the current formatter | [
"Find",
"object",
"by",
"primary",
"key",
"."
]
| 2ba86d96f1f41f9424e2229c4e2b13017e973f89 | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteAppQuery.php#L277-L286 |
18,037 | slashworks/control-bundle | src/Slashworks/AppBundle/Model/om/BaseRemoteAppQuery.php | BaseRemoteAppQuery.filterByApiUrl | public function filterByApiUrl($apiUrl = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($apiUrl)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $apiUrl)) {
$apiUrl = str_replace('*', '%', $apiUrl);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(RemoteAppPeer::API_URL, $apiUrl, $comparison);
} | php | public function filterByApiUrl($apiUrl = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($apiUrl)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $apiUrl)) {
$apiUrl = str_replace('*', '%', $apiUrl);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(RemoteAppPeer::API_URL, $apiUrl, $comparison);
} | [
"public",
"function",
"filterByApiUrl",
"(",
"$",
"apiUrl",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"apiUrl",
")",
")",
"{",
"$",
"comparison",
"=",
"Criteria",
"::",
"IN",
";",
"}",
"elseif",
"(",
"preg_match",
"(",
"'/[\\%\\*]/'",
",",
"$",
"apiUrl",
")",
")",
"{",
"$",
"apiUrl",
"=",
"str_replace",
"(",
"'*'",
",",
"'%'",
",",
"$",
"apiUrl",
")",
";",
"$",
"comparison",
"=",
"Criteria",
"::",
"LIKE",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"RemoteAppPeer",
"::",
"API_URL",
",",
"$",
"apiUrl",
",",
"$",
"comparison",
")",
";",
"}"
]
| Filter the query on the api_url column
Example usage:
<code>
$query->filterByApiUrl('fooValue'); // WHERE api_url = 'fooValue'
$query->filterByApiUrl('%fooValue%'); // WHERE api_url LIKE '%fooValue%'
</code>
@param string $apiUrl The value to use as filter.
Accepts wildcards (* and % trigger a LIKE)
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return RemoteAppQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"api_url",
"column"
]
| 2ba86d96f1f41f9424e2229c4e2b13017e973f89 | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteAppQuery.php#L482-L494 |
18,038 | slashworks/control-bundle | src/Slashworks/AppBundle/Model/om/BaseRemoteAppQuery.php | BaseRemoteAppQuery.filterByApiAuthHttpUser | public function filterByApiAuthHttpUser($apiAuthHttpUser = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($apiAuthHttpUser)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $apiAuthHttpUser)) {
$apiAuthHttpUser = str_replace('*', '%', $apiAuthHttpUser);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(RemoteAppPeer::API_AUTH_HTTP_USER, $apiAuthHttpUser, $comparison);
} | php | public function filterByApiAuthHttpUser($apiAuthHttpUser = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($apiAuthHttpUser)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $apiAuthHttpUser)) {
$apiAuthHttpUser = str_replace('*', '%', $apiAuthHttpUser);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(RemoteAppPeer::API_AUTH_HTTP_USER, $apiAuthHttpUser, $comparison);
} | [
"public",
"function",
"filterByApiAuthHttpUser",
"(",
"$",
"apiAuthHttpUser",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"apiAuthHttpUser",
")",
")",
"{",
"$",
"comparison",
"=",
"Criteria",
"::",
"IN",
";",
"}",
"elseif",
"(",
"preg_match",
"(",
"'/[\\%\\*]/'",
",",
"$",
"apiAuthHttpUser",
")",
")",
"{",
"$",
"apiAuthHttpUser",
"=",
"str_replace",
"(",
"'*'",
",",
"'%'",
",",
"$",
"apiAuthHttpUser",
")",
";",
"$",
"comparison",
"=",
"Criteria",
"::",
"LIKE",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"RemoteAppPeer",
"::",
"API_AUTH_HTTP_USER",
",",
"$",
"apiAuthHttpUser",
",",
"$",
"comparison",
")",
";",
"}"
]
| Filter the query on the api_auth_http_user column
Example usage:
<code>
$query->filterByApiAuthHttpUser('fooValue'); // WHERE api_auth_http_user = 'fooValue'
$query->filterByApiAuthHttpUser('%fooValue%'); // WHERE api_auth_http_user LIKE '%fooValue%'
</code>
@param string $apiAuthHttpUser The value to use as filter.
Accepts wildcards (* and % trigger a LIKE)
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return RemoteAppQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"api_auth_http_user",
"column"
]
| 2ba86d96f1f41f9424e2229c4e2b13017e973f89 | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteAppQuery.php#L511-L523 |
18,039 | slashworks/control-bundle | src/Slashworks/AppBundle/Model/om/BaseRemoteAppQuery.php | BaseRemoteAppQuery.filterByApiAuthHttpPassword | public function filterByApiAuthHttpPassword($apiAuthHttpPassword = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($apiAuthHttpPassword)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $apiAuthHttpPassword)) {
$apiAuthHttpPassword = str_replace('*', '%', $apiAuthHttpPassword);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(RemoteAppPeer::API_AUTH_HTTP_PASSWORD, $apiAuthHttpPassword, $comparison);
} | php | public function filterByApiAuthHttpPassword($apiAuthHttpPassword = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($apiAuthHttpPassword)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $apiAuthHttpPassword)) {
$apiAuthHttpPassword = str_replace('*', '%', $apiAuthHttpPassword);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(RemoteAppPeer::API_AUTH_HTTP_PASSWORD, $apiAuthHttpPassword, $comparison);
} | [
"public",
"function",
"filterByApiAuthHttpPassword",
"(",
"$",
"apiAuthHttpPassword",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"apiAuthHttpPassword",
")",
")",
"{",
"$",
"comparison",
"=",
"Criteria",
"::",
"IN",
";",
"}",
"elseif",
"(",
"preg_match",
"(",
"'/[\\%\\*]/'",
",",
"$",
"apiAuthHttpPassword",
")",
")",
"{",
"$",
"apiAuthHttpPassword",
"=",
"str_replace",
"(",
"'*'",
",",
"'%'",
",",
"$",
"apiAuthHttpPassword",
")",
";",
"$",
"comparison",
"=",
"Criteria",
"::",
"LIKE",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"RemoteAppPeer",
"::",
"API_AUTH_HTTP_PASSWORD",
",",
"$",
"apiAuthHttpPassword",
",",
"$",
"comparison",
")",
";",
"}"
]
| Filter the query on the api_auth_http_password column
Example usage:
<code>
$query->filterByApiAuthHttpPassword('fooValue'); // WHERE api_auth_http_password = 'fooValue'
$query->filterByApiAuthHttpPassword('%fooValue%'); // WHERE api_auth_http_password LIKE '%fooValue%'
</code>
@param string $apiAuthHttpPassword The value to use as filter.
Accepts wildcards (* and % trigger a LIKE)
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return RemoteAppQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"api_auth_http_password",
"column"
]
| 2ba86d96f1f41f9424e2229c4e2b13017e973f89 | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteAppQuery.php#L540-L552 |
18,040 | slashworks/control-bundle | src/Slashworks/AppBundle/Model/om/BaseRemoteAppQuery.php | BaseRemoteAppQuery.filterByApiAuthType | public function filterByApiAuthType($apiAuthType = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($apiAuthType)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $apiAuthType)) {
$apiAuthType = str_replace('*', '%', $apiAuthType);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(RemoteAppPeer::API_AUTH_TYPE, $apiAuthType, $comparison);
} | php | public function filterByApiAuthType($apiAuthType = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($apiAuthType)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $apiAuthType)) {
$apiAuthType = str_replace('*', '%', $apiAuthType);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(RemoteAppPeer::API_AUTH_TYPE, $apiAuthType, $comparison);
} | [
"public",
"function",
"filterByApiAuthType",
"(",
"$",
"apiAuthType",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"apiAuthType",
")",
")",
"{",
"$",
"comparison",
"=",
"Criteria",
"::",
"IN",
";",
"}",
"elseif",
"(",
"preg_match",
"(",
"'/[\\%\\*]/'",
",",
"$",
"apiAuthType",
")",
")",
"{",
"$",
"apiAuthType",
"=",
"str_replace",
"(",
"'*'",
",",
"'%'",
",",
"$",
"apiAuthType",
")",
";",
"$",
"comparison",
"=",
"Criteria",
"::",
"LIKE",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"RemoteAppPeer",
"::",
"API_AUTH_TYPE",
",",
"$",
"apiAuthType",
",",
"$",
"comparison",
")",
";",
"}"
]
| Filter the query on the api_auth_type column
Example usage:
<code>
$query->filterByApiAuthType('fooValue'); // WHERE api_auth_type = 'fooValue'
$query->filterByApiAuthType('%fooValue%'); // WHERE api_auth_type LIKE '%fooValue%'
</code>
@param string $apiAuthType The value to use as filter.
Accepts wildcards (* and % trigger a LIKE)
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return RemoteAppQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"api_auth_type",
"column"
]
| 2ba86d96f1f41f9424e2229c4e2b13017e973f89 | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteAppQuery.php#L569-L581 |
18,041 | slashworks/control-bundle | src/Slashworks/AppBundle/Model/om/BaseRemoteAppQuery.php | BaseRemoteAppQuery.filterByApiAuthUser | public function filterByApiAuthUser($apiAuthUser = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($apiAuthUser)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $apiAuthUser)) {
$apiAuthUser = str_replace('*', '%', $apiAuthUser);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(RemoteAppPeer::API_AUTH_USER, $apiAuthUser, $comparison);
} | php | public function filterByApiAuthUser($apiAuthUser = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($apiAuthUser)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $apiAuthUser)) {
$apiAuthUser = str_replace('*', '%', $apiAuthUser);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(RemoteAppPeer::API_AUTH_USER, $apiAuthUser, $comparison);
} | [
"public",
"function",
"filterByApiAuthUser",
"(",
"$",
"apiAuthUser",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"apiAuthUser",
")",
")",
"{",
"$",
"comparison",
"=",
"Criteria",
"::",
"IN",
";",
"}",
"elseif",
"(",
"preg_match",
"(",
"'/[\\%\\*]/'",
",",
"$",
"apiAuthUser",
")",
")",
"{",
"$",
"apiAuthUser",
"=",
"str_replace",
"(",
"'*'",
",",
"'%'",
",",
"$",
"apiAuthUser",
")",
";",
"$",
"comparison",
"=",
"Criteria",
"::",
"LIKE",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"RemoteAppPeer",
"::",
"API_AUTH_USER",
",",
"$",
"apiAuthUser",
",",
"$",
"comparison",
")",
";",
"}"
]
| Filter the query on the api_auth_user column
Example usage:
<code>
$query->filterByApiAuthUser('fooValue'); // WHERE api_auth_user = 'fooValue'
$query->filterByApiAuthUser('%fooValue%'); // WHERE api_auth_user LIKE '%fooValue%'
</code>
@param string $apiAuthUser The value to use as filter.
Accepts wildcards (* and % trigger a LIKE)
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return RemoteAppQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"api_auth_user",
"column"
]
| 2ba86d96f1f41f9424e2229c4e2b13017e973f89 | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteAppQuery.php#L598-L610 |
18,042 | slashworks/control-bundle | src/Slashworks/AppBundle/Model/om/BaseRemoteAppQuery.php | BaseRemoteAppQuery.filterByApiAuthPassword | public function filterByApiAuthPassword($apiAuthPassword = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($apiAuthPassword)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $apiAuthPassword)) {
$apiAuthPassword = str_replace('*', '%', $apiAuthPassword);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(RemoteAppPeer::API_AUTH_PASSWORD, $apiAuthPassword, $comparison);
} | php | public function filterByApiAuthPassword($apiAuthPassword = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($apiAuthPassword)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $apiAuthPassword)) {
$apiAuthPassword = str_replace('*', '%', $apiAuthPassword);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(RemoteAppPeer::API_AUTH_PASSWORD, $apiAuthPassword, $comparison);
} | [
"public",
"function",
"filterByApiAuthPassword",
"(",
"$",
"apiAuthPassword",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"apiAuthPassword",
")",
")",
"{",
"$",
"comparison",
"=",
"Criteria",
"::",
"IN",
";",
"}",
"elseif",
"(",
"preg_match",
"(",
"'/[\\%\\*]/'",
",",
"$",
"apiAuthPassword",
")",
")",
"{",
"$",
"apiAuthPassword",
"=",
"str_replace",
"(",
"'*'",
",",
"'%'",
",",
"$",
"apiAuthPassword",
")",
";",
"$",
"comparison",
"=",
"Criteria",
"::",
"LIKE",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"RemoteAppPeer",
"::",
"API_AUTH_PASSWORD",
",",
"$",
"apiAuthPassword",
",",
"$",
"comparison",
")",
";",
"}"
]
| Filter the query on the api_auth_password column
Example usage:
<code>
$query->filterByApiAuthPassword('fooValue'); // WHERE api_auth_password = 'fooValue'
$query->filterByApiAuthPassword('%fooValue%'); // WHERE api_auth_password LIKE '%fooValue%'
</code>
@param string $apiAuthPassword The value to use as filter.
Accepts wildcards (* and % trigger a LIKE)
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return RemoteAppQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"api_auth_password",
"column"
]
| 2ba86d96f1f41f9424e2229c4e2b13017e973f89 | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteAppQuery.php#L627-L639 |
18,043 | slashworks/control-bundle | src/Slashworks/AppBundle/Model/om/BaseRemoteAppQuery.php | BaseRemoteAppQuery.filterByApiAuthToken | public function filterByApiAuthToken($apiAuthToken = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($apiAuthToken)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $apiAuthToken)) {
$apiAuthToken = str_replace('*', '%', $apiAuthToken);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(RemoteAppPeer::API_AUTH_TOKEN, $apiAuthToken, $comparison);
} | php | public function filterByApiAuthToken($apiAuthToken = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($apiAuthToken)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $apiAuthToken)) {
$apiAuthToken = str_replace('*', '%', $apiAuthToken);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(RemoteAppPeer::API_AUTH_TOKEN, $apiAuthToken, $comparison);
} | [
"public",
"function",
"filterByApiAuthToken",
"(",
"$",
"apiAuthToken",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"apiAuthToken",
")",
")",
"{",
"$",
"comparison",
"=",
"Criteria",
"::",
"IN",
";",
"}",
"elseif",
"(",
"preg_match",
"(",
"'/[\\%\\*]/'",
",",
"$",
"apiAuthToken",
")",
")",
"{",
"$",
"apiAuthToken",
"=",
"str_replace",
"(",
"'*'",
",",
"'%'",
",",
"$",
"apiAuthToken",
")",
";",
"$",
"comparison",
"=",
"Criteria",
"::",
"LIKE",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"RemoteAppPeer",
"::",
"API_AUTH_TOKEN",
",",
"$",
"apiAuthToken",
",",
"$",
"comparison",
")",
";",
"}"
]
| Filter the query on the api_auth_token column
Example usage:
<code>
$query->filterByApiAuthToken('fooValue'); // WHERE api_auth_token = 'fooValue'
$query->filterByApiAuthToken('%fooValue%'); // WHERE api_auth_token LIKE '%fooValue%'
</code>
@param string $apiAuthToken The value to use as filter.
Accepts wildcards (* and % trigger a LIKE)
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return RemoteAppQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"api_auth_token",
"column"
]
| 2ba86d96f1f41f9424e2229c4e2b13017e973f89 | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteAppQuery.php#L656-L668 |
18,044 | slashworks/control-bundle | src/Slashworks/AppBundle/Model/om/BaseRemoteAppQuery.php | BaseRemoteAppQuery.filterByApiAuthUrlUserKey | public function filterByApiAuthUrlUserKey($apiAuthUrlUserKey = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($apiAuthUrlUserKey)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $apiAuthUrlUserKey)) {
$apiAuthUrlUserKey = str_replace('*', '%', $apiAuthUrlUserKey);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(RemoteAppPeer::API_AUTH_URL_USER_KEY, $apiAuthUrlUserKey, $comparison);
} | php | public function filterByApiAuthUrlUserKey($apiAuthUrlUserKey = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($apiAuthUrlUserKey)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $apiAuthUrlUserKey)) {
$apiAuthUrlUserKey = str_replace('*', '%', $apiAuthUrlUserKey);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(RemoteAppPeer::API_AUTH_URL_USER_KEY, $apiAuthUrlUserKey, $comparison);
} | [
"public",
"function",
"filterByApiAuthUrlUserKey",
"(",
"$",
"apiAuthUrlUserKey",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"apiAuthUrlUserKey",
")",
")",
"{",
"$",
"comparison",
"=",
"Criteria",
"::",
"IN",
";",
"}",
"elseif",
"(",
"preg_match",
"(",
"'/[\\%\\*]/'",
",",
"$",
"apiAuthUrlUserKey",
")",
")",
"{",
"$",
"apiAuthUrlUserKey",
"=",
"str_replace",
"(",
"'*'",
",",
"'%'",
",",
"$",
"apiAuthUrlUserKey",
")",
";",
"$",
"comparison",
"=",
"Criteria",
"::",
"LIKE",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"RemoteAppPeer",
"::",
"API_AUTH_URL_USER_KEY",
",",
"$",
"apiAuthUrlUserKey",
",",
"$",
"comparison",
")",
";",
"}"
]
| Filter the query on the api_auth_url_user_key column
Example usage:
<code>
$query->filterByApiAuthUrlUserKey('fooValue'); // WHERE api_auth_url_user_key = 'fooValue'
$query->filterByApiAuthUrlUserKey('%fooValue%'); // WHERE api_auth_url_user_key LIKE '%fooValue%'
</code>
@param string $apiAuthUrlUserKey The value to use as filter.
Accepts wildcards (* and % trigger a LIKE)
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return RemoteAppQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"api_auth_url_user_key",
"column"
]
| 2ba86d96f1f41f9424e2229c4e2b13017e973f89 | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteAppQuery.php#L685-L697 |
18,045 | slashworks/control-bundle | src/Slashworks/AppBundle/Model/om/BaseRemoteAppQuery.php | BaseRemoteAppQuery.filterByApiAuthUrlPwKey | public function filterByApiAuthUrlPwKey($apiAuthUrlPwKey = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($apiAuthUrlPwKey)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $apiAuthUrlPwKey)) {
$apiAuthUrlPwKey = str_replace('*', '%', $apiAuthUrlPwKey);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(RemoteAppPeer::API_AUTH_URL_PW_KEY, $apiAuthUrlPwKey, $comparison);
} | php | public function filterByApiAuthUrlPwKey($apiAuthUrlPwKey = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($apiAuthUrlPwKey)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $apiAuthUrlPwKey)) {
$apiAuthUrlPwKey = str_replace('*', '%', $apiAuthUrlPwKey);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(RemoteAppPeer::API_AUTH_URL_PW_KEY, $apiAuthUrlPwKey, $comparison);
} | [
"public",
"function",
"filterByApiAuthUrlPwKey",
"(",
"$",
"apiAuthUrlPwKey",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"apiAuthUrlPwKey",
")",
")",
"{",
"$",
"comparison",
"=",
"Criteria",
"::",
"IN",
";",
"}",
"elseif",
"(",
"preg_match",
"(",
"'/[\\%\\*]/'",
",",
"$",
"apiAuthUrlPwKey",
")",
")",
"{",
"$",
"apiAuthUrlPwKey",
"=",
"str_replace",
"(",
"'*'",
",",
"'%'",
",",
"$",
"apiAuthUrlPwKey",
")",
";",
"$",
"comparison",
"=",
"Criteria",
"::",
"LIKE",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"RemoteAppPeer",
"::",
"API_AUTH_URL_PW_KEY",
",",
"$",
"apiAuthUrlPwKey",
",",
"$",
"comparison",
")",
";",
"}"
]
| Filter the query on the api_auth_url_pw_key column
Example usage:
<code>
$query->filterByApiAuthUrlPwKey('fooValue'); // WHERE api_auth_url_pw_key = 'fooValue'
$query->filterByApiAuthUrlPwKey('%fooValue%'); // WHERE api_auth_url_pw_key LIKE '%fooValue%'
</code>
@param string $apiAuthUrlPwKey The value to use as filter.
Accepts wildcards (* and % trigger a LIKE)
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return RemoteAppQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"api_auth_url_pw_key",
"column"
]
| 2ba86d96f1f41f9424e2229c4e2b13017e973f89 | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteAppQuery.php#L714-L726 |
18,046 | slashworks/control-bundle | src/Slashworks/AppBundle/Model/om/BaseRemoteAppQuery.php | BaseRemoteAppQuery.filterByCron | public function filterByCron($cron = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($cron)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $cron)) {
$cron = str_replace('*', '%', $cron);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(RemoteAppPeer::CRON, $cron, $comparison);
} | php | public function filterByCron($cron = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($cron)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $cron)) {
$cron = str_replace('*', '%', $cron);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(RemoteAppPeer::CRON, $cron, $comparison);
} | [
"public",
"function",
"filterByCron",
"(",
"$",
"cron",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"cron",
")",
")",
"{",
"$",
"comparison",
"=",
"Criteria",
"::",
"IN",
";",
"}",
"elseif",
"(",
"preg_match",
"(",
"'/[\\%\\*]/'",
",",
"$",
"cron",
")",
")",
"{",
"$",
"cron",
"=",
"str_replace",
"(",
"'*'",
",",
"'%'",
",",
"$",
"cron",
")",
";",
"$",
"comparison",
"=",
"Criteria",
"::",
"LIKE",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"RemoteAppPeer",
"::",
"CRON",
",",
"$",
"cron",
",",
"$",
"comparison",
")",
";",
"}"
]
| Filter the query on the cron column
Example usage:
<code>
$query->filterByCron('fooValue'); // WHERE cron = 'fooValue'
$query->filterByCron('%fooValue%'); // WHERE cron LIKE '%fooValue%'
</code>
@param string $cron The value to use as filter.
Accepts wildcards (* and % trigger a LIKE)
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return RemoteAppQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"cron",
"column"
]
| 2ba86d96f1f41f9424e2229c4e2b13017e973f89 | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteAppQuery.php#L743-L755 |
18,047 | slashworks/control-bundle | src/Slashworks/AppBundle/Model/om/BaseRemoteAppQuery.php | BaseRemoteAppQuery.filterByCustomerId | public function filterByCustomerId($customerId = null, $comparison = null)
{
if (is_array($customerId)) {
$useMinMax = false;
if (isset($customerId['min'])) {
$this->addUsingAlias(RemoteAppPeer::CUSTOMER_ID, $customerId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($customerId['max'])) {
$this->addUsingAlias(RemoteAppPeer::CUSTOMER_ID, $customerId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(RemoteAppPeer::CUSTOMER_ID, $customerId, $comparison);
} | php | public function filterByCustomerId($customerId = null, $comparison = null)
{
if (is_array($customerId)) {
$useMinMax = false;
if (isset($customerId['min'])) {
$this->addUsingAlias(RemoteAppPeer::CUSTOMER_ID, $customerId['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($customerId['max'])) {
$this->addUsingAlias(RemoteAppPeer::CUSTOMER_ID, $customerId['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(RemoteAppPeer::CUSTOMER_ID, $customerId, $comparison);
} | [
"public",
"function",
"filterByCustomerId",
"(",
"$",
"customerId",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"customerId",
")",
")",
"{",
"$",
"useMinMax",
"=",
"false",
";",
"if",
"(",
"isset",
"(",
"$",
"customerId",
"[",
"'min'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"addUsingAlias",
"(",
"RemoteAppPeer",
"::",
"CUSTOMER_ID",
",",
"$",
"customerId",
"[",
"'min'",
"]",
",",
"Criteria",
"::",
"GREATER_EQUAL",
")",
";",
"$",
"useMinMax",
"=",
"true",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"customerId",
"[",
"'max'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"addUsingAlias",
"(",
"RemoteAppPeer",
"::",
"CUSTOMER_ID",
",",
"$",
"customerId",
"[",
"'max'",
"]",
",",
"Criteria",
"::",
"LESS_EQUAL",
")",
";",
"$",
"useMinMax",
"=",
"true",
";",
"}",
"if",
"(",
"$",
"useMinMax",
")",
"{",
"return",
"$",
"this",
";",
"}",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"$",
"comparison",
"=",
"Criteria",
"::",
"IN",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"RemoteAppPeer",
"::",
"CUSTOMER_ID",
",",
"$",
"customerId",
",",
"$",
"comparison",
")",
";",
"}"
]
| Filter the query on the customer_id column
Example usage:
<code>
$query->filterByCustomerId(1234); // WHERE customer_id = 1234
$query->filterByCustomerId(array(12, 34)); // WHERE customer_id IN (12, 34)
$query->filterByCustomerId(array('min' => 12)); // WHERE customer_id >= 12
$query->filterByCustomerId(array('max' => 12)); // WHERE customer_id <= 12
</code>
@see filterByCustomer()
@param mixed $customerId The value to use as filter.
Use scalar values for equality.
Use array values for in_array() equivalent.
Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return RemoteAppQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"customer_id",
"column"
]
| 2ba86d96f1f41f9424e2229c4e2b13017e973f89 | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteAppQuery.php#L778-L799 |
18,048 | slashworks/control-bundle | src/Slashworks/AppBundle/Model/om/BaseRemoteAppQuery.php | BaseRemoteAppQuery.filterByLastRun | public function filterByLastRun($lastRun = null, $comparison = null)
{
if (is_array($lastRun)) {
$useMinMax = false;
if (isset($lastRun['min'])) {
$this->addUsingAlias(RemoteAppPeer::LAST_RUN, $lastRun['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($lastRun['max'])) {
$this->addUsingAlias(RemoteAppPeer::LAST_RUN, $lastRun['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(RemoteAppPeer::LAST_RUN, $lastRun, $comparison);
} | php | public function filterByLastRun($lastRun = null, $comparison = null)
{
if (is_array($lastRun)) {
$useMinMax = false;
if (isset($lastRun['min'])) {
$this->addUsingAlias(RemoteAppPeer::LAST_RUN, $lastRun['min'], Criteria::GREATER_EQUAL);
$useMinMax = true;
}
if (isset($lastRun['max'])) {
$this->addUsingAlias(RemoteAppPeer::LAST_RUN, $lastRun['max'], Criteria::LESS_EQUAL);
$useMinMax = true;
}
if ($useMinMax) {
return $this;
}
if (null === $comparison) {
$comparison = Criteria::IN;
}
}
return $this->addUsingAlias(RemoteAppPeer::LAST_RUN, $lastRun, $comparison);
} | [
"public",
"function",
"filterByLastRun",
"(",
"$",
"lastRun",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"lastRun",
")",
")",
"{",
"$",
"useMinMax",
"=",
"false",
";",
"if",
"(",
"isset",
"(",
"$",
"lastRun",
"[",
"'min'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"addUsingAlias",
"(",
"RemoteAppPeer",
"::",
"LAST_RUN",
",",
"$",
"lastRun",
"[",
"'min'",
"]",
",",
"Criteria",
"::",
"GREATER_EQUAL",
")",
";",
"$",
"useMinMax",
"=",
"true",
";",
"}",
"if",
"(",
"isset",
"(",
"$",
"lastRun",
"[",
"'max'",
"]",
")",
")",
"{",
"$",
"this",
"->",
"addUsingAlias",
"(",
"RemoteAppPeer",
"::",
"LAST_RUN",
",",
"$",
"lastRun",
"[",
"'max'",
"]",
",",
"Criteria",
"::",
"LESS_EQUAL",
")",
";",
"$",
"useMinMax",
"=",
"true",
";",
"}",
"if",
"(",
"$",
"useMinMax",
")",
"{",
"return",
"$",
"this",
";",
"}",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"$",
"comparison",
"=",
"Criteria",
"::",
"IN",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"RemoteAppPeer",
"::",
"LAST_RUN",
",",
"$",
"lastRun",
",",
"$",
"comparison",
")",
";",
"}"
]
| Filter the query on the last_run column
Example usage:
<code>
$query->filterByLastRun('2011-03-14'); // WHERE last_run = '2011-03-14'
$query->filterByLastRun('now'); // WHERE last_run = '2011-03-14'
$query->filterByLastRun(array('max' => 'yesterday')); // WHERE last_run < '2011-03-13'
</code>
@param mixed $lastRun The value to use as filter.
Values can be integers (unix timestamps), DateTime objects, or strings.
Empty strings are treated as NULL.
Use scalar values for equality.
Use array values for in_array() equivalent.
Use associative array('min' => $minValue, 'max' => $maxValue) for intervals.
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return RemoteAppQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"last_run",
"column"
]
| 2ba86d96f1f41f9424e2229c4e2b13017e973f89 | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteAppQuery.php#L877-L898 |
18,049 | slashworks/control-bundle | src/Slashworks/AppBundle/Model/om/BaseRemoteAppQuery.php | BaseRemoteAppQuery.filterByIncludelog | public function filterByIncludelog($includelog = null, $comparison = null)
{
if (is_string($includelog)) {
$includelog = in_array(strtolower($includelog), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
}
return $this->addUsingAlias(RemoteAppPeer::INCLUDELOG, $includelog, $comparison);
} | php | public function filterByIncludelog($includelog = null, $comparison = null)
{
if (is_string($includelog)) {
$includelog = in_array(strtolower($includelog), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
}
return $this->addUsingAlias(RemoteAppPeer::INCLUDELOG, $includelog, $comparison);
} | [
"public",
"function",
"filterByIncludelog",
"(",
"$",
"includelog",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"includelog",
")",
")",
"{",
"$",
"includelog",
"=",
"in_array",
"(",
"strtolower",
"(",
"$",
"includelog",
")",
",",
"array",
"(",
"'false'",
",",
"'off'",
",",
"'-'",
",",
"'no'",
",",
"'n'",
",",
"'0'",
",",
"''",
")",
")",
"?",
"false",
":",
"true",
";",
"}",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"RemoteAppPeer",
"::",
"INCLUDELOG",
",",
"$",
"includelog",
",",
"$",
"comparison",
")",
";",
"}"
]
| Filter the query on the includeLog column
Example usage:
<code>
$query->filterByIncludelog(true); // WHERE includeLog = true
$query->filterByIncludelog('yes'); // WHERE includeLog = true
</code>
@param boolean|string $includelog The value to use as filter.
Non-boolean arguments are converted using the following rules:
* 1, '1', 'true', 'on', and 'yes' are converted to boolean true
* 0, '0', 'false', 'off', and 'no' are converted to boolean false
Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return RemoteAppQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"includeLog",
"column"
]
| 2ba86d96f1f41f9424e2229c4e2b13017e973f89 | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteAppQuery.php#L918-L925 |
18,050 | slashworks/control-bundle | src/Slashworks/AppBundle/Model/om/BaseRemoteAppQuery.php | BaseRemoteAppQuery.filterByPublicKey | public function filterByPublicKey($publicKey = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($publicKey)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $publicKey)) {
$publicKey = str_replace('*', '%', $publicKey);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(RemoteAppPeer::PUBLIC_KEY, $publicKey, $comparison);
} | php | public function filterByPublicKey($publicKey = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($publicKey)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $publicKey)) {
$publicKey = str_replace('*', '%', $publicKey);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(RemoteAppPeer::PUBLIC_KEY, $publicKey, $comparison);
} | [
"public",
"function",
"filterByPublicKey",
"(",
"$",
"publicKey",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"publicKey",
")",
")",
"{",
"$",
"comparison",
"=",
"Criteria",
"::",
"IN",
";",
"}",
"elseif",
"(",
"preg_match",
"(",
"'/[\\%\\*]/'",
",",
"$",
"publicKey",
")",
")",
"{",
"$",
"publicKey",
"=",
"str_replace",
"(",
"'*'",
",",
"'%'",
",",
"$",
"publicKey",
")",
";",
"$",
"comparison",
"=",
"Criteria",
"::",
"LIKE",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"RemoteAppPeer",
"::",
"PUBLIC_KEY",
",",
"$",
"publicKey",
",",
"$",
"comparison",
")",
";",
"}"
]
| Filter the query on the public_key column
Example usage:
<code>
$query->filterByPublicKey('fooValue'); // WHERE public_key = 'fooValue'
$query->filterByPublicKey('%fooValue%'); // WHERE public_key LIKE '%fooValue%'
</code>
@param string $publicKey The value to use as filter.
Accepts wildcards (* and % trigger a LIKE)
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return RemoteAppQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"public_key",
"column"
]
| 2ba86d96f1f41f9424e2229c4e2b13017e973f89 | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteAppQuery.php#L942-L954 |
18,051 | slashworks/control-bundle | src/Slashworks/AppBundle/Model/om/BaseRemoteAppQuery.php | BaseRemoteAppQuery.filterByWebsiteHash | public function filterByWebsiteHash($websiteHash = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($websiteHash)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $websiteHash)) {
$websiteHash = str_replace('*', '%', $websiteHash);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(RemoteAppPeer::WEBSITE_HASH, $websiteHash, $comparison);
} | php | public function filterByWebsiteHash($websiteHash = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($websiteHash)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $websiteHash)) {
$websiteHash = str_replace('*', '%', $websiteHash);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(RemoteAppPeer::WEBSITE_HASH, $websiteHash, $comparison);
} | [
"public",
"function",
"filterByWebsiteHash",
"(",
"$",
"websiteHash",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"websiteHash",
")",
")",
"{",
"$",
"comparison",
"=",
"Criteria",
"::",
"IN",
";",
"}",
"elseif",
"(",
"preg_match",
"(",
"'/[\\%\\*]/'",
",",
"$",
"websiteHash",
")",
")",
"{",
"$",
"websiteHash",
"=",
"str_replace",
"(",
"'*'",
",",
"'%'",
",",
"$",
"websiteHash",
")",
";",
"$",
"comparison",
"=",
"Criteria",
"::",
"LIKE",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"RemoteAppPeer",
"::",
"WEBSITE_HASH",
",",
"$",
"websiteHash",
",",
"$",
"comparison",
")",
";",
"}"
]
| Filter the query on the website_hash column
Example usage:
<code>
$query->filterByWebsiteHash('fooValue'); // WHERE website_hash = 'fooValue'
$query->filterByWebsiteHash('%fooValue%'); // WHERE website_hash LIKE '%fooValue%'
</code>
@param string $websiteHash The value to use as filter.
Accepts wildcards (* and % trigger a LIKE)
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return RemoteAppQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"website_hash",
"column"
]
| 2ba86d96f1f41f9424e2229c4e2b13017e973f89 | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteAppQuery.php#L971-L983 |
18,052 | slashworks/control-bundle | src/Slashworks/AppBundle/Model/om/BaseRemoteAppQuery.php | BaseRemoteAppQuery.filterByNotificationRecipient | public function filterByNotificationRecipient($notificationRecipient = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($notificationRecipient)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $notificationRecipient)) {
$notificationRecipient = str_replace('*', '%', $notificationRecipient);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(RemoteAppPeer::NOTIFICATION_RECIPIENT, $notificationRecipient, $comparison);
} | php | public function filterByNotificationRecipient($notificationRecipient = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($notificationRecipient)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $notificationRecipient)) {
$notificationRecipient = str_replace('*', '%', $notificationRecipient);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(RemoteAppPeer::NOTIFICATION_RECIPIENT, $notificationRecipient, $comparison);
} | [
"public",
"function",
"filterByNotificationRecipient",
"(",
"$",
"notificationRecipient",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"notificationRecipient",
")",
")",
"{",
"$",
"comparison",
"=",
"Criteria",
"::",
"IN",
";",
"}",
"elseif",
"(",
"preg_match",
"(",
"'/[\\%\\*]/'",
",",
"$",
"notificationRecipient",
")",
")",
"{",
"$",
"notificationRecipient",
"=",
"str_replace",
"(",
"'*'",
",",
"'%'",
",",
"$",
"notificationRecipient",
")",
";",
"$",
"comparison",
"=",
"Criteria",
"::",
"LIKE",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"RemoteAppPeer",
"::",
"NOTIFICATION_RECIPIENT",
",",
"$",
"notificationRecipient",
",",
"$",
"comparison",
")",
";",
"}"
]
| Filter the query on the notification_recipient column
Example usage:
<code>
$query->filterByNotificationRecipient('fooValue'); // WHERE notification_recipient = 'fooValue'
$query->filterByNotificationRecipient('%fooValue%'); // WHERE notification_recipient LIKE '%fooValue%'
</code>
@param string $notificationRecipient The value to use as filter.
Accepts wildcards (* and % trigger a LIKE)
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return RemoteAppQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"notification_recipient",
"column"
]
| 2ba86d96f1f41f9424e2229c4e2b13017e973f89 | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteAppQuery.php#L1000-L1012 |
18,053 | slashworks/control-bundle | src/Slashworks/AppBundle/Model/om/BaseRemoteAppQuery.php | BaseRemoteAppQuery.filterByNotificationSender | public function filterByNotificationSender($notificationSender = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($notificationSender)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $notificationSender)) {
$notificationSender = str_replace('*', '%', $notificationSender);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(RemoteAppPeer::NOTIFICATION_SENDER, $notificationSender, $comparison);
} | php | public function filterByNotificationSender($notificationSender = null, $comparison = null)
{
if (null === $comparison) {
if (is_array($notificationSender)) {
$comparison = Criteria::IN;
} elseif (preg_match('/[\%\*]/', $notificationSender)) {
$notificationSender = str_replace('*', '%', $notificationSender);
$comparison = Criteria::LIKE;
}
}
return $this->addUsingAlias(RemoteAppPeer::NOTIFICATION_SENDER, $notificationSender, $comparison);
} | [
"public",
"function",
"filterByNotificationSender",
"(",
"$",
"notificationSender",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"null",
"===",
"$",
"comparison",
")",
"{",
"if",
"(",
"is_array",
"(",
"$",
"notificationSender",
")",
")",
"{",
"$",
"comparison",
"=",
"Criteria",
"::",
"IN",
";",
"}",
"elseif",
"(",
"preg_match",
"(",
"'/[\\%\\*]/'",
",",
"$",
"notificationSender",
")",
")",
"{",
"$",
"notificationSender",
"=",
"str_replace",
"(",
"'*'",
",",
"'%'",
",",
"$",
"notificationSender",
")",
";",
"$",
"comparison",
"=",
"Criteria",
"::",
"LIKE",
";",
"}",
"}",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"RemoteAppPeer",
"::",
"NOTIFICATION_SENDER",
",",
"$",
"notificationSender",
",",
"$",
"comparison",
")",
";",
"}"
]
| Filter the query on the notification_sender column
Example usage:
<code>
$query->filterByNotificationSender('fooValue'); // WHERE notification_sender = 'fooValue'
$query->filterByNotificationSender('%fooValue%'); // WHERE notification_sender LIKE '%fooValue%'
</code>
@param string $notificationSender The value to use as filter.
Accepts wildcards (* and % trigger a LIKE)
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return RemoteAppQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"notification_sender",
"column"
]
| 2ba86d96f1f41f9424e2229c4e2b13017e973f89 | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteAppQuery.php#L1029-L1041 |
18,054 | slashworks/control-bundle | src/Slashworks/AppBundle/Model/om/BaseRemoteAppQuery.php | BaseRemoteAppQuery.filterByNotificationChange | public function filterByNotificationChange($notificationChange = null, $comparison = null)
{
if (is_string($notificationChange)) {
$notificationChange = in_array(strtolower($notificationChange), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
}
return $this->addUsingAlias(RemoteAppPeer::NOTIFICATION_CHANGE, $notificationChange, $comparison);
} | php | public function filterByNotificationChange($notificationChange = null, $comparison = null)
{
if (is_string($notificationChange)) {
$notificationChange = in_array(strtolower($notificationChange), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
}
return $this->addUsingAlias(RemoteAppPeer::NOTIFICATION_CHANGE, $notificationChange, $comparison);
} | [
"public",
"function",
"filterByNotificationChange",
"(",
"$",
"notificationChange",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"notificationChange",
")",
")",
"{",
"$",
"notificationChange",
"=",
"in_array",
"(",
"strtolower",
"(",
"$",
"notificationChange",
")",
",",
"array",
"(",
"'false'",
",",
"'off'",
",",
"'-'",
",",
"'no'",
",",
"'n'",
",",
"'0'",
",",
"''",
")",
")",
"?",
"false",
":",
"true",
";",
"}",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"RemoteAppPeer",
"::",
"NOTIFICATION_CHANGE",
",",
"$",
"notificationChange",
",",
"$",
"comparison",
")",
";",
"}"
]
| Filter the query on the notification_change column
Example usage:
<code>
$query->filterByNotificationChange(true); // WHERE notification_change = true
$query->filterByNotificationChange('yes'); // WHERE notification_change = true
</code>
@param boolean|string $notificationChange The value to use as filter.
Non-boolean arguments are converted using the following rules:
* 1, '1', 'true', 'on', and 'yes' are converted to boolean true
* 0, '0', 'false', 'off', and 'no' are converted to boolean false
Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return RemoteAppQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"notification_change",
"column"
]
| 2ba86d96f1f41f9424e2229c4e2b13017e973f89 | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteAppQuery.php#L1061-L1068 |
18,055 | slashworks/control-bundle | src/Slashworks/AppBundle/Model/om/BaseRemoteAppQuery.php | BaseRemoteAppQuery.filterByNotificationError | public function filterByNotificationError($notificationError = null, $comparison = null)
{
if (is_string($notificationError)) {
$notificationError = in_array(strtolower($notificationError), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
}
return $this->addUsingAlias(RemoteAppPeer::NOTIFICATION_ERROR, $notificationError, $comparison);
} | php | public function filterByNotificationError($notificationError = null, $comparison = null)
{
if (is_string($notificationError)) {
$notificationError = in_array(strtolower($notificationError), array('false', 'off', '-', 'no', 'n', '0', '')) ? false : true;
}
return $this->addUsingAlias(RemoteAppPeer::NOTIFICATION_ERROR, $notificationError, $comparison);
} | [
"public",
"function",
"filterByNotificationError",
"(",
"$",
"notificationError",
"=",
"null",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"is_string",
"(",
"$",
"notificationError",
")",
")",
"{",
"$",
"notificationError",
"=",
"in_array",
"(",
"strtolower",
"(",
"$",
"notificationError",
")",
",",
"array",
"(",
"'false'",
",",
"'off'",
",",
"'-'",
",",
"'no'",
",",
"'n'",
",",
"'0'",
",",
"''",
")",
")",
"?",
"false",
":",
"true",
";",
"}",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"RemoteAppPeer",
"::",
"NOTIFICATION_ERROR",
",",
"$",
"notificationError",
",",
"$",
"comparison",
")",
";",
"}"
]
| Filter the query on the notification_error column
Example usage:
<code>
$query->filterByNotificationError(true); // WHERE notification_error = true
$query->filterByNotificationError('yes'); // WHERE notification_error = true
</code>
@param boolean|string $notificationError The value to use as filter.
Non-boolean arguments are converted using the following rules:
* 1, '1', 'true', 'on', and 'yes' are converted to boolean true
* 0, '0', 'false', 'off', and 'no' are converted to boolean false
Check on string values is case insensitive (so 'FaLsE' is seen as 'false').
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return RemoteAppQuery The current query, for fluid interface | [
"Filter",
"the",
"query",
"on",
"the",
"notification_error",
"column"
]
| 2ba86d96f1f41f9424e2229c4e2b13017e973f89 | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteAppQuery.php#L1088-L1095 |
18,056 | slashworks/control-bundle | src/Slashworks/AppBundle/Model/om/BaseRemoteAppQuery.php | BaseRemoteAppQuery.filterByApiLog | public function filterByApiLog($apiLog, $comparison = null)
{
if ($apiLog instanceof ApiLog) {
return $this
->addUsingAlias(RemoteAppPeer::ID, $apiLog->getRemoteAppId(), $comparison);
} elseif ($apiLog instanceof PropelObjectCollection) {
return $this
->useApiLogQuery()
->filterByPrimaryKeys($apiLog->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByApiLog() only accepts arguments of type ApiLog or PropelCollection');
}
} | php | public function filterByApiLog($apiLog, $comparison = null)
{
if ($apiLog instanceof ApiLog) {
return $this
->addUsingAlias(RemoteAppPeer::ID, $apiLog->getRemoteAppId(), $comparison);
} elseif ($apiLog instanceof PropelObjectCollection) {
return $this
->useApiLogQuery()
->filterByPrimaryKeys($apiLog->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByApiLog() only accepts arguments of type ApiLog or PropelCollection');
}
} | [
"public",
"function",
"filterByApiLog",
"(",
"$",
"apiLog",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"apiLog",
"instanceof",
"ApiLog",
")",
"{",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"RemoteAppPeer",
"::",
"ID",
",",
"$",
"apiLog",
"->",
"getRemoteAppId",
"(",
")",
",",
"$",
"comparison",
")",
";",
"}",
"elseif",
"(",
"$",
"apiLog",
"instanceof",
"PropelObjectCollection",
")",
"{",
"return",
"$",
"this",
"->",
"useApiLogQuery",
"(",
")",
"->",
"filterByPrimaryKeys",
"(",
"$",
"apiLog",
"->",
"getPrimaryKeys",
"(",
")",
")",
"->",
"endUse",
"(",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"PropelException",
"(",
"'filterByApiLog() only accepts arguments of type ApiLog or PropelCollection'",
")",
";",
"}",
"}"
]
| Filter the query by a related ApiLog object
@param ApiLog|PropelObjectCollection $apiLog the related object to use as filter
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return RemoteAppQuery The current query, for fluid interface
@throws PropelException - if the provided filter is invalid. | [
"Filter",
"the",
"query",
"by",
"a",
"related",
"ApiLog",
"object"
]
| 2ba86d96f1f41f9424e2229c4e2b13017e973f89 | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteAppQuery.php#L1182-L1195 |
18,057 | slashworks/control-bundle | src/Slashworks/AppBundle/Model/om/BaseRemoteAppQuery.php | BaseRemoteAppQuery.useApiLogQuery | public function useApiLogQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinApiLog($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'ApiLog', '\Slashworks\AppBundle\Model\ApiLogQuery');
} | php | public function useApiLogQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinApiLog($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'ApiLog', '\Slashworks\AppBundle\Model\ApiLogQuery');
} | [
"public",
"function",
"useApiLogQuery",
"(",
"$",
"relationAlias",
"=",
"null",
",",
"$",
"joinType",
"=",
"Criteria",
"::",
"INNER_JOIN",
")",
"{",
"return",
"$",
"this",
"->",
"joinApiLog",
"(",
"$",
"relationAlias",
",",
"$",
"joinType",
")",
"->",
"useQuery",
"(",
"$",
"relationAlias",
"?",
"$",
"relationAlias",
":",
"'ApiLog'",
",",
"'\\Slashworks\\AppBundle\\Model\\ApiLogQuery'",
")",
";",
"}"
]
| Use the ApiLog relation ApiLog object
@see useQuery()
@param string $relationAlias optional alias for the relation,
to be used as main alias in the secondary query
@param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
@return \Slashworks\AppBundle\Model\ApiLogQuery A secondary query class using the current class as primary query | [
"Use",
"the",
"ApiLog",
"relation",
"ApiLog",
"object"
]
| 2ba86d96f1f41f9424e2229c4e2b13017e973f89 | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteAppQuery.php#L1240-L1245 |
18,058 | slashworks/control-bundle | src/Slashworks/AppBundle/Model/om/BaseRemoteAppQuery.php | BaseRemoteAppQuery.filterByRemoteHistoryContao | public function filterByRemoteHistoryContao($remoteHistoryContao, $comparison = null)
{
if ($remoteHistoryContao instanceof RemoteHistoryContao) {
return $this
->addUsingAlias(RemoteAppPeer::ID, $remoteHistoryContao->getRemoteAppId(), $comparison);
} elseif ($remoteHistoryContao instanceof PropelObjectCollection) {
return $this
->useRemoteHistoryContaoQuery()
->filterByPrimaryKeys($remoteHistoryContao->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByRemoteHistoryContao() only accepts arguments of type RemoteHistoryContao or PropelCollection');
}
} | php | public function filterByRemoteHistoryContao($remoteHistoryContao, $comparison = null)
{
if ($remoteHistoryContao instanceof RemoteHistoryContao) {
return $this
->addUsingAlias(RemoteAppPeer::ID, $remoteHistoryContao->getRemoteAppId(), $comparison);
} elseif ($remoteHistoryContao instanceof PropelObjectCollection) {
return $this
->useRemoteHistoryContaoQuery()
->filterByPrimaryKeys($remoteHistoryContao->getPrimaryKeys())
->endUse();
} else {
throw new PropelException('filterByRemoteHistoryContao() only accepts arguments of type RemoteHistoryContao or PropelCollection');
}
} | [
"public",
"function",
"filterByRemoteHistoryContao",
"(",
"$",
"remoteHistoryContao",
",",
"$",
"comparison",
"=",
"null",
")",
"{",
"if",
"(",
"$",
"remoteHistoryContao",
"instanceof",
"RemoteHistoryContao",
")",
"{",
"return",
"$",
"this",
"->",
"addUsingAlias",
"(",
"RemoteAppPeer",
"::",
"ID",
",",
"$",
"remoteHistoryContao",
"->",
"getRemoteAppId",
"(",
")",
",",
"$",
"comparison",
")",
";",
"}",
"elseif",
"(",
"$",
"remoteHistoryContao",
"instanceof",
"PropelObjectCollection",
")",
"{",
"return",
"$",
"this",
"->",
"useRemoteHistoryContaoQuery",
"(",
")",
"->",
"filterByPrimaryKeys",
"(",
"$",
"remoteHistoryContao",
"->",
"getPrimaryKeys",
"(",
")",
")",
"->",
"endUse",
"(",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"PropelException",
"(",
"'filterByRemoteHistoryContao() only accepts arguments of type RemoteHistoryContao or PropelCollection'",
")",
";",
"}",
"}"
]
| Filter the query by a related RemoteHistoryContao object
@param RemoteHistoryContao|PropelObjectCollection $remoteHistoryContao the related object to use as filter
@param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
@return RemoteAppQuery The current query, for fluid interface
@throws PropelException - if the provided filter is invalid. | [
"Filter",
"the",
"query",
"by",
"a",
"related",
"RemoteHistoryContao",
"object"
]
| 2ba86d96f1f41f9424e2229c4e2b13017e973f89 | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteAppQuery.php#L1256-L1269 |
18,059 | slashworks/control-bundle | src/Slashworks/AppBundle/Model/om/BaseRemoteAppQuery.php | BaseRemoteAppQuery.useRemoteHistoryContaoQuery | public function useRemoteHistoryContaoQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinRemoteHistoryContao($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'RemoteHistoryContao', '\Slashworks\AppBundle\Model\RemoteHistoryContaoQuery');
} | php | public function useRemoteHistoryContaoQuery($relationAlias = null, $joinType = Criteria::INNER_JOIN)
{
return $this
->joinRemoteHistoryContao($relationAlias, $joinType)
->useQuery($relationAlias ? $relationAlias : 'RemoteHistoryContao', '\Slashworks\AppBundle\Model\RemoteHistoryContaoQuery');
} | [
"public",
"function",
"useRemoteHistoryContaoQuery",
"(",
"$",
"relationAlias",
"=",
"null",
",",
"$",
"joinType",
"=",
"Criteria",
"::",
"INNER_JOIN",
")",
"{",
"return",
"$",
"this",
"->",
"joinRemoteHistoryContao",
"(",
"$",
"relationAlias",
",",
"$",
"joinType",
")",
"->",
"useQuery",
"(",
"$",
"relationAlias",
"?",
"$",
"relationAlias",
":",
"'RemoteHistoryContao'",
",",
"'\\Slashworks\\AppBundle\\Model\\RemoteHistoryContaoQuery'",
")",
";",
"}"
]
| Use the RemoteHistoryContao relation RemoteHistoryContao object
@see useQuery()
@param string $relationAlias optional alias for the relation,
to be used as main alias in the secondary query
@param string $joinType Accepted values are null, 'left join', 'right join', 'inner join'
@return \Slashworks\AppBundle\Model\RemoteHistoryContaoQuery A secondary query class using the current class as primary query | [
"Use",
"the",
"RemoteHistoryContao",
"relation",
"RemoteHistoryContao",
"object"
]
| 2ba86d96f1f41f9424e2229c4e2b13017e973f89 | https://github.com/slashworks/control-bundle/blob/2ba86d96f1f41f9424e2229c4e2b13017e973f89/src/Slashworks/AppBundle/Model/om/BaseRemoteAppQuery.php#L1314-L1319 |
18,060 | praxisnetau/silverware-spam-guard | src/Guards/SimpleSpamGuard.php | SimpleSpamGuard.getFormField | public function getFormField($name = null, $title = null, $value = null)
{
return SimpleSpamGuardField::create($name, $title, $value)->setTimeLimit($this->timeLimit);
} | php | public function getFormField($name = null, $title = null, $value = null)
{
return SimpleSpamGuardField::create($name, $title, $value)->setTimeLimit($this->timeLimit);
} | [
"public",
"function",
"getFormField",
"(",
"$",
"name",
"=",
"null",
",",
"$",
"title",
"=",
"null",
",",
"$",
"value",
"=",
"null",
")",
"{",
"return",
"SimpleSpamGuardField",
"::",
"create",
"(",
"$",
"name",
",",
"$",
"title",
",",
"$",
"value",
")",
"->",
"setTimeLimit",
"(",
"$",
"this",
"->",
"timeLimit",
")",
";",
"}"
]
| Answers the form field used for implementing the spam guard.
@param string $name
@param string $title
@param mixed $value
@return SimpleSpamGuardField | [
"Answers",
"the",
"form",
"field",
"used",
"for",
"implementing",
"the",
"spam",
"guard",
"."
]
| c5f8836a09141bd675173892a1e3d8c8cc8c1886 | https://github.com/praxisnetau/silverware-spam-guard/blob/c5f8836a09141bd675173892a1e3d8c8cc8c1886/src/Guards/SimpleSpamGuard.php#L136-L139 |
18,061 | wikimedia/CLDRPluralRuleParser | src/Converter.php | Converter.doConvert | protected function doConvert() {
$expectOperator = true;
// Iterate through all tokens, saving the operators and operands to a
// stack per Dijkstra's shunting yard algorithm.
/** @var Operator $token */
while ( false !== ( $token = $this->nextToken() ) ) {
// In this grammar, there are only binary operators, so every valid
// rule string will alternate between operator and operand tokens.
$expectOperator = !$expectOperator;
if ( $token instanceof Expression ) {
// Operand
if ( $expectOperator ) {
$token->error( 'unexpected operand' );
}
$this->operands[] = $token;
continue;
} else {
// Operator
if ( !$expectOperator ) {
$token->error( 'unexpected operator' );
}
// Resolve higher precedence levels
$lastOp = end( $this->operators );
while ( $lastOp && self::$precedence[$token->name] <= self::$precedence[$lastOp->name] ) {
$this->doOperation( $lastOp );
array_pop( $this->operators );
$lastOp = end( $this->operators );
}
$this->operators[] = $token;
}
}
// Finish off the stack
while ( $op = array_pop( $this->operators ) ) {
$this->doOperation( $op );
}
// Make sure the result is sane. The first case is possible for an empty
// string input, the second should be unreachable.
if ( !count( $this->operands ) ) {
$this->error( 'condition expected' );
} elseif ( count( $this->operands ) > 1 ) {
$this->error( 'missing operator or too many operands' );
}
$value = $this->operands[0];
if ( $value->type !== 'boolean' ) {
$this->error( 'the result must have a boolean type' );
}
return $this->operands[0]->rpn;
} | php | protected function doConvert() {
$expectOperator = true;
// Iterate through all tokens, saving the operators and operands to a
// stack per Dijkstra's shunting yard algorithm.
/** @var Operator $token */
while ( false !== ( $token = $this->nextToken() ) ) {
// In this grammar, there are only binary operators, so every valid
// rule string will alternate between operator and operand tokens.
$expectOperator = !$expectOperator;
if ( $token instanceof Expression ) {
// Operand
if ( $expectOperator ) {
$token->error( 'unexpected operand' );
}
$this->operands[] = $token;
continue;
} else {
// Operator
if ( !$expectOperator ) {
$token->error( 'unexpected operator' );
}
// Resolve higher precedence levels
$lastOp = end( $this->operators );
while ( $lastOp && self::$precedence[$token->name] <= self::$precedence[$lastOp->name] ) {
$this->doOperation( $lastOp );
array_pop( $this->operators );
$lastOp = end( $this->operators );
}
$this->operators[] = $token;
}
}
// Finish off the stack
while ( $op = array_pop( $this->operators ) ) {
$this->doOperation( $op );
}
// Make sure the result is sane. The first case is possible for an empty
// string input, the second should be unreachable.
if ( !count( $this->operands ) ) {
$this->error( 'condition expected' );
} elseif ( count( $this->operands ) > 1 ) {
$this->error( 'missing operator or too many operands' );
}
$value = $this->operands[0];
if ( $value->type !== 'boolean' ) {
$this->error( 'the result must have a boolean type' );
}
return $this->operands[0]->rpn;
} | [
"protected",
"function",
"doConvert",
"(",
")",
"{",
"$",
"expectOperator",
"=",
"true",
";",
"// Iterate through all tokens, saving the operators and operands to a",
"// stack per Dijkstra's shunting yard algorithm.",
"/** @var Operator $token */",
"while",
"(",
"false",
"!==",
"(",
"$",
"token",
"=",
"$",
"this",
"->",
"nextToken",
"(",
")",
")",
")",
"{",
"// In this grammar, there are only binary operators, so every valid",
"// rule string will alternate between operator and operand tokens.",
"$",
"expectOperator",
"=",
"!",
"$",
"expectOperator",
";",
"if",
"(",
"$",
"token",
"instanceof",
"Expression",
")",
"{",
"// Operand",
"if",
"(",
"$",
"expectOperator",
")",
"{",
"$",
"token",
"->",
"error",
"(",
"'unexpected operand'",
")",
";",
"}",
"$",
"this",
"->",
"operands",
"[",
"]",
"=",
"$",
"token",
";",
"continue",
";",
"}",
"else",
"{",
"// Operator",
"if",
"(",
"!",
"$",
"expectOperator",
")",
"{",
"$",
"token",
"->",
"error",
"(",
"'unexpected operator'",
")",
";",
"}",
"// Resolve higher precedence levels",
"$",
"lastOp",
"=",
"end",
"(",
"$",
"this",
"->",
"operators",
")",
";",
"while",
"(",
"$",
"lastOp",
"&&",
"self",
"::",
"$",
"precedence",
"[",
"$",
"token",
"->",
"name",
"]",
"<=",
"self",
"::",
"$",
"precedence",
"[",
"$",
"lastOp",
"->",
"name",
"]",
")",
"{",
"$",
"this",
"->",
"doOperation",
"(",
"$",
"lastOp",
")",
";",
"array_pop",
"(",
"$",
"this",
"->",
"operators",
")",
";",
"$",
"lastOp",
"=",
"end",
"(",
"$",
"this",
"->",
"operators",
")",
";",
"}",
"$",
"this",
"->",
"operators",
"[",
"]",
"=",
"$",
"token",
";",
"}",
"}",
"// Finish off the stack",
"while",
"(",
"$",
"op",
"=",
"array_pop",
"(",
"$",
"this",
"->",
"operators",
")",
")",
"{",
"$",
"this",
"->",
"doOperation",
"(",
"$",
"op",
")",
";",
"}",
"// Make sure the result is sane. The first case is possible for an empty",
"// string input, the second should be unreachable.",
"if",
"(",
"!",
"count",
"(",
"$",
"this",
"->",
"operands",
")",
")",
"{",
"$",
"this",
"->",
"error",
"(",
"'condition expected'",
")",
";",
"}",
"elseif",
"(",
"count",
"(",
"$",
"this",
"->",
"operands",
")",
">",
"1",
")",
"{",
"$",
"this",
"->",
"error",
"(",
"'missing operator or too many operands'",
")",
";",
"}",
"$",
"value",
"=",
"$",
"this",
"->",
"operands",
"[",
"0",
"]",
";",
"if",
"(",
"$",
"value",
"->",
"type",
"!==",
"'boolean'",
")",
"{",
"$",
"this",
"->",
"error",
"(",
"'the result must have a boolean type'",
")",
";",
"}",
"return",
"$",
"this",
"->",
"operands",
"[",
"0",
"]",
"->",
"rpn",
";",
"}"
]
| Do the operation.
@return string The RPN representation of the rule (e.g. "5 3 mod n is") | [
"Do",
"the",
"operation",
"."
]
| 4c5d71a3fd62a75871da8562310ca2258647ee6d | https://github.com/wikimedia/CLDRPluralRuleParser/blob/4c5d71a3fd62a75871da8562310ca2258647ee6d/src/Converter.php#L121-L174 |
18,062 | parsnick/steak | src/Build/Publishers/Compile.php | Compile.write | protected function write($destination, $content)
{
$directory = dirname($destination);
if ( ! $this->files->exists($directory)) {
$this->files->makeDirectory($directory, 0755, true);
}
return (bool) $this->files->put($destination, $content);
} | php | protected function write($destination, $content)
{
$directory = dirname($destination);
if ( ! $this->files->exists($directory)) {
$this->files->makeDirectory($directory, 0755, true);
}
return (bool) $this->files->put($destination, $content);
} | [
"protected",
"function",
"write",
"(",
"$",
"destination",
",",
"$",
"content",
")",
"{",
"$",
"directory",
"=",
"dirname",
"(",
"$",
"destination",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"files",
"->",
"exists",
"(",
"$",
"directory",
")",
")",
"{",
"$",
"this",
"->",
"files",
"->",
"makeDirectory",
"(",
"$",
"directory",
",",
"0755",
",",
"true",
")",
";",
"}",
"return",
"(",
"bool",
")",
"$",
"this",
"->",
"files",
"->",
"put",
"(",
"$",
"destination",
",",
"$",
"content",
")",
";",
"}"
]
| Write file contents, creating any necessary subdirectories.
@param string $destination
@param string $content
@return bool | [
"Write",
"file",
"contents",
"creating",
"any",
"necessary",
"subdirectories",
"."
]
| 461869189a640938438187330f6c50aca97c5ccc | https://github.com/parsnick/steak/blob/461869189a640938438187330f6c50aca97c5ccc/src/Build/Publishers/Compile.php#L87-L96 |
18,063 | vorbind/influx-analytics | src/Mapper/ImportMysqlMapper.php | ImportMysqlMapper.getRows | public function getRows($query) {
try {
$stmt = $this->db->query($query);
return $stmt->fetchAll(PDO::FETCH_ASSOC);
} catch (Exception $e) {
return [];
}
} | php | public function getRows($query) {
try {
$stmt = $this->db->query($query);
return $stmt->fetchAll(PDO::FETCH_ASSOC);
} catch (Exception $e) {
return [];
}
} | [
"public",
"function",
"getRows",
"(",
"$",
"query",
")",
"{",
"try",
"{",
"$",
"stmt",
"=",
"$",
"this",
"->",
"db",
"->",
"query",
"(",
"$",
"query",
")",
";",
"return",
"$",
"stmt",
"->",
"fetchAll",
"(",
"PDO",
"::",
"FETCH_ASSOC",
")",
";",
"}",
"catch",
"(",
"Exception",
"$",
"e",
")",
"{",
"return",
"[",
"]",
";",
"}",
"}"
]
| Get rows of data by query
@param string $query | [
"Get",
"rows",
"of",
"data",
"by",
"query"
]
| 8c0c150351f045ccd3d57063f2b3b50a2c926e3e | https://github.com/vorbind/influx-analytics/blob/8c0c150351f045ccd3d57063f2b3b50a2c926e3e/src/Mapper/ImportMysqlMapper.php#L46-L53 |
18,064 | parsnick/steak | src/Console/DeployCommand.php | DeployCommand.prepareRepository | protected function prepareRepository()
{
$config = $this->container['config'];
$this->builder->clean($config['build.directory']); // clear out everything, including .git metadata
$workingCopy = $this->git->workingCopy($config['build.directory']);
$this->doGitInit($workingCopy, $config['deploy.git.url'], $config['deploy.git.branch']); // start again at last commit
$this->builder->clean($config['build.directory'], true); // clear the old content but keep .git folder
return $workingCopy;
} | php | protected function prepareRepository()
{
$config = $this->container['config'];
$this->builder->clean($config['build.directory']); // clear out everything, including .git metadata
$workingCopy = $this->git->workingCopy($config['build.directory']);
$this->doGitInit($workingCopy, $config['deploy.git.url'], $config['deploy.git.branch']); // start again at last commit
$this->builder->clean($config['build.directory'], true); // clear the old content but keep .git folder
return $workingCopy;
} | [
"protected",
"function",
"prepareRepository",
"(",
")",
"{",
"$",
"config",
"=",
"$",
"this",
"->",
"container",
"[",
"'config'",
"]",
";",
"$",
"this",
"->",
"builder",
"->",
"clean",
"(",
"$",
"config",
"[",
"'build.directory'",
"]",
")",
";",
"// clear out everything, including .git metadata",
"$",
"workingCopy",
"=",
"$",
"this",
"->",
"git",
"->",
"workingCopy",
"(",
"$",
"config",
"[",
"'build.directory'",
"]",
")",
";",
"$",
"this",
"->",
"doGitInit",
"(",
"$",
"workingCopy",
",",
"$",
"config",
"[",
"'deploy.git.url'",
"]",
",",
"$",
"config",
"[",
"'deploy.git.branch'",
"]",
")",
";",
"// start again at last commit",
"$",
"this",
"->",
"builder",
"->",
"clean",
"(",
"$",
"config",
"[",
"'build.directory'",
"]",
",",
"true",
")",
";",
"// clear the old content but keep .git folder",
"return",
"$",
"workingCopy",
";",
"}"
]
| Prepare the build directory as a git repository.
Maybe there's already a git repo in the build folder, but is it pointing to
the correct origin and is it on the correct branch? Instead of checking for
things that might be wrong, we'll just start from scratch.
@returns GitWorkingCopy
@throws RuntimeException | [
"Prepare",
"the",
"build",
"directory",
"as",
"a",
"git",
"repository",
"."
]
| 461869189a640938438187330f6c50aca97c5ccc | https://github.com/parsnick/steak/blob/461869189a640938438187330f6c50aca97c5ccc/src/Console/DeployCommand.php#L87-L100 |
18,065 | parsnick/steak | src/Console/DeployCommand.php | DeployCommand.doGitInit | protected function doGitInit(GitWorkingCopy $workingCopy, $url, $branch)
{
$workingCopy->init();
$workingCopy->remote('add', 'origin', $url);
try {
$this->output->writeln("Attempting to fetch <path>origin/{$branch}</path>", OutputInterface::VERBOSITY_VERBOSE);
$workingCopy
->fetch('origin', $branch)
->checkout('-f', $branch);
} catch (GitException $exception) {
$this->output->writeln("Fetch failed, creating new branch instead", OutputInterface::VERBOSITY_VERBOSE);
$workingCopy
->checkout('--orphan', $branch)
->run(['commit', '--allow-empty', '-m', "Branch created by steak"])
->push('-u', 'origin', $branch);
}
return $workingCopy->clearOutput();
} | php | protected function doGitInit(GitWorkingCopy $workingCopy, $url, $branch)
{
$workingCopy->init();
$workingCopy->remote('add', 'origin', $url);
try {
$this->output->writeln("Attempting to fetch <path>origin/{$branch}</path>", OutputInterface::VERBOSITY_VERBOSE);
$workingCopy
->fetch('origin', $branch)
->checkout('-f', $branch);
} catch (GitException $exception) {
$this->output->writeln("Fetch failed, creating new branch instead", OutputInterface::VERBOSITY_VERBOSE);
$workingCopy
->checkout('--orphan', $branch)
->run(['commit', '--allow-empty', '-m', "Branch created by steak"])
->push('-u', 'origin', $branch);
}
return $workingCopy->clearOutput();
} | [
"protected",
"function",
"doGitInit",
"(",
"GitWorkingCopy",
"$",
"workingCopy",
",",
"$",
"url",
",",
"$",
"branch",
")",
"{",
"$",
"workingCopy",
"->",
"init",
"(",
")",
";",
"$",
"workingCopy",
"->",
"remote",
"(",
"'add'",
",",
"'origin'",
",",
"$",
"url",
")",
";",
"try",
"{",
"$",
"this",
"->",
"output",
"->",
"writeln",
"(",
"\"Attempting to fetch <path>origin/{$branch}</path>\"",
",",
"OutputInterface",
"::",
"VERBOSITY_VERBOSE",
")",
";",
"$",
"workingCopy",
"->",
"fetch",
"(",
"'origin'",
",",
"$",
"branch",
")",
"->",
"checkout",
"(",
"'-f'",
",",
"$",
"branch",
")",
";",
"}",
"catch",
"(",
"GitException",
"$",
"exception",
")",
"{",
"$",
"this",
"->",
"output",
"->",
"writeln",
"(",
"\"Fetch failed, creating new branch instead\"",
",",
"OutputInterface",
"::",
"VERBOSITY_VERBOSE",
")",
";",
"$",
"workingCopy",
"->",
"checkout",
"(",
"'--orphan'",
",",
"$",
"branch",
")",
"->",
"run",
"(",
"[",
"'commit'",
",",
"'--allow-empty'",
",",
"'-m'",
",",
"\"Branch created by steak\"",
"]",
")",
"->",
"push",
"(",
"'-u'",
",",
"'origin'",
",",
"$",
"branch",
")",
";",
"}",
"return",
"$",
"workingCopy",
"->",
"clearOutput",
"(",
")",
";",
"}"
]
| Set up the git repository for our build.
@param GitWorkingCopy $workingCopy
@param string $url
@param string $branch
@return mixed | [
"Set",
"up",
"the",
"git",
"repository",
"for",
"our",
"build",
"."
]
| 461869189a640938438187330f6c50aca97c5ccc | https://github.com/parsnick/steak/blob/461869189a640938438187330f6c50aca97c5ccc/src/Console/DeployCommand.php#L110-L135 |
18,066 | parsnick/steak | src/Console/DeployCommand.php | DeployCommand.rebuild | protected function rebuild()
{
$command = $this->getApplication()->find('build');
$input = new ArrayInput([
'--no-clean' => true,
]);
return $command->run($input, $this->output) === 0;
} | php | protected function rebuild()
{
$command = $this->getApplication()->find('build');
$input = new ArrayInput([
'--no-clean' => true,
]);
return $command->run($input, $this->output) === 0;
} | [
"protected",
"function",
"rebuild",
"(",
")",
"{",
"$",
"command",
"=",
"$",
"this",
"->",
"getApplication",
"(",
")",
"->",
"find",
"(",
"'build'",
")",
";",
"$",
"input",
"=",
"new",
"ArrayInput",
"(",
"[",
"'--no-clean'",
"=>",
"true",
",",
"]",
")",
";",
"return",
"$",
"command",
"->",
"run",
"(",
"$",
"input",
",",
"$",
"this",
"->",
"output",
")",
"===",
"0",
";",
"}"
]
| Delegate to the build command to rebuild the site.
@return bool | [
"Delegate",
"to",
"the",
"build",
"command",
"to",
"rebuild",
"the",
"site",
"."
]
| 461869189a640938438187330f6c50aca97c5ccc | https://github.com/parsnick/steak/blob/461869189a640938438187330f6c50aca97c5ccc/src/Console/DeployCommand.php#L142-L151 |
18,067 | parsnick/steak | src/Console/DeployCommand.php | DeployCommand.deployWithGit | protected function deployWithGit(GitWorkingCopy $workingCopy)
{
if ( ! $workingCopy->hasChanges()) {
return $this->output->writeln('<comment>No changes to deploy!</comment>');
}
$this->output->writeln('<info>Ready to deploy changes:</info>');
$this->output->write($workingCopy->getStatus());
if ( ! $this->input->getOption('force')) {
if ( ! $this->askForChangesConfirmation($workingCopy)) {
return $this->output->writeln('<error>Aborted!</error>');
}
}
$this->output->writeln('<info>Deploying...</info>');
$this->output->write(
$workingCopy->add('.')->commit($this->getCommitMessage())->push()->getOutput(),
OutputInterface::VERBOSITY_VERBOSE
);
} | php | protected function deployWithGit(GitWorkingCopy $workingCopy)
{
if ( ! $workingCopy->hasChanges()) {
return $this->output->writeln('<comment>No changes to deploy!</comment>');
}
$this->output->writeln('<info>Ready to deploy changes:</info>');
$this->output->write($workingCopy->getStatus());
if ( ! $this->input->getOption('force')) {
if ( ! $this->askForChangesConfirmation($workingCopy)) {
return $this->output->writeln('<error>Aborted!</error>');
}
}
$this->output->writeln('<info>Deploying...</info>');
$this->output->write(
$workingCopy->add('.')->commit($this->getCommitMessage())->push()->getOutput(),
OutputInterface::VERBOSITY_VERBOSE
);
} | [
"protected",
"function",
"deployWithGit",
"(",
"GitWorkingCopy",
"$",
"workingCopy",
")",
"{",
"if",
"(",
"!",
"$",
"workingCopy",
"->",
"hasChanges",
"(",
")",
")",
"{",
"return",
"$",
"this",
"->",
"output",
"->",
"writeln",
"(",
"'<comment>No changes to deploy!</comment>'",
")",
";",
"}",
"$",
"this",
"->",
"output",
"->",
"writeln",
"(",
"'<info>Ready to deploy changes:</info>'",
")",
";",
"$",
"this",
"->",
"output",
"->",
"write",
"(",
"$",
"workingCopy",
"->",
"getStatus",
"(",
")",
")",
";",
"if",
"(",
"!",
"$",
"this",
"->",
"input",
"->",
"getOption",
"(",
"'force'",
")",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"askForChangesConfirmation",
"(",
"$",
"workingCopy",
")",
")",
"{",
"return",
"$",
"this",
"->",
"output",
"->",
"writeln",
"(",
"'<error>Aborted!</error>'",
")",
";",
"}",
"}",
"$",
"this",
"->",
"output",
"->",
"writeln",
"(",
"'<info>Deploying...</info>'",
")",
";",
"$",
"this",
"->",
"output",
"->",
"write",
"(",
"$",
"workingCopy",
"->",
"add",
"(",
"'.'",
")",
"->",
"commit",
"(",
"$",
"this",
"->",
"getCommitMessage",
"(",
")",
")",
"->",
"push",
"(",
")",
"->",
"getOutput",
"(",
")",
",",
"OutputInterface",
"::",
"VERBOSITY_VERBOSE",
")",
";",
"}"
]
| Deploy the current contents of our working copy.
@param GitWorkingCopy $workingCopy | [
"Deploy",
"the",
"current",
"contents",
"of",
"our",
"working",
"copy",
"."
]
| 461869189a640938438187330f6c50aca97c5ccc | https://github.com/parsnick/steak/blob/461869189a640938438187330f6c50aca97c5ccc/src/Console/DeployCommand.php#L158-L179 |
18,068 | parsnick/steak | src/Console/DeployCommand.php | DeployCommand.askForChangesConfirmation | protected function askForChangesConfirmation(GitWorkingCopy $workingCopy)
{
$deployTo = "{$this->container['config']['deploy.git.url']}#{$this->container['config']['deploy.git.branch']}";
$confirm = new ConfirmationQuestion("<comment>Commit all and push to <path>{$deployTo}</path>?</comment> [Yn] ");
return $this->getHelper('question')->ask($this->input, $this->output, $confirm);
} | php | protected function askForChangesConfirmation(GitWorkingCopy $workingCopy)
{
$deployTo = "{$this->container['config']['deploy.git.url']}#{$this->container['config']['deploy.git.branch']}";
$confirm = new ConfirmationQuestion("<comment>Commit all and push to <path>{$deployTo}</path>?</comment> [Yn] ");
return $this->getHelper('question')->ask($this->input, $this->output, $confirm);
} | [
"protected",
"function",
"askForChangesConfirmation",
"(",
"GitWorkingCopy",
"$",
"workingCopy",
")",
"{",
"$",
"deployTo",
"=",
"\"{$this->container['config']['deploy.git.url']}#{$this->container['config']['deploy.git.branch']}\"",
";",
"$",
"confirm",
"=",
"new",
"ConfirmationQuestion",
"(",
"\"<comment>Commit all and push to <path>{$deployTo}</path>?</comment> [Yn] \"",
")",
";",
"return",
"$",
"this",
"->",
"getHelper",
"(",
"'question'",
")",
"->",
"ask",
"(",
"$",
"this",
"->",
"input",
",",
"$",
"this",
"->",
"output",
",",
"$",
"confirm",
")",
";",
"}"
]
| Ask user to confirm changes listed by git status.
@param GitWorkingCopy $workingCopy
@return bool | [
"Ask",
"user",
"to",
"confirm",
"changes",
"listed",
"by",
"git",
"status",
"."
]
| 461869189a640938438187330f6c50aca97c5ccc | https://github.com/parsnick/steak/blob/461869189a640938438187330f6c50aca97c5ccc/src/Console/DeployCommand.php#L187-L194 |
18,069 | stanislav-web/phalcon-ulogin | src/ULogin/Auth.php | Auth.hasSession | private function hasSession() {
if(DI::getDefault()->has('session') === true) {
// get instance of session class
$this->session = DI::getDefault()->getSession();
if($this->session->getId() === '') {
$this->session->start();
}
return true;
}
return false;
} | php | private function hasSession() {
if(DI::getDefault()->has('session') === true) {
// get instance of session class
$this->session = DI::getDefault()->getSession();
if($this->session->getId() === '') {
$this->session->start();
}
return true;
}
return false;
} | [
"private",
"function",
"hasSession",
"(",
")",
"{",
"if",
"(",
"DI",
"::",
"getDefault",
"(",
")",
"->",
"has",
"(",
"'session'",
")",
"===",
"true",
")",
"{",
"// get instance of session class",
"$",
"this",
"->",
"session",
"=",
"DI",
"::",
"getDefault",
"(",
")",
"->",
"getSession",
"(",
")",
";",
"if",
"(",
"$",
"this",
"->",
"session",
"->",
"getId",
"(",
")",
"===",
"''",
")",
"{",
"$",
"this",
"->",
"session",
"->",
"start",
"(",
")",
";",
"}",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
]
| Check if \Phalcon\Di has session service
@return bool | [
"Check",
"if",
"\\",
"Phalcon",
"\\",
"Di",
"has",
"session",
"service"
]
| 0cea8510a244ebb9b1333085b325a283e4fb9f2f | https://github.com/stanislav-web/phalcon-ulogin/blob/0cea8510a244ebb9b1333085b325a283e4fb9f2f/src/ULogin/Auth.php#L63-L78 |
18,070 | titon/db | src/Titon/Db/Driver/Dialect/Statement.php | Statement.render | public function render(array $params = []) {
return trim(String::insert($this->getStatement(), $params + $this->getParams(), ['escape' => false])) . ';';
} | php | public function render(array $params = []) {
return trim(String::insert($this->getStatement(), $params + $this->getParams(), ['escape' => false])) . ';';
} | [
"public",
"function",
"render",
"(",
"array",
"$",
"params",
"=",
"[",
"]",
")",
"{",
"return",
"trim",
"(",
"String",
"::",
"insert",
"(",
"$",
"this",
"->",
"getStatement",
"(",
")",
",",
"$",
"params",
"+",
"$",
"this",
"->",
"getParams",
"(",
")",
",",
"[",
"'escape'",
"=>",
"false",
"]",
")",
")",
".",
"';'",
";",
"}"
]
| Render the statement by injecting custom parameters.
Merge with the default parameters to fill in any missing keys.
@param array $params
@return string | [
"Render",
"the",
"statement",
"by",
"injecting",
"custom",
"parameters",
".",
"Merge",
"with",
"the",
"default",
"parameters",
"to",
"fill",
"in",
"any",
"missing",
"keys",
"."
]
| fbc5159d1ce9d2139759c9367565986981485604 | https://github.com/titon/db/blob/fbc5159d1ce9d2139759c9367565986981485604/src/Titon/Db/Driver/Dialect/Statement.php#L75-L77 |
18,071 | javiacei/IdeupSimplePaginatorBundle | Paginator/Paginator.php | Paginator.setFallbackValues | private function setFallbackValues()
{
$hash = md5(null);
$this->currentPage[$hash] = 0;
$this->itemsPerPage[$hash] = 10;
$this->maxPagerItems[$hash] = 3;
$this->totalItems[$hash] = 0;
} | php | private function setFallbackValues()
{
$hash = md5(null);
$this->currentPage[$hash] = 0;
$this->itemsPerPage[$hash] = 10;
$this->maxPagerItems[$hash] = 3;
$this->totalItems[$hash] = 0;
} | [
"private",
"function",
"setFallbackValues",
"(",
")",
"{",
"$",
"hash",
"=",
"md5",
"(",
"null",
")",
";",
"$",
"this",
"->",
"currentPage",
"[",
"$",
"hash",
"]",
"=",
"0",
";",
"$",
"this",
"->",
"itemsPerPage",
"[",
"$",
"hash",
"]",
"=",
"10",
";",
"$",
"this",
"->",
"maxPagerItems",
"[",
"$",
"hash",
"]",
"=",
"3",
";",
"$",
"this",
"->",
"totalItems",
"[",
"$",
"hash",
"]",
"=",
"0",
";",
"}"
]
| Sets default values
@return void | [
"Sets",
"default",
"values"
]
| 12639a9c75bc403649fc2b2881e190a017d8c5b2 | https://github.com/javiacei/IdeupSimplePaginatorBundle/blob/12639a9c75bc403649fc2b2881e190a017d8c5b2/Paginator/Paginator.php#L71-L78 |
18,072 | javiacei/IdeupSimplePaginatorBundle | Paginator/Paginator.php | Paginator.getTotalItems | public function getTotalItems($id = null)
{
$hash = md5($id);
return isset($this->totalItems[$hash]) ? $this->totalItems[$hash] : 0;
} | php | public function getTotalItems($id = null)
{
$hash = md5($id);
return isset($this->totalItems[$hash]) ? $this->totalItems[$hash] : 0;
} | [
"public",
"function",
"getTotalItems",
"(",
"$",
"id",
"=",
"null",
")",
"{",
"$",
"hash",
"=",
"md5",
"(",
"$",
"id",
")",
";",
"return",
"isset",
"(",
"$",
"this",
"->",
"totalItems",
"[",
"$",
"hash",
"]",
")",
"?",
"$",
"this",
"->",
"totalItems",
"[",
"$",
"hash",
"]",
":",
"0",
";",
"}"
]
| Get the total items in the non-paginated version of the query
@param string $id
@return int | [
"Get",
"the",
"total",
"items",
"in",
"the",
"non",
"-",
"paginated",
"version",
"of",
"the",
"query"
]
| 12639a9c75bc403649fc2b2881e190a017d8c5b2 | https://github.com/javiacei/IdeupSimplePaginatorBundle/blob/12639a9c75bc403649fc2b2881e190a017d8c5b2/Paginator/Paginator.php#L241-L245 |
18,073 | javiacei/IdeupSimplePaginatorBundle | Paginator/Paginator.php | Paginator.getLastPage | public function getLastPage($id = null)
{
$totalItems = ($this->getTotalItems($id) > 0) ? $this->getTotalItems($id) : 1;
return (int)ceil($totalItems / $this->getItemsPerPage($id));
} | php | public function getLastPage($id = null)
{
$totalItems = ($this->getTotalItems($id) > 0) ? $this->getTotalItems($id) : 1;
return (int)ceil($totalItems / $this->getItemsPerPage($id));
} | [
"public",
"function",
"getLastPage",
"(",
"$",
"id",
"=",
"null",
")",
"{",
"$",
"totalItems",
"=",
"(",
"$",
"this",
"->",
"getTotalItems",
"(",
"$",
"id",
")",
">",
"0",
")",
"?",
"$",
"this",
"->",
"getTotalItems",
"(",
"$",
"id",
")",
":",
"1",
";",
"return",
"(",
"int",
")",
"ceil",
"(",
"$",
"totalItems",
"/",
"$",
"this",
"->",
"getItemsPerPage",
"(",
"$",
"id",
")",
")",
";",
"}"
]
| Gets the last page number
@param string $id
@return int | [
"Gets",
"the",
"last",
"page",
"number"
]
| 12639a9c75bc403649fc2b2881e190a017d8c5b2 | https://github.com/javiacei/IdeupSimplePaginatorBundle/blob/12639a9c75bc403649fc2b2881e190a017d8c5b2/Paginator/Paginator.php#L253-L257 |
18,074 | ClanCats/Core | src/bundles/Session/Manager.php | Manager.default_data_provider | public static function default_data_provider()
{
return array(
'last_active' => time(),
'current_lang' => \CCLang::current(),
'client_agent' => \CCServer::client( 'agent' ),
'client_ip' => \CCServer::client( 'ip' ),
'client_port' => \CCServer::client( 'port' ),
'client_lang' => \CCServer::client( 'language' ),
);
} | php | public static function default_data_provider()
{
return array(
'last_active' => time(),
'current_lang' => \CCLang::current(),
'client_agent' => \CCServer::client( 'agent' ),
'client_ip' => \CCServer::client( 'ip' ),
'client_port' => \CCServer::client( 'port' ),
'client_lang' => \CCServer::client( 'language' ),
);
} | [
"public",
"static",
"function",
"default_data_provider",
"(",
")",
"{",
"return",
"array",
"(",
"'last_active'",
"=>",
"time",
"(",
")",
",",
"'current_lang'",
"=>",
"\\",
"CCLang",
"::",
"current",
"(",
")",
",",
"'client_agent'",
"=>",
"\\",
"CCServer",
"::",
"client",
"(",
"'agent'",
")",
",",
"'client_ip'",
"=>",
"\\",
"CCServer",
"::",
"client",
"(",
"'ip'",
")",
",",
"'client_port'",
"=>",
"\\",
"CCServer",
"::",
"client",
"(",
"'port'",
")",
",",
"'client_lang'",
"=>",
"\\",
"CCServer",
"::",
"client",
"(",
"'language'",
")",
",",
")",
";",
"}"
]
| Some default values for our session
@return array | [
"Some",
"default",
"values",
"for",
"our",
"session"
]
| 9f6ec72c1a439de4b253d0223f1029f7f85b6ef8 | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Session/Manager.php#L60-L70 |
18,075 | ClanCats/Core | src/bundles/Session/Manager.php | Manager.valid_fingerprint | public function valid_fingerprint( $fingerprint = null )
{
if ( is_null( $fingerprint ) )
{
$fingerprint = \CCIn::get( \ClanCats::$config->get( 'session.default_fingerprint_parameter' ), false );
}
return $this->fingerprint === $fingerprint;
} | php | public function valid_fingerprint( $fingerprint = null )
{
if ( is_null( $fingerprint ) )
{
$fingerprint = \CCIn::get( \ClanCats::$config->get( 'session.default_fingerprint_parameter' ), false );
}
return $this->fingerprint === $fingerprint;
} | [
"public",
"function",
"valid_fingerprint",
"(",
"$",
"fingerprint",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"fingerprint",
")",
")",
"{",
"$",
"fingerprint",
"=",
"\\",
"CCIn",
"::",
"get",
"(",
"\\",
"ClanCats",
"::",
"$",
"config",
"->",
"get",
"(",
"'session.default_fingerprint_parameter'",
")",
",",
"false",
")",
";",
"}",
"return",
"$",
"this",
"->",
"fingerprint",
"===",
"$",
"fingerprint",
";",
"}"
]
| Does the current session fingerprint match a parameter
When no parameter is given we use GET->s as default parameter
@param string $fingerprint
@return string | [
"Does",
"the",
"current",
"session",
"fingerprint",
"match",
"a",
"parameter"
]
| 9f6ec72c1a439de4b253d0223f1029f7f85b6ef8 | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Session/Manager.php#L247-L255 |
18,076 | ClanCats/Core | src/bundles/Session/Manager.php | Manager.once | public function once( $key, $default = null )
{
$value = \CCArr::get( $key, $this->_data, $default );
\CCArr::delete( $key, $this->_data );
return $value;
} | php | public function once( $key, $default = null )
{
$value = \CCArr::get( $key, $this->_data, $default );
\CCArr::delete( $key, $this->_data );
return $value;
} | [
"public",
"function",
"once",
"(",
"$",
"key",
",",
"$",
"default",
"=",
"null",
")",
"{",
"$",
"value",
"=",
"\\",
"CCArr",
"::",
"get",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"_data",
",",
"$",
"default",
")",
";",
"\\",
"CCArr",
"::",
"delete",
"(",
"$",
"key",
",",
"$",
"this",
"->",
"_data",
")",
";",
"return",
"$",
"value",
";",
"}"
]
| Get a value from data and remove it afterwards
@param string $key
@param mixed $default
@return mixed | [
"Get",
"a",
"value",
"from",
"data",
"and",
"remove",
"it",
"afterwards"
]
| 9f6ec72c1a439de4b253d0223f1029f7f85b6ef8 | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Session/Manager.php#L264-L269 |
18,077 | ClanCats/Core | src/bundles/Session/Manager.php | Manager.read | public function read()
{
// Do we already have a session id if not we regenerate
// the session and assign the default data.
if ( $this->id )
{
if ( !$this->_data = $this->_driver->read( $this->id ) )
{
$this->regenerate();
$this->_data = array();
}
if ( !is_array( $this->_data ) )
{
$this->_data = array();
}
$this->_data = array_merge( $this->_data, $this->default_data() );
}
else
{
$this->regenerate();
$this->_data = $this->default_data();
}
} | php | public function read()
{
// Do we already have a session id if not we regenerate
// the session and assign the default data.
if ( $this->id )
{
if ( !$this->_data = $this->_driver->read( $this->id ) )
{
$this->regenerate();
$this->_data = array();
}
if ( !is_array( $this->_data ) )
{
$this->_data = array();
}
$this->_data = array_merge( $this->_data, $this->default_data() );
}
else
{
$this->regenerate();
$this->_data = $this->default_data();
}
} | [
"public",
"function",
"read",
"(",
")",
"{",
"// Do we already have a session id if not we regenerate",
"// the session and assign the default data.",
"if",
"(",
"$",
"this",
"->",
"id",
")",
"{",
"if",
"(",
"!",
"$",
"this",
"->",
"_data",
"=",
"$",
"this",
"->",
"_driver",
"->",
"read",
"(",
"$",
"this",
"->",
"id",
")",
")",
"{",
"$",
"this",
"->",
"regenerate",
"(",
")",
";",
"$",
"this",
"->",
"_data",
"=",
"array",
"(",
")",
";",
"}",
"if",
"(",
"!",
"is_array",
"(",
"$",
"this",
"->",
"_data",
")",
")",
"{",
"$",
"this",
"->",
"_data",
"=",
"array",
"(",
")",
";",
"}",
"$",
"this",
"->",
"_data",
"=",
"array_merge",
"(",
"$",
"this",
"->",
"_data",
",",
"$",
"this",
"->",
"default_data",
"(",
")",
")",
";",
"}",
"else",
"{",
"$",
"this",
"->",
"regenerate",
"(",
")",
";",
"$",
"this",
"->",
"_data",
"=",
"$",
"this",
"->",
"default_data",
"(",
")",
";",
"}",
"}"
]
| Read data from the session driver. This overwrite's
any changes made on runtime.
@return void | [
"Read",
"data",
"from",
"the",
"session",
"driver",
".",
"This",
"overwrite",
"s",
"any",
"changes",
"made",
"on",
"runtime",
"."
]
| 9f6ec72c1a439de4b253d0223f1029f7f85b6ef8 | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Session/Manager.php#L277-L301 |
18,078 | ClanCats/Core | src/bundles/Session/Manager.php | Manager.write | public function write()
{
$this->_driver->write( $this->id, $this->_data );
// We also have to set the cookie again to keep it alive
\CCCookie::set( $this->cookie_name(), $this->id, \CCArr::get( 'lifetime', $this->_config, \CCDate::minutes( 5 ) ) );
} | php | public function write()
{
$this->_driver->write( $this->id, $this->_data );
// We also have to set the cookie again to keep it alive
\CCCookie::set( $this->cookie_name(), $this->id, \CCArr::get( 'lifetime', $this->_config, \CCDate::minutes( 5 ) ) );
} | [
"public",
"function",
"write",
"(",
")",
"{",
"$",
"this",
"->",
"_driver",
"->",
"write",
"(",
"$",
"this",
"->",
"id",
",",
"$",
"this",
"->",
"_data",
")",
";",
"// We also have to set the cookie again to keep it alive",
"\\",
"CCCookie",
"::",
"set",
"(",
"$",
"this",
"->",
"cookie_name",
"(",
")",
",",
"$",
"this",
"->",
"id",
",",
"\\",
"CCArr",
"::",
"get",
"(",
"'lifetime'",
",",
"$",
"this",
"->",
"_config",
",",
"\\",
"CCDate",
"::",
"minutes",
"(",
"5",
")",
")",
")",
";",
"}"
]
| Write the session to the driver
@return void | [
"Write",
"the",
"session",
"to",
"the",
"driver"
]
| 9f6ec72c1a439de4b253d0223f1029f7f85b6ef8 | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Session/Manager.php#L308-L314 |
18,079 | ClanCats/Core | src/bundles/Session/Manager.php | Manager.regenerate | public function regenerate()
{
do
{
$id = \CCStr::random( 32 );
}
while ( $this->_driver->has( $id ) );
$this->fingerprint = sha1( $id );
return $this->id = $id;
} | php | public function regenerate()
{
do
{
$id = \CCStr::random( 32 );
}
while ( $this->_driver->has( $id ) );
$this->fingerprint = sha1( $id );
return $this->id = $id;
} | [
"public",
"function",
"regenerate",
"(",
")",
"{",
"do",
"{",
"$",
"id",
"=",
"\\",
"CCStr",
"::",
"random",
"(",
"32",
")",
";",
"}",
"while",
"(",
"$",
"this",
"->",
"_driver",
"->",
"has",
"(",
"$",
"id",
")",
")",
";",
"$",
"this",
"->",
"fingerprint",
"=",
"sha1",
"(",
"$",
"id",
")",
";",
"return",
"$",
"this",
"->",
"id",
"=",
"$",
"id",
";",
"}"
]
| Generate a new session id and checks the dirver for dublicates.
@return string The new generated session id. | [
"Generate",
"a",
"new",
"session",
"id",
"and",
"checks",
"the",
"dirver",
"for",
"dublicates",
"."
]
| 9f6ec72c1a439de4b253d0223f1029f7f85b6ef8 | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Session/Manager.php#L321-L331 |
18,080 | ClanCats/Core | src/bundles/Session/Manager.php | Manager.gc | public function gc()
{
$lifetime = \CCArr::get( 'lifetime', $this->_config, \CCDate::minutes( 5 ) );
if ( $lifetime < ( $min_lifetime = \CCArr::get( 'min_lifetime', $this->_config, \CCDate::minutes( 5 ) ) ) )
{
$lifetime = $min_lifetime;
}
$this->_driver->gc( $lifetime );
} | php | public function gc()
{
$lifetime = \CCArr::get( 'lifetime', $this->_config, \CCDate::minutes( 5 ) );
if ( $lifetime < ( $min_lifetime = \CCArr::get( 'min_lifetime', $this->_config, \CCDate::minutes( 5 ) ) ) )
{
$lifetime = $min_lifetime;
}
$this->_driver->gc( $lifetime );
} | [
"public",
"function",
"gc",
"(",
")",
"{",
"$",
"lifetime",
"=",
"\\",
"CCArr",
"::",
"get",
"(",
"'lifetime'",
",",
"$",
"this",
"->",
"_config",
",",
"\\",
"CCDate",
"::",
"minutes",
"(",
"5",
")",
")",
";",
"if",
"(",
"$",
"lifetime",
"<",
"(",
"$",
"min_lifetime",
"=",
"\\",
"CCArr",
"::",
"get",
"(",
"'min_lifetime'",
",",
"$",
"this",
"->",
"_config",
",",
"\\",
"CCDate",
"::",
"minutes",
"(",
"5",
")",
")",
")",
")",
"{",
"$",
"lifetime",
"=",
"$",
"min_lifetime",
";",
"}",
"$",
"this",
"->",
"_driver",
"->",
"gc",
"(",
"$",
"lifetime",
")",
";",
"}"
]
| Garbage collection, delete all outdated sessions
@return void | [
"Garbage",
"collection",
"delete",
"all",
"outdated",
"sessions"
]
| 9f6ec72c1a439de4b253d0223f1029f7f85b6ef8 | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/bundles/Session/Manager.php#L347-L357 |
18,081 | phrest/sdk | src/Generator.php | Generator.generate | public function generate()
{
$this->printMessage('');
$this->printMessage(
'Creating Collection config'
);
Files::saveCollectionConfig((new ConfigGenerator($this->config))->create());
$this->printMessage(
'Creating Models, Controllers, Requests, Responses, and Exceptions'
);
/**
* @var string $name
* @var Config $entity
*/
foreach ($this->config->versions as $version => $api)
{
$requests = [];
$this->printMessage($version . '...');
foreach ($api as $entityName => $entity)
{
$entity = $this->vaidateEntityConfig($entityName, $entity);
Files::initializeFolders($version, $entityName);
if (isset($entity->model))
{
$columns = $entity->model->columns;
// Models
Files::saveModel(
new ModelGenerator($version, $entityName, $columns)
);
// Requests
foreach ($entity->requests as $requestMethod => $actions)
{
foreach ($actions as $actionName => $action)
{
if (empty($action))
{
continue;
}
$requests[] = Files::saveRequest(
new RequestGenerator(
$version,
$entityName,
$entity->model,
$requestMethod,
$actionName,
$action
)
);
}
}
// Responses
Files::saveResponse(
new ResponseGenerator($version, $entityName, $columns)
);
}
// Exceptions
$exceptions = $this->getExceptionsFromEntityConfig($entity);
foreach ($exceptions as $exception)
{
Files::saveException(
new ExceptionGenerator($version, $entityName, $exception)
);
}
// Controllers
Files::saveController(
new ControllerGenerator($version, $entityName, $entity)
);
}
Files::saveSDK(
new SDKGenerator($version, $this->config->name, $requests)
);
}
$this->printMessage("All done, Remember to add the files to VCS!");
} | php | public function generate()
{
$this->printMessage('');
$this->printMessage(
'Creating Collection config'
);
Files::saveCollectionConfig((new ConfigGenerator($this->config))->create());
$this->printMessage(
'Creating Models, Controllers, Requests, Responses, and Exceptions'
);
/**
* @var string $name
* @var Config $entity
*/
foreach ($this->config->versions as $version => $api)
{
$requests = [];
$this->printMessage($version . '...');
foreach ($api as $entityName => $entity)
{
$entity = $this->vaidateEntityConfig($entityName, $entity);
Files::initializeFolders($version, $entityName);
if (isset($entity->model))
{
$columns = $entity->model->columns;
// Models
Files::saveModel(
new ModelGenerator($version, $entityName, $columns)
);
// Requests
foreach ($entity->requests as $requestMethod => $actions)
{
foreach ($actions as $actionName => $action)
{
if (empty($action))
{
continue;
}
$requests[] = Files::saveRequest(
new RequestGenerator(
$version,
$entityName,
$entity->model,
$requestMethod,
$actionName,
$action
)
);
}
}
// Responses
Files::saveResponse(
new ResponseGenerator($version, $entityName, $columns)
);
}
// Exceptions
$exceptions = $this->getExceptionsFromEntityConfig($entity);
foreach ($exceptions as $exception)
{
Files::saveException(
new ExceptionGenerator($version, $entityName, $exception)
);
}
// Controllers
Files::saveController(
new ControllerGenerator($version, $entityName, $entity)
);
}
Files::saveSDK(
new SDKGenerator($version, $this->config->name, $requests)
);
}
$this->printMessage("All done, Remember to add the files to VCS!");
} | [
"public",
"function",
"generate",
"(",
")",
"{",
"$",
"this",
"->",
"printMessage",
"(",
"''",
")",
";",
"$",
"this",
"->",
"printMessage",
"(",
"'Creating Collection config'",
")",
";",
"Files",
"::",
"saveCollectionConfig",
"(",
"(",
"new",
"ConfigGenerator",
"(",
"$",
"this",
"->",
"config",
")",
")",
"->",
"create",
"(",
")",
")",
";",
"$",
"this",
"->",
"printMessage",
"(",
"'Creating Models, Controllers, Requests, Responses, and Exceptions'",
")",
";",
"/**\n * @var string $name\n * @var Config $entity\n */",
"foreach",
"(",
"$",
"this",
"->",
"config",
"->",
"versions",
"as",
"$",
"version",
"=>",
"$",
"api",
")",
"{",
"$",
"requests",
"=",
"[",
"]",
";",
"$",
"this",
"->",
"printMessage",
"(",
"$",
"version",
".",
"'...'",
")",
";",
"foreach",
"(",
"$",
"api",
"as",
"$",
"entityName",
"=>",
"$",
"entity",
")",
"{",
"$",
"entity",
"=",
"$",
"this",
"->",
"vaidateEntityConfig",
"(",
"$",
"entityName",
",",
"$",
"entity",
")",
";",
"Files",
"::",
"initializeFolders",
"(",
"$",
"version",
",",
"$",
"entityName",
")",
";",
"if",
"(",
"isset",
"(",
"$",
"entity",
"->",
"model",
")",
")",
"{",
"$",
"columns",
"=",
"$",
"entity",
"->",
"model",
"->",
"columns",
";",
"// Models",
"Files",
"::",
"saveModel",
"(",
"new",
"ModelGenerator",
"(",
"$",
"version",
",",
"$",
"entityName",
",",
"$",
"columns",
")",
")",
";",
"// Requests",
"foreach",
"(",
"$",
"entity",
"->",
"requests",
"as",
"$",
"requestMethod",
"=>",
"$",
"actions",
")",
"{",
"foreach",
"(",
"$",
"actions",
"as",
"$",
"actionName",
"=>",
"$",
"action",
")",
"{",
"if",
"(",
"empty",
"(",
"$",
"action",
")",
")",
"{",
"continue",
";",
"}",
"$",
"requests",
"[",
"]",
"=",
"Files",
"::",
"saveRequest",
"(",
"new",
"RequestGenerator",
"(",
"$",
"version",
",",
"$",
"entityName",
",",
"$",
"entity",
"->",
"model",
",",
"$",
"requestMethod",
",",
"$",
"actionName",
",",
"$",
"action",
")",
")",
";",
"}",
"}",
"// Responses",
"Files",
"::",
"saveResponse",
"(",
"new",
"ResponseGenerator",
"(",
"$",
"version",
",",
"$",
"entityName",
",",
"$",
"columns",
")",
")",
";",
"}",
"// Exceptions",
"$",
"exceptions",
"=",
"$",
"this",
"->",
"getExceptionsFromEntityConfig",
"(",
"$",
"entity",
")",
";",
"foreach",
"(",
"$",
"exceptions",
"as",
"$",
"exception",
")",
"{",
"Files",
"::",
"saveException",
"(",
"new",
"ExceptionGenerator",
"(",
"$",
"version",
",",
"$",
"entityName",
",",
"$",
"exception",
")",
")",
";",
"}",
"// Controllers",
"Files",
"::",
"saveController",
"(",
"new",
"ControllerGenerator",
"(",
"$",
"version",
",",
"$",
"entityName",
",",
"$",
"entity",
")",
")",
";",
"}",
"Files",
"::",
"saveSDK",
"(",
"new",
"SDKGenerator",
"(",
"$",
"version",
",",
"$",
"this",
"->",
"config",
"->",
"name",
",",
"$",
"requests",
")",
")",
";",
"}",
"$",
"this",
"->",
"printMessage",
"(",
"\"All done, Remember to add the files to VCS!\"",
")",
";",
"}"
]
| Generate the SDK | [
"Generate",
"the",
"SDK"
]
| e9f2812ad517b07ca4d284512b530f615305eb47 | https://github.com/phrest/sdk/blob/e9f2812ad517b07ca4d284512b530f615305eb47/src/Generator.php#L69-L156 |
18,082 | okitcom/ok-lib-php | src/Service/Ticketing.php | Ticketing.create | public function create(TicketObject $ticket) {
$response = $this->client->post('tickets', array('ticket' => $ticket));
return new TicketObject($response);
} | php | public function create(TicketObject $ticket) {
$response = $this->client->post('tickets', array('ticket' => $ticket));
return new TicketObject($response);
} | [
"public",
"function",
"create",
"(",
"TicketObject",
"$",
"ticket",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"client",
"->",
"post",
"(",
"'tickets'",
",",
"array",
"(",
"'ticket'",
"=>",
"$",
"ticket",
")",
")",
";",
"return",
"new",
"TicketObject",
"(",
"$",
"response",
")",
";",
"}"
]
| Creates a ticket
@param TicketObject $ticket
@return TicketObject
@throws \OK\Model\Network\Exception\NetworkException | [
"Creates",
"a",
"ticket"
]
| 1f441f3d216af7c952788e864bfe66bc4f089467 | https://github.com/okitcom/ok-lib-php/blob/1f441f3d216af7c952788e864bfe66bc4f089467/src/Service/Ticketing.php#L33-L36 |
18,083 | okitcom/ok-lib-php | src/Service/Ticketing.php | Ticketing.update | public function update(TicketObject $ticket) {
return new TicketObject($this->client->post('tickets/' . $ticket->guid, array("ticket" => $ticket)));
} | php | public function update(TicketObject $ticket) {
return new TicketObject($this->client->post('tickets/' . $ticket->guid, array("ticket" => $ticket)));
} | [
"public",
"function",
"update",
"(",
"TicketObject",
"$",
"ticket",
")",
"{",
"return",
"new",
"TicketObject",
"(",
"$",
"this",
"->",
"client",
"->",
"post",
"(",
"'tickets/'",
".",
"$",
"ticket",
"->",
"guid",
",",
"array",
"(",
"\"ticket\"",
"=>",
"$",
"ticket",
")",
")",
")",
";",
"}"
]
| Updates the ticket
@param TicketObject $ticket
@return mixed
@throws \OK\Model\Network\Exception\NetworkException | [
"Updates",
"the",
"ticket"
]
| 1f441f3d216af7c952788e864bfe66bc4f089467 | https://github.com/okitcom/ok-lib-php/blob/1f441f3d216af7c952788e864bfe66bc4f089467/src/Service/Ticketing.php#L44-L46 |
18,084 | okitcom/ok-lib-php | src/Service/Ticketing.php | Ticketing.check | public function check($eventId, $barcode, $terminalId = null, Location $location = null) {
return new TicketCheckIn($this->client->post('check', [
'event' => $eventId,
'barcode' => $barcode,
'terminalId' => $terminalId,
'location' => $location
]));
} | php | public function check($eventId, $barcode, $terminalId = null, Location $location = null) {
return new TicketCheckIn($this->client->post('check', [
'event' => $eventId,
'barcode' => $barcode,
'terminalId' => $terminalId,
'location' => $location
]));
} | [
"public",
"function",
"check",
"(",
"$",
"eventId",
",",
"$",
"barcode",
",",
"$",
"terminalId",
"=",
"null",
",",
"Location",
"$",
"location",
"=",
"null",
")",
"{",
"return",
"new",
"TicketCheckIn",
"(",
"$",
"this",
"->",
"client",
"->",
"post",
"(",
"'check'",
",",
"[",
"'event'",
"=>",
"$",
"eventId",
",",
"'barcode'",
"=>",
"$",
"barcode",
",",
"'terminalId'",
"=>",
"$",
"terminalId",
",",
"'location'",
"=>",
"$",
"location",
"]",
")",
")",
";",
"}"
]
| Check a ticket barcode for an event.
@param $eventId integer event id
@param $barcode string barcode
@param $terminalId integer _optional_ terminal id
@param $location Location _optional_ location
@return TicketCheckIn result
@throws \OK\Model\Network\Exception\NetworkException | [
"Check",
"a",
"ticket",
"barcode",
"for",
"an",
"event",
"."
]
| 1f441f3d216af7c952788e864bfe66bc4f089467 | https://github.com/okitcom/ok-lib-php/blob/1f441f3d216af7c952788e864bfe66bc4f089467/src/Service/Ticketing.php#L70-L77 |
18,085 | anime-db/app-bundle | src/Controller/FormController.php | FormController.localPathAction | public function localPathAction(Request $request)
{
$response = $this->getCacheTimeKeeper()->getResponse();
// response was not modified for this request
if ($response->isNotModified($request)) {
return $response;
}
$form = $this->createForm(
new ChoiceLocalPath(),
['path' => $request->get('path') ?: '']
);
return $this->render('AnimeDbAppBundle:Form:local_path.html.twig', [
'form' => $form->createView(),
], $response);
} | php | public function localPathAction(Request $request)
{
$response = $this->getCacheTimeKeeper()->getResponse();
// response was not modified for this request
if ($response->isNotModified($request)) {
return $response;
}
$form = $this->createForm(
new ChoiceLocalPath(),
['path' => $request->get('path') ?: '']
);
return $this->render('AnimeDbAppBundle:Form:local_path.html.twig', [
'form' => $form->createView(),
], $response);
} | [
"public",
"function",
"localPathAction",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"getCacheTimeKeeper",
"(",
")",
"->",
"getResponse",
"(",
")",
";",
"// response was not modified for this request",
"if",
"(",
"$",
"response",
"->",
"isNotModified",
"(",
"$",
"request",
")",
")",
"{",
"return",
"$",
"response",
";",
"}",
"$",
"form",
"=",
"$",
"this",
"->",
"createForm",
"(",
"new",
"ChoiceLocalPath",
"(",
")",
",",
"[",
"'path'",
"=>",
"$",
"request",
"->",
"get",
"(",
"'path'",
")",
"?",
":",
"''",
"]",
")",
";",
"return",
"$",
"this",
"->",
"render",
"(",
"'AnimeDbAppBundle:Form:local_path.html.twig'",
",",
"[",
"'form'",
"=>",
"$",
"form",
"->",
"createView",
"(",
")",
",",
"]",
",",
"$",
"response",
")",
";",
"}"
]
| Form field local path.
@param Request $request
@return Response | [
"Form",
"field",
"local",
"path",
"."
]
| ca3b342081719d41ba018792a75970cbb1f1fe22 | https://github.com/anime-db/app-bundle/blob/ca3b342081719d41ba018792a75970cbb1f1fe22/src/Controller/FormController.php#L29-L45 |
18,086 | anime-db/app-bundle | src/Controller/FormController.php | FormController.localPathFoldersAction | public function localPathFoldersAction(Request $request)
{
$form = $this->createForm(new ChoiceLocalPath());
$form->handleRequest($request);
$path = $form->get('path')->getData() ?: Filesystem::getUserHomeDir();
if (($root = $request->get('root')) && strpos($path, $root) !== 0) {
$path = $root;
}
/* @var $response JsonResponse */
$response = $this->getCacheTimeKeeper()
->getResponse([(new \DateTime())->setTimestamp(filemtime($path))], -1, new JsonResponse());
// response was not modified for this request
if ($response->isNotModified($request)) {
return $response;
}
return $response->setData([
'path' => $path,
'folders' => Filesystem::scandir($path, Filesystem::DIRECTORY),
]);
} | php | public function localPathFoldersAction(Request $request)
{
$form = $this->createForm(new ChoiceLocalPath());
$form->handleRequest($request);
$path = $form->get('path')->getData() ?: Filesystem::getUserHomeDir();
if (($root = $request->get('root')) && strpos($path, $root) !== 0) {
$path = $root;
}
/* @var $response JsonResponse */
$response = $this->getCacheTimeKeeper()
->getResponse([(new \DateTime())->setTimestamp(filemtime($path))], -1, new JsonResponse());
// response was not modified for this request
if ($response->isNotModified($request)) {
return $response;
}
return $response->setData([
'path' => $path,
'folders' => Filesystem::scandir($path, Filesystem::DIRECTORY),
]);
} | [
"public",
"function",
"localPathFoldersAction",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"form",
"=",
"$",
"this",
"->",
"createForm",
"(",
"new",
"ChoiceLocalPath",
"(",
")",
")",
";",
"$",
"form",
"->",
"handleRequest",
"(",
"$",
"request",
")",
";",
"$",
"path",
"=",
"$",
"form",
"->",
"get",
"(",
"'path'",
")",
"->",
"getData",
"(",
")",
"?",
":",
"Filesystem",
"::",
"getUserHomeDir",
"(",
")",
";",
"if",
"(",
"(",
"$",
"root",
"=",
"$",
"request",
"->",
"get",
"(",
"'root'",
")",
")",
"&&",
"strpos",
"(",
"$",
"path",
",",
"$",
"root",
")",
"!==",
"0",
")",
"{",
"$",
"path",
"=",
"$",
"root",
";",
"}",
"/* @var $response JsonResponse */",
"$",
"response",
"=",
"$",
"this",
"->",
"getCacheTimeKeeper",
"(",
")",
"->",
"getResponse",
"(",
"[",
"(",
"new",
"\\",
"DateTime",
"(",
")",
")",
"->",
"setTimestamp",
"(",
"filemtime",
"(",
"$",
"path",
")",
")",
"]",
",",
"-",
"1",
",",
"new",
"JsonResponse",
"(",
")",
")",
";",
"// response was not modified for this request",
"if",
"(",
"$",
"response",
"->",
"isNotModified",
"(",
"$",
"request",
")",
")",
"{",
"return",
"$",
"response",
";",
"}",
"return",
"$",
"response",
"->",
"setData",
"(",
"[",
"'path'",
"=>",
"$",
"path",
",",
"'folders'",
"=>",
"Filesystem",
"::",
"scandir",
"(",
"$",
"path",
",",
"Filesystem",
"::",
"DIRECTORY",
")",
",",
"]",
")",
";",
"}"
]
| Return list folders for path.
@param Request $request
@return JsonResponse | [
"Return",
"list",
"folders",
"for",
"path",
"."
]
| ca3b342081719d41ba018792a75970cbb1f1fe22 | https://github.com/anime-db/app-bundle/blob/ca3b342081719d41ba018792a75970cbb1f1fe22/src/Controller/FormController.php#L54-L76 |
18,087 | anime-db/app-bundle | src/Controller/FormController.php | FormController.imageAction | public function imageAction(Request $request)
{
$response = $this->getCacheTimeKeeper()->getResponse();
// response was not modified for this request
if ($response->isNotModified($request)) {
return $response;
}
return $this->render('AnimeDbAppBundle:Form:image.html.twig', [
'form' => $this->createForm(new UploadImage())->createView(),
'change' => (bool) $request->get('change', false),
], $response);
} | php | public function imageAction(Request $request)
{
$response = $this->getCacheTimeKeeper()->getResponse();
// response was not modified for this request
if ($response->isNotModified($request)) {
return $response;
}
return $this->render('AnimeDbAppBundle:Form:image.html.twig', [
'form' => $this->createForm(new UploadImage())->createView(),
'change' => (bool) $request->get('change', false),
], $response);
} | [
"public",
"function",
"imageAction",
"(",
"Request",
"$",
"request",
")",
"{",
"$",
"response",
"=",
"$",
"this",
"->",
"getCacheTimeKeeper",
"(",
")",
"->",
"getResponse",
"(",
")",
";",
"// response was not modified for this request",
"if",
"(",
"$",
"response",
"->",
"isNotModified",
"(",
"$",
"request",
")",
")",
"{",
"return",
"$",
"response",
";",
"}",
"return",
"$",
"this",
"->",
"render",
"(",
"'AnimeDbAppBundle:Form:image.html.twig'",
",",
"[",
"'form'",
"=>",
"$",
"this",
"->",
"createForm",
"(",
"new",
"UploadImage",
"(",
")",
")",
"->",
"createView",
"(",
")",
",",
"'change'",
"=>",
"(",
"bool",
")",
"$",
"request",
"->",
"get",
"(",
"'change'",
",",
"false",
")",
",",
"]",
",",
"$",
"response",
")",
";",
"}"
]
| Form field image.
@param Request $request
@return Response | [
"Form",
"field",
"image",
"."
]
| ca3b342081719d41ba018792a75970cbb1f1fe22 | https://github.com/anime-db/app-bundle/blob/ca3b342081719d41ba018792a75970cbb1f1fe22/src/Controller/FormController.php#L85-L97 |
18,088 | ClanCats/Core | src/classes/CCLang.php | CCLang.parse | public static function parse( $lang )
{
$conf = ClanCats::$config->language;
if ( isset( $lang ) && strlen( $lang ) > 1 )
{
$lang = explode( ',', strtolower( $lang ) );
$lang = explode( '-', $lang[0] );
if ( !isset( $lang[1] ) )
{
$lang[1] = $lang[0];
}
$available = $conf['available'];
if ( array_key_exists( $lang[0], $available ) )
{
// does even the region match?
if ( in_array( $lang[1], $available[$lang[0]] ) )
{
return $lang[0].'-'.$lang[1];
}
// return the first region
else
{
$locales = $available[$lang[0]];
return $lang[0].'-'.$locales[key($locales)];
}
}
}
// Return the default language when nothing coul be matched
return $conf['default'];
} | php | public static function parse( $lang )
{
$conf = ClanCats::$config->language;
if ( isset( $lang ) && strlen( $lang ) > 1 )
{
$lang = explode( ',', strtolower( $lang ) );
$lang = explode( '-', $lang[0] );
if ( !isset( $lang[1] ) )
{
$lang[1] = $lang[0];
}
$available = $conf['available'];
if ( array_key_exists( $lang[0], $available ) )
{
// does even the region match?
if ( in_array( $lang[1], $available[$lang[0]] ) )
{
return $lang[0].'-'.$lang[1];
}
// return the first region
else
{
$locales = $available[$lang[0]];
return $lang[0].'-'.$locales[key($locales)];
}
}
}
// Return the default language when nothing coul be matched
return $conf['default'];
} | [
"public",
"static",
"function",
"parse",
"(",
"$",
"lang",
")",
"{",
"$",
"conf",
"=",
"ClanCats",
"::",
"$",
"config",
"->",
"language",
";",
"if",
"(",
"isset",
"(",
"$",
"lang",
")",
"&&",
"strlen",
"(",
"$",
"lang",
")",
">",
"1",
")",
"{",
"$",
"lang",
"=",
"explode",
"(",
"','",
",",
"strtolower",
"(",
"$",
"lang",
")",
")",
";",
"$",
"lang",
"=",
"explode",
"(",
"'-'",
",",
"$",
"lang",
"[",
"0",
"]",
")",
";",
"if",
"(",
"!",
"isset",
"(",
"$",
"lang",
"[",
"1",
"]",
")",
")",
"{",
"$",
"lang",
"[",
"1",
"]",
"=",
"$",
"lang",
"[",
"0",
"]",
";",
"}",
"$",
"available",
"=",
"$",
"conf",
"[",
"'available'",
"]",
";",
"if",
"(",
"array_key_exists",
"(",
"$",
"lang",
"[",
"0",
"]",
",",
"$",
"available",
")",
")",
"{",
"// does even the region match?",
"if",
"(",
"in_array",
"(",
"$",
"lang",
"[",
"1",
"]",
",",
"$",
"available",
"[",
"$",
"lang",
"[",
"0",
"]",
"]",
")",
")",
"{",
"return",
"$",
"lang",
"[",
"0",
"]",
".",
"'-'",
".",
"$",
"lang",
"[",
"1",
"]",
";",
"}",
"// return the first region",
"else",
"{",
"$",
"locales",
"=",
"$",
"available",
"[",
"$",
"lang",
"[",
"0",
"]",
"]",
";",
"return",
"$",
"lang",
"[",
"0",
"]",
".",
"'-'",
".",
"$",
"locales",
"[",
"key",
"(",
"$",
"locales",
")",
"]",
";",
"}",
"}",
"}",
"// Return the default language when nothing coul be matched",
"return",
"$",
"conf",
"[",
"'default'",
"]",
";",
"}"
]
| Match an language code with the aviable languages
CCLang::parse( 'de' );
CCLang::parse( 'EN-US' );
CCLang::parse( 'de-DE,en,fr' );
@param string $lang
@return string | [
"Match",
"an",
"language",
"code",
"with",
"the",
"aviable",
"languages"
]
| 9f6ec72c1a439de4b253d0223f1029f7f85b6ef8 | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCLang.php#L113-L147 |
18,089 | ClanCats/Core | src/classes/CCLang.php | CCLang.load | public static function load( $path, $overwrite = false )
{
if ( array_key_exists( $path, static::$data[static::$current_language] ) && $overwrite === false )
{
return;
}
$file_path = CCPath::get( $path, CCDIR_LANGUAGE.static::$current_language.'/', EXT );
if ( !file_exists( $file_path ) )
{
// as fallback try to load the language file of the default language
if ( static::$current_language !== ( $default_lang = ClanCats::$config->get( 'language.default' ) ) )
{
$file_path = CCPath::get( $path, CCDIR_LANGUAGE.$default_lang.'/', EXT );
if ( !file_exists( $file_path ) )
{
throw new CCException( "CCLang::load - could not find language file: ".$file_path );
}
}
else
{
throw new CCException( "CCLang::load - could not find language file: ".$file_path );
}
}
static::$data[static::$current_language][$path] = require( $file_path );
} | php | public static function load( $path, $overwrite = false )
{
if ( array_key_exists( $path, static::$data[static::$current_language] ) && $overwrite === false )
{
return;
}
$file_path = CCPath::get( $path, CCDIR_LANGUAGE.static::$current_language.'/', EXT );
if ( !file_exists( $file_path ) )
{
// as fallback try to load the language file of the default language
if ( static::$current_language !== ( $default_lang = ClanCats::$config->get( 'language.default' ) ) )
{
$file_path = CCPath::get( $path, CCDIR_LANGUAGE.$default_lang.'/', EXT );
if ( !file_exists( $file_path ) )
{
throw new CCException( "CCLang::load - could not find language file: ".$file_path );
}
}
else
{
throw new CCException( "CCLang::load - could not find language file: ".$file_path );
}
}
static::$data[static::$current_language][$path] = require( $file_path );
} | [
"public",
"static",
"function",
"load",
"(",
"$",
"path",
",",
"$",
"overwrite",
"=",
"false",
")",
"{",
"if",
"(",
"array_key_exists",
"(",
"$",
"path",
",",
"static",
"::",
"$",
"data",
"[",
"static",
"::",
"$",
"current_language",
"]",
")",
"&&",
"$",
"overwrite",
"===",
"false",
")",
"{",
"return",
";",
"}",
"$",
"file_path",
"=",
"CCPath",
"::",
"get",
"(",
"$",
"path",
",",
"CCDIR_LANGUAGE",
".",
"static",
"::",
"$",
"current_language",
".",
"'/'",
",",
"EXT",
")",
";",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"file_path",
")",
")",
"{",
"// as fallback try to load the language file of the default language",
"if",
"(",
"static",
"::",
"$",
"current_language",
"!==",
"(",
"$",
"default_lang",
"=",
"ClanCats",
"::",
"$",
"config",
"->",
"get",
"(",
"'language.default'",
")",
")",
")",
"{",
"$",
"file_path",
"=",
"CCPath",
"::",
"get",
"(",
"$",
"path",
",",
"CCDIR_LANGUAGE",
".",
"$",
"default_lang",
".",
"'/'",
",",
"EXT",
")",
";",
"if",
"(",
"!",
"file_exists",
"(",
"$",
"file_path",
")",
")",
"{",
"throw",
"new",
"CCException",
"(",
"\"CCLang::load - could not find language file: \"",
".",
"$",
"file_path",
")",
";",
"}",
"}",
"else",
"{",
"throw",
"new",
"CCException",
"(",
"\"CCLang::load - could not find language file: \"",
".",
"$",
"file_path",
")",
";",
"}",
"}",
"static",
"::",
"$",
"data",
"[",
"static",
"::",
"$",
"current_language",
"]",
"[",
"$",
"path",
"]",
"=",
"require",
"(",
"$",
"file_path",
")",
";",
"}"
]
| Load a language file into the appliaction
CCLang::load( 'some/path/to/file' );
CCLang::load( 'controller/example' );
CCLang::load( 'Blog::controller/dashboard' );
@param string $path
@param bool $overwrite
@return void | [
"Load",
"a",
"language",
"file",
"into",
"the",
"appliaction"
]
| 9f6ec72c1a439de4b253d0223f1029f7f85b6ef8 | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCLang.php#L170-L198 |
18,090 | ClanCats/Core | src/classes/CCLang.php | CCLang.line | public static function line( $key, $params = array() )
{
$path = substr( $key, 0, strpos( $key, '.' ) );
$key = substr( $key, strpos( $key, '.' )+1 );
// if there is a namespace replace the path with it
if ( isset( static::$aliases[$path] ) )
{
return static::line( static::$aliases[$path].'.'.$key, $params );
}
// find the language file behind the path
if ( !isset( static::$data[static::$current_language][$path] ) )
{
// Autoload the language file
// The load function will throw an exception if the
// file doesnt exists so we dont have to care for that here.
CCLang::load( $path );
}
// Does the line exist in the language file?
if ( !isset( static::$data[static::$current_language][$path][$key] ) )
{
// We simply return the key to the user and log the missing language file line
CCLog::add( 'CCLang::line - No such line "'.$key.'" ('.static::$current_language.') in file: '.$path, 'warning' ); return $key;
}
$line = static::$data[static::$current_language][$path][$key];
// replace the params inside the line
foreach ( $params as $param => $value )
{
$line = str_replace( ':'.$param, $value, $line );
}
return $line;
} | php | public static function line( $key, $params = array() )
{
$path = substr( $key, 0, strpos( $key, '.' ) );
$key = substr( $key, strpos( $key, '.' )+1 );
// if there is a namespace replace the path with it
if ( isset( static::$aliases[$path] ) )
{
return static::line( static::$aliases[$path].'.'.$key, $params );
}
// find the language file behind the path
if ( !isset( static::$data[static::$current_language][$path] ) )
{
// Autoload the language file
// The load function will throw an exception if the
// file doesnt exists so we dont have to care for that here.
CCLang::load( $path );
}
// Does the line exist in the language file?
if ( !isset( static::$data[static::$current_language][$path][$key] ) )
{
// We simply return the key to the user and log the missing language file line
CCLog::add( 'CCLang::line - No such line "'.$key.'" ('.static::$current_language.') in file: '.$path, 'warning' ); return $key;
}
$line = static::$data[static::$current_language][$path][$key];
// replace the params inside the line
foreach ( $params as $param => $value )
{
$line = str_replace( ':'.$param, $value, $line );
}
return $line;
} | [
"public",
"static",
"function",
"line",
"(",
"$",
"key",
",",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"$",
"path",
"=",
"substr",
"(",
"$",
"key",
",",
"0",
",",
"strpos",
"(",
"$",
"key",
",",
"'.'",
")",
")",
";",
"$",
"key",
"=",
"substr",
"(",
"$",
"key",
",",
"strpos",
"(",
"$",
"key",
",",
"'.'",
")",
"+",
"1",
")",
";",
"// if there is a namespace replace the path with it",
"if",
"(",
"isset",
"(",
"static",
"::",
"$",
"aliases",
"[",
"$",
"path",
"]",
")",
")",
"{",
"return",
"static",
"::",
"line",
"(",
"static",
"::",
"$",
"aliases",
"[",
"$",
"path",
"]",
".",
"'.'",
".",
"$",
"key",
",",
"$",
"params",
")",
";",
"}",
"// find the language file behind the path",
"if",
"(",
"!",
"isset",
"(",
"static",
"::",
"$",
"data",
"[",
"static",
"::",
"$",
"current_language",
"]",
"[",
"$",
"path",
"]",
")",
")",
"{",
"// Autoload the language file",
"// The load function will throw an exception if the ",
"// file doesnt exists so we dont have to care for that here.",
"CCLang",
"::",
"load",
"(",
"$",
"path",
")",
";",
"}",
"// Does the line exist in the language file?",
"if",
"(",
"!",
"isset",
"(",
"static",
"::",
"$",
"data",
"[",
"static",
"::",
"$",
"current_language",
"]",
"[",
"$",
"path",
"]",
"[",
"$",
"key",
"]",
")",
")",
"{",
"// We simply return the key to the user and log the missing language file line",
"CCLog",
"::",
"add",
"(",
"'CCLang::line - No such line \"'",
".",
"$",
"key",
".",
"'\" ('",
".",
"static",
"::",
"$",
"current_language",
".",
"') in file: '",
".",
"$",
"path",
",",
"'warning'",
")",
";",
"return",
"$",
"key",
";",
"}",
"$",
"line",
"=",
"static",
"::",
"$",
"data",
"[",
"static",
"::",
"$",
"current_language",
"]",
"[",
"$",
"path",
"]",
"[",
"$",
"key",
"]",
";",
"// replace the params inside the line",
"foreach",
"(",
"$",
"params",
"as",
"$",
"param",
"=>",
"$",
"value",
")",
"{",
"$",
"line",
"=",
"str_replace",
"(",
"':'",
".",
"$",
"param",
",",
"$",
"value",
",",
"$",
"line",
")",
";",
"}",
"return",
"$",
"line",
";",
"}"
]
| Recive a translated line
__( 'some/path.to.my.label' );
__( 'user.welcome', array( 'name' => 'Jeff' ) )
@param string $key
@param array $params
@return string | [
"Recive",
"a",
"translated",
"line"
]
| 9f6ec72c1a439de4b253d0223f1029f7f85b6ef8 | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCLang.php#L210-L246 |
18,091 | dunkelfrosch/phpcoverfish | src/PHPCoverFish/CoverFishScanner.php | CoverFishScanner.addCoverageValidatorPoolForCover | public function addCoverageValidatorPoolForCover($coverToken)
{
// covers ClassName::methodName
$this->addValidator(new ValidatorClassNameMethodName($coverToken));
// covers ::methodName
$this->addValidator(new ValidatorMethodName($coverToken));
// covers ClassName
$this->addValidator(new ValidatorClassName($coverToken));
// covers ClassName::accessor (for public, protected, private, !public, !protected, !private)
$this->addValidator(new ValidatorClassNameMethodAccess($coverToken));
} | php | public function addCoverageValidatorPoolForCover($coverToken)
{
// covers ClassName::methodName
$this->addValidator(new ValidatorClassNameMethodName($coverToken));
// covers ::methodName
$this->addValidator(new ValidatorMethodName($coverToken));
// covers ClassName
$this->addValidator(new ValidatorClassName($coverToken));
// covers ClassName::accessor (for public, protected, private, !public, !protected, !private)
$this->addValidator(new ValidatorClassNameMethodAccess($coverToken));
} | [
"public",
"function",
"addCoverageValidatorPoolForCover",
"(",
"$",
"coverToken",
")",
"{",
"// covers ClassName::methodName",
"$",
"this",
"->",
"addValidator",
"(",
"new",
"ValidatorClassNameMethodName",
"(",
"$",
"coverToken",
")",
")",
";",
"// covers ::methodName",
"$",
"this",
"->",
"addValidator",
"(",
"new",
"ValidatorMethodName",
"(",
"$",
"coverToken",
")",
")",
";",
"// covers ClassName",
"$",
"this",
"->",
"addValidator",
"(",
"new",
"ValidatorClassName",
"(",
"$",
"coverToken",
")",
")",
";",
"// covers ClassName::accessor (for public, protected, private, !public, !protected, !private)",
"$",
"this",
"->",
"addValidator",
"(",
"new",
"ValidatorClassNameMethodAccess",
"(",
"$",
"coverToken",
")",
")",
";",
"}"
]
| init all available cover validator classes use incoming coverToken as parameter
@param $coverToken | [
"init",
"all",
"available",
"cover",
"validator",
"classes",
"use",
"incoming",
"coverToken",
"as",
"parameter"
]
| 779bd399ec8f4cadb3b7854200695c5eb3f5a8ad | https://github.com/dunkelfrosch/phpcoverfish/blob/779bd399ec8f4cadb3b7854200695c5eb3f5a8ad/src/PHPCoverFish/CoverFishScanner.php#L54-L64 |
18,092 | dunkelfrosch/phpcoverfish | src/PHPCoverFish/CoverFishScanner.php | CoverFishScanner.analysePHPUnitFiles | public function analysePHPUnitFiles()
{
$testFiles = $this->scanFilesInPath($this->testSourcePath);
foreach ($testFiles as $file) {
$this->analyseClassesInFile($file);
}
return $this->coverFishOutput->writeResult($this->coverFishResult);
} | php | public function analysePHPUnitFiles()
{
$testFiles = $this->scanFilesInPath($this->testSourcePath);
foreach ($testFiles as $file) {
$this->analyseClassesInFile($file);
}
return $this->coverFishOutput->writeResult($this->coverFishResult);
} | [
"public",
"function",
"analysePHPUnitFiles",
"(",
")",
"{",
"$",
"testFiles",
"=",
"$",
"this",
"->",
"scanFilesInPath",
"(",
"$",
"this",
"->",
"testSourcePath",
")",
";",
"foreach",
"(",
"$",
"testFiles",
"as",
"$",
"file",
")",
"{",
"$",
"this",
"->",
"analyseClassesInFile",
"(",
"$",
"file",
")",
";",
"}",
"return",
"$",
"this",
"->",
"coverFishOutput",
"->",
"writeResult",
"(",
"$",
"this",
"->",
"coverFishResult",
")",
";",
"}"
]
| scan all unit-test files inside specific path
@return string | [
"scan",
"all",
"unit",
"-",
"test",
"files",
"inside",
"specific",
"path"
]
| 779bd399ec8f4cadb3b7854200695c5eb3f5a8ad | https://github.com/dunkelfrosch/phpcoverfish/blob/779bd399ec8f4cadb3b7854200695c5eb3f5a8ad/src/PHPCoverFish/CoverFishScanner.php#L71-L79 |
18,093 | dunkelfrosch/phpcoverfish | src/PHPCoverFish/CoverFishScanner.php | CoverFishScanner.analyseCoverAnnotations | public function analyseCoverAnnotations($phpDocBlock, CoverFishPHPUnitTest $phpUnitTest)
{
$this->validatorCollection->clear();
$phpUnitTest->clearCoverMappings();
$phpUnitTest->clearCoverAnnotation();
/** @var string $cover */
foreach ($phpDocBlock['covers'] as $cover) {
$phpUnitTest->addCoverAnnotation($cover);
$this->addCoverageValidatorPoolForCover($cover);
}
$phpUnitTest = $this->validateAndReturnMapping($phpUnitTest);
$this->phpUnitFile->addTest($phpUnitTest);
} | php | public function analyseCoverAnnotations($phpDocBlock, CoverFishPHPUnitTest $phpUnitTest)
{
$this->validatorCollection->clear();
$phpUnitTest->clearCoverMappings();
$phpUnitTest->clearCoverAnnotation();
/** @var string $cover */
foreach ($phpDocBlock['covers'] as $cover) {
$phpUnitTest->addCoverAnnotation($cover);
$this->addCoverageValidatorPoolForCover($cover);
}
$phpUnitTest = $this->validateAndReturnMapping($phpUnitTest);
$this->phpUnitFile->addTest($phpUnitTest);
} | [
"public",
"function",
"analyseCoverAnnotations",
"(",
"$",
"phpDocBlock",
",",
"CoverFishPHPUnitTest",
"$",
"phpUnitTest",
")",
"{",
"$",
"this",
"->",
"validatorCollection",
"->",
"clear",
"(",
")",
";",
"$",
"phpUnitTest",
"->",
"clearCoverMappings",
"(",
")",
";",
"$",
"phpUnitTest",
"->",
"clearCoverAnnotation",
"(",
")",
";",
"/** @var string $cover */",
"foreach",
"(",
"$",
"phpDocBlock",
"[",
"'covers'",
"]",
"as",
"$",
"cover",
")",
"{",
"$",
"phpUnitTest",
"->",
"addCoverAnnotation",
"(",
"$",
"cover",
")",
";",
"$",
"this",
"->",
"addCoverageValidatorPoolForCover",
"(",
"$",
"cover",
")",
";",
"}",
"$",
"phpUnitTest",
"=",
"$",
"this",
"->",
"validateAndReturnMapping",
"(",
"$",
"phpUnitTest",
")",
";",
"$",
"this",
"->",
"phpUnitFile",
"->",
"addTest",
"(",
"$",
"phpUnitTest",
")",
";",
"}"
]
| scan all annotations inside one single unit test file
@param array $phpDocBlock
@param CoverFishPHPUnitTest $phpUnitTest | [
"scan",
"all",
"annotations",
"inside",
"one",
"single",
"unit",
"test",
"file"
]
| 779bd399ec8f4cadb3b7854200695c5eb3f5a8ad | https://github.com/dunkelfrosch/phpcoverfish/blob/779bd399ec8f4cadb3b7854200695c5eb3f5a8ad/src/PHPCoverFish/CoverFishScanner.php#L87-L101 |
18,094 | dunkelfrosch/phpcoverfish | src/PHPCoverFish/CoverFishScanner.php | CoverFishScanner.analyseClassesInFile | public function analyseClassesInFile($file)
{
$ts = new PHP_Token_Stream($file);
$this->phpUnitFile = new CoverFishPHPUnitFile();
foreach ($ts->getClasses() as $className => $classData) {
$fqnClass = sprintf('%s\\%s',
$this->coverFishHelper->getAttributeByKey('namespace', $classData['package']),
$className
);
if (false === $this->coverFishHelper->isValidTestClass($fqnClass)) {
continue;
}
$classData['className'] = $className;
$classData['classFile'] = $file;
$this->analyseClass($classData);
}
} | php | public function analyseClassesInFile($file)
{
$ts = new PHP_Token_Stream($file);
$this->phpUnitFile = new CoverFishPHPUnitFile();
foreach ($ts->getClasses() as $className => $classData) {
$fqnClass = sprintf('%s\\%s',
$this->coverFishHelper->getAttributeByKey('namespace', $classData['package']),
$className
);
if (false === $this->coverFishHelper->isValidTestClass($fqnClass)) {
continue;
}
$classData['className'] = $className;
$classData['classFile'] = $file;
$this->analyseClass($classData);
}
} | [
"public",
"function",
"analyseClassesInFile",
"(",
"$",
"file",
")",
"{",
"$",
"ts",
"=",
"new",
"PHP_Token_Stream",
"(",
"$",
"file",
")",
";",
"$",
"this",
"->",
"phpUnitFile",
"=",
"new",
"CoverFishPHPUnitFile",
"(",
")",
";",
"foreach",
"(",
"$",
"ts",
"->",
"getClasses",
"(",
")",
"as",
"$",
"className",
"=>",
"$",
"classData",
")",
"{",
"$",
"fqnClass",
"=",
"sprintf",
"(",
"'%s\\\\%s'",
",",
"$",
"this",
"->",
"coverFishHelper",
"->",
"getAttributeByKey",
"(",
"'namespace'",
",",
"$",
"classData",
"[",
"'package'",
"]",
")",
",",
"$",
"className",
")",
";",
"if",
"(",
"false",
"===",
"$",
"this",
"->",
"coverFishHelper",
"->",
"isValidTestClass",
"(",
"$",
"fqnClass",
")",
")",
"{",
"continue",
";",
"}",
"$",
"classData",
"[",
"'className'",
"]",
"=",
"$",
"className",
";",
"$",
"classData",
"[",
"'classFile'",
"]",
"=",
"$",
"file",
";",
"$",
"this",
"->",
"analyseClass",
"(",
"$",
"classData",
")",
";",
"}",
"}"
]
| scan all classes inside one defined unit test file
@param string $file
@return array | [
"scan",
"all",
"classes",
"inside",
"one",
"defined",
"unit",
"test",
"file"
]
| 779bd399ec8f4cadb3b7854200695c5eb3f5a8ad | https://github.com/dunkelfrosch/phpcoverfish/blob/779bd399ec8f4cadb3b7854200695c5eb3f5a8ad/src/PHPCoverFish/CoverFishScanner.php#L110-L129 |
18,095 | steeffeen/FancyManiaLinks | FML/Script/Features/ToggleInterface.php | ToggleInterface.setKeyCode | public function setKeyCode($keyCode)
{
$this->keyCode = (int)$keyCode;
$this->keyName = null;
return $this;
} | php | public function setKeyCode($keyCode)
{
$this->keyCode = (int)$keyCode;
$this->keyName = null;
return $this;
} | [
"public",
"function",
"setKeyCode",
"(",
"$",
"keyCode",
")",
"{",
"$",
"this",
"->",
"keyCode",
"=",
"(",
"int",
")",
"$",
"keyCode",
";",
"$",
"this",
"->",
"keyName",
"=",
"null",
";",
"return",
"$",
"this",
";",
"}"
]
| Set the key code
@api
@param int $keyCode Key code
@return static | [
"Set",
"the",
"key",
"code"
]
| 227b0759306f0a3c75873ba50276e4163a93bfa6 | https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Script/Features/ToggleInterface.php#L200-L205 |
18,096 | steeffeen/FancyManiaLinks | FML/Script/Features/ToggleInterface.php | ToggleInterface.getOnInitScriptText | protected function getOnInitScriptText()
{
$scriptText = null;
if ($this->control) {
$controlId = Builder::escapeText($this->control->getId());
$scriptText = "declare ToggleInterfaceControl <=> Page.GetFirstChild({$controlId});";
} else {
$scriptText = "declare ToggleInterfaceControl <=> Page.MainFrame;";
}
$stateVariableName = $this::VAR_STATE;
return $scriptText . "
declare persistent {$stateVariableName} as CurrentState for LocalUser = True;
ToggleInterfaceControl.Visible = CurrentState;
";
} | php | protected function getOnInitScriptText()
{
$scriptText = null;
if ($this->control) {
$controlId = Builder::escapeText($this->control->getId());
$scriptText = "declare ToggleInterfaceControl <=> Page.GetFirstChild({$controlId});";
} else {
$scriptText = "declare ToggleInterfaceControl <=> Page.MainFrame;";
}
$stateVariableName = $this::VAR_STATE;
return $scriptText . "
declare persistent {$stateVariableName} as CurrentState for LocalUser = True;
ToggleInterfaceControl.Visible = CurrentState;
";
} | [
"protected",
"function",
"getOnInitScriptText",
"(",
")",
"{",
"$",
"scriptText",
"=",
"null",
";",
"if",
"(",
"$",
"this",
"->",
"control",
")",
"{",
"$",
"controlId",
"=",
"Builder",
"::",
"escapeText",
"(",
"$",
"this",
"->",
"control",
"->",
"getId",
"(",
")",
")",
";",
"$",
"scriptText",
"=",
"\"declare ToggleInterfaceControl <=> Page.GetFirstChild({$controlId});\"",
";",
"}",
"else",
"{",
"$",
"scriptText",
"=",
"\"declare ToggleInterfaceControl <=> Page.MainFrame;\"",
";",
"}",
"$",
"stateVariableName",
"=",
"$",
"this",
"::",
"VAR_STATE",
";",
"return",
"$",
"scriptText",
".",
"\"\ndeclare persistent {$stateVariableName} as CurrentState for LocalUser = True;\nToggleInterfaceControl.Visible = CurrentState;\n\"",
";",
"}"
]
| Get the on init script text
@return string | [
"Get",
"the",
"on",
"init",
"script",
"text"
]
| 227b0759306f0a3c75873ba50276e4163a93bfa6 | https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Script/Features/ToggleInterface.php#L248-L262 |
18,097 | steeffeen/FancyManiaLinks | FML/Script/Features/ToggleInterface.php | ToggleInterface.getKeyPressScriptText | protected function getKeyPressScriptText()
{
$scriptText = null;
$keyProperty = null;
$keyValue = null;
if ($this->keyName) {
$keyProperty = "KeyName";
$keyValue = Builder::getText($this->keyName);
} else if ($this->keyCode) {
$keyProperty = "KeyCode";
$keyValue = Builder::getInteger($this->keyCode);
}
$scriptText = "
if (Event.{$keyProperty} == {$keyValue}) {
";
if ($this->control) {
$controlId = Builder::escapeText($this->control->getId());
$scriptText .= "
declare ToggleInterfaceControl <=> Page.GetFirstChild({$controlId});";
} else {
$scriptText .= "
declare ToggleInterfaceControl <=> Page.MainFrame;";
}
$scriptText .= "
ToggleInterfaceControl.Visible = !ToggleInterfaceControl.Visible;";
if ($this->rememberState) {
$stateVariableName = static::VAR_STATE;
$scriptText .= "
declare persistent {$stateVariableName} as CurrentState for LocalUser = True;
CurrentState = ToggleInterfaceControl.Visible;
";
}
return $scriptText . "
}";
} | php | protected function getKeyPressScriptText()
{
$scriptText = null;
$keyProperty = null;
$keyValue = null;
if ($this->keyName) {
$keyProperty = "KeyName";
$keyValue = Builder::getText($this->keyName);
} else if ($this->keyCode) {
$keyProperty = "KeyCode";
$keyValue = Builder::getInteger($this->keyCode);
}
$scriptText = "
if (Event.{$keyProperty} == {$keyValue}) {
";
if ($this->control) {
$controlId = Builder::escapeText($this->control->getId());
$scriptText .= "
declare ToggleInterfaceControl <=> Page.GetFirstChild({$controlId});";
} else {
$scriptText .= "
declare ToggleInterfaceControl <=> Page.MainFrame;";
}
$scriptText .= "
ToggleInterfaceControl.Visible = !ToggleInterfaceControl.Visible;";
if ($this->rememberState) {
$stateVariableName = static::VAR_STATE;
$scriptText .= "
declare persistent {$stateVariableName} as CurrentState for LocalUser = True;
CurrentState = ToggleInterfaceControl.Visible;
";
}
return $scriptText . "
}";
} | [
"protected",
"function",
"getKeyPressScriptText",
"(",
")",
"{",
"$",
"scriptText",
"=",
"null",
";",
"$",
"keyProperty",
"=",
"null",
";",
"$",
"keyValue",
"=",
"null",
";",
"if",
"(",
"$",
"this",
"->",
"keyName",
")",
"{",
"$",
"keyProperty",
"=",
"\"KeyName\"",
";",
"$",
"keyValue",
"=",
"Builder",
"::",
"getText",
"(",
"$",
"this",
"->",
"keyName",
")",
";",
"}",
"else",
"if",
"(",
"$",
"this",
"->",
"keyCode",
")",
"{",
"$",
"keyProperty",
"=",
"\"KeyCode\"",
";",
"$",
"keyValue",
"=",
"Builder",
"::",
"getInteger",
"(",
"$",
"this",
"->",
"keyCode",
")",
";",
"}",
"$",
"scriptText",
"=",
"\"\nif (Event.{$keyProperty} == {$keyValue}) {\n\"",
";",
"if",
"(",
"$",
"this",
"->",
"control",
")",
"{",
"$",
"controlId",
"=",
"Builder",
"::",
"escapeText",
"(",
"$",
"this",
"->",
"control",
"->",
"getId",
"(",
")",
")",
";",
"$",
"scriptText",
".=",
"\"\n declare ToggleInterfaceControl <=> Page.GetFirstChild({$controlId});\"",
";",
"}",
"else",
"{",
"$",
"scriptText",
".=",
"\"\n declare ToggleInterfaceControl <=> Page.MainFrame;\"",
";",
"}",
"$",
"scriptText",
".=",
"\"\n ToggleInterfaceControl.Visible = !ToggleInterfaceControl.Visible;\"",
";",
"if",
"(",
"$",
"this",
"->",
"rememberState",
")",
"{",
"$",
"stateVariableName",
"=",
"static",
"::",
"VAR_STATE",
";",
"$",
"scriptText",
".=",
"\"\n declare persistent {$stateVariableName} as CurrentState for LocalUser = True;\n CurrentState = ToggleInterfaceControl.Visible;\n\"",
";",
"}",
"return",
"$",
"scriptText",
".",
"\"\n}\"",
";",
"}"
]
| Get the key press script text
@return string | [
"Get",
"the",
"key",
"press",
"script",
"text"
]
| 227b0759306f0a3c75873ba50276e4163a93bfa6 | https://github.com/steeffeen/FancyManiaLinks/blob/227b0759306f0a3c75873ba50276e4163a93bfa6/FML/Script/Features/ToggleInterface.php#L269-L303 |
18,098 | ClanCats/Core | src/classes/CCEvent.php | CCEvent.clear | public static function clear( $event, $what = null ) {
if ( is_null( $what ) ) {
unset( static::$events[$event] ); return;
}
if ( array_key_exists( $what, static::$events[$event][$what] ) ) {
unset( static::$events[$event][$what] );
}
} | php | public static function clear( $event, $what = null ) {
if ( is_null( $what ) ) {
unset( static::$events[$event] ); return;
}
if ( array_key_exists( $what, static::$events[$event][$what] ) ) {
unset( static::$events[$event][$what] );
}
} | [
"public",
"static",
"function",
"clear",
"(",
"$",
"event",
",",
"$",
"what",
"=",
"null",
")",
"{",
"if",
"(",
"is_null",
"(",
"$",
"what",
")",
")",
"{",
"unset",
"(",
"static",
"::",
"$",
"events",
"[",
"$",
"event",
"]",
")",
";",
"return",
";",
"}",
"if",
"(",
"array_key_exists",
"(",
"$",
"what",
",",
"static",
"::",
"$",
"events",
"[",
"$",
"event",
"]",
"[",
"$",
"what",
"]",
")",
")",
"{",
"unset",
"(",
"static",
"::",
"$",
"events",
"[",
"$",
"event",
"]",
"[",
"$",
"what",
"]",
")",
";",
"}",
"}"
]
| clear an event
@param string $event
@param mixed $callback
@return void | [
"clear",
"an",
"event"
]
| 9f6ec72c1a439de4b253d0223f1029f7f85b6ef8 | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCEvent.php#L58-L66 |
18,099 | ClanCats/Core | src/classes/CCEvent.php | CCEvent.ready | public static function ready( $event, $params = array() ) {
$responses = static::fire( $event, $params );
foreach( static::pack( $responses ) as $response ) {
if ( $response !== true ) {
return false;
}
}
return true;
} | php | public static function ready( $event, $params = array() ) {
$responses = static::fire( $event, $params );
foreach( static::pack( $responses ) as $response ) {
if ( $response !== true ) {
return false;
}
}
return true;
} | [
"public",
"static",
"function",
"ready",
"(",
"$",
"event",
",",
"$",
"params",
"=",
"array",
"(",
")",
")",
"{",
"$",
"responses",
"=",
"static",
"::",
"fire",
"(",
"$",
"event",
",",
"$",
"params",
")",
";",
"foreach",
"(",
"static",
"::",
"pack",
"(",
"$",
"responses",
")",
"as",
"$",
"response",
")",
"{",
"if",
"(",
"$",
"response",
"!==",
"true",
")",
"{",
"return",
"false",
";",
"}",
"}",
"return",
"true",
";",
"}"
]
| also fires an event but returns a bool positiv
only if all responses where positiv, like all system ready YESS!
@param string $event
@param array $params
@return array | [
"also",
"fires",
"an",
"event",
"but",
"returns",
"a",
"bool",
"positiv",
"only",
"if",
"all",
"responses",
"where",
"positiv",
"like",
"all",
"system",
"ready",
"YESS!"
]
| 9f6ec72c1a439de4b253d0223f1029f7f85b6ef8 | https://github.com/ClanCats/Core/blob/9f6ec72c1a439de4b253d0223f1029f7f85b6ef8/src/classes/CCEvent.php#L76-L86 |
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.