Update Kirby and dependencies
This commit is contained in:
parent
503b339974
commit
399fa20902
439 changed files with 66915 additions and 64442 deletions
|
@ -15,59 +15,59 @@ namespace Kirby\Toolkit;
|
|||
*/
|
||||
class Silo
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public static $data = [];
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public static $data = [];
|
||||
|
||||
/**
|
||||
* Setter for new data.
|
||||
*
|
||||
* @param string|array $key
|
||||
* @param mixed $value
|
||||
* @return array
|
||||
*/
|
||||
public static function set($key, $value = null): array
|
||||
{
|
||||
if (is_array($key) === true) {
|
||||
return static::$data = array_merge(static::$data, $key);
|
||||
} else {
|
||||
static::$data[$key] = $value;
|
||||
return static::$data;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Setter for new data.
|
||||
*
|
||||
* @param string|array $key
|
||||
* @param mixed $value
|
||||
* @return array
|
||||
*/
|
||||
public static function set($key, $value = null): array
|
||||
{
|
||||
if (is_array($key) === true) {
|
||||
return static::$data = array_merge(static::$data, $key);
|
||||
} else {
|
||||
static::$data[$key] = $value;
|
||||
return static::$data;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|array $key
|
||||
* @param mixed $default
|
||||
* @return mixed
|
||||
*/
|
||||
public static function get($key = null, $default = null)
|
||||
{
|
||||
if ($key === null) {
|
||||
return static::$data;
|
||||
}
|
||||
/**
|
||||
* @param string|array $key
|
||||
* @param mixed $default
|
||||
* @return mixed
|
||||
*/
|
||||
public static function get($key = null, $default = null)
|
||||
{
|
||||
if ($key === null) {
|
||||
return static::$data;
|
||||
}
|
||||
|
||||
return A::get(static::$data, $key, $default);
|
||||
}
|
||||
return A::get(static::$data, $key, $default);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes an item from the data array
|
||||
*
|
||||
* @param string|null $key
|
||||
* @return array
|
||||
*/
|
||||
public static function remove(string $key = null): array
|
||||
{
|
||||
// reset the entire array
|
||||
if ($key === null) {
|
||||
return static::$data = [];
|
||||
}
|
||||
/**
|
||||
* Removes an item from the data array
|
||||
*
|
||||
* @param string|null $key
|
||||
* @return array
|
||||
*/
|
||||
public static function remove(string $key = null): array
|
||||
{
|
||||
// reset the entire array
|
||||
if ($key === null) {
|
||||
return static::$data = [];
|
||||
}
|
||||
|
||||
// unset a single key
|
||||
unset(static::$data[$key]);
|
||||
// unset a single key
|
||||
unset(static::$data[$key]);
|
||||
|
||||
// return the array without the removed key
|
||||
return static::$data;
|
||||
}
|
||||
// return the array without the removed key
|
||||
return static::$data;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue