. */ namespace Volkszaehler\Controller; /** * controller superclass for all controllers * * @author Steffen Vogel * */ abstract class Controller { protected $view; protected $em; /** * constructor */ public function __construct(\Volkszaehler\View\View $view, \Doctrine\ORM\EntityManager $em) { $this->view = $view; $this->em = $em; } /** * run controller actions * * @param string $action runs the action if class method is available */ public function run($action) { if (!method_exists($this, $action)) { throw new \InvalidArgumentException('\'' . $action . '\' is not a valid controller action'); } $this->$action(); } } ?>