1 | <?php |
||
14 | final class Converter implements ConverterInterface |
||
15 | { |
||
16 | /** |
||
17 | * The key to search for in the INI file to find the browscap settings |
||
18 | */ |
||
19 | const BROWSCAP_VERSION_KEY = 'GJK_Browscap_Version'; |
||
20 | |||
21 | /** |
||
22 | * @var \Psr\Log\LoggerInterface |
||
23 | */ |
||
24 | private $logger = null; |
||
25 | |||
26 | /** |
||
27 | * The cache instance |
||
28 | * |
||
29 | * @var \BrowscapPHP\Cache\BrowscapCacheInterface |
||
30 | */ |
||
31 | private $cache = null; |
||
32 | |||
33 | /** |
||
34 | * a filesystem patternHelper instance |
||
35 | * |
||
36 | * @var Filesystem |
||
37 | */ |
||
38 | private $filessystem = null; |
||
39 | |||
40 | /** |
||
41 | * version of the ini file |
||
42 | * |
||
43 | * @var int |
||
44 | */ |
||
45 | private $iniVersion = 0; |
||
46 | |||
47 | /** |
||
48 | * Converter constructor. |
||
49 | * |
||
50 | * @param LoggerInterface $logger |
||
51 | * @param BrowscapCacheInterface $cache |
||
52 | */ |
||
53 | 6 | public function __construct(LoggerInterface $logger, BrowscapCacheInterface $cache) |
|
58 | |||
59 | /** |
||
60 | * Sets a filesystem instance |
||
61 | * |
||
62 | * @param Filesystem $file |
||
63 | */ |
||
64 | 6 | public function setFilesystem(Filesystem $file) : void |
|
68 | |||
69 | /** |
||
70 | * Returns a filesystem instance |
||
71 | * |
||
72 | * @return Filesystem |
||
73 | */ |
||
74 | 3 | public function getFilesystem() : Filesystem |
|
82 | |||
83 | /** |
||
84 | * converts a file |
||
85 | * |
||
86 | * @param string $iniFile |
||
87 | * |
||
88 | * @throws FileNotFoundException |
||
89 | */ |
||
90 | 2 | public function convertFile(string $iniFile) : void |
|
104 | |||
105 | /** |
||
106 | * converts the string content |
||
107 | * |
||
108 | * @param string $iniString |
||
109 | */ |
||
110 | 2 | public function convertString(string $iniString) : void |
|
145 | |||
146 | /** |
||
147 | * Parses the ini data to get the version of loaded ini file |
||
148 | * |
||
149 | * @param string $iniString The loaded ini data |
||
150 | * |
||
151 | * @return int |
||
152 | */ |
||
153 | 1 | public function getIniVersion(string $iniString) : int |
|
166 | |||
167 | /** |
||
168 | * sets the version |
||
169 | * |
||
170 | * @param int $version |
||
171 | */ |
||
172 | public function setVersion(int $version) : void |
||
176 | |||
177 | /** |
||
178 | * stores the version of the ini file into cache |
||
179 | */ |
||
180 | public function storeVersion() : void |
||
184 | |||
185 | /** |
||
186 | * Parses the ini data to get the releaseDate of loaded ini file |
||
187 | * |
||
188 | * @param string $iniString The loaded ini data |
||
189 | * @return string|null |
||
190 | */ |
||
191 | 2 | private function getIniReleaseDate(string $iniString) : ?string |
|
201 | |||
202 | /** |
||
203 | * Parses the ini data to get the releaseDate of loaded ini file |
||
204 | * |
||
205 | * @param string $iniString The loaded ini data |
||
206 | * @return string|null |
||
207 | */ |
||
208 | 2 | private function getIniType(string $iniString) : ?string |
|
218 | } |
||
219 |