Passed
Branch master (9d0313)
by Tom
03:33
created
Category
src/NoaaCapAlerts/Dependencies.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -16,23 +16,23 @@
 block discarded – undo
16 16
     {
17 17
         parent::__construct();
18 18
 
19
-        $this['NoaaAlertManager'] = function ($c) {
19
+        $this['NoaaAlertManager'] = function($c) {
20 20
             return new NoaaAlertManager($c['DownloaderProvider'], $c['IndexParser']);
21 21
         };
22 22
 
23
-        $this['DownloaderProvider'] = function ($c) {
23
+        $this['DownloaderProvider'] = function($c) {
24 24
             return new DownloaderProvider();
25 25
         };
26 26
 
27
-        $this['IndexParser'] = function ($c) {
27
+        $this['IndexParser'] = function($c) {
28 28
             return new IndexParser($c['XmlParser']);
29 29
         };
30 30
 
31
-        $this['XmlParser'] = function ($c) {
31
+        $this['XmlParser'] = function($c) {
32 32
             return new XmlParser();
33 33
         };
34 34
 
35
-        $this['DownloaderProvider'] = function ($c) {
35
+        $this['DownloaderProvider'] = function($c) {
36 36
             return new DownloaderProvider();
37 37
         };
38 38
     }
Please login to merge, or discard this patch.
src/NoaaCapAlerts/XmlProvider/DownloaderProvider.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@
 block discarded – undo
22 22
         );
23 23
 
24 24
         $context = stream_context_create($options);
25
-        $xml = file_get_contents($this->indexUrl,false, $context);
25
+        $xml = file_get_contents($this->indexUrl, false, $context);
26 26
 
27 27
         return $xml;
28 28
     }
Please login to merge, or discard this patch.
src/NoaaCapAlerts/Parser/IndexParser.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
     {
19 19
         $this->xmlParser = $xmlParser;
20 20
 
21
-        if($xmlParser === null) {
21
+        if ($xmlParser === null) {
22 22
             $this->xmlParser = new XmlParser();
23 23
         }
24 24
     }
@@ -36,9 +36,9 @@  discard block
 block discarded – undo
36 36
         // Process each alert ("ENTRY")
37 37
         $resultArray = array();
38 38
 
39
-        foreach($alertDataArray as $alert) {
39
+        foreach ($alertDataArray as $alert) {
40 40
             $parsedAlert = $this->parseAlert($alert);
41
-            if($parsedAlert !== null) {
41
+            if ($parsedAlert !== null) {
42 42
                 $resultArray[] = $parsedAlert;
43 43
             }
44 44
         }
@@ -80,28 +80,28 @@  discard block
 block discarded – undo
80 80
         $expiresDateTime = null;
81 81
         $effectiveDateTime = null;
82 82
 
83
-        if(!isset($alert['name']) || $alert['name'] != 'ENTRY') {
83
+        if (!isset($alert['name']) || $alert['name'] != 'ENTRY') {
84 84
             return null;
85 85
         }
86 86
 
87 87
         // Loop through attributes and set values
88
-        foreach($alert['children'] as $element){
88
+        foreach ($alert['children'] as $element) {
89 89
             $elementName = $element['name'];
90 90
             $elementAttrs = $element['attrs'];
91
-            if(isset($element['tagData'])){
91
+            if (isset($element['tagData'])) {
92 92
                 $elementData = $element['tagData'];
93 93
             } else {
94 94
                 $elementData = '';
95 95
             }
96 96
 
97 97
 
98
-            switch($elementName){
98
+            switch ($elementName) {
99 99
                 case 'ID':
100 100
                     $idString = $elementData;
101 101
                     break;
102 102
                 case 'UPDATED':
103 103
                     $updatedDateTime = new \DateTime($elementData);
104
-                    $updatedTime  = $updatedDateTime->format('Y-m-d H:i:s');
104
+                    $updatedTime = $updatedDateTime->format('Y-m-d H:i:s');
105 105
                     break;
106 106
                 case 'PUBLISHED':
107 107
                     $publishedDateTime = new \DateTime($elementData);
@@ -159,8 +159,8 @@  discard block
 block discarded – undo
159 159
                     $geoArray = array();
160 160
 
161 161
                     // parse into simple array
162
-                    foreach($element['children'] as $geo) {
163
-                        if(isset($geo['tagData'])) {
162
+                    foreach ($element['children'] as $geo) {
163
+                        if (isset($geo['tagData'])) {
164 164
                             $geoArray[] = $geo['tagData'];
165 165
                         }
166 166
                     }
@@ -170,9 +170,9 @@  discard block
 block discarded – undo
170 170
                     $capGeo = $geoLocArray;
171 171
                     break;
172 172
                 case 'CAP:PARAMETERS':
173
-                    $capParameters  = '';
173
+                    $capParameters = '';
174 174
                     $paramArray = array();
175
-                    foreach($element['children'] as $param){
175
+                    foreach ($element['children'] as $param) {
176 176
                         $paramArray[] = $param['tagData'];
177 177
                     }
178 178
                     $capParameters = implode(', ', $paramArray);
@@ -247,8 +247,8 @@  discard block
 block discarded – undo
247 247
         $currentLocationKey = 'null';
248 248
         $geoLocArray = array();
249 249
 
250
-        foreach($geoArray as $geoLoc) {
251
-            if(in_array($geoLoc, $locationFormatTypes)) {
250
+        foreach ($geoArray as $geoLoc) {
251
+            if (in_array($geoLoc, $locationFormatTypes)) {
252 252
                 $currentLocationKey = $geoLoc;
253 253
                 $geoLocArray[$geoLoc] = array();
254 254
             } else {
Please login to merge, or discard this patch.
src/NoaaCapAlerts/Parser/XmlParser.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -25,13 +25,13 @@  discard block
 block discarded – undo
25 25
     public function getArrayFromXml($xml)
26 26
     {
27 27
         $xmlParser = xml_parser_create();
28
-        xml_set_object($xmlParser,$this);
28
+        xml_set_object($xmlParser, $this);
29 29
         xml_set_element_handler($xmlParser, "tagOpen", "tagClosed");
30 30
         xml_set_character_data_handler($xmlParser, "tagData");
31 31
 
32 32
         $successfulParse = xml_parse($xmlParser, $xml, true);
33 33
 
34
-        if($successfulParse === 0) {
34
+        if ($successfulParse === 0) {
35 35
             $errorString = xml_error_string(xml_get_error_code($xmlParser));
36 36
             $errorLine = xml_get_current_line_number($xmlParser);
37 37
 
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
             "attrs" => $attrs
51 51
         ); 
52 52
         
53
-        array_push($this->output,$tag);
53
+        array_push($this->output, $tag);
54 54
     }
55 55
 
56 56
     protected function tagClosed($parser, $name)
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
     {
65 65
         $notWhitespace = !empty(trim($tagData));
66 66
 
67
-        if($notWhitespace) {
67
+        if ($notWhitespace) {
68 68
             $this->output[count($this->output) - 1]['tagData'] = $tagData;
69 69
         }
70 70
     }
Please login to merge, or discard this patch.