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