/** * sets error handlers; * bind event 'mvc.error' to function * * @access public * @return void */ public function __construct() { register_shutdown_function("\\MVC\\Error::FATAL"); set_error_handler("\\MVC\\Error::ERRORHANDLER"); set_exception_handler("\\MVC\\Error::EXCEPTION"); Event::BIND('mvc.error', function ($mPackage) { \MVC\Error::addERROR($mPackage); }); }
/** * gets the policy rules; if one matches to the current request, it will be executed * * @access public * @return void */ public function __construct() { Event::RUN('mvc.policy.before'); Event::BIND('mvc.error', function ($mPackage) { \MVC\Error::addERROR($mPackage); }); $aPolicy = $this->getPolicyRuleOnCurrentRequest(); if (!empty($aPolicy)) { foreach ($aPolicy as $sPolicy) { if ('' !== $sPolicy) { // execute policy if (call_user_func($sPolicy) === FALSE) { \MVC\Event::RUN('mvc.error', "Policy could not be executed: " . $sPolicy); } } } } Event::RUN('mvc.policy.after'); }