Conditions | 10 |
Paths | 384 |
Total Lines | 30 |
Code Lines | 19 |
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 |
||
107 | protected function generateSummaryText(): string |
||
108 | { |
||
109 | $prefixSummary = ($this->summary->isBotFlag()) ? 'bot ' : ''; |
||
110 | $suffix = ''; |
||
111 | if (isset($this->summary->memo['count article'])) { |
||
112 | $suffix .= ' '.$this->summary->memo['count article'].'x {article}'; |
||
113 | } |
||
114 | if (isset($this->summary->memo['count lien web'])) { |
||
115 | $suffix .= ' '.$this->summary->memo['count lien web'].'x {lien web}'; |
||
116 | } |
||
117 | if (isset($this->summary->memo['presse'])) { |
||
118 | $suffix .= ' 🗞️'; // 🗞️ 📰 |
||
119 | } |
||
120 | if (isset($this->summary->memo['science'])) { |
||
121 | $suffix .= ' 🧪'; // 🧪 🔬 |
||
122 | } |
||
123 | if (isset($this->summary->memo['count lien brisé'])) { |
||
124 | $suffix .= ', ⚠️️️lien brisé'; //⚠️💩 |
||
125 | $suffix .= ($this->summary->memo['count lien brisé'] > 1) ? ' x'.$this->summary->memo['count lien brisé'] : |
||
126 | ''; |
||
127 | } |
||
128 | if (isset($this->summary->memo['accès url non libre'])) { |
||
129 | $suffix .= ' 🔒'; |
||
130 | } |
||
131 | |||
132 | if ($this->summary->citationNumber >= 8) { |
||
133 | $suffix .= ' 🔥'; |
||
134 | } |
||
135 | |||
136 | return $prefixSummary.$this->summary->taskName.$suffix; |
||
137 | } |
||
140 |