@@ -27,14 +27,14 @@ discard block |
||
| 27 | 27 | $this->subject = $subject; |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - public function setRemoveDuplicates(bool $remove=true, bool $caseInsensitive=false) : self |
|
| 30 | + public function setRemoveDuplicates(bool $remove = true, bool $caseInsensitive = false) : self |
|
| 31 | 31 | { |
| 32 | 32 | $this->removeDuplicates = $remove; |
| 33 | 33 | $this->duplicatesCaseInsensitive = $caseInsensitive; |
| 34 | 34 | return $this; |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - public function setSorting(bool $sorting=true) : self |
|
| 37 | + public function setSorting(bool $sorting = true) : self |
|
| 38 | 38 | { |
| 39 | 39 | $this->sorting = $sorting; |
| 40 | 40 | return $this; |
@@ -52,11 +52,11 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | $words = $this->filterEmpty($words); |
| 54 | 54 | |
| 55 | - if($this->removeDuplicates) { |
|
| 55 | + if ($this->removeDuplicates) { |
|
| 56 | 56 | $words = $this->filterDuplicates($words); |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | - if($this->sorting) { |
|
| 59 | + if ($this->sorting) { |
|
| 60 | 60 | usort($words, 'strnatcasecmp'); |
| 61 | 61 | } |
| 62 | 62 | |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | private function filterDuplicates(array $words) : array |
| 67 | 67 | { |
| 68 | - if($this->duplicatesCaseInsensitive) { |
|
| 68 | + if ($this->duplicatesCaseInsensitive) { |
|
| 69 | 69 | return $this->filterDuplicatesCaseInsensitive($words); |
| 70 | 70 | } |
| 71 | 71 | |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | { |
| 77 | 77 | return array_intersect_key( |
| 78 | 78 | $array, |
| 79 | - array_unique( array_map( "strtolower", $array ) ) |
|
| 79 | + array_unique(array_map("strtolower", $array)) |
|
| 80 | 80 | ); |
| 81 | 81 | } |
| 82 | 82 | |
@@ -88,13 +88,13 @@ discard block |
||
| 88 | 88 | { |
| 89 | 89 | $keep = array(); |
| 90 | 90 | |
| 91 | - foreach($words as $word) |
|
| 91 | + foreach ($words as $word) |
|
| 92 | 92 | { |
| 93 | - if(empty($word)) { |
|
| 93 | + if (empty($word)) { |
|
| 94 | 94 | continue; |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | - if(mb_strlen($word) < $this->minWordLength) { |
|
| 97 | + if (mb_strlen($word) < $this->minWordLength) { |
|
| 98 | 98 | continue; |
| 99 | 99 | } |
| 100 | 100 | |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | public function setMinWords(int $min) : self |
| 123 | 123 | { |
| 124 | 124 | // Avoid a reset if the value is the same |
| 125 | - if($this->minWords === $min) |
|
| 125 | + if ($this->minWords === $min) |
|
| 126 | 126 | { |
| 127 | 127 | return $this; |
| 128 | 128 | } |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | |
| 143 | 143 | private function detect() : void |
| 144 | 144 | { |
| 145 | - if($this->detected) { |
|
| 145 | + if ($this->detected) { |
|
| 146 | 146 | return; |
| 147 | 147 | } |
| 148 | 148 | |
@@ -150,15 +150,15 @@ discard block |
||
| 150 | 150 | $this->found = array(); |
| 151 | 151 | $this->count = 0; |
| 152 | 152 | |
| 153 | - foreach(self::$words as $word) |
|
| 153 | + foreach (self::$words as $word) |
|
| 154 | 154 | { |
| 155 | - if(stripos($this->subject, $word) !== false) |
|
| 155 | + if (stripos($this->subject, $word) !== false) |
|
| 156 | 156 | { |
| 157 | 157 | $this->count++; |
| 158 | 158 | $this->found[] = $word; |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | - if($this->count >= $this->minWords) { |
|
| 161 | + if ($this->count >= $this->minWords) { |
|
| 162 | 162 | break; |
| 163 | 163 | } |
| 164 | 164 | } |