Upgrade to 3.5.5
This commit is contained in:
@@ -95,7 +95,7 @@ class Collection extends Iterator implements Countable
|
||||
*
|
||||
* @param string $key string or array
|
||||
* @param mixed $value
|
||||
* @return \Kirby\Toolkit\Collection
|
||||
* @return $this
|
||||
*/
|
||||
public function __set(string $key, $value)
|
||||
{
|
||||
@@ -134,7 +134,7 @@ class Collection extends Iterator implements Countable
|
||||
* @param mixed $key
|
||||
* @param mixed $item
|
||||
* @param mixed ...$args
|
||||
* @return \Kirby\Toolkit\Collection
|
||||
* @return $this
|
||||
*/
|
||||
public function append(...$args)
|
||||
{
|
||||
@@ -152,8 +152,8 @@ class Collection extends Iterator implements Countable
|
||||
* The last chunk may be smaller
|
||||
*
|
||||
* @param int $size Number of elements per chunk
|
||||
* @return \Kirby\Toolkit\Collection A new collection with an element for each chunk and
|
||||
* a sub collection in each chunk
|
||||
* @return static A new collection with an element for each chunk and
|
||||
* a sub collection in each chunk
|
||||
*/
|
||||
public function chunk(int $size)
|
||||
{
|
||||
@@ -183,7 +183,7 @@ class Collection extends Iterator implements Countable
|
||||
/**
|
||||
* Returns a cloned instance of the collection
|
||||
*
|
||||
* @return \Kirby\Toolkit\Collection
|
||||
* @return $this
|
||||
*/
|
||||
public function clone()
|
||||
{
|
||||
@@ -194,7 +194,7 @@ class Collection extends Iterator implements Countable
|
||||
* Getter and setter for the data
|
||||
*
|
||||
* @param array|null $data
|
||||
* @return array|\Kirby\Toolkit\Collection
|
||||
* @return array|$this
|
||||
*/
|
||||
public function data(array $data = null)
|
||||
{
|
||||
@@ -214,7 +214,7 @@ class Collection extends Iterator implements Countable
|
||||
/**
|
||||
* Clone and remove all elements from the collection
|
||||
*
|
||||
* @return \Kirby\Toolkit\Collection
|
||||
* @return static
|
||||
*/
|
||||
public function empty()
|
||||
{
|
||||
@@ -228,7 +228,7 @@ class Collection extends Iterator implements Countable
|
||||
* Adds all elements to the collection
|
||||
*
|
||||
* @param mixed $items
|
||||
* @return \Kirby\Toolkit\Collection
|
||||
* @return static
|
||||
*/
|
||||
public function extend($items)
|
||||
{
|
||||
@@ -243,7 +243,7 @@ class Collection extends Iterator implements Countable
|
||||
*
|
||||
* @param string|array|\Closure $field
|
||||
* @param mixed ...$args
|
||||
* @return \Kirby\Toolkit\Collection
|
||||
* @return static
|
||||
*/
|
||||
public function filter($field, ...$args)
|
||||
{
|
||||
@@ -323,7 +323,7 @@ class Collection extends Iterator implements Countable
|
||||
*
|
||||
* @param string|Closure $field
|
||||
* @param array ...$args
|
||||
* @return self
|
||||
* @return static
|
||||
*/
|
||||
public function filterBy(...$args)
|
||||
{
|
||||
@@ -452,7 +452,7 @@ class Collection extends Iterator implements Countable
|
||||
/**
|
||||
* Returns the elements in reverse order
|
||||
*
|
||||
* @return \Kirby\Toolkit\Collection
|
||||
* @return static
|
||||
*/
|
||||
public function flip()
|
||||
{
|
||||
@@ -525,7 +525,9 @@ class Collection extends Iterator implements Countable
|
||||
*
|
||||
* @param string|Closure $field
|
||||
* @param bool $i
|
||||
* @return \Kirby\Toolkit\Collection A new collection with an element for each group and a subcollection in each group
|
||||
* @return \Kirby\Toolkit\Collection A new collection with an element for
|
||||
* each group and a subcollection in
|
||||
* each group
|
||||
* @throws \Exception if $field is not a string nor a callback function
|
||||
*/
|
||||
public function group($field, bool $i = true)
|
||||
@@ -586,7 +588,9 @@ class Collection extends Iterator implements Countable
|
||||
*
|
||||
* @param string|Closure $field
|
||||
* @param bool $i
|
||||
* @return \Kirby\Toolkit\Collection A new collection with an element for each group and a sub collection in each group
|
||||
* @return \Kirby\Toolkit\Collection A new collection with an element for
|
||||
* each group and a sub collection in
|
||||
* each group
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function groupBy(...$args)
|
||||
@@ -599,7 +603,7 @@ class Collection extends Iterator implements Countable
|
||||
* @since 3.3.0
|
||||
*
|
||||
* @param \Kirby\Toolkit\Collection $other
|
||||
* @return \Kirby\Toolkit\Collection
|
||||
* @return static
|
||||
*/
|
||||
public function intersection($other)
|
||||
{
|
||||
@@ -679,7 +683,7 @@ class Collection extends Iterator implements Countable
|
||||
* Returns a new object with a limited number of elements
|
||||
*
|
||||
* @param int $limit The number of elements to return
|
||||
* @return \Kirby\Toolkit\Collection
|
||||
* @return static
|
||||
*/
|
||||
public function limit(int $limit)
|
||||
{
|
||||
@@ -690,7 +694,7 @@ class Collection extends Iterator implements Countable
|
||||
* Map a function to each element
|
||||
*
|
||||
* @param callable $callback
|
||||
* @return \Kirby\Toolkit\Collection
|
||||
* @return $this
|
||||
*/
|
||||
public function map(callable $callback)
|
||||
{
|
||||
@@ -713,7 +717,7 @@ class Collection extends Iterator implements Countable
|
||||
* Returns a Collection without the given element(s)
|
||||
*
|
||||
* @param string ...$keys any number of keys, passed as individual arguments
|
||||
* @return \Kirby\Toolkit\Collection
|
||||
* @return static
|
||||
*/
|
||||
public function not(...$keys)
|
||||
{
|
||||
@@ -728,7 +732,7 @@ class Collection extends Iterator implements Countable
|
||||
* Returns a new object starting from the given offset
|
||||
*
|
||||
* @param int $offset The index to start from
|
||||
* @return \Kirby\Toolkit\Collection
|
||||
* @return static
|
||||
*/
|
||||
public function offset(int $offset)
|
||||
{
|
||||
@@ -739,7 +743,7 @@ class Collection extends Iterator implements Countable
|
||||
* Add pagination
|
||||
*
|
||||
* @param array ...$arguments
|
||||
* @return \Kirby\Toolkit\Collection a sliced set of data
|
||||
* @return static a sliced set of data
|
||||
*/
|
||||
public function paginate(...$arguments)
|
||||
{
|
||||
@@ -795,7 +799,7 @@ class Collection extends Iterator implements Countable
|
||||
* @param mixed $key
|
||||
* @param mixed $item
|
||||
* @param mixed ...$args
|
||||
* @return \Kirby\Toolkit\Collection
|
||||
* @return $this
|
||||
*/
|
||||
public function prepend(...$args)
|
||||
{
|
||||
@@ -817,7 +821,7 @@ class Collection extends Iterator implements Countable
|
||||
* Any part of the query is optional.
|
||||
*
|
||||
* @param array $arguments
|
||||
* @return \Kirby\Toolkit\Collection
|
||||
* @return static
|
||||
*/
|
||||
public function query(array $arguments = [])
|
||||
{
|
||||
@@ -875,7 +879,7 @@ class Collection extends Iterator implements Countable
|
||||
* Removes an element from the array by key
|
||||
*
|
||||
* @param mixed $key the name of the key
|
||||
* @return \Kirby\Toolkit\Collection
|
||||
* @return $this
|
||||
*/
|
||||
public function remove($key)
|
||||
{
|
||||
@@ -888,7 +892,7 @@ class Collection extends Iterator implements Countable
|
||||
*
|
||||
* @param mixed $key string or array
|
||||
* @param mixed $value
|
||||
* @return \Kirby\Toolkit\Collection
|
||||
* @return $this
|
||||
*/
|
||||
public function set($key, $value = null)
|
||||
{
|
||||
@@ -905,7 +909,7 @@ class Collection extends Iterator implements Countable
|
||||
/**
|
||||
* Shuffle all elements
|
||||
*
|
||||
* @return \Kirby\Toolkit\Collection
|
||||
* @return static
|
||||
*/
|
||||
public function shuffle()
|
||||
{
|
||||
@@ -928,7 +932,7 @@ class Collection extends Iterator implements Countable
|
||||
*
|
||||
* @param int $offset The optional index to start the slice from
|
||||
* @param int|null $limit The optional number of elements to return
|
||||
* @return \Kirby\Toolkit\Collection
|
||||
* @return $this|static
|
||||
*/
|
||||
public function slice(int $offset = 0, int $limit = null)
|
||||
{
|
||||
@@ -972,7 +976,7 @@ class Collection extends Iterator implements Countable
|
||||
* @param string|callable $field Field name or value callback to sort by
|
||||
* @param string $direction asc or desc
|
||||
* @param int $method The sort flag, SORT_REGULAR, SORT_NUMERIC etc.
|
||||
* @return \Kirby\Toolkit\Collection
|
||||
* @return $this|static
|
||||
*/
|
||||
public function sort()
|
||||
{
|
||||
@@ -1088,7 +1092,7 @@ class Collection extends Iterator implements Countable
|
||||
* @param string|callable $field Field name or value callback to sort by
|
||||
* @param string $direction asc or desc
|
||||
* @param int $method The sort flag, SORT_REGULAR, SORT_NUMERIC etc.
|
||||
* @return Collection
|
||||
* @return $this|static
|
||||
*/
|
||||
public function sortBy(...$args)
|
||||
{
|
||||
@@ -1170,7 +1174,7 @@ class Collection extends Iterator implements Countable
|
||||
* Alias for $this->not()
|
||||
*
|
||||
* @param string ...$keys any number of keys, passed as individual arguments
|
||||
* @return \Kirby\Toolkit\Collection
|
||||
* @return static
|
||||
*/
|
||||
public function without(...$keys)
|
||||
{
|
||||
|
@@ -69,7 +69,7 @@ class Dir
|
||||
|
||||
if (is_dir($root) === true) {
|
||||
if ($recursive === true) {
|
||||
static::copy($root, $target . '/' . $name);
|
||||
static::copy($root, $target . '/' . $name, true, $ignore);
|
||||
}
|
||||
} else {
|
||||
F::copy($root, $target . '/' . $name);
|
||||
@@ -254,7 +254,7 @@ class Dir
|
||||
* @param string $dir The path of the directory
|
||||
* @param string $format
|
||||
* @param string $handler
|
||||
* @return int
|
||||
* @return int|string
|
||||
*/
|
||||
public static function modified(string $dir, string $format = null, string $handler = 'date')
|
||||
{
|
||||
|
@@ -23,6 +23,13 @@ use Laminas\Escaper\Escaper;
|
||||
*/
|
||||
class Escape
|
||||
{
|
||||
/**
|
||||
* The internal singleton escaper instance
|
||||
*
|
||||
* @var \Laminas\Escaper\Escaper
|
||||
*/
|
||||
protected static $escaper;
|
||||
|
||||
/**
|
||||
* Escape common HTML attributes data
|
||||
*
|
||||
@@ -43,7 +50,7 @@ class Escape
|
||||
*/
|
||||
public static function attr($string)
|
||||
{
|
||||
return (new Escaper('utf-8'))->escapeHtmlAttr($string);
|
||||
return static::escaper()->escapeHtmlAttr($string);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -64,7 +71,17 @@ class Escape
|
||||
*/
|
||||
public static function css($string)
|
||||
{
|
||||
return (new Escaper('utf-8'))->escapeCss($string);
|
||||
return static::escaper()->escapeCss($string);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the escaper instance (and create if needed)
|
||||
*
|
||||
* @return \Laminas\Escaper\Escaper
|
||||
*/
|
||||
protected static function escaper()
|
||||
{
|
||||
return static::$escaper = static::$escaper ?? new Escaper('utf-8');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -84,7 +101,7 @@ class Escape
|
||||
*/
|
||||
public static function html($string)
|
||||
{
|
||||
return (new Escaper('utf-8'))->escapeHtml($string);
|
||||
return static::escaper()->escapeHtml($string);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -102,7 +119,7 @@ class Escape
|
||||
*/
|
||||
public static function js($string)
|
||||
{
|
||||
return (new Escaper('utf-8'))->escapeJs($string);
|
||||
return static::escaper()->escapeJs($string);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -81,7 +81,6 @@ class F
|
||||
'jpeg',
|
||||
'jpg',
|
||||
'jpe',
|
||||
'jp2',
|
||||
'png',
|
||||
'ps',
|
||||
'psd',
|
||||
|
@@ -59,7 +59,7 @@ class File
|
||||
*
|
||||
* @param string $target
|
||||
* @param bool $force
|
||||
* @return self
|
||||
* @return static
|
||||
*/
|
||||
public function copy(string $target, bool $force = false)
|
||||
{
|
||||
@@ -197,7 +197,7 @@ class File
|
||||
*
|
||||
* @param string $newRoot
|
||||
* @param bool $overwrite Force overwriting any existing files
|
||||
* @return self
|
||||
* @return static
|
||||
*/
|
||||
public function move(string $newRoot, bool $overwrite = false)
|
||||
{
|
||||
@@ -256,7 +256,7 @@ class File
|
||||
*
|
||||
* @param string $newName
|
||||
* @param bool $overwrite Force overwrite existing files
|
||||
* @return self
|
||||
* @return static
|
||||
*/
|
||||
public function rename(string $newName, bool $overwrite = false)
|
||||
{
|
||||
|
@@ -55,7 +55,9 @@ class I18n
|
||||
/**
|
||||
* Returns the first fallback locale
|
||||
*
|
||||
* @deprecated 3.5.1 Use \Kirby\Toolkit\I18n::fallbacks() instead
|
||||
* @deprecated 3.5.1 Use `\Kirby\Toolkit\I18n::fallbacks()` instead
|
||||
* @todo Add deprecated() helper warning in 3.6.0
|
||||
* @todo Remove in 3.7.0
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
@@ -66,7 +66,7 @@ class Pagination
|
||||
*
|
||||
* @param \Kirby\Toolkit\Collection $collection
|
||||
* @param mixed ...$arguments
|
||||
* @return self
|
||||
* @return static
|
||||
*/
|
||||
public static function for(Collection $collection, ...$arguments)
|
||||
{
|
||||
@@ -380,7 +380,7 @@ class Pagination
|
||||
* and validates that the properties match
|
||||
*
|
||||
* @param array $props Array with keys limit, total and/or page
|
||||
* @return self
|
||||
* @return $this
|
||||
*/
|
||||
protected function setProperties(array $props)
|
||||
{
|
||||
@@ -417,7 +417,7 @@ class Pagination
|
||||
* Sets the number of items per page
|
||||
*
|
||||
* @param int $limit
|
||||
* @return self
|
||||
* @return $this
|
||||
*/
|
||||
protected function setLimit(int $limit = 20)
|
||||
{
|
||||
@@ -433,7 +433,7 @@ class Pagination
|
||||
* Sets the total number of items
|
||||
*
|
||||
* @param int $total
|
||||
* @return self
|
||||
* @return $this
|
||||
*/
|
||||
protected function setTotal(int $total = 0)
|
||||
{
|
||||
@@ -450,7 +450,7 @@ class Pagination
|
||||
*
|
||||
* @param int|string|null $page Int or int in string form;
|
||||
* automatically determined if null
|
||||
* @return self
|
||||
* @return $this
|
||||
*/
|
||||
protected function setPage($page = null)
|
||||
{
|
||||
|
@@ -23,7 +23,7 @@ trait Properties
|
||||
* initial properties.
|
||||
*
|
||||
* @param array $props
|
||||
* @return self
|
||||
* @return static
|
||||
*/
|
||||
public function clone(array $props = [])
|
||||
{
|
||||
@@ -34,7 +34,7 @@ trait Properties
|
||||
* Creates a clone and fetches all
|
||||
* lazy-loaded getters to get a full copy
|
||||
*
|
||||
* @return self
|
||||
* @return static
|
||||
*/
|
||||
public function hardcopy()
|
||||
{
|
||||
|
Reference in New Issue
Block a user