Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 6 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| PathSymlinkDetails | |
0.00% |
0 / 6 |
|
0.00% |
0 / 2 |
6 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
2 | |||
| isSymlink | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * POJO with some convenience functions. |
| 4 | */ |
| 5 | namespace BrianHenryIE\Strauss\Helpers\Flysystem; |
| 6 | |
| 7 | /** |
| 8 | * @phpstan-type PathSymlinkDetailsArray array{path:string,absoluteFilesystemPath:string,realpath:string,symlinkPath:string} |
| 9 | */ |
| 10 | class PathSymlinkDetails |
| 11 | { |
| 12 | /** |
| 13 | * The path that was queried. |
| 14 | */ |
| 15 | public string $flysystemPath; |
| 16 | |
| 17 | /** |
| 18 | * The path-prefixed absolute path on the filesystem. |
| 19 | */ |
| 20 | public string $absoluteFilesystemPath; |
| 21 | |
| 22 | /** |
| 23 | * The `realpath()` for the queried path. |
| 24 | */ |
| 25 | public string $targetAbsoluteFilesystemPath; |
| 26 | |
| 27 | /** |
| 28 | * The symlink, potentially a parent directory, which is the root of the virtual file/directory. |
| 29 | */ |
| 30 | public string $symlinkAbsoluteFilesystemPath; |
| 31 | |
| 32 | /** |
| 33 | * The symlink's target. |
| 34 | */ |
| 35 | public string $symlinkTargetRealpathAbsoluteFilesystemPath; |
| 36 | |
| 37 | public function __construct( |
| 38 | string $flysystemPath, |
| 39 | string $absoluteFilesystemPath, |
| 40 | string $targetAbsoluteFilesystemPath, |
| 41 | string $symlinkAbsoluteFilesystemPath, |
| 42 | string $symlinkTargetRealpathAbsoluteFilesystemPath |
| 43 | ) { |
| 44 | $this->flysystemPath = $flysystemPath; |
| 45 | $this->absoluteFilesystemPath = $absoluteFilesystemPath; |
| 46 | $this->targetAbsoluteFilesystemPath = $targetAbsoluteFilesystemPath; |
| 47 | $this->symlinkAbsoluteFilesystemPath = $symlinkAbsoluteFilesystemPath; |
| 48 | $this->symlinkTargetRealpathAbsoluteFilesystemPath = $symlinkTargetRealpathAbsoluteFilesystemPath; |
| 49 | } |
| 50 | |
| 51 | /** |
| 52 | * Is the path itself a symlink (conversely it would be inside a symlink) |
| 53 | */ |
| 54 | public function isSymlink(): bool |
| 55 | { |
| 56 | return $this->absoluteFilesystemPath === $this->symlinkAbsoluteFilesystemPath; |
| 57 | } |
| 58 | } |