Get a new extension method

@param string $name

@throws \InvalidArgumentException
@throws \LogicException

@return \Closure
16452
public function get($name)
    {
        if (!is_string($name)) {
            throw new \InvalidArgumentException(self::MSG_EXTENSION_NAME, 220);
        }
    
        if (!$this->offsetExists(strtolower($name))) {
            throw new \LogicException(sprintf(self::MSG_NO_EXTENSION_TOGET, $name), 221);
        }
        
        return parent::offsetGet(strtolower($name));
    }
258399
public function set($name, \Closure $extension)
    {
        if (!is_string($name)) {
            throw new \InvalidArgumentException(self::MSG_EXTENSION_NAME, 210);
        }

        parent::offsetSet(strtolower($name), $extension);
        
        return $this;
    }
832011
public function get($name)
    {
        if (!isset($this->formats[$name])) {
            throw new \InvalidArgumentException(sprintf(
                'Unknown format "%s", known formats: "%s"',
                $name, implode(', ', array_keys($this->formats))
            ));
        }

        return $this->formats[$name];
    }
247604
public function removeExtension($name)
    {
        if (isset($this->extensions[$name])) {
            unset($this->extensions[$name]);
        }

        return $this;
    }
40032
public function getAppender($name)
    {
        if (!isset($this->appenderMap[$name])) {
            LoggerPolicy::processConfigurationError("Appender {$name} not found");

            return new AppenderNull();
        }

        return $this->appenderMap[$name];
    }
611457
public function getExtensionConfig($name)
    {
        if (!isset($this->extensionConfigs[$name])) {
            $this->extensionConfigs[$name] = [];
        }

        return $this->extensionConfigs[$name];
    }
1241222
public function method($name)
    {
        $method = new Method($name);
        $this->container->put($name, $method);

        return $method;
    }
1117560
public function get($name)
    {
        if ($this->has($name)) {
            $code = $this->getCode($name);

            $this->elements[$code] = $this->resolve($this->elements[$code]);

            return $this->elements[$code];
        }

        throw new \InvalidArgumentException(sprintf('Element "%s" does not exist.', $name));
    }
254726
public function extension_loaded($name)
    {
        $code = new Code();
        $code->addStatement(sprintf(
            "return extension_loaded(%s);",
            var_export($name, true)
        ));

        return $this->adapter->run($code);
    }
1271984
public function get(string $name): Method
    {
        if (!$this->has($name)) {
            //Automatically creating constant
            $method = new Method($name);
            $this->add($method);

            return $method;
        }

        return parent::get($name);
    }
997678
public function get($name)
    {
        $this->checkNameIsString($name);

        if (isset($this->encrypters[$name])) {
            $encrypter = $this->encrypters[$name];
        } else {
            if (isset($this->configs[$name])) {
                $config = $this->configs[$name];
                $encrypter = new ManagedEncrypter($config);

                $this->encrypters[$name] = $encrypter;
            } else {
                throw new \InvalidArgumentException('Unknown encrypter (' . $name . ')');
            }
        }

        return $encrypter;
    }
1103158
public function getArgument($name) {
        if (!$this->definition->hasArgument($name)) {
            throw new \InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
        }

        return isset($this->arguments[$name]) ? $this->arguments[$name] : $this->definition->getArgument($name)
            ->getDefault();
    }
578875
public function getMethod($name)
    {
        if ($this->hasMethod($name) === true) {
            return $this->methods[$name];
        } else {
            throw new InvalidArgumentException('Method "' . $name . '" is not defined.');
        }
    }
276940
protected function date(string $name): Closure
    {
        return function (Table $table) use ($name) {
            $table->addColumn($name, Type::DATE)->setNotnull(true);
        };
    }
63750
public function addMethod($name, callable $method)
    {
        $this->methods[$name] = \Closure::bind($method, $this, $this);

        return $this;
    }
1135557
protected function makeConnection($name)
    {
        $config = $this->configuration($name);

        // First we will check by the connection name to see if an extension has been
        // registered specifically for that connection. If it has we will call the
        // Closure and pass it the config allowing it to resolve the connection.
//        if (isset($this->extensions[$name])) {
//            return call_user_func($this->extensions[$name], $config, $name);
//        }

        // Next we will check to see if an extension has been registered for a driver
        // and will call the Closure if so, which allows us to have a more generic
        // resolver for the drivers themselves which applies to all connections.
//        if (isset($this->extensions[$driver = $config['driver']])) {
//            return call_user_func($this->extensions[$driver], $config, $name);
//        }
        return $this->factory->make($config, $name);
    }
678469
protected function makeService($name)
    {
        $config = $this->getConfig($name);

        // First we will check by the service name to see if an extension has been
        // registered specifically for that service. If it has we will call the
        // Closure and pass it the config allowing it to resolve the service.
        if (isset($this->extensions[$name])) {
            return call_user_func($this->extensions[$name], $config, $name);
        }

        $config = $this->getDbConfig($name);
        $type = $config['type'];

        // Next we will check to see if a type extension has been registered for a service type
        // and will call the factory Closure if so, which allows us to have a more generic
        // resolver for the service types themselves which applies to all services.
        if (isset($this->types[$type])) {
            return $this->types[$type]->make($name, $config);
        }

        throw new InvalidArgumentException("Unsupported service type '$type'.");
    }