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->firstContentfulPaint >= self::MAX_FIRST_CONTENTFUL_PAINT_TIME) { |
||
39 | $displayFirstContentfulPaint = ($this->sample->firstContentfulPaint / 1000) . 's'; |
||
40 | $this->hasRecommendation = true; |
||
41 | $this->summary = Craft::t( |
||
42 | 'webperf', |
||
43 | 'The wait is too long before content is displayed', |
||
44 | [] |
||
45 | ); |
||
46 | $this->detail = Craft::t( |
||
47 | 'webperf', |
||
48 | 'The first contentful paint took {displayFirstContentfulPaint}. Try to avoid blocking the render by implementing [CriticalCSS](https://nystudio107.com/blog/implementing-critical-css), optimizing the [Critical Path](https://developers.google.com/web/fundamentals/performance/critical-rendering-path/) by loading JavaScript asynchronously, and using the [font-display](https://css-tricks.com/font-display-masses/) property.', |
||
49 | [ |
||
50 | 'displayFirstContentfulPaint' => $displayFirstContentfulPaint, |
||
51 | ] |
||
52 | ); |
||
53 | $this->learnMoreUrl = 'https://developers.google.com/web/tools/lighthouse/audits/first-contentful-paint'; |
||
54 | |||
55 | return; |
||
56 | } |
||
59 |