Skip to content

Commit

Permalink
Cached translation support for LibraryTypes and TagTypes. extra check…
Browse files Browse the repository at this point in the history
…s added
  • Loading branch information
BurakBoz committed Sep 28, 2023
1 parent f4acdae commit 2514180
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -263,11 +263,11 @@ public function libraryTypes(array $types): static

public function getLibraryTypes(): ?array
{
if ($this->translatedLibraryTypes === null && $this->libraryTypes) {
if ($this->translatedLibraryTypes === null && $this->libraryTypes && function_exists('__')) {
$this->translatedLibraryTypes = array_map('__', $this->libraryTypes);
}

return $this->translatedLibraryTypes;
return $this->translatedLibraryTypes ?? $this->libraryTypes;
}

public function tagTypes(array $types): static
Expand All @@ -281,11 +281,11 @@ public function tagTypes(array $types): static

public function getTagTypes(): ?array
{
if ($this->translatedTagTypes === null && $this->tagTypes) {
if ($this->translatedTagTypes === null && $this->tagTypes && function_exists('__')) {
$this->translatedTagTypes = array_map('__', $this->tagTypes);
}

return $this->translatedTagTypes;
return $this->translatedTagTypes ?? $this->tagTypes;
}

public function uriPrefix(array $prefix): static
Expand Down

0 comments on commit 2514180

Please sign in to comment.