Passed
Push — 9.x ( facc1a...80dc3b )
by Andrey
13:27
created

Packages   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
eloc 10
dl 0
loc 31
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
    public function get(): array
19
    {
20
        $this->log('Getting a sorted list of packages identified for processing...');
21
22
        $packages = ConfigFacade::packages();
23
24
        return ArrProcessor::of($packages)
25
            ->unique()
26
            ->values()
27
            ->toArray();
28
    }
29
30
    /**
31
     * Returns the count of processable packages.
32
     *
33
     * @return int
34
     */
35
    public function count(): int
36
    {
37
        $this->log('Getting the number of processed packets...');
38
39
        return count($this->get());
40
    }
41
}
42