PluginProbe
Solid Performance – Your No-Code Caching, Performance, & Page Speed Solution / 1.8.0
Solid Performance – Your No-Code Caching, Performance, & Page Speed Solution v1.8.0
2.0.1 trunk 1.0.0 1.1.0 1.2.0 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 1.4.2 1.5.0 1.6.0 1.6.1 1.7.0 1.7.1 1.8.0 1.9.0 2.0.0
solid-performance / src / Performance / Page_Cache / Compression / Contracts / Compressible.php

Compressible.php in Solid Performance – Your No-Code Caching, Performance, & Page Speed Solution 1.8.0, at src/Performance/Page_Cache/Compression/Contracts/Compressible.php

68 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * The Compressible contract for different browser compression strategies.
4 *
5 * @package SolidWP\Performance
6 */
7
8 declare( strict_types=1 );
9
10 namespace SolidWP\Performance\Page_Cache\Compression\Contracts;
11
12 use SolidWP\Performance\Page_Cache\Compression\Exceptions\CompressionFailedException;
13
14 /**
15 * @internal
16 */
17 interface Compressible {
18
19 /**
20 * Whether the current host has the appropriate PHP extensions to
21 * support this compression algorithm.
22 *
23 * @return bool
24 */
25 public function supported(): bool;
26
27 /**
28 * Whether this type of compression is enabled.
29 *
30 * @return bool
31 */
32 public function enabled(): bool;
33
34 /**
35 * Get the file extension for this type of compression.
36 *
37 * @return string
38 */
39 public function extension(): string;
40
41 /**
42 * Return the content-encoding header value, if any.
43 *
44 * @example gzip, br, zstd etc.
45 *
46 * @return string
47 */
48 public function encoding(): string;
49
50 /**
51 * Send Content-Encoding headers with the strategy's encoding.
52 *
53 * @return void
54 */
55 public function send_headers(): void;
56
57 /**
58 * Compress content.
59 *
60 * @param string $content The content to compress.
61 *
62 * @throws CompressionFailedException When the strategy fails to compress the content.
63 *
64 * @return string
65 */
66 public function compress( string $content ): string;
67 }
68