Conditions | 5 |
Paths | 6 |
Total Lines | 26 |
Code Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 6.7458 |
Changes | 0 |
1 | <?php |
||
32 | 3 | protected function prePerform() |
|
33 | { |
||
34 | 3 | $originalJson = file_get_contents($this->originalPath); |
|
35 | 3 | if (!$originalJson) { |
|
36 | $this->response->error('Unable to read ' . $this->originalPath); |
||
37 | return; |
||
38 | } |
||
39 | |||
40 | 3 | $newJson = file_get_contents($this->newPath); |
|
41 | 3 | if (!$newJson) { |
|
42 | $this->response->error('Unable to read ' . $this->newPath); |
||
43 | return; |
||
44 | } |
||
45 | |||
46 | 3 | $options = 0; |
|
47 | 3 | if ($this->rearrangeArrays) { |
|
48 | 3 | $options += JsonDiff::REARRANGE_ARRAYS; |
|
49 | } |
||
50 | try { |
||
51 | 3 | $this->diff = new JsonDiff(json_decode($originalJson), json_decode($newJson), $options); |
|
52 | } catch (Exception $e) { |
||
53 | $this->response->error($e->getMessage()); |
||
54 | return; |
||
55 | } |
||
56 | |||
57 | 3 | $this->out = ''; |
|
58 | 3 | } |
|
60 | } |