Loads Modernizr

@param array|ObjectConfig $config
@return string
960316
public function modernizr($config = array())
    {
        $config = new ObjectConfigJson($config);
        $config->append(array(
            'debug' => \Kodekit::getInstance()->isDebug()
        ));

        $html = '';

        if (!static::isLoaded('modernizr'))
        {
            $html = '<ktml:script src="assets://js/'.($config->debug ? 'build/' : 'min/').'modernizr.js" />';

            static::setLoaded('modernizr');
        }

        return $html;
    }
1234057
public static function factory($config = array())
    {
        Version::warn(__METHOD__ . ' is deprecated');
        if (!is_array($config)) {
            throw new InvalidArgumentException('$config must be an array');
        }

        if (!isset($config['cache.adapter']) && !isset($config['cache.provider'])) {
            $config['cache.adapter'] = 'Guzzle\Cache\NullCacheAdapter';
            $config['cache.provider'] = null;
        } else {
            // Validate that the options are valid
            foreach (array('cache.adapter', 'cache.provider') as $required) {
                if (!isset($config[$required])) {
                    throw new InvalidArgumentException("{$required} is a required CacheAdapterFactory option");
                }
                if (is_string($config[$required])) {
                    // Convert dot notation to namespaces
                    $config[$required] = str_replace('.', '\\', $config[$required]);
                    if (!class_exists($config[$required])) {
                        throw new InvalidArgumentException("{$config[$required]} is not a valid class for {$required}");
                    }
                }
            }
            // Instantiate the cache provider
            if (is_string($config['cache.provider'])) {
                $args = isset($config['cache.provider.args']) ? $config['cache.provider.args'] : null;
                $config['cache.provider'] = self::createObject($config['cache.provider'], $args);
            }
        }

        // Instantiate the cache adapter using the provider and options
        if (is_string($config['cache.adapter'])) {
            $args = isset($config['cache.adapter.args']) ? $config['cache.adapter.args'] : array();
            array_unshift($args, $config['cache.provider']);
            $config['cache.adapter'] = self::createObject($config['cache.adapter'], $args);
        }

        return $config['cache.adapter'];
    }
93593
protected function getConfigData($config)
    {
        if (is_string($config)) {
            if (!file_exists($config)) {
                throw new \InvalidArgumentException("Config file $config not found");
            }
            $this->loadConfigFile($config);
        } elseif (is_array($config)) {
            $this->loadFromHash($config);
        }

        $this->loadConfigFile('iron.ini');
        $this->loadConfigFile('iron.json');

        $this->loadFromEnv(strtoupper($this->product_name));
        $this->loadFromEnv('IRON');

        if (!ini_get('open_basedir')) {
            $this->loadConfigFile(self::homeDir() . '.iron.ini');
            $this->loadConfigFile(self::homeDir() . '.iron.json');
        }

        $this->loadFromHash($this->default_values);

        if (empty($this->token) || empty($this->project_id)) {
            throw new \InvalidArgumentException("token or project_id not found in any of the available sources");
        }
    }
913689
protected function loadRootDirConfig(array &$realConfig)
    {
        if (file_exists($this->getRootDir() . 'config.php')) {
            $config = null;

            // scope isolated require()
            $includeClosure = function ($configFile) use (&$config) {
                require($configFile);
            };
            if (PHP_VERSION_ID >= 50400) {
                $includeClosure = $includeClosure->bindTo(null);
            }

            $includeClosure($this->getRootDir() . 'config.php');

            if (is_array($config)) {
                if (isset($config['base_url'])) {
                    $config['base_url'] = rtrim($config['base_url'], '/') . '/';
                }
                if (isset($config['content_dir'])) {
                    $config['content_dir'] = rtrim($config['content_dir'], '/\\') . '/';
                }

                $realConfig = $config + $realConfig;
            }
        }
    }
