1 | <?php |
||
23 | final class Converter implements ConverterInterface |
||
24 | { |
||
25 | /** |
||
26 | * The key to search for in the INI file to find the browscap settings |
||
27 | */ |
||
28 | const BROWSCAP_VERSION_KEY = 'GJK_Browscap_Version'; |
||
29 | |||
30 | /** |
||
31 | * @var \Psr\Log\LoggerInterface |
||
32 | */ |
||
33 | private $logger = null; |
||
34 | |||
35 | /** |
||
36 | * The cache instance |
||
37 | * |
||
38 | * @var \BrowscapPHP\Cache\BrowscapCacheInterface |
||
39 | */ |
||
40 | private $cache = null; |
||
41 | |||
42 | /** |
||
43 | * a filesystem patternHelper instance |
||
44 | * |
||
45 | * @var Filesystem |
||
46 | */ |
||
47 | private $filessystem = null; |
||
48 | |||
49 | /** |
||
50 | * version of the ini file |
||
51 | * |
||
52 | * @var int |
||
53 | */ |
||
54 | private $iniVersion = 0; |
||
55 | |||
56 | /** |
||
57 | * Converter constructor. |
||
58 | * |
||
59 | * @param LoggerInterface $logger |
||
60 | * @param BrowscapCacheInterface $cache |
||
61 | */ |
||
62 | 6 | public function __construct(LoggerInterface $logger, BrowscapCacheInterface $cache) |
|
67 | |||
68 | /** |
||
69 | * Sets a filesystem instance |
||
70 | * |
||
71 | * @param Filesystem $file |
||
72 | */ |
||
73 | 6 | public function setFilesystem(Filesystem $file) : void |
|
77 | |||
78 | /** |
||
79 | * Returns a filesystem instance |
||
80 | * |
||
81 | * @return Filesystem |
||
82 | */ |
||
83 | 3 | public function getFilesystem() : Filesystem |
|
91 | |||
92 | /** |
||
93 | * converts a file |
||
94 | * |
||
95 | * @param string $iniFile |
||
96 | * |
||
97 | * @throws FileNotFoundException |
||
98 | */ |
||
99 | 2 | public function convertFile(string $iniFile) : void |
|
113 | |||
114 | /** |
||
115 | * converts the string content |
||
116 | * |
||
117 | * @param string $iniString |
||
118 | */ |
||
119 | 2 | public function convertString(string $iniString) : void |
|
171 | |||
172 | /** |
||
173 | * Parses the ini data to get the version of loaded ini file |
||
174 | * |
||
175 | * @param string $iniString The loaded ini data |
||
176 | * |
||
177 | * @return int |
||
178 | */ |
||
179 | 1 | public function getIniVersion(string $iniString) : int |
|
192 | |||
193 | /** |
||
194 | * sets the version |
||
195 | * |
||
196 | * @param int $version |
||
197 | */ |
||
198 | public function setVersion(int $version) : void |
||
202 | |||
203 | /** |
||
204 | * stores the version of the ini file into cache |
||
205 | */ |
||
206 | public function storeVersion() : void |
||
214 | |||
215 | /** |
||
216 | * Parses the ini data to get the releaseDate of loaded ini file |
||
217 | * |
||
218 | * @param string $iniString The loaded ini data |
||
219 | * |
||
220 | * @return string|null |
||
221 | */ |
||
222 | 2 | private function getIniReleaseDate(string $iniString) : ?string |
|
232 | |||
233 | /** |
||
234 | * Parses the ini data to get the releaseDate of loaded ini file |
||
235 | * |
||
236 | * @param string $iniString The loaded ini data |
||
237 | * |
||
238 | * @return string|null |
||
239 | */ |
||
240 | 2 | private function getIniType(string $iniString) : ?string |
|
250 | } |
||
251 |