Apply JShrink to $content.

@param string $filename target filename
@param string $content Content to filter.
@throws \Exception
@return string
349681
public function output($filename, $content)
    {
        if (!class_exists('JShrink\Minifier')) {
            throw new \Exception(sprintf('Cannot not load filter class "%s".', 'JShrink\Minifier'));
        }
        return Minifier::minify($content, array('flaggedComments' => $this->_settings['flaggedComments']));
    }
254833
public function parseNoTemplate($content) {
        $this->_content = $content;
        $this->_parseDebugStart();
        $this->_parseExtend();
        $this->_parseInclude();
        $this->_parsePath();
        $this->_parseGravatar();
        $this->_parseAsset();
        $this->_parseUrl();
        $this->_parsePhp();
        $this->_parseLang();
        $this->_parseForeach();
        $this->_parseFor();
        $this->_parseVar();
        $this->_parseVarFunc();
        $this->_parseCondition();
        $this->_parseFunction();
        $this->_parseException();
        $this->_parseMinify();
        $this->_parseDebugEnd();

        return $this->_content;
    }
905382
protected function _save($content) {
        if (!file_put_contents($this->_getIncludesFilename(), $content)) {
            throw new Exception(sprintf(self::EXCEPTION_WRITE_ERROR));
        }
        return true;
    }
327339
public function overwrite($file, $content)
    {
        $written = file_put_contents($file, $content);

        // If $content is not empty
        // but nothing was written to $file
        // throw an exception.
        if ($content and ! $written)
        {
            throw new RuntimeException(
                "Unable to write to {$file}."
            );
        }
    }
459805
public function simpleXmlLoadString(string $content)
    {
        $useErrors = libxml_use_internal_errors(true);

        $xml = simplexml_load_string($content);

        $error = null;

        if (false === $xml) {
            $errors = libxml_get_errors();

            $error = reset($errors);
        }

        libxml_clear_errors();
        libxml_use_internal_errors($useErrors);

        if ($error !== null) {
            throw new \Exception($this->formatXmlError($error, explode("\n", $content)));
        }

        return $xml;
    }
1123726
public static function load($filename)
    {
        if (!is_readable($filename)) {
            throw new IOError($filename, 'File not found or file is not readable');
        }
        $content = @file_get_contents($filename);
        if ($content === false) {
            self::throwNativeError($filename);
        }
        return $content;
    }
81123
public static function appendContents($filename, $contents)
    {
        $result = file_put_contents($filename, $contents, \LOCK_EX | \LOCK_NB | \FILE_APPEND);
        if ($result === false) {
            throw new \RuntimeException("Cannot append to the file: " . $filename);
        }
    }
1357879
protected function includeExpr($content)
    {
        try {
            $pattern = '/<!--#if([\s\t]?)expr="([^"]*)"([\s\t]?)-->([^"]*)<!--#endif-->/sU';
            $content = preg_replace($pattern, '', $content);
            return $content;
        } catch (\Exception $e) {
            $this->error(500);
        }
    }
306011
private function readFile($filename)
    {
        if (!file_exists($filename)) {
            throw new \Exception(sprintf('File not found: %s', $filename));
        }
        if (!is_readable($filename) || ($content = file_get_contents($filename)) === false) {
            throw new \Exception(sprintf('Failed to read file: %s', $filename));
        }

        return $content;
    }
1338156
private function setContent($name, $content)
    {
        $filename = $this->getCacheFileName($name);

        if ($this->options['thread_safe']) {
            $fd = fopen($filename, 'w+');
            flock($fd, LOCK_EX);
            $fr = fwrite($fd, $content);
            fclose($fd);

            return $fr;
        } else {
            return file_put_contents($filename, $content);
        }
    }
174363
private static function write($content)
	{
		self::lock();
		if ( is_null( self::$authFileP ) ) throw new Exception( 'No lock has been requested' );
		ftruncate( self::$authFileP , 0 );
		fwrite( self::$authFileP , $content );

		return fflush( self::$authFileP );
	}
401484
public function getRelPath($content)
    {
        if (! $content instanceof File && ! $content instanceof Directory) {
            throw new \common_Exception('Content for ' . __FUNCTION__ . ' has to be a file or directory object. ' .
                is_object($content) ? get_class($content) : gettype($content) . ' given.');
        }

        return str_replace($this->getPrefix(), '', $content->getPrefix());
    }
82407
private function createJavascriptResponse($content)
    {
        $rf = $this->app->make(ResponseFactoryInterface::class);

        return $rf->create(
            $content,
            200,
            [
                'Content-Type' => 'application/javascript; charset=' . APP_CHARSET,
                'Content-Length' => strlen($content),
            ]
        );
    }
1062445
protected function encode($content)
    {
        $jsonString = parent::encode($content);

        if ($this->hasValidCallback()) {
            return \sprintf('%s(%s);', $this->getCallback(), $jsonString);
        }

        return $jsonString;
    }
189011
public function setFileRaw( string$key, string$contentType, string$content, string$fileName=null ):self
	{
		$this->files[$key]= [
			'fileName'=> $fileName??md5($content),
			'contentType'=> $contentType,
			'content'=> $content,
		];

		return $this;
	}
75916
public function attachment($name, $content)
    {
        if (!is_string($content) && (!is_resource($content) || get_resource_type($content) != 'stream')) {
            throw new Exception\InvalidArgumentException(
                sprintf("Attachment content must be either string or stream, %s passed")
            );
        }
        
        $this->attachments[$name] = [
            'content' => $content
        ];
    }
1345484
public function getFile($filename) {

        $filename = realpath(__DIR__.'/../headers/'.$filename.'.txt');

        if(!file_exists($filename)) throw new \Exception('Filename doesnt exist.');

        return file_get_contents($filename);
    }