Passed
Branch master (18f841)
by sam
04:46 queued 57s
created
src/darkSkyApi/DarkSky.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -21,14 +21,14 @@  discard block
 block discarded – undo
21 21
     {
22 22
         for ($j=0; $j < count($time); $j++) {
23 23
             ${"ch$j"}  = curl_init('https://api.darksky.net/forecast/'.$accessKey.'/'.$res[0]->latitude .
24
-                  ','. $res[0]->longitude . "," . $time[$j] . "?exclude=minutely?exclude=hourly");
24
+                    ','. $res[0]->longitude . "," . $time[$j] . "?exclude=minutely?exclude=hourly");
25 25
         }
26
-          $mhcurl = curl_multi_init();
26
+            $mhcurl = curl_multi_init();
27 27
         for ($i=0; $i < count($time); $i++) {
28 28
             curl_setopt(${"ch$i"}, CURLOPT_RETURNTRANSFER, true);
29 29
             curl_multi_add_handle($mhcurl, ${"ch$i"});
30 30
         }
31
-          $responseArray = [];
31
+            $responseArray = [];
32 32
         for ($k=0; $k < count($time); $k++) {
33 33
             $running = null;
34 34
             do {
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
     {
51 51
         for ($j=0; $j < count($res); $j++) {
52 52
             ${"ch$j"}  = curl_init('https://api.darksky.net/forecast/'.$accessKey.'/'.$res[$j]->latitude .
53
-              ','. $res[$j]->longitude . "?exclude=minutely?exclude=hourly");
53
+                ','. $res[$j]->longitude . "?exclude=minutely?exclude=hourly");
54 54
         }
55 55
 
56 56
 
Please login to merge, or discard this patch.
src/IpValidators/InternalValidator.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -24,9 +24,9 @@
 block discarded – undo
24 24
                 return [$ipInfoJson];
25 25
             }
26 26
         }
27
-          $ipInfo["Type"] = "Invalid IP";
28
-          $ipInfo["Domain"] = "None";
29
-          $ipInfoJson = json_encode($ipInfo, JSON_PRETTY_PRINT);
30
-          return [$ipInfoJson];
27
+            $ipInfo["Type"] = "Invalid IP";
28
+            $ipInfo["Domain"] = "None";
29
+            $ipInfoJson = json_encode($ipInfo, JSON_PRETTY_PRINT);
30
+            return [$ipInfoJson];
31 31
     }
32 32
 }
Please login to merge, or discard this patch.
src/IpValidators/ExternalApi.php 1 patch
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -10,27 +10,27 @@  discard block
 block discarded – undo
10 10
     public function validateipActionGet($ipAdress = null, $accessKey = null) : string
11 11
     {
12 12
 
13
-      // $url = "apikey.json";
14
-      // $data = file_get_contents("http://" . $_SERVER["HTTP_HOST"] . "/dbwebb/ramverk1/me/redovisa/src/IpValidators/apikey.json");
15
-      // $keytest = json_decode($data);
16
-      //
17
-      //
18
-      // $accessKey = $keytest->api_key;
19
-      // echo $accessKey;
13
+        // $url = "apikey.json";
14
+        // $data = file_get_contents("http://" . $_SERVER["HTTP_HOST"] . "/dbwebb/ramverk1/me/redovisa/src/IpValidators/apikey.json");
15
+        // $keytest = json_decode($data);
16
+        //
17
+        //
18
+        // $accessKey = $keytest->api_key;
19
+        // echo $accessKey;
20 20
 
21 21
 
22
-          // http://api.ipstack.com/79.138.27.9?access_key=ae68fdd7e0843f6cbbaf81475db34e24
23
-          $curlh  = curl_init('http://api.ipstack.com/'.$ipAdress.'?access_key='.$accessKey.'');
24
-          curl_setopt($curlh, CURLOPT_RETURNTRANSFER, true);
22
+            // http://api.ipstack.com/79.138.27.9?access_key=ae68fdd7e0843f6cbbaf81475db34e24
23
+            $curlh  = curl_init('http://api.ipstack.com/'.$ipAdress.'?access_key='.$accessKey.'');
24
+            curl_setopt($curlh, CURLOPT_RETURNTRANSFER, true);
25 25
 
26 26
 
27
-          $json = curl_exec($curlh);
28
-          curl_close($curlh);
27
+            $json = curl_exec($curlh);
28
+            curl_close($curlh);
29 29
 
30 30
 
31 31
 
32 32
 
33
-          return $json;
33
+            return $json;
34 34
     }
