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
Push — master ( af63ed...3569fe )
by Alireza
21s
created

Link   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 10
lcom 1
cbo 0
dl 0
loc 38
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getAllLinks() 0 7 3
A getUrls() 0 8 3
A getMainUrls() 0 8 3
A addNewLink() 0 7 1
1
<?php
2
namespace Serverfireteam\Panel;
3
4
use Illuminate\Database\Eloquent\Model;
5
6
class Link extends Model {
7
8
    protected $fillable = ['url', 'display', 'show_menu'];
9
10
    protected $table = 'links';
11
    
12
    static $cache = [];
13
    public static function getAllLinks($forceRefresh = false) // allCached(
14
    {
15
        if (!isset(self::$cache['all']) || $forceRefresh) {
16
            self::$cache['all'] = Link::all();
17
        }
18
        return self::$cache['all'];
19
    }
20
    public static function getUrls($forceRefresh = false) // returnUrls(
21
    {
22
        if (!isset(self::$cache['all_urls']) || $forceRefresh) {
23
            $configs = Link::allCached($forceRefresh);
24
            self::$cache['all_urls'] =  $configs->pluck('url')->toArray();
25
        }
26
        return self::$cache['all_urls'];
27
    }
28
    public static function getMainUrls($forceRefresh = false)
29
    {
30
        if (!isset(self::$cache['main_urls']) || $forceRefresh) {
31
            $configs = Link::where('main', '=', true)->get(['url']);
32
            self::$cache['main_urls'] = $configs->pluck('url')->toArray();
33
        }
34
        return self::$cache['main_urls'];
35
    }
36
    public function addNewLink($url, $label, $visibility) // getAndSave(
37
    {
38
        $this->url = $url;
39
        $this->display = $label;
40
        $this->show_menu = $visibility;
41
        $this->save();
42
    }
43
}