| @@ 46-63 (lines=18) @@ | ||
| 43 | /** |
|
| 44 | * {@inheritDoc} |
|
| 45 | */ |
|
| 46 | public function mount( |
|
| 47 | /*# string */ $mountPoint, |
|
| 48 | FilesystemInterface $filesystem |
|
| 49 | )/*# : bool */ { |
|
| 50 | // normalize mount point |
|
| 51 | $mp = $this->cleanMountPoint($mountPoint); |
|
| 52 | ||
| 53 | // mounted already |
|
| 54 | if (isset($this->filesystems[$mp])) { |
|
| 55 | throw new LogicException( |
|
| 56 | Message::get(Message::STR_MOUNT_EXISTS, $mountPoint), |
|
| 57 | Message::STR_MOUNT_EXISTS |
|
| 58 | ); |
|
| 59 | } |
|
| 60 | ||
| 61 | $this->filesystems[$mp] = $filesystem; |
|
| 62 | return true; |
|
| 63 | } |
|
| 64 | ||
| 65 | /** |
|
| 66 | * {@inheritDoc} |
|
| @@ 68-85 (lines=18) @@ | ||
| 65 | /** |
|
| 66 | * {@inheritDoc} |
|
| 67 | */ |
|
| 68 | public function umount(/*# string */ $mountPoint)/*# : bool */ |
|
| 69 | { |
|
| 70 | // normalize mount point |
|
| 71 | $mp = $this->cleanMountPoint($mountPoint); |
|
| 72 | ||
| 73 | // not mounted |
|
| 74 | if (!isset($this->filesystems[$mp])) { |
|
| 75 | throw new LogicException( |
|
| 76 | Message::get(Message::STR_MOUNT_NOT_EXISTS, $mountPoint), |
|
| 77 | Message::STR_MOUNT_NOT_EXISTS |
|
| 78 | ); |
|
| 79 | } |
|
| 80 | ||
| 81 | // umount now |
|
| 82 | unset($this->filesystems[$mp]); |
|
| 83 | ||
| 84 | return true; |
|
| 85 | } |
|
| 86 | ||
| 87 | /** |
|
| 88 | * Clean path to standard mount point |
|