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.

ClassDecorator   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 49
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

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

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 4 4 1
A render() 9 9 3
A setClass() 5 5 2
A getClass() 4 4 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

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 View Code Duplication
class ClassDecorator extends AbstractRowDecorator
0 ignored issues
show
Duplication introduced by
This class 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...
12
{
13
14
    /**
15
     * Class
16
     * @var array
17
     */
18
    protected $class;
19
20
    public function __construct($options)
21
    {
22
        $this->setClass($options['class']);
23
    }
24
25
    /**
26
     * Rendering decorator
27
     * @param string $context
28
     * @return string
29
     */
30
    public function render($context)
31
    {
32
        if (count($this->class) > 0) {
33
            foreach ($this->class as $class) {
34
                $this->getRow()->addClass($class);
35
            }
36
        }
37
        return $context;
38
    }
39
40
    /**
41
     *
42
     * @param string|array $class
43
     * @return $this
44
     */
45
    public function setClass($class)
46
    {
47
        $this->class = (is_array($class)) ? $class : explode(' ', $class);
48
        return $this;
49
    }
50
51
    /**
52
     *
53
     * @return null|array
54
     */
55
    public function getClass()
56
    {
57
        return $this->class;
58
    }
59
}
60