Passed
Push — master ( a569b2...1b7ab6 )
by Christian
03:49
created

ExistsTranslation   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 11
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 1 Features 0
Metric Value
eloc 7
c 1
b 1
f 0
dl 0
loc 11
ccs 7
cts 7
cp 1
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A exists() 0 9 1
1
<?php
2
3
namespace Omatech\Mage\Core\Repositories\Translations;
4
5
use Omatech\Mage\Core\Domains\Translations\Contracts\ExistsTranslationInterface;
6
use Omatech\Mage\Core\Domains\Translations\Contracts\TranslationInterface;
7
use Omatech\Mage\Core\Repositories\TranslationBaseRepository;
8
9
class ExistsTranslation extends TranslationBaseRepository implements ExistsTranslationInterface
10
{
11 15
    public function exists(TranslationInterface $translation): bool
12
    {
13 15
        return $this->query()
14
            ->where(static function ($q) use ($translation) {
15 15
                $q->where('group', $translation->getGroup())
16 15
                  ->where('key', $translation->getKey());
17 15
            })
18 15
            ->orWhere('id', $translation->getId())
19 15
            ->exists();
20
    }
21
}
22