35 35
 
36 36
 
@@ -42,22 +42,22 @@  discard block
 block discarded – undo
42 42
         // $json_a = json_decode($string, true);
43 43
         // echo $json_a;
44 44
         // $accessKey = $keytest->api_key;
45
-          // Initialize CURL:
46
-
47
-          // http://api.ipstack.com/79.138.27.9?access_key=ae68fdd7e0843f6cbbaf81475db34e24
48
-          $curlh  = curl_init('http://api.ipstack.com/'.$ipAdress.'?access_key='.$accessKey.'');
49
-          curl_setopt($curlh, CURLOPT_RETURNTRANSFER, true);
50
-
51
-          // Store the data:
52
-          $json = curl_exec($curlh);
53
-          curl_close($curlh);
54
-          print_r($json);
55
-          // Decode JSON response:
56
-          // $api_result = json_decode($json, true);
57
-          $apiResult = json_decode($json, true);
58
-          // Output the "capital" object inside "location"
59
-          // print_r($api_result);
60
-
61
-          return $apiResult;
45
+            // Initialize CURL:
46
+
47
+            // http://api.ipstack.com/79.138.27.9?access_key=ae68fdd7e0843f6cbbaf81475db34e24
48
+            $curlh  = curl_init('http://api.ipstack.com/'.$ipAdress.'?access_key='.$accessKey.'');
49
+            curl_setopt($curlh, CURLOPT_RETURNTRANSFER, true);
50
+
51
+            // Store the data:
52
+            $json = curl_exec($curlh);
53
+            curl_close($curlh);
54
+            print_r($json);
55
+            // Decode JSON response:
56
+            // $api_result = json_decode($json, true);
57
+            $apiResult = json_decode($json, true);
58
+            // Output the "capital" object inside "location"
59
+            // print_r($api_result);
60
+
61
+            return $apiResult;
62 62
     }
63 63
 }
Please login to merge, or discard this patch.
src/Controller/DarkSkyController.php 1 patch
Indentation   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -1,48 +1,48 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace Anax\Controller;
3 3
 
4
-  use \Anax\darkSkyApi;
4
+    use \Anax\darkSkyApi;
5 5
 
6
-  use Anax\Commons\ContainerInjectableInterface;
6
+    use Anax\Commons\ContainerInjectableInterface;
7 7
 
8
-  use Anax\Commons\ContainerInjectableTrait;
8
+    use Anax\Commons\ContainerInjectableTrait;
9 9
 
10 10
 class DarkSkyController implements ContainerInjectableInterface
