public function get($key)
    {
        if (! \is_string($key) || empty($key)) {
            throw new ContainerException("$key must be a string");
        }

        if ($this->storage->hasStored($key)) {
            return $this->storage->getStored($key);
        }

        // key exists but hasn't been initialized yet
        if ($this->storage->hasObject($key)) {
            $this->storage->store($key, $this->storage->getDefinition($key)($this));
            return $this->storage->getStored($key);
        }

        if ($this->storage->hasFactory($key)) {
            $definition = $this->storage->getFactory($key);

            return $definition($this);
        }

        // the key was not found
        throw new NotFoundException("The key [$key] could not be found");
    }