@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public function fromDump() |
104 | 104 | { |
105 | - $files = Storage::disk('local')->files('harvests/' . $this->name); |
|
105 | + $files = Storage::disk('local')->files('harvests/'.$this->name); |
|
106 | 106 | $recordsHarvested = 0; |
107 | 107 | foreach ($files as $filename) { |
108 | 108 | if (!preg_match('/.xml$/', $filename)) { |
@@ -124,11 +124,11 @@ discard block |
||
124 | 124 | |
125 | 125 | public function fromNetwork() |
126 | 126 | { |
127 | - $dest_path = 'harvests/' . $this->name . '/'; |
|
127 | + $dest_path = 'harvests/'.$this->name.'/'; |
|
128 | 128 | |
129 | 129 | Storage::disk('local')->deleteDir($dest_path); |
130 | 130 | |
131 | - $latest = $dest_path . 'latest.xml'; |
|
131 | + $latest = $dest_path.'latest.xml'; |
|
132 | 132 | |
133 | 133 | $client = new OaiPmhClient($this->url, [ |
134 | 134 | 'schema' => $this->schema, |
@@ -137,12 +137,12 @@ discard block |
||
137 | 137 | 'sleep-time-on-error' => $this->sleepTimeOnError, |
138 | 138 | ]); |
139 | 139 | |
140 | - $client->on('request.error', function ($msg) { |
|
140 | + $client->on('request.error', function($msg) { |
|
141 | 141 | $this->error($msg); |
142 | 142 | }); |
143 | 143 | |
144 | 144 | // Store each response to disk just in case |
145 | - $client->on('request.complete', function ($verb, $args, $body) use ($latest) { |
|
145 | + $client->on('request.complete', function($verb, $args, $body) use ($latest) { |
|
146 | 146 | Storage::disk('local')->put($latest, $body); |
147 | 147 | }); |
148 | 148 | |
@@ -166,9 +166,9 @@ discard block |
||
166 | 166 | if ($this->resume != $records->getResumptionToken()) { |
167 | 167 | $this->resume = $records->getResumptionToken(); |
168 | 168 | if (is_null($this->resume)) { |
169 | - Storage::disk('local')->delete($dest_path . '/resumption_token'); |
|
169 | + Storage::disk('local')->delete($dest_path.'/resumption_token'); |
|
170 | 170 | } else { |
171 | - Storage::disk('local')->put($dest_path . '/resumption_token', $this->resume); |
|
171 | + Storage::disk('local')->put($dest_path.'/resumption_token', $this->resume); |
|
172 | 172 | } |
173 | 173 | } |
174 | 174 | |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | } catch (BadRequestError $e) { |
202 | 202 | $this->error($e->getMessage()); |
203 | 203 | $this->error($e->getCode()); |
204 | - $this->error('Bad request. Attempt ' . $attempt . ' of 100. Sleeping 10 secs.'); |
|
204 | + $this->error('Bad request. Attempt '.$attempt.' of 100. Sleeping 10 secs.'); |
|
205 | 205 | if ($attempt > 100) { |
206 | 206 | throw $e; |
207 | 207 | } |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | */ |
226 | 226 | public function handle(DocumentsIndex $docIndex, Marc21Importer $importer) |
227 | 227 | { |
228 | - Log::info('[OaiPmhHarvestJob] Starting job. Requesting records from ' . ($this->start ?: '(no limit)') . ' until ' . ($this->until ?: '(no limit)') . '.'); |
|
228 | + Log::info('[OaiPmhHarvestJob] Starting job. Requesting records from '.($this->start ?: '(no limit)').' until '.($this->until ?: '(no limit)').'.'); |
|
229 | 229 | $this->docIndex = $docIndex; |
230 | 230 | $this->importer = $importer; |
231 | 231 | |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | } |
246 | 246 | |
247 | 247 | // $this->postProcess($this->importedDocuments); |
248 | - Log::info('[OaiPmhHarvestJob] Complete, got ' . $recordsHarvested . ' records.'); |
|
248 | + Log::info('[OaiPmhHarvestJob] Complete, got '.$recordsHarvested.' records.'); |
|
249 | 249 | |
250 | 250 | Event::fire(new OaiPmhHarvestComplete($recordsHarvested)); |
251 | 251 | } |
@@ -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 |
@@ -60,6 +60,7 @@ |
||
60 | 60 | |
61 | 61 | /** |
62 | 62 | * Get enrichments associated with this document. |
63 | + * @param string $serviceName |
|
63 | 64 | */ |
64 | 65 | public function enrichmentsByService($serviceName) |
65 | 66 | { |
@@ -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 | } |