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.

TbDataColumn::renderFilterCell()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 8
ccs 0
cts 8
cp 0
rs 9.4285
cc 1
eloc 6
nc 1
nop 0
crap 2
1
<?php
2
/**
3
 *## TbDataColumn class file.
4
 *
5
 * @author Christoffer Niska <[email protected]>
6
 * @copyright Copyright &copy; Christoffer Niska 2011-
7
 * @license [New BSD License](http://www.opensource.org/licenses/bsd-license.php)
8
 */
9
10
Yii::import('zii.widgets.grid.CDataColumn');
11
12
/**
13
 *## Bootstrap grid data column.
14
 *
15
 * @property TbGridView|TbExtendedGridView $grid the grid view object that owns this column.
16
 *
17
 * @package booster.widgets.grids.columns
18
 */
19
class TbDataColumn extends CDataColumn
20
{
21
	/**
22
	 * @var array HTML options for filter input
23
	 * @see TbDataColumn::renderFilterCellContent()
24
	 */
25
	public $filterInputOptions;
26
27
	/**
28
	 *### .renderHeaderCellContent()
29
	 *
30
	 * Renders the header cell content.
31
	 * This method will render a link that can trigger the sorting if the column is sortable.
32
	 */
33
	protected function renderHeaderCellContent()
34
	{
35
		if ($this->grid->enableSorting && $this->sortable && $this->name !== null) {
36
			$sort = $this->grid->dataProvider->getSort();
37
			$label = isset($this->header) ? $this->header : $sort->resolveLabel($this->name);
38
39
40
			if ($sort->resolveAttribute($this->name) !== false)
41
				$label .= ' <span class="caret"></span>';
42
43
			echo $sort->link($this->name, $label, array('class' => 'sort-link'));
44
		} else {
45
			if ($this->name !== null && $this->header === null) {
46
				if ($this->grid->dataProvider instanceof CActiveDataProvider) {
0 ignored issues
show
Bug introduced by
The class CActiveDataProvider does not exist. Did you forget a USE statement, or did you not list all dependencies?

This error could be the result of:

1. Missing dependencies

PHP Analyzer uses your composer.json file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects the composer.json to be in the root folder of your repository.

Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the require or require-dev section?

2. Missing use statement

PHP does not complain about undefined classes in ìnstanceof checks. For example, the following PHP code will work perfectly fine:

if ($x instanceof DoesNotExist) {
    // Do something.
}

If you have not tested against this specific condition, such errors might go unnoticed.

Loading history...
47
					echo CHtml::encode($this->grid->dataProvider->model->getAttributeLabel($this->name));
48
				} else {
49
					echo CHtml::encode($this->name);
50
				}
51
			} else {
52
				parent::renderHeaderCellContent();
53
			}
54
		}
55
	}
56
57
	/**
58
	 *### .renderFilterCell()
59
	 *
60
	 * Renders the filter cell.
61
	 * @author antonio ramirez <[email protected]>
62
	 * @since 24/09/2012 added filterHtmlOptions
63
	 */
64
	public function renderFilterCell()
65
	{
66
		echo CHtml::openTag('td', $this->filterHtmlOptions);
67
		echo '<div class="filter-container">';
68
		$this->renderFilterCellContent();
69
		echo '</div>';
70
		echo CHtml::closeTag('td');
71
	}
72
73
	/**
74
	 *### .renderFilterCellContent()
75
	 *
76
	 * Renders the filter cell content.
77
	 * On top of Yii's default, here we can provide HTML options for actual filter input
78
	 * @author Sergii Gamaiunov <[email protected]>
79
	 */
80
	protected function renderFilterCellContent()
81
	{
82
		if (is_string($this->filter)) {
83
			echo $this->filter;
84
		} else if ($this->filter !== false && $this->grid->filter !== null && $this->name !== null && strpos(
85
			$this->name,
86
			'.'
87
		) === false
88
		) {
89
			if ($this->filterInputOptions) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $this->filterInputOptions of type array is implicitly converted to a boolean; are you sure this is intended? If so, consider using ! empty($expr) instead to make it clear that you intend to check for an array without elements.

This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.

Consider making the comparison explicit by using empty(..) or ! empty(...) instead.

Loading history...
90
				$filterInputOptions = $this->filterInputOptions;
91
				if (empty($filterInputOptions['id'])) {
92
					$filterInputOptions['id'] = false;
93
				}
94
			} else {
95
				$filterInputOptions = array();
96
			}
97
			
98
			if(!isset($filterInputOptions['class']) || empty($filterInputOptions['class']))
99
				$filterInputOptions['class'] = 'form-control';
100
			else
101
				$filterInputOptions['class'] .= ' form-control';
102
			
103
			if (is_array($this->filter)) {
104
				if (!isset($filterInputOptions['prompt'])) {
105
					$filterInputOptions['prompt'] = '';
106
				}
107
				echo CHtml::activeDropDownList($this->grid->filter, $this->name, $this->filter, $filterInputOptions);
108
			} else if ($this->filter === null) {
109
				echo CHtml::activeTextField($this->grid->filter, $this->name, $filterInputOptions);
110
			}
111
		} else {
112
			parent::renderFilterCellContent();
113
		}
114
	}
115
}
116