Skip to content

Commit

Permalink
Fix non-static methods
Browse files Browse the repository at this point in the history
  • Loading branch information
afbora committed Mar 20, 2024
1 parent 1c297d9 commit a2e45c3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/Cms/Language.php
Original file line number Diff line number Diff line change
Expand Up @@ -437,8 +437,7 @@ public function save(): static
// save translations to the custom root and remove translations
// to prevent duplication write into the language file
if ($this->translationsObject()->root() !== null) {
$this->translationsObject()
->save($data['translations'] ?? []);
$this->translationsObject()->save($data['translations'] ?? []);
$data['translations'] = [];
}

Expand Down
4 changes: 2 additions & 2 deletions src/Cms/LanguageTranslations.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function get(string $key, string $default = null): string|null
*/
public function load(array $default = []): array
{
if ($file = static::root()) {
if ($file = $this->root()) {
try {
return Data::read($file);
} catch (Exception) {
Expand Down Expand Up @@ -118,7 +118,7 @@ public function set(string $key, string|null $value = null): static
public function setTranslations(self|array $translations = []): static
{
$this->data = match (true) {
empty($translations) === true => static::load(),
empty($translations) === true => $this->load(),
$translations instanceof self => $translations->toArray(),
default => $translations
};
Expand Down

0 comments on commit a2e45c3

Please sign in to comment.