| @@ 77-92 (lines=16) @@ | ||
| 74 | /** |
|
| 75 | * Check whether a document exists. |
|
| 76 | */ |
|
| 77 | public function hasDocument(string $id): bool |
|
| 78 | { |
|
| 79 | if (isset($this->documents[$id])) { |
|
| 80 | return true; |
|
| 81 | } |
|
| 82 | ||
| 83 | $path = $this->getDocumentPath($id); |
|
| 84 | ||
| 85 | if ($this->filesystem->has($path)) { |
|
| 86 | $info = $this->filesystem->getMetadata($path); |
|
| 87 | ||
| 88 | return $info['type'] === 'file'; |
|
| 89 | } |
|
| 90 | ||
| 91 | return false; |
|
| 92 | } |
|
| 93 | ||
| 94 | /** |
|
| 95 | * Check whether a document or directory exists. |
|
| @@ 97-112 (lines=16) @@ | ||
| 94 | /** |
|
| 95 | * Check whether a document or directory exists. |
|
| 96 | */ |
|
| 97 | public function hasDirectory(string $id): bool |
|
| 98 | { |
|
| 99 | if (isset($this->directories[$id])) { |
|
| 100 | return true; |
|
| 101 | } |
|
| 102 | ||
| 103 | $path = $this->getDirectoryPath($id); |
|
| 104 | ||
| 105 | if ($this->filesystem->has($path)) { |
|
| 106 | $info = $this->filesystem->getMetadata($path); |
|
| 107 | ||
| 108 | return $info['type'] === 'dir'; |
|
| 109 | } |
|
| 110 | ||
| 111 | return false; |
|
| 112 | } |
|
| 113 | ||
| 114 | /** |
|
| 115 | * Saves a document. |
|