Total Complexity | 17 |
Total Lines | 112 |
Duplicated Lines | 0 % |
Coverage | 97.37% |
Changes | 0 |
1 | <?php |
||
8 | class Walker |
||
9 | { |
||
10 | private $dataStream; |
||
11 | /** |
||
12 | * @var array |
||
13 | */ |
||
14 | private $founds = []; |
||
15 | |||
16 | private $target; |
||
17 | |||
18 | /** |
||
19 | * @param array $founds |
||
20 | */ |
||
21 | 6 | private function setFounds(array $founds) |
|
22 | { |
||
23 | 6 | $this->founds = $founds; |
|
24 | 6 | } |
|
25 | |||
26 | /** |
||
27 | * @param $json |
||
28 | * @return $this |
||
29 | */ |
||
30 | 1 | public function fromJson($json) |
|
36 | } |
||
37 | |||
38 | /** |
||
39 | * @param $rawData |
||
40 | * @return $this |
||
41 | */ |
||
42 | 5 | public function from($rawData) |
|
48 | } |
||
49 | |||
50 | /** |
||
51 | * @param $target |
||
52 | * @return Walker |
||
53 | */ |
||
54 | 6 | public function with($target) |
|
55 | { |
||
56 | 6 | $this->target = $target; |
|
57 | 6 | $this->run(); |
|
58 | |||
59 | 6 | return $this; |
|
60 | } |
||
61 | |||
62 | /** |
||
63 | * @param callable|null $formatter |
||
64 | * @return string |
||
65 | */ |
||
66 | 4 | public function asString(callable $formatter = null) |
|
69 | } |
||
70 | |||
71 | /** |
||
72 | * @return array |
||
73 | */ |
||
74 | 3 | public function asArray() |
|
77 | } |
||
78 | |||
79 | /** |
||
80 | * @param $target |
||
81 | * @return array |
||
82 | */ |
||
83 | 6 | protected function parseTarget($target) |
|
84 | { |
||
85 | 6 | if (empty($target)) { |
|
86 | throw new \LogicException(sprintf('You must call %s::with($target) first', get_class($this))); |
||
87 | } |
||
88 | 6 | $separator = '->'; |
|
89 | |||
90 | 6 | return(explode($separator, $target)); |
|
91 | } |
||
92 | |||
93 | /** |
||
94 | * @param $node |
||
95 | * @param array $matches |
||
96 | * @return void |
||
97 | */ |
||
98 | 6 | protected function walk($node, array $matches) |
|
113 | } |
||
114 | } |
||
115 | 6 | } |
|
116 | |||
117 | 6 | private function run() |
|
120 | 6 | } |
|
121 | } |
||
122 |