82b2d5a85d17f15b2b36fba148aec1012df8cede
[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(array("Pman"));
39         $this->scan(array("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                 echo "not handle {$d}\n";
54                 continue;
55             }
56             
57             if (is_dir($d)) {
58                 echo "directory : {$d}\n";
59                 $this->scan(array_merge($route, array($d)));
60                 continue;
61             }
62             
63             if (!preg_match('/\.php$/', $d)) {
64                 continue;
65             }
66             
67             try {
68                 
69                 require_once implode('/', $route) . "/" . $d;
70                 
71             } catch (ErrorException $ex) {
72                 echo $ex->getMessage() . "\n";
73             }
74             
75         }
76         
77     }
78     
79     function output() 
80     {
81         die("DONE");
82     }
83
84 }