| Conditions | 11 |
| Paths | 1024 |
| Total Lines | 35 |
| Code Lines | 21 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 22 | public function tearDown(): void |
||
| 23 | { |
||
| 24 | // copy |
||
| 25 | if (is_file($this->getTestDir() . 'other' . DIRECTORY_SEPARATOR . 'tst1')) { |
||
| 26 | unlink($this->getTestDir() . 'other' . DIRECTORY_SEPARATOR . 'tst1'); |
||
| 27 | } |
||
| 28 | if (is_file($this->getTestDir() . 'other' . DIRECTORY_SEPARATOR . 'any' . DIRECTORY_SEPARATOR . 'tst2')) { |
||
| 29 | unlink($this->getTestDir() . 'other' . DIRECTORY_SEPARATOR . 'any' . DIRECTORY_SEPARATOR . 'tst2'); |
||
| 30 | } |
||
| 31 | if (is_file($this->getTestDir() . 'other' . DIRECTORY_SEPARATOR . 'any' . DIRECTORY_SEPARATOR . 'tst3')) { |
||
| 32 | unlink($this->getTestDir() . 'other' . DIRECTORY_SEPARATOR . 'any' . DIRECTORY_SEPARATOR . 'tst3'); |
||
| 33 | } |
||
| 34 | if (is_dir($this->getTestDir() . 'other' . DIRECTORY_SEPARATOR . 'any')) { |
||
| 35 | rmdir($this->getTestDir() . 'other' . DIRECTORY_SEPARATOR . 'any'); |
||
| 36 | } |
||
| 37 | if (is_dir($this->getTestDir() . 'other')) { |
||
| 38 | rmdir($this->getTestDir() . 'other'); |
||
| 39 | } |
||
| 40 | // original |
||
| 41 | if (is_file($this->getTestDir() . 'some' . DIRECTORY_SEPARATOR . 'tst1')) { |
||
| 42 | unlink($this->getTestDir() . 'some' . DIRECTORY_SEPARATOR . 'tst1'); |
||
| 43 | } |
||
| 44 | if (is_file($this->getTestDir() . 'some' . DIRECTORY_SEPARATOR . 'any' . DIRECTORY_SEPARATOR . 'tst2')) { |
||
| 45 | unlink($this->getTestDir() . 'some' . DIRECTORY_SEPARATOR . 'any' . DIRECTORY_SEPARATOR . 'tst2'); |
||
| 46 | } |
||
| 47 | if (is_file($this->getTestDir() . 'some' . DIRECTORY_SEPARATOR . 'any' . DIRECTORY_SEPARATOR . 'tst3')) { |
||
| 48 | unlink($this->getTestDir() . 'some' . DIRECTORY_SEPARATOR . 'any' . DIRECTORY_SEPARATOR . 'tst3'); |
||
| 49 | } |
||
| 50 | if (is_dir($this->getTestDir() . 'some' . DIRECTORY_SEPARATOR . 'any')) { |
||
| 51 | rmdir($this->getTestDir() . 'some' . DIRECTORY_SEPARATOR . 'any'); |
||
| 52 | } |
||
| 53 | if (is_dir($this->getTestDir() . 'some')) { |
||
| 54 | rmdir($this->getTestDir() . 'some'); |
||
| 55 | } |
||
| 56 | parent::tearDown(); |
||
| 57 | } |
||
| 87 |