@@ -92,8 +92,7 @@ discard block |
||
92 | 92 | $dt = new \DateTime($node->getAttribute('content')); |
93 | 93 | break; |
94 | 94 | } |
95 | - } |
|
96 | - catch (\Exception $e) { |
|
95 | + } catch (\Exception $e) { |
|
97 | 96 | // Do nothing here in case the node has unrecognizable date information. |
98 | 97 | } |
99 | 98 | } |
@@ -113,8 +112,7 @@ discard block |
||
113 | 112 | $dt = new \DateTime($json->datePublished); |
114 | 113 | break; |
115 | 114 | } |
116 | - } |
|
117 | - catch (\Exception $e) { |
|
115 | + } catch (\Exception $e) { |
|
118 | 116 | // Do nothing here in case the node has unrecognizable date information. |
119 | 117 | } |
120 | 118 | } |
@@ -141,8 +139,7 @@ discard block |
||
141 | 139 | $dt = new \DateTime($node->getAttribute('content')); |
142 | 140 | break; |
143 | 141 | } |
144 | - } |
|
145 | - catch (\Exception $e) { |
|
142 | + } catch (\Exception $e) { |
|
146 | 143 | // Do nothing here in case the node has unrecognizable date information. |
147 | 144 | } |
148 | 145 | } |
@@ -174,8 +171,7 @@ discard block |
||
174 | 171 | if (is_null($dt) && isset($og_data['pubdate'])) { |
175 | 172 | $dt = new \DateTime($og_data['pubdate']); |
176 | 173 | } |
177 | - } |
|
178 | - catch (\Exception $e) { |
|
174 | + } catch (\Exception $e) { |
|
179 | 175 | // Do nothing here in case the node has unrecognizable date information. |
180 | 176 | } |
181 | 177 | |
@@ -207,8 +203,7 @@ discard block |
||
207 | 203 | $dt = new \DateTime($json->dateCreated); |
208 | 204 | break; |
209 | 205 | } |
210 | - } |
|
211 | - catch (\Exception $e) { |
|
206 | + } catch (\Exception $e) { |
|
212 | 207 | // Do nothing here in case the node has unrecognizable date information. |
213 | 208 | } |
214 | 209 | } |
@@ -227,8 +222,7 @@ discard block |
||
227 | 222 | $dt = new \DateTime($node->getAttribute('content')); |
228 | 223 | break; |
229 | 224 | } |
230 | - } |
|
231 | - catch (\Exception $e) { |
|
225 | + } catch (\Exception $e) { |
|
232 | 226 | // Do nothing here in case the node has unrecognizable date information. |
233 | 227 | } |
234 | 228 | } |
@@ -250,8 +244,7 @@ discard block |
||
250 | 244 | break; |
251 | 245 | } |
252 | 246 | } |
253 | - } |
|
254 | - catch (\Exception $e) { |
|
247 | + } catch (\Exception $e) { |
|
255 | 248 | // Do nothing here in case the node has unrecognizable date information. |
256 | 249 | } |
257 | 250 | } |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php declare(strict_types=1); |
|
1 | +<?php declare(strict_types = 1); |
|
2 | 2 | |
3 | 3 | namespace Goose\Modules\Extractors; |
4 | 4 | |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | private function getDateFromURL(): ?\DateTime { |
52 | 52 | // Determine date based on URL |
53 | 53 | if (preg_match('@(?:[\d]{4})(?<delimiter>[/-])(?:[\d]{2})\k<delimiter>(?:[\d]{2})@U', $this->article()->getFinalUrl(), $matches)) { |
54 | - $dt = \DateTime::createFromFormat('Y' . $matches['delimiter'] . 'm' . $matches['delimiter'] . 'd', $matches[0]); |
|
54 | + $dt = \DateTime::createFromFormat('Y'.$matches['delimiter'].'m'.$matches['delimiter'].'d', $matches[0]); |
|
55 | 55 | $dt->setTime(0, 0, 0); |
56 | 56 | |
57 | 57 | if ($dt === false) { |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php declare(strict_types=1); |
|
1 | +<?php declare(strict_types = 1); |
|
2 | 2 | |
3 | 3 | namespace Goose\Text; |
4 | 4 | |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | */ |
25 | 25 | public function __construct($options = []) { |
26 | 26 | foreach ($options as $key => $value) { |
27 | - $method = 'set' . ucfirst($key); |
|
27 | + $method = 'set'.ucfirst($key); |
|
28 | 28 | |
29 | 29 | if (method_exists($this, $method)) { |
30 | 30 | call_user_func([$this, $method], $value); |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php declare(strict_types=1); |
|
1 | +<?php declare(strict_types = 1); |
|
2 | 2 | |
3 | 3 | namespace Goose\Text; |
4 | 4 | |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | */ |
67 | 67 | public function getWordList(): array { |
68 | 68 | if (empty($this->cached)) { |
69 | - $file = sprintf(__DIR__ . '/../../resources/text/stopwords-%s.txt', $this->getLanguage()); |
|
69 | + $file = sprintf(__DIR__.'/../../resources/text/stopwords-%s.txt', $this->getLanguage()); |
|
70 | 70 | |
71 | 71 | $this->cached = explode("\n", str_replace(["\r\n", "\r"], "\n", file_get_contents($file))); |
72 | 72 | } |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | public function getCandidateWords(string $strippedInput): string { |
110 | 110 | // Simple separating words in Japanese. |
111 | 111 | if ($this->getLanguage() === 'ja') { |
112 | - $regexp = '/(' . implode('|', array_map('preg_quote', $this->getWordList())) . ')/'; |
|
112 | + $regexp = '/('.implode('|', array_map('preg_quote', $this->getWordList())).')/'; |
|
113 | 113 | $strippedInput = preg_replace($regexp, ' $1 ', $strippedInput); |
114 | 114 | } |
115 | 115 |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php declare(strict_types=1); |
|
1 | +<?php declare(strict_types = 1); |
|
2 | 2 | |
3 | 3 | namespace Goose\Modules\Formatters; |
4 | 4 | |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | $headers = $topNode->find('h1, h2, h3, h4, h5, h6'); |
172 | 172 | |
173 | 173 | foreach ($headers as $header) { |
174 | - $header->replaceWith(new Text("\n\n" . $this->getTagCleanedText($header) . "\n\n")); |
|
174 | + $header->replaceWith(new Text("\n\n".$this->getTagCleanedText($header)."\n\n")); |
|
175 | 175 | } |
176 | 176 | } |
177 | 177 |
@@ -1,4 +1,4 @@ |
||
1 | -<?php declare(strict_types=1); |
|
1 | +<?php declare(strict_types = 1); |
|
2 | 2 | |
3 | 3 | namespace Goose\Modules; |
4 | 4 |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php declare(strict_types=1); |
|
1 | +<?php declare(strict_types = 1); |
|
2 | 2 | |
3 | 3 | namespace Goose\Modules\Cleaners; |
4 | 4 | |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | ]; |
168 | 168 | |
169 | 169 | $exceptions = array_map(function($value) { |
170 | - return ':not(' . $value . ')'; |
|
170 | + return ':not('.$value.')'; |
|
171 | 171 | }, $this->exceptionSelectors); |
172 | 172 | |
173 | 173 | $exceptions = implode('', $exceptions); |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | foreach ($lists as $expr => $list) { |
176 | 176 | foreach ($list as $value) { |
177 | 177 | foreach ($attrs as $attr) { |
178 | - $selector = sprintf($expr, $attr, $value) . $exceptions; |
|
178 | + $selector = sprintf($expr, $attr, $value).$exceptions; |
|
179 | 179 | |
180 | 180 | foreach ($this->document()->find($selector) as $node) { |
181 | 181 | $node->remove(); |
@@ -1,4 +1,4 @@ |
||
1 | -<?php declare(strict_types=1); |
|
1 | +<?php declare(strict_types = 1); |
|
2 | 2 | |
3 | 3 | namespace Goose\Modules; |
4 | 4 |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php declare(strict_types=1); |
|
1 | +<?php declare(strict_types = 1); |
|
2 | 2 | |
3 | 3 | namespace Goose\Modules\Extractors; |
4 | 4 | |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | |
59 | 59 | // Additionally retrieve type values based on provided og:type (http://ogp.me/#types) |
60 | 60 | if (isset($results['type'])) { |
61 | - $nodes = $this->article()->getDoc()->find('meta[property^="' . $results['type'] .':"]'); |
|
61 | + $nodes = $this->article()->getDoc()->find('meta[property^="'.$results['type'].':"]'); |
|
62 | 62 | |
63 | 63 | foreach ($nodes as $node) { |
64 | 64 | $property = explode(':', $node->attr('property')); |
@@ -1,4 +1,4 @@ |
||
1 | -<?php declare(strict_types=1); |
|
1 | +<?php declare(strict_types = 1); |
|
2 | 2 | |
3 | 3 | namespace Goose\Modules\Extractors; |
4 | 4 |