src/CodeFile.php
public function preview()
    {
        if (($pos = strrpos($this->path, '.')) !== false) {
            $type = substr($this->path, $pos + 1);
        } else {
            $type = 'unknown';
        }

        if ($type === 'php') {
            return highlight_string($this->content, true);
        } elseif (!in_array($type, ['jpg', 'gif', 'png', 'exe'])) {
            return nl2br(Html::encode($this->content));
        }

        return false;
    }
public function preview()
    {
        if (($pos = strrpos($this->path, '.')) !== false) {
            $type = substr($this->path, $pos + 1);
        } else {
            $type = 'unknown';
        }

        if ($type === 'php') {
            return highlight_string($this->content, true);
        } elseif (!in_array($type, ['jpg', 'gif', 'png', 'exe'])) {
            return nl2br(Html::encode($this->content));
        }

        return false;
    }
public function preview ( ) { if ( ( $ pos = strrpos ( $ this -> path , '.' ) ) !== false ) { $ type = substr ( $ this -> path , $ pos + 1 ) ; } else { $ type = 'unknown' ; } if ( $ type === 'php' ) { return highlight_string ( $ this -> content , true ) ; } elseif ( ! in_array ( $ type , [ 'jpg' , 'gif' , 'png' , 'exe' ] ) ) { return nl2br ( Html :: encode ( $ this -> content ) ) ; } return false ; }
Returns preview or false if it cannot be rendered

@return bool|string
Returns preview or false if it cannot be rendered