Conditions | 4 |
Paths | 3 |
Total Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Tests | 7 |
CRAP Score | 4 |
Changes | 0 |
1 | <?php declare(strict_types=1); |
||
35 | 2 | public function containsCount( |
|
36 | string $serializedData, |
||
37 | string $searchTerm |
||
38 | ): int { |
||
39 | 2 | $tokenizer = new Tokenizer(); |
|
40 | |||
41 | 2 | $count = 0; |
|
42 | 2 | foreach ($tokenizer->tokenize($serializedData) as $token) { |
|
43 | 2 | if (Token::STRING === $token->getType() && strstr($token->getValue(), $searchTerm)) { |
|
44 | 2 | $count += substr_count($token->getValue(), $searchTerm); |
|
45 | } |
||
46 | } |
||
47 | |||
48 | 2 | return $count; |
|
49 | } |
||
50 | |||
70 | } |