ExistsAndDeleteTranslation   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 3
dl 0
loc 30
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A make() 0 10 2
1
<?php
2
3
namespace Omatech\Mage\Core\Domains\Translations\Features;
4
5
use Omatech\Mage\Core\Domains\Translations\Exceptions\TranslationDoesNotExistsException;
6
use Omatech\Mage\Core\Domains\Translations\Jobs\DeleteTranslation;
7
use Omatech\Mage\Core\Domains\Translations\Jobs\ExistsTranslation;
8
use Omatech\Mage\Core\Domains\Translations\Translation;
9
10
class ExistsAndDeleteTranslation
11
{
12
    private $exists;
13
    private $delete;
14
15
    /**
16
     * ExistsAndDeleteTranslation constructor.
17
     */
18 3
    public function __construct()
19
    {
20 3
        $this->exists = new ExistsTranslation();
21 3
        $this->delete = new DeleteTranslation();
22 3
    }
23
24
    /**
25
     * @param Translation $translation
26
     * @return bool
27
     * @throws TranslationDoesNotExistsException
28
     */
29 3
    public function make(Translation $translation): bool
30
    {
31 3
        $exists = $this->exists->make($translation);
32
33 3
        if (false === $exists) {
34 1
            throw new TranslationDoesNotExistsException();
35
        }
36
37 3
        return $this->delete->make($translation);
38
    }
39
}
40