292616
public function getMongoDb($config)
	{
		if( class_exists( 'MongoClient' ) )
		{
			$class = 'MongoClient';
		}
		else
		{
			$class = 'Mongo';
			debug_enforce(
				class_exists( $class ),
				"No 'Mongo' class available. Make sure you've installed php mongo extension correctly."
			);
		}

		$confOptions = array();

		if (!empty($config["mongo_username"])) {
			$confOptions["username"] = $config["mongo_username"];
		}

		if (!empty($config["mongo_password"])) {
			$confOptions["password"] = $config["mongo_password"];
		}

		/** @var $_conn Mongo */
		$_conn = new $class(
			'mongodb://'.$config['mongo_host'],
			$confOptions
		);
		$dbMongo = $_conn->selectDB($config["db_name"]);

		$dbMongo->listCollections();
		return $dbMongo;
	}
537629
public function createTwigLoaderFilesystem(TwigConfig $config) {
        $loader = new TwigLoader();

        foreach ($config->getPaths() as $path) {
            $loader->addPath($path);
        }

        foreach ($config->getNamespaces() as $namespace => $path) {
            $loader->addPath($path, $namespace);
        }

        return $loader;
    }
1293287
public function load($config = array())
    {
        foreach ($config as $specId => $spec) {
            if (is_string($spec)) {
                $spec = array('class' => $spec);
            }

            $file = isset($spec['src']) ? $spec['src'] : null;

            // class is whatever's explicitly set,
            $class = isset($spec['class']) ? $spec['class'] : null;

            // or the specid if nothing else available.
            if (!$class && is_string($specId)) {
                $class = $specId;
            }

            // make sure the class is set...
            if (empty($class)) {
                throw new InvalidArgumentException('Missing spec class');
            }
            $spec['class'] = $class;

            $id = is_string($specId)
                ? $specId
                : (isset($spec['id']) ? $spec['id'] : $class);

            $priority = isset($spec['priority']) ? $spec['priority'] : 1;

            // see if we already have this defined. If so, check priority weighting
            if (isset($this->specs[$id]) && isset($this->specs[$id]['priority'])) {
                if ($this->specs[$id]['priority'] > $priority) {
                    return $this;
                }
            }

            // okay, actually include it now we know we're going to use it
            if (file_exists($file)) {
                require_once $file;
            }

            // make sure to set the id for later when instantiating
            // to ensure we get cached
            $spec['id'] = $id;

//          We've removed this check because new functionality means that the 'class' field doesn't need to refer
//          specifically to a class anymore - it could be a compound statement, ala SilverStripe's old Object::create
//          functionality
//
//          if (!class_exists($class)) {
//              throw new Exception("Failed to load '$class' from $file");
//          }

            // store the specs for now - we lazy load on demand later on.
            $this->specs[$id] = $spec;

            // EXCEPT when there's already an existing instance at this id.
            // if so, we need to instantiate and replace immediately
            if (isset($this->serviceCache[$id])) {
                $this->updateSpecConstructor($spec);
                $this->instantiate($spec, $id);
            }
        }

        return $this;
    }
428828
public static function factory($config = array())
    {
        $defaults = array();

        $required = array(
            'base_url',
            'login',
            'password'
        );

        $config = Collection::fromConfig($config, $defaults, $required);

        $client = new self($config['base_url'], $config);

        return $client;
    }
644054
public function load(array $config, ContainerBuilder $container)
    {
        if (!isset($config['framework_path'])) {
            throw new \InvalidArgumentException('Specify `framework_path` parameter for silverstripe_extension');
        }

        $loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/services'));
        $loader->load('silverstripe.yml');

        $behatBasePath = $container->getParameter('behat.paths.base');
        $config['framework_path'] = realpath(sprintf('%s%s%s',
            rtrim($behatBasePath, DIRECTORY_SEPARATOR),
            DIRECTORY_SEPARATOR,
            ltrim($config['framework_path'], DIRECTORY_SEPARATOR)
        ));
        if (!file_exists($config['framework_path']) || !is_dir($config['framework_path'])) {
            throw new \InvalidArgumentException('Path specified as `framework_path` either doesn\'t exist or is not a directory');
        }

        $container->setParameter('behat.silverstripe_extension.framework_path', $config['framework_path']);
        $container->setParameter('behat.silverstripe_extension.admin_url', $config['admin_url']);
        $container->setParameter('behat.silverstripe_extension.login_url', $config['login_url']);
        $container->setParameter('behat.silverstripe_extension.screenshot_path', $config['screenshot_path']);
        $container->setParameter('behat.silverstripe_extension.ajax_timeout', $config['ajax_timeout']);
        if (isset($config['ajax_steps'])) {
            $container->setParameter('behat.silverstripe_extension.ajax_steps', $config['ajax_steps']);
        }
        if (isset($config['region_map'])) {
             $container->setParameter('behat.silverstripe_extension.region_map', $config['region_map']);
        }
    }
