@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | protected $topNode; |
| 229 | 229 | |
| 230 | 230 | /** |
| 231 | - * @param Element|null $topNode |
|
| 231 | + * @param null|\DOMWrap\Element $topNode |
|
| 232 | 232 | * |
| 233 | 233 | * @return self |
| 234 | 234 | */ |
@@ -436,7 +436,7 @@ discard block |
||
| 436 | 436 | protected $doc; |
| 437 | 437 | |
| 438 | 438 | /** |
| 439 | - * @param Document $doc |
|
| 439 | + * @param \DOMWrap\Document $doc |
|
| 440 | 440 | * |
| 441 | 441 | * @return self |
| 442 | 442 | */ |
@@ -446,7 +446,7 @@ discard block |
||
| 446 | 446 | return $this; |
| 447 | 447 | } |
| 448 | 448 | |
| 449 | - /** @return Document */ |
|
| 449 | + /** @return \DOMWrap\Document */ |
|
| 450 | 450 | public function getDoc(): Document { |
| 451 | 451 | return $this->doc; |
| 452 | 452 | } |
@@ -460,7 +460,7 @@ discard block |
||
| 460 | 460 | protected $rawDoc; |
| 461 | 461 | |
| 462 | 462 | /** |
| 463 | - * @param Document $rawDoc |
|
| 463 | + * @param \DOMWrap\Document $rawDoc |
|
| 464 | 464 | * |
| 465 | 465 | * @return self |
| 466 | 466 | */ |
@@ -470,7 +470,7 @@ discard block |
||
| 470 | 470 | return $this; |
| 471 | 471 | } |
| 472 | 472 | |
| 473 | - /** @return Document */ |
|
| 473 | + /** @return \DOMWrap\Document */ |
|
| 474 | 474 | public function getRawDoc(): Document { |
| 475 | 475 | return $this->rawDoc; |
| 476 | 476 | } |
@@ -483,7 +483,7 @@ discard block |
||
| 483 | 483 | protected $rawResponse; |
| 484 | 484 | |
| 485 | 485 | /** |
| 486 | - * @param \Psr\Http\Message\ResponseInterface|null $rawResponse |
|
| 486 | + * @param \Psr\Http\Message\ResponseInterface $rawResponse |
|
| 487 | 487 | * |
| 488 | 488 | * @return self |
| 489 | 489 | */ |
@@ -1,4 +1,4 @@ |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | |
| 3 | 3 | namespace Goose; |
| 4 | 4 | |
@@ -73,7 +73,7 @@ |
||
| 73 | 73 | |
| 74 | 74 | /** |
| 75 | 75 | * @param string $option |
| 76 | - * @param mixed $value |
|
| 76 | + * @param string|null $value |
|
| 77 | 77 | * |
| 78 | 78 | * @return self |
| 79 | 79 | */ |
@@ -1,4 +1,4 @@ |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | |
| 3 | 3 | namespace Goose; |
| 4 | 4 | |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | /** |
| 191 | 191 | * Replace supplied element with <p> new element. |
| 192 | 192 | * |
| 193 | - * @param Element $node |
|
| 193 | + * @param \DOMWrap\Element $node |
|
| 194 | 194 | * |
| 195 | 195 | * @return self|null |
| 196 | 196 | */ |
@@ -244,9 +244,9 @@ discard block |
||
| 244 | 244 | /** |
| 245 | 245 | * Generate new <p> element with supplied content. |
| 246 | 246 | * |
| 247 | - * @param NodeList $replacementNodes |
|
| 247 | + * @param \DOMWrap\NodeList $replacementNodes |
|
| 248 | 248 | * |
| 249 | - * @return Element |
|
| 249 | + * @return \DOMWrap\Element |
|
| 250 | 250 | */ |
| 251 | 251 | private function getFlushedBuffer(NodeList $replacementNodes): Element { |
| 252 | 252 | $newEl = $this->document()->createElement('p'); |
@@ -258,9 +258,9 @@ discard block |
||
| 258 | 258 | /** |
| 259 | 259 | * Generate <p> element replacements for supplied elements child nodes as required. |
| 260 | 260 | * |
| 261 | - * @param Element $node |
|
| 261 | + * @param \DOMWrap\Element $node |
|
| 262 | 262 | * |
| 263 | - * @return NodeList $nodesToReturn Replacement elements |
|
| 263 | + * @return \DOMWrap\NodeList $nodesToReturn Replacement elements |
|
| 264 | 264 | */ |
| 265 | 265 | private function getReplacementNodes(Element $node): NodeList { |
| 266 | 266 | $nodesToReturn = $node->newNodeList(); |
@@ -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(); |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | /** |
| 60 | - * @return Image|null |
|
| 60 | + * @return null|\Goose\Images\Image |
|
| 61 | 61 | */ |
| 62 | 62 | private function getBestImage(): ?Image { |
| 63 | 63 | $image = $this->checkForKnownElements(); |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | * Prefer Twitter images (as they tend to have the right size for us), then Open Graph images |
| 88 | 88 | * (which seem to be smaller), and finally linked images. |
| 89 | 89 | * |
| 90 | - * @return Image|null |
|
| 90 | + * @return \Goose\Images\Image|null |
|
| 91 | 91 | */ |
| 92 | 92 | private function checkForMetaTag(): ?Image { |
| 93 | 93 | $image = $this->checkForTwitterTag(); |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | * 4. any images left over let's do a full GET request, download em to disk and check their dimensions |
| 121 | 121 | * 5. Score images based on different factors like height/width and possibly things like color density |
| 122 | 122 | * |
| 123 | - * @param Element $node |
|
| 123 | + * @param \DOMWrap\Element $node |
|
| 124 | 124 | * @param int $parentDepthLevel |
| 125 | 125 | * @param int $siblingDepthLevel |
| 126 | 126 | * |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | /** |
| 161 | - * @param Element $node |
|
| 161 | + * @param \DOMWrap\Element $node |
|
| 162 | 162 | * @param int $parentDepth |
| 163 | 163 | * @param int $siblingDepth |
| 164 | 164 | * |
@@ -337,7 +337,7 @@ discard block |
||
| 337 | 337 | /** |
| 338 | 338 | * will check the image src against a list of bad image files we know of like buttons, etc... |
| 339 | 339 | * |
| 340 | - * @param Element $imageNode |
|
| 340 | + * @param \DOMWrap\Element $imageNode |
|
| 341 | 341 | * |
| 342 | 342 | * @return bool |
| 343 | 343 | */ |
@@ -358,7 +358,7 @@ discard block |
||
| 358 | 358 | } |
| 359 | 359 | |
| 360 | 360 | /** |
| 361 | - * @param Element $node |
|
| 361 | + * @param \DOMWrap\Element $node |
|
| 362 | 362 | * |
| 363 | 363 | * @return LocallyStoredImage[] |
| 364 | 364 | */ |
@@ -410,7 +410,7 @@ discard block |
||
| 410 | 410 | /** |
| 411 | 411 | * checks to see if we were able to find feature image tags on this page |
| 412 | 412 | * |
| 413 | - * @return Image|null |
|
| 413 | + * @return null|\Goose\Images\Image |
|
| 414 | 414 | */ |
| 415 | 415 | private function checkForLinkTag(): ?Image { |
| 416 | 416 | return $this->checkForTag('link[rel="image_src"]', 'href', 'linktag'); |
@@ -419,7 +419,7 @@ discard block |
||
| 419 | 419 | /** |
| 420 | 420 | * checks to see if we were able to find open graph tags on this page |
| 421 | 421 | * |
| 422 | - * @return Image|null |
|
| 422 | + * @return null|\Goose\Images\Image |
|
| 423 | 423 | */ |
| 424 | 424 | private function checkForOpenGraphTag(): ?Image { |
| 425 | 425 | return $this->checkForTag('meta[property="og:image"],meta[name="og:image"]', 'content', 'opengraph'); |
@@ -428,7 +428,7 @@ discard block |
||
| 428 | 428 | /** |
| 429 | 429 | * checks to see if we were able to find twitter tags on this page |
| 430 | 430 | * |
| 431 | - * @return Image|null |
|
| 431 | + * @return null|\Goose\Images\Image |
|
| 432 | 432 | */ |
| 433 | 433 | private function checkForTwitterTag(): ?Image { |
| 434 | 434 | return $this->checkForTag('meta[property="twitter:image"],meta[name="twitter:image"],meta[property="twitter:image:src"],meta[name="twitter:image:src"]', 'content', 'twitter'); |
@@ -439,7 +439,7 @@ discard block |
||
| 439 | 439 | * @param string $attr |
| 440 | 440 | * @param string $type |
| 441 | 441 | * |
| 442 | - * @return Image|null |
|
| 442 | + * @return null|\Goose\Images\Image |
|
| 443 | 443 | */ |
| 444 | 444 | private function checkForTag(string $selector, string $attr, string $type): ?Image { |
| 445 | 445 | $meta = $this->article()->getRawDoc()->find($selector); |
@@ -476,9 +476,9 @@ discard block |
||
| 476 | 476 | } |
| 477 | 477 | |
| 478 | 478 | /** |
| 479 | - * @param Image $mainImage |
|
| 479 | + * @param \Goose\Images\Image $mainImage |
|
| 480 | 480 | * |
| 481 | - * @return Image|null |
|
| 481 | + * @return \Goose\Images\Image|null |
|
| 482 | 482 | */ |
| 483 | 483 | private function ensureMinimumImageSize(Image $mainImage): ?Image { |
| 484 | 484 | if ($mainImage->getWidth() >= $this->config()->get('image_min_width') |
@@ -493,7 +493,7 @@ discard block |
||
| 493 | 493 | * @param string $imageSrc |
| 494 | 494 | * @param bool $returnAll |
| 495 | 495 | * |
| 496 | - * @return LocallyStoredImage|null |
|
| 496 | + * @return \Goose\Images\LocallyStoredImage|null |
|
| 497 | 497 | */ |
| 498 | 498 | private function getLocallyStoredImage(string $imageSrc, bool $returnAll = false): ?LocallyStoredImage { |
| 499 | 499 | $locallyStoredImages = ImageUtils::storeImagesToLocalFile([$imageSrc], $returnAll, $this->config()); |
@@ -524,7 +524,7 @@ discard block |
||
| 524 | 524 | * |
| 525 | 525 | * @todo enable this to use a series of settings files so people can define what the image ids/classes are on specific sites |
| 526 | 526 | * |
| 527 | - * @return Image|null |
|
| 527 | + * @return null|\Goose\Images\Image |
|
| 528 | 528 | */ |
| 529 | 529 | private function checkForKnownElements(): ?Image { |
| 530 | 530 | if (!$this->article()->getRawDoc()) { |
@@ -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 | |
@@ -348,7 +348,7 @@ discard block |
||
| 348 | 348 | return false; |
| 349 | 349 | } |
| 350 | 350 | |
| 351 | - $regex = '@' . implode('|', $this->badFileNames) . '@i'; |
|
| 351 | + $regex = '@'.implode('|', $this->badFileNames).'@i'; |
|
| 352 | 352 | |
| 353 | 353 | if (preg_match($regex, $imgSrc)) { |
| 354 | 354 | return false; |
@@ -546,10 +546,10 @@ discard block |
||
| 546 | 546 | $knownImage = null; |
| 547 | 547 | |
| 548 | 548 | foreach ($knownImgDomNames as $knownName) { |
| 549 | - $known = $this->article()->getRawDoc()->find('#' . $knownName); |
|
| 549 | + $known = $this->article()->getRawDoc()->find('#'.$knownName); |
|
| 550 | 550 | |
| 551 | 551 | if (!$known->count()) { |
| 552 | - $known = $this->article()->getRawDoc()->find('.' . $knownName); |
|
| 552 | + $known = $this->article()->getRawDoc()->find('.'.$knownName); |
|
| 553 | 553 | } |
| 554 | 554 | |
| 555 | 555 | if ($known->count()) { |
@@ -604,7 +604,7 @@ discard block |
||
| 604 | 604 | $articleUrlParts = parse_url($this->article()->getFinalUrl()); |
| 605 | 605 | if (isset($imageUrlParts['path'], $articleUrlParts['path']) && $imageUrlParts['path'] && $imageUrlParts['path']{0} !== '/') { |
| 606 | 606 | $articleUrlDir = dirname($articleUrlParts['path']); |
| 607 | - $imageUrlParts['path'] = $articleUrlDir . '/' . $imageUrlParts['path']; |
|
| 607 | + $imageUrlParts['path'] = $articleUrlDir.'/'.$imageUrlParts['path']; |
|
| 608 | 608 | } |
| 609 | 609 | |
| 610 | 610 | foreach ($parts as $part) { |
@@ -626,7 +626,7 @@ discard block |
||
| 626 | 626 | */ |
| 627 | 627 | private function customSiteMapping(): array { |
| 628 | 628 | if (empty(self::$CUSTOM_SITE_MAPPING)) { |
| 629 | - $file = __DIR__ . '/../../../resources/images/known-image-css.txt'; |
|
| 629 | + $file = __DIR__.'/../../../resources/images/known-image-css.txt'; |
|
| 630 | 630 | |
| 631 | 631 | $lines = explode("\n", str_replace(["\r\n", "\r"], "\n", file_get_contents($file))); |
| 632 | 632 | |
@@ -149,19 +149,19 @@ |
||
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | /** |
| 152 | - * @param Document $doc |
|
| 152 | + * @param \DOMWrap\Document $doc |
|
| 153 | 153 | * @param string $tag |
| 154 | 154 | * @param string $property |
| 155 | 155 | * @param string $value |
| 156 | 156 | * |
| 157 | - * @return NodeList |
|
| 157 | + * @return \DOMWrap\NodeList |
|
| 158 | 158 | */ |
| 159 | 159 | private function getNodesByLowercasePropertyValue(Document $doc, string $tag, string $property, string $value): NodeList { |
| 160 | 160 | return $doc->findXPath("descendant::".$tag."[translate(@".$property.", 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')='".$value."']"); |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | /** |
| 164 | - * @param Document $doc |
|
| 164 | + * @param \DOMWrap\Document $doc |
|
| 165 | 165 | * @param string $property |
| 166 | 166 | * @param string $value |
| 167 | 167 | * @param string $attr |
@@ -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')); |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | /** |
| 55 | 55 | * Takes an element and turns the P tags into \n\n |
| 56 | 56 | * |
| 57 | - * @param Element $topNode The top most node to format |
|
| 57 | + * @param \DOMWrap\Element $topNode The top most node to format |
|
| 58 | 58 | * |
| 59 | 59 | * @return string |
| 60 | 60 | */ |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | /** |
| 94 | - * @param Element $topNode |
|
| 94 | + * @param \DOMWrap\Element $topNode |
|
| 95 | 95 | * |
| 96 | 96 | * @return string |
| 97 | 97 | */ |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | /** |
| 107 | 107 | * cleans up and converts any nodes that should be considered text into text |
| 108 | 108 | * |
| 109 | - * @param Element $topNode |
|
| 109 | + * @param \DOMWrap\Element $topNode |
|
| 110 | 110 | * |
| 111 | 111 | * @return self |
| 112 | 112 | */ |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | * if there are elements inside our top node that have a negative gravity score, let's |
| 131 | 131 | * give em the boot |
| 132 | 132 | * |
| 133 | - * @param Element $topNode |
|
| 133 | + * @param \DOMWrap\Element $topNode |
|
| 134 | 134 | * |
| 135 | 135 | * @return self |
| 136 | 136 | */ |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | * |
| 157 | 157 | * replaces header tags h1 ... h6 with newline padded text |
| 158 | 158 | * |
| 159 | - * @param Element $topNode |
|
| 159 | + * @param \DOMWrap\Element $topNode |
|
| 160 | 160 | * |
| 161 | 161 | * @return self |
| 162 | 162 | */ |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | /** |
| 182 | 182 | * @todo Implement |
| 183 | 183 | * |
| 184 | - * @param Element $item |
|
| 184 | + * @param \DOMWrap\Element $item |
|
| 185 | 185 | * |
| 186 | 186 | * @return string |
| 187 | 187 | */ |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | /** |
| 193 | 193 | * remove paragraphs that have less than x number of words, would indicate that it's some sort of link |
| 194 | 194 | * |
| 195 | - * @param Element $topNode |
|
| 195 | + * @param \DOMWrap\Element $topNode |
|
| 196 | 196 | * |
| 197 | 197 | * @return self |
| 198 | 198 | */ |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | /** |
| 239 | - * @param Element $topNode |
|
| 239 | + * @param \DOMWrap\Element $topNode |
|
| 240 | 240 | * |
| 241 | 241 | * @return self |
| 242 | 242 | */ |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | } |
| 254 | 254 | |
| 255 | 255 | /** |
| 256 | - * @param Element $topNode |
|
| 256 | + * @param \DOMWrap\Element $topNode |
|
| 257 | 257 | * |
| 258 | 258 | * @return bool |
| 259 | 259 | */ |
@@ -282,8 +282,8 @@ discard block |
||
| 282 | 282 | } |
| 283 | 283 | |
| 284 | 284 | /** |
| 285 | - * @param Element $topNode |
|
| 286 | - * @param Element $node |
|
| 285 | + * @param \DOMWrap\Element $topNode |
|
| 286 | + * @param \DOMWrap\Element $node |
|
| 287 | 287 | * |
| 288 | 288 | * @return bool |
| 289 | 289 | */ |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | /** |
| 303 | 303 | * Adds any siblings that may have a decent score to this node |
| 304 | 304 | * |
| 305 | - * @param Element $currentSibling |
|
| 305 | + * @param \DOMWrap\Element $currentSibling |
|
| 306 | 306 | * @param float $baselineScoreForSiblingParagraphs |
| 307 | 307 | * |
| 308 | 308 | * @return Element[] |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | } |
| 335 | 335 | |
| 336 | 336 | /** |
| 337 | - * @param Element $topNode |
|
| 337 | + * @param \DOMWrap\Element $topNode |
|
| 338 | 338 | * |
| 339 | 339 | * @return self |
| 340 | 340 | */ |
@@ -363,7 +363,7 @@ discard block |
||
| 363 | 363 | * of the paragraphs within the top node. For example if our total score of 10 paragraphs was 1000 but each had an average value of |
| 364 | 364 | * 100 then 100 should be our base. |
| 365 | 365 | * |
| 366 | - * @param Element $topNode |
|
| 366 | + * @param \DOMWrap\Element $topNode |
|
| 367 | 367 | * |
| 368 | 368 | * @return float |
| 369 | 369 | */ |
@@ -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 | |
@@ -104,7 +104,7 @@ |
||
| 104 | 104 | /** |
| 105 | 105 | * @param string $strippedInput |
| 106 | 106 | * |
| 107 | - * @return array |
|
| 107 | + * @return string |
|
| 108 | 108 | */ |
| 109 | 109 | public function getCandidateWords(string $strippedInput): string { |
| 110 | 110 | // Simple separating words in Japanese. |
@@ -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\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 @@ |
||
| 1 | -<?php declare(strict_types=1); |
|
| 1 | +<?php declare(strict_types = 1); |
|
| 2 | 2 | |
| 3 | 3 | namespace Goose\Modules; |
| 4 | 4 | |