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.
Completed
Pull Request — master (#340)
by
unknown
07:41 queued 05:52
created

ConfigLinkProvider::getAll()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 18
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 18
rs 9.4285
cc 2
eloc 12
nc 1
nop 0
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: JM
5
 * Date: 08/04/2017
6
 * Time: 15:16
7
 */
8
9
namespace Serverfireteam\Panel\Links;
10
11
use Illuminate\Support\Collection;
12
use Illuminate\Support\Str;
13
14
class ConfigLinkProvider implements LinkProvider
15
{
16
17
    /**
18
     * @return Collection
19
     */
20
    public function getAll ()
21
    {
22
        // Use the links from config/panel.php
23
        $config = config('panel.links');
24
25
        return collect($config)->map(function ($spec, $label) {
26
            if (is_int($label)) { // This is just a string without a key (short notation)
27
                $label = $spec;
28
                $spec  = null;
29
            }
30
            return [
31
                'display'   => $label,
32
                'url'       => data_get($spec, 'model', Str::singular($label)),
33
                'show_menu' => data_get($spec, 'show_menu', true),
34
                'main'      => !data_get($spec, 'custom', true),
35
            ];
36
        })->values();
37
    }
38
39
    /**
40
     * @return Collection
41
     */
42
    public function getMain ()
43
    {
44
        return $this->getAll()->filter(function ($link) {
45
            return $link['main'];
46
        });
47
    }
48
}