PluginProbe
Solid Performance – Your No-Code Caching, Performance, & Page Speed Solution / 2.0.0
Solid Performance – Your No-Code Caching, Performance, & Page Speed Solution v2.0.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 / Cache_Delivery / Contracts / Config_File.php

Config_File.php in Solid Performance – Your No-Code Caching, Performance, & Page Speed Solution 2.0.0, at src/Performance/Cache_Delivery/Contracts/Config_File.php

59 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Represents a config file for a particular cache delivery strategy.
4 *
5 * @package SolidWP\Performance
6 */
7
8 declare( strict_types=1 );
9
10 namespace SolidWP\Performance\Cache_Delivery\Contracts;
11
12 use RuntimeException;
13
14 /**
15 * Represents a config file for a particular cache delivery strategy.
16 *
17 * @package SolidWP\Performance
18 */
19 abstract class Config_File {
20
21 /**
22 * Memoization cache for the file path.
23 *
24 * @var string|null
25 */
26 protected ?string $filepath = null;
27
28 /**
29 * Get the server path to the cache delivery strategy config file.
30 *
31 * @throws RuntimeException If something goes seriously wrong finding the path.
32 *
33 * @return string
34 */
35 abstract public function get_file_path(): string;
36
37 /**
38 * Check if the cache delivery file exists.
39 *
40 * @throws RuntimeException If something goes seriously wrong finding the path.
41 *
42 * @return bool
43 */
44 public function exists(): bool {
45 return file_exists( $this->get_file_path() );
46 }
47
48 /**
49 * Check if the cache delivery file exists and is writable.
50 *
51 * @throws RuntimeException If something goes seriously wrong finding the path.
52 *
53 * @return bool
54 */
55 public function is_writable(): bool {
56 return is_writable( $this->get_file_path() );
57 }
58 }
59