Skip to content

Commit

Permalink
Rename methods
Browse files Browse the repository at this point in the history
  • Loading branch information
olivervogel committed Nov 9, 2024
1 parent 80bebb0 commit 799e5bd
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/AbstractZodiac.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function match(Carbon $date): bool
*/
public function localized(?string $locale = null): ?string
{
$translator = $this->getTranslator($locale);
$translator = $this->translator($locale);
$key = "zodiacs.{$this->name}";

if ($translator->has($key)) {
Expand Down
2 changes: 1 addition & 1 deletion src/Calculator.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function zodiac(mixed $date): AbstractZodiac
foreach ($this->zodiacClassnames() as $classname) {
$zodiac = new $classname();
if ($zodiac->match($date)) {
return $zodiac->setTranslator($this->getTranslator());
return $zodiac->setTranslator($this->translator());
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/Laravel/ZodiacBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function __construct(Application $app)
*/
public function make($date): AbstractZodiac
{
return $this->getTranslatableCalculator()->zodiac($date);
return $this->translatableCalculator()->zodiac($date);
}

/**
Expand All @@ -43,7 +43,7 @@ public function make($date): AbstractZodiac
* @throws InvalidArgumentException
* @return Calculator
*/
private function getTranslatableCalculator(): Calculator
private function translatableCalculator(): Calculator
{
return (new Calculator())->setTranslator($this->app['translator']);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Traits/CanTranslate.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function setTranslator(Translator $translator): Calculator|AbstractZodiac
* @throws InvalidArgumentException
* @return Translator
*/
public function getTranslator(?string $locale = null): Translator
public function translator(?string $locale = null): Translator
{
if (is_a($this->translator, Translator::class)) {
if (is_string($locale) && $this->translator->getLocale() !== $locale) {
Expand Down

0 comments on commit 799e5bd

Please sign in to comment.