11 11
 {
12
-      use ContainerInjectableTrait;
12
+        use ContainerInjectableTrait;
13 13
 
14 14
     public function indexAction() : object
15 15
     {
16
-          $title = " | Ip Json API";
17
-          $page = $this->di->get("page");
18
-          $page->add(
19
-              "anax/v2/DarkskyApi/darkSkyApi",
20
-              [
21
-                  "header" => "hello",
22
-                  "text" => "text",
23
-              ]
24
-          );
25
-          return $page->render([
26
-              "title" => "$title"
27
-          ]);
16
+            $title = " | Ip Json API";
17
+            $page = $this->di->get("page");
18
+            $page->add(
19
+                "anax/v2/DarkskyApi/darkSkyApi",
20
+                [
21
+                    "header" => "hello",
22
+                    "text" => "text",
23
+                ]
24
+            );
25
+            return $page->render([
26
+                "title" => "$title"
27
+            ]);
28 28
     }
29 29
 
30 30
 
31 31
 
32 32
     public function indexJsonAction() : object
33 33
     {
34
-          $title = " | Ip Json API";
35
-          $page = $this->di->get("page");
36
-          $page->add(
37
-              "anax/v2/DarkskyApi/darkSkyApiJson",
38
-              [
39
-                  "header" => "hello",
40
-                  "text" => "text",
41
-              ]
42
-          );
43
-          return $page->render([
44
-              "title" => "$title"
45
-          ]);
34
+            $title = " | Ip Json API";
35
+            $page = $this->di->get("page");
36
+            $page->add(
37
+                "anax/v2/DarkskyApi/darkSkyApiJson",
38
+                [
39
+                    "header" => "hello",
40
+                    "text" => "text",
41
+                ]
42
+            );
43
+            return $page->render([
44
+                "title" => "$title"
45
+            ]);
46 46
     }
47 47
 
48 48
 
@@ -83,14 +83,14 @@  discard block
 block discarded – undo
83 83
         $dates = $darkClass::wheatherSevenActionGet(30, $time);
84 84
         $resThirtyDaysRequest = $darkClass::wheatherThirtyActionGet($array, $dates, $darkSkyKey);
85 85
 
86
-          // try {
87
-          //   if (array_key_exists("code",$res)) {
88
-          //     throw new \Exception("Value must be 1 or below");
89
-          //   }
90
-          //
91
-          // } catch (\Exception $e) {
92
-          //   return $res[0];
93
-          // }
86
+            // try {
87
+            //   if (array_key_exists("code",$res)) {
88
+            //     throw new \Exception("Value must be 1 or below");
89
+            //   }
90
+            //
91
+            // } catch (\Exception $e) {
92
+            //   return $res[0];
93
+            // }
94 94
 
95 95
         $streetname = $darkClass->streetActionGet($coordinates->longitude, $coordinates->latitude);
96 96
         //
@@ -100,21 +100,21 @@  discard block
 block discarded – undo
100 100
 
101 101
         // $datesJson = json_encode($dates);
102 102
         // print_r(strtotime("2010-05-17 + 1 day"));
103
-          $title = " | Ip Json API";
104
-          $page = $this->di->get("page");
105
-          $page->add(
106
-              "anax/v2/DarkskyApi/darkRes",
107
-              [
108
-                  "header" => "hello",
109
-                  "res" => $res,
110
-                  "ogDate" => $time,
111
-                  "resThirty" => $resThirtyDaysRequest,
112
-                  "streetname" => $streetname
113
-              ]
114
-          );
115
-          return $page->render([
116
-              "title" => "$title"
117
-          ]);
103
+            $title = " | Ip Json API";
104
+            $page = $this->di->get("page");
105
+            $page->add(
106
+                "anax/v2/DarkskyApi/darkRes",
107
+                [
108
+                    "header" => "hello",
109
+                    "res" => $res,
110
+                    "ogDate" => $time,
111
+                    "resThirty" => $resThirtyDaysRequest,
112
+                    "streetname" => $streetname
113
+                ]
114
+            );
115
+            return $page->render([
116
+                "title" => "$title"
117
+            ]);
118 118
     }
119 119
 
120 120
 
@@ -158,14 +158,14 @@  discard block
 block discarded – undo
158 158
 
159 159
         $dates = $darkClass::wheatherSevenActionGet(30, $time);
160 160
         $resThirtyDaysRequest = $darkClass::wheatherThirtyActionGet($array, $dates, $darkSkyKey);
161
-          // try {
162
-          //   if (array_key_exists("code",$res)) {
163
-          //     throw new \Exception("must be ip or coordinates");
164
-          //   }
165
-          //
166
-          // } catch (\Exception $e) {
167
-          //   return $res;
168
-          // }
161
+            // try {
162
+            //   if (array_key_exists("code",$res)) {
163
+            //     throw new \Exception("must be ip or coordinates");
164
+            //   }
165
+            //
166
+            // } catch (\Exception $e) {
167
+            //   return $res;
168
+            // }
169 169
         array_push($resArray, json_decode($res[0], JSON_PRETTY_PRINT));
170 170
         array_push($resArray, $resThirtyDaysRequest);
171 171
 
Please login to merge, or discard this patch.
src/Controller/ApiExternalController.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -40,20 +40,20 @@  discard block
 block discarded – undo
40 40
          */
41 41
     public function indexAction() : object
42 42
     {
43
-          $title = " | Ip Json API";
44
-          $page = $this->di->get("page");
45
-          $page->add(
46
-              "anax/v2/ip-validator/apiExternal",
47
-              [
48
-                  "header" => "hello",
49
-                  "text" => "text",
50
-              ]
51
-          );
52
-
53
-
54
-          return $page->render([
55
-              "title" => "$title"
56
-          ]);
43
+            $title = " | Ip Json API";
44
+            $page = $this->di->get("page");
45
+            $page->add(
46
+                "anax/v2/ip-validator/apiExternal",
47
+                [
48
+                    "header" => "hello",
49
+                    "text" => "text",
50
+                ]
51
+            );
52
+
53
+
54
+            return $page->render([
55
+                "title" => "$title"
56
+            ]);
57 57
     }
