1 | <?php |
||
17 | class PermissionInfo implements InfoPartInterface |
||
18 | { |
||
19 | /** |
||
20 | * @var int |
||
21 | */ |
||
22 | private $owner; |
||
23 | |||
24 | /** |
||
25 | * @var string |
||
26 | */ |
||
27 | private $ownerName; |
||
28 | |||
29 | /** |
||
30 | * @var int |
||
31 | */ |
||
32 | private $group; |
||
33 | |||
34 | /** |
||
35 | * @var string |
||
36 | */ |
||
37 | private $groupName; |
||
38 | |||
39 | /** |
||
40 | * @var int |
||
41 | */ |
||
42 | private $perms; |
||
43 | |||
44 | /** |
||
45 | * Constructor. |
||
46 | * |
||
47 | * @internal |
||
48 | * |
||
49 | * @param int $owner |
||
50 | * @param string $ownerName |
||
51 | * @param int $group |
||
52 | * @param string $groupName |
||
53 | * @param int $perms |
||
54 | */ |
||
55 | 16 | public function __construct($owner, $ownerName, $group, $groupName, $perms) |
|
63 | |||
64 | /** |
||
65 | * Returns the owner ID of the file. |
||
66 | * |
||
67 | * @return int |
||
68 | */ |
||
69 | 4 | public function getOwner() |
|
73 | |||
74 | /** |
||
75 | * Returns the owner name of the file. |
||
76 | * |
||
77 | * @return string |
||
78 | */ |
||
79 | 4 | public function getOwnerName() |
|
83 | |||
84 | /** |
||
85 | * Returns the group ID of the file. |
||
86 | * |
||
87 | * @return int |
||
88 | */ |
||
89 | 4 | public function getGroup() |
|
93 | |||
94 | /** |
||
95 | * Returns the group name of the file. |
||
96 | * |
||
97 | * @return string |
||
98 | */ |
||
99 | 4 | public function getGroupName() |
|
103 | |||
104 | /** |
||
105 | * Returns the permissions of the file. |
||
106 | * |
||
107 | * @return int |
||
108 | */ |
||
109 | 5 | public function getPerms() |
|
113 | |||
114 | /** |
||
115 | * Returns the formatted permissions of the file in octal format. |
||
116 | * |
||
117 | * @return string |
||
118 | */ |
||
119 | 1 | public function getPermsOctal() |
|
123 | |||
124 | /** |
||
125 | * Returns the formatted permissions of the file in rwx format (only permission bits). |
||
126 | * |
||
127 | * @return string |
||
128 | */ |
||
129 | 9 | public function getPermsFormatted() |
|
133 | |||
134 | /** |
||
135 | * Returns whether the file has the read bit set for the owner. |
||
136 | * |
||
137 | * @return bool |
||
138 | */ |
||
139 | 10 | public function isOwnerReadable() |
|
143 | |||
144 | /** |
||
145 | * Returns whether the file has the write bit set for the owner. |
||
146 | * |
||
147 | * @return bool |
||
148 | */ |
||
149 | 10 | public function isOwnerWritable() |
|
153 | |||
154 | /** |
||
155 | * Returns whether the file has the execute bit set for the owner. |
||
156 | * |
||
157 | * @return bool |
||
158 | */ |
||
159 | 10 | public function isOwnerExecutable() |
|
163 | |||
164 | /** |
||
165 | * Returns whether the file has the read bit set for the group. |
||
166 | * |
||
167 | * @return bool |
||
168 | */ |
||
169 | 10 | public function isGroupReadable() |
|
173 | |||
174 | /** |
||
175 | * Returns whether the file has the write bit set for the group. |
||
176 | * |
||
177 | * @return bool |
||
178 | */ |
||
179 | 10 | public function isGroupWritable() |
|
183 | |||
184 | /** |
||
185 | * Returns whether the file has the execute bit set for the group. |
||
186 | * |
||
187 | * @return bool |
||
188 | */ |
||
189 | 10 | public function isGroupExecutable() |
|
193 | |||
194 | /** |
||
195 | * Returns whether the file has the read bit set for others/world. |
||
196 | * |
||
197 | * @return bool |
||
198 | */ |
||
199 | 10 | public function isWorldReadable() |
|
203 | |||
204 | /** |
||
205 | * Returns whether the file has the write bit set for others/world. |
||
206 | * |
||
207 | * @return bool |
||
208 | */ |
||
209 | 10 | public function isWorldWritable() |
|
213 | |||
214 | /** |
||
215 | * Returns whether the file has the execute bit set for others/world. |
||
216 | * |
||
217 | * @return bool |
||
218 | */ |
||
219 | 10 | public function isWorldExecutable() |
|
223 | |||
224 | /** |
||
225 | * Matches an octal string against the file permissions. |
||
226 | * |
||
227 | * @param string $oct octal permission string |
||
228 | * |
||
229 | * @return bool |
||
230 | */ |
||
231 | 10 | private function matchPerms($oct) |
|
235 | |||
236 | /** |
||
237 | * Returns the formatted owner permissions of the file in rwx format. |
||
238 | * |
||
239 | * @return string |
||
240 | */ |
||
241 | 9 | private function formatOwnerPerms() |
|
250 | |||
251 | /** |
||
252 | * Returns the formatted group permissions of the file in rwx format. |
||
253 | * |
||
254 | * @return string |
||
255 | */ |
||
256 | 9 | private function formatGroupPerms() |
|
265 | |||
266 | /** |
||
267 | * Returns the formatted world permissions of the file in rwx format. |
||
268 | * |
||
269 | * @return string |
||
270 | */ |
||
271 | 9 | private function formatWorldPerms() |
|
280 | } |
||
281 |