src/RestGateway.php
public function createRequest($class, array $parameters = array())
    {
        if (!$this->hasToken() && $class != '\Omnipay\PayPal\Message\RestTokenRequest') {
            // This will set the internal token parameter which the parent
            // createRequest will find when it calls getParameters().
            $this->getToken(true);
        }

        return parent::createRequest($class, $parameters);
    }
public function createRequest($class, array $parameters = array())
    {
        if (!$this->hasToken() && $class != '\Omnipay\PayPal\Message\RestTokenRequest') {
            // This will set the internal token parameter which the parent
            // createRequest will find when it calls getParameters().
            $this->getToken(true);
        }

        return parent::createRequest($class, $parameters);
    }
Create Request

This overrides the parent createRequest function ensuring that the OAuth
2.0 access token is passed along with the request data -- unless the
request is a RestTokenRequest in which case no token is needed.  If no
token is available then a new one is created (e.g. if there has been no
token request or the current token has expired).

@param string $class
@param array $parameters
@return \Omnipay\PayPal\Message\AbstractRestRequest