Skip to content

Commit

Permalink
Rename helper method
Browse files Browse the repository at this point in the history
  • Loading branch information
caendesilva committed Dec 30, 2022
1 parent 90e3a7a commit 6d26e9e
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ protected function getCanonicalValue(): string
{
$canonicalFieldName = $this->pubType->canonicalField;
if ($canonicalFieldName === '__createdAt') {
return $this->getFieldValue('__createdAt')->getValue()->format('Y-m-d H:i:s');
return $this->getFieldFromCollection('__createdAt')->getValue()->format('Y-m-d H:i:s');
}

if ($this->fieldData->has($canonicalFieldName)) {
$field = $this->getFieldValue($canonicalFieldName);
$field = $this->getFieldFromCollection($canonicalFieldName);

return (string) $field->getValue(); // TODO here we can check if field has interface allowing it to be canonical, else throw exception
} else {
Expand All @@ -87,7 +87,7 @@ protected function normalizeData(Collection $data): array
})->toArray();
}

protected function getFieldValue(string $key): PublicationFieldValue
protected function getFieldFromCollection(string $key): PublicationFieldValue
{
return $this->fieldData->get($key);
}
Expand Down

0 comments on commit 6d26e9e

Please sign in to comment.