Puli\Repository\Resource\Collection\ArrayResourceCollection::merge PHP Méthode

merge() public méthode

public merge ( $resources )
    public function merge($resources)
    {
        Assert::allIsInstanceOf($resources, 'Puli\\Repository\\Api\\Resource\\PuliResource');
        // only start merging after validating all resources
        foreach ($resources as $resource) {
            $this->resources[] = $resource;
        }
    }

Usage Example

 /**
  * @expectedException \InvalidArgumentException
  */
 public function testMergeFailsIfNoResource()
 {
     $collection = new ArrayResourceCollection();
     $collection->merge(array('foobar'));
 }