123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- <?php
- declare(strict_types=1);
- namespace OC\OCM\Model;
- use OCP\OCM\IOCMResource;
- class OCMResource implements IOCMResource {
- private string $name = '';
-
- private array $shareTypes = [];
-
- private array $protocols = [];
-
- public function setName(string $name): static {
- $this->name = $name;
- return $this;
- }
-
- public function getName(): string {
- return $this->name;
- }
-
- public function setShareTypes(array $shareTypes): static {
- $this->shareTypes = $shareTypes;
- return $this;
- }
-
- public function getShareTypes(): array {
- return $this->shareTypes;
- }
-
- public function setProtocols(array $protocols): static {
- $this->protocols = $protocols;
- return $this;
- }
-
- public function getProtocols(): array {
- return $this->protocols;
- }
-
- public function import(array $data): static {
- return $this->setName((string)($data['name'] ?? ''))
- ->setShareTypes($data['shareTypes'] ?? [])
- ->setProtocols($data['protocols'] ?? []);
- }
-
- public function jsonSerialize(): array {
- return [
- 'name' => $this->getName(),
- 'shareTypes' => $this->getShareTypes(),
- 'protocols' => $this->getProtocols()
- ];
- }
- }
|