| Conditions | 6 |
| Paths | 20 |
| Total Lines | 26 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | public function exportAccount($accounts, $filename, $password = false, $flagCI = false) |
||
| 8 | { |
||
| 9 | $this->storage->put($filename, ''); |
||
|
|
|||
| 10 | |||
| 11 | $count = count($accounts); |
||
| 12 | |||
| 13 | if ($flagCI === false) { |
||
| 14 | $bar = $this->output->createProgressBar($count); |
||
| 15 | } |
||
| 16 | |||
| 17 | foreach ($accounts as $account) { |
||
| 18 | $record = "{$account->netlogin}"; |
||
| 19 | $record .= $password ? ":{$account->netpass}" : ''; |
||
| 20 | $this->storage->prepend($filename, $record); |
||
| 21 | if (isset($bar)) { |
||
| 22 | $bar->advance(); |
||
| 23 | } |
||
| 24 | } |
||
| 25 | |||
| 26 | if (isset($bar)) { |
||
| 27 | $bar->finish(); |
||
| 28 | $this->info("\n"); |
||
| 29 | } |
||
| 30 | |||
| 31 | return $count; |
||
| 32 | } |
||
| 33 | } |
||
| 34 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: