original_string: private function loadRouting()
      {
          $app = $this->app;
          $maps = [];
  
          $routing_file_path = $this->getAppPath('config').DIRECTORY_SEPARATOR.'routing.php';
          if (is_readable($routing_file_path)) {
              $maps = require $routing_file_path;
          }
  
          if ($maps) {
              $prefix_locale = $app['multi_languages'] ? '/{_locale}' : '';
              $app_controller_prefix = $app['app.vendor_name'].'\\Controller\\';
  
              foreach ($maps as $prefix => $routes) {
                  $map = $this->app['controllers_factory'];
  
                  foreach ($routes as $pattern => $target) {
                      if ($pattern == '.' && is_callable($target)) {
                          call_user_func($target, $map);
                      } else {
                          $params = is_array($target) ? $target : explode(':', $target);
                          $controller_name = $app_controller_prefix.$params[0];
                          $action = $params[1].'Action';
                          $bind_name = isset($params[2]) ? $params[2] : false;
                          $method = isset($params[4]) ? strtolower($params[4]) : 'get|post';
  
                          $tmp = $map->match($pattern, $controller_name.'::'.$action)->method($method);
                          if ($bind_name) {
                              $tmp->bind($bind_name);
                          }
  
                          if (!empty($params[3])) {
                              if (is_array($params[3])) {
                                  foreach ($params[3] as $key => $value) {
                                      $tmp->value($key, $value);
                                  }
                              } else {
                                  $defaults = explode(',', $params[3]);
                                  foreach ($defaults as $default) {
                                      $values = explode('=', $default);
                                      $tmp->value($values[0], $values[1]);
                                  }
                              }
                          }
  
                          if ($prefix_locale != '' && $prefix == '/' && $pattern == '/') {
                              $app->match('/', $controller_name.'::'.$action)->method($method);
                          }
                      }
                  }
  
                  $app->mount($prefix_locale.$prefix, $map);
              }
          }
      }
code: private function loadRouting()
      {
          $app = $this->app;
          $maps = [];
  
          $routing_file_path = $this->getAppPath('config').DIRECTORY_SEPARATOR.'routing.php';
          if (is_readable($routing_file_path)) {
              $maps = require $routing_file_path;
          }
  
          if ($maps) {
              $prefix_locale = $app['multi_languages'] ? '/{_locale}' : '';
              $app_controller_prefix = $app['app.vendor_name'].'\\Controller\\';
  
              foreach ($maps as $prefix => $routes) {
                  $map = $this->app['controllers_factory'];
  
                  foreach ($routes as $pattern => $target) {
                      if ($pattern == '.' && is_callable($target)) {
                          call_user_func($target, $map);
                      } else {
                          $params = is_array($target) ? $target : explode(':', $target);
                          $controller_name = $app_controller_prefix.$params[0];
                          $action = $params[1].'Action';
                          $bind_name = isset($params[2]) ? $params[2] : false;
                          $method = isset($params[4]) ? strtolower($params[4]) : 'get|post';
  
                          $tmp = $map->match($pattern, $controller_name.'::'.$action)->method($method);
                          if ($bind_name) {
                              $tmp->bind($bind_name);
                          }
  
                          if (!empty($params[3])) {
                              if (is_array($params[3])) {
                                  foreach ($params[3] as $key => $value) {
                                      $tmp->value($key, $value);
                                  }
                              } else {
                                  $defaults = explode(',', $params[3]);
                                  foreach ($defaults as $default) {
                                      $values = explode('=', $default);
                                      $tmp->value($values[0], $values[1]);
                                  }
                              }
                          }
  
                          if ($prefix_locale != '' && $prefix == '/' && $pattern == '/') {
                              $app->match('/', $controller_name.'::'.$action)->method($method);
                          }
                      }
                  }
  
                  $app->mount($prefix_locale.$prefix, $map);
              }
          }
      }
code_tokens: private function loadRouting ( ) { $ app = $ this -> app ; $ maps = [ ] ; $ routing_file_path = $ this -> getAppPath ( 'config' ) . DIRECTORY_SEPARATOR . 'routing.php' ; if ( is_readable ( $ routing_file_path ) ) { $ maps = require $ routing_file_path ; } if ( $ maps ) { $ prefix_locale = $ app [ 'multi_languages' ] ? '/{_locale}' : '' ; $ app_controller_prefix = $ app [ 'app.vendor_name' ] . '\\Controller\\' ; foreach ( $ maps as $ prefix => $ routes ) { $ map = $ this -> app [ 'controllers_factory' ] ; foreach ( $ routes as $ pattern => $ target ) { if ( $ pattern == '.' && is_callable ( $ target ) ) { call_user_func ( $ target , $ map ) ; } else { $ params = is_array ( $ target ) ? $ target : explode ( ':' , $ target ) ; $ controller_name = $ app_controller_prefix . $ params [ 0 ] ; $ action = $ params [ 1 ] . 'Action' ; $ bind_name = isset ( $ params [ 2 ] ) ? $ params [ 2 ] : false ; $ method = isset ( $ params [ 4 ] ) ? strtolower ( $ params [ 4 ] ) : 'get|post' ; $ tmp = $ map -> match ( $ pattern , $ controller_name . '::' . $ action ) -> method ( $ method ) ; if ( $ bind_name ) { $ tmp -> bind ( $ bind_name ) ; } if ( ! empty ( $ params [ 3 ] ) ) { if ( is_array ( $ params [ 3 ] ) ) { foreach ( $ params [ 3 ] as $ key => $ value ) { $ tmp -> value ( $ key , $ value ) ; } } else { $ defaults = explode ( ',' , $ params [ 3 ] ) ; foreach ( $ defaults as $ default ) { $ values = explode ( '=' , $ default ) ; $ tmp -> value ( $ values [ 0 ] , $ values [ 1 ] ) ; } } } if ( $ prefix_locale != '' && $ prefix == '/' && $ pattern == '/' ) { $ app -> match ( '/' , $ controller_name . '::' . $ action ) -> method ( $ method ) ; } } } $ app -> mount ( $ prefix_locale . $ prefix , $ map ) ; } } }
docstring: Load routing.
docstring_tokens: Load routing .