| Conditions | 12 |
| Paths | 1025 |
| Total Lines | 39 |
| Code Lines | 31 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 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 |
||
| 30 | protected function loadData(LoteriaNumbersNode $numbersNode) |
||
| 31 | { |
||
| 32 | $table = $this->domdocument->getElementsByTagName('table')->item(0); |
||
| 33 | $trs = $table->getElementsByTagName('tr'); |
||
| 34 | |||
| 35 | for ($concursoHtml = 1; $concursoHtml < $trs->length; $concursoHtml++) { |
||
| 36 | $tds = $trs->item($concursoHtml)->getElementsByTagName('td'); |
||
| 37 | |||
| 38 | $nrconcurso = $tds->item($numbersNode->getNumberConcurso())->nodeValue; |
||
| 39 | |||
| 40 | $data = $tds->item($numbersNode->getDataConcurso())->nodeValue; |
||
| 41 | $dezenas = $this->loadDezenas($numbersNode, $tds); |
||
| 42 | $arrecadacao = isset($tds->item($numbersNode->getArrecadacaoConcurso())->nodeValue) ? $tds->item($numbersNode->getArrecadacaoConcurso())->nodeValue : ""; |
||
| 43 | $totalGanhadoresPrimeiroPremio = isset($tds->item($numbersNode->getTotalGanhadoresPrimeiroPremio())->nodeValue) ? $tds->item($numbersNode->getTotalGanhadoresPrimeiroPremio())->nodeValue : ""; |
||
| 44 | $totalGanhadoresSegundoPremio = isset($tds->item($numbersNode->getTotalGanhadoresSegundoPremio())->nodeValue) ? $tds->item($numbersNode->getTotalGanhadoresSegundoPremio())->nodeValue : ""; |
||
| 45 | $totalGanhadoresTerceiroPremio = isset($tds->item($numbersNode->getTotalGanhadoresTerceiroPremio())->nodeValue) ? $tds->item($numbersNode->getTotalGanhadoresTerceiroPremio())->nodeValue : ""; |
||
| 46 | $valorGanhadoresPrimeiroPremio = isset($tds->item($numbersNode->getValorGanhadoresPrimeiroPremio())->nodeValue) ? $tds->item($numbersNode->getValorGanhadoresPrimeiroPremio())->nodeValue : ""; |
||
| 47 | $valorGanhadoresSegundoPremio = isset($tds->item($numbersNode->getValorGanhadoresSegundoPremio())->nodeValue) ? $tds->item($numbersNode->getValorGanhadoresSegundoPremio())->nodeValue : ""; |
||
| 48 | $valorGanhadoresTerceiroPremio = isset($tds->item($numbersNode->getValorGanhadoresTerceiroPremio())->nodeValue) ? $tds->item($numbersNode->getValorGanhadoresTerceiroPremio())->nodeValue : ""; |
||
| 49 | $valorAcumulado = isset($tds->item($numbersNode->getValorAcumuladoConcurso())->nodeValue) ? $tds->item($numbersNode->getValorAcumuladoConcurso())->nodeValue : ""; |
||
| 50 | $valorEstimadoProximoConcurso = isset($tds->item($numbersNode->getValorEstimadoProximoConcurso())->nodeValue) ? $tds->item($numbersNode->getValorEstimadoProximoConcurso())->nodeValue : ""; |
||
| 51 | $acumulado = $totalGanhadoresPrimeiroPremio === '0' ? 'SIM' : 'NÃO'; |
||
| 52 | |||
| 53 | $this->data[$nrconcurso] = [ |
||
| 54 | 'data' => $data, |
||
| 55 | 'dezenas' => $dezenas, |
||
| 56 | 'arrecadacao' => $arrecadacao, |
||
| 57 | 'total_ganhadores_primeiro_premio' => $totalGanhadoresPrimeiroPremio, |
||
| 58 | 'total_ganhadores_segundo_premio' => $totalGanhadoresSegundoPremio, |
||
| 59 | 'total_ganhadores_terceiro_premio' => $totalGanhadoresTerceiroPremio, |
||
| 60 | 'valor_ganhadores_primeiro_premio' => $valorGanhadoresPrimeiroPremio, |
||
| 61 | 'valor_ganhadores_segundo_premio' => $valorGanhadoresSegundoPremio, |
||
| 62 | 'valor_ganhadores_terceiro_premio' => $valorGanhadoresTerceiroPremio, |
||
| 63 | 'acumulado' => $acumulado, |
||
| 64 | 'valor_acumulado' => $valorAcumulado, |
||
| 65 | 'valor_estimado_proximo_concurso' => $valorEstimadoProximoConcurso, |
||
| 66 | ]; |
||
| 67 | } |
||
| 68 | } |
||
| 69 | |||
| 92 |