964918
protected function normalize($config)
    {
        // Validate the config entry
        $this->validateRootElements($config);

        // For single value elements, normalize all class name and options, remove null entry
        foreach (array('vcs', 'version-generator', 'version-persister') as $configKey) {
            $value = $config[$configKey];
            if ($value == null) {
                unset($config[$configKey]);
                continue;
            }
            $config[$configKey] = $this->getClassAndOptions($value, $configKey);
        }

        // Same process but for list value elements
        foreach (array('prerequisites', 'pre-release-actions', 'post-release-actions') as $configKey) {
            foreach ($config[$configKey] as $key => $item) {

                // Accept the element to be define by key or by value
                if (!is_numeric($key)) {
                    if ($item == null) {
                        $item = array();
                    }
                    $item['name'] = $key;
                }

                $config[$configKey][$key] = $this->getClassAndOptions($item, $configKey.'_'.$key);
            }
        }

        return $config;
    }
351330
public function load(Config $config)
    {
        $sys = new Service\SystemService();

        $config->set('CWD', $sys->getCurrentWorkingDirectory());
    }
1136081
public function load(array $routesConfig)
    {
        foreach ($routesConfig as $route) {
            $pattern = $route[0];
            $handler = $route[1] ?? null;
            $methods = $route[2] ?? '*';
            $this->map($pattern, $handler, $methods);
        }
        return $this->routes;
    }
59475
protected function getFormatter(array $config)
    {
        if (isset($config['formatter'])) {
            if (!$config['formatter'] instanceof FormatterInterface) {
                throw new \DomainException(
                    'formatter must implement ' . __NAMESPACE__ . '\FormatterInterface',
                    self::ERR_FORMATTER_INVALID
                );
            }
            return $config['formatter'];
        }
        return new DefaultFormatter;
    }
1060790
protected function getDomain(array $config): string
    {
        $result = '';
        $parts = explode(',', $config['baseDn']);
        foreach ($parts as $part) {
            list($key, $value) = explode('=', $part);
            if ('dc' !== strtolower($key)) {
                continue;
            }

            $result .= '.' . $value;
        }

        $result = trim(trim($result, '.'));

        // fallback value
        if (empty($result)) {
            $result = $config['domain'] . '.com';
        }

        return $result;
    }
513163
protected function parseHosts(array $config)
    {
        $hosts = Arr::wrap($config['host']);

        if (empty($hosts)) {
            throw new InvalidArgumentException('Database hosts array is empty.');
        }

        return $hosts;
    }
899813
public static function init($config = [])
    {
        $config = array_merge([
            'accepts' => [],
            'appendTo' => 'body',
            'showBar' => false,
            'editor' => Debugger::$editor,
            'maxDepth' => Debugger::$maxDepth,
            'maxLength' => Debugger::$maxLength,
            'scream' => true,
            'showLocation' => true,
            'strictMode' => true,
            'currentTime' => $_SERVER['REQUEST_TIME_FLOAT'] ?: microtime(true),
            'editorMapping' => isset(Debugger::$editorMapping) === true ? Debugger::$editorMapping : [],
        ], $config);

        Debugger::$editor = $config['editor'];
        Debugger::$maxDepth = $config['maxDepth'];
        Debugger::$maxLength = $config['maxLength'];
        Debugger::$scream = $config['scream'];
        Debugger::$showLocation = $config['showLocation'];
        Debugger::$strictMode = $config['strictMode'];
        Debugger::$time = $config['currentTime'];

        if (isset(Debugger::$editorMapping) === true) {
            Debugger::$editorMapping = $config['editorMapping'];
        }

        return $config;
    }
1110482
public function load(array $config)
    {
        $config = $this->getParsedConfig(
            $config,
            $this->config,
            $this->yamlConfigMap,
            $this->required
        );
        $this->setParsedConfig($config);

        return $this;
    }