Conditions | 4 |
Paths | 3 |
Total Lines | 21 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
31 | public function parseString(string $subject) : Mailcode_Variables_Collection_Regular |
||
32 | { |
||
33 | $collection = new Mailcode_Variables_Collection_Regular(); |
||
34 | |||
35 | $matches = array(); |
||
36 | preg_match_all(self::REGEX_VARIABLE_NAME, $subject, $matches, PREG_PATTERN_ORDER); |
||
37 | |||
38 | if(!isset($matches[0]) || empty($matches[0])) |
||
39 | { |
||
40 | return $collection; |
||
41 | } |
||
42 | |||
43 | foreach($matches[0] as $idx => $matchedText) |
||
44 | { |
||
45 | $path = $matches[1][$idx]; |
||
46 | $name = $matches[2][$idx]; |
||
47 | |||
48 | $collection->add(new Mailcode_Variables_Variable($path, $name, $matchedText)); |
||
49 | } |
||
50 | |||
51 | return $collection; |
||
52 | } |
||
54 |