Files
hocusfokus-web/kirby/src/Cms/NestCollection.php
Bastian Allgeier 447a9dd266 Upgrade to 3.2.5
2019-09-24 11:00:59 +02:00

34 lines
759 B
PHP
Executable File

<?php
namespace Kirby\Cms;
use Closure;
use Kirby\Toolkit\Collection as BaseCollection;
/**
* NestCollection
*
* @package Kirby Cms
* @author Bastian Allgeier <bastian@getkirby.com>
* @link https://getkirby.com
* @copyright Bastian Allgeier GmbH
* @license https://getkirby.com/license
*/
class NestCollection extends BaseCollection
{
/**
* Converts all objects in the collection
* to an array. This can also take a callback
* function to further modify the array result.
*
* @param Closure $map
* @return array
*/
public function toArray(Closure $map = null): array
{
return parent::toArray($map ?? function ($object) {
return $object->toArray();
});
}
}