GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

DataProviderCollection::fromConfig()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 1
dl 0
loc 10
rs 9.9332
c 0
b 0
f 0
1
<?php
2
3
4
namespace Hihaho\LaravelJsStore;
5
6
use Illuminate\Support\Collection;
7
8
class DataProviderCollection
9
{
10
    /**
11
     * @var Collection
12
     */
13
    protected $items;
14
15
    public function __construct(array $providers)
16
    {
17
        $this->items = collect($providers)->map(function (string $provider) {
18
            return app()->make($provider);
19
        })->filter(function ($provider) {
20
            return $provider instanceof AbstractFrontendDataProvider;
21
        })->filter->hasData();
22
    }
23
24
    public static function fromConfig(string $configPath): self
25
    {
26
        $data = config($configPath, []);
27
28
        if (!is_array($data)) {
29
            $data = [];
30
        }
31
32
        return new self($data);
33
    }
34
35
    public function store()
36
    {
37
        $this->items->each->store();
38
    }
39
40
    public function hasData(): bool
41
    {
42
        return $this->items->isNotEmpty();
43
    }
44
}
45