@@ -49,8 +49,8 @@ |
||
| 49 | 49 | */ |
| 50 | 50 | public function handleDocuments(XisbnClient $client, $docs) |
| 51 | 51 | { |
| 52 | - $this->info('Will check ' . count($docs) . ' documents'); |
|
| 53 | - Log::info('[HarvestXisbnJob] Starting job. ' . count($docs) . ' documents to be checked.'); |
|
| 52 | + $this->info('Will check '.count($docs).' documents'); |
|
| 53 | + Log::info('[HarvestXisbnJob] Starting job. '.count($docs).' documents to be checked.'); |
|
| 54 | 54 | |
| 55 | 55 | $this->output->progressStart(count($docs)); |
| 56 | 56 | foreach ($docs as $doc) { |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | $this->warnings[] = 'Offset cannot be negative.'; |
| 26 | 26 | } elseif ($input['offset'] > $maxPaginationDepth) { |
| 27 | 27 | $input['offset'] = $maxPaginationDepth; |
| 28 | - $this->warnings[] = 'Pagination depth is limited to ' . $maxPaginationDepth . ' results.'; |
|
| 28 | + $this->warnings[] = 'Pagination depth is limited to '.$maxPaginationDepth.' results.'; |
|
| 29 | 29 | } |
| 30 | 30 | } |
| 31 | 31 | |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | $this->warnings[] = 'Limit cannot be negative.'; |
| 37 | 37 | } elseif ($input['limit'] > $maxResultsPerRequest) { |
| 38 | 38 | $input['limit'] = $maxResultsPerRequest; |
| 39 | - $this->warnings[] = 'Limiting to max ' . $maxResultsPerRequest . ' results per request.'; |
|
| 39 | + $this->warnings[] = 'Limiting to max '.$maxResultsPerRequest.' results per request.'; |
|
| 40 | 40 | } |
| 41 | 41 | } |
| 42 | 42 | |
@@ -3,7 +3,6 @@ |
||
| 3 | 3 | namespace Colligator; |
| 4 | 4 | |
| 5 | 5 | use Scriptotek\GoogleBooks\GoogleBooks; |
| 6 | -use Scriptotek\GoogleBooks\Exceptions\UsageRateExceeded; |
|
| 7 | 6 | |
| 8 | 7 | class GoogleBooksService implements EnrichmentService |
| 9 | 8 | { |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | { |
| 20 | 20 | foreach ($isbns as $isbn) { |
| 21 | 21 | $volume = $this->books->volumes->byIsbn($isbn); |
| 22 | - \Log::debug('[GoogleBooksService] - ' . $isbn . ': ' . (is_null($volume) ? 'not found' : 'found')); |
|
| 22 | + \Log::debug('[GoogleBooksService] - '.$isbn.': '.(is_null($volume) ? 'not found' : 'found')); |
|
| 23 | 23 | if (!is_null($volume)) { |
| 24 | 24 | return $volume; |
| 25 | 25 | } |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | public function enrich(Document $doc) |
| 31 | 31 | { |
| 32 | - \Log::debug('[GoogleBooksService] Checking document ' . $doc->id); |
|
| 32 | + \Log::debug('[GoogleBooksService] Checking document '.$doc->id); |
|
| 33 | 33 | |
| 34 | 34 | $volume = $this->get($doc->bibliographic['isbns']); |
| 35 | 35 | |
@@ -47,11 +47,11 @@ discard block |
||
| 47 | 47 | if ($volume) { |
| 48 | 48 | $cover_url = $volume->getCover(); |
| 49 | 49 | if (!is_null($cover_url) && is_null($doc->cover)) { |
| 50 | - \Log::debug('[GoogleBooksService] Setting new cover to document #' . $doc->id); |
|
| 50 | + \Log::debug('[GoogleBooksService] Setting new cover to document #'.$doc->id); |
|
| 51 | 51 | try { |
| 52 | 52 | $doc->storeCover($cover_url); |
| 53 | 53 | } catch (\ErrorException $e) { |
| 54 | - \Log::error('[GoogleBooksService] Failed to store cover: ' . $cover_url . "\n" . $e->getMessage()); |
|
| 54 | + \Log::error('[GoogleBooksService] Failed to store cover: '.$cover_url."\n".$e->getMessage()); |
|
| 55 | 55 | } |
| 56 | 56 | } |
| 57 | 57 | } |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | public function handleDocuments(EnrichmentService $service, $docs) |
| 73 | 73 | { |
| 74 | - \Log::info('[EnrichDocuments] Starting job. ' . count($docs) . ' documents to be checked using the "' . $service::$serviceName . '" service.'); |
|
| 74 | + \Log::info('[EnrichDocuments] Starting job. '.count($docs).' documents to be checked using the "'.$service::$serviceName.'" service.'); |
|
| 75 | 75 | |
| 76 | 76 | // $this->output->progressStart(count($docs)); |
| 77 | 77 | foreach ($docs as $doc) { |
@@ -107,22 +107,22 @@ discard block |
||
| 107 | 107 | $collectionId = intval($this->option('collection')); |
| 108 | 108 | |
| 109 | 109 | if (!isset($this->services[$serviceName])) { |
| 110 | - $this->error('Service "' . $serviceName . '" is not defined. Available servies: "' . implode('", "', array_keys($this->services)) . '".'); |
|
| 110 | + $this->error('Service "'.$serviceName.'" is not defined. Available servies: "'.implode('", "', array_keys($this->services)).'".'); |
|
| 111 | 111 | return; |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | if ($verbose) { |
| 115 | - \DB::listen(function ($query, $bindings) { |
|
| 116 | - $this->comment('Query: ' . $query . '. Bindings: ' . implode(', ', $bindings)); |
|
| 115 | + \DB::listen(function($query, $bindings) { |
|
| 116 | + $this->comment('Query: '.$query.'. Bindings: '.implode(', ', $bindings)); |
|
| 117 | 117 | }); |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | - $collectionHelp = ($collectionId > 0) ? ' in collection ' . $collectionId : ''; |
|
| 120 | + $collectionHelp = ($collectionId > 0) ? ' in collection '.$collectionId : ''; |
|
| 121 | 121 | |
| 122 | 122 | $docs = $this->getDocumentsToBeChecked($serviceName, $force, $collectionId); |
| 123 | 123 | |
| 124 | 124 | if (!count($docs)) { |
| 125 | - $this->info('No new documents' . $collectionHelp . '. Exiting.'); |
|
| 125 | + $this->info('No new documents'.$collectionHelp.'. Exiting.'); |
|
| 126 | 126 | \Log::info('[EnrichDocuments] No new documents to be checked.'); |
| 127 | 127 | return; |
| 128 | 128 | } |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | /* |
| 20 | 20 | * Authenticate the user's personal channel... |
| 21 | 21 | */ |
| 22 | - Broadcast::channel('Colligator.User.{userId}', function ($user, $userId) { |
|
| 22 | + Broadcast::channel('Colligator.User.{userId}', function($user, $userId) { |
|
| 23 | 23 | return (int) $user->id === (int) $userId; |
| 24 | 24 | }); |
| 25 | 25 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | Route::group([ |
| 42 | 42 | 'middleware' => 'web', |
| 43 | 43 | 'namespace' => $this->namespace, |
| 44 | - ], function () { |
|
| 44 | + ], function() { |
|
| 45 | 45 | require base_path('routes/web.php'); |
| 46 | 46 | }); |
| 47 | 47 | } |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | 'middleware' => 'api', |
| 59 | 59 | 'namespace' => $this->namespace, |
| 60 | 60 | // 'prefix' => 'api', |
| 61 | - ], function () { |
|
| 61 | + ], function() { |
|
| 62 | 62 | require base_path('routes/api.php'); |
| 63 | 63 | }); |
| 64 | 64 | } |
@@ -57,8 +57,8 @@ discard block |
||
| 57 | 57 | $rec = MarcRecord::fromString($q); |
| 58 | 58 | |
| 59 | 59 | $itemMap = [ |
| 60 | - 'x' => 'location', // OBS: 1030310 |
|
| 61 | - 'y' => 'shelvinglocation', // OBS: k00475 |
|
| 60 | + 'x' => 'location', // OBS: 1030310 |
|
| 61 | + 'y' => 'shelvinglocation', // OBS: k00475 |
|
| 62 | 62 | 'b' => 'barcode', |
| 63 | 63 | 'z' => 'callcode', |
| 64 | 64 | 'a' => 'id', |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | try { |
| 191 | 191 | $doc->storeCover($biblio['cover_image']); |
| 192 | 192 | } catch (\ErrorException $e) { |
| 193 | - \Log::error('Failed to store cover: ' . $biblio['cover_image']); |
|
| 193 | + \Log::error('Failed to store cover: '.$biblio['cover_image']); |
|
| 194 | 194 | } |
| 195 | 195 | } |
| 196 | 196 | |
@@ -207,14 +207,14 @@ discard block |
||
| 207 | 207 | try { |
| 208 | 208 | list($biblio, $holdings) = $this->parseRecord($record); |
| 209 | 209 | } catch (ParserException $e) { |
| 210 | - $this->error('Failed to parse MARC record. Error "' . $e->getMessage() . '" in: ' . $e->getFile() . ':' . $e->getLine() . "\nStack trace:\n" . $e->getTraceAsString()); |
|
| 210 | + $this->error('Failed to parse MARC record. Error "'.$e->getMessage().'" in: '.$e->getFile().':'.$e->getLine()."\nStack trace:\n".$e->getTraceAsString()); |
|
| 211 | 211 | |
| 212 | 212 | return null; |
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | $doc = $this->importParsedRecord($biblio, $holdings); |
| 216 | 216 | |
| 217 | - \Log::debug('[Marc21Importer] Imported ' . $doc->bibsys_id . ' as ' . $doc->id); |
|
| 217 | + \Log::debug('[Marc21Importer] Imported '.$doc->bibsys_id.' as '.$doc->id); |
|
| 218 | 218 | |
| 219 | 219 | if (!is_null($doc)) { |
| 220 | 220 | Event::fire(new Marc21RecordImported($doc->id)); |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | public function invalidateCache() |
| 79 | 79 | { |
| 80 | 80 | if (!is_null($this->width) && !is_null($this->height)) { |
| 81 | - \Log::debug('[Cover] Invalidating cache. Old version was ' . $this->width . ' x ' . $this->height); |
|
| 81 | + \Log::debug('[Cover] Invalidating cache. Old version was '.$this->width.' x '.$this->height); |
|
| 82 | 82 | } |
| 83 | 83 | $this->width = null; |
| 84 | 84 | $this->height = null; |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | $orig = \CoverCache::putBlob($blob); |
| 134 | 134 | |
| 135 | 135 | } else { |
| 136 | - \Log::debug('[Cover] Add to cache from url: ' . $this->url); |
|
| 136 | + \Log::debug('[Cover] Add to cache from url: '.$this->url); |
|
| 137 | 137 | $orig = \CoverCache::putUrl($this->url); |
| 138 | 138 | } |
| 139 | 139 | |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | /** |
| 14 | 14 | * Display a listing of the resource. |
| 15 | 15 | * |
| 16 | - * @return Response |
|
| 16 | + * @return \Illuminate\Http\JsonResponse |
|
| 17 | 17 | */ |
| 18 | 18 | public function index(SearchDocumentsRequest $request, DocumentsIndex $se) |
| 19 | 19 | { |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | * @param DocumentsIndex $se |
| 66 | 66 | * @param int $id |
| 67 | 67 | * |
| 68 | - * @return Response |
|
| 68 | + * @return \Illuminate\Http\JsonResponse |
|
| 69 | 69 | */ |
| 70 | 70 | public function show(Request $request, DocumentsIndex $se, $id) |
| 71 | 71 | { |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | /** |
| 139 | 139 | * Show cover. |
| 140 | 140 | * |
| 141 | - * @return Response |
|
| 141 | + * @return \Illuminate\Http\JsonResponse |
|
| 142 | 142 | */ |
| 143 | 143 | public function cover($document_id) |
| 144 | 144 | { |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | /** |
| 153 | 153 | * Store cover. |
| 154 | 154 | * |
| 155 | - * @return Response |
|
| 155 | + * @return \Illuminate\Http\JsonResponse |
|
| 156 | 156 | */ |
| 157 | 157 | public function storeCover($document_id, Request $request, DocumentsIndex $se) |
| 158 | 158 | { |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | /** |
| 205 | 205 | * Store description. |
| 206 | 206 | * |
| 207 | - * @return Response |
|
| 207 | + * @return \Illuminate\Http\JsonResponse |
|
| 208 | 208 | */ |
| 209 | 209 | public function storeDescription($document_id, Request $request, DocumentsIndex $se) |
| 210 | 210 | { |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | /** |
| 236 | 236 | * Store "Cannot find cover" |
| 237 | 237 | * |
| 238 | - * @return Response |
|
| 238 | + * @return \Illuminate\Http\JsonResponse |
|
| 239 | 239 | */ |
| 240 | 240 | public function cannotFindCover($document_id, Request $request, DocumentsIndex $se) |
| 241 | 241 | { |
@@ -3,7 +3,6 @@ |
||
| 3 | 3 | namespace Colligator\Http\Controllers; |
| 4 | 4 | |
| 5 | 5 | use Carbon\Carbon; |
| 6 | -use Colligator\Cover; |
|
| 7 | 6 | use Colligator\Document; |
| 8 | 7 | use Colligator\Http\Requests\SearchDocumentsRequest; |
| 9 | 8 | use Colligator\Search\DocumentsIndex; |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | 'event' => 'elasticsearch_request', |
| 40 | 40 | 'event_time' => Carbon::now(), |
| 41 | 41 | 'msecs' => round(($t1 - $t0) * 1000), |
| 42 | - 'data' => 'results:' . count($response['hits']['hits']), |
|
| 42 | + 'data' => 'results:'.count($response['hits']['hits']), |
|
| 43 | 43 | ]); |
| 44 | 44 | $hits = count($response['hits']['hits']); |
| 45 | 45 | if ($response['offset'] + $hits < $out['total']) { |
@@ -204,11 +204,11 @@ discard block |
||
| 204 | 204 | $cover = $cover->toArray(); |
| 205 | 205 | } |
| 206 | 206 | } catch (\ErrorException $e) { |
| 207 | - \Log::error('Failed to cache cover, got error: ' . $e->getMessage()); |
|
| 207 | + \Log::error('Failed to cache cover, got error: '.$e->getMessage()); |
|
| 208 | 208 | |
| 209 | 209 | return response()->json([ |
| 210 | 210 | 'result' => 'error', |
| 211 | - 'error' => 'Failed to store the cover. Please check that the URL points to a valid image file. Details: ' . $e->getMessage(), |
|
| 211 | + 'error' => 'Failed to store the cover. Please check that the URL points to a valid image file. Details: '.$e->getMessage(), |
|
| 212 | 212 | ]); |
| 213 | 213 | } |
| 214 | 214 | |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | ]; |
| 244 | 244 | $doc->save(); |
| 245 | 245 | |
| 246 | - \Log::info('Stored new description for ' . $doc->id); |
|
| 246 | + \Log::info('Stored new description for '.$doc->id); |
|
| 247 | 247 | |
| 248 | 248 | $se->indexById($doc->id); |
| 249 | 249 | |
@@ -268,11 +268,11 @@ discard block |
||
| 268 | 268 | $doc->save(); |
| 269 | 269 | |
| 270 | 270 | } catch (\ErrorException $e) { |
| 271 | - \Log::error('Failed to store status, got error: ' . $e->getMessage()); |
|
| 271 | + \Log::error('Failed to store status, got error: '.$e->getMessage()); |
|
| 272 | 272 | |
| 273 | 273 | return response()->json([ |
| 274 | 274 | 'result' => 'error', |
| 275 | - 'error' => 'Failed to store status. Details: ' . $e->getMessage(), |
|
| 275 | + 'error' => 'Failed to store status. Details: '.$e->getMessage(), |
|
| 276 | 276 | ]); |
| 277 | 277 | } |
| 278 | 278 | |