| Conditions | 2 |
| Paths | 2 |
| Total Lines | 20 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 35 | public function evaluate() |
||
| 36 | { |
||
| 37 | // See if there are too many database queries |
||
| 38 | if ($this->sample->craftDbCnt >= self::MAX_QUERIES) { |
||
| 39 | $this->hasRecommendation = true; |
||
| 40 | $this->summary = Craft::t( |
||
| 41 | 'webperf', |
||
| 42 | 'Look into Eager Loading to decrease database queries', |
||
| 43 | [] |
||
| 44 | ); |
||
| 45 | $this->detail = Craft::t( |
||
| 46 | 'webperf', |
||
| 47 | 'A total of {dbQueries} database queries were executed. Look into decreasing the number of database queries needed by leveraging Eager Loading in Craft CMS.', |
||
| 48 | [ |
||
| 49 | 'dbQueries' => $this->sample->craftDbCnt, |
||
| 50 | ] |
||
| 51 | ); |
||
| 52 | $this->learnMoreUrl = 'https://nystudio107.com/blog/speed-up-your-craft-cms-templates-with-eager-loading'; |
||
| 53 | |||
| 54 | return; |
||
| 55 | } |
||
| 58 |