| Total Complexity | 44 |
| Total Lines | 380 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 1 | Features | 1 |
Complex classes like FilesystemDefaultImplementationTrait often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use FilesystemDefaultImplementationTrait, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 37 | trait FilesystemDefaultImplementationTrait |
||
| 38 | { |
||
| 39 | use MountableFilesystemTrait; |
||
| 40 | use FilesystemFlagsImplementationTrait; |
||
| 41 | |||
| 42 | /** |
||
| 43 | * int (*getattr) (const char *, struct stat *); |
||
| 44 | */ |
||
| 45 | public function getattr(string $path, Stat $stat): int |
||
| 46 | { |
||
| 47 | return -Errno::ENOSYS; |
||
| 48 | } |
||
| 49 | |||
| 50 | /** |
||
| 51 | * int (*readlink) (const char *, char *, size_t); |
||
| 52 | */ |
||
| 53 | public function readlink(string $path, CStringBuffer $buffer, int $size): int |
||
| 54 | { |
||
| 55 | return -Errno::ENOSYS; |
||
| 56 | } |
||
| 57 | |||
| 58 | /** |
||
| 59 | * int (*getdir) (const char *, fuse_dirh_t, fuse_dirfil_t); |
||
| 60 | * |
||
| 61 | * @deprecated |
||
| 62 | */ |
||
| 63 | public function getdir(string $path, FuseDirHandle $dirhandle, FuseDirFill $dirfill): int |
||
| 64 | { |
||
| 65 | return -Errno::ENOSYS; |
||
| 66 | } |
||
| 67 | |||
| 68 | /** |
||
| 69 | * int (*mknod) (const char *, mode_t, dev_t); |
||
| 70 | */ |
||
| 71 | public function mknod(string $path, int $mode, int $dev): int |
||
| 72 | { |
||
| 73 | return -Errno::ENOSYS; |
||
| 74 | } |
||
| 75 | |||
| 76 | /** |
||
| 77 | * int (*mkdir) (const char *, mode_t); |
||
| 78 | */ |
||
| 79 | public function mkdir(string $path, int $mode): int |
||
| 80 | { |
||
| 81 | return -Errno::ENOSYS; |
||
| 82 | } |
||
| 83 | |||
| 84 | /** |
||
| 85 | * int (*unlink) (const char *); |
||
| 86 | */ |
||
| 87 | public function unlink(string $path): int |
||
| 88 | { |
||
| 89 | return -Errno::ENOSYS; |
||
| 90 | } |
||
| 91 | |||
| 92 | /** |
||
| 93 | * int (*rmdir) (const char *); |
||
| 94 | */ |
||
| 95 | public function rmdir(string $path): int |
||
| 96 | { |
||
| 97 | return -Errno::ENOSYS; |
||
| 98 | } |
||
| 99 | |||
| 100 | /** |
||
| 101 | * int (*symlink) (const char *, const char *); |
||
| 102 | */ |
||
| 103 | public function symlink(string $path, string $link): int |
||
| 104 | { |
||
| 105 | return -Errno::ENOSYS; |
||
| 106 | } |
||
| 107 | |||
| 108 | /** |
||
| 109 | * int (*rename) (const char *, const char *); |
||
| 110 | */ |
||
| 111 | public function rename(string $from, string $to): int |
||
| 112 | { |
||
| 113 | return -Errno::ENOSYS; |
||
| 114 | } |
||
| 115 | |||
| 116 | /** |
||
| 117 | * int (*link) (const char *, const char *); |
||
| 118 | */ |
||
| 119 | public function link(string $path, string $link): int |
||
| 120 | { |
||
| 121 | return -Errno::ENOSYS; |
||
| 122 | } |
||
| 123 | |||
| 124 | /** |
||
| 125 | * int (*chmod) (const char *, mode_t); |
||
| 126 | */ |
||
| 127 | public function chmod(string $path, int $mode): int |
||
| 128 | { |
||
| 129 | return -Errno::ENOSYS; |
||
| 130 | } |
||
| 131 | |||
| 132 | /** |
||
| 133 | * int (*chown) (const char *, uid_t, gid_t); |
||
| 134 | */ |
||
| 135 | public function chown(string $path, int $uid, int $gid): int |
||
| 136 | { |
||
| 137 | return -Errno::ENOSYS; |
||
| 138 | } |
||
| 139 | |||
| 140 | /** |
||
| 141 | * int (*truncate) (const char *, off_t); |
||
| 142 | */ |
||
| 143 | public function truncate(string $path, int $offset): int |
||
| 144 | { |
||
| 145 | return -Errno::ENOSYS; |
||
| 146 | } |
||
| 147 | |||
| 148 | /** |
||
| 149 | * int (*utime) (const char *, struct utimbuf *); |
||
| 150 | */ |
||
| 151 | public function utime(string $path, UtimBuf $utime_buf): int |
||
| 152 | { |
||
| 153 | return -Errno::ENOSYS; |
||
| 154 | } |
||
| 155 | |||
| 156 | /** |
||
| 157 | * int (*open) (const char *, struct fuse_file_info *); |
||
| 158 | */ |
||
| 159 | public function open(string $path, FuseFileInfo $fuse_file_info): int |
||
| 160 | { |
||
| 161 | return 0; |
||
| 162 | } |
||
| 163 | |||
| 164 | /** |
||
| 165 | * int (*read) (const char *, char *, size_t, off_t, struct fuse_file_info *); |
||
| 166 | */ |
||
| 167 | public function read(string $path, CBytesBuffer $buffer, int $size, int $offset, FuseFileInfo $fuse_file_info): int |
||
| 168 | { |
||
| 169 | return -Errno::ENOSYS; |
||
| 170 | } |
||
| 171 | |||
| 172 | /** |
||
| 173 | * int (*write) (const char *, const char *, size_t, off_t, struct fuse_file_info *); |
||
| 174 | */ |
||
| 175 | public function write(string $path, string $buffer, int $size, int $offset, FuseFileInfo $fuse_file_info): int |
||
| 176 | { |
||
| 177 | return -Errno::ENOSYS; |
||
| 178 | } |
||
| 179 | |||
| 180 | /** |
||
| 181 | * int (*statfs) (const char *, struct statvfs *); |
||
| 182 | */ |
||
| 183 | public function statfs(string $path, StatVfs $statvfs): int |
||
| 184 | { |
||
| 185 | return -Errno::ENOSYS; |
||
| 186 | } |
||
| 187 | |||
| 188 | /** |
||
| 189 | * int (*flush) (const char *, struct fuse_file_info *); |
||
| 190 | */ |
||
| 191 | public function flush(string $path, FuseFileInfo $fuse_file_info): int |
||
| 192 | { |
||
| 193 | return -Errno::ENOSYS; |
||
| 194 | } |
||
| 195 | |||
| 196 | /** |
||
| 197 | * int (*release) (const char *, struct fuse_file_info *); |
||
| 198 | */ |
||
| 199 | public function release(string $path, FuseFileInfo $fuse_file_info): int |
||
| 200 | { |
||
| 201 | return -Errno::ENOSYS; |
||
| 202 | } |
||
| 203 | |||
| 204 | /** |
||
| 205 | * int (*fsync) (const char *, int, struct fuse_file_info *); |
||
| 206 | */ |
||
| 207 | public function fsync(string $path, int $flags, FuseFileInfo $fuse_file_info): int |
||
| 208 | { |
||
| 209 | return -Errno::ENOSYS; |
||
| 210 | } |
||
| 211 | |||
| 212 | /** |
||
| 213 | * int (*setxattr) (const char *, const char *, const char *, size_t, int); |
||
| 214 | */ |
||
| 215 | public function setxattr(string $path, string $name, string $value, int $size): int |
||
| 216 | { |
||
| 217 | return -Errno::ENOSYS; |
||
| 218 | } |
||
| 219 | |||
| 220 | /** |
||
| 221 | * int (*getxattr) (const char *, const char *, char *, size_t); |
||
| 222 | */ |
||
| 223 | public function getxattr(string $path, string $name, ?string &$value, int $size): int |
||
| 224 | { |
||
| 225 | return -Errno::ENOSYS; |
||
| 226 | } |
||
| 227 | |||
| 228 | /** |
||
| 229 | * int (*listxattr) (const char *, char *, size_t);* |
||
| 230 | */ |
||
| 231 | public function listxattr(string $path, ?string &$value, int $size): int |
||
| 232 | { |
||
| 233 | return -Errno::ENOSYS; |
||
| 234 | } |
||
| 235 | |||
| 236 | /** |
||
| 237 | * int (*removexattr) (const char *, const char *); |
||
| 238 | */ |
||
| 239 | public function removexattr(string $path, string $name): int |
||
| 240 | { |
||
| 241 | return -Errno::ENOSYS; |
||
| 242 | } |
||
| 243 | |||
| 244 | /** |
||
| 245 | * int (*opendir) (const char *, struct fuse_file_info *); |
||
| 246 | */ |
||
| 247 | public function opendir(string $path, FuseFileInfo $fuse_file_info): int |
||
| 248 | { |
||
| 249 | return 0; |
||
| 250 | } |
||
| 251 | |||
| 252 | /** |
||
| 253 | * int (*readdir) (const char *, void *, fuse_fill_dir_t, off_t, struct fuse_file_info *); |
||
| 254 | */ |
||
| 255 | public function readdir( |
||
| 256 | string $path, |
||
| 257 | FuseReadDirBuffer $buf, |
||
| 258 | FuseFillDir $filler, |
||
| 259 | int $offset, |
||
| 260 | FuseFileInfo $fuse_file_info |
||
| 261 | ): int { |
||
| 262 | return -Errno::ENOSYS; |
||
| 263 | } |
||
| 264 | |||
| 265 | /** |
||
| 266 | * int (*releasedir) (const char *, struct fuse_file_info *); |
||
| 267 | */ |
||
| 268 | public function releasedir(string $path, FuseFileInfo $fuse_file_info): int |
||
| 269 | { |
||
| 270 | return -Errno::ENOSYS; |
||
| 271 | } |
||
| 272 | |||
| 273 | /** |
||
| 274 | * int (*fsyncdir) (const char *, int, struct fuse_file_info *); |
||
| 275 | */ |
||
| 276 | public function fsyncdir(string $path, FuseFileInfo $fuse_file_info): int |
||
| 277 | { |
||
| 278 | return -Errno::ENOSYS; |
||
| 279 | } |
||
| 280 | |||
| 281 | /** |
||
| 282 | * void *(*init) (struct fuse_conn_info *conn); |
||
| 283 | */ |
||
| 284 | public function init(FuseConnInfo $conn): ?FusePrivateData |
||
| 285 | { |
||
| 286 | return null; |
||
| 287 | } |
||
| 288 | |||
| 289 | /** |
||
| 290 | * void (*destroy) (void *); |
||
| 291 | */ |
||
| 292 | public function destroy(?FusePrivateData $private_data): void |
||
| 293 | { |
||
| 294 | } |
||
| 295 | |||
| 296 | /** |
||
| 297 | * int (*access) (const char *, int); |
||
| 298 | */ |
||
| 299 | public function access(string $path, int $mode): int |
||
| 300 | { |
||
| 301 | return -Errno::ENOSYS; |
||
| 302 | } |
||
| 303 | |||
| 304 | /** |
||
| 305 | * int (*create) (const char *, mode_t, struct fuse_file_info *); |
||
| 306 | */ |
||
| 307 | public function create(string $path, int $mode, FuseFileInfo $fuse_file_info): int |
||
| 308 | { |
||
| 309 | return -Errno::ENOSYS; |
||
| 310 | } |
||
| 311 | |||
| 312 | /** |
||
| 313 | * int (*ftruncate) (const char *, off_t, struct fuse_file_info *); |
||
| 314 | */ |
||
| 315 | public function ftruncate(string $path, int $offset, FuseFileInfo $fuse_file_info): int |
||
| 316 | { |
||
| 317 | return -Errno::ENOSYS; |
||
| 318 | } |
||
| 319 | |||
| 320 | /** |
||
| 321 | * int (*fgetattr) (const char *, struct stat *, struct fuse_file_info *); |
||
| 322 | */ |
||
| 323 | public function fgetattr(string $path, Stat $stat, FuseFileInfo $fuse_file_info): int |
||
| 324 | { |
||
| 325 | return -Errno::ENOSYS; |
||
| 326 | } |
||
| 327 | |||
| 328 | /** |
||
| 329 | * int (*lock) (const char *, struct fuse_file_info *, int cmd, struct flock *); |
||
| 330 | */ |
||
| 331 | public function lock(string $path, FuseFileInfo $fuse_file_info, int $cmd, Flock $flock): int |
||
| 332 | { |
||
| 333 | return -Errno::ENOSYS; |
||
| 334 | } |
||
| 335 | |||
| 336 | /** |
||
| 337 | * int (*utimens) (const char *, const struct timespec tv[2]); |
||
| 338 | * |
||
| 339 | * @param TypedCDataArray<TimeSpec> $tv |
||
| 340 | */ |
||
| 341 | public function utimens(string $path, TypedCDataArray $tv): int |
||
| 342 | { |
||
| 343 | return -Errno::ENOSYS; |
||
| 344 | } |
||
| 345 | |||
| 346 | /** |
||
| 347 | * int (*bmap) (const char *, size_t blocksize, uint64_t *idx); |
||
| 348 | */ |
||
| 349 | public function bmap(string $path, int $blocksize, int &$idx): int |
||
| 350 | { |
||
| 351 | return -Errno::ENOSYS; |
||
| 352 | } |
||
| 353 | |||
| 354 | /** |
||
| 355 | * int (*ioctl) (const char *, int cmd, void *arg, struct fuse_file_info *, unsigned int flags, void *data); |
||
| 356 | */ |
||
| 357 | public function ioctl( |
||
| 358 | string $path, |
||
| 359 | int $cmd, |
||
| 360 | FuseIoctlArgPointer $arg, |
||
| 361 | FuseFileInfo $fuse_file_info, |
||
| 362 | int $flags, |
||
| 363 | FuseIoctlDataPointer $data |
||
| 364 | ): int { |
||
| 365 | return -Errno::ENOSYS; |
||
| 366 | } |
||
| 367 | |||
| 368 | /** |
||
| 369 | * int (*poll) (const char *, struct fuse_file_info *, struct fuse_pollhandle *ph, unsigned *reventsp); |
||
| 370 | */ |
||
| 371 | public function poll( |
||
| 372 | string $path, |
||
| 373 | FuseFileInfo $fuse_file_info, |
||
| 374 | FusePollHandle $fuse_pollhandle, |
||
| 375 | int &$reventsp |
||
| 376 | ): int { |
||
| 377 | return -Errno::ENOSYS; |
||
| 378 | } |
||
| 379 | |||
| 380 | /** |
||
| 381 | * int (*write_buf) (const char *, struct fuse_bufvec *buf, off_t off, struct fuse_file_info *); |
||
| 382 | */ |
||
| 383 | public function writeBuf(string $path, FuseBufVec $buf, int $offset, FuseFileInfo $fuse_file_info): int |
||
| 386 | } |
||
| 387 | |||
| 388 | /** |
||
| 389 | * int (*read_buf) (const char *, struct fuse_bufvec **bufp, size_t size, off_t off, struct fuse_file_info *); |
||
| 390 | * |
||
| 391 | * @param TypedCDataArray<FuseBufVec> $bufp |
||
| 392 | */ |
||
| 393 | public function readBuf( |
||
| 401 | } |
||
| 402 | |||
| 403 | /** |
||
| 404 | * int (*flock) (const char *, struct fuse_file_info *, int op); |
||
| 405 | */ |
||
| 406 | public function flock(string $path, FuseFileInfo $fuse_file_info, int $op): int |
||
| 409 | } |
||
| 410 | |||
| 411 | /** |
||
| 412 | * int (*fallocate) (const char *, int, off_t, off_t, struct fuse_file_info *); |
||
| 413 | */ |
||
| 414 | public function fallocate(string $path, int $mode, int $offset, FuseFileInfo $fuse_file_info): int |
||
| 415 | { |
||
| 416 | return -Errno::ENOSYS; |
||
| 417 | } |
||
| 418 | } |
||
| 419 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths