Example #1
0
 public function initConfig($config)
 {
     $config['onWork'] = ArrayToolkit::index($config['onWork'], 'cmd');
     $config['onTask'] = ArrayToolkit::index($config['onTask'], 'cmd');
     $this->config = $config;
 }
Example #2
0
 /**
  * create routing cache
  *
  * @return  array
  */
 private function createMethodsCache()
 {
     $routing = $this->route->getRouting();
     $config = array();
     foreach ($routing as $key => $route) {
         $route['alias'] = $key;
         if (!isset($route['methods'])) {
             $config[$key] = $route;
             continue;
         }
         if (isset($route['methods']) && !in_array(strtoupper($route['methods']), $this->methods)) {
             continue;
         }
         if (isset($route['methods']) && $this->route->getCurrentMethod() != strtoupper($route['methods'])) {
             continue;
         }
         $config[$key] = $route;
     }
     $config = ArrayToolkit::index($config, 'pattern');
     return $config;
 }