@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | return false; |
80 | 80 | } |
81 | 81 | |
82 | - return (bool)preg_match(IURLGenerator::URL_REGEX, $referenceText); |
|
82 | + return (bool) preg_match(IURLGenerator::URL_REGEX, $referenceText); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | public function resolveReference(string $referenceText): ?IReference { |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | |
107 | 107 | $client = $this->clientService->newClient(); |
108 | 108 | try { |
109 | - $headResponse = $client->head($reference->getId(), [ 'timeout' => 10 ]); |
|
109 | + $headResponse = $client->head($reference->getId(), ['timeout' => 10]); |
|
110 | 110 | } catch (\Exception $e) { |
111 | 111 | $this->logger->debug('Failed to perform HEAD request to get target metadata', ['exception' => $e]); |
112 | 112 | return; |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | } |
119 | 119 | $linkContentType = $headResponse->getHeader('Content-Type'); |
120 | 120 | $expectedContentType = 'text/html'; |
121 | - $suffixedExpectedContentType = $expectedContentType . ';'; |
|
121 | + $suffixedExpectedContentType = $expectedContentType.';'; |
|
122 | 122 | $startsWithSuffixed = substr($linkContentType, 0, strlen($suffixedExpectedContentType)) === $suffixedExpectedContentType; |
123 | 123 | // check the header begins with the expected content type |
124 | 124 | if ($linkContentType !== $expectedContentType && !$startsWithSuffixed) { |
@@ -126,13 +126,13 @@ discard block |
||
126 | 126 | return; |
127 | 127 | } |
128 | 128 | try { |
129 | - $response = $client->get($reference->getId(), [ 'timeout' => 10 ]); |
|
129 | + $response = $client->get($reference->getId(), ['timeout' => 10]); |
|
130 | 130 | } catch (\Exception $e) { |
131 | 131 | $this->logger->debug('Failed to fetch link for obtaining open graph data', ['exception' => $e]); |
132 | 132 | return; |
133 | 133 | } |
134 | 134 | |
135 | - $responseBody = (string)$response->getBody(); |
|
135 | + $responseBody = (string) $response->getBody(); |
|
136 | 136 | |
137 | 137 | // OpenGraph handling |
138 | 138 | $consumer = new Consumer(); |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | try { |
154 | 154 | $host = parse_url($object->images[0]->url, PHP_URL_HOST); |
155 | 155 | if ($host === false || $host === null) { |
156 | - $this->logger->warning('Could not detect host of open graph image URI for ' . $reference->getId()); |
|
156 | + $this->logger->warning('Could not detect host of open graph image URI for '.$reference->getId()); |
|
157 | 157 | } else { |
158 | 158 | $appData = $this->appDataFactory->get('core'); |
159 | 159 | try { |
@@ -174,9 +174,9 @@ discard block |
||
174 | 174 | } |
175 | 175 | } |
176 | 176 | } catch (GuzzleException $e) { |
177 | - $this->logger->info('Failed to fetch and store the open graph image for ' . $reference->getId(), ['exception' => $e]); |
|
177 | + $this->logger->info('Failed to fetch and store the open graph image for '.$reference->getId(), ['exception' => $e]); |
|
178 | 178 | } catch (\Throwable $e) { |
179 | - $this->logger->error('Failed to fetch and store the open graph image for ' . $reference->getId(), ['exception' => $e]); |
|
179 | + $this->logger->error('Failed to fetch and store the open graph image for '.$reference->getId(), ['exception' => $e]); |
|
180 | 180 | } |
181 | 181 | } |
182 | 182 | } |