public function getCompression(LocalFileNodeInterface $file)
    {
        $cmd = "file --brief --uncompress --mime {$file->getPath()}";

        $process = $this->getProcess($cmd);
        $process->mustRun();

        $result = $process->getOutput();
        if (preg_match('/compressed-encoding=application\/(?:x-)?(.+?);/i', $result, $matches)) {
            if ($this->factory->isCompression($matches[1])) {
                $this->log(LogLevel::DEBUG, "Found the compression for '{file}' as '{compression}'", [
                    'file'        => $file,
                    'compression' => $matches[1],
                ]);
                return $matches[1];
            }
            return CompressionFactory::TYPE_UNKNOWN;
        }
        return CompressionFactory::TYPE_NONE;
    }
public function getCompression(LocalFileNodeInterface $file)
    {
        $cmd = "file --brief --uncompress --mime {$file->getPath()}";

        $process = $this->getProcess($cmd);
        $process->mustRun();

        $result = $process->getOutput();
        if (preg_match('/compressed-encoding=application\/(?:x-)?(.+?);/i', $result, $matches)) {
            if ($this->factory->isCompression($matches[1])) {
                $this->log(LogLevel::DEBUG, "Found the compression for '{file}' as '{compression}'", [
                    'file'        => $file,
                    'compression' => $matches[1],
                ]);
                return $matches[1];
            }
            return CompressionFactory::TYPE_UNKNOWN;
        }
        return CompressionFactory::TYPE_NONE;
    }
public function getCompression ( LocalFileNodeInterface $ file ) { $ cmd = "file --brief --uncompress --mime {$file->getPath()}" ; $ process = $ this -> getProcess ( $ cmd ) ; $ process -> mustRun ( ) ; $ result = $ process -> getOutput ( ) ; if ( preg_match ( '/compressed-encoding=application\/(?:x-)?(.+?);/i' , $ result , $ matches ) ) { if ( $ this -> factory -> isCompression ( $ matches [ 1 ] ) ) { $ this -> log ( LogLevel :: DEBUG , "Found the compression for '{file}' as '{compression}'" , [ 'file' => $ file , 'compression' => $ matches [ 1 ] , ] ) ; return $ matches [ 1 ] ; } return CompressionFactory :: TYPE_UNKNOWN ; } return CompressionFactory :: TYPE_NONE ; }
Find the compression of a file

@param LocalFileNodeInterface $file

@return string
Find the compression of a file