PluginProbe
User Access Manager / 2.3.15
User Access Manager v2.3.15
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
user-access-manager / src / Wrapper / Php.php

Php.php in User Access Manager 2.3.15, at src/Wrapper/Php.php

198 lines 4.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 declare(strict_types=1);
4
5 namespace UserAccessManager\Wrapper;
6
7 use Exception;
8 use JetBrains\PhpStorm\NoReturn;
9
10 class Php
11 {
12 /**
13 * @see function_exists()
14 */
15 public function functionExists(string $functionName): bool
16 {
17 return function_exists($functionName);
18 }
19
20 /**
21 * @see array_fill()
22 */
23 public function arrayFill(int $startIndex, int $numberOfElements, mixed $value): array
24 {
25 return array_fill($startIndex, $numberOfElements, $value);
26 }
27
28 /**
29 * @see openssl_random_pseudo_bytes()
30 */
31 public function opensslRandomPseudoBytes(int $length, ?bool &$strong = false): bool|string
32 {
33 return openssl_random_pseudo_bytes($length, $strong);
34 }
35
36 /**
37 * @param string $filename
38 * @param null $context
39 * @return bool
40 * @see unlink()
41 */
42 public function unlink(string $filename, $context = null): bool
43 {
44 return ($context !== null) ? unlink($filename, $context) : unlink($filename);
45 }
46
47 /**
48 * @see ini_get()
49 */
50 public function iniGet(string $variableName): int|string|false
51 {
52 return ini_get($variableName);
53 }
54
55 /**
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 * @see set_time_limit()
65 */
66 public function setTimeLimit(int $seconds): bool
67 {
68 return @set_time_limit($seconds);
69 }
70
71 /**
72 * @see fread()
73 */
74 public function fread($handle, int $length): false|string
75 {
76 return fread($handle, $length);
77 }
78
79 /**
80 * @throws Exception
81 */
82 public function includeFile($controller, string $file): void
83 {
84 if ($controller === null) {
85 throw new Exception('Controller is required');
86 }
87
88 include $file;
89 }
90
91 /**
92 * @see exit()
93 */
94 #[NoReturn]
95 public function callExit(): void
96 {
97 exit;
98 }
99
100 /**
101 * @see file_put_contents()
102 */
103 public function filePutContents(string $filename, mixed $data, int $flags = 0, $context = null): false|int
104 {
105 return file_put_contents($filename, $data, $flags, $context);
106 }
107
108 /**
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 igbinary_serialize()
134 */
135 public function igbinarySerialize(mixed $value): ?string
136 {
137 return igbinary_serialize($value);
138 }
139
140 /**
141 * @see igbinary_unserialize()
142 */
143 public function igbinaryUnserialize(string $key): mixed
144 {
145 return igbinary_unserialize($key);
146 }
147
148 /**
149 * @see mkdir()
150 */
151 public function mkdir(string $pathname, int $mode = 0777, bool $recursive = false, $context = null): bool
152 {
153 return ($context !== null)
154 ? mkdir($pathname, $mode, $recursive, $context)
155 : mkdir($pathname, $mode, $recursive);
156 }
157
158 /**
159 * @see connection_status()
160 */
161 public function connectionStatus(): int
162 {
163 return connection_status();
164 }
165
166 /**
167 * @see fclose()
168 */
169 public function fClose($handle): bool
170 {
171 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 }
197 }
198