| Conditions | 2 |
| Paths | 1 |
| Total Lines | 88 |
| 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 |
||
| 67 | protected function toNode() |
||
| 68 | { |
||
| 69 | $ideEmpregador = $this->node->getElementsByTagName('ideEmpregador')->item(0); |
||
| 70 | //o idEvento pode variar de evento para evento |
||
| 71 | //então cada factory individualmente terá de construir o seu |
||
| 72 | $ideEvento = $this->dom->createElement("ideEvento"); |
||
| 73 | $this->dom->addChild( |
||
| 74 | $ideEvento, |
||
| 75 | "indRetif", |
||
| 76 | $this->std->indretif, |
||
| 77 | true |
||
| 78 | ); |
||
| 79 | $this->dom->addChild( |
||
| 80 | $ideEvento, |
||
| 81 | "nrRecibo", |
||
| 82 | ($this->std->indretif == 2) ? $this->std->nrrecibo : null, |
||
| 83 | false |
||
| 84 | ); |
||
| 85 | $this->dom->addChild( |
||
| 86 | $ideEvento, |
||
| 87 | "tpAmb", |
||
| 88 | $this->tpAmb, |
||
| 89 | true |
||
| 90 | ); |
||
| 91 | $this->dom->addChild( |
||
| 92 | $ideEvento, |
||
| 93 | "procEmi", |
||
| 94 | $this->procEmi, |
||
| 95 | true |
||
| 96 | ); |
||
| 97 | $this->dom->addChild( |
||
| 98 | $ideEvento, |
||
| 99 | "verProc", |
||
| 100 | $this->verProc, |
||
| 101 | true |
||
| 102 | ); |
||
| 103 | $this->node->insertBefore($ideEvento, $ideEmpregador); |
||
| 104 | $ideVinculo = $this->dom->createElement("ideVinculo"); |
||
| 105 | $this->dom->addChild( |
||
| 106 | $ideVinculo, |
||
| 107 | "cpfTrab", |
||
| 108 | $this->std->cpftrab, |
||
| 109 | true |
||
| 110 | ); |
||
| 111 | $this->dom->addChild( |
||
| 112 | $ideVinculo, |
||
| 113 | "matricula", |
||
| 114 | $this->std->matricula, |
||
| 115 | true |
||
| 116 | ); |
||
| 117 | $this->node->appendChild($ideVinculo); |
||
| 118 | $infoBaixa = $this->dom->createElement("infoBaixa"); |
||
| 119 | $this->dom->addChild( |
||
| 120 | $infoBaixa, |
||
| 121 | "mtvDeslig", |
||
| 122 | $this->std->mtvdeslig, |
||
| 123 | true |
||
| 124 | ); |
||
| 125 | $this->dom->addChild( |
||
| 126 | $infoBaixa, |
||
| 127 | "dtDeslig", |
||
| 128 | $this->std->dtdeslig, |
||
| 129 | true |
||
| 130 | ); |
||
| 131 | $this->dom->addChild( |
||
| 132 | $infoBaixa, |
||
| 133 | "dtProjFimAPI", |
||
| 134 | $this->std->dtprojfimapi, |
||
| 135 | false |
||
| 136 | ); |
||
| 137 | $this->dom->addChild( |
||
| 138 | $infoBaixa, |
||
| 139 | "nrProcTrab", |
||
| 140 | $this->std->nrproctrab, |
||
| 141 | true |
||
| 142 | ); |
||
| 143 | $this->dom->addChild( |
||
| 144 | $infoBaixa, |
||
| 145 | "observacao", |
||
| 146 | $this->std->observacao, |
||
| 147 | false |
||
| 148 | ); |
||
| 149 | $this->node->appendChild($infoBaixa); |
||
| 150 | |||
| 151 | $this->eSocial->appendChild($this->node); |
||
| 152 | //$this->xml = $this->dom->saveXML($this->eSocial); |
||
| 153 | $this->sign(); |
||
| 154 | } |
||
| 155 | } |
||
| 156 |