src/Context/Initializer/ApiClientAwareInitializer.php
public function initializeContext(Context $context) {
        if ($context instanceof ApiClientAwareContext) {
            // Fetch base URI from the Guzzle client configuration, if it exists
            $baseUri = !empty($this->guzzleConfig['base_uri']) ? $this->guzzleConfig['base_uri'] : null;

            if ($baseUri && !$this->validateConnection($baseUri)) {
                throw new RuntimeException(sprintf('Can\'t connect to base_uri: "%s".', $baseUri));
            }

            $context->setClient(new Client($this->guzzleConfig));
        }
    }
public function initializeContext(Context $context) {
        if ($context instanceof ApiClientAwareContext) {
            // Fetch base URI from the Guzzle client configuration, if it exists
            $baseUri = !empty($this->guzzleConfig['base_uri']) ? $this->guzzleConfig['base_uri'] : null;

            if ($baseUri && !$this->validateConnection($baseUri)) {
                throw new RuntimeException(sprintf('Can\'t connect to base_uri: "%s".', $baseUri));
            }

            $context->setClient(new Client($this->guzzleConfig));
        }
    }
public function initializeContext ( Context $ context ) { if ( $ context instanceof ApiClientAwareContext ) { // Fetch base URI from the Guzzle client configuration, if it exists $ baseUri = ! empty ( $ this -> guzzleConfig [ 'base_uri' ] ) ? $ this -> guzzleConfig [ 'base_uri' ] : null ; if ( $ baseUri && ! $ this -> validateConnection ( $ baseUri ) ) { throw new RuntimeException ( sprintf ( 'Can\'t connect to base_uri: "%s".' , $ baseUri ) ) ; } $ context -> setClient ( new Client ( $ this -> guzzleConfig ) ) ; } }
Initialize the context

Inject the Guzzle client if the context implements the ApiClientAwareContext interface

@param Context $context
Initialize the context