| Conditions | 8 |
| Paths | 22 |
| Total Lines | 29 |
| Code Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 40 | public function handle(): ?OuvrageTemplate |
||
| 41 | { |
||
| 42 | try { |
||
| 43 | $this->logger->debug('BIBLIO NAT FRANCE...'); |
||
| 44 | // BnF sait pas trouver un vieux livre (10) d'après ISBN-13... FACEPALM ! |
||
| 45 | $bnfOuvrage = null; |
||
| 46 | if ($this->isbn10) { |
||
| 47 | $bnfOuvrage = OuvrageFactory::BnfFromIsbn($this->isbn10); |
||
| 48 | sleep(2); |
||
| 49 | } |
||
| 50 | if (!$this->isbn10 || null === $bnfOuvrage || empty($bnfOuvrage->getParam('titre'))) { |
||
| 51 | $bnfOuvrage = OuvrageFactory::BnfFromIsbn($this->isbn); |
||
| 52 | } |
||
| 53 | |||
| 54 | } catch (Throwable $e) { |
||
| 55 | if (strpos($e->getMessage(), 'Could not resolve host') !== false) { |
||
| 56 | throw $e; |
||
| 57 | } |
||
| 58 | $this->logger->error(sprintf( |
||
| 59 | "*** ERREUR BnF Isbn Search %s %s %s \n", |
||
| 60 | $e->getMessage(), |
||
| 61 | $e->getFile(), |
||
| 62 | $e->getLine() |
||
| 63 | )); |
||
| 64 | |||
| 65 | return null; |
||
| 66 | } |
||
| 67 | |||
| 68 | return $bnfOuvrage instanceof OuvrageTemplate ? $bnfOuvrage : null; |
||
|
|
|||
| 69 | } |
||
| 70 | } |