| @@ 32-43 (lines=12) @@ | ||
| 29 | use Sabre\DAV\ICollection; |
|
| 30 | ||
| 31 | abstract class AbstractTrashFolder extends AbstractTrash implements ICollection, ITrash { |
|
| 32 | public function getChildren(): array { |
|
| 33 | $entries = $this->trashManager->listTrashFolder($this->data); |
|
| 34 | ||
| 35 | $children = array_map(function (ITrashItem $entry) { |
|
| 36 | if ($entry->getType() === FileInfo::TYPE_FOLDER) { |
|
| 37 | return new TrashFolderFolder($this->trashManager, $entry); |
|
| 38 | } |
|
| 39 | return new TrashFolderFile($this->trashManager, $entry); |
|
| 40 | }, $entries); |
|
| 41 | ||
| 42 | return $children; |
|
| 43 | } |
|
| 44 | ||
| 45 | public function getChild($name): ITrash { |
|
| 46 | $entries = $this->getChildren(); |
|
| @@ 67-78 (lines=12) @@ | ||
| 64 | throw new Forbidden('Not allowed to create folders in the trashbin'); |
|
| 65 | } |
|
| 66 | ||
| 67 | public function getChildren(): array { |
|
| 68 | $entries = $this->trashManager->listTrashRoot($this->user); |
|
| 69 | ||
| 70 | $children = array_map(function (ITrashItem $entry) { |
|
| 71 | if ($entry->getType() === FileInfo::TYPE_FOLDER) { |
|
| 72 | return new TrashFolder($this->trashManager, $entry); |
|
| 73 | } |
|
| 74 | return new TrashFile($this->trashManager, $entry); |
|
| 75 | }, $entries); |
|
| 76 | ||
| 77 | return $children; |
|
| 78 | } |
|
| 79 | ||
| 80 | public function getChild($name): ITrash { |
|
| 81 | $entries = $this->getChildren(); |
|