original_string: public function authenticate(HTTPRequest $request)
      {
          //get the token
          $token = $request->getHeader($this->tokenConfig['header']);
          if (!$token) {
              $token = $request->requestVar($this->tokenConfig['queryVar']);
          }
  
          if ($token) {
              //check token validity
              return $this->validateAPIToken($token, $request);
          } else {
              //no token, bad news
              return new RESTfulAPIError(403,
                  'Token invalid.',
                  array(
                      'message' => 'Token invalid.',
                      'code' => self::AUTH_CODE_TOKEN_INVALID,
                  )
              );
          }
      }
code: public function authenticate(HTTPRequest $request)
      {
          //get the token
          $token = $request->getHeader($this->tokenConfig['header']);
          if (!$token) {
              $token = $request->requestVar($this->tokenConfig['queryVar']);
          }
  
          if ($token) {
              //check token validity
              return $this->validateAPIToken($token, $request);
          } else {
              //no token, bad news
              return new RESTfulAPIError(403,
                  'Token invalid.',
                  array(
                      'message' => 'Token invalid.',
                      'code' => self::AUTH_CODE_TOKEN_INVALID,
                  )
              );
          }
      }
code_tokens: public function authenticate ( HTTPRequest $ request ) { //get the token $ token = $ request -> getHeader ( $ this -> tokenConfig [ 'header' ] ) ; if ( ! $ token ) { $ token = $ request -> requestVar ( $ this -> tokenConfig [ 'queryVar' ] ) ; } if ( $ token ) { //check token validity return $ this -> validateAPIToken ( $ token , $ request ) ; } else { //no token, bad news return new RESTfulAPIError ( 403 , 'Token invalid.' , array ( 'message' => 'Token invalid.' , 'code' => self :: AUTH_CODE_TOKEN_INVALID , ) ) ; } }
docstring: Checks if a request to the API is authenticated
  Gets API Token from HTTP Request and return Auth result
  
  @param  HTTPRequest           $request    HTTP API request
  @return true|RESTfulAPIError                True if token is valid OR RESTfulAPIError with details
docstring_tokens: Checks if a request to the API is authenticated Gets API Token from HTTP Request and return Auth result