refactor: object property names
Build Test / build (pull_request) Successful in 14s
JS Unit Tests / test (pull_request) Successful in 13s
PHP Unit Tests / test (pull_request) Successful in 35s

Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
2026-06-16 13:19:40 -04:00
parent 6dadd13acf
commit 388e3fb8b8
23 changed files with 88 additions and 88 deletions
@@ -26,7 +26,7 @@ abstract class CollectionPropertiesBaseAbstract extends NodePropertiesBaseAbstra
* @inheritDoc
*/
public function content(): CollectionContent {
$content = $this->data[self::JSON_PROPERTY_CONTENTS] ?? null;
$content = $this->data[self::PROPERTY_CONTENTS] ?? null;
if ($content instanceof CollectionContent) {
return $content;
}
@@ -42,35 +42,35 @@ abstract class CollectionPropertiesBaseAbstract extends NodePropertiesBaseAbstra
* @inheritDoc
*/
public function getLabel(): string {
return $this->data[self::JSON_PROPERTY_LABEL] ?? '';
return $this->data[self::PROPERTY_LABEL] ?? '';
}
/**
* @inheritDoc
*/
public function getDescription(): ?string {
return $this->data[self::JSON_PROPERTY_DESCRIPTION] ?? null;
return $this->data[self::PROPERTY_DESCRIPTION] ?? null;
}
/**
* @inheritDoc
*/
public function getPriority(): ?int {
return $this->data[self::JSON_PROPERTY_PRIORITY] ?? null;
return $this->data[self::PROPERTY_PRIORITY] ?? null;
}
/**
* @inheritDoc
*/
public function getVisibility(): ?bool {
return $this->data[self::JSON_PROPERTY_VISIBILITY] ?? null;
return $this->data[self::PROPERTY_VISIBILITY] ?? null;
}
/**
* @inheritDoc
*/
public function getColor(): ?string {
return $this->data[self::JSON_PROPERTY_COLOR] ?? null;
return $this->data[self::PROPERTY_COLOR] ?? null;
}
}
@@ -14,13 +14,13 @@ use KTXF\Resource\Provider\Node\NodePropertiesBaseInterface;
interface CollectionPropertiesBaseInterface extends NodePropertiesBaseInterface {
public const JSON_TYPE = 'chrono:collection';
public const JSON_PROPERTY_CONTENTS = 'content';
public const PROPERTY_CONTENTS = 'content';
public const JSON_PROPERTY_LABEL = 'label';
public const JSON_PROPERTY_DESCRIPTION = 'description';
public const JSON_PROPERTY_PRIORITY = 'priority';
public const JSON_PROPERTY_VISIBILITY = 'visibility';
public const JSON_PROPERTY_COLOR = 'color';
public const PROPERTY_LABEL = 'label';
public const PROPERTY_DESCRIPTION = 'description';
public const PROPERTY_PRIORITY = 'priority';
public const PROPERTY_VISIBILITY = 'visibility';
public const PROPERTY_COLOR = 'color';
public function content(): CollectionContent;
@@ -33,7 +33,7 @@ abstract class CollectionPropertiesMutableAbstract extends CollectionPropertiesB
* @inheritDoc
*/
public function setLabel(string $value): static {
$this->data[self::JSON_PROPERTY_LABEL] = $value;
$this->data[self::PROPERTY_LABEL] = $value;
return $this;
}
@@ -41,7 +41,7 @@ abstract class CollectionPropertiesMutableAbstract extends CollectionPropertiesB
* @inheritDoc
*/
public function setDescription(?string $value): static {
$this->data[self::JSON_PROPERTY_DESCRIPTION] = $value;
$this->data[self::PROPERTY_DESCRIPTION] = $value;
return $this;
}
@@ -49,7 +49,7 @@ abstract class CollectionPropertiesMutableAbstract extends CollectionPropertiesB
* @inheritDoc
*/
public function setPriority(?int $value): static {
$this->data[self::JSON_PROPERTY_PRIORITY] = $value;
$this->data[self::PROPERTY_PRIORITY] = $value;
return $this;
}
@@ -57,7 +57,7 @@ abstract class CollectionPropertiesMutableAbstract extends CollectionPropertiesB
* @inheritDoc
*/
public function setVisibility(?bool $value): static {
$this->data[self::JSON_PROPERTY_VISIBILITY] = $value;
$this->data[self::PROPERTY_VISIBILITY] = $value;
return $this;
}
@@ -65,7 +65,7 @@ abstract class CollectionPropertiesMutableAbstract extends CollectionPropertiesB
* @inheritDoc
*/
public function setColor(?string $value): static {
$this->data[self::JSON_PROPERTY_COLOR] = $value;
$this->data[self::PROPERTY_COLOR] = $value;
return $this;
}
@@ -16,6 +16,6 @@ abstract class EntityPropertiesBaseAbstract extends NodePropertiesBaseAbstract i
public const JSON_TYPE = EntityPropertiesBaseInterface::JSON_TYPE;
public function getDataRaw(): array|string|null {
return $this->data[self::JSON_PROPERTY_DATA] ?? null;
return $this->data[self::PROPERTY_DATA] ?? null;
}
}
@@ -14,7 +14,7 @@ use KTXF\Resource\Provider\Node\NodePropertiesBaseInterface;
interface EntityPropertiesBaseInterface extends NodePropertiesBaseInterface {
public const JSON_TYPE = 'chrono:entity';
public const JSON_PROPERTY_DATA = 'data';
public const PROPERTY_DATA = 'data';
public function getDataRaw(): array|string|null;
@@ -24,7 +24,7 @@ abstract class EntityPropertiesMutableAbstract extends EntityPropertiesBaseAbstr
}
public function setDataRaw(array|string|null $value): static {
$this->data[self::JSON_PROPERTY_DATA] = $value;
$this->data[self::PROPERTY_DATA] = $value;
return $this;
}
}
+10 -10
View File
@@ -14,16 +14,16 @@ use DateTimeImmutable;
interface INodeBase extends \JsonSerializable {
public const JSON_TYPE = 'files.node';
public const JSON_PROPERTY_TYPE = '@type';
public const JSON_PROPERTY_IN = 'in';
public const JSON_PROPERTY_ID = 'id';
public const JSON_PROPERTY_CREATED_ON = 'createdOn';
public const JSON_PROPERTY_CREATED_BY = 'createdBy';
public const JSON_PROPERTY_MODIFIED_ON = 'modifiedOn';
public const JSON_PROPERTY_MODIFIED_BY = 'modifiedBy';
public const JSON_PROPERTY_OWNER = 'owner';
public const JSON_PROPERTY_SIGNATURE = 'signature';
public const JSON_PROPERTY_LABEL = 'label';
public const PROPERTY_TYPE = '@type';
public const PROPERTY_IN = 'in';
public const PROPERTY_ID = 'id';
public const PROPERTY_CREATED_ON = 'createdOn';
public const PROPERTY_CREATED_BY = 'createdBy';
public const PROPERTY_MODIFIED_ON = 'modifiedOn';
public const PROPERTY_MODIFIED_BY = 'modifiedBy';
public const PROPERTY_OWNER = 'owner';
public const PROPERTY_SIGNATURE = 'signature';
public const PROPERTY_LABEL = 'label';
/**
* Unique identifier of the parent node (folder) this node belongs to
+4 -4
View File
@@ -18,10 +18,10 @@ namespace KTXF\Files\Node;
interface INodeEntityBase extends INodeBase {
public const JSON_TYPE = 'files.entity';
public const JSON_PROPERTY_SIZE = 'size';
public const JSON_PROPERTY_MIME = 'mime';
public const JSON_PROPERTY_FORMAT = 'format';
public const JSON_PROPERTY_ENCODING = 'encoding';
public const PROPERTY_SIZE = 'size';
public const PROPERTY_MIME = 'mime';
public const PROPERTY_FORMAT = 'format';
public const PROPERTY_ENCODING = 'encoding';
/**
* File size in bytes
@@ -73,8 +73,8 @@ interface ServiceBaseInterface extends ResourceServiceBaseInterface {
public const CAPABILITY_ENTITY_SORT_SIZE = 'size';
public const JSON_TYPE = 'mail.service';
public const JSON_PROPERTY_PRIMARY_ADDRESS = 'primaryAddress';
public const JSON_PROPERTY_SECONDARY_ADDRESSES = 'secondaryAddresses';
public const PROPERTY_PRIMARY_ADDRESS = 'primaryAddress';
public const PROPERTY_SECONDARY_ADDRESSES = 'secondaryAddresses';
/**
* Gets the primary mailing address for this service
@@ -26,7 +26,7 @@ abstract class CollectionPropertiesBaseAbstract extends NodePropertiesBaseAbstra
* @inheritDoc
*/
public function content(): array {
$content = $this->data[self::JSON_PROPERTY_CONTENT] ?? null;
$content = $this->data[self::PROPERTY_CONTENT] ?? null;
if (is_array($content)) {
return array_map(function ($item) {
return new CollectionContent($item);
@@ -40,35 +40,35 @@ abstract class CollectionPropertiesBaseAbstract extends NodePropertiesBaseAbstra
* @inheritDoc
*/
public function getLabel(): string {
return $this->data[self::JSON_PROPERTY_LABEL] ?? '';
return $this->data[self::PROPERTY_LABEL] ?? '';
}
/**
* @inheritDoc
*/
public function getDescription(): ?string {
return $this->data[self::JSON_PROPERTY_DESCRIPTION] ?? null;
return $this->data[self::PROPERTY_DESCRIPTION] ?? null;
}
/**
* @inheritDoc
*/
public function getPriority(): ?int {
return $this->data[self::JSON_PROPERTY_PRIORITY] ?? null;
return $this->data[self::PROPERTY_PRIORITY] ?? null;
}
/**
* @inheritDoc
*/
public function getVisibility(): ?bool {
return $this->data[self::JSON_PROPERTY_VISIBILITY] ?? null;
return $this->data[self::PROPERTY_VISIBILITY] ?? null;
}
/**
* @inheritDoc
*/
public function getColor(): ?string {
return $this->data[self::JSON_PROPERTY_COLOR] ?? null;
return $this->data[self::PROPERTY_COLOR] ?? null;
}
}
@@ -15,13 +15,13 @@ use PhpParser\Node\Expr\Array_;
interface CollectionPropertiesBaseInterface extends NodePropertiesBaseInterface {
public const JSON_TYPE = 'people:collection';
public const JSON_PROPERTY_CONTENT = 'content';
public const PROPERTY_CONTENT = 'content';
public const JSON_PROPERTY_LABEL = 'label';
public const JSON_PROPERTY_DESCRIPTION = 'description';
public const JSON_PROPERTY_PRIORITY = 'priority';
public const JSON_PROPERTY_VISIBILITY = 'visibility';
public const JSON_PROPERTY_COLOR = 'color';
public const PROPERTY_LABEL = 'label';
public const PROPERTY_DESCRIPTION = 'description';
public const PROPERTY_PRIORITY = 'priority';
public const PROPERTY_VISIBILITY = 'visibility';
public const PROPERTY_COLOR = 'color';
/**
* Gets the content type of this collection
@@ -33,7 +33,7 @@ abstract class CollectionPropertiesMutableAbstract extends CollectionPropertiesB
* @inheritDoc
*/
public function setLabel(string $value): static {
$this->data[self::JSON_PROPERTY_LABEL] = $value;
$this->data[self::PROPERTY_LABEL] = $value;
return $this;
}
@@ -41,7 +41,7 @@ abstract class CollectionPropertiesMutableAbstract extends CollectionPropertiesB
* @inheritDoc
*/
public function setDescription(?string $value): static {
$this->data[self::JSON_PROPERTY_DESCRIPTION] = $value;
$this->data[self::PROPERTY_DESCRIPTION] = $value;
return $this;
}
@@ -49,7 +49,7 @@ abstract class CollectionPropertiesMutableAbstract extends CollectionPropertiesB
* @inheritDoc
*/
public function setPriority(?int $value): static {
$this->data[self::JSON_PROPERTY_PRIORITY] = $value;
$this->data[self::PROPERTY_PRIORITY] = $value;
return $this;
}
@@ -57,7 +57,7 @@ abstract class CollectionPropertiesMutableAbstract extends CollectionPropertiesB
* @inheritDoc
*/
public function setVisibility(?bool $value): static {
$this->data[self::JSON_PROPERTY_VISIBILITY] = $value;
$this->data[self::PROPERTY_VISIBILITY] = $value;
return $this;
}
@@ -65,7 +65,7 @@ abstract class CollectionPropertiesMutableAbstract extends CollectionPropertiesB
* @inheritDoc
*/
public function setColor(?string $value): static {
$this->data[self::JSON_PROPERTY_COLOR] = $value;
$this->data[self::PROPERTY_COLOR] = $value;
return $this;
}
@@ -16,6 +16,6 @@ abstract class EntityPropertiesBaseAbstract extends NodePropertiesBaseAbstract i
public const JSON_TYPE = EntityPropertiesBaseInterface::JSON_TYPE;
public function getDataRaw(): array|string|null {
return $this->data[self::JSON_PROPERTY_DATA] ?? null;
return $this->data[self::PROPERTY_DATA] ?? null;
}
}
@@ -14,7 +14,7 @@ use KTXF\Resource\Provider\Node\NodePropertiesBaseInterface;
interface EntityPropertiesBaseInterface extends NodePropertiesBaseInterface {
public const JSON_TYPE = 'people:entity';
public const JSON_PROPERTY_DATA = 'data';
public const PROPERTY_DATA = 'data';
public function getDataRaw(): array|string|null;
@@ -24,7 +24,7 @@ abstract class EntityPropertiesMutableAbstract extends EntityPropertiesBaseAbstr
}
public function setDataRaw(array|string|null $value): static {
$this->data[self::JSON_PROPERTY_DATA] = $value;
$this->data[self::PROPERTY_DATA] = $value;
return $this;
}
}
@@ -23,7 +23,7 @@ abstract class CollectionPropertiesBaseAbstract extends NodePropertiesBaseAbstra
public const JSON_TYPE = CollectionPropertiesBaseInterface::JSON_TYPE;
public function content(): CollectionContent {
$content = $this->data[self::JSON_PROPERTY_CONTENTS] ?? null;
$content = $this->data[self::PROPERTY_CONTENTS] ?? null;
if ($content instanceof CollectionContent) {
return $content;
}
@@ -36,7 +36,7 @@ abstract class CollectionPropertiesBaseAbstract extends NodePropertiesBaseAbstra
}
public function getLabel(): string {
return $this->data[self::JSON_PROPERTY_LABEL] ?? '';
return $this->data[self::PROPERTY_LABEL] ?? '';
}
}
@@ -14,8 +14,8 @@ use KTXF\Resource\Provider\Node\NodePropertiesBaseInterface;
interface CollectionPropertiesBaseInterface extends NodePropertiesBaseInterface {
public const JSON_TYPE = 'document:collection';
public const JSON_PROPERTY_CONTENTS = 'content';
public const JSON_PROPERTY_LABEL = 'label';
public const PROPERTY_CONTENTS = 'content';
public const PROPERTY_LABEL = 'label';
public function content(): CollectionContent;
@@ -27,7 +27,7 @@ abstract class CollectionPropertiesMutableAbstract extends CollectionPropertiesB
}
public function setLabel(string $value): static {
$this->data[self::JSON_PROPERTY_LABEL] = $value;
$this->data[self::PROPERTY_LABEL] = $value;
return $this;
}
@@ -16,23 +16,23 @@ abstract class EntityPropertiesBaseAbstract extends NodePropertiesBaseAbstract i
public const JSON_TYPE = EntityPropertiesBaseInterface::JSON_TYPE;
public function size(): int {
return $this->data[self::JSON_PROPERTY_SIZE] ?? 0;
return $this->data[self::PROPERTY_SIZE] ?? 0;
}
public function getLabel(): string {
return $this->data[self::JSON_PROPERTY_LABEL] ?? '';
return $this->data[self::PROPERTY_LABEL] ?? '';
}
public function getMime(): string {
return $this->data[self::JSON_PROPERTY_MIME] ?? '';
return $this->data[self::PROPERTY_MIME] ?? '';
}
public function getFormat(): string {
return $this->data[self::JSON_PROPERTY_FORMAT] ?? '';
return $this->data[self::PROPERTY_FORMAT] ?? '';
}
public function getEncoding(): string {
return $this->data[self::JSON_PROPERTY_ENCODING] ?? '';
return $this->data[self::PROPERTY_ENCODING] ?? '';
}
}
@@ -14,11 +14,11 @@ use KTXF\Resource\Provider\Node\NodePropertiesBaseInterface;
interface EntityPropertiesBaseInterface extends NodePropertiesBaseInterface {
public const JSON_TYPE = 'document:file';
public const JSON_PROPERTY_LABEL = 'label';
public const JSON_PROPERTY_SIZE = 'size';
public const JSON_PROPERTY_MIME = 'mime';
public const JSON_PROPERTY_FORMAT = 'format';
public const JSON_PROPERTY_ENCODING = 'encoding';
public const PROPERTY_LABEL = 'label';
public const PROPERTY_SIZE = 'size';
public const PROPERTY_MIME = 'mime';
public const PROPERTY_FORMAT = 'format';
public const PROPERTY_ENCODING = 'encoding';
public function size(): int;
@@ -24,22 +24,22 @@ abstract class EntityPropertiesMutableAbstract extends EntityPropertiesBaseAbstr
}
public function setLabel(string $value): static {
$this->data[self::JSON_PROPERTY_LABEL] = $value;
$this->data[self::PROPERTY_LABEL] = $value;
return $this;
}
public function setMime(string $value): static {
$this->data[self::JSON_PROPERTY_MIME] = $value;
$this->data[self::PROPERTY_MIME] = $value;
return $this;
}
public function setFormat(string $value): static {
$this->data[self::JSON_PROPERTY_FORMAT] = $value;
$this->data[self::PROPERTY_FORMAT] = $value;
return $this;
}
public function setEncoding(string $value): static {
$this->data[self::JSON_PROPERTY_ENCODING] = $value;
$this->data[self::PROPERTY_ENCODING] = $value;
return $this;
}
@@ -16,10 +16,10 @@ interface ResourceProviderBaseInterface extends ProviderInterface, JsonSerializa
public const CAPABILITY_SERVICE_EXTANT = 'ServiceExtant';
public const JSON_TYPE = 'resource.provider';
public const JSON_PROPERTY_TYPE = '@type';
public const JSON_PROPERTY_IDENTIFIER = 'identifier';
public const JSON_PROPERTY_LABEL = 'label';
public const JSON_PROPERTY_CAPABILITIES = 'capabilities';
public const PROPERTY_TYPE = '@type';
public const PROPERTY_IDENTIFIER = 'identifier';
public const PROPERTY_LABEL = 'label';
public const PROPERTY_CAPABILITIES = 'capabilities';
/**
* Confirms if specific capability is supported (e.g. 'ServiceList')
@@ -10,15 +10,15 @@ interface ResourceServiceBaseInterface extends JsonSerializable {
// JSON Constants
public const JSON_TYPE = 'resource.service';
public const JSON_PROPERTY_TYPE = '@type';
public const JSON_PROPERTY_PROVIDER = 'provider';
public const JSON_PROPERTY_IDENTIFIER = 'identifier';
public const JSON_PROPERTY_LABEL = 'label';
public const JSON_PROPERTY_ENABLED = 'enabled';
public const JSON_PROPERTY_CAPABILITIES = 'capabilities';
public const JSON_PROPERTY_LOCATION = 'location';
public const JSON_PROPERTY_IDENTITY = 'identity';
public const JSON_PROPERTY_AUXILIARY = 'auxiliary';
public const PROPERTY_TYPE = '@type';
public const PROPERTY_PROVIDER = 'provider';
public const PROPERTY_IDENTIFIER = 'identifier';
public const PROPERTY_LABEL = 'label';
public const PROPERTY_ENABLED = 'enabled';
public const PROPERTY_CAPABILITIES = 'capabilities';
public const PROPERTY_LOCATION = 'location';
public const PROPERTY_IDENTITY = 'identity';
public const PROPERTY_AUXILIARY = 'auxiliary';
/**
* Confirms if specific capability is supported