Created
October 13, 2016 13:37
-
-
Save NandoKstroNet/bc79a4b4dca76ea580fda8b1c302e07b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace CodeExpertsApps\App\MVC; | |
use Silex\Application; | |
class View | |
{ | |
private $data = []; | |
private $view; | |
private $app; | |
public function __construct($view, Application $app = null) | |
{ | |
$this->view = $view; | |
$this->app = $app; | |
} | |
public function __get($value) | |
{ | |
if(!isset($this->data[$value])) { | |
return null; | |
} | |
return $this->data[$value]; | |
} | |
public function __set($key, $value) | |
{ | |
$this->data[$key] = $value; | |
} | |
public function render() | |
{ | |
ob_start(); | |
require $this->view; | |
return ob_get_clean(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment