| Total Complexity | 4 |
| Total Lines | 41 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | class IsbnFacade extends Isbn implements IsbnConverterInterface |
||
| 16 | { |
||
| 17 | public const ERROR_EMPTY = 'aucun code fourni'; |
||
| 18 | |||
| 19 | public const ERROR_INVALID_CHARACTERS = 'caractères invalides'; |
||
| 20 | |||
| 21 | public const ERROR_INVALID_LENGTH = 'trop court ou trop long'; |
||
| 22 | |||
| 23 | public const ERROR_INVALID_PRODUCT_CODE = 'code produit devrait être 978 ou 979'; |
||
| 24 | |||
| 25 | public const ERROR_INVALID_COUNTRY_CODE = 'code pays inconnu'; |
||
| 26 | |||
| 27 | // TODO: complete array. |
||
| 28 | public const ISBN_LANGUAGE_CODES |
||
| 29 | = [ |
||
| 30 | '0' => 'en', |
||
| 31 | '1' => 'en', |
||
| 32 | '2' => 'fr', |
||
| 33 | '3' => 'de', |
||
| 34 | '4' => 'ja', |
||
| 35 | '5' => 'ru', |
||
| 36 | '88' => 'it', |
||
| 37 | ]; |
||
| 38 | |||
| 39 | public static function isbn2ean(string $isbn): string |
||
| 40 | { |
||
| 41 | return preg_replace('#[^0-9X]#i', '', $isbn); |
||
| 42 | } |
||
| 43 | |||
| 44 | public function getCountryShortName(): ?string |
||
| 56 | } |
||
| 57 | } |
||
| 58 |