public function get($id)
    {
        $id = strtolower($id);
        $isAlias = false;

        if (array_key_exists($id, $this->aliases)) {
            $id = $this->aliases[$id];
            $isAlias = true;
        }

        if (!array_key_exists($id, $this->serviceDefinitions)) {
            if (array_key_exists($id, $this->services)) {
                return $this->services[$id];
            }

            throw new \InvalidArgumentException('service is not defined');
        }

        $definition = $this->serviceDefinitions[$id];

        if (false === $definition->getPublic() && false === $isAlias) {
            throw new \InvalidArgumentException('cannot access service directly');
        }

        if (array_key_exists($id, $this->services)) {
            return $this->services[$id];
        }

        $service = $this->generateService($definition);

        if ($definition->getShare()) {
            $this->services[$id] = $service;
        }

        return $service;
    }