These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | namespace Redaxscript\Bootstrap; |
||
3 | |||
4 | use PDO; |
||
5 | use Redaxscript\Client; |
||
6 | use Redaxscript\Server; |
||
7 | |||
8 | /** |
||
9 | * children class to boot the common |
||
10 | * |
||
11 | * @since 3.1.0 |
||
12 | * |
||
13 | * @package Redaxscript |
||
14 | * @category Bootstrap |
||
15 | * @author Henry Ruhs |
||
16 | */ |
||
17 | |||
18 | class Common extends BootstrapAbstract |
||
19 | { |
||
20 | /** |
||
21 | * automate run |
||
22 | * |
||
23 | * @since 3.1.0 |
||
24 | */ |
||
25 | |||
26 | 7 | protected function _autorun() |
|
27 | { |
||
28 | 7 | $this->_setServer(); |
|
29 | 7 | $this->_setClient(); |
|
30 | 7 | $this->_setDriver(); |
|
31 | 7 | $this->_setModule(); |
|
32 | 7 | $this->_setPhp(); |
|
33 | 7 | $this->_setOpcache(); |
|
34 | 7 | } |
|
35 | |||
36 | /** |
||
37 | * set the server |
||
38 | * |
||
39 | * @since 3.1.0 |
||
40 | */ |
||
41 | |||
42 | 7 | protected function _setServer() |
|
43 | { |
||
44 | 7 | $file = new Server\File($this->_request); |
|
45 | 7 | $root = new Server\Root($this->_request); |
|
46 | 7 | $host = new Server\Host($this->_request); |
|
47 | 7 | $token = new Server\Token($this->_request); |
|
48 | |||
49 | /* set the registry */ |
||
50 | |||
51 | 7 | $this->_registry->set('file', $file->getOutput()); |
|
52 | 7 | $this->_registry->set('root', $root->getOutput()); |
|
53 | 7 | $this->_registry->set('host', $host->getOutput()); |
|
54 | 7 | $this->_registry->set('token', $token->getOutput()); |
|
55 | 7 | } |
|
56 | |||
57 | /** |
||
58 | * set the client |
||
59 | * |
||
60 | * @since 3.1.0 |
||
61 | */ |
||
62 | |||
63 | 7 | protected function _setClient() |
|
64 | { |
||
65 | 7 | $browser = new Client\Browser($this->_request); |
|
66 | 7 | $version = new Client\Version($this->_request); |
|
67 | 7 | $engine = new Client\Engine($this->_request); |
|
68 | 7 | $mobile = new Client\Mobile($this->_request); |
|
69 | 7 | $tablet = new Client\Tablet($this->_request); |
|
70 | 7 | $desktop = new Client\Desktop($this->_request); |
|
71 | |||
72 | /* set the registry */ |
||
73 | |||
74 | 7 | $this->_registry->set('myBrowser', $browser->getOutput()); |
|
75 | 7 | $this->_registry->set('myBrowserVersion', $version->getOutput()); |
|
76 | 7 | $this->_registry->set('myEngine', $engine->getOutput()); |
|
77 | 7 | $this->_registry->set('myMobile', $mobile->getOutput()); |
|
78 | 7 | $this->_registry->set('myTablet', $tablet->getOutput()); |
|
79 | 7 | $this->_registry->set('myDesktop', $desktop->getOutput()); |
|
80 | 7 | } |
|
81 | |||
82 | /** |
||
83 | * set the driver |
||
84 | * |
||
85 | * @since 3.1.0 |
||
86 | */ |
||
87 | |||
88 | 7 | protected function _setDriver() |
|
89 | { |
||
90 | 7 | $driverArray = []; |
|
91 | |||
92 | /* process driver */ |
||
93 | |||
94 | 7 | foreach (PDO::getAvailableDrivers() as $driver) |
|
95 | { |
||
96 | 7 | $driver = $driver === 'sqlsrv' ? 'mssql' : $driver; |
|
97 | 7 | if (is_dir('database' . DIRECTORY_SEPARATOR . $driver)) |
|
98 | { |
||
99 | 7 | $driverArray[$driver] = $driver; |
|
100 | } |
||
101 | } |
||
102 | 7 | $this->_registry->set('driverArray', $driverArray); |
|
103 | 7 | } |
|
104 | |||
105 | /** |
||
106 | * set the module |
||
107 | * |
||
108 | * @since 3.1.0 |
||
109 | */ |
||
110 | |||
111 | 7 | protected function _setModule() |
|
112 | { |
||
113 | 7 | $moduleArray = function_exists('apache_get_modules') ? apache_get_modules() : []; |
|
114 | $fallbackArray = |
||
115 | [ |
||
116 | 7 | 'mod_deflate', |
|
117 | 'mod_headers', |
||
118 | 'mod_rewrite' |
||
119 | ]; |
||
120 | |||
121 | /* process fallback */ |
||
122 | |||
123 | 7 | if (!$moduleArray) |
|
124 | { |
||
125 | 7 | foreach ($fallbackArray as $value) |
|
126 | { |
||
127 | 7 | if (getenv('REDIRECT_' . $value) === 'on') |
|
128 | { |
||
129 | 7 | $moduleArray[$value] = true; |
|
130 | } |
||
131 | } |
||
132 | } |
||
133 | 7 | $this->_registry->set('moduleArray', $moduleArray); |
|
134 | 7 | } |
|
135 | |||
136 | /** |
||
137 | * set the php |
||
138 | * |
||
139 | * @since 3.2.3 |
||
140 | */ |
||
141 | |||
142 | 7 | protected function _setPhp() |
|
143 | { |
||
144 | 7 | $phpOs = strtolower(PHP_OS); |
|
145 | 7 | $phpVersion = PHP_VERSION; |
|
146 | 7 | if (strpos($phpOs, 'linux') === 0) |
|
147 | { |
||
148 | 7 | $this->_registry->set('phpOs', 'linux'); |
|
149 | } |
||
150 | else if (strpos($phpOs, 'win') === 0) |
||
151 | { |
||
152 | $this->_registry->set('phpOs', 'windows'); |
||
153 | } |
||
154 | 7 | $this->_registry->set('phpVersion', $phpVersion); |
|
155 | 7 | $this->_registry->set('phpStatus', version_compare($phpVersion, '7.2', '>=')); |
|
0 ignored issues
–
show
|
|||
156 | 7 | } |
|
157 | |||
158 | /** |
||
159 | * set the opcache |
||
160 | * |
||
161 | * @since 4.0.0 |
||
162 | */ |
||
163 | |||
164 | 7 | protected function _setOpcache() |
|
165 | { |
||
166 | 7 | $opcacheArray = function_exists('opcache_get_status') ? opcache_get_status(false) : []; |
|
167 | 7 | $this->_registry->set('opcacheArray', $opcacheArray); |
|
168 | 7 | } |
|
169 | } |
||
170 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: