original_string: private function extractAccessToken(ServerRequestInterface $request)
      {
          // The preferred way is using Authorization header
          if ($request->hasHeader('Authorization')) {
              // Header value is expected to be "Bearer xxx"
              $parts = explode(' ', $request->getHeaderLine('Authorization'));
  
              if (count($parts) < 2) {
                  return null;
              }
  
              return end($parts);
          }
  
          // Default back to authorization in query param
          $queryParams = $request->getQueryParams();
  
          return $queryParams['access_token'] ?? null;
      }
code: private function extractAccessToken(ServerRequestInterface $request)
      {
          // The preferred way is using Authorization header
          if ($request->hasHeader('Authorization')) {
              // Header value is expected to be "Bearer xxx"
              $parts = explode(' ', $request->getHeaderLine('Authorization'));
  
              if (count($parts) < 2) {
                  return null;
              }
  
              return end($parts);
          }
  
          // Default back to authorization in query param
          $queryParams = $request->getQueryParams();
  
          return $queryParams['access_token'] ?? null;
      }
code_tokens: private function extractAccessToken ( ServerRequestInterface $ request ) { // The preferred way is using Authorization header if ( $ request -> hasHeader ( 'Authorization' ) ) { // Header value is expected to be "Bearer xxx" $ parts = explode ( ' ' , $ request -> getHeaderLine ( 'Authorization' ) ) ; if ( count ( $ parts ) < 2 ) { return null ; } return end ( $ parts ) ; } // Default back to authorization in query param $ queryParams = $ request -> getQueryParams ( ) ; return $ queryParams [ 'access_token' ] ?? null ; }
docstring: Extract the token either from Authorization header or query params
  
  @return string|null
docstring_tokens: Extract the token either from Authorization header or query params