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

lists() public méthode

Get an array with the values of a given key.
public lists ( string $value, string $key = null ) : array
$value string
$key string
Résultat array
    public function lists($value, $key = null)
    {
        return array_pluck($this->items, $value, $key);
    }

Usage Example

Exemple #1
0
 public function testGetListValueWithAccessors()
 {
     $model = new TestAccessorFOF30TestStub(array('some' => 'foo'));
     $modelTwo = new TestAccessorFOF30TestStub(array('some' => 'bar'));
     $data = new Collection(array($model, $modelTwo));
     $this->assertEquals(array('foo', 'bar'), $data->lists('some'));
 }