Completed
Push — master ( 77b047...0f74d8 )
by Maurício
01:58
created
tests/ShapeFileTest.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
         $shp->loadFromFile($filename);
46 46
         $this->assertEquals('', $shp->lastError);
47 47
         $this->assertEquals($records, count($shp->records));
48
-        if (! is_null($parts)) {
48
+        if (!is_null($parts)) {
49 49
             $this->assertEquals($parts, count($shp->records[0]->shpData['parts']));
50 50
         }
51 51
     }
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
      */
192 192
     public function testCreate()
193 193
     {
194
-        if (! ShapeFile::supportsDbase()) {
194
+        if (!ShapeFile::supportsDbase()) {
195 195
             $this->markTestSkipped('dbase extension missing');
196 196
         }
197 197
         $this->createTestData();
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
      */
207 207
     public function testDelete()
208 208
     {
209
-        if (! ShapeFile::supportsDbase()) {
209
+        if (!ShapeFile::supportsDbase()) {
210 210
             $this->markTestSkipped('dbase extension missing');
211 211
         }
212 212
         $this->createTestData();
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
      */
228 228
     public function testAdd()
229 229
     {
230
-        if (! ShapeFile::supportsDbase()) {
230
+        if (!ShapeFile::supportsDbase()) {
231 231
             $this->markTestSkipped('dbase extension missing');
232 232
         }
233 233
         $this->createTestData();
Please login to merge, or discard this patch.
src/ShapeRecord.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
                 $this->setError(sprintf('The Shape Type "%s" is not supported.', $this->shapeType));
189 189
                 break;
190 190
         }
191
-        if (ShapeFile::supportsDbase() && ! is_null($this->dbfFile)) {
191
+        if (ShapeFile::supportsDbase() && !is_null($this->dbfFile)) {
192 192
             $this->saveDBFData();
193 193
         }
194 194
     }
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
     private function loadMultiPointMZRecord($type)
368 368
     {
369 369
         /* The m dimension is optional, depends on bounding box data */
370
-        if ($type == 'm' && ! $this->shapeFile->hasMeasure()) {
370
+        if ($type == 'm' && !$this->shapeFile->hasMeasure()) {
371 371
             return;
372 372
         }
373 373
 
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
             if ($part + 1 < $numparts && $i == $this->shpData['parts'][$part + 1]) {
453 453
                 ++$part;
454 454
             }
455
-            if (! isset($this->shpData['parts'][$part]['points']) || ! is_array($this->shpData['parts'][$part]['points'])) {
455
+            if (!isset($this->shpData['parts'][$part]['points']) || !is_array($this->shpData['parts'][$part]['points'])) {
456 456
                 $this->shpData['parts'][$part] = ['points' => []];
457 457
             }
458 458
             $this->shpData['parts'][$part]['points'][] = $this->loadPoint();
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
     private function loadPolyLineMZRecord($type)
466 466
     {
467 467
         /* The m dimension is optional, depends on bounding box data */
468
-        if ($type == 'm' && ! $this->shapeFile->hasMeasure()) {
468
+        if ($type == 'm' && !$this->shapeFile->hasMeasure()) {
469 469
             return;
470 470
         }
471 471
 
@@ -587,15 +587,15 @@  discard block
 block discarded – undo
587 587
             'm',
588 588
         ];
589 589
         foreach ($directions as $direction) {
590
-            if (! isset($point[$direction])) {
590
+            if (!isset($point[$direction])) {
591 591
                 continue;
592 592
             }
593 593
             $min = $direction . 'min';
594 594
             $max = $direction . 'max';
595
-            if (! isset($this->shpData[$min]) || ($this->shpData[$min] > $point[$direction])) {
595
+            if (!isset($this->shpData[$min]) || ($this->shpData[$min] > $point[$direction])) {
596 596
                 $this->shpData[$min] = $point[$direction];
597 597
             }
598
-            if (! isset($this->shpData[$max]) || ($this->shpData[$max] < $point[$direction])) {
598
+            if (!isset($this->shpData[$max]) || ($this->shpData[$max] < $point[$direction])) {
599 599
                 $this->shpData[$max] = $point[$direction];
600 600
             }
601 601
         }
@@ -611,7 +611,7 @@  discard block
 block discarded – undo
611 611
      */
612 612
     private function fixPoint($point, $dimension)
613 613
     {
614
-        if (! isset($point[$dimension])) {
614
+        if (!isset($point[$dimension])) {
615 615
             $point[$dimension] = 0.0; // no_value
616 616
         }
617 617
 
@@ -823,11 +823,11 @@  discard block
 block discarded – undo
823 823
         }
824 824
         unset($this->dbfData['deleted']);
825 825
         if ($this->recordNumber <= dbase_numrecords($this->dbfFile)) {
826
-            if (! dbase_replace_record($this->dbfFile, array_values($this->dbfData), $this->recordNumber)) {
826
+            if (!dbase_replace_record($this->dbfFile, array_values($this->dbfData), $this->recordNumber)) {
827 827
                 $this->setError('I wasn\'t possible to update the information in the DBF file.');
828 828
             }
829 829
         } else {
830
-            if (! dbase_add_record($this->dbfFile, array_values($this->dbfData))) {
830
+            if (!dbase_add_record($this->dbfFile, array_values($this->dbfData))) {
831 831
                 $this->setError('I wasn\'t possible to add the information to the DBF file.');
832 832
             }
833 833
         }
Please login to merge, or discard this patch.
src/ShapeFile.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
      */
90 90
     public function loadFromFile($fileName)
91 91
     {
92
-        if (! empty($fileName)) {
92
+        if (!empty($fileName)) {
93 93
             $this->fileName = $fileName;
94 94
             $result = $this->openSHPFile();
95 95
         } else {
@@ -98,13 +98,13 @@  discard block
 block discarded – undo
98 98
         }
99 99
 
100 100
         if ($result && ($this->openDBFFile())) {
101
-            if (! $this->loadHeaders()) {
101
+            if (!$this->loadHeaders()) {
102 102
                 $this->closeSHPFile();
103 103
                 $this->closeDBFFile();
104 104
 
105 105
                 return false;
106 106
             }
107
-            if (! $this->loadRecords()) {
107
+            if (!$this->loadRecords()) {
108 108
                 $this->closeSHPFile();
109 109
                 $this->closeDBFFile();
110 110
 
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
      */
127 127
     public function saveToFile($fileName = null)
128 128
     {
129
-        if (! is_null($fileName)) {
129
+        if (!is_null($fileName)) {
130 130
             $this->fileName = $fileName;
131 131
         }
132 132
 
@@ -164,10 +164,10 @@  discard block
 block discarded – undo
164 164
         $min = $type . 'min';
165 165
         $max = $type . 'max';
166 166
 
167
-        if (! isset($this->boundingBox[$min]) || $this->boundingBox[$min] == 0.0 || ($this->boundingBox[$min] > $data[$min])) {
167
+        if (!isset($this->boundingBox[$min]) || $this->boundingBox[$min] == 0.0 || ($this->boundingBox[$min] > $data[$min])) {
168 168
             $this->boundingBox[$min] = $data[$min];
169 169
         }
170
-        if (! isset($this->boundingBox[$max]) || $this->boundingBox[$max] == 0.0 || ($this->boundingBox[$max] < $data[$max])) {
170
+        if (!isset($this->boundingBox[$max]) || $this->boundingBox[$max] == 0.0 || ($this->boundingBox[$max] < $data[$max])) {
171 171
             $this->boundingBox[$max] = $data[$max];
172 172
         }
173 173
     }
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
         $inHeader = true;
284 284
 
285 285
         while ($inHeader) {
286
-            if (! feof($DBFFile)) {
286
+            if (!feof($DBFFile)) {
287 287
                 $buff32 = fread($DBFFile, 32);
288 288
                 if ($i > 1) {
289 289
                     if (substr($buff32, 0, 1) == chr(13)) {
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
     private function loadRecords()
420 420
     {
421 421
         /* Need to start at offset 100 */
422
-        while (! $this->eofSHP()) {
422
+        while (!$this->eofSHP()) {
423 423
             $record = new ShapeRecord(-1);
424 424
             $record->loadFromFile($this, $this->shpFile, $this->dbfFile);
425 425
             if ($record->lastError != '') {
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
     {
470 470
         $shpName = $this->getFilename($extension);
471 471
         $result = @fopen($shpName, ($toWrite ? 'wb+' : 'rb'));
472
-        if (! $result) {
472
+        if (!$result) {
473 473
             $this->setError(sprintf('It wasn\'t possible to open the %s file "%s"', $name, $shpName));
474 474
 
475 475
             return false;
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
     private function openSHPFile($toWrite = false)
489 489
     {
490 490
         $this->shpFile = $this->openFile($toWrite, '.shp', 'Shape');
491
-        if (! $this->shpFile) {
491
+        if (!$this->shpFile) {
492 492
             return false;
493 493
         }
494 494
 
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
     private function openSHXFile($toWrite = false)
517 517
     {
518 518
         $this->shxFile = $this->openFile($toWrite, '.shx', 'Index');
519
-        if (! $this->shxFile) {
519
+        if (!$this->shxFile) {
520 520
             return false;
521 521
         }
522 522
 
@@ -541,7 +541,7 @@  discard block
 block discarded – undo
541 541
      */
542 542
     private function createDBFFile()
543 543
     {
544
-        if (! self::supportsDbase() || ! is_array($this->dbfHeader) || count($this->dbfHeader) == 0) {
544
+        if (!self::supportsDbase() || !is_array($this->dbfHeader) || count($this->dbfHeader) == 0) {
545 545
             $this->dbfFile = null;
546 546
 
547 547
             return true;
@@ -571,7 +571,7 @@  discard block
 block discarded – undo
571 571
      */
572 572
     private function openDBFFile()
573 573
     {
574
-        if (! self::supportsDbase()) {
574
+        if (!self::supportsDbase()) {
575 575
             $this->dbfFile = null;
576 576
 
577 577
             return true;
@@ -579,7 +579,7 @@  discard block
 block discarded – undo
579 579
         $dbfName = $this->getFilename('.dbf');
580 580
         if (is_readable($dbfName)) {
581 581
             $this->dbfFile = @dbase_open($dbfName, 0);
582
-            if (! $this->dbfFile) {
582
+            if (!$this->dbfFile) {
583 583
                 $this->setError(sprintf('It wasn\'t possible to open the DBase file "%s"', $dbfName));
584 584
 
585 585
                 return false;
Please login to merge, or discard this patch.