| Conditions | 7 |
| Paths | 19 |
| Total Lines | 20 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 24 | public function actionUpdateName($names) |
||
| 25 | { |
||
| 26 | $rows = StringHelper::explode($names, ';', true, true); |
||
| 27 | foreach ($rows as $row) { |
||
| 28 | $username = StringHelper::explode($row); |
||
| 29 | if (count($username) != 3) { |
||
| 30 | $this->stdout("Wrong format!\n", Console::BG_RED); |
||
| 31 | } |
||
| 32 | $account = Account::findOne(['username' => $username['0']]); |
||
| 33 | if ($account) { |
||
| 34 | if ($username['1']) { |
||
| 35 | $account->username = $username['1']; |
||
| 36 | } |
||
| 37 | if ($username['2']) { |
||
| 38 | $account->name = $username['2']; |
||
| 39 | } |
||
| 40 | if (!$account->update()) { |
||
|
|
|||
| 41 | echo Console::errorSummary($account); |
||
| 42 | |||
| 43 | return ExitCode::DATAERR; |
||
| 44 | } |
||
| 49 | } |
In PHP, under loose comparison (like
==, or!=, orswitchconditions), values of different types might be equal.For
integervalues, zero is a special case, in particular the following results might be unexpected: