Skip to content

Commit

Permalink
adds support for php 5
Browse files Browse the repository at this point in the history
  • Loading branch information
daudmalik06 committed Feb 27, 2018
1 parent e8db2dc commit c7a5df8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
3 changes: 0 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,5 @@
"psr-4": {
"dawood\\WBMScrapper\\": "src/"
}
},
"require" : {
"php" : "^7.0"
}
}
12 changes: 6 additions & 6 deletions src/WBMScrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class WBMScrapper
* @param string $url
* @return array
*/
public static function getAllSnapShotUrls(string $url) : array
public static function getAllSnapShotUrls($url)
{
$firstYear = self::firstSnapshotYear($url);
$lastYear = self::lastSnapshotYear($url);
Expand All @@ -30,7 +30,7 @@ public static function getAllSnapShotUrls(string $url) : array
* @param int $year
* @return array
*/
public static function getSnapShotUrlsOfYear(string $url, int $year) : array
public static function getSnapShotUrlsOfYear($url, $year)
{
$scrapper = new self;
$snapShotAddress = 'https://web.archive.org/__wb/calendarcaptures?url='.urlencode($url).'&selected_year='.$year;
Expand Down Expand Up @@ -59,7 +59,7 @@ public static function getSnapShotUrlsOfYear(string $url, int $year) : array
* @param string $url
* @return int
*/
public static function firstSnapshotYear(string $url) : int
public static function firstSnapshotYear($url)
{
$scrapper = new self;
return (int)$scrapper->getYears($url)['first'];
Expand All @@ -70,7 +70,7 @@ public static function firstSnapshotYear(string $url) : int
* @param $url
* @return int
*/
public static function lastSnapshotYear($url) : int
public static function lastSnapshotYear($url)
{
$scrapper = new self;
return (int)$scrapper->getYears($url)['last'];
Expand All @@ -80,7 +80,7 @@ public static function lastSnapshotYear($url) : int
* @param string $url
* @return array
*/
private function getYears(string $url) : array
private function getYears($url)
{
$infoAddress = 'https://web.archive.org/__wb/sparkline?url='.urlencode($url).'&collection=web&output=json';
$jsonResponse = file_get_contents($infoAddress);
Expand All @@ -96,7 +96,7 @@ private function getYears(string $url) : array
* @param array $timestamps
* @return array
*/
private function prepareWebArchiveUrlsFromArray(string $url, array $timestamps) : array
private function prepareWebArchiveUrlsFromArray($url, array $timestamps)
{
$webArchiveUrls = [];
$webArchiveAddress = 'https://web.archive.org/web/TIME_STAMP/'.$url;
Expand Down

0 comments on commit c7a5df8

Please sign in to comment.