Conditions | 16 |
Paths | 8192 |
Total Lines | 66 |
Code Lines | 36 |
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 |
||
113 | protected function addSummaryDataOnPageWorkStatus(array $ouvrageData): void |
||
114 | { |
||
115 | // paramètre inconnu |
||
116 | if (preg_match_all( |
||
117 | "#\|[^|]+<!-- ?(PARAMETRE [^>]+ N'EXISTE PAS|VALEUR SANS NOM DE PARAMETRE|ERREUR [^>]+) ?-->#", |
||
118 | $ouvrageData['opti'], |
||
119 | $matches |
||
120 | ) > 0 |
||
121 | ) { |
||
122 | foreach ($matches[0] as $line) { |
||
123 | $this->addErrorWarning($ouvrageData['page'], $line); |
||
124 | } |
||
125 | // $this->pageWorkStatus->botFlag = false; |
||
126 | $this->addSummaryTag('paramètre non corrigé'); |
||
127 | } |
||
128 | |||
129 | // ISBN invalide |
||
130 | if (preg_match("#isbn invalide ?=[^|}]+#i", $ouvrageData['opti'], $matches) > 0) { |
||
131 | $this->addErrorWarning($ouvrageData['page'], $matches[0]); |
||
132 | $this->pageWorkStatus->botFlag = false; |
||
133 | $this->addSummaryTag('ISBN invalide 💩'); |
||
134 | } |
||
135 | |||
136 | // Edits avec ajout conséquent de donnée |
||
137 | if (preg_match('#distinction des auteurs#', $ouvrageData['modifs']) > 0) { |
||
138 | $this->pageWorkStatus->botFlag = false; |
||
139 | $this->addSummaryTag('distinction auteurs 🧠'); |
||
140 | } |
||
141 | // prédiction paramètre correct |
||
142 | if (preg_match('#[^,]+(=>|⇒)[^,]+#', $ouvrageData['modifs'], $matches) > 0) { |
||
143 | $this->pageWorkStatus->botFlag = false; |
||
144 | $this->addSummaryTag($matches[0]); |
||
145 | } |
||
146 | if (preg_match('#\+\+sous-titre#', $ouvrageData['modifs']) > 0) { |
||
147 | $this->pageWorkStatus->botFlag = false; |
||
148 | $this->addSummaryTag('+sous-titre'); |
||
149 | } |
||
150 | if (preg_match('#\+lieu#', $ouvrageData['modifs']) > 0) { |
||
151 | $this->addSummaryTag('+lieu'); |
||
152 | } |
||
153 | if (preg_match('#tracking#', $ouvrageData['modifs']) > 0) { |
||
154 | $this->addSummaryTag('tracking'); |
||
155 | } |
||
156 | if (preg_match('#présentation en ligne#', $ouvrageData['modifs']) > 0) { |
||
157 | $this->addSummaryTag('+présentation en ligne✨'); |
||
158 | } |
||
159 | if (preg_match('#distinction auteurs#', $ouvrageData['modifs']) > 0) { |
||
160 | $this->addSummaryTag('distinction auteurs 🧠'); |
||
161 | } |
||
162 | if (preg_match('#\+lire en ligne#', $ouvrageData['modifs']) > 0) { |
||
163 | $this->addSummaryTag('+lire en ligne✨'); |
||
164 | } |
||
165 | if (preg_match('#\+lien #', $ouvrageData['modifs']) > 0) { |
||
166 | $this->addSummaryTag('wikif'); |
||
167 | } |
||
168 | |||
169 | if (preg_match('#\+éditeur#', $ouvrageData['modifs']) > 0) { |
||
170 | $this->addSummaryTag('éditeur'); |
||
171 | } |
||
172 | // if (preg_match('#\+langue#', $data['modifs']) > 0) { |
||
173 | // $this->addSummaryTag('langue'); |
||
174 | // } |
||
175 | |||
176 | // mention BnF si ajout donnée + ajout identifiant bnf= |
||
177 | if (!empty($this->pageWorkStatus->importantSummary) && preg_match('#BnF#i', $ouvrageData['modifs'], $matches) > 0) { |
||
178 | $this->addSummaryTag('©[[BnF]]'); |
||
179 | } |
||
182 |