@@ -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 | |
@@ -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 | |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | $srcHost = parse_url($src, PHP_URL_HOST); |
| 87 | 87 | $srcScheme = parse_url($src, PHP_URL_SCHEME); |
| 88 | 88 | |
| 89 | - return $match || preg_match('@' . $domain . '$@i', $srcHost) && in_array($srcScheme, ['http', 'https']); |
|
| 89 | + return $match || preg_match('@'.$domain.'$@i', $srcHost) && in_array($srcScheme, ['http', 'https']); |
|
| 90 | 90 | }); |
| 91 | 91 | |
| 92 | 92 | if ($match) { |
@@ -133,10 +133,10 @@ discard block |
||
| 133 | 133 | $stopWords = $this->config()->getStopWords()->getWordList(); |
| 134 | 134 | |
| 135 | 135 | $text = $this->article()->getTitle(); |
| 136 | - $text .= ' ' . $this->article()->getMetaDescription(); |
|
| 136 | + $text .= ' '.$this->article()->getMetaDescription(); |
|
| 137 | 137 | |
| 138 | 138 | if ($this->article()->getTopNode()) { |
| 139 | - $text .= ' ' . $this->article()->getCleanedArticleText(); |
|
| 139 | + $text .= ' '.$this->article()->getCleanedArticleText(); |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | // Decode and split words by white-space |