public function extractFileAsText($disableCache = false)
    {
        /** @var File $file */
        $file = $this->owner;
        if (!$disableCache) {
            $text = $this->getTextCache()->load($file);
            if ($text) {
                return $text;
            }
        }

        // Determine which extractor can process this file.
        $extractor = FileTextExtractor::for_file($file);
        if (!$extractor) {
            return null;
        }

        $text = $extractor->getContent($file);
        if (!$text) {
            return null;
        }

        if (!$disableCache) {
            $this->getTextCache()->save($file, $text);
        }

        return $text;
    }
public function extractFileAsText($disableCache = false)
    {
        /** @var File $file */
        $file = $this->owner;
        if (!$disableCache) {
            $text = $this->getTextCache()->load($file);
            if ($text) {
                return $text;
            }
        }

        // Determine which extractor can process this file.
        $extractor = FileTextExtractor::for_file($file);
        if (!$extractor) {
            return null;
        }

        $text = $extractor->getContent($file);
        if (!$text) {
            return null;
        }

        if (!$disableCache) {
            $this->getTextCache()->save($file, $text);
        }

        return $text;
    }
public function extractFileAsText ( $ disableCache = false ) { /** @var File $file */ $ file = $ this -> owner ; if ( ! $ disableCache ) { $ text = $ this -> getTextCache ( ) -> load ( $ file ) ; if ( $ text ) { return $ text ; } } // Determine which extractor can process this file. $ extractor = FileTextExtractor :: for_file ( $ file ) ; if ( ! $ extractor ) { return null ; } $ text = $ extractor -> getContent ( $ file ) ; if ( ! $ text ) { return null ; } if ( ! $ disableCache ) { $ this -> getTextCache ( ) -> save ( $ file , $ text ) ; } return $ text ; }
Tries to parse the file contents if a FileTextExtractor class exists to handle the file type, and
returns the text. The value is also cached into the File record itself.

@param boolean $disableCache If false, the file content is only parsed on demand.
If true, the content parsing is forced, bypassing
the cached version
@return string|null
Tries to parse the file contents if a FileTextExtractor class exists to handle the file type and returns the text . The value is also cached into the File record itself .