| Conditions | 10 | 
| Paths | 10 | 
| Total Lines | 64 | 
| Code Lines | 41 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 3 | ||
| Bugs | 1 | Features | 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  | 
            ||
| 51 | // private function process(): ?ArticleOrLienBriseInterface  | 
            ||
| 52 | //    { | 
            ||
| 53 | // $mapper = PublisherMapperFactory::fromURL($this->url);  | 
            ||
| 54 | //        if (!$mapper) { | 
            ||
| 55 | // return null;  | 
            ||
| 56 | // }  | 
            ||
| 57 | // sleep(10);  | 
            ||
| 58 | // $arrayLD = [];  | 
            ||
| 59 | //        try { | 
            ||
| 60 | // $html = $this->publisherAction->getHTMLSource();  | 
            ||
| 61 | // $htmlData = $this->publisherAction->extractWebData($html);  | 
            ||
| 62 | //        } catch (Throwable $e) { | 
            ||
| 63 | // if (strpos($e->getMessage(), '404 Not Found') !== false  | 
            ||
| 64 | // || strpos($e->getMessage(), '410 Gone') !== false  | 
            ||
| 65 | //            ) { | 
            ||
| 66 | //                dump('****** lien brisé !!!!'); | 
            ||
| 67 | //                $lienBrise = WikiTemplateFactory::create('lien brisé'); | 
            ||
| 68 | // $lienBrise->hydrate(  | 
            ||
| 69 | // [  | 
            ||
| 70 | // 'url' => $this->url,  | 
            ||
| 71 | // 'titre' => 'Article de presse',  | 
            ||
| 72 | //                        'brisé le' => date('d-m-Y'), | 
            ||
| 73 | // ],  | 
            ||
| 74 | // true  | 
            ||
| 75 | // );  | 
            ||
| 76 | //  | 
            ||
| 77 | // return $lienBrise; // ok  | 
            ||
| 78 | // }  | 
            ||
| 79 | // echo "*** Erreur ".$e->getMessage()."\n";  | 
            ||
| 80 | //  | 
            ||
| 81 | // return null;  | 
            ||
| 82 | // }  | 
            ||
| 83 | //  | 
            ||
| 84 | //        if (empty($htmlData)) { | 
            ||
| 85 | // echo "*** Pas de data Json-LD ou meta\n";  | 
            ||
| 86 | //  | 
            ||
| 87 | // return null;  | 
            ||
| 88 | // }  | 
            ||
| 89 | // $htmlData['url'] = $this->url;  | 
            ||
| 90 | //  | 
            ||
| 91 | //        try { | 
            ||
| 92 | // $articleData = $mapper->process($htmlData);  | 
            ||
| 93 | //        } catch (Throwable $e) { | 
            ||
| 94 | // echo sprintf(  | 
            ||
| 95 | // "SKIP : %s %s:%s \n",  | 
            ||
| 96 | // $e->getMessage(),  | 
            ||
| 97 | // $e->getFile(),  | 
            ||
| 98 | // $e->getLine()  | 
            ||
| 99 | // );  | 
            ||
| 100 | //  | 
            ||
| 101 | // return null;  | 
            ||
| 102 | // }  | 
            ||
| 103 | //  | 
            ||
| 104 | //        if (!empty($articleData) && !empty($articleData['titre'])) { | 
            ||
| 105 | //            $article = WikiTemplateFactory::create('article'); | 
            ||
| 106 | // $article->hydrate($articleData, true);  | 
            ||
| 107 | //            if (!$article->hasParamValue('lire en ligne')) { | 
            ||
| 108 | //                $article->setParam('lire en ligne', $this->url); | 
            ||
| 109 | // }  | 
            ||
| 110 | //  | 
            ||
| 111 | // return $article; // ok  | 
            ||
| 112 | // }  | 
            ||
| 113 | //  | 
            ||
| 114 | // return null;  | 
            ||
| 115 | // }  | 
            ||
| 123 |