Conditions | 3 |
Paths | 6 |
Total Lines | 18 |
Code Lines | 12 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 3.3332 |
Changes | 0 |
1 | <?php |
||
35 | 1 | public function performAction() |
|
36 | { |
||
37 | 1 | $patchJson = $this->readData($this->patchPath); |
|
38 | 1 | $base = $this->readData($this->basePath); |
|
39 | |||
40 | try { |
||
41 | 1 | $patch = JsonPatch::import($patchJson); |
|
42 | 1 | $errors = $patch->apply($base, !$this->tolerateErrors); |
|
43 | 1 | foreach ($errors as $error) { |
|
44 | $this->response->error($error->getMessage()); |
||
45 | } |
||
46 | 1 | $this->out = $base; |
|
47 | } catch (Exception $e) { |
||
48 | $this->response->error($e->getMessage()); |
||
49 | die(1); |
||
|
|||
50 | } |
||
51 | |||
52 | 1 | $this->postPerform(); |
|
53 | 1 | } |
|
55 | } |
In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.