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

Packages::count()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 5
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
    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