<?php
class ShowFile
{
private $_filename;
public function __construct($filename)
{
if (!is_readable($filename)) {
throw new RuntimeException('File [' . $filename . '] is not readable.');
}
$this->_filename = $filename;
}
public function showPlain()
{
echo '<pre>';
echo htmlspecialchars(file_get_contents($this->_filename), ENT_QUOTES);
echo '</pre>';
}
public function showHightlight()
{
highlight_file($this->_filename);
}
}