Passed
Push — v5 ( 1b075a...467c6f )
by Andrew
20:32 queued 15:03
created
ecs.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@
 block discarded – undo
5 5
 
6 6
 return static function(ECSConfig $ecsConfig): void {
7 7
     $ecsConfig->paths([
8
-        __DIR__ . '/src',
8
+        __DIR__.'/src',
9 9
         __FILE__,
10 10
     ]);
11 11
     $ecsConfig->parallel();
Please login to merge, or discard this patch.
src/helpers/PluginTemplate.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 
67 67
         // Render the template with our vars passed in
68 68
         try {
69
-            $htmlText = Craft::$app->view->renderTemplate('recipe/' . $templatePath, $params);
69
+            $htmlText = Craft::$app->view->renderTemplate('recipe/'.$templatePath, $params);
70 70
             $templateRendered = true;
71 71
         } catch (\Exception $exception) {
72 72
             $templateRendered = false;
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
 
83 83
             // Render the template with our vars passed in
84 84
             try {
85
-                $htmlText = Craft::$app->view->renderTemplate('recipe/' . $templatePath, $params);
85
+                $htmlText = Craft::$app->view->renderTemplate('recipe/'.$templatePath, $params);
86 86
                 $templateRendered = true;
87 87
             } catch (\Exception $exception) {
88 88
                 $templateRendered = false;
Please login to merge, or discard this patch.
src/models/Recipe.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
                 $review = [
365 365
                     'type' => 'Review',
366 366
                     'author' => $rating['author'],
367
-                    'name' => $this->name . ' ' . Craft::t('recipe', 'Review'),
367
+                    'name' => $this->name.' '.Craft::t('recipe', 'Review'),
368 368
                     'description' => $rating['review'],
369 369
                     'reviewRating' => [
370 370
                         'type' => 'Rating',
@@ -381,15 +381,15 @@  discard block
 block discarded – undo
381 381
         }
382 382
 
383 383
         if ($this->prepTime !== 0) {
384
-            $recipeJSONLD['prepTime'] = 'PT' . $this->prepTime . 'M';
384
+            $recipeJSONLD['prepTime'] = 'PT'.$this->prepTime.'M';
385 385
         }
386 386
 
387 387
         if ($this->cookTime !== 0) {
388
-            $recipeJSONLD['cookTime'] = 'PT' . $this->cookTime . 'M';
388
+            $recipeJSONLD['cookTime'] = 'PT'.$this->cookTime.'M';
389 389
         }
390 390
 
391 391
         if ($this->totalTime !== 0) {
392
-            $recipeJSONLD['totalTime'] = 'PT' . $this->totalTime . 'M';
392
+            $recipeJSONLD['totalTime'] = 'PT'.$this->totalTime.'M';
393 393
         }
394 394
 
395 395
         return $recipeJSONLD;
@@ -443,7 +443,7 @@  discard block
 block discarded – undo
443 443
      *
444 444
      *
445 445
      */
446
-    public function renderRecipeJSONLD(bool $raw = true): string|Markup
446
+    public function renderRecipeJSONLD(bool $raw = true): string | Markup
447 447
     {
448 448
         return $this->renderJsonLd($this->getRecipeJSONLD(), $raw);
449 449
     }
@@ -606,12 +606,12 @@  discard block
 block discarded – undo
606 606
                         $units = rtrim($units, 's');
607 607
                     }
608 608
 
609
-                    $ingredient .= ' ' . $units;
609
+                    $ingredient .= ' '.$units;
610 610
                 }
611 611
             }
612 612
 
613 613
             if ($row['ingredient']) {
614
-                $ingredient .= ' ' . $row['ingredient'];
614
+                $ingredient .= ' '.$row['ingredient'];
615 615
             }
616 616
 
617 617
             if ($raw) {
@@ -666,7 +666,7 @@  discard block
 block discarded – undo
666 666
     /**
667 667
      * Get the aggregate rating from all the ratings
668 668
      */
669
-    public function getAggregateRating(): float|int|string
669
+    public function getAggregateRating(): float | int | string
670 670
     {
671 671
         $result = 0;
672 672
         $total = 0;
@@ -695,10 +695,10 @@  discard block
 block discarded – undo
695 695
     /**
696 696
      * Returns concatenated serves with its unit
697 697
      */
698
-    public function getServes(): int|string
698
+    public function getServes(): int | string
699 699
     {
700 700
         if (!empty($this->servesUnit)) {
701
-            return $this->serves . ' ' . $this->servesUnit;
701
+            return $this->serves.' '.$this->servesUnit;
702 702
         }
703 703
 
704 704
         return $this->serves;
@@ -766,7 +766,7 @@  discard block
 block discarded – undo
766 766
             $whole = '';
767 767
         }
768 768
 
769
-        return $whole . $fraction;
769
+        return $whole.$fraction;
770 770
     }
771 771
 
772 772
     // Private Methods
@@ -777,7 +777,7 @@  discard block
 block discarded – undo
777 777
      *
778 778
      * @param      $json
779 779
      */
780
-    private function renderJsonLd($json, bool $raw = true): string|Markup
780
+    private function renderJsonLd($json, bool $raw = true): string | Markup
781 781
     {
782 782
         $linebreak = '';
783 783
 
Please login to merge, or discard this patch.
src/console/controllers/NutritionApiController.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -57,19 +57,19 @@  discard block
 block discarded – undo
57 57
         /** @var Settings $settings */
58 58
         $settings = Recipe::$plugin->getSettings();
59 59
         if (!$settings->hasApiCredentials()) {
60
-            $this->stderr(Craft::t('recipe', 'API credentials do not exist in plugin settings.') . PHP_EOL, BaseConsole::FG_RED);
60
+            $this->stderr(Craft::t('recipe', 'API credentials do not exist in plugin settings.').PHP_EOL, BaseConsole::FG_RED);
61 61
 
62 62
             return ExitCode::OK;
63 63
         }
64 64
 
65 65
         if ($this->section === null) {
66
-            $this->stderr(Craft::t('recipe', 'A section handle must be provided using --section.') . PHP_EOL, BaseConsole::FG_RED);
66
+            $this->stderr(Craft::t('recipe', 'A section handle must be provided using --section.').PHP_EOL, BaseConsole::FG_RED);
67 67
 
68 68
             return ExitCode::OK;
69 69
         }
70 70
 
71 71
         if ($this->field === null) {
72
-            $this->stderr(Craft::t('recipe', 'A field handle must be provided using --field.') . PHP_EOL, BaseConsole::FG_RED);
72
+            $this->stderr(Craft::t('recipe', 'A field handle must be provided using --field.').PHP_EOL, BaseConsole::FG_RED);
73 73
 
74 74
             return ExitCode::OK;
75 75
         }
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
         $entries = Entry::find()->section($this->section)->all();
78 78
 
79 79
         if (empty($entries)) {
80
-            $this->stderr(Craft::t('recipe', 'No entries found in the section with handle `{handle}`.', ['handle' => $this->section]) . PHP_EOL, BaseConsole::FG_RED);
80
+            $this->stderr(Craft::t('recipe', 'No entries found in the section with handle `{handle}`.', ['handle' => $this->section]).PHP_EOL, BaseConsole::FG_RED);
81 81
 
82 82
             return ExitCode::OK;
83 83
         }
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
         $count = 0;
87 87
         $failed = 0;
88 88
 
89
-        $this->stdout(Craft::t('recipe', 'Generating nutritional information for {count} entries...', ['count' => $total]) . PHP_EOL, BaseConsole::FG_YELLOW);
89
+        $this->stdout(Craft::t('recipe', 'Generating nutritional information for {count} entries...', ['count' => $total]).PHP_EOL, BaseConsole::FG_YELLOW);
90 90
 
91 91
         Console::startProgress($count, $total, '', 0.8);
92 92
 
@@ -125,10 +125,10 @@  discard block
 block discarded – undo
125 125
 
126 126
         $succeeded = $count - $failed;
127 127
 
128
-        $this->stdout(Craft::t('recipe', 'Successfully generated nutritional information for {count} entries.', ['count' => $succeeded]) . PHP_EOL, BaseConsole::FG_GREEN);
128
+        $this->stdout(Craft::t('recipe', 'Successfully generated nutritional information for {count} entries.', ['count' => $succeeded]).PHP_EOL, BaseConsole::FG_GREEN);
129 129
 
130 130
         if ($failed > 0) {
131
-            $this->stderr(Craft::t('recipe', 'Failed to generate nutritional information for {count} entries.', ['count' => $failed]) . PHP_EOL, BaseConsole::FG_RED);
131
+            $this->stderr(Craft::t('recipe', 'Failed to generate nutritional information for {count} entries.', ['count' => $failed]).PHP_EOL, BaseConsole::FG_RED);
132 132
         }
133 133
 
134 134
         return ExitCode::OK;
Please login to merge, or discard this patch.
src/helpers/Json.php 1 patch
Spacing   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -51,10 +51,8 @@
 block discarded – undo
51 51
      * @inheritdoc
52 52
      */
53 53
     protected static function processData($data, &$expressions, $expPrefix)
54
-    {
55
-        ++self::$recursionLevel;
56
-        $result = parent::processData($data, $expressions, $expPrefix);
57
-        --self::$recursionLevel;
54
+    {++self::$recursionLevel;
55
+        $result = parent::processData($data, $expressions, $expPrefix);--self::$recursionLevel;
58 56
         static::normalizeJsonLdArray($result, self::$recursionLevel);
59 57
 
60 58
         return $result;
Please login to merge, or discard this patch.
src/services/NutritionApi.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -38,8 +38,8 @@  discard block
 block discarded – undo
38 38
         }
39 39
 
40 40
         $url = 'https://api.edamam.com/api/nutrition-details'
41
-            . '?app_id=' . Craft::parseEnv($settings->apiApplicationId)
42
-            . '&app_key=' . Craft::parseEnv($settings->apiApplicationKey);
41
+            . '?app_id='.Craft::parseEnv($settings->apiApplicationId)
42
+            . '&app_key='.Craft::parseEnv($settings->apiApplicationKey);
43 43
 
44 44
         $data = [
45 45
             'ingr' => $ingredients,
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
             $yield = $result->yield ?: 1;
58 58
 
59 59
             return [
60
-                'servingSize' => round($result->totalWeight ?? 0 / $yield, 0) . ' grams',
60
+                'servingSize' => round($result->totalWeight ?? 0 / $yield, 0).' grams',
61 61
                 'calories' => round($result->totalNutrients->ENERC_KCAL->quantity ?? 0 / $yield, 0),
62 62
                 'carbohydrateContent' => round($result->totalNutrients->CHOCDF->quantity ?? 0 / $yield, 1),
63 63
                 'cholesterolContent' => round($result->totalNutrients->CHOLE->quantity ?? 0 / $yield, 1),
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
                 $message .= 'One or more ingredients could not be recognized.';
80 80
             }
81 81
 
82
-            Craft::error($message . $exception->getMessage(), __METHOD__);
82
+            Craft::error($message.$exception->getMessage(), __METHOD__);
83 83
 
84 84
             return ['error' => $message];
85 85
         }
Please login to merge, or discard this patch.
src/fields/Recipe.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
     /**
48 48
      * @inheritdoc
49 49
      */
50
-    public static function dbType(): array|string|null
50
+    public static function dbType(): array | string | null
51 51
     {
52 52
         return Schema::TYPE_TEXT;
53 53
     }
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
             'prefix' => Craft::$app->getView()->namespaceInputId(''),
172 172
         ];
173 173
         $jsonVars = Json::encode($jsonVars);
174
-        Craft::$app->getView()->registerJs(sprintf('$(\'#%s-field\').RecipeRecipe(', $nameSpacedId) . $jsonVars . ");");
174
+        Craft::$app->getView()->registerJs(sprintf('$(\'#%s-field\').RecipeRecipe(', $nameSpacedId).$jsonVars.");");
175 175
 
176 176
         // Set asset elements
177 177
         $elements = [];
Please login to merge, or discard this patch.