Init.
@param  string $name
@param  array  $options
@return froq\encoding\EncoderInterface
@throws froq\encoding\EncoderException
421807
public static final function init(string $name, array $options = null): EncoderInterface
    {
        switch ($name) {
            case self::NAME_JSON: return new JsonEncoder($options);
            case self::NAME_GZIP: return new GzipEncoder($options);
        }

        throw new EncoderException("Unimplemented encoder '{$name}' given");
    }
503291
public function queue($name, array $options = [])
    {
        return $this->queues[$name] = (new QueueBuilder($this, $name))->options($options);
    }
759697
public function block($name, $options=[]) {

        if (!isset($this->blocks[$name])) return null;

        $options = \array_merge([
            'print' => true
        ], $options);

        $block = \implode("\n", $this->blocks[$name]);

        if ($options['print']){
            echo $block;
        }

        return $block;
    }
101770
public function get(string $name): EncoderInterface
    {
        if (!isset($this->encoders[$name])) {
            throw new \InvalidArgumentException('There is no encoder registered with name '.$name);
        }

        return $this->encoders[$name];
    }
968054
public function text(string $name, array $options = []): FieldTypeInterface
    {
        return (new TextType($name))
            ->setLocale($this->app->getLocale())
            ->setViewFactory($this->viewFactory)
            ->setOptions($options);
    }
805556
public function create($name, $options)
    {
        switch (strtolower($name)) {
            case 'apc':
            case 'apccache':
                $cache = $this->createApc();
                break;
            case 'array':
            case 'arraycache':
                $cache = new ArrayCache();
                break;
            case 'memcache':
            case 'memcachecache':
                $cache = $this->createMemcache($options);
                break;
            case 'memcached':
            case 'memcachedcache':
                $cache = $this->createMemcached($options);
                break;
            case 'redis':
            case 'rediscache':
                $cache = $this->createRedis($options);
                break;
            case 'wincache':
            case 'wincachecache':
                $cache = $this->createWincache();
                break;
            case 'xcache':
            case 'xcachecache':
                $cache = $this->createXcache();
                break;
            default:
                throw new RuntimeException(sprintf('Unnown cache type %s', $name));
        }

        return $cache;
    }
93514
public function delete(string $name, array $options = []): Cookies
	{
		$this->add($name, '', -3600, $options);

		return $this;
	}
1182965
private function createServiceFromDelegator(string $name, array $options = null)
    {
        // @todo: This selection is necessary only because lazy services
        // configuration currently requires an explicit Delegator definition
        if ($this->delegators[$name][0] === Proxy\LazyServiceFactory::class) {
            return $this->createServiceFromLazyServiceDelegator($name, $options);
        }

        $creationCallback = $this->delegatorCallbackCache[$name] ?? null;
        if ($creationCallback) {
            $object = $creationCallback($this->creationContext, $name, $creationCallback, $options);
            return $object;
        }

        $creationCallback = function () use ($name, $options) {
            return $this->createServiceFromFactory($name, $options);
        };

        foreach ($this->delegators[$name] as $index => $delegatorFactory) {
            if (is_string($delegatorFactory) && class_exists($delegatorFactory)) {
                $delegatorFactory = new $delegatorFactory();
                if ($delegatorFactory instanceof DelegatorFactoryInterface) {
                    $this->delegators[$name][$index] = $delegatorFactory;
                    $creationCallback = function () use ($delegatorFactory, $name, $creationCallback, $options) {
                        return $delegatorFactory($this->creationContext, $name, $creationCallback, $options);
                    };
                    continue;
                }
            }
            if (is_callable($delegatorFactory)) {
                $creationCallback = function () use ($delegatorFactory, $name, $creationCallback, $options) {
                    return $delegatorFactory($this->creationContext, $name, $creationCallback, $options);
                };
                continue;
            }
            if (is_string($delegatorFactory)) {
                throw InvalidArgumentException::fromInvalidDelegatorFactoryClass($delegatorFactory);
            }
            throw InvalidArgumentException::fromInvalidDelegatorFactoryInstance($delegatorFactory);
        }

        //cache the callback for later requests
        $this->delegatorCallbackCache[$name] = $creationCallback;
        return $creationCallback($this->creationContext, $name, $creationCallback, $options);
    }
945638
public static function buildKeyValidation(array $options, $name)
    {
        if (!key_exists(Properties::TYPE, $options)) {
            trigger_error($name . ' must have a type');
        }

        switch ($options[Properties::TYPE]) {
            case Types::STR:
            case Types::STRING:
                return new StringValidation($name, $options);
            case Types::INT:
            case Types::INTEGER:
                return new IntegerValidation($name, $options);
            case Types::FLOAT:
                return new FloatValidation($name, $options);
            case Types::BOOLEAN:
                return new BooleanValidation($name, $options);
            case Types::ARRY:
                return new ArrayValidation($name, $options);
            default:
                trigger_error(sprintf('%s is unknown', $options[Properties::TYPE]), E_USER_ERROR);
        }
    }
768364
public function alterTable($name, array $options = [])
    {
        $schema = isset($options['schema']) ? new Schema($options['schema']) : null;

        return (new TableApi($name, $schema, $this->manipulation, $this->actions))
            ->alterTable();
    }
1097717
public function _init($options)
    {
		if(is_array($options)) {
			foreach($options as $opt_name => $opt_val) {
				if(property_exists($this, $opt_name)) {
					$this->$opt_name = $opt_val;
				}
			}
		}
    }
1306386
public function make($name, array $options)
    {
        //check the permission on this item
        $options = $this->parseDefaults($name, $options);

        //now we can instantiate the object
        return $this->getActionObject($options);
    }
269040
protected function setOption(Array $options, $name, $method)
    {
        if (isset($options[$name])) {
            $this->$method($options[$name]);
        }
    }
429039
public function make($name, $options)
    {
        if (!$name || !is_string($name)) {
            return null;
        }

        if (isset($this->objTemplates[$name])) {
            return clone $this->objTemplates[$name];
        }

        if (!$this->namespaceTransformer) {
            $this->namespaceTransformer = $this->objTemplates[self::NAMESPACE_TRANSFORMER] = new PrependNamespace();
        }

        $className = $this->namespaceTransformer->transform($name, ['namespace' => __NAMESPACE__]);

        if (!class_exists($className, true)) {
            return null;
        }

        $this->objTemplates[$name] = new $className();

        return clone $this->objTemplates[$name];
    }
607899
protected function init(array $options = array())
    {
        foreach ($options as $key => $value) {
            if (property_exists($this, $key)) {
                $this->{$key} = $value;
            }
        }
    }
155021
public function getData($name, array $options = [])
    {
        if (false === isset($this->data[$name])) {

            $this->data[$name] = $this->factoryRegistry->getFactory($name)->create(new ParameterBag($options));
        }

        return $this->data[$name];
    }
1146961
public function plugin(string $name, array $options = []): PluginInterface
    {
        return $this->getPluginManager()->get($name, $options);
    }