private function compile($file) {
        if(!file_exists($file)) {
            throw new \Exception("Could not compile $file, file not found");
        }

        if(!file_exists($this->views_cache) && !mkdir($this->views_cache)) {
            throw new \Exception("Could no create cache directory." . 
                " Make sure you have write permissions.");
        }

        $hash = md5($file);
        $compiled_file = $this->views_cache . '/' . $hash;
        $compiled = null;

        if( $this->debug || (!file_exists($compiled_file) 
            || filemtime($compiled_file) < filemtime($file))) {
            // get the katar source code and compile it
            $source = file_get_contents($file);
            $compiled = $this->compileString($source);
            $compiled = "<?php\nfunction katar_" . $hash .
                "(\$args) {\nextract(\$args);\n\$output = null;\n" . $compiled .
                "\nreturn \$output;\n}\n";

            file_put_contents($compiled_file, $compiled);
        } else {
            $compiled = file_get_contents($cache_file);
        }

        return $compiled;
    }
private function compile($file) {
        if(!file_exists($file)) {
            throw new \Exception("Could not compile $file, file not found");
        }

        if(!file_exists($this->views_cache) && !mkdir($this->views_cache)) {
            throw new \Exception("Could no create cache directory." . 
                " Make sure you have write permissions.");
        }

        $hash = md5($file);
        $compiled_file = $this->views_cache . '/' . $hash;
        $compiled = null;

        if( $this->debug || (!file_exists($compiled_file) 
            || filemtime($compiled_file) < filemtime($file))) {
            // get the katar source code and compile it
            $source = file_get_contents($file);
            $compiled = $this->compileString($source);
            $compiled = "<?php\nfunction katar_" . $hash .
                "(\$args) {\nextract(\$args);\n\$output = null;\n" . $compiled .
                "\nreturn \$output;\n}\n";

            file_put_contents($compiled_file, $compiled);
        } else {
            $compiled = file_get_contents($cache_file);
        }

        return $compiled;
    }
private function compile ( $ file ) { if ( ! file_exists ( $ file ) ) { throw new \ Exception ( "Could not compile $file, file not found" ) ; } if ( ! file_exists ( $ this -> views_cache ) && ! mkdir ( $ this -> views_cache ) ) { throw new \ Exception ( "Could no create cache directory." . " Make sure you have write permissions." ) ; } $ hash = md5 ( $ file ) ; $ compiled_file = $ this -> views_cache . '/' . $ hash ; $ compiled = null ; if ( $ this -> debug || ( ! file_exists ( $ compiled_file ) || filemtime ( $ compiled_file ) < filemtime ( $ file ) ) ) { // get the katar source code and compile it $ source = file_get_contents ( $ file ) ; $ compiled = $ this -> compileString ( $ source ) ; $ compiled = "<?php\nfunction katar_" . $ hash . "(\$args) {\nextract(\$args);\n\$output = null;\n" . $ compiled . "\nreturn \$output;\n}\n" ; file_put_contents ( $ compiled_file , $ compiled ) ; } else { $ compiled = file_get_contents ( $ cache_file ) ; } return $ compiled ; }
Compiles a Katar file to a PHP file, returning the compiled code

@param string $file The path of the file to be compiled

@return string The compiled PHP code
Compiles a Katar file to a PHP file returning the compiled code