| 1 |
<?php |
| 2 |
/** |
| 3 |
* The fallback compressor, which doesn't actually compress. |
| 4 |
* |
| 5 |
* This just returns uncompressed HTML. |
| 6 |
* |
| 7 |
* @package SolidWP\Performance |
| 8 |
*/ |
| 9 |
|
| 10 |
declare( strict_types=1 ); |
| 11 |
|
| 12 |
namespace SolidWP\Performance\Page_Cache\Compression\Strategies; |
| 13 |
|
| 14 |
use SolidWP\Performance\Page_Cache\Compression\Contracts\Compressible; |
| 15 |
|
| 16 |
/** |
| 17 |
* The fallback compressor, which doesn't actually compress. |
| 18 |
* |
| 19 |
* This just returns uncompressed HTML. |
| 20 |
* |
| 21 |
* @package SolidWP\Performance |
| 22 |
*/ |
| 23 |
final class Html implements Compressible { |
| 24 |
|
| 25 |
public const EXT = 'html'; |
| 26 |
|
| 27 |
/** |
| 28 |
* HTML is always supported. |
| 29 |
* |
| 30 |
* @return bool |
| 31 |
*/ |
| 32 |
public function supported(): bool { |
| 33 |
return true; |
| 34 |
} |
| 35 |
|
| 36 |
/** |
| 37 |
* HTML is always enabled. |
| 38 |
* |
| 39 |
* @return bool |
| 40 |
*/ |
| 41 |
public function enabled(): bool { |
| 42 |
return true; |
| 43 |
} |
| 44 |
|
| 45 |
/** |
| 46 |
* The file extension. |
| 47 |
* |
| 48 |
* @return string |
| 49 |
*/ |
| 50 |
public function extension(): string { |
| 51 |
return self::EXT; |
| 52 |
} |
| 53 |
|
| 54 |
/** |
| 55 |
* HTML has no specific content encoding. |
| 56 |
* |
| 57 |
* @return string |
| 58 |
*/ |
| 59 |
public function encoding(): string { |
| 60 |
return ''; |
| 61 |
} |
| 62 |
|
| 63 |
/** |
| 64 |
* No additional headers required for HTML. |
| 65 |
* |
| 66 |
* @return void |
| 67 |
*/ |
| 68 |
public function send_headers(): void { |
| 69 |
} |
| 70 |
|
| 71 |
/** |
| 72 |
* Pass through the content without any compression. |
| 73 |
* |
| 74 |
* @param string $content The content. |
| 75 |
* |
| 76 |
* @return string |
| 77 |
*/ |
| 78 |
public function compress( string $content ): string { |
| 79 |
return $content; |
| 80 |
} |
| 81 |
} |
| 82 |
|