Conditions | 2 |
Paths | 2 |
Total Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
11 | 30 | private function getIncrementedPath($filePath) |
|
12 | { |
||
13 | 30 | $originalFilePath = $filePath; |
|
14 | 30 | $increment = 1; |
|
15 | |||
16 | 30 | while ($this->fileExists($filePath)) { |
|
17 | 30 | $filePath = $this->incrementPath($originalFilePath, $increment); |
|
18 | 30 | $increment++; |
|
19 | 10 | } |
|
20 | |||
21 | 30 | return $filePath; |
|
22 | } |
||
23 | |||
59 |
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: