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   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
c 0
b 0
f 0
lcom 0
cbo 1
dl 0
loc 33
ccs 8
cts 8
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
getLinks() 0 1 ?
A hasLink() 0 4 1
A getLinkUrl() 0 12 3
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