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

Packages   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 3
Bugs 0 Features 0
Metric Value
eloc 10
dl 0
loc 31
ccs 10
cts 10
cp 1
rs 10
c 3
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A count() 0 5 1
A get() 0 10 1
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