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->firstByte >= self::MAX_TOTAL_TIME) { |
||
39 | $displayFirstByte = ($this->sample->firstByte / 1000) . 's'; |
||
40 | $this->hasRecommendation = true; |
||
41 | $this->summary = Craft::t( |
||
42 | 'webperf', |
||
43 | 'The Time To First Byte (TTFB) is high', |
||
44 | [] |
||
45 | ); |
||
46 | $this->detail = Craft::t( |
||
47 | 'webperf', |
||
48 | 'The time it took for the client to receive the first byte of data from the server was {displayFirstByte}. Look into decreasing that via the `{% cache %}` tag or some kind of static caching such as the [Blitz](https://github.com/putyourlightson/craft-blitz) plugin, [FastCGI Cache](https://nystudio107.com/blog/static-caching-with-craft-cms), or [Varnish](https://supercool.github.io/2015/06/08/making-craft-sing-with-varnish-and-nginx.html).', |
||
49 | [ |
||
50 | 'displayFirstByte' => $displayFirstByte, |
||
51 | ] |
||
52 | ); |
||
53 | $this->learnMoreUrl = 'https://craftcms.com/guides/why-is-my-site-slow'; |
||
54 | |||
55 | return; |
||
56 | } |
||
59 |