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,
        ]);
    }