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