Skip to content

Instantly share code, notes, and snippets.

@NandoKstroNet
Created October 13, 2016 13:37
Show Gist options
  • Save NandoKstroNet/bc79a4b4dca76ea580fda8b1c302e07b to your computer and use it in GitHub Desktop.
Save NandoKstroNet/bc79a4b4dca76ea580fda8b1c302e07b to your computer and use it in GitHub Desktop.
<?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