PluginProbe
User Access Manager / 2.1.11
User Access Manager v2.1.11
2.3.20 2.3.19 2.3.18 2.3.17 2.3.16 2.3.15 2.3.14 2.3.13 trunk 0.6 0.6.1 0.6.2 0.7 0.7 Beta 0.7.0.1 0.8 0.8.0.1 0.8.0.2 0.9 0.9.1 0.9.1.1 0.9.1.2 0.9.1.3 0.9.1.4 1.0 All 136 releases
← All changes | src/Wrapper/Php.php +104 -94 2.3.17 → 2.1.11 View file →
@@ -1,19 +1,35 @@
1 1 <?php
2 -
3 -declare(strict_types=1);
4 -
2 +/**
3 + * Php.php
4 + *
5 + * The Php class file.
6 + *
7 + * PHP versions 5
8 + *
9 + * @author Alexander Schneider <[email protected]>
10 + * @copyright 2008-2017 Alexander Schneider
11 + * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2
12 + * @version SVN: $id$
13 + * @link http://wordpress.org/extend/plugins/user-access-manager/
14 + */
5 15 namespace UserAccessManager\Wrapper;
6 16
7 -use Exception;
8 -use JetBrains\PhpStorm\NoReturn;
9 -
17 +/**
18 + * Class Php
19 + *
20 + * @package UserAccessManager\Wrapper
21 + */
10 22 class Php
11 23 {
12 24 /**
13 25 * @see function_exists()
26 + *
27 + * @param string $functionName
28 + *
29 + * @return bool
14 30 */
15 - public function functionExists(string $functionName): bool
31 + public function functionExists($functionName)
16 32 {
17 33 return function_exists($functionName);
18 34 }
19 35
@@ -18,10 +34,16 @@
18 34 }
19 35
20 36 /**
21 37 * @see array_fill()
38 + *
39 + * @param int $startIndex
40 + * @param int $numberOfElements
41 + * @param mixed $value
42 + *
43 + * @return array
22 44 */
23 - public function arrayFill(int $startIndex, int $numberOfElements, mixed $value): array
45 + public function arrayFill($startIndex, $numberOfElements, $value)
24 46 {
25 47 return array_fill($startIndex, $numberOfElements, $value);
26 48 }
27 49
@@ -26,21 +48,28 @@
26 48 }
27 49
28 50 /**
29 51 * @see openssl_random_pseudo_bytes()
52 + *
53 + * @param int $length
54 + * @param bool $strong
55 + *
56 + * @return string
30 57 */
31 - public function opensslRandomPseudoBytes(int $length, ?bool &$strong = false): bool|string
58 + public function opensslRandomPseudoBytes($length, &$strong)
32 59 {
33 60 return openssl_random_pseudo_bytes($length, $strong);
34 61 }
35 62
36 63 /**
37 - * @param string $filename
38 - * @param null $context
64 + * @see unlink()
65 + *
66 + * @param string $filename
67 + * @param resource $context
68 + *
39 69 * @return bool
40 - * @see unlink()
41 70 */
42 - public function unlink(string $filename, $context = null): bool
71 + public function unlink($filename, $context = null)
43 72 {
44 73 return ($context !== null) ? unlink($filename, $context) : unlink($filename);
45 74 }
46 75
@@ -45,26 +74,26 @@
45 74 }
46 75
47 76 /**
48 77 * @see ini_get()
78 + *
79 + * @param string $variableName
80 + *
81 + * @return string
49 82 */
50 - public function iniGet(string $variableName): int|string|false
83 + public function iniGet($variableName)
51 84 {
52 85 return ini_get($variableName);
53 86 }
54 87
55 88 /**
56 - * @see header()
57 - */
58 - public function header(string $header, bool $replace = true, int $responseCode = 0): void
59 - {
60 - header($header, $replace, $responseCode);
61 - }
62 -
63 - /**
64 89 * @see set_time_limit()
90 + *
91 + * @param int $seconds
92 + *
93 + * @return bool
65 94 */
66 - public function setTimeLimit(int $seconds): bool
95 + public function setTimeLimit($seconds)
67 96 {
68 97 return @set_time_limit($seconds);
69 98 }
70 99
@@ -69,23 +98,32 @@
69 98 }
70 99
71 100 /**
72 101 * @see fread()
102 + *
103 + * @param resource $handle
104 + * @param int $length
105 + *
106 + * @return bool|string
73 107 */
74 - public function fread($handle, int $length): false|string
108 + public function fread($handle, $length)
75 109 {
76 110 return fread($handle, $length);
77 111 }
78 112
79 113 /**
80 - * @throws Exception
114 + * @param mixed $controller
115 + * @param string $file
116 + *
117 + * @throws \Exception
81 118 */
82 - public function includeFile($controller, string $file): void
119 + public function includeFile(&$controller, $file)
83 120 {
84 121 if ($controller === null) {
85 - throw new Exception('Controller is required');
122 + throw new \Exception('Controller is required');
86 123 }
87 124
125 + /** @noinspection PhpIncludeInspection */
88 126 include $file;
89 127 }
90 128
91 129 /**
@@ -90,10 +128,9 @@
90 128
91 129 /**
92 130 * @see exit()
93 131 */
94 - #[NoReturn]
95 - public function callExit(): void
132 + public function callExit()
96 133 {
97 134 exit;
98 135 }
99 136
@@ -98,76 +135,69 @@
98 135 }
99 136
100 137 /**
101 138 * @see file_put_contents()
139 + *
140 + * @param string $filename
141 + * @param mixed $data
142 + * @param int $flags
143 + * @param null $context
144 + *
145 + * @return bool|int
102 146 */
103 - public function filePutContents(string $filename, mixed $data, int $flags = 0, $context = null): false|int
147 + public function filePutContents($filename, $data, $flags = 0, $context = null)
104 148 {
105 149 return file_put_contents($filename, $data, $flags, $context);
106 150 }
107 151
108 152 /**
109 - * @see is_file()
110 - */
111 - public function isFile(string $filename): bool
112 - {
113 - return is_file($filename);
114 - }
115 -
116 - /**
117 - * @see filemtime()
118 - */
119 - public function fileMTime(string $filename): int|false
120 - {
121 - return filemtime($filename);
122 - }
123 -
124 - /**
125 - * @see file_get_contents()
126 - */
127 - public function fileGetContents(string $filename): string|false
128 - {
129 - return @file_get_contents($filename);
130 - }
131 -
132 - /**
133 - * @see realpath()
134 - */
135 - public function realpath(string $path): string|false
136 - {
137 - return realpath($path);
138 - }
139 -
140 - /**
141 153 * @see igbinary_serialize()
154 + *
155 + * @param mixed $value
156 + *
157 + * @return string
142 158 */
143 - public function igbinarySerialize(mixed $value): ?string
159 + public function igbinarySerialize($value)
144 160 {
161 + /** @noinspection PhpUndefinedFunctionInspection */
145 162 return igbinary_serialize($value);
146 163 }
147 164
148 165 /**
149 166 * @see igbinary_unserialize()
167 + *
168 + * @param string $key
169 + *
170 + * @return mixed
150 171 */
151 - public function igbinaryUnserialize(string $key): mixed
172 + public function igbinaryUnserialize($key)
152 173 {
174 + /** @noinspection PhpUndefinedFunctionInspection */
153 175 return igbinary_unserialize($key);
154 176 }
155 177
156 178 /**
157 179 * @see mkdir()
180 + *
181 + * @param string $pathname
182 + * @param int $mode
183 + * @param bool $recursive
184 + * @param resource $context
185 + *
186 + * @return bool
158 187 */
159 - public function mkdir(string $pathname, int $mode = 0777, bool $recursive = false, $context = null): bool
188 + public function mkdir($pathname, $mode = 0777, $recursive = false, $context = null)
160 189 {
161 - return ($context !== null)
162 - ? mkdir($pathname, $mode, $recursive, $context)
163 - : mkdir($pathname, $mode, $recursive);
190 + return ($context !== null) ?
191 + mkdir($pathname, $mode, $recursive, $context) : mkdir($pathname, $mode, $recursive);
164 192 }
165 193
166 194 /**
167 195 * @see connection_status()
196 + *
197 + * @return int
168 198 */
169 - public function connectionStatus(): int
199 + public function connectionStatus()
170 200 {
171 201 return connection_status();
172 202 }
173 203
@@ -172,34 +202,14 @@
172 202 }
173 203
174 204 /**
175 205 * @see fclose()
206 + *
207 + * @param resource $handle
208 + *
209 + * @return bool
176 210 */
177 - public function fClose($handle): bool
211 + public function fClose($handle)
178 212 {
179 213 return fclose($handle);
180 - }
181 -
182 - /**
183 - * @see fseek()
184 - */
185 - public function fseek($handle, int $offset, int $whence = SEEK_SET): int
186 - {
187 - return fseek($handle, $offset, $whence);
188 - }
189 -
190 - /**
191 - * @see flush()
192 - */
193 - public function flush(): void
194 - {
195 - flush();
196 - }
197 -
198 - /**
199 - * @see finfo_close()
200 - */
201 - public function fInfoClose($fileInfo): bool
202 - {
203 - return finfo_close($fileInfo);
204 214 }
205 215 }