Completed
Branch master (2f992b)
by Wissam
03:08
created
src/Weather/JsonWeather.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 
32 32
     public function __construct()
33 33
     {
34
-        $apiKeys = require ANAX_INSTALL_PATH . "/config/apiKeys.php";
34
+        $apiKeys = require ANAX_INSTALL_PATH."/config/apiKeys.php";
35 35
         $this->apiKey = $apiKeys["ipstack"];
36 36
         $this->darkKey = $apiKeys["darksky"];
37 37
     }
@@ -51,9 +51,9 @@  discard block
 block discarded – undo
51 51
         $currentIp = $this->ipAddress;
52 52
         $this->object = new WeatherIp();
53 53
         $currentIp = $this->object->validateIp($this->ipAddress);
54
-        $accessKey  = $this->apiKey;
54
+        $accessKey = $this->apiKey;
55 55
         $BaseUrl = 'http://api.ipstack.com/';
56
-        $details =  $this->WeatherRequest->curlJson($BaseUrl.$currentIp.'?access_key='.$accessKey);
56
+        $details = $this->WeatherRequest->curlJson($BaseUrl.$currentIp.'?access_key='.$accessKey);
57 57
         $weather = $this->multiCurlJson($details);
58 58
         $data["details"] = $details;
59 59
         $data["weather"] = $weather;
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
         $currentIp = $this->ipAddress;
76 76
         $this->object = new WeatherIp();
77 77
         $currentIp = $this->object->validateIp($this->ipAddress);
78
-        $accessKey  = $this->apiKey;
78
+        $accessKey = $this->apiKey;
79 79
         $BaseUrl = 'http://api.ipstack.com/';
80 80
         $details = $this->WeatherRequest->curlJson($BaseUrl.$currentIp.'?access_key='.$accessKey);
81 81
         $weather = $this->multiCurlJson($details);
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
         $currentIp = $this->ipAddress;
114 114
         $this->object = new WeatherIp();
115 115
         $currentIp = $this->object->validateIp($this->ipAddress);
116
-        $accessKey  = $this->apiKey;
116
+        $accessKey = $this->apiKey;
117 117
         $BaseUrl = 'http://api.ipstack.com/';
118 118
         $details = $this->WeatherRequest->curlJson($BaseUrl.$currentIp.'?access_key='.$accessKey);
119 119
         $weather = $this->multiCurlJson($details);
@@ -143,24 +143,24 @@  discard block
 block discarded – undo
143 143
 
144 144
     public function multiCurlJson($details)
