akshaykhale1992 /
TinyPHP
| 1 | <?php |
||
| 2 | use Windwalker\Renderer\BladeRenderer; |
||
| 3 | |||
| 4 | class Controller |
||
| 5 | { |
||
| 6 | private $renderer; |
||
| 7 | |||
| 8 | /** |
||
| 9 | * Loading the default blade |
||
| 10 | * rendered |
||
| 11 | * @author Akshay Khale |
||
| 12 | * @param Array $paths Array of default Directories |
||
| 13 | * @param Array $cache_path Array of Cache Path |
||
| 14 | */ |
||
| 15 | function __construct($paths, $cache_path) |
||
| 16 | { |
||
| 17 | $this->renderer = new BladeRenderer($paths, $cache_path); |
||
| 18 | } |
||
| 19 | |||
| 20 | /** |
||
| 21 | * Index method which gets loaded |
||
| 22 | * on default URL |
||
| 23 | * @return String HTML Content of the Page |
||
| 24 | */ |
||
| 25 | public function index() |
||
| 26 | { |
||
| 27 | return $this->renderer->render(sayHello(), []); |
||
| 28 | } |
||
| 29 | |||
| 30 | /** |
||
| 31 | * This function returns default |
||
| 32 | * 404 Error Page |
||
| 33 | * @return View Renders view on Browser window |
||
| 34 | */ |
||
| 35 | public function notFound() |
||
| 36 | { |
||
| 37 | return $this->renderer->render('errors.404', []); |
||
|
0 ignored issues
–
show
Bug
Best Practice
introduced
by
Loading history...
|
|||
| 38 | } |
||
| 39 | |||
| 40 | /** |
||
| 41 | * About page which gets loaded |
||
| 42 | * on <host_name>/about URL |
||
| 43 | * @return String HTML Content of the Page |
||
| 44 | */ |
||
| 45 | public function about() |
||
| 46 | { |
||
| 47 | return $this->renderer->render('about', []); |
||
| 48 | } |
||
| 49 | } |
||
| 50 |