1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Copyright (c) Enalean, 2012-2015. All Rights Reserved. |
4
|
|
|
* |
5
|
|
|
* This file is a part of Tuleap. |
6
|
|
|
* |
7
|
|
|
* Tuleap is free software; you can redistribute it and/or modify |
8
|
|
|
* it under the terms of the GNU General Public License as published by |
9
|
|
|
* the Free Software Foundation; either version 2 of the License, or |
10
|
|
|
* (at your option) any later version. |
11
|
|
|
* |
12
|
|
|
* Tuleap is distributed in the hope that it will be useful, |
13
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
14
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15
|
|
|
* GNU General Public License for more details. |
16
|
|
|
* |
17
|
|
|
* You should have received a copy of the GNU General Public License |
18
|
|
|
* along with Tuleap. If not, see <http://www.gnu.org/licenses/>. |
19
|
|
|
*/ |
20
|
|
|
|
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* The content of the renderer |
24
|
|
|
*/ |
25
|
|
|
class Cardwall_RendererPresenter extends Cardwall_BoardPresenter { |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* @var Tracker_FormElement_Field_Selectbox |
29
|
|
|
*/ |
30
|
|
|
public $field; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* @var bool |
34
|
|
|
*/ |
35
|
|
|
public $has_columns; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @var string |
39
|
|
|
*/ |
40
|
|
|
public $warn_please_choose; |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @var string |
44
|
|
|
*/ |
45
|
|
|
public $warn_no_values; |
46
|
|
|
|
47
|
|
|
public $is_display_avatar_selected = ""; |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* @param Cardwall_Board $board The board |
51
|
|
|
* @param string $redirect_parameter the redirect paramter to add to various url |
52
|
|
|
* @param Tracker_FormElement_Field_Selectbox $field form to choose the column. false if no form (in widget) (thus no typehinting) |
53
|
|
|
* @param $form |
54
|
|
|
*/ |
55
|
|
|
public function __construct(Cardwall_Board $board, $redirect_parameter, $field, $form) { |
56
|
|
|
parent::__construct($board, $redirect_parameter); |
57
|
|
|
$hp = Codendi_HTMLPurifier::instance(); |
58
|
|
|
$this->nifty = Toggler::getClassname('cardwall_board-nifty') == 'toggler' ? 'nifty' : false; |
|
|
|
|
59
|
|
|
$this->swimline_title = ''; |
60
|
|
|
$this->has_swimline_header = false; |
61
|
|
|
$this->field = $field ? $field : false; |
|
|
|
|
62
|
|
|
$this->form = $form ? $form : false; |
63
|
|
|
$this->has_columns = count($this->board->columns) > 0; |
64
|
|
|
$this->warn_please_choose = $GLOBALS['Language']->getText('plugin_cardwall', 'warn_please_choose'); |
65
|
|
|
$field_label = $field ? $hp->purify($this->field->getLabel()) : '###'; |
66
|
|
|
$this->warn_no_values = $GLOBALS['Language']->getText('plugin_cardwall', 'warn_no_values', $field_label); |
67
|
|
|
} |
68
|
|
|
} |
69
|
|
|
|
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.
For example, imagine you have a variable
$accountId
that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to theid
property of an instance of theAccount
class. This class holds a proper account, so the id value must no longer be false.Either this assignment is in error or a type check should be added for that assignment.