Gets the singleton SoapClient which is used to connect to the TransIP Api.

@param array  $classMap
@param  mixed $parameters Parameters.
@throws \Exception
@return \SoapClient               The SoapClient object to which we can connect to the TransIP API
497798
protected function soapClient(array $classMap, $parameters = array())
    {
        $endpoint = $this->client->getEndpoint();

        if ($this->soapClient === null) {
            $extensions = get_loaded_extensions();
            $errors     = array();

            if (!class_exists('SoapClient') || !in_array('soap', $extensions)) {
                $errors[] = 'The PHP SOAP extension doesn\'t seem to be installed. You need to install the PHP SOAP extension. (See: http://www.php.net/manual/en/book.soap.php)';
            }
            if (!in_array('openssl', $extensions)) {
                $errors[] = 'The PHP OpenSSL extension doesn\'t seem to be installed. You need to install PHP with the OpenSSL extension. (See: http://www.php.net/manual/en/book.openssl.php)';
            }
            if (!empty($errors)) {
                die('<p>' . implode("</p>\n<p>", $errors) . '</p>');
            }

            $options = array(
                'classmap' => $classMap,
                'encoding' => 'utf-8', // lets support unicode
                'features' => SOAP_SINGLE_ELEMENT_ARRAYS, // see http://bugs.php.net/bug.php?id=43338
                'trace'    => false, // can be used for debugging
            );

            $wsdlUri = "https://{$endpoint}/wsdl/?service=" . $this->service;
            try {
                $this->soapClient = new \SoapClient($wsdlUri, $options);
            } catch (\SoapFault $sf) {
                throw new \Exception("Unable to connect to endpoint '{$endpoint}'");
            }

            $this->soapClient->__setCookie('login', $this->client->getLogin());
            $this->soapClient->__setCookie('mode', $this->client->getMode());
        }

        $timestamp = time();
        $nonce     = uniqid('', true);

        $this->soapClient->__setCookie('timestamp', $timestamp);
        $this->soapClient->__setCookie('nonce', $nonce);
        $this->soapClient->__setCookie('clientVersion', $this->apiVersion);
        $this->soapClient->__setCookie(
            'signature',
            $this->_urlencode(
                $this->_sign(
                    array_merge(
                        $parameters,
                        array(
                            '__service'   => $this->service,
                            '__hostname'  => $endpoint,
                            '__timestamp' => $timestamp,
                            '__nonce'     => $nonce
                        )
                    )
                )
            )
        );

        return $this->soapClient;
    }
1261283
protected function registerClassMap(array $classMap)
    {
        foreach ($classMap as $file) {
            $arrClasses = require $file;
            if (!ArrayUtils::isHashTable($arrClasses, true)) {
                throw new Exception\RuntimeException('Config autoload for classmap is invalid');
            }

            if (!empty($arrClasses)) {
                $this->loader->registerClasses($arrClasses);
            }
        }
    }
1230228
public function getOrCreate($className, $params = array())
    {
        $key = $className . join('-', $params);

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

        if (method_exists($this, $this->getMethodName($className))) {
            $callback = array($this, $this->getMethodName($className));
            $instance =  call_user_func_array($callback, $params);
        } else {
            $instance = new $className;
        }

        return $this->mapping[$key] = $instance;
    }
290065
public function get($name, $parameters = null)
    {
        if (isset($this->_instances[$name])) {
            return $this->_instances[$name];
        }

        if (isset($this->_definitions[$name])) {
            $definition = $this->_definitions[$name];
        } else {
            return $this->getInstance($name, $parameters, $name);
        }

        $instance = $this->getInstance($definition, $parameters, $name);

        if (is_string($definition) || !isset($definition['shared']) || $definition['shared'] === true) {
            $this->_instances[$name] = $instance;
        }

        return $instance;
    }
418868
final public static function getInstance(...$params)
    {
        $called = static::class;
        if (self::$instance instanceof $called) {
            return self::$instance;
        } else {
            return self::$instance = new $called(...$params);
        }
    }
1250600
public function get($ressourceToGrab, array $parameters = null)
    {
        $this->apiRequest->clean();
        $this->apiRequest->setHeaders($this->apiConfiguration->getHeaders());
        $this->apiRequest->setParameters($this->apiConfiguration->getParameters());

        return $this->apiRequest->get($ressourceToGrab, $parameters);
    }
120037
public function getEndpoint(string $type, ClientInterface $client, array $options = []): EndpointInterface
    {
        if (!array_key_exists($type, $this->endpointList)) {
            if (class_exists($type)) {
                $this->endpointList[$type] = new $type($client, $options);
            } else {
                $className = sprintf('%s\%sEndpoint', __NAMESPACE__, ucfirst($type));
                if (!class_exists($className)) {
                    throw new \InvalidArgumentException("{$className} is not valid endpoint");
                }

                $this->endpointList[$type] = new $className($client);
            }
        }

        return $this->endpointList[$type];
    }
538907
public function request($method, $endpoint, array $parameters = null)
    {
        $url = $this->config->getEndpoint() . $endpoint;

        // Client should always send OAuth2 tokens in its headers
        $headers = array('Authorization' => 'Bearer ' . $this->config->getAccessToken());

        return $this->client->request($method, $url, $parameters, $headers);
    }
449943
public static function getInstance(
        StreamFactory $sdf,
        PartStreamFilterManagerFactory $psf,
        PartFilterFactory $pf = null,
        MessageHelperService $mhs = null
    ) {
        $instance = static::getCachedInstance();
        if ($instance === null) {
            $ref = new ReflectionClass(get_called_class());
            $n = $ref->getConstructor()->getNumberOfParameters();
            $args = [];
            for ($i = 0; $i < $n; ++$i) {
                $args[] = func_get_arg($i);
            }
            $instance = $ref->newInstanceArgs($args);
            static::setCachedInstance($instance);
        }
        return $instance;
    }
