26 lines
		
	
	
		
			618 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			26 lines
		
	
	
		
			618 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| 
 | |
| class App
 | |
| {
 | |
|     public function __construct()
 | |
|     {
 | |
|         $config = require __DIR__ . '/../config.php';
 | |
|         $this->config = $config;
 | |
|     }
 | |
| 
 | |
|     public function model(string $model): object
 | |
|     {
 | |
|         // Require model file
 | |
|         require __DIR__ . '/../model/' . $model . '.php';
 | |
|         // Instantiate model
 | |
|         return new $model();
 | |
|     }
 | |
| 
 | |
|     public function view(string $view, array $data = []): void
 | |
|     {
 | |
|         // Import variables into the current symbol table from an array
 | |
|         extract($data);
 | |
|         // Require view file
 | |
|         require __DIR__ . '/../view/' . $view . '.php';
 | |
|     }
 | |
| } |