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