1 | <?php |
||
5 | class Config |
||
6 | { |
||
7 | /** |
||
8 | * Name of file (with or without full path to this file) |
||
9 | * @var string |
||
10 | */ |
||
11 | private $_archive = './easy-rsa.tar.gz'; |
||
12 | |||
13 | /** |
||
14 | * Path to folder with easy-rsa scripts |
||
15 | * @var string |
||
16 | */ |
||
17 | private $_scripts = './easy-rsa'; |
||
18 | |||
19 | /** |
||
20 | * Path to folder with certificates |
||
21 | * @var string |
||
22 | */ |
||
23 | private $_certs = '.'; |
||
24 | |||
25 | /** |
||
26 | * Get path with certificates |
||
27 | * |
||
28 | * @return string |
||
29 | */ |
||
30 | public function getCerts(): string |
||
34 | |||
35 | /** |
||
36 | * Set full path to folder with certificates |
||
37 | * |
||
38 | * @param string $folder |
||
39 | * @return Config |
||
40 | */ |
||
41 | public function setCerts(string $folder): self |
||
46 | |||
47 | /** |
||
48 | * Get full path to folder with scripts |
||
49 | * |
||
50 | * @return string |
||
51 | */ |
||
52 | public function getScripts(): string |
||
56 | |||
57 | /** |
||
58 | * Set path with easy-rsa scripts |
||
59 | * |
||
60 | * @param string $folder |
||
61 | * @return Config |
||
62 | */ |
||
63 | public function setScripts(string $folder): self |
||
68 | |||
69 | /** |
||
70 | * Get archive file with full path |
||
71 | * |
||
72 | * @return string |
||
73 | */ |
||
74 | public function getArchive(): string |
||
78 | |||
79 | /** |
||
80 | * Set easy-rsa archive file with full path |
||
81 | * |
||
82 | * @param string $archive |
||
83 | * @return Config |
||
84 | */ |
||
85 | public function setArchive(string $archive): self |
||
90 | |||
91 | /** |
||
92 | * Remove '.' and '..' path parts and make path absolute without |
||
93 | * resolving symlinks. |
||
94 | * |
||
95 | * Examples: |
||
96 | * |
||
97 | * resolvePath("test/./me/../now/", false); |
||
98 | * => test/now |
||
99 | * |
||
100 | * resolvePath("test///.///me///../now/", true); |
||
101 | * => /home/example/test/now |
||
102 | * |
||
103 | * resolvePath("test/./me/../now/", "/www/example.com"); |
||
104 | * => /www/example.com/test/now |
||
105 | * |
||
106 | * resolvePath("/test/./me/../now/", "/www/example.com"); |
||
107 | * => /test/now |
||
108 | * |
||
109 | * @param string $path |
||
110 | * @param mixed $basePath resolve paths realtively to this path. Params: |
||
111 | * STRING: prefix with this path; |
||
112 | * TRUE: use current dir; |
||
113 | * FALSE: keep relative (default) |
||
114 | * @return string resolved path |
||
115 | */ |
||
116 | public function resolvePath(string $path, $basePath = true): string |
||
141 | } |
||
142 |