58 58
 
59 59
 
@@ -63,16 +63,16 @@  discard block
 block discarded – undo
63 63
         $title = " | Ip info";
64 64
         $page = $this->di->get("page");
65 65
         $page->add("anax/v2/ip-validator/externalInfo", [
66
-          "ip" => $this->di->get("request")->getGet("ip"),
67
-          "type" => $this->di->get("request")->getGet("type"),
68
-          "country" => $this->di->get("request")->getGet("country"),
69
-          "latitude" => $this->di->get("request")->getGet("latitude"),
70
-          "longitude" => $this->di->get("request")->getGet("longitude")
66
+            "ip" => $this->di->get("request")->getGet("ip"),
67
+            "type" => $this->di->get("request")->getGet("type"),
68
+            "country" => $this->di->get("request")->getGet("country"),
69
+            "latitude" => $this->di->get("request")->getGet("latitude"),
70
+            "longitude" => $this->di->get("request")->getGet("longitude")
71 71
         ]);
72 72
 
73 73
 
74 74
         return $page->render([
75
-          "title" => "$title"
75
+            "title" => "$title"
76 76
         ]);
77 77
     }
78 78
 
Please login to merge, or discard this patch.
view/anax/v2/DarkskyApi/darkRes.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -16,26 +16,26 @@
 block discarded – undo
16 16
 
17 17
     $cord = $resObj->longitude  .  "%2C"  . $resObj->latitude  ."&amp;layer=mapnik&amp;marker=" . $resObj->latitude . "%2C" . $resObj->longitude   . "";
18 18
 
19
-  // $resDecoded = parse_str($res, $output);
20
-  // // print_r($output[0]);
21
-  // $myobj = json_decode($output[0]);
22
-  // $myobj = $output;
23
-  //
24
-  //
25
-  //
26
-  //
27
-  // print_r($god);
28
-  // // print_r($myobj->daily);
29
-  // $array =  (array) $myobj;
30
-  // // print_r($myobj[0]);
31
-  // $myobj2 = json_decode($myobj[0], true);
32
-  // // print_r(array_keys($myobj2));
33
-  // $array =  (array) $myobj2;
34
-  // print_r($array["latitude"]);
35
-  // print_r($array[0]);
36
-  //
37
-  // print_r($myobj2);
38
-  // print_r($array["daily"]);
19
+    // $resDecoded = parse_str($res, $output);
20
+    // // print_r($output[0]);
21
+    // $myobj = json_decode($output[0]);
22
+    // $myobj = $output;
23
+    //
24
+    //
25
+    //
26
+    //
27
+    // print_r($god);
28
+    // // print_r($myobj->daily);
29
+    // $array =  (array) $myobj;
30
+    // // print_r($myobj[0]);
31
+    // $myobj2 = json_decode($myobj[0], true);
32
+    // // print_r(array_keys($myobj2));
33
+    // $array =  (array) $myobj2;
34
+    // print_r($array["latitude"]);
35
+    // print_r($array[0]);
36
+    //
37
+    // print_r($myobj2);
38
+    // print_r($array["daily"]);
39 39
     ?>
40 40
 <br>
41 41
 <br>
Please login to merge, or discard this patch.
config/di/apikeyDarksky.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -2,14 +2,14 @@
 block discarded – undo
2 2
 /**
3 3
  * Configuration file for DI container.
4 4
  */
5
- return [
6
-     "services" => [
7
-         "apikeyDarkSky" => [
8
-             "shared" => true,
9
-             "callback" => function () {
10
-                 $dirs = "87abcd4f5a83d4f77caf6be317702207";
11
-                 return $dirs;
12
-             },
13
-         ],
14
-     ],
15
- ];
5
+    return [
6
+        "services" => [
7
+            "apikeyDarkSky" => [
8
+                "shared" => true,
9
+                "callback" => function () {
10
+                    $dirs = "87abcd4f5a83d4f77caf6be317702207";
11
+                    return $dirs;
12
+                },
13
+            ],
14
+        ],
15
+    ];
Please login to merge, or discard this patch.