Static factory method used to turn an array or collection of configuration data into an instantiated object.

@param array|Collection $config Configuration data
@return KinveyClient
329224
public static function factory($config = array())
	{
		$client = new self($config['baseURL'], $config);
		$client->setDefaultOption('headers/Content-Type', 'application/json');
		$client->setDefaultOption('X-Kinvey-API-Version', 2);
		$client->setAuthMode($config['defaultAuthMode']);

		$client = self::registerPlugins($client);

		return $client;
	}
1348949
public function make(array $config)
    {
        Arr::requires($config, ['from', 'client', 'token']);

        $client = new Client();

        return new TwilioGateway($client, $config);
    }
2447
public function setConfig($config)
    {
        $configObject = $this->getConfig();

        if (is_object($config)) {
            $config = get_object_vars($config);
        }

        foreach ((array)$config as $key => $value) {
            $configObject->$key = $value;
        }

        return $this;
    }
642466
public static function factory($config = array())
    {
        // Merge in default settings and validate the config
        $config = Collection::fromConfig($config);

        // Create a new Cinderella Template client
        $client = new self('', $config);

        $description = ServiceDescription::factory(__DIR__.'/Resources/template-1.0.json');
        $client->setDescription($description);

        return $client;
    }
256514
public static function factory($config = array()) {
        $defaults = array(
            'base_url' => self::API_URL,
            'version' => 'v2.1',
            'command.params' => array(
                'command.on_complete' => function($command) {
                    $response = $command->getResult();

                    // We don't need the meta blocks
                    unset($response['meta']);

                    // If we're down to a single element (events, talks etc)
                    // return only this element
                    if (count($response) == 1) {
                        $command->setResult(reset($response));
                    }
                }
            )
        );

        $required = array(
            'base_url',
            'version',
        );

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

        $client = new self($config->get('base_url'), $config);

        // Attach a service description to the client
        $description = ServiceDescription::factory(__DIR__ . '/client.json');
        $client->setDescription($description);

        return $client;
    }
444420
public function make($config = null)
    {
        try {
            return $this->_invokeCallable($this->_getFactoryCallback($config), [$config]);
        } catch (InvocationExceptionInterface $invocationException) {
            throw $this->_createCouldNotMakeException(
                $this->__('Could not make subject instance'),
                null,
                $invocationException,
                $this,
                $config
            );
        } catch (RootException $exception) {
            throw $this->_createFactoryException(
                $this->__('An error occurred while trying to make the subject instance'),
                null,
                $exception,
                $this
            );
        }
    }
1211776
public function create(array $config = [])
    {
        if (null === $this->handler) {
            $this->handler = DefaultHandler::create();
        }

        return new Client(
            array_merge_recursive(
                [
                    'verify'  => false,
                    'handler' => $this->handler,
                ],
                $config
            )
        );
    }
1354035
public function make(array $config)
    {
        Arr::requires($config, ['endpoint']);

        $client = new Client();

        return new WebhookGateway($client, $config);
    }
619791
static public function factory($config = array()) {
        if (is_string($config)) {
            // Assume $config is a filename
            $filename = $config;
            $config = array(
                'timestampFormat' => 'Y-m-d',
                array(
                    'writerName' => 'Stream',
                    'writerParams' => array(
                        'stream' => self::_getLoggingDirectory() . DIRECTORY_SEPARATOR . $filename
                    )
                )
            );
        }
        return parent::factory($config);
    }
858197
public static function getInstance($config = null)
    {
        if (!self::$instance) {
            self::$instance = new self($config == null ? ConfigManager::getInstance()->getConfigHashmap() : $config);
        }
        return self::$instance;
    }
1081956
public static function createFromConfig(array $config)
    {
        $fields = [];
        foreach ($config as $name => $field) {
            $fields[$name] = Fields::create($name, $field);
        }
        return new static($fields);
    }
1110256
protected function getClient(array $config)
    {
        $client = new CloudsearchClient( 
            $config['client_id'], 
            $config['client_secret'], 
            $config['host'],
            'aliyun'
        );

        $search = new CloudsearchSearch($client);
        $search->addIndex($config['app']);

        return $search;
    }
464831
public function client(array $config)
    {
        $key = $this->getClientKey($config);

        if (isset($this->clients[$key])) {
            return $this->clients[$key];
        }

        return $this->clients[$key] = $this->createClient($config);
    }
345306
public function make(array $config): Client
    {
        $config = $this->getConfig($config);

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

        return $this->get($type, $config, false);
    }
931488
public static function factory(array $config)
    {
        // Determine whether we are whitelisting or blacklisting
        $denyByDefault = false;
        if (array_key_exists('deny_by_default', $config)) {
            $denyByDefault = (bool)$config['deny_by_default'];
            unset($config['deny_by_default']);
        }

        // By default, create an open ACL
        $acl = new AclAuthorization;
        $acl->addRole('guest');
        $acl->allow();

        $grant = 'deny';
        if ($denyByDefault) {
            $acl->deny('guest', null, null);
            $grant = 'allow';
        }

        if (! empty($config)) {
            return self::injectGrants($acl, $grant, $config);
        }

        return $acl;
    }
991567
public static function factory(string $config)
    {
        return function (Application $app) use ($config) {
            $collection = new FinderGroup($app->make('config')
                                              ->get($config));
            $collection->transform(function (string $itemClass) {
                return new $itemClass();
            });

            return $collection;
        };
    }