Nelmio\Alice\ObjectBag::__construct PHP Method

__construct() public method

public __construct ( array $objects = [] )
$objects array
    public function __construct(array $objects = [])
    {
        foreach ($objects as $id => $object) {
            if ($object instanceof ObjectInterface) {
                if ($id !== $object->getId()) {
                    throw InvalidArgumentExceptionFactory::createForReferenceKeyMismatch($id, $object->getId());
                }
                $this->objects[$id] = $object;
                $this->array[$id] = $object->getInstance();
                continue;
            }
            $this->objects[$id] = new CompleteObject(new SimpleObject($id, $object));
            $this->array[$id] = $object;
        }
    }