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   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
c 0
b 0
f 0
lcom 0
cbo 2
dl 0
loc 35
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getAll() 0 18 2
A getMain() 0 6 1
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
}