@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | { |
| 27 | 27 | $lines = array_slice(array_filter( |
| 28 | 28 | explode(PHP_EOL, $content), |
| 29 | - function ($val) { return trim($val) && strpos($val, '|') === 0; } |
|
| 29 | + function($val) { return trim($val) && strpos($val, '|') === 0; } |
|
| 30 | 30 | ), 0, 2); |
| 31 | 31 | |
| 32 | 32 | preg_match("/{[^}{]*Version[^}{]*\| ?([\d\.]+)}/", $lines[0], $edgeVersion); |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | |
| 41 | 41 | private static function writeEdgeVersions($versions) |
| 42 | 42 | { |
| 43 | - $file = __DIR__ . '/../../src/edgeVersionMap.php'; |
|
| 43 | + $file = __DIR__.'/../../src/edgeVersionMap.php'; |
|
| 44 | 44 | $currentVersions = require $file; |
| 45 | 45 | |
| 46 | 46 | foreach ($versions as $version) { |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | $content = ''; |
| 52 | 52 | foreach ($currentVersions as $edgeHtml => $edge) { |
| 53 | - $content .= " '{$edgeHtml}' => '{$edge}'," . PHP_EOL; |
|
| 53 | + $content .= " '{$edgeHtml}' => '{$edge}',".PHP_EOL; |
|
| 54 | 54 | } |
| 55 | 55 | $data = <<<PHP |
| 56 | 56 | <?php |
@@ -12,11 +12,17 @@ discard block |
||
| 12 | 12 | public static function fetch() |
| 13 | 13 | { |
| 14 | 14 | $content = file_get_contents(self::URL); |
| 15 | - if (!$content) throw new Exception(self::$errors['fetch_error']); |
|
| 15 | + if (!$content) { |
|
| 16 | + throw new Exception(self::$errors['fetch_error']); |
|
| 17 | + } |
|
| 16 | 18 | $content = explode('===Release history===', $content); |
| 17 | - if (!isset($content[1])) throw new Exception(self::$errors['parse_error']); |
|
| 19 | + if (!isset($content[1])) { |
|
| 20 | + throw new Exception(self::$errors['parse_error']); |
|
| 21 | + } |
|
| 18 | 22 | $table = explode('|-', $content[1]); |
| 19 | - if (!isset($table[1])) throw new Exception(self::$errors['parse_error']); |
|
| 23 | + if (!isset($table[1])) { |
|
| 24 | + throw new Exception(self::$errors['parse_error']); |
|
| 25 | + } |
|
| 20 | 26 | $table = array_slice($table, 1); |
| 21 | 27 | $versions = array_map(array('Wikipedia', 'extractVersion'), $table); |
| 22 | 28 | self::writeEdgeVersions($versions); |
@@ -32,8 +38,12 @@ discard block |
||
| 32 | 38 | preg_match("/{[^}{]*Version[^}{]*\| ?([\d\.]+)}/", $lines[0], $edgeVersion); |
| 33 | 39 | preg_match("/\| *(\d*\.\d*)/", $lines[1], $edgeHtmlVersion); |
| 34 | 40 | |
| 35 | - if (!isset($edgeVersion[1])) throw new Exception(self::$errors['parse_error']); |
|
| 36 | - if (!isset($edgeHtmlVersion[1])) throw new Exception(self::$errors['parse_error']); |
|
| 41 | + if (!isset($edgeVersion[1])) { |
|
| 42 | + throw new Exception(self::$errors['parse_error']); |
|
| 43 | + } |
|
| 44 | + if (!isset($edgeHtmlVersion[1])) { |
|
| 45 | + throw new Exception(self::$errors['parse_error']); |
|
| 46 | + } |
|
| 37 | 47 | |
| 38 | 48 | return array($edgeHtmlVersion[1], $edgeVersion[1]); |
| 39 | 49 | } |
@@ -1,7 +1,7 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -require_once __DIR__ . '/ChangeWindows.php'; |
|
| 4 | -require_once __DIR__ . '/Wikipedia.php'; |
|
| 3 | +require_once __DIR__.'/ChangeWindows.php'; |
|
| 4 | +require_once __DIR__.'/Wikipedia.php'; |
|
| 5 | 5 | |
| 6 | 6 | Wikipedia::fetch(); |
| 7 | 7 | ChangeWindows::fetchVersions(); |