message_name, $this->config)) { throw new Exception('Could not load messge from config (' . $this->message_name . ')'); } $this->message = $this->config[$this->message_name]; } protected function loadConfig() { $config =Config::getConfig(); if (!$config) { throw new \Exception('Could not load config'); } $this->config = $config; } public function __construct() { $this->loadConfig(); $this->loadMessage(); } public function renderMessage() { $m = new Mustache_Engine; return $m->render($this->message, $this->getInjectValues()); } public function getInjectValues() { $out = []; foreach ($this->injects as $inject) { $out[$inject] = $this->$inject; } return $out; } public function getImportantValues() { $out = []; foreach ($this->important as $important) { $out[$important] = $this->$important; } return $out; } }