Conditions | 6 |
Paths | 10 |
Total Lines | 20 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
10 | public function processPhrases() |
||
11 | { |
||
12 | // to match lower case letters in words set array |
||
13 | $lowerSource = $this->addLowSpaces($this->text->getString()); |
||
14 | /** |
||
15 | * @var string $points |
||
16 | * @var array $phrases |
||
17 | */ |
||
18 | foreach ($this->dataSet->getPhrases() as $points => $phrases) { |
||
19 | foreach ($phrases as $phrase) { |
||
20 | if (mb_strpos($lowerSource, ' ' . $phrase . ' ') !== false) { |
||
21 | $this->score += (float)$points; |
||
22 | if ($this->text->isReplaceable()) { |
||
23 | $this->replace($phrase); |
||
24 | } |
||
25 | } |
||
26 | } |
||
27 | } |
||
28 | if ($this->score >= self::MAX_SCORE) { |
||
29 | $this->score = self::MAX_SCORE; |
||
30 | } |
||
32 | } |