Conditions | 4 |
Paths | 6 |
Total Lines | 24 |
Code Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
34 | public function performAction() |
||
35 | { |
||
36 | $patchJson = file_get_contents($this->patchPath); |
||
37 | if (!$patchJson) { |
||
38 | $this->response->error('Unable to read ' . $this->patchPath); |
||
39 | return; |
||
40 | } |
||
41 | |||
42 | $baseJson = file_get_contents($this->basePath); |
||
43 | if (!$baseJson) { |
||
44 | $this->response->error('Unable to read ' . $this->basePath); |
||
45 | return; |
||
46 | } |
||
47 | |||
48 | try { |
||
49 | $patch = JsonPatch::import(json_decode($patchJson)); |
||
50 | $base = json_decode($baseJson); |
||
51 | $patch->apply($base); |
||
52 | } catch (Exception $e) { |
||
53 | $this->response->error($e->getMessage()); |
||
54 | } |
||
55 | $this->out = $base; |
||
56 | |||
57 | $this->postPerform(); |
||
58 | } |
||
60 | } |