예제 #1
0
 /**
  * Return [["/path", "testAction", [ "method" => ... ] ],...].
  *
  * @return array returns routes array
  */
 public function getActionRoutes()
 {
     $routes = array();
     $actions = $this->getActionMethods();
     foreach ($actions as $actionName => $actionInfo) {
         list($annotations, $meta) = $actionInfo;
         if (isset($annotations['Route'])) {
             $path = $annotations['Route'];
         } else {
             if ($actionName === 'indexAction') {
                 $path = '';
             } else {
                 $path = $this->translatePath($actionName);
                 // '/' . preg_replace_callback('/[A-Z]/', function($matches) {
             }
         }
         $route = array($path, $actionName);
         if (isset($annotations['Method'])) {
             $route[] = array('method' => Mux::convertRequestMethodConstant($annotations['Method']));
         } else {
             $route[] = array();
         }
         $routes[] = $route;
     }
     return $routes;
 }