/** * @param string $method The name of the method * @param array $arguments The arguments * * @return mixed * * @throws \Exception */ private function delegate($method, $arguments) { if (preg_match('~^visit(.+)~', $method, $match)) { $type = $match[1]; $this->dispatcher->dispatch(new RenderContentTypeEvent($type, $arguments[0])); try { $result = call_user_func_array([$this->renderer, $method], $arguments); $this->dispatcher->dispatch(new RenderContentTypeSuccessEvent($type, $this->renderer)); return $result; } catch (\Exception $exception) { $this->dispatcher->dispatch(new RenderContentTypeFailureEvent($type, $exception)); throw $exception; } } else { return call_user_func_array([$this->renderer, $method], $arguments); } }
/** * Start a session. * * @return void * * @since 1.0 */ public function start() { if ($this->getState() === 'active') { return; } $this->_start(); $this->setState('active'); // Initialise the session $this->_setCounter(); $this->_setTimers(); // Perform security checks $this->_validate(); if ($this->dispatcher instanceof DispatcherInterface) { $this->dispatcher->triggerEvent('onAfterSessionStart'); } }