Passed
Push — 10.x ( 64cb8f...6737cd )
by Andrey
02:16
created

Update::targetLocales()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 6
nc 1
nop 0
dl 0
loc 9
ccs 7
cts 7
cp 1
crap 1
rs 10
c 1
b 0
f 0
1
<?php
2
3
/*
4
 * This file is part of the "andrey-helldar/laravel-lang-publisher" project.
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 *
9
 * @author Andrey Helldar <[email protected]>
10
 *
11
 * @copyright 2021 Andrey Helldar
12
 *
13
 * @license MIT
14
 *
15
 * @see https://github.com/andrey-helldar/laravel-lang-publisher
16
 */
17
18
declare(strict_types=1);
19
20
namespace Helldar\LaravelLangPublisher\Console;
21
22
use Helldar\LaravelLangPublisher\Facades\Helpers\Locales;
23
use Helldar\LaravelLangPublisher\Processors\Add as Processor;
24
use Helldar\Support\Facades\Helpers\Ables\Arrayable;
25
26
class Update extends Base
27
{
28
    protected $signature = 'lang:update';
29
30
    protected $description = 'Updating installed localizations.';
31
32
    protected $processor = Processor::class;
33
34 2
    protected function targetLocales(): array
35
    {
36 2
        $locales = parent::targetLocales();
37
38 2
        return Arrayable::of($locales)
39 2
            ->addUnique($this->getProtected())
40 2
            ->sort()
41 2
            ->values()
42 2
            ->get();
43
    }
44
45 2
    protected function getProtected(): array
46
    {
47 2
        return Locales::protects();
48
    }
49
}
50