public static function formatExampleComment($example)
    {
        // Remove possible code tag
        $example = self::stripCodeTags($example);

        if( preg_match('/(\n       )/', $example) ) {
            $example = preg_replace('/(\n       )/', "\n", $example);
        }
        elseif( preg_match('/(\n    )/', $example) ) {
            $example = preg_replace('/(\n    )/', "\n", $example);
        } else {
            $example = preg_replace('/(\n   )/', "\n", $example);
        }
        $type = '';

        // A very naive analysis of the programming language used in the comment
        if( strpos($example, '<?php') !== false ) {
            $type = 'php';
        }
        elseif( strpos($example, 'var ') !== false && strpos($example, '</') === false ) {
            $type = 'js';
        }

        return sprintf("```%s\n%s\n```", $type, trim($example));
    }
public static function formatExampleComment($example)
    {
        // Remove possible code tag
        $example = self::stripCodeTags($example);

        if( preg_match('/(\n       )/', $example) ) {
            $example = preg_replace('/(\n       )/', "\n", $example);
        }
        elseif( preg_match('/(\n    )/', $example) ) {
            $example = preg_replace('/(\n    )/', "\n", $example);
        } else {
            $example = preg_replace('/(\n   )/', "\n", $example);
        }
        $type = '';

        // A very naive analysis of the programming language used in the comment
        if( strpos($example, '<?php') !== false ) {
            $type = 'php';
        }
        elseif( strpos($example, 'var ') !== false && strpos($example, '</') === false ) {
            $type = 'js';
        }

        return sprintf("```%s\n%s\n```", $type, trim($example));
    }
public static function formatExampleComment ( $ example ) { // Remove possible code tag $ example = self :: stripCodeTags ( $ example ) ; if ( preg_match ( '/(\n       )/' , $ example ) ) { $ example = preg_replace ( '/(\n       )/' , "\n" , $ example ) ; } elseif ( preg_match ( '/(\n    )/' , $ example ) ) { $ example = preg_replace ( '/(\n    )/' , "\n" , $ example ) ; } else { $ example = preg_replace ( '/(\n   )/' , "\n" , $ example ) ; } $ type = '' ; // A very naive analysis of the programming language used in the comment if ( strpos ( $ example , '<?php' ) !== false ) { $ type = 'php' ; } elseif ( strpos ( $ example , 'var ' ) !== false && strpos ( $ example , '</' ) === false ) { $ type = 'js' ; } return sprintf ( "```%s\n%s\n```" , $ type , trim ( $ example ) ) ; }
Create a markdown-formatted code view out of an example comment
@param string $example
@return string
Create a markdown - formatted code view out of an example comment