Passed
Pull Request — main (#84)
by Andrey
196:26 queued 181:26
created

Reset::compare()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 2
c 0
b 0
f 0
nc 2
nop 2
dl 0
loc 5
rs 10
1
<?php
2
3
namespace Helldar\LaravelLangPublisher\Services\Processors;
4
5
use Helldar\LaravelLangPublisher\Concerns\Keyable;
6
use Helldar\LaravelLangPublisher\Concerns\Reservation;
7
use Helldar\LaravelLangPublisher\Constants\Status;
8
9
final class Reset extends Processor
10
{
11
    use Keyable;
12
    use Reservation;
13
14
    public function run(): string
15
    {
16
        $source = $this->load($this->source_path);
17
        $target = $this->load($this->target_path);
18
19
        $result = $this->compare($source, $target);
20
21
        $this->store($this->target_path, $result);
22
23
        return Status::RESET;
24
    }
25
26
    protected function compare(array $source, array $target): array
27
    {
28
        $target = $this->full ? [] : $this->only($target);
29
30
        return parent::compare($source, $target);
31
    }
32
33
    protected function only(array $array): array
34
    {
35
        return $this->reserved($array, $this->key($this->target_path));
36
    }
37
}
38