Process/Php7.php
[Pman.Core] / Process / Php7.php
1 <?php
2
3 /**
4  *
5  * PHP7 produces all sorts of pointless warnings... this attempts to just include all the files,
6  * so that you can view them..??
7  *
8  * would be nice to write the code to fix them.
9  *
10  */
11 require_once 'Pman.php';
12
13 class Pman_Core_Process_Php7 extends Pman 
14 {
15
16     static $cli_desc = "Tests for PHP compatibilty, by including files...";
17     static $cli_opts = array();
18
19     function getAuth() 
20     {
21         if (empty($this->bootLoader->cli)) {
22             die("CLI only");
23         }
24     }
25     
26     function get($base, $opts = array()) 
27     {
28         set_error_handler(function ($errno, $errstr, $errfile, $errline ){
29 //            throw new ErrorException($errstr, $errno, 0, $errfile, $errline);
30             print_r(array(
31                 $errno,
32                 $errstr,
33                 $errfile,
34                 $errline
35             ));
36         });
37         
38         $this->scan($this->rootDir . "/Pman");
39         $this->scan($this->rootDir . "/Hebe");
40         
41         exit;
42     }
43     
44     function scan($route = array()) 
45     {
46         $dir = $this->rootDir . "/" . implode("/", $route);
47         
48         echo "Looking for {$dir}\n";
49         
50         foreach (scandir($dir) as $d) {
51             
52             if (!strlen($d) || $d[0] == '.') {
53                 continue;
54             }
55             
56             if (is_dir($d)) {
57                 $this->scan(array_merge($route, array($d)));
58                 continue;
59             }
60             
61             if (!preg_match('/\.php$/', $d)) {
62                 continue;
63             }
64             
65             if(empty($route)){
66                 continue;
67             }
68             
69             try {
70                 
71                 require_once implode('/', $route) . "/" . $d;
72                 
73             } catch (ErrorException $ex) {
74                 echo $ex->getMessage() . "\n";
75             }
76             
77         }
78         
79     }
80
81 //    function scan($p, $pr, $path = false) 
82 //    {
83 //        $full_path = array($p, $pr);
84 //        $class_path = array();
85 //        if ($path !== false) {
86 //            $full_path = array_merge($full_path, $path);
87 //            $class_path = array_merge($class_path, $path);
88 //        }
89 //        //print_r("CHKDIR:    ". implode('/', $full_path)."\n");
90 //
91 //        foreach (scandir(implode('/', $full_path)) as $d) {
92 //
93 //            if (!strlen($d) || $d[0] == '.') {
94 //                continue;
95 //            }
96 //            $chk = $full_path;
97 //            $chk[] = $d;
98 //
99 //            $clp = $class_path;
100 //
101 //
102 //
103 //            //print_r("CHK:          " . implode('/', $chk)."\n");
104 //            // is it a file.. and .PHP...
105 //            if (!is_dir(implode('/', $chk))) {
106 //                if (!preg_match('/\.php$/', $d)) {
107 //                    continue;
108 //                }
109 //                $clp[] = preg_replace('/\.php$/', '', $d);
110 //
111 //                //print_r("CLP:          " . implode('/', $clp)."\n");
112 //                require_once "Pman/" . implode('/', $clp) . '.php';
113 //                continue;
114 //            }
115 //            $clp[] = $d;
116 //            // otherwise recurse...
117 //            //print_r("RECURSE:        " . implode('/', $clp)."\n");
118 //
119 //            $this->scan($p, $pr, $clp);
120 //        }
121 //    }
122
123     function output() 
124     {
125         die("DONE");
126     }
127
128 }