*/ class Handler { /** * Filename * * @var string */ protected $filename; /** * Contents of file * * @var string */ protected $file; /** * Check file can be read * Read and parse file into array * * @author Phil Burton * @param string $filename string */ public function __construct(string $filename) { $this->filename = $filename; if (!is_readable($filename)) { throw new Exception('Cannot read from file: ' . $filename); } $this->load(); } /** * Load the file * * @author Phil Burton */ public function load() { $this->file = file_get_contents($this->filename); } /** * Retun the raw file contents * * @author Phil Burton * @return string */ public function getFileContents(): string { return $this->file; } }