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.

HasLinks::getLinks()
last analyzed

Size

Total Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 1
ccs 0
cts 0
cp 0
nc 1
1
<?php
2
namespace EventStore\StreamFeed;
3
4
/**
5
 * Class HasLinks
6
 * @package EventStore\StreamFeed
7
 */
8
trait HasLinks
9
{
10
    /**
11
     * @return array
12
     */
13
    abstract protected function getLinks();
14
15
    /**
16
     * @param  LinkRelation $relation
17
     * @return null|string
18
     */
19 19
    public function getLinkUrl(LinkRelation $relation)
20
    {
21 19
        $links = $this->getLinks();
22
23 19
        foreach ($links as $link) {
24 19
            if ($link['relation'] == $relation->toNative()) {
25 19
                return $link['uri'];
26
            }
27
        }
28
29 6
        return null;
30
    }
31
32
    /**
33
     * @param  LinkRelation $relation
34
     * @return boolean
35
     */
36 9
    public function hasLink(LinkRelation $relation)
37
    {
38 9
        return $this->getLinkUrl($relation) !== null;
39
    }
40
}
41