public function cache($path, $input, callable $rendered, &$success = null)
    {
        $cacheFolder = $this->getCacheDirectory();
        $destination = $path;

        if (!$this->isCacheUpToDate($destination, $input)) {
            if (!is_writable($cacheFolder)) {
                throw new RuntimeException(sprintf('Cache directory must be writable. "%s" is not.', $cacheFolder), 6);
            }

            $compiler = $this->getRenderer()->getCompiler();
            $fullPath = $compiler->locate($path) ?: $path;
            $output = $rendered($fullPath, $input);
            $importsPaths = $compiler->getImportPaths($fullPath);

            $success = $this->cacheFileContents(
                $destination,
                $output,
                $importsPaths
            );
        }

        return $destination;
    }
public function cache($path, $input, callable $rendered, &$success = null)
    {
        $cacheFolder = $this->getCacheDirectory();
        $destination = $path;

        if (!$this->isCacheUpToDate($destination, $input)) {
            if (!is_writable($cacheFolder)) {
                throw new RuntimeException(sprintf('Cache directory must be writable. "%s" is not.', $cacheFolder), 6);
            }

            $compiler = $this->getRenderer()->getCompiler();
            $fullPath = $compiler->locate($path) ?: $path;
            $output = $rendered($fullPath, $input);
            $importsPaths = $compiler->getImportPaths($fullPath);

            $success = $this->cacheFileContents(
                $destination,
                $output,
                $importsPaths
            );
        }

        return $destination;
    }
public function cache ( $ path , $ input , callable $ rendered , & $ success = null ) { $ cacheFolder = $ this -> getCacheDirectory ( ) ; $ destination = $ path ; if ( ! $ this -> isCacheUpToDate ( $ destination , $ input ) ) { if ( ! is_writable ( $ cacheFolder ) ) { throw new RuntimeException ( sprintf ( 'Cache directory must be writable. "%s" is not.' , $ cacheFolder ) , 6 ) ; } $ compiler = $ this -> getRenderer ( ) -> getCompiler ( ) ; $ fullPath = $ compiler -> locate ( $ path ) ? : $ path ; $ output = $ rendered ( $ fullPath , $ input ) ; $ importsPaths = $ compiler -> getImportPaths ( $ fullPath ) ; $ success = $ this -> cacheFileContents ( $ destination , $ output , $ importsPaths ) ; } return $ destination ; }
Return the cached file path after cache optional process.

@param $path
@param string   $input    pug input
@param callable $rendered method to compile the source into PHP
@param bool     $success

@return string
Return the cached file path after cache optional process .