original_string: public function tika($file)
      {
          $text = null;
          try {
              /** @var Response $response */
              $response = $this->put(
                  'tika',
                  $this->getGuzzleOptions([
                      'headers' => [
                          'Accept' => 'text/plain',
                      ],
                      'body' => file_get_contents($file),
                  ])
              );
              $text = $response->getBody();
          } catch (RequestException $e) {
              $msg = sprintf(
                  'TikaRestClient was not able to process %s. Response: %s %s.',
                  $file,
                  $e->getResponse()->getStatusCode(),
                  $e->getResponse()->getReasonPhrase()
              );
              // Only available if tika-server was started with --includeStack
              $body = $e->getResponse()->getBody();
              if ($body) {
                  $msg .= ' Body: ' . $body;
              }
  
              Injector::inst()->get(LoggerInterface::class)->info($msg);
          }
  
          return (string) $text;
      }
code: public function tika($file)
      {
          $text = null;
          try {
              /** @var Response $response */
              $response = $this->put(
                  'tika',
                  $this->getGuzzleOptions([
                      'headers' => [
                          'Accept' => 'text/plain',
                      ],
                      'body' => file_get_contents($file),
                  ])
              );
              $text = $response->getBody();
          } catch (RequestException $e) {
              $msg = sprintf(
                  'TikaRestClient was not able to process %s. Response: %s %s.',
                  $file,
                  $e->getResponse()->getStatusCode(),
                  $e->getResponse()->getReasonPhrase()
              );
              // Only available if tika-server was started with --includeStack
              $body = $e->getResponse()->getBody();
              if ($body) {
                  $msg .= ' Body: ' . $body;
              }
  
              Injector::inst()->get(LoggerInterface::class)->info($msg);
          }
  
          return (string) $text;
      }
code_tokens: public function tika ( $ file ) { $ text = null ; try { /** @var Response $response */ $ response = $ this -> put ( 'tika' , $ this -> getGuzzleOptions ( [ 'headers' => [ 'Accept' => 'text/plain' , ] , 'body' => file_get_contents ( $ file ) , ] ) ) ; $ text = $ response -> getBody ( ) ; } catch ( RequestException $ e ) { $ msg = sprintf ( 'TikaRestClient was not able to process %s. Response: %s %s.' , $ file , $ e -> getResponse ( ) -> getStatusCode ( ) , $ e -> getResponse ( ) -> getReasonPhrase ( ) ) ; // Only available if tika-server was started with --includeStack $ body = $ e -> getResponse ( ) -> getBody ( ) ; if ( $ body ) { $ msg .= ' Body: ' . $ body ; } Injector :: inst ( ) -> get ( LoggerInterface :: class ) -> info ( $ msg ) ; } return ( string ) $ text ; }
docstring: Extract text content from a given file.
  Logs a notice-level error if the document can't be parsed.
  
  @param  string $file Full filesystem path to a file to post
  @return string Content of the file extracted as plain text
docstring_tokens: Extract text content from a given file . Logs a notice - level error if the document can t be parsed .