Anemone::from()

Object instantiator.

Table of Contents
  1. Description
  2. Example

Description

Anemone::from(...$lot): self;

It is just a shortcut for the Anemone::__construct() way.

Example

$anemone = Anemone::from([1, 2, 3, 4, 5], ';');

The example above is the same as the instantiation below:

$anemone = new Anemone([1, 2, 3, 4, 5], ';');

Its purpose is to help you avoid using parentheses when you want to call a method directly from the class instance to minimize variable usage:

// Syntax error, unexpected token “->”, expecting “)”
$first = new Anemone([1, 2, 3, 4, 5])->first();

// :(
$anemone = new Anemone([1, 2, 3, 4, 5]);
$first = $anemone->first();

$first = (new Anemone([1, 2, 3, 4, 5]))->first(); // :\
$first = Anemone::from([1, 2, 3, 4, 5])->first(); // :)

Anemone::any()

Checks if at least one item in the data passes the test.

Anemone::from()

Object instantiator.

Anemone::is()

Filters the data so that only items that pass the test are left.

Anemone::not()

Filters the data so that only items that do not pass the test are left.

Anemone::pluck()

Returns a new data set contains values from the key on every item.