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 //        $this->scan($this->rootDir, 'Pman');
29         $this->scan($this->rootDir);
30     }
31
32     function scan($p, $pr, $path = false) 
33     {
34         $full_path = array($p, $pr);
35         $class_path = array();
36         if ($path !== false) {
37             $full_path = array_merge($full_path, $path);
38             $class_path = array_merge($class_path, $path);
39         }
40         //print_r("CHKDIR:    ". implode('/', $full_path)."\n");
41
42         foreach (scandir(implode('/', $full_path)) as $d) {
43
44             if (!strlen($d) || $d[0] == '.') {
45                 continue;
46             }
47             $chk = $full_path;
48             $chk[] = $d;
49
50             $clp = $class_path;
51
52
53
54             //print_r("CHK:          " . implode('/', $chk)."\n");
55             // is it a file.. and .PHP...
56             if (!is_dir(implode('/', $chk))) {
57                 if (!preg_match('/\.php$/', $d)) {
58                     continue;
59                 }
60                 $clp[] = preg_replace('/\.php$/', '', $d);
61
62                 //print_r("CLP:          " . implode('/', $clp)."\n");
63                 require_once "Pman/" . implode('/', $clp) . '.php';
64                 continue;
65             }
66             $clp[] = $d;
67             // otherwise recurse...
68             //print_r("RECURSE:        " . implode('/', $clp)."\n");
69
70             $this->scan($p, $pr, $clp);
71         }
72     }
73
74     function output() 
75     {
76         die("DONE");
77     }
78
79 }