Select   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 25
rs 10
c 0
b 0
f 0
ccs 7
cts 7
cp 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 2
A getFormControl() 0 4 1
1
<?php
2
3
/**
4
 * This file is part of the Grido (https://github.com/o5/grido)
5
 *
6
 * Copyright (c) 2011 Petr Bugyík (http://petr.bugyik.cz)
7
 *
8
 * For the full copyright and license information, please view
9
 * the file LICENSE.md that was distributed with this source code.
10
 */
11
12
namespace Grido\Components\Filters;
13
14
/**
15
 * Select box filter.
16
 *
17
 * @package     Grido
18
 * @subpackage  Components\Filters
19
 * @author      Petr Bugyík
20
 */
21
class Select extends Filter
22 1
{
23
    /**
24
     * @param \Grido\Grid $grid
25
     * @param string $name
26
     * @param string $label
27
     * @param array $items for select
28
     */
29
    public function __construct($grid, $name, $label, array $items = NULL)
30
    {
31 1
        parent::__construct($grid, $name, $label);
32
33 1
        if ($items !== NULL) {
34 1
            $this->getControl()->setItems($items);
35 1
        }
36 1
    }
37
38
    /**
39
     * @return \Nette\Forms\Controls\SelectBox
40
     */
41
    protected function getFormControl()
42
    {
43 1
        return new \Nette\Forms\Controls\SelectBox($this->label);
44
    }
45
}
46