Completed
Push — master ( a57c3d...fa0598 )
by Antonio
02:20
created

ColumnTrait::renderHeaderCell()   B

Complexity

Conditions 5
Paths 2

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 30

Importance

Changes 1
Bugs 1 Features 1
Metric Value
dl 0
loc 9
ccs 0
cts 8
cp 0
rs 8.8571
c 1
b 1
f 1
cc 5
eloc 5
nc 2
nop 0
crap 30
1
<?php
2
3
/*
4
 * This file is part of the 2amigos/yii2-grid-view-library project.
5
 * (c) 2amigOS! <http://2amigos.us/>
6
 * For the full copyright and license information, please view
7
 * the LICENSE file that was distributed with this source code.
8
 */
9
10
namespace dosamigos\grid\traits;
11
12
use dosamigos\grid\GridView;
13
14
/**
15
 * @property GridView $grid the grid view object that owns this column.
16
 */
17
trait ColumnTrait
18
{
19
    /**
20
     * @var bool
21
     */
22
    public $rowSpanNoFilterHeaders = false;
23
24
    /**
25
     * Renders the header cell.
26
     *
27
     * @return string
28
     */
29
    public function renderHeaderCell()
30
    {
31
        if (null !== $this->grid->filterModel && false === $this->filter && $this->rowSpanNoFilterHeaders = true &&
32
                $this->grid->filterPosition === GridView::FILTER_POS_BODY) {
33
            $this->headerOptions['rowspan'] = 2;
34
        }
35
36
        return parent::renderHeaderCell();
37
    }
38
39
    /**
40
     * Renders the filter cell.
41
     *
42
     * @return string
43
     */
44
    public function renderFilterCell()
45
    {
46
        if (null !== $this->grid->filterModel && false === $this->filter && $this->rowSpanNoFilterHeaders = true &&
47
                $this->grid->filterPosition === GridView::FILTER_POS_BODY) {
48
            return null;
49
        }
50
51
        return parent::renderFilterCell();
52
    }
53
}
54