1066006
protected static function getInstance($clazz, $publickey = null, $secretkey = null)
    {
        if (class_exists($clazz)) {
            return new $clazz($publickey, $secretkey);
        }

        throw new Exception('Undefined class.');
    }
1236026
public function call(string $method, array $arguments): ResponseInterface
    {
        try {
            return $this->__soapCall($method, $arguments, null, $this->getHeader());
        } catch (\Exception $e) {
            $exception = new ClientException($e->getMessage(), $e->getCode(), $e);

            if ($this->debug) {
                $exception->request = ClientException::formatXml($this->__getLastRequest());
                $exception->response = ClientException::formatXml($this->__getLastResponse());
            }

            throw $exception;
        }
    }
709627
public function api($name)
    {
        $classes = array(
            'Bartlett\Reflect\Api\\' => array(
                'Analyser',
                'Cache',
                'Config',
                'Diagnose',
                'Diagram',
                'Plugin',
                'Reflection',
            ),
            'Bartlett\CompatInfo\Api\\' => array(
                'Reference'
            ),
        );

        $class = false;

        foreach ($classes as $ns => $basename) {
            if (in_array(ucfirst($name), $basename)) {
                $class = $ns . ucfirst($name);
                break;
            }
        }

        if (!$class || !class_exists($class)) {
            throw new \InvalidArgumentException(
                sprintf('Unknown Api "%s" requested', $name)
            );
        }
        if ($this->client instanceof LocalClient) {
            $this->client->setNamespace($ns . 'V3');
        }
        return new $class($this->client, $this->token);
    }
547920
public function get(array $parameters = array())
    {
        $response = $this->ontraport->get(
            $this->getNamespace(), $this->toArray($parameters)
        );

        return $this->ontraport->collection($this, $response);
    }
744814
public function getInstance($definition, $parameters = null, $name = null)
    {
        if (is_string($definition)) {
            $params = [];
        } elseif (isset($definition['class'])) {
            $params = $definition;
            $definition = $definition['class'];
            unset($params['class'], $params['shared']);
        } elseif (isset($definition[0])) {
            $params = $definition;
            $definition = $definition[0];
            unset($params[0], $params['shared']);
        } else {
            $params = [];
        }

        if ($parameters === null) {
            if (!$params || isset($params[0])) {
                $parameters = $params;
            } else {
                $parameters = [$params];
            }
        } elseif (count($parameters) !== 0 && !isset($parameters[0])) {
            $parameters = [$parameters];
        }

        if (is_string($definition)) {
            if ($definition[0] === '@') {
                $definition = $this->alias->resolveNS($definition);
            }

            if (!class_exists($definition)) {
                throw new InvalidValueException(['`:name` component cannot be resolved: `:class` class is not exists',
                    'name' => $name,
                    'class' => $definition]);
            }
            $count = count($parameters);

            if ($count === 0) {
                $instance = new $definition();
            } elseif ($count === 1) {
                $instance = new $definition($parameters[0]);
            } elseif ($count === 2) {
                $instance = new $definition($parameters[0], $parameters[1]);
            } elseif ($count === 3) {
                $instance = new $definition($parameters[0], $parameters[1], $parameters[2]);
            } else {
                $reflection = new \ReflectionClass($definition);
                $instance = $reflection->newInstanceArgs($parameters);
            }
        } elseif ($definition instanceof \Closure) {
            $instance = call_user_func_array($definition, $parameters);
        } elseif (is_object($definition)) {
            $instance = $definition;
        } else {
            throw new NotSupportedException(['`:name` component cannot be resolved: component implement type is not supported', 'name' => $name]);
        }

        if ($instance instanceof Component || method_exists($instance, 'setDi')) {
            $instance->setDi($this);
        }

        return $instance;
    }
465173
public static function getInstance($key = 'default', array $params = []) {
        $class = get_called_class();

        if (isset(static::$_instances[$class][$key])) {
            return static::$_instances[$class][$key];
        }

        $reflection = new ReflectionClass($class);
        $object = $reflection->newInstanceArgs($params);

        static::$_instances[$class][$key] = $object;

        return $object;
    }
458579
protected function getSoap()
    {
        if ($this->SOAPClient === null) {
            $this->SOAPClient = new \SoapClient($this->url,
                [
                    'trace' => 1,
                    'cache_wsdl' => WSDL_CACHE_NONE
                ]);
            if ($this->location) {
                $this->SOAPClient->__setLocation($this->location);
            }
        }
        return $this->SOAPClient;
    }
855862
public function get(string $name, ...$params) {
        if ($this->created->containsKey($name)) return $this->created->getNodeByKey($name)->getValue();
        if ($this->instances->containsKey($name)) return $this->fromInstances($name, $params);

        try {
            $reflectionClass = new ReflectionClass($name);
            $constructor = $reflectionClass->getConstructor();
            $parameters = [];

            if (null !== $constructor) {
                /** @var ReflectionParameter $parameter */
                foreach ($constructor->getParameters() as $parameter) {
                    $className = $parameter->getClass()->getName();
                    $class = $this->get($className);
                    if (null === $class) throw new ClassNotFoundException();
                    $parameters[] = $class;
                }
            }
            $clazz = $reflectionClass->newInstanceArgs($parameters + $params);
            $this->created->add($name, $clazz);
            return $clazz;
        } catch (Exception $exception) {
            return null;
        }
    }