1 | <?php |
||
14 | class Parser |
||
15 | { |
||
16 | /** |
||
17 | * Parse the current content |
||
18 | * @return Rules |
||
19 | */ |
||
20 | public function analyze($content) |
||
48 | |||
49 | /** |
||
50 | * Handle content to build a valid instance |
||
51 | * @param string|Content $content |
||
52 | * @return Content |
||
53 | */ |
||
54 | private function handleContent($content) |
||
67 | |||
68 | /** |
||
69 | * Transform file content to structured Rules |
||
70 | * @param string|Content $content |
||
71 | * @return Rules |
||
72 | */ |
||
73 | public static function parse($content) |
||
78 | |||
79 | /** |
||
80 | * Parse a line of data |
||
81 | * @param array &$current |
||
82 | * @param string $line |
||
83 | */ |
||
84 | private function parseLine(array &$current, $line, Rules $rules) |
||
94 | |||
95 | /** |
||
96 | * Apply a method on all element of a given array |
||
97 | * @param array $data |
||
98 | * @param string $method |
||
99 | * @param string $param |
||
100 | */ |
||
101 | private function apply(array $data, $method, $param) |
||
107 | |||
108 | /** |
||
109 | * Populate rules property with build Rule instance |
||
110 | * @param Rules $rules |
||
111 | * @param array $current Collection of Rule objects |
||
112 | */ |
||
113 | private function populateRules(Rules $rules, array $current) |
||
119 | } |
||
120 |