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.

Issues (37)

src/Link.php (3 issues)

1
<?php
2
3
namespace Siren;
4
5
use LogicException;
6
7
class Link
8
{
9
    /**
10
     * @var array
11
     */
12
    protected $rel = array();
13
14
    /**
15
     * @var string
16
     */
17
    protected $href;
18
19
    /**
20
     * Get rel
21
     *
22
     * @return array
23
     */
24
    public function getRel()
25
    {
26
        return $this->rel;
27
    }
28
29
    /**
30
     * Set rel
31
     *
32
     * @param array $rel
33
     * @return $this
34
     * @throws LogicException
35
     */
36 View Code Duplication
    public function setRel(array $rel)
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
37
    {
38
        foreach ($rel as $relItem) {
39
            if (!is_string($relItem)) {
40
                $exMsg = sprintf('Provided rel `%s` is not a string', $relItem);
41
                throw new LogicException($exMsg);
42
            }
43
        }
44
45
        $this->rel = $rel;
46
47
        return $this;
48
    }
49
50
    /**
51
     * Add rel
52
     *
53
     * @param string $rel
54
     * @return $this
55
     * @throws LogicException
56
     */
57 View Code Duplication
    public function addRel($rel)
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
58
    {
59
        if (!is_string($rel)) {
60
            $exMsg = sprintf('Provided rel `%s` is not a string', $rel);
61
            throw new LogicException($exMsg);
62
        }
63
64
        $this->rel[] = $rel;
65
66
        return $this;
67
    }
68
69
    /**
70
     * Get href
71
     *
72
     * @return string
73
     */
74
    public function getHref()
75
    {
76
        return $this->href;
77
    }
78
79
    /**
80
     * Set href
81
     *
82
     * @param string $href
83
     * @return $this
84
     * @throws LogicException
85
     */
86 View Code Duplication
    public function setHref($href)
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
87
    {
88
        if (!is_string($href)) {
89
            $exMsg = sprintf('Provided href `%s` is not a string', $href);
90
            throw new LogicException($exMsg);
91
        }
92
93
        $this->href = $href;
94
95
        return $this;
96
    }
97
98
    /**
99
     * Convert object to array
100
     *
101
     * @return array
102
     */
103
    public function toArray()
104
    {
105
        $data = array();
106
107
        $rel = $this->getRel();
108
        if (!empty($rel)) {
109
            $data['rel'] = $rel;
110
        }
111
112
        $href = $this->getHref();
113
        if ($href !== null) {
114
            $data['href'] = $href;
115
        }
116
117
        return $data;
118
    }
119
}
120