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 ( 160b61...162853 )
by Alireza
9s
created

LinkRepository::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 1
1
<?php
2
3
namespace Serverfireteam\Panel;
4
5
use Illuminate\Support\Collection;
6
use Serverfireteam\Panel\Links\LinkProvider;
7
8
class LinkRepository
9
{
10
11
    /**
12
     * @var LinkProvider
13
     */
14
    private $linkProvider;
15
16
    /**
17
     * LinkRepository constructor.
18
     * @param LinkProvider $linkProvider
19
     */
20
    public function __construct (LinkProvider $linkProvider)
21
    {
22
        $this->linkProvider = $linkProvider;
23
    }
24
25
    /**
26
     * @return Collection
27
     */
28
    public function all ()
29
    {
30
        // @TODO cache
31
        return $this->linkProvider->getAll();
32
    }
33
34
    /**
35
     * Get all the links where "main" is true
36
     * @return Collection
37
     */
38
    public function main ()
39
    {
40
        // @TODO cache
41
        return $this->linkProvider->getMain();
42
    }
43
44
    /**
45
     * Return whether the given URL (model name) exists amongst the "main" links
46
     * @param $url
47
     * @return bool
48
     */
49
    public function isMain ($url)
50
    {
51
        return $this->main()->pluck('url')->contains($url);
52
    }
53
}