public function registerDefaults()
    {
        if (!array_key_exists('token', $this->options)) {
            throw new ApiTokenMissingException('An API token was not configured, please configure the `token` option with an correct ApiToken() object.');
        }

        $requestSubscriber = new RequestSubscriber();
        $this->addSubscriber($requestSubscriber);

        $hydrationSubscriber = new HydrationSubscriber();
        $this->addSubscriber($hydrationSubscriber);

        $apiTokenPlugin = new ApiTokenPlugin(
            is_string($this->options['token']) ?
                new ApiToken($this->options['token']):
                $this->options['token']
        );

        $this->addSubscriber($apiTokenPlugin);

        $acceptJsonHeaderPlugin = new AcceptJsonHeaderPlugin();
        $this->addSubscriber($acceptJsonHeaderPlugin);

        $contentTypeHeaderPlugin = new ContentTypeJsonHeaderPlugin();
        $this->addSubscriber($contentTypeHeaderPlugin);

        $userAgentHeaderPlugin = new UserAgentHeaderPlugin();
        $this->addSubscriber($userAgentHeaderPlugin);

        return $this;
    }
public function registerDefaults()
    {
        if (!array_key_exists('token', $this->options)) {
            throw new ApiTokenMissingException('An API token was not configured, please configure the `token` option with an correct ApiToken() object.');
        }

        $requestSubscriber = new RequestSubscriber();
        $this->addSubscriber($requestSubscriber);

        $hydrationSubscriber = new HydrationSubscriber();
        $this->addSubscriber($hydrationSubscriber);

        $apiTokenPlugin = new ApiTokenPlugin(
            is_string($this->options['token']) ?
                new ApiToken($this->options['token']):
                $this->options['token']
        );

        $this->addSubscriber($apiTokenPlugin);

        $acceptJsonHeaderPlugin = new AcceptJsonHeaderPlugin();
        $this->addSubscriber($acceptJsonHeaderPlugin);

        $contentTypeHeaderPlugin = new ContentTypeJsonHeaderPlugin();
        $this->addSubscriber($contentTypeHeaderPlugin);

        $userAgentHeaderPlugin = new UserAgentHeaderPlugin();
        $this->addSubscriber($userAgentHeaderPlugin);

        return $this;
    }
public function registerDefaults ( ) { if ( ! array_key_exists ( 'token' , $ this -> options ) ) { throw new ApiTokenMissingException ( 'An API token was not configured, please configure the `token` option with an correct ApiToken() object.' ) ; } $ requestSubscriber = new RequestSubscriber ( ) ; $ this -> addSubscriber ( $ requestSubscriber ) ; $ hydrationSubscriber = new HydrationSubscriber ( ) ; $ this -> addSubscriber ( $ hydrationSubscriber ) ; $ apiTokenPlugin = new ApiTokenPlugin ( is_string ( $ this -> options [ 'token' ] ) ? new ApiToken ( $ this -> options [ 'token' ] ) : $ this -> options [ 'token' ] ) ; $ this -> addSubscriber ( $ apiTokenPlugin ) ; $ acceptJsonHeaderPlugin = new AcceptJsonHeaderPlugin ( ) ; $ this -> addSubscriber ( $ acceptJsonHeaderPlugin ) ; $ contentTypeHeaderPlugin = new ContentTypeJsonHeaderPlugin ( ) ; $ this -> addSubscriber ( $ contentTypeHeaderPlugin ) ; $ userAgentHeaderPlugin = new UserAgentHeaderPlugin ( ) ; $ this -> addSubscriber ( $ userAgentHeaderPlugin ) ; return $ this ; }
Register the default plugins

@return $this
Register the default plugins