| Conditions | 2 |
| Paths | 2 |
| Total Lines | 18 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 29 | public function createViewAction(Request $request) |
||
| 30 | { |
||
| 31 | $viewName = $request->request->get('viewName'); |
||
| 32 | $viewBody = $request->request->get('viewBody'); |
||
| 33 | $viewPath = $this->get('knp_rad.view.path_deducer')->deducePath($viewName); |
||
| 34 | $filesystem = $this->get('filesystem'); |
||
| 35 | |||
| 36 | if ($filesystem->exists($viewPath)) { |
||
| 37 | return new Response(sprintf( |
||
| 38 | 'File "%s" already exists.', $viewPath |
||
| 39 | ), 409); |
||
| 40 | } |
||
| 41 | |||
| 42 | $filesystem->mkdir(dirname($viewPath)); |
||
| 43 | file_put_contents($viewPath, $viewBody); |
||
| 44 | |||
| 45 | return new Response(null, 201); |
||
| 46 | } |
||
| 47 | } |
||
| 48 |