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.

LinkExpressionFunction::getName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Hateoas\Expression;
4
5
use Hateoas\Helper\LinkHelper;
6
7
/**
8
 * @author William Durand <[email protected]>
9
 */
10
class LinkExpressionFunction implements ExpressionFunctionInterface
11
{
12
    /**
13
     * @var LinkHelper
14
     */
15
    private $linkHelper;
16
17
    /**
18
     * @param LinkHelper $linkHelper
19
     */
20
    public function __construct(LinkHelper $linkHelper)
21
    {
22
        $this->linkHelper = $linkHelper;
23
    }
24
25
    /**
26
     * {@inheritDoc}
27
     */
28
    public function getName()
29
    {
30
        return 'link';
31
    }
32
33
    /**
34
     * {@inheritDoc}
35
     */
36
    public function getCompiler()
37
    {
38
        return function ($object, $rel, $absolute = false) {
39
            return sprintf('$link_helper->getLinkHref(%s, %s, %s)', $object, $rel, $absolute);
40
        };
41
    }
42
43
    /**
44
     * {@inheritDoc}
45
     */
46
    public function getEvaluator()
47
    {
48
        return function ($context, $object, $rel, $absolute = false) {
49
            return $context['link_helper']->getLinkHref($object, $rel, $absolute);
50
        };
51
    }
52
53
    /**
54
     * {@inheritDoc}
55
     */
56
    public function getContextVariables()
57
    {
58
        return array('link_helper' => $this->linkHelper);
59
    }
60
}
61