PygmentsElephant/Pygmentize.php
public function format($content, $originalFilename)
    {
        $pathInfo = pathinfo($originalFilename);
        $filename = sys_get_temp_dir().'/pygmentize_'.sha1(uniqid()).(isset($pathInfo['extension']) ? '.'. $pathInfo['extension'] : '');
        $this->fs->touch($filename);
        $h = fopen($filename, 'w');
        fwrite($h, $content);
        fclose($h);

        return $this->formatFile($filename, $this->binary->guessLexer($filename));
    }
public function format($content, $originalFilename)
    {
        $pathInfo = pathinfo($originalFilename);
        $filename = sys_get_temp_dir().'/pygmentize_'.sha1(uniqid()).(isset($pathInfo['extension']) ? '.'. $pathInfo['extension'] : '');
        $this->fs->touch($filename);
        $h = fopen($filename, 'w');
        fwrite($h, $content);
        fclose($h);

        return $this->formatFile($filename, $this->binary->guessLexer($filename));
    }
public function format ( $ content , $ originalFilename ) { $ pathInfo = pathinfo ( $ originalFilename ) ; $ filename = sys_get_temp_dir ( ) . '/pygmentize_' . sha1 ( uniqid ( ) ) . ( isset ( $ pathInfo [ 'extension' ] ) ? '.' . $ pathInfo [ 'extension' ] : '' ) ; $ this -> fs -> touch ( $ filename ) ; $ h = fopen ( $ filename , 'w' ) ; fwrite ( $ h , $ content ) ; fclose ( $ h ) ; return $ this -> formatFile ( $ filename , $ this -> binary -> guessLexer ( $ filename ) ) ; }
format a string of content

@param string $content          content
@param string $originalFilename original filename for the lexer guesser

@internal param string $lexer lexer
@internal param string $format format

@internal param string $filename file name
@return string
format a string of content