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.

Separatable::getDefaultColumn()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
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\Row;
10
11
class Separatable extends AbstractRowDecorator
12
{
13
    /**
14
     * Flag to inform if iterable is just started
15
     * @var boolean
16
     */
17
    protected $isStarted = true;
18
19
    /**
20
     *
21
     * @var mixed Value of previous iterated
22
     */
23
    protected $previousColumnValue = null;
24
25
    /**
26
     * Default column value
27
     * @var string
28
     */
29
    protected $defaultColumn = null;
30
31
32
    public function getIsStarted()
33
    {
34
        return $this->isStarted;
35
    }
36
37
    public function setIsStarted($isStarted)
38
    {
39
        $this->isStarted = $isStarted;
40
    }
41
42
    public function getPreviousColumnValue()
43
    {
44
        return $this->previousColumnValue;
45
    }
46
47
    public function setPreviousColumnValue($previousColumnValue)
48
    {
49
        $this->previousColumnValue = $previousColumnValue;
50
    }
51
52
    public function __construct($options = array())
53
    {
54
        $this->defaultColumn = (isset($options['defaultColumn'])) ? $options['defaultColumn'] : null;
55
    }
56
57
    /**
58
     * Rendering decorator
59
     *
60
     * @param string $context
61
     * @return string
62
     */
63
    public function render($context)
64
    {
65
        $column = $this->getRow()->getTable()->getParamAdapter()->getColumn();
66
67
        if (!$column && !$this->getDefaultColumn()) {
68
            return $context;
69
        } elseif (!$column && $this->getDefaultColumn()) {
70
            $column = $this->getDefaultColumn();
71
        }
72
        $actualRow = $this->getRow()->getActualRow();
73
        $valueOfColumn = $actualRow[$column];
74
75
        if ($this->getIsStarted()) {
76
            $this->setIsStarted(false);
77
            $this->setPreviousColumnValue($valueOfColumn);
78
            return $context;
79
        }
80
81
        if ($valueOfColumn !== $this->getPreviousColumnValue()
82
            && $this->getRow()->getTable()->getHeader($column)->getSeparatable()
83
        ) {
84
            $this->getRow()->addVarClass('separatable');
85
        }
86
        $this->setPreviousColumnValue($valueOfColumn);
87
    }
88
89
    public function getDefaultColumn()
90
    {
91
        return $this->defaultColumn;
92
    }
93
}
94