| Conditions | 12 |
| Paths | 58 |
| Total Lines | 56 |
| Code Lines | 28 |
| 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 |
||
| 68 | public function processRefContent(string $refContent): string |
||
| 69 | { |
||
| 70 | // todo // hack Temporary Skip URL |
||
| 71 | if (preg_match('#books\.google#', $refContent)) { |
||
| 72 | return $refContent; |
||
| 73 | } |
||
| 74 | |||
| 75 | try { |
||
| 76 | $result = $this->transformer->process($refContent, $this->summary); |
||
|
|
|||
| 77 | } catch (Throwable $e) { |
||
| 78 | $this->log->critical('Error patate34 ' . $e->getMessage() . " " . $e->getFile() . ":" . $e->getLine()); |
||
| 79 | // TODO : parse $e->message -> variable process, taskName, botflag... |
||
| 80 | |||
| 81 | return $refContent; |
||
| 82 | } |
||
| 83 | |||
| 84 | if (trim($result) === trim($refContent)) { |
||
| 85 | return $refContent; |
||
| 86 | } |
||
| 87 | |||
| 88 | // Gestion semi-auto : todo CONDITION POURRI FAUSSE $this->transformer->skipUnauthorised |
||
| 89 | |||
| 90 | $this->printDiff($refContent, $result, 'echo'); |
||
| 91 | if (!$this->autoOrYesConfirmation('Conserver cette modif ?')) { |
||
| 92 | return $refContent; |
||
| 93 | } |
||
| 94 | |||
| 95 | |||
| 96 | if (preg_match('#{{lien brisé#i', $result)) { |
||
| 97 | $this->summary->memo['count lien brisé'] = 1 + ($this->summary->memo['count lien brisé'] ?? 0); |
||
| 98 | if ($this->summary->memo['count lien brisé'] >= self::DEAD_LINK_NO_BOTFLAG) { |
||
| 99 | $this->summary->setBotFlag(false); |
||
| 100 | } |
||
| 101 | } |
||
| 102 | |||
| 103 | if (str_contains($result, self::STRING_WIKIWIX_URL)) { |
||
| 104 | $this->summary->memo['wikiwix'] = 1 + ($this->summary->memo['wikiwix'] ?? 0); |
||
| 105 | if ($this->summary->memo['wikiwix'] >= self::DEAD_LINK_NO_BOTFLAG) { |
||
| 106 | $this->summary->setBotFlag(false); |
||
| 107 | } |
||
| 108 | } |
||
| 109 | // not httpS in 2023 |
||
| 110 | if (str_contains($result, self::STRING_WAYBACK_URL)) { |
||
| 111 | $this->summary->memo['wayback'] = 1 + ($this->summary->memo['wayback'] ?? 0); |
||
| 112 | if ($this->summary->memo['wayback'] >= self::DEAD_LINK_NO_BOTFLAG) { |
||
| 113 | $this->summary->setBotFlag(false); |
||
| 114 | } |
||
| 115 | } |
||
| 116 | |||
| 117 | if ($this->summary->citationNumber >= self::CITATION_NUMBER_NO_BOTFLAG) { |
||
| 118 | $this->summary->setBotFlag(false); |
||
| 119 | } |
||
| 120 | |||
| 121 | $this->summary->memo['count URL'] = 1 + ($this->summary->memo['count URL'] ?? 0); |
||
| 122 | |||
| 123 | return $result; |
||
| 124 | } |
||
| 180 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.