Esempio n. 1
0
 public function __construct()
 {
     $this->watch = new Stopwatch();
     $this->watch->start('rendering');
     // initialize start time
     $this->start_time = microtime(true);
     // Initialize all parameters before parsing url
     Loader::Init();
     // get DI container
     if (DEVELOPMENT_ENVIRONMENT) {
         $this->watch->start('enable_container');
     }
     $this->container = ServiceProvider::GetDependencyContainer();
     if (DEVELOPMENT_ENVIRONMENT) {
         $event = $this->watch->stop('enable_container');
         $start_container = ($event->getOrigin() + $event->getStartTime()) / 1000;
         $stop_container = ($event->getOrigin() + $event->getEndTime()) / 1000;
         \Debug::addMeasure("Enable container", $start_container, $stop_container);
     }
     \Debug::startMeasure('load_filter', 'Load filters');
     // instantiate filters object
     $this->filters = new Filters();
     \Debug::stopMeasure('load_filter');
     // enable error reporting
     $this->setReporting();
 }
Esempio n. 2
0
 public function __construct(\Symfony\Component\HttpFoundation\Request $request = null)
 {
     $this->_route = "";
     $this->_controller = "";
     $this->_method = "";
     $this->_args = array();
     $this->_container = \GL\Core\DI\ServiceProvider::GetDependencyContainer();
     $req = $request != null ? $request : $this->_container->get('request');
     $this->_request = $req;
 }
Esempio n. 3
0
 protected static function resolveFacadeInstance($name)
 {
     if (is_object($name)) {
         return $name;
     }
     if (isset(static::$resolvedInstance[$name])) {
         return static::$resolvedInstance[$name];
     }
     return static::$resolvedInstance[$name] = \GL\Core\DI\ServiceProvider::GetDependencyContainer()->get($name);
 }
Esempio n. 4
0
 public function collect()
 {
     $redis = \GL\Core\DI\ServiceProvider::GetDependencyContainer()->get('redis');
     $commands = $redis->getCommandsHistory();
     $data = array();
     $i = 1;
     foreach ($commands as $value) {
         $data[$i] = "Method " . strtoupper($value['command']) . "  :: Parameters " . $this->getDataFormatter()->formatVar($value['parameters']);
         $i++;
     }
     return $data;
 }
Esempio n. 5
0
 private static function getContainer()
 {
     return \GL\Core\DI\ServiceProvider::GetDependencyContainer();
 }
Esempio n. 6
0
 function __construct()
 {
     $this->_container = \GL\Core\DI\ServiceProvider::GetDependencyContainer();
 }
Esempio n. 7
-1
 /**
  * Get Url from routename and parameters array
  * @param string $routename route name defined in routes.yml
  * @param array $params parameters array
  * @return string url
  */
 public static function route($routename, $params = array())
 {
     $url = "";
     try {
         $rc = \GL\Core\DI\ServiceProvider::GetDependencyContainer()->get('routes');
         $route = $rc->get($routename);
         if ($route != null) {
             $pattern = $route->getPath();
             $url = \GL\Core\Helpers\Utils::url($pattern);
             $urlo = S::create($url);
             $sep = "/";
             $defaults = $route->getDefaults();
             $param_array = array_merge($defaults, $params);
             foreach ($param_array as $key => $value) {
                 $str = '{' . $key . '}';
                 $urlo = $urlo->replace($str, $value);
             }
             $urlo = $urlo->removeRight($sep);
         }
     } catch (Exception $e) {
         $urlo = S::create("");
     }
     $ret = isset($urlo) == true ? $urlo->__toString() : "";
     return $ret;
 }