Conditions | 2 |
Paths | 2 |
Total Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
28 | public function getList() |
||
29 | { |
||
30 | // Let's download the content of HTML page https://nodejs.org/dist/ |
||
31 | $html = $this->rfs->getContents(parse_url(self::NODEJS_DIST_URL, PHP_URL_HOST), self::NODEJS_DIST_URL, false); |
||
|
|||
32 | |||
33 | // Now, let's parse it! |
||
34 | $matches = array(); |
||
35 | preg_match_all("$>v([0-9]*\\.[0-9]*\\.[0-9]*)/<$", $html, $matches); |
||
36 | |||
37 | if (!isset($matches[1])) { |
||
38 | throw new NodeJsInstallerException("Error while querying ".self::NODEJS_DIST_URL.". Unable to find NodeJS |
||
39 | versions on this page."); |
||
40 | } |
||
41 | |||
42 | return $matches[1]; |
||
43 | } |
||
44 | } |
||
45 |