@@ 99-114 (lines=16) @@ | ||
96 | * |
|
97 | * @return bool |
|
98 | */ |
|
99 | public function hasDocument($id) |
|
100 | { |
|
101 | if (isset($this->documents[$id])) { |
|
102 | return true; |
|
103 | } |
|
104 | ||
105 | $path = $this->getDocumentPath($id); |
|
106 | ||
107 | if ($this->filesystem->has($path)) { |
|
108 | $info = $this->filesystem->getMetadata($path); |
|
109 | ||
110 | return $info['type'] === 'file'; |
|
111 | } |
|
112 | ||
113 | return false; |
|
114 | } |
|
115 | ||
116 | /** |
|
117 | * Check whether a document or directory exists. |
|
@@ 123-138 (lines=16) @@ | ||
120 | * |
|
121 | * @return bool |
|
122 | */ |
|
123 | public function hasDirectory($id) |
|
124 | { |
|
125 | if (isset($this->directories[$id])) { |
|
126 | return true; |
|
127 | } |
|
128 | ||
129 | $path = $this->getDirectoryPath($id); |
|
130 | ||
131 | if ($this->filesystem->has($path)) { |
|
132 | $info = $this->filesystem->getMetadata($path); |
|
133 | ||
134 | return $info['type'] === 'dir'; |
|
135 | } |
|
136 | ||
137 | return false; |
|
138 | } |
|
139 | ||
140 | /** |
|
141 | * Saves a document. |