Builds the client with the configured values

@param string|null $service

@return Client
183961
public function build($service = null)
    {
        if (!$this->sender) {
            $this->sender = $this->buildGuzzleSender();
        }

        if (!$this->factory) {
            throw new RuntimeException("You need to provide a configuration or a factory for requests");
        }

        if (!$this->logger) {
            $this->logger = new NullLogger();
        }

        return $this->buildClient($this->factory, $this->sender, $this->logger, $service);
    }
1314454
public static function service(string $service)
    {
        if (!array_key_exists($service, self::$available_services)) {
            throw (new ServiceNotFoundException(sprintf(
                '"%s" is not registered as a service.',
                $service
            )))->setServiceName($service);
        }

        $service_class = static::$available_services[$service];

        $config = static::$config['services'][$service] ?? null;

        if (is_null($config)) {
            throw (new ServiceConfigurationNotFoundException(sprintf(
                '"%s" configuration not found.',
                $service
            )))->setServiceName($service);
        }

        return $service_class::configure($config);
    }
267425
protected function getService( $service){
        $rest = new utils\rest\RestAuth( $this->application->getFreeboxApiHost() . $service);
        $rest->setSessionToken( $this->application->getSessionToken());
        return $rest;
    }
11929
protected function decorateService($service)
    {
        $extName = DecorateExtension::EXTENSION_CLASS;

        // decorate extension loaded
        if ($this->hasExtension($extName)) {
            /* @var $ext DecorateExtension */
            $ext = $this->getExtension($extName);
            $ext->decorateService($service);
        }

        return $this;
    }
1001547
protected function buildService($serviceDefinition, $interfaceName = null)
    {
        if ($serviceDefinition instanceof ConfigurableService) {
            if (is_null($interfaceName) || is_a($serviceDefinition, $interfaceName)) {
                $this->propagate($serviceDefinition);
                return $serviceDefinition;
            } else {
                throw new InvalidService('Service must implements ' . $interfaceName);
            }
        } elseif (is_array($serviceDefinition) && isset($serviceDefinition['class'])) {
            $classname = $serviceDefinition['class'];
            $options = isset($serviceDefinition['options']) ? $serviceDefinition['options'] : [];
            if (is_null($interfaceName) || is_a($classname, $interfaceName, true)) {
                return $this->getServiceManager()->build($classname, $options);
            } else {
                throw new InvalidService('Service must implements ' . $interfaceName);
            }
        } else {
            throw new InvalidService();
        }
    }
1314022
public function uses(string $service, ?string $version = null): Contracts\Request
    {
        if (\is_null($version) || ! \array_key_exists($version, $this->supportedVersions)) {
            $version = $this->defaultVersion;
        }

        $name = \str_replace('.', '\\', $service);
        $class = \sprintf('%s\%s\%s', $this->getResourceNamespace(), $this->supportedVersions[$version], $name);

        if (! \class_exists($class)) {
            throw new InvalidArgumentException("Resource [{$service}] for version [{$version}] is not available.");
        }

        return $this->via(new $class($this));
    }
559008
public function client($client = null)
    {
        if (!func_num_args()) {
            return $this->_client;
        }
        $this->_client = $client;
        return $this;
    }
1045390
public function setService($account = null) {
        if (!empty($account)) {
            $this->setData('TransInfo', [
                'KfAccount' => [
                    '@cdata' => $account
                ]
            ]);
        }
        return $this->setType(MessageEnum::Service);
    }
1112992
public function setService($service)
    {
        $prefix = $this->getConfig('service_class_prefix');

        $this->service[$service] = $this->createInstance($service, $prefix, [$this->client]);
    }
315605
public function getOpenedClient(ServiceAbstractClient $client = null)
    {
        if (!$client) {
            $client = new ServiceClient();
        }

        $client->open(
            $this->isProductionEnvironment() ? ServiceClient::PRODUCTION_URI : ServiceClient::SANDBOX_URI,
            $this->getParameter('certificate'),
            $this->getParameter('passPhrase')
        );

        return $client;
    }
404175
public ServerBuilder service(PathMapping pathMapping, Service<HttpRequest, HttpResponse> service) {
        defaultVirtualHostBuilderUpdated();
        defaultVirtualHostBuilder.service(pathMapping, service);
        return this;
    }
794907
public function client($client = null)
    {
        if ($client === null) {
            return $this->getClient();
        }

        return $this->setClient($client);
    }
778475
private function init($service)
    {
        //====================================================================//
        // Debug
        Splash::log()->deb('MsgWsCall');
        //====================================================================//
        // Safety Check
        if (!$this->verify()) {
            return Splash::log()->err('ErrWsInValid');
        }
        //====================================================================//
        // Clean Data Input Buffer
        $this->cleanIn();
        //====================================================================//
        // Prepare Data Output Buffer
        //====================================================================//
        // Fill buffer with Server Core infos
        $this->outputs->server = $this->getServerInfos();
        // Remote Service to call
        $this->outputs->service = $service;
        // Share Debug Flag with Server
        $this->outputs->debug = (int) SPLASH_DEBUG;

        return true;
    }
238331
public static function getAPI($service)
    {
        $service = strtolower($service);
        $identifier = 'com:connect.oauth.service.'.$service;
        if (!AnService::has($identifier)) {
            $config = array();
            $config['consumer'] = self::getConsumer($service);
            $config['enabled'] = self::enabled($service);
            AnService::set($identifier, AnService::get($identifier, $config));
        }

        return    AnService::get($identifier);
    }
252153
public function setLibrary($name, $service, $parameters = null)
    {
        return $this->setService($name, $service, $parameters);
    }
1168040
public function create(): Service
    {
        /** @var Endpoint $data */
        $data = $this;

        /** @var Service $service */
        $service = Service::post($data, ["clientId" => $this->clientId]);

        return $service;
    }
840133
public function getService($service)
    {
        foreach ($this->queue as $extension) {
            $new = call_user_func($extension, $service, $this->container);

            if ($new) {
                $service = $new;
            }
        }

        return $service;
    }