Total Complexity | 3 |
Total Lines | 36 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
8 | trait AssignTrait |
||
9 | { |
||
10 | /** |
||
11 | * List of result names to assign the matched text to. |
||
12 | * |
||
13 | * @var callable[] |
||
14 | */ |
||
15 | private $assignCallbacks = []; |
||
16 | |||
17 | /** |
||
18 | * Resolve all callbacks registered to this trait. |
||
19 | * |
||
20 | * @param $text |
||
21 | */ |
||
22 | 371 | private function resolveAssignCallbacks($text) |
|
23 | { |
||
24 | 371 | foreach ($this->assignCallbacks as $callback) { |
|
25 | 2 | $callback($text); |
|
26 | } |
||
27 | 371 | } |
|
28 | |||
29 | /** |
||
30 | * After parsing, assign the matched input to the specified local variable. |
||
31 | * Only assign if successfully matched entire parent up to root. |
||
32 | * |
||
33 | * @param mixed $variable |
||
34 | * |
||
35 | * @return $this |
||
36 | */ |
||
37 | public function assignTo(&$variable) |
||
44 | } |
||
45 | } |
||
46 |