| Conditions | 3 |
| Paths | 3 |
| Total Lines | 13 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 22 | public function update(Request $request, Property $property, UserPropertyRepository $repository): JsonResponse |
||
| 23 | { |
||
| 24 | $state = $request->query->get('state'); |
||
| 25 | |||
| 26 | if (!\in_array($state, ['published', 'private'], true)) { |
||
| 27 | return new JsonResponse(['status' => 'fail'], 422); |
||
| 28 | } |
||
| 29 | |||
| 30 | if ($repository->changeState($property, $state)) { |
||
| 31 | return new JsonResponse(['status' => 'ok']); |
||
| 32 | } |
||
| 33 | |||
| 34 | return new JsonResponse(['status' => 'fail'], 500); |
||
| 35 | } |
||
| 37 |