1 | <?php |
||
3 | class EmailReminder_ReplacerClassBase extends Object implements EmailReminder_ReplacerClassInterface |
||
4 | { |
||
5 | protected $replaceArray = array( |
||
6 | '[PASSWORD_REMINDER_LINK]' => array( |
||
7 | 'Title' => 'Password reminder page', |
||
8 | 'Method' => 'PasswordReminderLink' |
||
9 | ), |
||
10 | '[LOGIN_LINK]' => array( |
||
11 | 'Title' => 'Login Page', |
||
12 | 'Method' => 'LoginLink' |
||
13 | ), |
||
14 | '[DAYS]' => array( |
||
15 | 'Title' => 'Replaces with the number of days, as set', |
||
16 | 'Method' => 'Days' |
||
17 | ), |
||
18 | '[BEFORE_OR_AFTER]' => array( |
||
19 | 'Title' => 'Replaces with before or after expiry date, as set', |
||
20 | 'Method' => 'BeforeOrAfter' |
||
21 | ) |
||
22 | ); |
||
23 | |||
24 | /** |
||
25 | * |
||
26 | * @return array |
||
27 | */ |
||
28 | public function getReplaceArray() |
||
32 | |||
33 | /** |
||
34 | * |
||
35 | * @param EmailReminder $reminder |
||
36 | * @param DataObject $record |
||
37 | * @param string $str |
||
38 | * |
||
39 | * @return string |
||
40 | */ |
||
41 | public function replace($reminder, $record, $str) |
||
50 | |||
51 | |||
52 | /** |
||
53 | * |
||
54 | * @param bool $asHTML |
||
55 | * |
||
56 | * @return array |
||
57 | */ |
||
58 | public function replaceHelpList($asHTML = false) |
||
77 | |||
78 | /** |
||
79 | * |
||
80 | * @param EmailReminder $reminder |
||
81 | * @param DataObject $record |
||
82 | * @param string $searchString |
||
83 | * @param string $str |
||
84 | * |
||
85 | * @return string |
||
86 | */ |
||
87 | protected function PasswordReminderLink($reminder, $record, $searchString, $str) |
||
93 | |||
94 | /** |
||
95 | * |
||
96 | * @param EmailReminder $reminder |
||
97 | * @param DataObject $record |
||
98 | * @param string $searchString |
||
99 | * @param string $str |
||
100 | * |
||
101 | * @return string |
||
102 | */ |
||
103 | protected function LoginLink($reminder, $record, $searchString, $str) |
||
109 | |||
110 | /** |
||
111 | * |
||
112 | * @param EmailReminder $reminder |
||
113 | * @param DataObject $record |
||
114 | * @param string $searchString |
||
115 | * @param string $str |
||
116 | * |
||
117 | * @return string |
||
118 | */ |
||
119 | protected function Days($reminder, $record, $searchString, $str) |
||
125 | |||
126 | /** |
||
127 | * |
||
128 | * @param EmailReminder $reminder |
||
129 | * @param DataObject $record |
||
130 | * @param string $searchString |
||
131 | * @param string $str |
||
132 | * |
||
133 | * @return string |
||
134 | */ |
||
135 | protected function BeforeOrAfter($reminder, $record, $searchString, $str) |
||
141 | } |
||
142 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.