| Conditions | 2 |
| Paths | 2 |
| Total Lines | 13 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 6 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 30 | public static function fromWikiSignature(string $string) |
||
| 31 | { |
||
| 32 | // 1 janvier 2020 à 17:44 (CET) => 1 January 2020 à 17:44 (CET) |
||
| 33 | $string = self::french2English(trim($string)); |
||
| 34 | |||
| 35 | $timezone = new DateTimeZone('Europe/Paris'); // CET, CEST |
||
| 36 | if (preg_match('/\(UTC\)/', $string)) { |
||
| 37 | $timezone = new DateTimeZone('UTC'); |
||
| 38 | } |
||
| 39 | $string = preg_replace('/\([A-Z]{3,4}\)/', '', $string); // strip CET,CEST,UTC |
||
| 40 | // convert fuseau ? https://stackoverflow.com/questions/5746531/utc-date-time-string-to-timezone |
||
| 41 | |||
| 42 | return DateTime::createFromFormat('d M Y \à H\:i', trim($string), $timezone); |
||
| 43 | } |
||
| 120 |