src/Service/EntityEraser/DependencyResultCollection.php
public function add($name, $entities = null, array $options = null)
    {
        if ($name instanceof DependencyResult) {
            return $this->addResult($name);
        }

        if ($name instanceof \Traversable) {
            return $this->addTraversable($name);
        }

        if (is_array($name)) {
            return $this->addArray($name);
        }

        if (null === $entities) {
            throw new \UnexpectedValueException('$entities must not be null.');
        }

        return $this->addArray([
            'name' => $name,
            'entities' => $entities,
            'options' => $options,
        ]);
    }
public function add($name, $entities = null, array $options = null)
    {
        if ($name instanceof DependencyResult) {
            return $this->addResult($name);
        }

        if ($name instanceof \Traversable) {
            return $this->addTraversable($name);
        }

        if (is_array($name)) {
            return $this->addArray($name);
        }

        if (null === $entities) {
            throw new \UnexpectedValueException('$entities must not be null.');
        }

        return $this->addArray([
            'name' => $name,
            'entities' => $entities,
            'options' => $options,
        ]);
    }
Add a result in various formats.

Possible are
- a DependencyResult object
- any \Traversable object (in that case, the name is set to the class name of the first item)
- an array of DependencyResult objects.
- an array in the format
[ name, entities, options]
-an array in the format
[
'name' => name,
'entities' => entities,
'options' => [ ... ]
]
- an array of arrays in any of the two formats above or \Traversable objects. Can be mixed.

@param DependencyResult|array|\Traversable|string           $name
@param null|array|\Traversable       $entities
@param array|null $options

@return DependencyResultCollection