PluginProbe
User Access Manager / 2.2.2
User Access Manager v2.2.2
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 +68 -71 2.3.152.2.2 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,73 +118,64 @@
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 - /**
141 + * @param mixed $value
142 + * @return string
133 143 * @see igbinary_serialize()
134 144 */
135 - public function igbinarySerialize(mixed $value): ?string
145 + public function igbinarySerialize($value): string
136 146 {
147 + /** @noinspection PhpUndefinedFunctionInspection */
137 148 return igbinary_serialize($value);
138 149 }
139 150
140 151 /**
152 + * @param string $key
153 + * @return mixed
141 154 * @see igbinary_unserialize()
142 155 */
143 - public function igbinaryUnserialize(string $key): mixed
156 + public function igbinaryUnserialize(string $key)
144 157 {
158 + /** @noinspection PhpUndefinedFunctionInspection */
145 159 return igbinary_unserialize($key);
146 160 }
147 161
148 162 /**
163 + * @param string $pathname
164 + * @param int $mode
165 + * @param bool $recursive
166 + * @param null $context
167 + * @return bool
149 168 * @see mkdir()
150 169 */
151 - public function mkdir(string $pathname, int $mode = 0777, bool $recursive = false, $context = null): bool
170 + public function mkdir(string $pathname, $mode = 0777, $recursive = false, $context = null): bool
152 171 {
153 - return ($context !== null)
154 - ? mkdir($pathname, $mode, $recursive, $context)
155 - : mkdir($pathname, $mode, $recursive);
172 + return ($context !== null) ?
173 + mkdir($pathname, $mode, $recursive, $context) : mkdir($pathname, $mode, $recursive);
156 174 }
157 175
158 176 /**
177 + * @return int
159 178 * @see connection_status()
160 179 */
161 180 public function connectionStatus(): int
162 181 {
@@ -163,35 +182,13 @@
163 182 return connection_status();
164 183 }
165 184
166 185 /**
186 + * @param resource $handle
187 + * @return bool
167 188 * @see fclose()
168 189 */
169 190 public function fClose($handle): bool
170 191 {
171 192 return fclose($handle);
172 - }
173 -
174 - /**
175 - * @see fseek()
176 - */
177 - public function fseek($handle, int $offset, int $whence = SEEK_SET): int
178 - {
179 - return fseek($handle, $offset, $whence);
180 - }
181 -
182 - /**
183 - * @see flush()
184 - */
185 - public function flush(): void
186 - {
187 - flush();
188 - }
189 -
190 - /**
191 - * @see finfo_close()
192 - */
193 - public function fInfoClose($fileInfo): bool
194 - {
195 - return finfo_close($fileInfo);
196 193 }
197 194 }