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.

Link   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 7
lcom 1
cbo 3
dl 0
loc 53
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 12 4
A render() 0 12 3
1
<?php
2
/**
3
 * ZfTable ( Module for Zend Framework 2)
4
 *
5
 * @copyright Copyright (c) 2013 Piotr Duda [email protected]
6
 * @license   MIT License
7
 */
8
9
namespace ZfTable\Decorator\Cell;
10
11
use ZfTable\Decorator\Exception;
12
13
class Link extends AbstractCellDecorator
14
{
15
16
    /**
17
     * Array of variable attribute for link
18
     * @var array
19
     */
20
    protected $vars;
21
22
    /**
23
     * Link url
24
     * @var string
25
     */
26
    protected $url;
27
28
29
    /**
30
     * Constructor
31
     *
32
     * @param array $options
33
     * @throws Exception\InvalidArgumentException
34
     */
35
    public function __construct(array $options = array())
36
    {
37
        if (!isset($options['url'])) {
38
            throw new Exception\InvalidArgumentException('Url key in options argument required');
39
        }
40
41
        $this->url = $options['url'];
42
43
        if (isset($options['vars'])) {
44
            $this->vars = is_array($options['vars']) ? $options['vars'] : array($options['vars']);
45
        }
46
    }
47
48
    /**
49
     * Rendering decorator
50
     * @param string $context
51
     * @return string
52
     */
53
    public function render($context)
54
    {
55
        $values = array();
56
        if (count($this->vars)) {
57
            $actualRow = $this->getCell()->getActualRow();
58
            foreach ($this->vars as $var) {
59
                $values[] = $actualRow[$var];
60
            }
61
        }
62
        $url = vsprintf($this->url, $values);
63
        return sprintf('<a  href="%s">%s</a>', $url, $context);
64
    }
65
}
66