]> git.andy128k.dev Git - ipf.git/commitdiff
remove global router
authorAndrey Kutejko <andy128k@gmail.com>
Sat, 16 Mar 2019 17:45:24 +0000 (18:45 +0100)
committerAndrey Kutejko <andy128k@gmail.com>
Sat, 16 Mar 2019 17:46:25 +0000 (18:46 +0100)
ipf/cli.php
ipf/command/routes.php
ipf/project.php

index bf69e69f8a32c430fa92263ae787c08f9d2eabbe..bc1a9dac89eb112c0c9738232844047f7209b634 100644 (file)
@@ -19,7 +19,7 @@ class IPF_Cli_Provider implements ServiceProviderInterface {
             return array(
                 new IPF_Command_Shell,
                 new IPF_Command_DebugServer,
-                new IPF_Command_Routes,
+                new IPF_Command_Routes($c['router']),
                 new IPF_Command_DB,
                 new IPF_Command_DBDump,
                 new IPF_Command_DBRestore,
index ad57ee4f1110561e7d79ed5d8794bde4f9c018cc..7975328835cf4f858323781591cd1a4f2dfb7f93 100644 (file)
@@ -5,10 +5,17 @@ class IPF_Command_Routes
     public $command = 'routes';
     public $description = 'Displays all routes';
 
+    /** @var IPF_Router */
+    private $router;
+
+    function __construct(IPF_Router $router)
+    {
+        $this->router = $router;
+    }
+
     public function run($args=null)
     {
-        $rows = IPF_Project::getInstance()->router->describe();
+        $rows = $this->router->describe();
         IPF_Shell::displayTwoColumns($rows);
     }
 }
-
index d4b9b6f1c5bc97f68cf45dd5ca1f3e1f6b50cb0b..bf6ac37b18d5eb5ac5b7078984423360314d2001 100644 (file)
@@ -10,7 +10,6 @@ final class IPF_Project
     /** @var Container */
     private $container = null;
     private $apps = array();
-    public $router = null;
     public $request = null;
 
     static private $instance = NULL;
@@ -45,7 +44,6 @@ final class IPF_Project
                 $settings->get('app_base')
             );
         };
-        $this->router = $this->container['router'];
     }
 
     private function __clone()