Returns a filter matching the provided configuration.

@param ConfigInterface $config The configuration to create a filter for.
@return FilterInterface A matching filter.
350148
public function create(ConfigInterface $config)
    {
        $operationNames = $config->get('operationNames');
        if (!empty($operationNames)) {
            return new ServiceOperationFilter($config);
        } else {
            return new DefaultFilter();
        }
    }
823939
public static function create(Config $config)
    {
        if (php_sapi_name() === 'cli' || !(self::$instance instanceof self)) {
            self::$instance = new self($config);
        }

        return self::$instance;
    }
1291944
final public static function getInstance($config = array())
    {
        static $instance;

        if ($instance === NULL)
        {
            if(!$config instanceof KObjectConfig) {
                $config = new KObjectConfig($config);
            }

            $instance = new self($config);
        }

        return $instance;
    }
193351
public static function getInstance(Configuration $config = null)
    {
        if (!self::$instance) {
            self::$instance = new self($config);
        }

        return self::$instance;
    }
488772
public static function getInstance(AnConfigInterface $config, AnServiceInterface $container)
    {
        if (is_null(self::$_clone)) {
            self::$_clone = new AnRegistry();
        }

        if ($config->key) {
            $config->cache_prefix .= '-'.$config->key;
            unset($config->key);
        }

        if (! isset(self::$_instances[$config->cache_prefix])) {

            $instance = clone self::$_clone;
            self::$_instances[$config->cache_prefix] = $instance;

            $instance->setCachePrefix($config->cache_prefix);
            $instance->enableCache($config->cache_enabled);
        }

        return self::$_instances[$config->cache_prefix];
    }
535672
protected function filter(Config $config, array $criteria = [])
    {
        $count = count($criteria);
        $default = new \stdClass();
        $countResult = 0;
        foreach ($criteria as $key => $value) {
            $configValue = $config->get($key, $default);
            if ($configValue === $value) {
                $countResult++;
            }
        }

        return ($countResult === $count);
    }
1273359
protected function resolve($config)
    {
        $name = $config['driver'];

        if (isset($this->instances[$name]) && $this->instances[$name]->getConfig() === $config) {
            return $this->instances[$name];
        }

        return $this->instances[$name] = PayMe::make($config);
    }
718303
final protected function mergeConfigInstance(
        ConfigInterface $config,
        ConfigInterface $instance = null
    ) : ConfigInterface {
        $instance  = $instance?: $this;

        // if offset detect as an increment array
        $arrayInstance  =  get_object_vars($instance);
        $arrayInstance[] = true;
        end($arrayInstance);

        $increment = key($arrayInstance);
        unset($arrayInstance);
        foreach (get_object_vars($config) as $key => $value) {
            if (isset($instance->{$key})) {
                if ($value instanceof Config) {
                    if ($instance->{$key} instanceof Config) {
                        $instance->mergeConfigInstance($value, $instance->{$key});
                        continue;
                    }

                    $instance->{$key} = $value;
                    continue;
                }

                if (is_numeric($key) && is_int(abs($key))) {
                    $key = $increment;
                    $increment++;
                }
            }

            $instance->{$key} = $value;
        }

        return $instance;
    }
461008
public function getEnvironment($config = null)
    {
        if ( ! $this->environment) {
            if (null == $config) {
                $config = $this->getConfig();
            }

            $this->environment = new Environment($config);
        }

        return $this->environment;
    }
686256
public static function getInstance($config = []){
        if(!(self::$_instance instanceof self)){
            self::$_instance = new self($config);
        }
        return self::$_instance;
    }
301252
public static function getInheritanceFinder(ConfigInterface $config) {
        if($config instanceof FileConfig){
            $cacheStrategy = new \Synga\InheritanceFinder\File\CacheStrategy($config);
        } elseif($config instanceof DatabaseConfig){
            $cacheStrategy = new \Synga\InheritanceFinder\Database\CacheStrategy($config);
        }

        return new \Synga\InheritanceFinder\InheritanceFinder(
            new \Synga\InheritanceFinder\CacheBuilder(
                $cacheStrategy,
                new PhpClassParser((new ParserFactory)->create(ParserFactory::PREFER_PHP7), new ClassNodeVisitor()),
                new \Symfony\Component\Finder\Finder(),
                new \Synga\InheritanceFinder\Helpers\FastArrayAccessHelper()
            )
        );
    }
3643
public static function config($configName, $config = null)
    {
        $_this = Purifier::getInstance();

        if (empty($config)) {
            if (!isset($_this->_configs[$configName])) {
                throw new \InvalidArgumentException(sprintf('Purifier configuration `%s` does not exist!', $configName));
            }
            return $_this->_configs[$configName];
        }

        if (is_array($config)) {
            $purifierConfig = \HTMLPurifier_Config::createDefault();
            foreach ($config as $key => $value) {
                $purifierConfig->set($key, $value);
            }

            return $_this->_configs[$configName] = $purifierConfig;
        } elseif (is_object($config) && is_a($config, 'HTMLPurifier_Config')) {
            return $_this->_configs[$configName] = $config;
        } else {
            throw new \InvalidArgumentException('Invalid purifier config passed!');
        }
    }
1041946
public function config($config)
    {
        if (is_array($config)) {
            $this->config = array_merge($this->config, $config);
        } elseif (isset($this->config[$config])) {
            return $this->config[$config];
        } else {
            return;
        }
    }
793041
public static function getInstance(ObjectConfigInterface $config, ObjectManagerInterface $manager)
    {
        //Add the object alias to allow easy access to the singleton
        $manager->registerAlias($config->object_identifier, 'dispatcher.fragment');

        //Merge alias configuration into the identifier
        $config->append($manager->getIdentifier('dispatcher.fragment')->getConfig());

        //Instantiate the class
        $instance  = new static($config);

        return $instance;
    }
1101803
protected function instantiateConfig($config = null)
    {
        if (is_null($this->config) || ! is_null($config)) {
            $this->config = ! is_null($config)
                ? $config
                : new Config($this->helper);
        }

        return $this->config;
    }
1013841
public static function get($config = null)
    {
        /** @var Session $session */
        $session = new static();
        if (is_null($config)) {
            $config = Configuration::get('config');
        }
        $class = $config->get('session.type', 'server');
        $options = $config->get('session', array());
        if ($config->get('session.type', false)) {
            unset ($options['type']);
        }

        $session->class = $class;
        $session->options = $options;
        return $session->initialize();

    }
22220
public function getUiHandler(ConfigInterface $config)
    {
        if ($config->isHidden()) {
            return null;
        }

        foreach ($this->uiHandlers as $ui) {
            if ($ui->isCompatible($config)) {
                return $ui;
            }
        }

        return null;
    }