Process/Php7.php
[Pman.Core] / Process / Php7.php
index f226662..8733aa2 100644 (file)
@@ -22,27 +22,57 @@ class Pman_Core_Process_Php7 extends Pman
             die("CLI only");
         }
     }
-
+    
     function get($base, $opts = array()) 
     {
-        $dir = array($this->rootDir);
-        $cls = array();
-        
-//        $this->scan($this->rootDir, 'Pman');
-        $this->scan($dir, $cls);
+        set_error_handler(function ($errno, $errstr, $errfile, $errline ){
+//            throw new ErrorException($errstr, $errno, 0, $errfile, $errline);
+            print_r(array(
+                $errno,
+                $errstr,
+                $errfile,
+                $errline
+            ));
+        });
         
+        $this->scan(array("Pman"));
+        $this->scan(array("Hebe"));
         
+        exit;
     }
     
-    function scan($dir
+    function scan($route = array()
     {
+        $dir = $this->rootDir . "/" . implode("/", $route);
+        
+        echo "Looking for {$dir}\n";
+        
         foreach (scandir($dir) as $d) {
             
             if (!strlen($d) || $d[0] == '.') {
                 continue;
             }
             
+            if (is_dir($d)) {
+                $this->scan(array_merge($route, array($d)));
+                continue;
+            }
+            
+            if (!preg_match('/\.php$/', $d)) {
+                continue;
+            }
             
+            if(empty($route)){
+                continue;
+            }
+            
+            try {
+                
+                require_once implode('/', $route) . "/" . $d;
+                
+            } catch (ErrorException $ex) {
+                echo $ex->getMessage() . "\n";
+            }
             
         }