| Conditions | 2 |
| Paths | 2 |
| Total Lines | 21 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 8 | public function gerar_arquivo() { |
||
| 9 | $this->cabecalho(); |
||
| 10 | |||
| 11 | $this->corpo(); |
||
| 12 | |||
| 13 | $this->rodape(); |
||
|
|
|||
| 14 | |||
| 15 | $name = date('Y-m-d') . uniqid() . ".txt"; |
||
| 16 | |||
| 17 | $dir = APP . 'webroot/uploads/venda/fiscal/'; |
||
| 18 | |||
| 19 | $nameFull = $dir . $name; |
||
| 20 | |||
| 21 | $file = fopen($nameFull, "w") or die("Não foi possivel imprimir arquivo!"); |
||
| 22 | |||
| 23 | fwrite($file, $this->txt); |
||
| 24 | |||
| 25 | fclose($file); |
||
| 26 | |||
| 27 | return $name; |
||
| 28 | } |
||
| 29 | |||
| 63 | } |
PHP Analyzer performs a side-effects analysis of your code. A side-effect is basically anything that might be visible after the scope of the method is left.
Let’s take a look at an example:
If we look at the
getEmail()method, we can see that it has no side-effect. Whether you call this method or not, no future calls to other methods are affected by this. As such code as the following is useless:On the hand, if we look at the
setEmail(), this method _has_ side-effects. In the following case, we could not remove the method call: