refactor: object property names
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user