Passed
Push — main ( 9ad958...bccbba )
by Andrey
72:16 queued 69:33
created

Packages::count()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 5
ccs 3
cts 3
cp 1
crap 1
rs 10
c 1
b 0
f 0
1
<?php
2
3
namespace Helldar\LaravelLangPublisher\Support;
4
5
use Helldar\LaravelLangPublisher\Concerns\Logger;
6
use Helldar\LaravelLangPublisher\Facades\ArrayProcessor as ArrProcessor;
7
use Helldar\LaravelLangPublisher\Facades\Config as ConfigFacade;
8
9
final class Packages
10
{
11
    use Logger;
0 ignored issues
show
Bug introduced by
The trait Helldar\LaravelLangPublisher\Concerns\Logger requires the property $output which is not provided by Helldar\LaravelLangPublisher\Support\Packages.
Loading history...
12
13
    /**
14
     * Returns a sorted list of packages identified for processing.
15
     *
16
     * @return array
17
     */
18 19
    public function get(): array
19
    {
20 19
        $this->log('Getting a sorted list of packages identified for processing...');
21
22 19
        $packages = ConfigFacade::packages();
23
24 19
        return ArrProcessor::of($packages)
25 19
            ->unique()
26 19
            ->values()
27 19
            ->toArray();
28
    }
29
30
    /**
31
     * Returns the count of processable packages.
32
     *
33
     * @return int
34
     */
35 11
    public function count(): int
36
    {
37 11
        $this->log('Getting the number of processed packets...');
38
39 11
        return count($this->get());
40
    }
41
}
42