public function build($id, array $config = [])
    {
        $id = $this->dereference($id);

        if (isset($this->building[$id])) {
            throw new CircularReferenceException(sprintf(
                'Circular reference to "%s" detected while building: %s; dereferencing: %s',
                $id,
                implode(',', array_keys($this->building)),
                implode(',', array_keys($this->dereferencing))
            ));
        }
        $this->building[$id] = 1;

        $this->registerProviderIfDeferredFor($id);

        $object = isset($this->definitions[$id])
            ? $this->buildWithDefinition($id, $config, $this->definitions[$id])
            : $this->buildWithoutDefinition($id, $config)
        ;

        unset($this->building[$id]);

        return $object;
    }