Esempio n. 1
0
 /**
  * set result
  *
  * @param string $resultName
  * @param array $params
  */
 public function setResult($resultName, $params)
 {
     $resultClass = Settings::getResultClass($resultName);
     $this->_result = new $resultClass();
     $this->_result->setEvent($this);
     $this->_result->setParams($params);
     Settings::setResult($resultName, $this->_result);
     $this->_result->init();
 }
Esempio n. 2
0
 /**
  * handle controller
  *
  * @param string $controller
  */
 protected function serve($controller)
 {
     try {
         if (empty($controller)) {
             $controller = Settings::routerNotFound();
         }
         $parts = parse_url($controller);
         $controller = $parts['path'];
         $method = 'execute';
         $interceptorManager = new InterceptorManager();
         if (!empty($parts['scheme'])) {
             $interceptors = explode('+', $parts['scheme']);
             foreach ($interceptors as $interceptor) {
                 Settings::pushInterceptor($interceptorManager, $interceptor);
             }
         }
         if (!empty($parts['fragment'])) {
             $method = $parts['fragment'];
         }
         $controllerInstance = new $controller($this->request, $this->response, $interceptorManager);
         if (!empty($parts['query'])) {
             parse_str($parts['query'], $params);
             foreach ($params as $key => $val) {
                 $controllerInstance->{$key} = $val;
             }
         }
         $controllerInstance->handle($method);
         $this->response->respond();
     } catch (\Exception $e) {
         Settings::catchException($e);
     }
 }
Esempio n. 3
0
<?php

require '../src/Settings.php';
// set framework
\TE\Settings::autoLoad('../src/', 'TE');