Skip to content

Commit

Permalink
Apply fixes from StyleCI
Browse files Browse the repository at this point in the history
  • Loading branch information
abbadon1334 authored and StyleCIBot committed Jul 15, 2019
1 parent 4f6fb2e commit 0116556
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
10 changes: 4 additions & 6 deletions src/I18Next/Locale/Processor/Key.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ public function processKey(string $key, ?string $context = null, ?int $counter =
{
$key_piped = $this->processDirectPipedKey($key, $counter);

if (null !== $key_piped)
{
if (null !== $key_piped) {
return $key_piped;
}

Expand All @@ -42,18 +41,17 @@ private function processDirectPipedKey($key, ?int $counter = null) : ?string
{
$key_piped = explode('|', $key);

if(count($key_piped) === 1)
{
if (count($key_piped) === 1) {
return null;
}

if(null === $counter || 1 === $counter)
{
if (null === $counter || 1 === $counter) {
return $key_piped[0];
}

return $key_piped[1];
}

/**
* @param string $key
* @param int|null $counter
Expand Down
1 change: 0 additions & 1 deletion src/I18Next/atk4/TranslatorI18NextTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ public function _(
?string $domain = null,
?string $locale = null
): string {

if (null === $this->translator) {
throw new Exception('Translator for TranslatorI18NextTrait must be defined with setTranslator');
}
Expand Down
6 changes: 3 additions & 3 deletions tests/Translator_CaseDirect_Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@ public function testDirectPipe1()
$this->setupTranslatorLanguages('it', 'en');

$result = $this->translator->_('friend|friends', ['count' => 1]);
$this->assertEquals("friend", $result);
$this->assertEquals('friend', $result);
}

public function testDirectPipe3()
{
$this->setupTranslatorLanguages('it', 'en');

$result = $this->translator->_('friend|friends', ['count' => 3]);
$this->assertEquals("friends", $result);
$this->assertEquals('friends', $result);
}

public function testDirectPipe4()
{
$this->setupTranslatorLanguages('it', 'en');

$result = $this->translator->_('i have a friend|i have {{count}} friends', ['count' => 3]);
$this->assertEquals("i have 3 friends", $result);
$this->assertEquals('i have 3 friends', $result);
}
}

0 comments on commit 0116556

Please sign in to comment.