FOF30\Utils\Collection::make PHP Méthode

make() public static méthode

Create a new collection instance if the value isn't one already.
public static make ( mixed $items ) : static
$items mixed
Résultat static
    public static function make($items)
    {
        if (is_null($items)) {
            return new static();
        }
        if ($items instanceof Collection) {
            return $items;
        }
        return new static(is_array($items) ? $items : array($items));
    }

Usage Example

Exemple #1
0
 public function testMakeMethod()
 {
     $collection = Collection::make('foo');
     $this->assertEquals(array('foo'), $collection->all());
 }