ExistsTranslation::exists()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 10
ccs 7
cts 7
cp 1
rs 9.9332
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 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
    /**
12
     * @param TranslationInterface $translation
13
     * @return bool
14
     */
15 19
    public function exists(TranslationInterface $translation): bool
16
    {
17 19
        return $this->query()
0 ignored issues
show
Bug introduced by
The method exists() does not exist on Illuminate\Database\Eloquent\Builder. Did you maybe mean canUseExistsForExistenceCheck()?

This check marks calls to methods that do not seem to exist on an object.

This is most likely the result of a method being renamed without all references to it being renamed likewise.

Loading history...
18
            ->where(static function ($q) use ($translation) {
19 19
                $q->where('group', $translation->getGroup())
20 19
                  ->where('key', $translation->getKey());
21 19
            })
22 19
            ->orWhere('id', $translation->getId())
23 19
            ->exists();
24
    }
25
}
26