| Total Complexity | 17 |
| Total Lines | 112 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 0 | ||
| 1 | <?php |
||
| 8 | class Walker |
||
| 9 | {
|
||
| 10 | private $dataEntryPoint; |
||
| 11 | /** |
||
| 12 | * @var array |
||
| 13 | */ |
||
| 14 | private $founds = []; |
||
| 15 | /** |
||
| 16 | * @var array |
||
| 17 | */ |
||
| 18 | private $targets = []; |
||
| 19 | /** |
||
| 20 | * @param array $founds |
||
| 21 | */ |
||
| 22 | 7 | private function setFounds(array $founds) |
|
| 25 | 7 | } |
|
| 26 | |||
| 27 | /** |
||
| 28 | * @param $json |
||
| 29 | * @return $this |
||
| 30 | */ |
||
| 31 | 1 | public function fromJson($json) |
|
| 32 | {
|
||
| 33 | 1 | $this->setFounds([]); |
|
| 34 | 1 | $this->dataEntryPoint = json_decode($json); |
|
| 35 | |||
| 36 | 1 | return $this; |
|
| 37 | } |
||
| 38 | |||
| 39 | /** |
||
| 40 | * @param $rawData |
||
| 41 | * @return $this |
||
| 42 | */ |
||
| 43 | 6 | public function from($rawData) |
|
| 49 | } |
||
| 50 | |||
| 51 | /** |
||
| 52 | * @param $target |
||
| 53 | * @return Walker |
||
| 54 | */ |
||
| 55 | 7 | public function with($target) |
|
| 56 | {
|
||
| 57 | 7 | $this->targets[] = $target; |
|
| 58 | |||
| 59 | 7 | return $this; |
|
| 60 | } |
||
| 61 | |||
| 62 | /** |
||
| 63 | * @param callable|null $formatter |
||
| 64 | * @return string |
||
| 65 | */ |
||
| 66 | 5 | public function asString(callable $formatter = null) |
|
| 70 | } |
||
| 71 | |||
| 72 | /** |
||
| 73 | * @return array |
||
| 74 | */ |
||
| 75 | 3 | public function asArray() |
|
| 79 | } |
||
| 80 | |||
| 81 | /** |
||
| 82 | * @param $target |
||
| 83 | * @return array |
||
| 84 | */ |
||
| 85 | 7 | protected function parseTarget($target) |
|
| 86 | {
|
||
| 87 | 7 | $separator = '->'; |
|
| 88 | |||
| 89 | 7 | return(explode($separator, $target)); |
|
| 90 | } |
||
| 91 | |||
| 92 | /** |
||
| 93 | * @param $node |
||
| 94 | * @param array $matches |
||
| 95 | * @return void |
||
| 96 | */ |
||
| 97 | 7 | protected function walk($node, array $matches) |
|
| 112 | } |
||
| 113 | } |
||
| 114 | 7 | } |
|
| 115 | |||
| 116 | 8 | private function run() |
|
| 120 | } |
||
| 121 | 8 | } |
|
| 123 |