Files
server/shared/lib/Mail/Collection/CollectionMutableAbstract.php
Sebastian Krupinski f3c882454d
All checks were successful
Build Test / build (pull_request) Successful in 12s
JS Unit Tests / test (pull_request) Successful in 11s
PHP Unit Tests / test (pull_request) Successful in 39s
refactor: mail interfaces
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
2026-05-14 22:54:51 -04:00

55 lines
1.6 KiB
PHP

<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace KTXF\Mail\Collection;
use KTXF\Resource\Identifier\CollectionIdentifier;
use KTXF\Resource\Provider\Node\NodeMutableAbstract;
use KTXF\Resource\Provider\Node\NodePropertiesMutableInterface;
/**
* Abstract Mail Collection Mutable Class
*
* Provides common implementation for mutable mail collections
*
* @since 2025.05.01
*/
abstract class CollectionMutableAbstract extends NodeMutableAbstract implements CollectionMutableInterface {
protected CollectionPropertiesMutableAbstract $properties;
protected function nodeIdentifier(): CollectionIdentifier {
return new CollectionIdentifier($this->data[static::PROPERTY_PROVIDER], $this->data[static::PROPERTY_SERVICE], $this->data[static::PROPERTY_IDENTIFIER]);
}
/**
* @inheritDoc
*/
public function getProperties(): CollectionPropertiesMutableInterface {
return $this->properties;
}
/**
* @inheritDoc
*/
public function setProperties(NodePropertiesMutableInterface $value): static {
if (!$value instanceof CollectionPropertiesMutableInterface) {
throw new \InvalidArgumentException('Properties must implement CollectionPropertiesMutableInterface');
}
// Copy all property values
$this->properties->setLabel($value->getLabel());
$this->properties->setRole($value->getRole());
$this->properties->setRank($value->getRank());
$this->properties->setSubscription($value->getSubscription());
return $this;
}
}