FOF30\Utils\Collection::intersect PHP Метод

intersect() публичный Метод

Intersect the collection with the given items.
public intersect ( Collection | array $items ) : Collection
$items Collection | array
Результат Collection
    public function intersect($items)
    {
        return new static(array_intersect($this->items, $this->getArrayableItems($items)));
    }

Usage Example

Пример #1
0
 public function testIntersectCollection()
 {
     $c = new Collection(array('id' => 1, 'first_word' => 'Hello'));
     $this->assertEquals(array('first_word' => 'Hello'), $c->intersect(new Collection(array('first_world' => 'Hello', 'last_word' => 'World')))->all());
 }