@@ -544,14 +544,12 @@ |
||
| 544 | 544 | { |
| 545 | 545 | self::$browser->setName(Browser::EDGE); |
| 546 | 546 | self::$browser->setVersion(self::$edgeHTML[$matches[1]]); |
| 547 | - } |
|
| 548 | - else |
|
| 547 | + } else |
|
| 549 | 548 | { |
| 550 | 549 | self::$browser->setName(Browser::EDGE_HTML); |
| 551 | 550 | self::$browser->setVersion($matches[1]); |
| 552 | 551 | } |
| 553 | - } |
|
| 554 | - else |
|
| 552 | + } else |
|
| 555 | 553 | { |
| 556 | 554 | self::$browser->setName(Browser::EDGE); |
| 557 | 555 | } |
@@ -21,7 +21,9 @@ discard block |
||
| 21 | 21 | $windowsVersions = json_decode(file_get_contents(__DIR__ . '/windowsVersions.json'), true); |
| 22 | 22 | if (!count($windowsVersions)) { |
| 23 | 23 | $currentVersion = explode('.', self::fetchCurrentVersion(), 2); |
| 24 | - if (!isset($currentVersion[0])) throw new Exception(self::$errors['invalid_version']); |
|
| 24 | + if (!isset($currentVersion[0])) { |
|
| 25 | + throw new Exception(self::$errors['invalid_version']); |
|
| 26 | + } |
|
| 25 | 27 | $windowsVersions = self::fetchVersion($windowsVersions, $currentVersion[0]); |
| 26 | 28 | self::writeWindowsVersions($windowsVersions); |
| 27 | 29 | } else { |
@@ -67,13 +69,21 @@ discard block |
||
| 67 | 69 | private static function fetchCurrentVersion() |
| 68 | 70 | { |
| 69 | 71 | $content = file_get_contents('https://changewindows.org/filter/pc/all/current/month/true'); |
| 70 | - if (!$content) throw new Exception(self::$errors['could_not_fetch_version']); |
|
| 72 | + if (!$content) { |
|
| 73 | + throw new Exception(self::$errors['could_not_fetch_version']); |
|
| 74 | + } |
|
| 71 | 75 | $content = explode('class="timeline"', $content, 2); |
| 72 | - if (!isset($content[1])) throw new Exception(self::$errors['could_not_fetch_version']); |
|
| 76 | + if (!isset($content[1])) { |
|
| 77 | + throw new Exception(self::$errors['could_not_fetch_version']); |
|
| 78 | + } |
|
| 73 | 79 | $content = explode('build"', $content[1], 2); |
| 74 | - if (!isset($content[1])) throw new Exception(self::$errors['could_not_fetch_version']); |
|
| 80 | + if (!isset($content[1])) { |
|
| 81 | + throw new Exception(self::$errors['could_not_fetch_version']); |
|
| 82 | + } |
|
| 75 | 83 | preg_match("/(\d*\.\d*)<\/div>/", $content[1], $matches); |
| 76 | - if (!isset($matches[1])) throw new Exception(self::$errors['could_not_fetch_version']); |
|
| 84 | + if (!isset($matches[1])) { |
|
| 85 | + throw new Exception(self::$errors['could_not_fetch_version']); |
|
| 86 | + } |
|
| 77 | 87 | return $matches[1]; |
| 78 | 88 | } |
| 79 | 89 | |
@@ -122,15 +132,25 @@ discard block |
||
| 122 | 132 | |
| 123 | 133 | private static function fetchSiblingVersions($content) |
| 124 | 134 | { |
| 125 | - if (!$content) throw new Exception(self::$errors['could_not_fetch_page']); |
|
| 135 | + if (!$content) { |
|
| 136 | + throw new Exception(self::$errors['could_not_fetch_page']); |
|
| 137 | + } |
|
| 126 | 138 | $content = explode('build-sidebar', $content, 2); |
| 127 | - if (!isset($content[1])) throw new Exception(self::$errors['could_not_fetch_page']); |
|
| 139 | + if (!isset($content[1])) { |
|
| 140 | + throw new Exception(self::$errors['could_not_fetch_page']); |
|
| 141 | + } |
|
| 128 | 142 | $content = explode('fa-angle-left', $content[1]); |
| 129 | - if (!isset($content[1])) throw new Exception(self::$errors['could_not_fetch_page']); |
|
| 143 | + if (!isset($content[1])) { |
|
| 144 | + throw new Exception(self::$errors['could_not_fetch_page']); |
|
| 145 | + } |
|
| 130 | 146 | $content = explode('fa-angle-right', $content[1]); |
| 131 | - if (!isset($content[0])) throw new Exception(self::$errors['could_not_fetch_page']); |
|
| 147 | + if (!isset($content[0])) { |
|
| 148 | + throw new Exception(self::$errors['could_not_fetch_page']); |
|
| 149 | + } |
|
| 132 | 150 | preg_match_all("/> *(\d+) *</", $content[0], $matches); |
| 133 | - if (!isset($matches[1])) throw new Exception(self::$errors['could_not_fetch_page']); |
|
| 151 | + if (!isset($matches[1])) { |
|
| 152 | + throw new Exception(self::$errors['could_not_fetch_page']); |
|
| 153 | + } |
|
| 134 | 154 | return $matches[1]; |
| 135 | 155 | } |
| 136 | 156 | } |