public function getTokenData($data = array())
    {
        // Are there token details to add?

        if ($this->getToken() || $this->getCardReference()) {
            // A card token or reference has been provided.
            $data['Token'] = $this->getToken() ?: $this->getCardReference();

            // If we don't have a StoreToken override, then set it according to
            // whether we are dealing with a token or a cardReference.
            // Overriding the default token storage flag is for legacy support.

            $storeToken = $this->getStoreToken();

            if ($storeToken === null) {
                // If we are using a cardReference, then keep it stored
                // after this transaction for future use.
                // We consider a cardReference as long term, and a token
                // as single-use.

                if ((bool)$this->getCardReference()) {
                    $data['StoreToken'] = static::STORE_TOKEN_YES;
                }
            } elseif ($storeToken !== static::STORE_TOKEN_YES
                && $storeToken !== static::STORE_TOKEN_NO
            ) {
                // A store token to treat as a boolean has been supplied.

                $data['StoreToken'] = (bool)$storeToken
                    ? static::STORE_TOKEN_YES
                    : static::STORE_TOKEN_NO;
            } else {
                // A valid store token to use directly has been supplied.

                $data['StoreToken'] = $storeToken;
            }
        }

        return $data;
    }
public function getTokenData($data = array())
    {
        // Are there token details to add?

        if ($this->getToken() || $this->getCardReference()) {
            // A card token or reference has been provided.
            $data['Token'] = $this->getToken() ?: $this->getCardReference();

            // If we don't have a StoreToken override, then set it according to
            // whether we are dealing with a token or a cardReference.
            // Overriding the default token storage flag is for legacy support.

            $storeToken = $this->getStoreToken();

            if ($storeToken === null) {
                // If we are using a cardReference, then keep it stored
                // after this transaction for future use.
                // We consider a cardReference as long term, and a token
                // as single-use.

                if ((bool)$this->getCardReference()) {
                    $data['StoreToken'] = static::STORE_TOKEN_YES;
                }
            } elseif ($storeToken !== static::STORE_TOKEN_YES
                && $storeToken !== static::STORE_TOKEN_NO
            ) {
                // A store token to treat as a boolean has been supplied.

                $data['StoreToken'] = (bool)$storeToken
                    ? static::STORE_TOKEN_YES
                    : static::STORE_TOKEN_NO;
            } else {
                // A valid store token to use directly has been supplied.

                $data['StoreToken'] = $storeToken;
            }
        }

        return $data;
    }
public function getTokenData ( $ data = array ( ) ) { // Are there token details to add? if ( $ this -> getToken ( ) || $ this -> getCardReference ( ) ) { // A card token or reference has been provided. $ data [ 'Token' ] = $ this -> getToken ( ) ? : $ this -> getCardReference ( ) ; // If we don't have a StoreToken override, then set it according to // whether we are dealing with a token or a cardReference. // Overriding the default token storage flag is for legacy support. $ storeToken = $ this -> getStoreToken ( ) ; if ( $ storeToken === null ) { // If we are using a cardReference, then keep it stored // after this transaction for future use. // We consider a cardReference as long term, and a token // as single-use. if ( ( bool ) $ this -> getCardReference ( ) ) { $ data [ 'StoreToken' ] = static :: STORE_TOKEN_YES ; } } elseif ( $ storeToken !== static :: STORE_TOKEN_YES && $ storeToken !== static :: STORE_TOKEN_NO ) { // A store token to treat as a boolean has been supplied. $ data [ 'StoreToken' ] = ( bool ) $ storeToken ? static :: STORE_TOKEN_YES : static :: STORE_TOKEN_NO ; } else { // A valid store token to use directly has been supplied. $ data [ 'StoreToken' ] = $ storeToken ; } } return $ data ; }
If a token or cardReference is being used, then include the details
of the token in the data.

@param array $data The data collected so far (to be added to).
@return array
If a token or cardReference is being used then include the details of the token in the data .