original_string: public function setRoutes()
      {
          $routesJsonFile = $this->getAppDir() . '/config/routes.json';
          $routesPhpFile = $this->getAppDir() . '/config/routes.php';
          $routes = array();
  
          if (file_exists($routesJsonFile)) {
              $routes[] = json_decode(file_get_contents($routesJsonFile), true);
          } elseif (file_exists($routesPhpFile)) {
              $routes[] = require_once $routesPhpFile;
          }
  
          foreach ($this->container->getModules() as $module) {
              $extension = $module->getModuleExtension();
              if (is_object($extension) && $extension instanceof Injection\Extension) {
                  $routes[] = $extension->loadRoutes();
              }
          }
  
          return $routes;
      }
code: public function setRoutes()
      {
          $routesJsonFile = $this->getAppDir() . '/config/routes.json';
          $routesPhpFile = $this->getAppDir() . '/config/routes.php';
          $routes = array();
  
          if (file_exists($routesJsonFile)) {
              $routes[] = json_decode(file_get_contents($routesJsonFile), true);
          } elseif (file_exists($routesPhpFile)) {
              $routes[] = require_once $routesPhpFile;
          }
  
          foreach ($this->container->getModules() as $module) {
              $extension = $module->getModuleExtension();
              if (is_object($extension) && $extension instanceof Injection\Extension) {
                  $routes[] = $extension->loadRoutes();
              }
          }
  
          return $routes;
      }
code_tokens: public function setRoutes ( ) { $ routesJsonFile = $ this -> getAppDir ( ) . '/config/routes.json' ; $ routesPhpFile = $ this -> getAppDir ( ) . '/config/routes.php' ; $ routes = array ( ) ; if ( file_exists ( $ routesJsonFile ) ) { $ routes [ ] = json_decode ( file_get_contents ( $ routesJsonFile ) , true ) ; } elseif ( file_exists ( $ routesPhpFile ) ) { $ routes [ ] = require_once $ routesPhpFile ; } foreach ( $ this -> container -> getModules ( ) as $ module ) { $ extension = $ module -> getModuleExtension ( ) ; if ( is_object ( $ extension ) && $ extension instanceof Injection \ Extension ) { $ routes [ ] = $ extension -> loadRoutes ( ) ; } } return $ routes ; }
docstring: Set Routes from JSON|PHP File
  
  @return Route[]
docstring_tokens: Set Routes from JSON|PHP File