<?php class Page { private $pageReader; public function __construct(PageReader $pageReader) { $this->pageReader = $pageReader; } public function show($params) { $data['content'] = $this->pageReader->readBySlug($slug); } } interface PageReader { public function readBySlug(string $slug) : string; } class FilePageReader implements PageReader { private $pageFolder; public function __construct(string $pageFolder) { $this->pageFolder = $pageFolder; } public function readBySlug(string $slug) : string { $path = "$this->pageFolder/$slug.md"; if (!file_exists($path)) { throw new Exception($slug); } return file_get_contents($path); } }
You have javascript disabled. You will not be able to edit any code.
Value for `_results` contains invalid data `array`