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         $dir = array($this->rootDir);
29         $cls = array();
30         
31 //        $this->scan($this->rootDir, 'Pman');
32         $this->scan($dir, $cls);
33     }
34     
35     function scan($dir, $cls) 
36     {
37         echo "Looking for " . implode('/', $dir) . "\n";
38         
39         foreach (scandir(implode('/', $dir)) as $d) {
40             
41             if (!strlen($d) || $d[0] == '.') {
42                 continue;
43             }
44             
45             if (is_dir($d)) {
46                 $this->scan(array_merge($dir, array($d)), array_merge($cls, array($d)));
47                 continue;
48             }
49             
50             if (!preg_match('/\.php$/', $d)) {
51                 continue;
52             }
53             
54             require_once implode('/', $cls) . "/" . $d;
55             
56         }
57         
58     }
59
60 //    function scan($p, $pr, $path = false) 
61 //    {
62 //        $full_path = array($p, $pr);
63 //        $class_path = array();
64 //        if ($path !== false) {
65 //            $full_path = array_merge($full_path, $path);
66 //            $class_path = array_merge($class_path, $path);
67 //        }
68 //        //print_r("CHKDIR:    ". implode('/', $full_path)."\n");
69 //
70 //        foreach (scandir(implode('/', $full_path)) as $d) {
71 //
72 //            if (!strlen($d) || $d[0] == '.') {
73 //                continue;
74 //            }
75 //            $chk = $full_path;
76 //            $chk[] = $d;
77 //
78 //            $clp = $class_path;
79 //
80 //
81 //
82 //            //print_r("CHK:          " . implode('/', $chk)."\n");
83 //            // is it a file.. and .PHP...
84 //            if (!is_dir(implode('/', $chk))) {
85 //                if (!preg_match('/\.php$/', $d)) {
86 //                    continue;
87 //                }
88 //                $clp[] = preg_replace('/\.php$/', '', $d);
89 //
90 //                //print_r("CLP:          " . implode('/', $clp)."\n");
91 //                require_once "Pman/" . implode('/', $clp) . '.php';
92 //                continue;
93 //            }
94 //            $clp[] = $d;
95 //            // otherwise recurse...
96 //            //print_r("RECURSE:        " . implode('/', $clp)."\n");
97 //
98 //            $this->scan($p, $pr, $clp);
99 //        }
100 //    }
101
102     function output() 
103     {
104         die("DONE");
105     }
106
107 }