Create the Api.

@param array $config

@return bool
177692
public function createApi($config)
    {
        $routesMaster = $config['_path_api_routes_'];

        if (!file_exists($routesMaster)) {
            $this->putIfNotExists($routesMaster, "<?php\n\n");
        }

        $this->fileService->mkdir($config['_path_api_controller_'], 0777, true);

        $routes = $this->fileService->get($config['template_source'].'/ApiRoutes.txt');

        foreach ($config as $key => $value) {
            $routes = str_replace($key, $value, $routes);
        }

        $this->filesystem->append($routesMaster, $routes);

        $request = $this->fileService->get($config['template_source'].'/ApiController.txt');

        foreach ($config as $key => $value) {
            $request = str_replace($key, $value, $request);
        }

        $request = $this->putIfNotExists($config['_path_api_controller_'].'/'.$config['_ucCamel_casePlural_'].'Controller.php', $request);

        return $request;
    }
175079
protected function createJsonResponse(array $data, array $config)
    {
        if (! \is_null($uses = $config['uses'] ?? null)) {
            $data = $data[$uses] ?? [];
        }

        if ($data instanceof Arrayable) {
            $data = $data->toArray();
        }

        $data = \array_map([$this, 'transformToArray'], $data);

        return function () use ($data, $config) {
            return \json_encode($data, $config['encoding'] ?? 0);
        };
    }
671390
public static function createFromConfig(array $config)
    {
        $manager = static::createEmptyFromConfig($config);

        $manager->addCollection(new CssCollection)
                ->addCollection(new JavascriptCollection);

        return $manager;
       
    }
122624
protected function createPdoResolver(array $config)
    {
        return array_key_exists('host', $config)
                            ? $this->createPdoResolverWithHosts($config)
                            : $this->createPdoResolverWithoutHosts($config);
    }
549620
public static function factory($config = array())
    {

        $defaults = array(
            'base_url'       => 'https://rpc.acquia.com',
            'server_address' => isset($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : '',
            'http_host'      => isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '',
            'https'          => false,
            'network_id'     => '',
            'network_key'    => '',
        );

        // Instantiate the Acquia Search plugin.
        $config = Collection::fromConfig($config, $defaults);
        return new static(
            $config->get('base_url'),
            $config->get('network_id'),
            $config->get('network_key'),
            $config
        );
    }
164062
public function connect(array $config)
    {
        $connection = $this->createConnection($config);

        $this->validateCredentials($config);

        // For basic authentication we need an Authorization
        // header to be set. We add it to the request here.
        $this->addHeader(
            'Authorization',
            'Basic ' . base64_encode(
                array_get($config, 'identifier') . ':' . array_get($config, 'secret')
            )
        );

        return $connection;
    }
182567
private function createEncoderFactory(array $config)
    {
        if (true === array_key_exists('encoders', $config)) {
            $this->_encoderfactory = new EncoderFactory($config['encoders']);
        }

        return $this;
    }
109616
public static function create(array $config = [])
    {
        $config        = self::mergeDefaults($config);
        $metricFactory = new MetricFactory($config['default_tags'], $config['prefix']);
        $eventFactory  = new EventFactory($config['hostname']);
        $logger        = $config['logger']['instance'] instanceof LoggerInterface ? $config['logger']['instance'] : null;
        $debug         = $config['logger']['debug'];
        $monitor       = new Monitor($metricFactory, $eventFactory, $debug ? $logger : null);

        if (!empty($config['datadog']['metrics'])) {
            $monitor->pushMetricSender(DataDogMetrics::create($config['datadog']['host'], $config['datadog']['port']));
        }

        if (!empty($config['datadog']['events'])) {
            $monitor->pushEventSender(DataDogEvents::create($config['datadog']['host'], $config['datadog']['port']));
        }

        if ($logger && $config['logger']['metrics']) {
            $monitor->pushMetricSender(new PsrLoggerMetrics($logger), $config['logger']['level']);
        }

        if ($logger && $config['logger']['events']) {
            $monitor->pushEventSender(new PsrLoggerEvents($logger), $config['logger']['level']);
        }

        return $monitor;
    }
258725
protected function createApcDriver(array $config)
    {
        $prefix = $this->getPrefix($config);

        return $this->repository(new ApcStore(new ApcWrapper, $prefix));
    }
775175
protected function createCustomDriver(array $config)
    {
        $factory = is_callable($via = $config['via']) ? $via : $this->app->make($via);

        return $factory($config);
    }
803405
public function factory($type, array $config)
    {
        $this->setFactoryCreationOptions($type, $config);

        return $this->get($type, $config, false);
    }
486185
public function createContainer(array $config)
    {
        $container = new Container();
        $container->add('config.raw', $config);
        $this->setContainer($container);
        return $this->getContainer();
    }
250799
public static function factory($config = array())
    {
        $defaults = array(
            'base_url' => 'http://localhost',
            'base_path' => '',
        );

        $required = array(
            'base_url',
            'base_path',
            'consumer_key',
            'consumer_secret',
        );

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

        $magento = new static($config->get('base_url'), $config);
        $magento->addSubscriber(new MagentoOauthPlugin($config->toArray()));

        $magento->setDefaultOption('headers', array(
            'Content-Type' => 'application/json',
            'Accept' => '*/*',
        ));

        return $magento;
    }
306849
public function make(array $config)
    {
        $client = new Client($this->getBuilder($config), array_get($config, 'version'), array_get($config, 'enterprise'));

        if (!array_key_exists('method', $config)) {
            throw new InvalidArgumentException('The github factory requires an auth method.');
        }

        if ($config['method'] === 'none') {
            return $client;
        }

        return $this->auth->make($config['method'])->with($client)->authenticate($config);
    }
988662
public function make(array $config)
    {
        $driver = $this->getDriver($config);

        // First we will check by the server driver type to see if an extension
        // has been registered specifically for that server.
        if (isset($this->serverExtensions[$driver])) {
            $server = call_user_func($this->serverExtensions[$driver], $config);
        }

        // Create a built-in server with given driver type.
        elseif (method_exists($this, $method = 'create'.Str::studly($driver).'Driver')) {
            $server = $this->$method($config);
        }

        // Otherwise, if the driver type does not support, an exception will be thrown.
        else {
            throw new InvalidArgumentException("Driver [{$driver}] is not supported.");
        }

        $this->configureServer($server, $config);

        return $server;
    }
1081219
public static function factory($config = array()) {
        $default = array(
            'serverUrls' => null,
            'user' => null,
            'publicKey' => null,
            'privateKey' => null,
        );

        // Backwards-compatibility with old client where user === publicKey
        if (!isset($config['user']) && isset($config['publicKey'])) {
            $config['user'] = $config['publicKey'];
        }

        $required = array('serverUrls', 'publicKey', 'privateKey', 'user');
        $config = Collection::fromConfig($config, $default, $required);

        if (!is_array($serverUrls = $config->get('serverUrls')) || empty($serverUrls)) {
            throw new InvalidArgumentException('serverUrls must be an array');
        }

        // Create the client and attach the service description
        return new self($serverUrls[0], $config);
    }
1193688
public static function create(array $config)
    {
        if (\Tripod\Config::getConfig() !== $config) {
            \Tripod\Config::setConfig($config);
        }
        if (isset($config['class']) && class_exists($config['class'])) {
            $tripodConfig = call_user_func(array($config['class'], 'deserialize'), $config);
        } else {
            $tripodConfig = \Tripod\Mongo\Config::deserialize($config);
        }
        return $tripodConfig;
    }