@@ -21,14 +21,14 @@ discard block  | 
                                                    ||
| 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  | 
                                                    ||
| 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 | |
@@ -8,8 +8,8 @@ discard block  | 
                                                    ||
| 8 | 8 | $timeRefined = $time;  | 
                                                        
| 9 | 9 | |
| 10 | 10 | $dates = [];  | 
                                                        
| 11 | -        for ($i=0; $i < $days; $i++) { | 
                                                        |
| 12 | - $date = strtotime($timeRefined . "-" . $i ."day");  | 
                                                        |
| 11 | +        for ($i = 0; $i < $days; $i++) { | 
                                                        |
| 12 | + $date = strtotime($timeRefined . "-" . $i . "day");  | 
                                                        |
| 13 | 13 |              array_push($dates, date("Y-m-d", $date) . "T" . date("h:m:s", $date)); | 
                                                        
| 14 | 14 | }  | 
                                                        
| 15 | 15 | |
@@ -19,17 +19,17 @@ discard block  | 
                                                    ||
| 19 | 19 | |
| 20 | 20 | public static function wheatherThirtyActionGet($res = null, $time = null, $accessKey = null) : array  | 
                                                        
| 21 | 21 |      { | 
                                                        
| 22 | -        for ($j=0; $j < count($time); $j++) { | 
                                                        |
| 23 | -            ${"ch$j"}  = curl_init('https://api.darksky.net/forecast/'.$accessKey.'/'.$res[0]->latitude . | 
                                                        |
| 24 | - ','. $res[0]->longitude . "," . $time[$j] . "?exclude=minutely?exclude=hourly");  | 
                                                        |
| 22 | +        for ($j = 0; $j < count($time); $j++) { | 
                                                        |
| 23 | +            ${"ch$j"} = curl_init('https://api.darksky.net/forecast/' . $accessKey . '/' . $res[0]->latitude . | 
                                                        |
| 24 | + ',' . $res[0]->longitude . "," . $time[$j] . "?exclude=minutely?exclude=hourly");  | 
                                                        |
| 25 | 25 | }  | 
                                                        
| 26 | 26 | $mhcurl = curl_multi_init();  | 
                                                        
| 27 | -        for ($i=0; $i < count($time); $i++) { | 
                                                        |
| 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 | 31 | $responseArray = [];  | 
                                                        
| 32 | -        for ($k=0; $k < count($time); $k++) { | 
                                                        |
| 32 | +        for ($k = 0; $k < count($time); $k++) { | 
                                                        |
| 33 | 33 | $running = null;  | 
                                                        
| 34 | 34 |              do { | 
                                                        
| 35 | 35 | curl_multi_exec($mhcurl, $running);  | 
                                                        
@@ -48,20 +48,20 @@ discard block  | 
                                                    ||
| 48 | 48 | |
| 49 | 49 | public static function wheatherActionGet($res = null, $accessKey = null) : array  | 
                                                        
| 50 | 50 |      { | 
                                                        
| 51 | -        for ($j=0; $j < count($res); $j++) { | 
                                                        |
| 52 | -            ${"ch$j"}  = curl_init('https://api.darksky.net/forecast/'.$accessKey.'/'.$res[$j]->latitude . | 
                                                        |
| 53 | - ','. $res[$j]->longitude . "?exclude=minutely?exclude=hourly");  | 
                                                        |
| 51 | +        for ($j = 0; $j < count($res); $j++) { | 
                                                        |
| 52 | +            ${"ch$j"} = curl_init('https://api.darksky.net/forecast/' . $accessKey . '/' . $res[$j]->latitude . | 
                                                        |
| 53 | + ',' . $res[$j]->longitude . "?exclude=minutely?exclude=hourly");  | 
                                                        |
| 54 | 54 | }  | 
                                                        
| 55 | 55 | |
| 56 | 56 | |
| 57 | 57 | |
| 58 | 58 | $mhcurl = curl_multi_init();  | 
                                                        
| 59 | -        for ($i=0; $i < count($res); $i++) { | 
                                                        |
| 59 | +        for ($i = 0; $i < count($res); $i++) { | 
                                                        |
| 60 | 60 |              curl_setopt(${"ch$i"}, CURLOPT_RETURNTRANSFER, true); | 
                                                        
| 61 | 61 |              curl_multi_add_handle($mhcurl, ${"ch$i"}); | 
                                                        
| 62 | 62 | }  | 
                                                        
| 63 | 63 | $responseArray = [];  | 
                                                        
| 64 | -        for ($k=0; $k < count($res); $k++) { | 
                                                        |
| 64 | +        for ($k = 0; $k < count($res); $k++) { | 
                                                        |
| 65 | 65 | $running = null;  | 
                                                        
| 66 | 66 |              do { | 
                                                        
| 67 | 67 | curl_multi_exec($mhcurl, $running);  | 
                                                        
@@ -82,7 +82,7 @@ discard block  | 
                                                    ||
| 82 | 82 | public function streetActionGet($lat, $long) : string  | 
                                                        
| 83 | 83 |      { | 
                                                        
| 84 | 84 | |
| 85 | -        $curlh  = curl_init('https://nominatim.openstreetmap.org/[email protected]&format=jsonv2&lat=' .$long. "&lon=".$lat); | 
                                                        |
| 85 | +        $curlh = curl_init('https://nominatim.openstreetmap.org/[email protected]&format=jsonv2&lat=' . $long . "&lon=" . $lat); | 
                                                        |
| 86 | 86 | |
| 87 | 87 | curl_setopt($curlh, CURLOPT_RETURNTRANSFER, true);  | 
                                                        
| 88 | 88 | |
@@ -24,9 +24,9 @@  | 
                                                    ||
| 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 | }  | 
                                                        
@@ -59,7 +59,7 @@  | 
                                                    ||
| 59 | 59 | |
| 60 | 60 |          if (filter_var($ipAdress, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) { | 
                                                        
| 61 | 61 | $ipInfo["Type"] = "Valid IPv4";  | 
                                                        
| 62 | - $ipInfo["Domain"] = gethostbyaddr($ipAdress) ?? "" ;  | 
                                                        |
| 62 | + $ipInfo["Domain"] = gethostbyaddr($ipAdress) ?? "";  | 
                                                        |
| 63 | 63 | $ipInfoJson = json_encode($ipInfo, JSON_PRETTY_PRINT);  | 
                                                        
| 64 | 64 | return [$ipInfoJson];  | 
                                                        
| 65 | 65 |          } else { | 
                                                        
@@ -10,27 +10,27 @@ discard block  | 
                                                    ||
| 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  | 
                                                    ||
| 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 | }  | 
                                                        
@@ -20,7 +20,7 @@ discard block  | 
                                                    ||
| 20 | 20 | |
| 21 | 21 | |
| 22 | 22 | // http://api.ipstack.com/79.138.27.9?access_key=ae68fdd7e0843f6cbbaf81475db34e24  | 
                                                        
| 23 | -          $curlh  = curl_init('http://api.ipstack.com/'.$ipAdress.'?access_key='.$accessKey.''); | 
                                                        |
| 23 | +          $curlh = curl_init('http://api.ipstack.com/' . $ipAdress . '?access_key=' . $accessKey . ''); | 
                                                        |
| 24 | 24 | curl_setopt($curlh, CURLOPT_RETURNTRANSFER, true);  | 
                                                        
| 25 | 25 | |
| 26 | 26 | |
@@ -45,7 +45,7 @@ discard block  | 
                                                    ||
| 45 | 45 | // Initialize CURL:  | 
                                                        
| 46 | 46 | |
| 47 | 47 | // http://api.ipstack.com/79.138.27.9?access_key=ae68fdd7e0843f6cbbaf81475db34e24  | 
                                                        
| 48 | -          $curlh  = curl_init('http://api.ipstack.com/'.$ipAdress.'?access_key='.$accessKey.''); | 
                                                        |
| 48 | +          $curlh = curl_init('http://api.ipstack.com/' . $ipAdress . '?access_key=' . $accessKey . ''); | 
                                                        |
| 49 | 49 | curl_setopt($curlh, CURLOPT_RETURNTRANSFER, true);  | 
                                                        
| 50 | 50 | |
| 51 | 51 | // Store the data:  | 
                                                        
@@ -1,48 +1,48 @@ discard block  | 
                                                    ||
| 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  | 
                                                    ||
| 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  | 
                                                    ||
| 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  | 
                                                    ||
| 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 | |
@@ -62,7 +62,7 @@ discard block  | 
                                                    ||
| 62 | 62 | $ipInfo = array();  | 
                                                        
| 63 | 63 |          $ipInfo["IP"] = $this->di->get("request")->getPost("ip") ?? $ipAdress; | 
                                                        
| 64 | 64 | $array = [];  | 
                                                        
| 65 | -        $apiEx =  $this->di->get("ExternalApi"); | 
                                                        |
| 65 | +        $apiEx = $this->di->get("ExternalApi"); | 
                                                        |
| 66 | 66 | $res = $apiEx->validateipActionGet($ipInfo["IP"], $keykey);  | 
                                                        
| 67 | 67 | |
| 68 | 68 | $obj = json_decode($res);  | 
                                                        
@@ -132,7 +132,7 @@ discard block  | 
                                                    ||
| 132 | 132 |          $darkSkyKey = $this->di->get("apikeyDarkSky"); | 
                                                        
| 133 | 133 | |
| 134 | 134 | $array = [];  | 
                                                        
| 135 | -        $apiEx =  $this->di->get("ExternalApi"); | 
                                                        |
| 135 | +        $apiEx = $this->di->get("ExternalApi"); | 
                                                        |
| 136 | 136 | $res = $apiEx->validateipActionGet($ipInfo["IP"], $keykey);  | 
                                                        
| 137 | 137 | |
| 138 | 138 | |
@@ -40,20 +40,20 @@ discard block  | 
                                                    ||
| 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  | 
                                                    ||
| 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 | |
@@ -87,7 +87,7 @@  | 
                                                    ||
| 87 | 87 | // $ipInfo["IP"] = $ipAdress;  | 
                                                        
| 88 | 88 | // }  | 
                                                        
| 89 | 89 |          $ipInfo["IP"] = $this->di->get("request")->getGet("ip") ?? $ipAdress; | 
                                                        
| 90 | -        $apiEx =  $this->di->get("ExternalApi"); | 
                                                        |
| 90 | +        $apiEx = $this->di->get("ExternalApi"); | 
                                                        |
| 91 | 91 | $res = $apiEx->validateipActionGet($ipInfo["IP"], $keykey);  | 
                                                        
| 92 | 92 | |
| 93 | 93 | $obj = json_decode($res);  | 
                                                        
@@ -1,7 +1,7 @@  | 
                                                    ||
| 1 | 1 | <?php  | 
                                                        
| 2 | 2 | namespace Anax\View;  | 
                                                        
| 3 | 3 | |
| 4 | -$cord = $longitude . "%2C" . $latitude ."&layer=mapnik&marker=" . $latitude . "%2C" . $longitude . "";  | 
                                                        |
| 4 | +$cord = $longitude . "%2C" . $latitude . "&layer=mapnik&marker=" . $latitude . "%2C" . $longitude . "";  | 
                                                        |
| 5 | 5 | print_r($cord);  | 
                                                        
| 6 | 6 | ?>  | 
                                                        
| 7 | 7 | |
@@ -1,5 +1,5 @@  | 
                                                    ||
| 1 | 1 | <?php  | 
                                                        
| 2 | -namespace Anax\View ;  | 
                                                        |
| 2 | +namespace Anax\View;  | 
                                                        |
| 3 | 3 | |
| 4 | 4 | use Anax\Controller;  | 
                                                        
| 5 | 5 | |
@@ -16,26 +16,26 @@  | 
                                                    ||
| 16 | 16 | |
| 17 | 17 | $cord = $resObj->longitude . "%2C" . $resObj->latitude ."&layer=mapnik&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>  | 
                                                        
@@ -1,20 +1,20 @@ discard block  | 
                                                    ||
| 1 | 1 | <?php  | 
                                                        
| 2 | 2 | namespace Anax\View;  | 
                                                        
| 3 | 3 | |
| 4 | -$res1 = (array) $res[0];  | 
                                                        |
| 4 | +$res1 = (array) $res[0];  | 
                                                        |
| 5 | 5 | $resObj = json_decode($res1[0]);  | 
                                                        
| 6 | 6 |  if (isset($resObj->latitude)) { | 
                                                        
| 7 | 7 | $streetinfo = json_decode($streetname);  | 
                                                        
| 8 | - $streetinfoArray = (array) $streetinfo;  | 
                                                        |
| 8 | + $streetinfoArray = (array) $streetinfo;  | 
                                                        |
| 9 | 9 | |
| 10 | - $resThirty1 = (array) $resThirty;  | 
                                                        |
| 10 | + $resThirty1 = (array) $resThirty;  | 
                                                        |
| 11 | 11 | $data = $resObj->daily->data;  | 
                                                        
| 12 | 12 | |
| 13 | 13 | |
| 14 | 14 | $dataThirty = $resThirty1;  | 
                                                        
| 15 | 15 | |
| 16 | 16 | |
| 17 | - $cord = $resObj->longitude . "%2C" . $resObj->latitude ."&layer=mapnik&marker=" . $resObj->latitude . "%2C" . $resObj->longitude . "";  | 
                                                        |
| 17 | + $cord = $resObj->longitude . "%2C" . $resObj->latitude . "&layer=mapnik&marker=" . $resObj->latitude . "%2C" . $resObj->longitude . "";  | 
                                                        |
| 18 | 18 | |
| 19 | 19 | // $resDecoded = parse_str($res, $output);  | 
                                                        
| 20 | 20 | // // print_r($output[0]);  | 
                                                        
@@ -72,7 +72,7 @@ discard block  | 
                                                    ||
| 72 | 72 | <h3>Past week</h3>  | 
                                                        
| 73 | 73 | <br>  | 
                                                        
| 74 | 74 | <br>  | 
                                                        
| 75 | -    <?php for ($i=0; $i < count($data); $i++) { ?> | 
                                                        |
| 75 | +    <?php for ($i = 0; $i < count($data); $i++) { ?> | 
                                                        |
| 76 | 76 | <div style="border-style: solid; float:left; font-size: 0.8rem; width: 10rem; height:12rem;">  | 
                                                        
| 77 | 77 | <table>  | 
                                                        
| 78 | 78 | <tbody>  | 
                                                        
@@ -99,7 +99,7 @@ discard block  | 
                                                    ||
| 99 | 99 | <h3>Past thirty days</h3>  | 
                                                        
| 100 | 100 | <br>  | 
                                                        
| 101 | 101 | <br>  | 
                                                        
| 102 | -    <?php for ($i=0; $i < count($dataThirty); $i++) { ?> | 
                                                        |
| 102 | +    <?php for ($i = 0; $i < count($dataThirty); $i++) { ?> | 
                                                        |
| 103 | 103 | <div style="border-style: solid; float:left; font-size: 0.8rem; width: 10rem; height:12rem; background-color:grey;">  | 
                                                        
| 104 | 104 | <table>  | 
                                                        
| 105 | 105 | <tbody>  |