Conditions | 7 |
Paths | 19 |
Total Lines | 20 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
28 | public function actionUpdateName($names) |
||
29 | { |
||
30 | $rows = StringHelper::explode($names, ';', true, true); |
||
31 | foreach ($rows as $row) { |
||
32 | $username = StringHelper::explode($row); |
||
33 | if (count($username) != 3) { |
||
34 | $this->stdout("Wrong format!\n", Console::BG_RED); |
||
35 | } |
||
36 | $account = Account::findOne(['username' => $username['0']]); |
||
37 | if ($account) { |
||
38 | if ($username['1']) { |
||
39 | $account->username = $username['1']; |
||
40 | } |
||
41 | if ($username['2']) { |
||
42 | $account->name = $username['2']; |
||
|
|||
43 | } |
||
44 | if (!$account->update()) { |
||
45 | echo Console::errorSummary($account); |
||
46 | |||
47 | return ExitCode::DATAERR; |
||
48 | } |
||
53 | } |