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 ( fbff4e...685c55 )
by Edi
32:34
created

Url   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
wmc 5
lcom 1
cbo 4
dl 0
loc 46
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
B getMetaTags() 0 23 4
1
<?php
2
3
namespace Netgen\Bundle\OpenGraphBundle\Handler\Literal;
4
5
use eZ\Publish\Core\Base\Exceptions\InvalidArgumentException;
6
use Netgen\Bundle\OpenGraphBundle\Handler\HandlerInterface;
7
use Netgen\Bundle\OpenGraphBundle\MetaTag\Item;
8
use Symfony\Component\HttpFoundation\Request;
9
use Symfony\Component\HttpFoundation\RequestStack;
10
11
class Url implements HandlerInterface
12
{
13
    /**
14
     * @var \Symfony\Component\HttpFoundation\RequestStack
15
     */
16
    protected $requestStack;
17
18
    public function __construct(RequestStack $requestStack)
19
    {
20
        $this->requestStack = $requestStack;
21
    }
22
23
    /**
24
     * Returns the array of meta tags.
25
     *
26
     * @param string $tagName
27
     * @param array $params
28
     *
29
     * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException If number of params is incorrect
30
     *
31
     * @return \Netgen\Bundle\OpenGraphBundle\MetaTag\Item[]
32
     */
33
    public function getMetaTags($tagName, array $params = array())
34
    {
35
        if (!isset($params[0])) {
36
            throw new InvalidArgumentException(
37
                '$params[0]',
38
                'Literal URL handler requires the path to output.'
39
            );
40
        }
41
42
        $path = $params[0];
43
        $request = $this->requestStack->getCurrentRequest();
44
45
        if (!preg_match('/^https?:\/\//', $path) && $request instanceof Request) {
46
            $path = $request->getUriForPath('/' . ltrim($path, '/'));
47
        }
48
49
        return array(
50
            new Item(
51
                $tagName,
52
                $path
53
            ),
54
        );
55
    }
56
}
57