145 145
     {
146
-        $accessKey  = $this->darkKey;
146
+        $accessKey = $this->darkKey;
147 147
         $multiRequests = [];
148 148
         #future weather
149 149
         if ($this->time === "future") {
150
-            for ($i=0; $i < 7; $i++) {
150
+            for ($i = 0; $i < 7; $i++) {
151 151
                 $unixTime = time() + ($i * 24 * 60 * 60);
152 152
                 $BaseUrl = 'https://api.darksky.net/forecast/';
153 153
                 $apiSetting = '?exclude=minutely,hourly,daily,flags';
154
-                $multiRequests[] = $BaseUrl.$accessKey .'/'.$details['latitude'].','.$details['longitude'].','.$unixTime.$apiSetting;
154
+                $multiRequests[] = $BaseUrl.$accessKey.'/'.$details['latitude'].','.$details['longitude'].','.$unixTime.$apiSetting;
155 155
             }
156 156
         }
157 157
         #previous weather
158 158
         if ($this->time === "past") {
159
-            for ($i=0; $i < 30; $i++) {
159
+            for ($i = 0; $i < 30; $i++) {
160 160
                 $unixTime = time() - ($i * 24 * 60 * 60);
161 161
                 $BaseUrl = 'https://api.darksky.net/forecast/';
162 162
                 $apiSetting = '?exclude=minutely,hourly,daily,flags';
163
-                $multiRequests[] = $BaseUrl.$accessKey .'/'.$details['latitude'].','.$details['longitude'].','.$unixTime.$apiSetting;
163
+                $multiRequests[] = $BaseUrl.$accessKey.'/'.$details['latitude'].','.$details['longitude'].','.$unixTime.$apiSetting;
164 164
             }
165 165
         }
166 166
         $weather = $this->WeatherRequest->multiRequest($multiRequests);
Please login to merge, or discard this patch.
src/Weather/WeatherIpController.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 
25 25
     public function __construct()
26 26
     {
27
-        $apiKeys = require ANAX_INSTALL_PATH . "/config/apiKeys.php";
27
+        $apiKeys = require ANAX_INSTALL_PATH."/config/apiKeys.php";
28 28
         $this->apiKey = $apiKeys["ipstack"];
29 29
         $this->darkKey = $apiKeys["darksky"];
30 30
 
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
         $currentIp = $this->ipAddress;
54 54
         $this->object = new WeatherIp();
55 55
         $currentIp = $this->object->validateIp($this->ipAddress);
56
-        $accessKey  = $this->apiKey;
56
+        $accessKey = $this->apiKey;
57 57
         $details = $this->WeatherRequest->curlJson('http://api.ipstack.com/'.$currentIp.'?access_key='.$accessKey);
58 58
         $weather = $this->multiCurlJson($details);
59 59
         $data["details"] = $details;
@@ -67,20 +67,20 @@  discard block
 block discarded – undo
67 67
 
68 68
     public function multiCurlJson($details)
69 69
     {
70
-        $accessKey  = $this->darkKey;
70
+        $accessKey = $this->darkKey;
71 71
         $multiRequests = [];
72 72
         #future weather
73 73
         if ($this->time === "future") {
74
-            for ($i=0; $i < 7; $i++) {
74
+            for ($i = 0; $i < 7; $i++) {
75 75
                 $unixTime = time() + ($i * 24 * 60 * 60);
76
-                $multiRequests[] = 'https://api.darksky.net/forecast/'.$accessKey .'/'.$details['latitude'].','.$details['longitude'].','.$unixTime.'?exclude=minutely,hourly,daily,flags&units=si';
76
+                $multiRequests[] = 'https://api.darksky.net/forecast/'.$accessKey.'/'.$details['latitude'].','.$details['longitude'].','.$unixTime.'?exclude=minutely,hourly,daily,flags&units=si';
77 77
             }
78 78
         }
79 79
         #previous weather
80 80
         if ($this->time === "past") {
81
-            for ($i=0; $i < 30; $i++) {
81
+            for ($i = 0; $i < 30; $i++) {
82 82
                 $unixTime = time() - ($i * 24 * 60 * 60);
83
-                $multiRequests[] = 'https://api.darksky.net/forecast/'.$accessKey .'/'.$details['latitude'].','.$details['longitude'].','.$unixTime.'?exclude=minutely,hourly,daily,flags&units=si';
83
+                $multiRequests[] = 'https://api.darksky.net/forecast/'.$accessKey.'/'.$details['latitude'].','.$details['longitude'].','.$unixTime.'?exclude=minutely,hourly,daily,flags&units=si';
84 84
             }
85 85
         }
86 86
         $weather = $this->WeatherRequest->multiRequest($multiRequests);
Please login to merge, or discard this patch.
src/Weather/WeatherIp.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -11,14 +11,14 @@
 block discarded – undo
11 11
  *
12 12
  * @SuppressWarnings(PHPMD.TooManyPublicMethods)
13 13
  */
14
- class WeatherIp implements ContainerInjectableInterface
15
- {
16
-     use ContainerInjectableTrait;
17
-     public function validateIp($ipAddress)
18
-     {
19
-         if (filter_var($ipAddress, FILTER_VALIDATE_IP)) {
20
-             return $ipAddress;
21
-         }
22
-         return null;
23
-     }
24
- }
14
+    class WeatherIp implements ContainerInjectableInterface
15
+    {
16
+        use ContainerInjectableTrait;
17
+        public function validateIp($ipAddress)
18
+        {
19
+            if (filter_var($ipAddress, FILTER_VALIDATE_IP)) {
20
+                return $ipAddress;
21
+            }
22
+            return null;
23
+        }
24
+    }
Please login to merge, or discard this patch.
config/configuration.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,5 +9,5 @@
 block discarded – undo
9 9
 
10 10
 return [
11 11
     //ANAX_APP_PATH . "/config",
12
-    ANAX_INSTALL_PATH . "/config",
12
+    ANAX_INSTALL_PATH."/config",
13 13
 ];
Please login to merge, or discard this patch.
config/router/100_sample-json-controller.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -5,9 +5,9 @@
 block discarded – undo
5 5
 return [
6 6
     "routes" => [
7 7
         [
8
-             "info" => "Weather IP (JSON)",
9
-             "mount" => "weatherjson",
10
-             "handler" => "\Aisa\Weather\JsonWeather",
11
-         ],
8
+                "info" => "Weather IP (JSON)",
9
+                "mount" => "weatherjson",
10
+                "handler" => "\Aisa\Weather\JsonWeather",
11
+            ],
12 12
     ]
13 13
 ];
Please login to merge, or discard this patch.
config/cache.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@
 block discarded – undo
5 5
 return [
6 6
     // Use for styling the menu
7 7
     //"basePath" => ANAX_APP_PATH . "/cache",
8
-    "basePath" => ANAX_INSTALL_PATH . "/cache/anax",
8
+    "basePath" => ANAX_INSTALL_PATH."/cache/anax",
9 9
 
10 10
     // Default time to live until item expires
11 11
     "timeToLive" => 7 * 24 * 60 * 60,
Please login to merge, or discard this patch.
config/di/configuration.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,9 +8,9 @@
 block discarded – undo
8 8
     "services" => [
9 9
         "configuration" => [
10 10
             "shared" => true,
11
-            "callback" => function () {
11
+            "callback" => function() {
12 12
                 $config = new \Anax\Configure\Configuration();
13
-                $dirs = require ANAX_INSTALL_PATH . "/config/configuration.php";
13
+                $dirs = require ANAX_INSTALL_PATH."/config/configuration.php";
14 14
                 $config->setBaseDirectories($dirs);
15 15
                 return $config;
16 16
             }
Please login to merge, or discard this patch.
config/di/textfilter.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -6,11 +6,11 @@
 block discarded – undo
6 6
     "services" => [
7 7
         "textfilter" => [
8 8
             "shared" => true,
9
-            "callback" => function () {
9
+            "callback" => function() {
10 10
                 $filter = new \Anax\TextFilter\TextFilter();
11
-                if (is_dir(ANAX_INSTALL_PATH . "/content")) {
11
+                if (is_dir(ANAX_INSTALL_PATH."/content")) {
12 12
                     $filter->setFilterConfig("frontmatter", [
13
-                        "include_base" => ANAX_INSTALL_PATH . "/content"
13
+                        "include_base" => ANAX_INSTALL_PATH."/content"
14 14
                     ]);
15 15
                 }
16 16
                 return $filter;
Please login to merge, or discard this patch.
config/di/url.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
     "services" => [
7 7
         "url" => [
8 8
             "shared" => true,
9
-            "callback" => function () {
9
+            "callback" => function() {
10 10
                 $url = new \Anax\Url\Url();
11 11
                 $request = $this->get("request");
12 12
                 $url->setSiteUrl($request->getSiteUrl());
Please login to merge, or discard this patch.