PluginProbe
User Access Manager / 2.2.13
User Access Manager v2.2.13
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 +66 -103 trunk2.2.13 View file →
@@ -1,5 +1,18 @@
1 1 <?php
2 +/**
3 + * Php.php
4 + *
5 + * The Php class file.
6 + *
7 + * PHP versions 5
8 + *
9 + * @author Alexander Schneider <alexanderschneider85@gmail.com>
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 + */
2 15
3 16 declare(strict_types=1);
4 17
5 18 namespace UserAccessManager\Wrapper;
@@ -4,13 +17,19 @@
4 17
5 18 namespace UserAccessManager\Wrapper;
6 19
7 20 use Exception;
8 -use JetBrains\PhpStorm\NoReturn;
9 21
22 +/**
23 + * Class Php
24 + *
25 + * @package UserAccessManager\Wrapper
26 + */
10 27 class Php
11 28 {
12 29 /**
30 + * @param string $functionName
31 + * @return bool
13 32 * @see function_exists()
14 33 */
15 34 public function functionExists(string $functionName): bool
16 35 {
@@ -17,19 +36,26 @@
17 36 return function_exists($functionName);
18 37 }
19 38
20 39 /**
40 + * @param int $startIndex
41 + * @param int $numberOfElements
42 + * @param mixed $value
43 + * @return array
21 44 * @see array_fill()
22 45 */
23 - public function arrayFill(int $startIndex, int $numberOfElements, mixed $value): array
46 + public function arrayFill(int $startIndex, int $numberOfElements, $value): array
24 47 {
25 48 return array_fill($startIndex, $numberOfElements, $value);
26 49 }
27 50
28 51 /**
52 + * @param int $length
53 + * @param null|bool $strong
54 + * @return false|string
29 55 * @see openssl_random_pseudo_bytes()
30 56 */
31 - public function opensslRandomPseudoBytes(int $length, ?bool &$strong = false): bool|string
57 + public function opensslRandomPseudoBytes(int $length, ?bool &$strong = false)
32 58 {
33 59 return openssl_random_pseudo_bytes($length, $strong);
34 60 }
35 61
@@ -44,24 +70,20 @@
44 70 return ($context !== null) ? unlink($filename, $context) : unlink($filename);
45 71 }
46 72
47 73 /**
74 + * @param string $variableName
75 + * @return int|string
48 76 * @see ini_get()
49 77 */
50 - public function iniGet(string $variableName): int|string|false
78 + public function iniGet(string $variableName)
51 79 {
52 80 return ini_get($variableName);
53 81 }
54 82
55 83 /**
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 - /**
84 + * @param int $seconds
85 + * @return bool
64 86 * @see set_time_limit()
65 87 */
66 88 public function setTimeLimit(int $seconds): bool
67 89 {
@@ -68,24 +90,30 @@
68 90 return @set_time_limit($seconds);
69 91 }
70 92
71 93 /**
94 + * @param resource $handle
95 + * @param int $length
96 + * @return bool|string
72 97 * @see fread()
73 98 */
74 - public function fread($handle, int $length): false|string
99 + public function fread($handle, int $length)
75 100 {
76 101 return fread($handle, $length);
77 102 }
78 103
79 104 /**
105 + * @param mixed $controller
106 + * @param string $file
80 107 * @throws Exception
81 108 */
82 - public function includeFile($controller, string $file): void
109 + public function includeFile($controller, string $file)
83 110 {
84 111 if ($controller === null) {
85 112 throw new Exception('Controller is required');
86 113 }
87 114
115 + /** @noinspection PhpIncludeInspection */
88 116 include $file;
89 117 }
90 118
91 119 /**
@@ -90,81 +118,62 @@
90 118
91 119 /**
92 120 * @see exit()
93 121 */
94 - #[NoReturn]
95 - public function callExit(): void
122 + public function callExit()
96 123 {
97 124 exit;
98 125 }
99 126
100 127 /**
128 + * @param string $filename
129 + * @param mixed $data
130 + * @param int $flags
131 + * @param null $context
132 + * @return bool|int
101 133 * @see file_put_contents()
102 134 */
103 - public function filePutContents(string $filename, mixed $data, int $flags = 0, $context = null): false|int
135 + public function filePutContents(string $filename, $data, $flags = 0, $context = null)
104 136 {
105 137 return file_put_contents($filename, $data, $flags, $context);
106 138 }
107 139
108 140 /**
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 + * @param mixed $value
142 + * @return string
141 143 * @see igbinary_serialize()
142 144 */
143 - public function igbinarySerialize(mixed $value): ?string
145 + public function igbinarySerialize($value): string
144 146 {
145 147 return igbinary_serialize($value);
146 148 }
147 149
148 150 /**
151 + * @param string $key
152 + * @return mixed
149 153 * @see igbinary_unserialize()
150 154 */
151 - public function igbinaryUnserialize(string $key): mixed
155 + public function igbinaryUnserialize(string $key)
152 156 {
153 157 return igbinary_unserialize($key);
154 158 }
155 159
156 160 /**
161 + * @param string $pathname
162 + * @param int $mode
163 + * @param bool $recursive
164 + * @param null $context
165 + * @return bool
157 166 * @see mkdir()
158 167 */
159 - public function mkdir(string $pathname, int $mode = 0777, bool $recursive = false, $context = null): bool
168 + public function mkdir(string $pathname, $mode = 0777, $recursive = false, $context = null): bool
160 169 {
161 - return ($context !== null)
162 - ? mkdir($pathname, $mode, $recursive, $context)
163 - : mkdir($pathname, $mode, $recursive);
170 + return ($context !== null) ?
171 + mkdir($pathname, $mode, $recursive, $context) : mkdir($pathname, $mode, $recursive);
164 172 }
165 173
166 174 /**
175 + * @return int
167 176 * @see connection_status()
168 177 */
169 178 public function connectionStatus(): int
170 179 {
@@ -171,59 +180,13 @@
171 180 return connection_status();
172 181 }
173 182
174 183 /**
184 + * @param resource $handle
185 + * @return bool
175 186 * @see fclose()
176 187 */
177 188 public function fClose($handle): bool
178 189 {
179 190 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_open()
200 - */
201 - public function fInfoOpen(int $flags)
202 - {
203 - return finfo_open($flags);
204 - }
205 -
206 - /**
207 - * @see finfo_file()
208 - */
209 - public function fInfoFile($fileInfo, string $file)
210 - {
211 - return finfo_file($fileInfo, $file);
212 - }
213 -
214 - /**
215 - * @see finfo_close()
216 - */
217 - public function fInfoClose($fileInfo): bool
218 - {
219 - return finfo_close($fileInfo);
220 - }
221 -
222 - /**
223 - * @see mime_content_type()
224 - */
225 - public function mimeContentType(string $file)
226 - {
227 - return mime_content_type($file);
228 191 }
229 192 }