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 / Config / Config_File.php

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

63 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Contains the location to the configuration file(s) on disk.
4 *
5 * @package SolidWP\Performance
6 */
7
8 declare( strict_types=1 );
9
10 namespace SolidWP\Performance\Config;
11
12 use InvalidArgumentException;
13
14 if ( ! defined( 'ABSPATH' ) ) {
15 exit;
16 }
17
18 /**
19 * Contains the location to the configuration file(s) on disk.
20 *
21 * @package SolidWP\Performance
22 */
23 final class Config_File {
24
25 /**
26 * The server directory where the config file is stored.
27 *
28 * @var string
29 */
30 private string $dir;
31
32 /**
33 * @param string $dir The server directory where the config file is stored.
34 *
35 * @throws InvalidArgumentException If an empty directory is provided.
36 */
37 public function __construct( string $dir ) {
38 if ( empty( $dir ) ) {
39 throw new InvalidArgumentException( 'The config directory cannot be empty' );
40 }
41
42 $this->dir = $dir;
43 }
44
45 /**
46 * The server directory of the configuration file.
47 *
48 * @return string
49 */
50 public function dir(): string {
51 return $this->dir;
52 }
53
54 /**
55 * The full server path to the configuration file.
56 *
57 * @return string
58 */
59 public function get(): string {
60 return $this->dir . '/config.php';
61 }
62 }
63