@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | } |
69 | 69 | // Render the template with our vars passed in |
70 | 70 | try { |
71 | - $htmlText = Craft::$app->view->renderTemplate('recipe/' .$templatePath, $params); |
|
71 | + $htmlText = Craft::$app->view->renderTemplate('recipe/'.$templatePath, $params); |
|
72 | 72 | $templateRendered = true; |
73 | 73 | } catch (\Exception $e) { |
74 | 74 | $templateRendered = false; |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | } |
84 | 84 | // Render the template with our vars passed in |
85 | 85 | try { |
86 | - $htmlText = Craft::$app->view->renderTemplate('recipe/' . $templatePath, $params); |
|
86 | + $htmlText = Craft::$app->view->renderTemplate('recipe/'.$templatePath, $params); |
|
87 | 87 | $templateRendered = true; |
88 | 88 | } catch (\Exception $e) { |
89 | 89 | $templateRendered = false; |
@@ -114,8 +114,7 @@ |
||
114 | 114 | if (!Craft::$app->getElements()->saveElement($entry)) { |
115 | 115 | $failed++; |
116 | 116 | } |
117 | - } |
|
118 | - else { |
|
117 | + } else { |
|
119 | 118 | $failed++; |
120 | 119 | } |
121 | 120 |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | $review = [ |
323 | 323 | 'type' => 'Review', |
324 | 324 | 'author' => $rating['author'], |
325 | - 'name' => $this->name . ' ' . Craft::t('recipe', 'Review'), |
|
325 | + 'name' => $this->name.' '.Craft::t('recipe', 'Review'), |
|
326 | 326 | 'description' => $rating['review'], |
327 | 327 | 'reviewRating' => [ |
328 | 328 | 'type' => 'Rating', |
@@ -338,13 +338,13 @@ discard block |
||
338 | 338 | } |
339 | 339 | |
340 | 340 | if ($this->prepTime) { |
341 | - $recipeJSONLD['prepTime'] = 'PT' . $this->prepTime . 'M'; |
|
341 | + $recipeJSONLD['prepTime'] = 'PT'.$this->prepTime.'M'; |
|
342 | 342 | } |
343 | 343 | if ($this->cookTime) { |
344 | - $recipeJSONLD['cookTime'] = 'PT' . $this->cookTime . 'M'; |
|
344 | + $recipeJSONLD['cookTime'] = 'PT'.$this->cookTime.'M'; |
|
345 | 345 | } |
346 | 346 | if ($this->totalTime) { |
347 | - $recipeJSONLD['totalTime'] = 'PT' . $this->totalTime . 'M'; |
|
347 | + $recipeJSONLD['totalTime'] = 'PT'.$this->totalTime.'M'; |
|
348 | 348 | } |
349 | 349 | |
350 | 350 | return $recipeJSONLD; |
@@ -538,11 +538,11 @@ discard block |
||
538 | 538 | $units = rtrim($units); |
539 | 539 | $units = rtrim($units, 's'); |
540 | 540 | } |
541 | - $ingredient .= ' ' . $units; |
|
541 | + $ingredient .= ' '.$units; |
|
542 | 542 | } |
543 | 543 | } |
544 | 544 | if ($row['ingredient']) { |
545 | - $ingredient .= ' ' . $row['ingredient']; |
|
545 | + $ingredient .= ' '.$row['ingredient']; |
|
546 | 546 | } |
547 | 547 | if ($raw) { |
548 | 548 | $ingredient = Template::raw($ingredient); |
@@ -703,8 +703,8 @@ discard block |
||
703 | 703 | */ |
704 | 704 | public function getServes(): string |
705 | 705 | { |
706 | - if(!empty($this->servesUnit)) { |
|
707 | - return $this->serves . ' ' . $this->servesUnit; |
|
706 | + if (!empty($this->servesUnit)) { |
|
707 | + return $this->serves.' '.$this->servesUnit; |
|
708 | 708 | } |
709 | 709 | |
710 | 710 | return $this->serves; |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | Event::on( |
84 | 84 | Fields::class, |
85 | 85 | Fields::EVENT_REGISTER_FIELD_TYPES, |
86 | - function (RegisterComponentTypesEvent $event) { |
|
86 | + function(RegisterComponentTypesEvent $event) { |
|
87 | 87 | $event->types[] = RecipeField::class; |
88 | 88 | } |
89 | 89 | ); |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | Event::on( |
93 | 93 | Plugins::class, |
94 | 94 | Plugins::EVENT_AFTER_INSTALL_PLUGIN, |
95 | - function (PluginEvent $event) { |
|
95 | + function(PluginEvent $event) { |
|
96 | 96 | if (!Craft::$app->getRequest()->getIsConsoleRequest() |
97 | 97 | && ($event->plugin === $this)) { |
98 | 98 | Craft::$app->getResponse()->redirect(UrlHelper::cpUrl('recipe/welcome'))->send(); |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | $feedMeInstalled = Craft::$app->getPlugins()->isPluginInstalled('feed-me') && Craft::$app->getPlugins()->isPluginEnabled('feed-me'); |
104 | 104 | |
105 | 105 | if ($feedMeInstalled) { |
106 | - Event::on(FeedMeFields::class, FeedMeFields::EVENT_REGISTER_FEED_ME_FIELDS, function (RegisterFeedMeFieldsEvent $e) { |
|
106 | + Event::on(FeedMeFields::class, FeedMeFields::EVENT_REGISTER_FEED_ME_FIELDS, function(RegisterFeedMeFieldsEvent $e) { |
|
107 | 107 | $e->fields[] = RecipeFeedMeField::class; |
108 | 108 | }); |
109 | 109 | } |
@@ -35,7 +35,7 @@ |
||
35 | 35 | // ref: https://github.com/craftcms/cms/issues/1989 |
36 | 36 | $config = ArrayHelper::merge([ |
37 | 37 | 'components' => [ |
38 | - 'nutritionApi' => NutritionApi::class,] |
|
38 | + 'nutritionApi' => NutritionApi::class, ] |
|
39 | 39 | ], $config); |
40 | 40 | |
41 | 41 | parent::__construct($id, $parent, $config); |
@@ -56,7 +56,7 @@ |
||
56 | 56 | $yield = $result->yield ?: 1; |
57 | 57 | |
58 | 58 | return [ |
59 | - 'servingSize' => round($result->totalWeight ?? 0 / $yield, 0) . ' grams', |
|
59 | + 'servingSize' => round($result->totalWeight ?? 0 / $yield, 0).' grams', |
|
60 | 60 | 'calories' => round($result->totalNutrients->ENERC_KCAL->quantity ?? 0 / $yield, 0), |
61 | 61 | 'carbohydrateContent' => round($result->totalNutrients->CHOCDF->quantity ?? 0 / $yield, 1), |
62 | 62 | 'cholesterolContent' => round($result->totalNutrients->CHOLE->quantity ?? 0 / $yield, 1), |
@@ -69,8 +69,7 @@ |
||
69 | 69 | 'transFatContent' => round($result->totalNutrients->FATRN->quantity ?? 0 / $yield, 1), |
70 | 70 | 'unsaturatedFatContent' => round(($result->totalNutrients->FAMS->quantity ?? 0 + $result->totalNutrients->FAPU->quantity ?? 0) / $yield, 1), |
71 | 71 | ]; |
72 | - } |
|
73 | - catch (Exception $exception) { |
|
72 | + } catch (Exception $exception) { |
|
74 | 73 | $message = 'Error fetching nutritional information from API. '; |
75 | 74 | |
76 | 75 | switch ($exception->getCode()) { |