@@ -100,6 +100,9 @@ discard block |
||
| 100 | 100 | $this->getOrDefault($item['volumeInfo'], 'categories', [])); |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | + /** |
|
| 104 | + * @param string $key |
|
| 105 | + */ |
|
| 103 | 106 | private function getOrDefault($array, $key, $default) |
| 104 | 107 | { |
| 105 | 108 | if (array_key_exists($key, $array)) { |
@@ -114,7 +117,7 @@ discard block |
||
| 114 | 117 | * |
| 115 | 118 | * @param string $isbn |
| 116 | 119 | * |
| 117 | - * @return bool |
|
| 120 | + * @return integer |
|
| 118 | 121 | */ |
| 119 | 122 | private function isValidISBN($isbn) |
| 120 | 123 | { |
@@ -70,18 +70,18 @@ |
||
| 70 | 70 | $publishedDateFormat = 'Y-m-d'; |
| 71 | 71 | $publishedDate = DateTime::createFromFormat('Y-m-d|', $item['volumeInfo']['publishedDate']); |
| 72 | 72 | |
| 73 | - if($publishedDate == false){ |
|
| 73 | + if ($publishedDate == false) { |
|
| 74 | 74 | $publishedDateFormat = 'Y-m'; |
| 75 | 75 | $publishedDate = DateTime::createFromFormat('Y-m|', $item['volumeInfo']['publishedDate']); |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - if($publishedDate == false){ |
|
| 78 | + if ($publishedDate == false) { |
|
| 79 | 79 | $publishedDateFormat = 'Y'; |
| 80 | 80 | $publishedDate = DateTime::createFromFormat('Y|', $item['volumeInfo']['publishedDate']); |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | if ($publishedDate == false) { |
| 84 | - throw new \Exception('Was not hable to parse publishedDate: ' . $item['volumeInfo']['publishedDate']); |
|
| 84 | + throw new \Exception('Was not hable to parse publishedDate: '.$item['volumeInfo']['publishedDate']); |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | } |