Completed
Push — master ( 596354...fd3af1 )
by Christofer
02:22
created
src/Models/Curl.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -16,9 +16,9 @@  discard block
 block discarded – undo
16 16
 
17 17
     public function cUrlMulti(array $url)
18 18
     {
19
-        $chandle= [];
19
+        $chandle = [];
20 20
         $mhandle = curl_multi_init();
21
-        for ($i=0; $i < count($url); $i++) {
21
+        for ($i = 0; $i < count($url); $i++) {
22 22
             array_push($chandle, curl_init($url[$i]));
23 23
             curl_setopt($chandle[$i], CURLOPT_RETURNTRANSFER, true);
24 24
             curl_multi_add_handle($mhandle, $chandle[$i]);
@@ -30,14 +30,14 @@  discard block
 block discarded – undo
30 30
         } while ($running);
31 31
 
32 32
         //close the handles
33
-        for ($i=0; $i < count($chandle); $i++) {
33
+        for ($i = 0; $i < count($chandle); $i++) {
34 34
             curl_multi_remove_handle($mhandle, $chandle[$i]);
35 35
         }
36 36
 
37 37
         curl_multi_close($mhandle);
38 38
 
39 39
         $json = [];
40
-        for ($i=0; $i < count($chandle); $i++) {
40
+        for ($i = 0; $i < count($chandle); $i++) {
41 41
             array_push($json, curl_multi_getcontent($chandle[$i]));
42 42
         }
43 43
         return $json;
Please login to merge, or discard this patch.
view/weather/weatherOld.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
     ?>
14 14
     <div class="container days">
15 15
     <?php
16
-    for ($i=0; $i < count($weather); $i++) {
16
+    for ($i = 0; $i < count($weather); $i++) {
17 17
         ?>
18 18
         <div class="container card day">
19 19
             <i class="<?=$weather[$i]["daily"]["data"][0]["icon"]?>"></i>
Please login to merge, or discard this patch.
src/Models/Location.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -11,16 +11,16 @@
 block discarded – undo
11 11
         $getJson = new Curl;
12 12
         $test = $validateIP->validate($ipNumber);
13 13
         if ($test[0]) {
14
-            $location = $getJson->cUrl($ipstack["url"]. $ipNumber. '?access_key='. $ipstack["key"]);
14
+            $location = $getJson->cUrl($ipstack["url"].$ipNumber.'?access_key='.$ipstack["key"]);
15 15
             $location = json_decode($location, true);
16 16
             $latitude = $location["latitude"];
17 17
             $longitude = $location["longitude"];
18 18
             $location = array("city"=> $location["city"], "latitude"=> $latitude, "longitude"=> $longitude);
19 19
         } else {
20
-            $search = array('å','ä','ö');
21
-            $replace = array('a','a','o');
20
+            $search = array('å', 'ä', 'ö');
21
+            $replace = array('a', 'a', 'o');
22 22
             $ipNumber = str_replace($search, $replace, $ipNumber);
23
-            $location = $getJson->cUrl($mapquest["url"]. $mapquest["key"]. $mapquest["extra"]. $ipNumber);
23
+            $location = $getJson->cUrl($mapquest["url"].$mapquest["key"].$mapquest["extra"].$ipNumber);
24 24
             $location = json_decode($location, true);
25 25
             $latitude = $location["results"][0]["locations"][0]["latLng"]["lat"];
26 26
             $longitude = $location["results"][0]["locations"][0]["latLng"]["lng"];
Please login to merge, or discard this patch.
src/Controller/WeatherController.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
         $api = $this->di->get("ipstack");
19 19
         $ipstack = $api["config"];
20 20
         $getipInfo = new Models\Curl;
21
-        $userIp =  $getipInfo->cUrl($ipstack["url"]. "check". '?access_key='. $ipstack["key"]. "&fields=ip");
21
+        $userIp = $getipInfo->cUrl($ipstack["url"]."check".'?access_key='.$ipstack["key"]."&fields=ip");
22 22
         $apiResult = json_decode($userIp, true);
23 23
 
24 24
         $session->set("userIp", $apiResult["ip"]);
@@ -51,12 +51,12 @@  discard block
 block discarded – undo
51 51
         $ipNumber = $request->getGet("ip");
52 52
         $location = $locationHandler->getLocation($ipNumber, $ipstack, $mapquest);
53 53
         $mapDiv = $map->getMap($location["latitude"], $location["longitude"]);
54
-        $weatherJson = $getJson->cUrl($darksky["url"]. $darksky["key"]. "/". $location["latitude"]. ",". $location["longitude"]. "?lang=sv&units=auto");
54
+        $weatherJson = $getJson->cUrl($darksky["url"].$darksky["key"]."/".$location["latitude"].",".$location["longitude"]."?lang=sv&units=auto");
55 55
 
56 56
         $weather = json_decode($weatherJson, true);
57 57
         $page->add("weather/weather", ["location" => $location, "mapDiv" => $mapDiv, "weather" => $weather]);
58 58
 
59
-        return $page->render(["title" => $title,]);
59
+        return $page->render(["title" => $title, ]);
60 60
     }
61 61
 
62 62
     public function weatherOldActionGet()
@@ -80,20 +80,20 @@  discard block
 block discarded – undo
80 80
 
81 81
         $url = [];
82 82
         $time  = time() - (30 * 24 * 60 * 60);
83
-        for ($i=0; $i < 31; $i++) {
84
-            $time  = time() - ($i * 24 * 60 * 60);
85
-            array_push($url, $darksky["url"]. $darksky["key"]. "/". $location["latitude"]. ",". $location["longitude"]. ",". $time. "?lang=sv&units=auto");
83
+        for ($i = 0; $i < 31; $i++) {
84
+            $time = time() - ($i * 24 * 60 * 60);
85
+            array_push($url, $darksky["url"].$darksky["key"]."/".$location["latitude"].",".$location["longitude"].",".$time."?lang=sv&units=auto");
86 86
         }
87 87
 
88 88
         $mapDiv = $map->getMap($location["latitude"], $location["longitude"]);
89 89
         $weatherJson = $getJson->cUrlMulti($url);
90 90
         $weather = [];
91
-        for ($i=0; $i < count($weatherJson); $i++) {
91
+        for ($i = 0; $i < count($weatherJson); $i++) {
92 92
             array_push($weather, json_decode($weatherJson[$i], true));
93 93
         }
94 94
 
95 95
         $page->add("weather/weatherOld", ["location" => $location, "mapDiv" => $mapDiv, "weather" => $weather]);
96 96
 
97
-        return $page->render(["title" => $title,]);
97
+        return $page->render(["title" => $title, ]);
98 98
     }
99 99
 }
Please login to merge, or discard this patch.
config/di/api.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
     "services" => [
7 7
         "darksky" => [
8 8
             "shared" => true,
9
-            "callback" => function () {
9
+            "callback" => function() {
10 10
                 // Load the configuration files
11 11
                 $cfg = $this->get("configuration");
12 12
                 $config = $cfg->load("darksky.php");
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
         ],
17 17
         "mapquest" => [
18 18
             "shared" => true,
19
-            "callback" => function () {
19
+            "callback" => function() {
20 20
                 // Load the configuration files
21 21
                 $cfg = $this->get("configuration");
22 22
                 $config = $cfg->load("mapquest.php");
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
         ],
27 27
         "ipstack" => [
28 28
             "shared" => true,
29
-            "callback" => function () {
29
+            "callback" => function() {
30 30
                 // Load the configuration files
31 31
                 $cfg = $this->get("configuration");
32 32
                 $config = $cfg->load("ipstack.php");
Please login to merge, or discard this patch.