refactor: improvemets
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
47
lib/Providers/Document/CollectionProperties.php
Normal file
47
lib/Providers/Document/CollectionProperties.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXM\ProviderJmapc\Providers\Document;
|
||||
|
||||
use KTXF\Resource\Documents\Collection\CollectionPropertiesMutableAbstract;
|
||||
|
||||
/**
|
||||
* Document Collection Properties Implementation
|
||||
*/
|
||||
class CollectionProperties extends CollectionPropertiesMutableAbstract {
|
||||
|
||||
/**
|
||||
* Convert JMAP parameters array to document collection properties object
|
||||
*
|
||||
* @param array $parameters JMAP parameters array
|
||||
*/
|
||||
public function fromJmap(array $parameters): static {
|
||||
|
||||
if (isset($parameters['name'])) {
|
||||
$this->data['label'] = $parameters['name'];
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert mail collection properties object to JMAP parameters array
|
||||
*/
|
||||
public function toJmap(): array {
|
||||
|
||||
$parameters = [];
|
||||
|
||||
if (isset($this->data['label'])) {
|
||||
$parameters['name'] = $this->data['label'];
|
||||
}
|
||||
|
||||
return $parameters;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user