Conditions | 2 |
Paths | 2 |
Total Lines | 16 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Changes | 3 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
31 | public function actionGetNutritionalInfo() |
||
32 | { |
||
33 | $this->requireAcceptsJson(); |
||
34 | |||
35 | $ingredients = Craft::$app->getRequest()->getParam('ingredients'); |
||
36 | $serves = Craft::$app->getRequest()->getParam('serves'); |
||
37 | |||
38 | if (empty($ingredients)) { |
||
39 | return $this->asJson([ |
||
40 | 'error' => 'Please provide some ingredients first.' |
||
41 | ]); |
||
42 | } |
||
43 | |||
44 | $nutritionalInfo = Recipe::$plugin->nutritionApi->getNutritionalInfo($ingredients, $serves); |
||
45 | |||
46 | return $this->asJson($nutritionalInfo); |
||
47 | } |
||
49 |