Skip to content

Commit

Permalink
change to singular field naming
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexzPurewoko committed Dec 21, 2023
1 parent c55430a commit 32b612a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/Abilities/Core/Objects/Enums/FieldType.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
enum FieldType
{
case ALL;
case STRING_OR_INT;
case SINGULAR_FIELD;
case OBJECT;
case ARRAY;
}
12 changes: 6 additions & 6 deletions src/Abilities/Core/Objects/Resource.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ private function processField(): void
return;
}

if ($this->isIntOrStringField($this->field)) {
$this->fieldType = FieldType::STRING_OR_INT;
if ($this->isSingularField($this->field)) {
$this->fieldType = FieldType::SINGULAR_FIELD;
return;
}

Expand Down Expand Up @@ -73,8 +73,8 @@ public function matchField(mixed $field): bool
return false;
}

if ($this->fieldType === FieldType::STRING_OR_INT) {
if (!$this->isIntOrStringField($field)) {
if ($this->fieldType === FieldType::SINGULAR_FIELD) {
if (!$this->isSingularField($field)) {
return false;
}

Expand All @@ -101,7 +101,7 @@ public function matchField(mixed $field): bool
return false;
}

private function isIntOrStringField(mixed $field): bool
private function isSingularField(mixed $field): bool
{
return is_string($field) || is_int($field);
}
Expand All @@ -112,7 +112,7 @@ public function __toString(): string
return $this->getResource() . "/*";
}

if ($this->fieldType === FieldType::STRING_OR_INT) {
if ($this->fieldType === FieldType::SINGULAR_FIELD) {
return $this->getResource() . "/" . $this->getField();
}

Expand Down

0 comments on commit 32b612a

Please sign in to comment.