| Conditions | 2 |
| Paths | 2 |
| Total Lines | 21 |
| Code Lines | 12 |
| 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->craftTwigMs >= self::MAX_TWIG_TIME) { |
||
| 39 | $displayCraftTwigMs = ($this->sample->craftTwigMs / 1000) . 's'; |
||
| 40 | $this->hasRecommendation = true; |
||
| 41 | $this->summary = Craft::t( |
||
| 42 | 'webperf', |
||
| 43 | 'Look into decreasing the Twig template rendering time', |
||
| 44 | [] |
||
| 45 | ); |
||
| 46 | $this->detail = Craft::t( |
||
| 47 | 'webperf', |
||
| 48 | 'The Twig templates took {displayCraftTwigMs} to render. Try to simplify the templates by doing less computation in Twig, and profiling them to see where the bottlenecks are.', |
||
| 49 | [ |
||
| 50 | 'displayCraftTwigMs' => $displayCraftTwigMs, |
||
| 51 | ] |
||
| 52 | ); |
||
| 53 | $this->learnMoreUrl = 'https://nystudio107.com/blog/profiling-your-website-with-craft-cms-3s-debug-toolbar'; |
||
| 54 | |||
| 55 | return; |
||
| 56 | } |
||
| 59 |