feat: entity move
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
40
shared/lib/Resource/Identifier/EntityIdentifier.php
Normal file
40
shared/lib/Resource/Identifier/EntityIdentifier.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\Resource\Identifier;
|
||||
|
||||
/**
|
||||
* Entity-level resource identifier (depth 4)
|
||||
*
|
||||
* Format: {provider}:{service}:{collection}:{entity}
|
||||
*/
|
||||
class EntityIdentifier extends CollectionIdentifier implements EntityIdentifierInterface {
|
||||
|
||||
public function __construct(
|
||||
string $provider,
|
||||
string $service,
|
||||
string $collection,
|
||||
private readonly string $_entity,
|
||||
) {
|
||||
parent::__construct($provider, $service, $collection);
|
||||
}
|
||||
|
||||
public function entity(): string {
|
||||
return $this->_entity;
|
||||
}
|
||||
|
||||
public function depth(): int {
|
||||
return 4;
|
||||
}
|
||||
|
||||
public function __toString(): string {
|
||||
return parent::__toString() . self::SEPARATOR . $this->_entity;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user