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.

TbTabView   A
last analyzed

Complexity

Total Complexity 22

Size/Duplication

Total Lines 136
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 22
lcom 1
cbo 1
dl 0
loc 136
ccs 0
cts 79
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
F normalizeTabs() 0 113 22
1
<?php
2
/**
3
 *##  TbTabView class file.
4
 *
5
 * @author Joe Blocher <[email protected]>
6
 * @copyright Copyright &copy; Joe Blocher 2012
7
 * @license [New BSD License](http://www.opensource.org/licenses/bsd-license.php) 
8
 */
9
10
Yii::import('booster.widgets.TbTabs');
11
12
/**
13
 *## Class TbTabView
14
 *
15
 * Use TbTabView as replacement for Yii CTabView
16
 *
17
 * @package booster.widgets.grouping
18
 */
19
class TbTabView extends TbTabs
20
{
21
22
	/**
23
	 * @var array
24
	 *
25
	 * Additional data submitted to the views
26
	 */
27
	public $viewData;
28
29
	/**
30
	 *### .normalizeTabs()
31
	 *
32
	 * Override from TbTabs
33
	 *
34
	 * @param array $tabs the tab configuration
35
	 * @param array $panes a reference to the panes array
36
	 * @param integer $i the current index
37
	 *
38
	 * @return array the items
39
	 */
40
	protected function normalizeTabs($tabs, &$panes, &$i = 0)
41
	{
42
		$id = $this->getId();
43
		$items = array();
44
45
		//---------------- new -------------------
46
		//Check if has an active item
47
		$hasActiveItem = false;
48
		foreach ($tabs as $tab) {
49
			$hasActiveItem = isset($tab['active']) ? $tab['active'] : false;
50
			if ($hasActiveItem) {
51
				break;
52
			}
53
		}
54
		//---------------- end new -------------------
55
56
		foreach ($tabs as $tab) {
57
			$item = $tab;
58
59
			if (isset($item['visible']) && $item['visible'] === false) {
60
				continue;
61
			}
62
63
			//---------------- new -------------------
64
			//check first active
65
			if (!$hasActiveItem && $i == 0) {
66
				$item['active'] = true;
67
			}
68
69
			//title -> label
70
			if (isset($item['title'])) {
71
				if (!isset($item['label'])) {
72
					$item['label'] = $item['title'];
73
				}
74
				unset($item['title']);
75
			}
76
			//------   end new ----------------
77
78
			if (!isset($item['itemOptions'])) {
79
				$item['itemOptions'] = array();
80
			}
81
82
			$item['linkOptions']['data-toggle'] = 'tab';
83
84
			if (isset($tab['items'])) {
85
				$item['items'] = $this->normalizeTabs($item['items'], $panes, $i);
86
			} else {
87
				if (!isset($item['id'])) {
88
					$item['id'] = $id . '_tab_' . ($i + 1);
89
				}
90
91
				$item['url'] = '#' . $item['id'];
92
93
94
				//--------------- new ---------------
95
				if (!isset($item['content'])) {
96
					if (isset($item['view'])) {
97
						if (isset($item['data'])) {
98
							if (is_array($this->viewData)) {
99
								$data = array_merge($this->viewData, $item['data']);
100
							} else {
101
								$data = $item['data'];
102
							}
103
104
							unset($item['data']);
105
						} else {
106
							$data = $this->viewData;
107
						}
108
109
						$item['content'] = $this->getController()->renderPartial($item['view'], $data, true);
110
111
						unset($item['view']);
112
					} else {
113
						$item['content'] = '';
114
					}
115
				}
116
				//--------------- end new ---------------
117
118
				$content = $item['content'];
119
				unset($item['content']);
120
121
				if (!isset($item['paneOptions'])) {
122
					$item['paneOptions'] = array();
123
				}
124
125
				$paneOptions = $item['paneOptions'];
126
				unset($item['paneOptions']);
127
128
				$paneOptions['id'] = $item['id'];
129
130
				$classes = array('tab-pane fade');
131
132
				if (isset($item['active']) && $item['active']) {
133
					$classes[] = 'active in';
134
				}
135
136
				$classes = implode(' ', $classes);
137
				if (isset($paneOptions['class'])) {
138
					$paneOptions['class'] .= ' ' . $classes;
139
				} else {
140
					$paneOptions['class'] = $classes;
141
				}
142
143
				$panes[] = CHtml::tag('div', $paneOptions, $content);
144
145
				$i++; // increment the tab-index
146
			}
147
148
			$items[] = $item;
149
		}
150
151
		return $items;
152
	}
153
154
}
155