Completed
Push — master ( 952cc5...be4e59 )
by Michal
06:14 queued 02:50
created
src/ShapeFile.lib.php 1 patch
Braces   +30 added lines, -10 removed lines patch added patch discarded remove patch
@@ -29,7 +29,9 @@  discard block
 block discarded – undo
29 29
  *
30 30
  */
31 31
   function loadData($type, $data) {
32
-    if (!$data) return $data;
32
+    if (!$data) {
33
+       return $data;
34
+    }
33 35
     $tmp = unpack($type, $data);
34 36
     return current($tmp);
35 37
   }
@@ -104,7 +106,9 @@  discard block
 block discarded – undo
104 106
     }
105 107
 
106 108
     function saveToFile($FileName = NULL) {
107
-      if ($FileName != NULL) $this->FileName = $FileName;
109
+      if ($FileName != NULL) {
110
+         $this->FileName = $FileName;
111
+      }
108 112
 
109 113
       if (($this->_openSHPFile(TRUE)) && ($this->_openSHXFile(TRUE)) && ($this->_openDBFFile(TRUE))) {
110 114
         $this->_saveHeaders();
@@ -562,10 +566,18 @@  discard block
 block discarded – undo
562 566
         case 3:
563 567
         case 5:
564 568
           //Adds a new point to the selected part
565
-          if (!isset($this->SHPData["xmin"]) || ($this->SHPData["xmin"] > $point["x"])) $this->SHPData["xmin"] = $point["x"];
566
-          if (!isset($this->SHPData["ymin"]) || ($this->SHPData["ymin"] > $point["y"])) $this->SHPData["ymin"] = $point["y"];
567
-          if (!isset($this->SHPData["xmax"]) || ($this->SHPData["xmax"] < $point["x"])) $this->SHPData["xmax"] = $point["x"];
568
-          if (!isset($this->SHPData["ymax"]) || ($this->SHPData["ymax"] < $point["y"])) $this->SHPData["ymax"] = $point["y"];
569
+          if (!isset($this->SHPData["xmin"]) || ($this->SHPData["xmin"] > $point["x"])) {
570
+             $this->SHPData["xmin"] = $point["x"];
571
+          }
572
+          if (!isset($this->SHPData["ymin"]) || ($this->SHPData["ymin"] > $point["y"])) {
573
+             $this->SHPData["ymin"] = $point["y"];
574
+          }
575
+          if (!isset($this->SHPData["xmax"]) || ($this->SHPData["xmax"] < $point["x"])) {
576
+             $this->SHPData["xmax"] = $point["x"];
577
+          }
578
+          if (!isset($this->SHPData["ymax"]) || ($this->SHPData["ymax"] < $point["y"])) {
579
+             $this->SHPData["ymax"] = $point["y"];
580
+          }
569 581
 
570 582
           $this->SHPData["parts"][$partIndex]["points"][] = $point;
571 583
 
@@ -574,10 +586,18 @@  discard block
 block discarded – undo
574 586
         break;
575 587
         case 8:
576 588
           //Adds a new point
577
-          if (!isset($this->SHPData["xmin"]) || ($this->SHPData["xmin"] > $point["x"])) $this->SHPData["xmin"] = $point["x"];
578
-          if (!isset($this->SHPData["ymin"]) || ($this->SHPData["ymin"] > $point["y"])) $this->SHPData["ymin"] = $point["y"];
579
-          if (!isset($this->SHPData["xmax"]) || ($this->SHPData["xmax"] < $point["x"])) $this->SHPData["xmax"] = $point["x"];
580
-          if (!isset($this->SHPData["ymax"]) || ($this->SHPData["ymax"] < $point["y"])) $this->SHPData["ymax"] = $point["y"];
589
+          if (!isset($this->SHPData["xmin"]) || ($this->SHPData["xmin"] > $point["x"])) {
590
+             $this->SHPData["xmin"] = $point["x"];
591
+          }
592
+          if (!isset($this->SHPData["ymin"]) || ($this->SHPData["ymin"] > $point["y"])) {
593
+             $this->SHPData["ymin"] = $point["y"];
594
+          }
595
+          if (!isset($this->SHPData["xmax"]) || ($this->SHPData["xmax"] < $point["x"])) {
596
+             $this->SHPData["xmax"] = $point["x"];
597
+          }
598
+          if (!isset($this->SHPData["ymax"]) || ($this->SHPData["ymax"] < $point["y"])) {
599
+             $this->SHPData["ymax"] = $point["y"];
600
+          }
581 601
 
582 602
           $this->SHPData["points"][] = $point;
583 603
           $this->SHPData["numpoints"]++;
Please login to merge, or discard this patch.