| Total Complexity | 8 | 
| Total Lines | 46 | 
| Duplicated Lines | 0 % | 
| Changes | 1 | ||
| Bugs | 0 | Features | 0 | 
| 1 | <?php  | 
            ||
| 15 | class CitationsAllCompletedValidator implements ValidatorInterface  | 
            ||
| 16 | { | 
            ||
| 17 | /**  | 
            ||
| 18 | * @var array  | 
            ||
| 19 | */  | 
            ||
| 20 | protected $citationCollection;  | 
            ||
| 21 | /**  | 
            ||
| 22 | * @var DbAdapterInterface  | 
            ||
| 23 | */  | 
            ||
| 24 | protected $db;  | 
            ||
| 25 | /**  | 
            ||
| 26 | * @var LoggerInterface  | 
            ||
| 27 | */  | 
            ||
| 28 | protected $log;  | 
            ||
| 29 | |||
| 30 | public function __construct(array $citationCollection, LoggerInterface $log, DbAdapterInterface $db)  | 
            ||
| 31 |     { | 
            ||
| 32 | $this->citationCollection = $citationCollection;  | 
            ||
| 33 | $this->log = $log;  | 
            ||
| 34 | $this->db = $db;  | 
            ||
| 35 | }  | 
            ||
| 36 | |||
| 37 | public function validate(): bool  | 
            ||
| 38 |     { | 
            ||
| 39 |         foreach ($this->citationCollection as $citation) { | 
            ||
| 40 |             if (!$this->isCitationCompleted($citation)) { | 
            ||
| 41 |                 $this->log->warning("SKIP : Amélioration incomplet de l'article. sleep 10min"); | 
            ||
| 42 | sleep(600); // todo move/event  | 
            ||
| 43 | |||
| 44 | return false;  | 
            ||
| 45 | }  | 
            ||
| 46 | }  | 
            ||
| 47 | return true;  | 
            ||
| 48 | }  | 
            ||
| 49 | |||
| 50 | protected function isCitationCompleted(array $pageOuvrage): bool  | 
            ||
| 61 | }  | 
            ||
| 62 | }  |