Completed
Push — master ( 0f74d8...48caa0 )
by Maurício
02:18
created
tests/ShapeFileTest.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
      */
193 193
     public function testCreate()
194 194
     {
195
-        if (! ShapeFile::supportsDbase()) {
195
+        if (!ShapeFile::supportsDbase()) {
196 196
             $this->markTestSkipped('dbase extension missing');
197 197
         }
198 198
 
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
      */
209 209
     public function testDelete()
210 210
     {
211
-        if (! ShapeFile::supportsDbase()) {
211
+        if (!ShapeFile::supportsDbase()) {
212 212
             $this->markTestSkipped('dbase extension missing');
213 213
         }
214 214
 
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
      */
231 231
     public function testAdd()
232 232
     {
233
-        if (! ShapeFile::supportsDbase()) {
233
+        if (!ShapeFile::supportsDbase()) {
234 234
             $this->markTestSkipped('dbase extension missing');
235 235
         }
236 236
 
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
             'numpoints',
331 331
         ];
332 332
         foreach ($items as $item) {
333
-            if (! isset($record->shpData[$item])) {
333
+            if (!isset($record->shpData[$item])) {
334 334
                 continue;
335 335
             }
336 336
 
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
             -1,
495 495
             $shp->getIndexFromDBFData('CNTRY_NAME', 'nonexisting')
496 496
         );
497
-        if (! ShapeFile::supportsDbase()) {
497
+        if (!ShapeFile::supportsDbase()) {
498 498
             return;
499 499
         }
500 500
 
Please login to merge, or discard this patch.
src/ShapeFile.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
      */
118 118
     public function loadFromFile($fileName)
119 119
     {
120
-        if (! empty($fileName)) {
120
+        if (!empty($fileName)) {
121 121
             $this->fileName = $fileName;
122 122
             $result = $this->openSHPFile();
123 123
         } else {
@@ -126,14 +126,14 @@  discard block
 block discarded – undo
126 126
         }
127 127
 
128 128
         if ($result && ($this->openDBFFile())) {
129
-            if (! $this->loadHeaders()) {
129
+            if (!$this->loadHeaders()) {
130 130
                 $this->closeSHPFile();
131 131
                 $this->closeDBFFile();
132 132
 
133 133
                 return false;
134 134
             }
135 135
 
136
-            if (! $this->loadRecords()) {
136
+            if (!$this->loadRecords()) {
137 137
                 $this->closeSHPFile();
138 138
                 $this->closeDBFFile();
139 139
 
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
             $this->fileName = $fileName;
161 161
         }
162 162
 
163
-        if (! $this->openSHPFile(true) || (! $this->openSHXFile(true)) || (! $this->createDBFFile())) {
163
+        if (!$this->openSHPFile(true) || (!$this->openSHXFile(true)) || (!$this->createDBFFile())) {
164 164
             return false;
165 165
         }
166 166
 
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
         $min = $type . 'min';
195 195
         $max = $type . 'max';
196 196
 
197
-        if (! isset($this->boundingBox[$min])
197
+        if (!isset($this->boundingBox[$min])
198 198
             || $this->boundingBox[$min] == 0.0
199 199
             || ($this->boundingBox[$min] > $data[$min])
200 200
         ) {
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
      */
250 250
     public function deleteRecord($index)
251 251
     {
252
-        if (! isset($this->records[$index])) {
252
+        if (!isset($this->records[$index])) {
253 253
             return;
254 254
         }
255 255
 
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
         $inHeader = true;
326 326
 
327 327
         while ($inHeader) {
328
-            if (! feof($DBFFile)) {
328
+            if (!feof($DBFFile)) {
329 329
                 $buff32 = fread($DBFFile, 32);
330 330
                 if ($i > 1) {
331 331
                     if (substr($buff32, 0, 1) == chr(13)) {
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
      */
362 362
     private function deleteRecordFromDBF($index)
363 363
     {
364
-        if ($this->dbfFile === null || ! @dbase_delete_record($this->dbfFile, $index)) {
364
+        if ($this->dbfFile === null || !@dbase_delete_record($this->dbfFile, $index)) {
365 365
             return;
366 366
         }
367 367
 
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
     private function loadRecords()
465 465
     {
466 466
         /* Need to start at offset 100 */
467
-        while (! $this->eofSHP()) {
467
+        while (!$this->eofSHP()) {
468 468
             $record = new ShapeRecord(-1);
469 469
             $record->loadFromFile($this, $this->shpFile, $this->dbfFile);
470 470
             if ($record->lastError != '') {
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
     private function saveRecords()
490 490
     {
491 491
         $offset = 50;
492
-        if (! is_array($this->records) || (count($this->records) <= 0)) {
492
+        if (!is_array($this->records) || (count($this->records) <= 0)) {
493 493
             return;
494 494
         }
495 495
 
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
     {
518 518
         $shpName = $this->getFilename($extension);
519 519
         $result = @fopen($shpName, ($toWrite ? 'wb+' : 'rb'));
520
-        if (! $result) {
520
+        if (!$result) {
521 521
             $this->setError(sprintf('It wasn\'t possible to open the %s file "%s"', $name, $shpName));
522 522
 
523 523
             return false;
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
      */
546 546
     private function closeSHPFile()
547 547
     {
548
-        if (! $this->shpFile) {
548
+        if (!$this->shpFile) {
549 549
             return;
550 550
         }
551 551
 
@@ -572,7 +572,7 @@  discard block
 block discarded – undo
572 572
      */
573 573
     private function closeSHXFile()
574 574
     {
575
-        if (! $this->shxFile) {
575
+        if (!$this->shxFile) {
576 576
             return;
577 577
         }
578 578
 
@@ -587,7 +587,7 @@  discard block
 block discarded – undo
587 587
      */
588 588
     private function createDBFFile()
589 589
     {
590
-        if (! self::supportsDbase() || ! is_array($this->dbfHeader) || count($this->dbfHeader) == 0) {
590
+        if (!self::supportsDbase() || !is_array($this->dbfHeader) || count($this->dbfHeader) == 0) {
591 591
             $this->dbfFile = null;
592 592
 
593 593
             return true;
@@ -618,21 +618,21 @@  discard block
 block discarded – undo
618 618
      */
619 619
     private function openDBFFile()
620 620
     {
621
-        if (! self::supportsDbase()) {
621
+        if (!self::supportsDbase()) {
622 622
             $this->dbfFile = null;
623 623
 
624 624
             return true;
625 625
         }
626 626
 
627 627
         $dbfName = $this->getFilename('.dbf');
628
-        if (! is_readable($dbfName)) {
628
+        if (!is_readable($dbfName)) {
629 629
             $this->setError(sprintf('It wasn\'t possible to find the DBase file "%s"', $dbfName));
630 630
 
631 631
             return false;
632 632
         }
633 633
 
634 634
         $this->dbfFile = @dbase_open($dbfName, 0);
635
-        if (! $this->dbfFile) {
635
+        if (!$this->dbfFile) {
636 636
             $this->setError(sprintf('It wasn\'t possible to open the DBase file "%s"', $dbfName));
637 637
 
638 638
             return false;
@@ -646,7 +646,7 @@  discard block
 block discarded – undo
646 646
      */
647 647
     private function closeDBFFile()
648 648
     {
649
-        if (! $this->dbfFile) {
649
+        if (!$this->dbfFile) {
650 650
             return;
651 651
         }
652 652
 
Please login to merge, or discard this patch.
src/ShapeRecord.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
             $this->setError(sprintf('Failed to parse record, read=%d, size=%d', $this->read, $this->size));
135 135
         }
136 136
 
137
-        if (! ShapeFile::supportsDbase() || ! isset($this->dbfFile)) {
137
+        if (!ShapeFile::supportsDbase() || !isset($this->dbfFile)) {
138 138
             return;
139 139
         }
140 140
 
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
                 break;
201 201
         }
202 202
 
203
-        if (! ShapeFile::supportsDbase() || $this->dbfFile === null) {
203
+        if (!ShapeFile::supportsDbase() || $this->dbfFile === null) {
204 204
             return;
205 205
         }
206 206
 
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
     private function loadMultiPointMZRecord($type)
385 385
     {
386 386
         /* The m dimension is optional, depends on bounding box data */
387
-        if ($type == 'm' && ! $this->shapeFile->hasMeasure()) {
387
+        if ($type == 'm' && !$this->shapeFile->hasMeasure()) {
388 388
             return;
389 389
         }
390 390
 
@@ -476,8 +476,8 @@  discard block
 block discarded – undo
476 476
                 ++$part;
477 477
             }
478 478
 
479
-            if (! isset($this->shpData['parts'][$part]['points'])
480
-                || ! is_array($this->shpData['parts'][$part]['points'])
479
+            if (!isset($this->shpData['parts'][$part]['points'])
480
+                || !is_array($this->shpData['parts'][$part]['points'])
481 481
             ) {
482 482
                 $this->shpData['parts'][$part] = ['points' => []];
483 483
             }
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
     private function loadPolyLineMZRecord($type)
493 493
     {
494 494
         /* The m dimension is optional, depends on bounding box data */
495
-        if ($type == 'm' && ! $this->shapeFile->hasMeasure()) {
495
+        if ($type == 'm' && !$this->shapeFile->hasMeasure()) {
496 496
             return;
497 497
         }
498 498
 
@@ -621,13 +621,13 @@  discard block
 block discarded – undo
621 621
             'm',
622 622
         ];
623 623
         foreach ($directions as $direction) {
624
-            if (! isset($point[$direction])) {
624
+            if (!isset($point[$direction])) {
625 625
                 continue;
626 626
             }
627 627
 
628 628
             $min = $direction . 'min';
629 629
             $max = $direction . 'max';
630
-            if (! isset($this->shpData[$min]) || ($this->shpData[$min] > $point[$direction])) {
630
+            if (!isset($this->shpData[$min]) || ($this->shpData[$min] > $point[$direction])) {
631 631
                 $this->shpData[$min] = $point[$direction];
632 632
             }
633 633
 
@@ -649,7 +649,7 @@  discard block
 block discarded – undo
649 649
      */
650 650
     private function fixPoint($point, $dimension)
651 651
     {
652
-        if (! isset($point[$dimension])) {
652
+        if (!isset($point[$dimension])) {
653 653
             $point[$dimension] = 0.0; // no_value
654 654
         }
655 655
 
@@ -876,11 +876,11 @@  discard block
 block discarded – undo
876 876
 
877 877
         unset($this->dbfData['deleted']);
878 878
         if ($this->recordNumber <= dbase_numrecords($this->dbfFile)) {
879
-            if (! dbase_replace_record($this->dbfFile, array_values($this->dbfData), $this->recordNumber)) {
879
+            if (!dbase_replace_record($this->dbfFile, array_values($this->dbfData), $this->recordNumber)) {
880 880
                 $this->setError('I wasn\'t possible to update the information in the DBF file.');
881 881
             }
882 882
         } else {
883
-            if (! dbase_add_record($this->dbfFile, array_values($this->dbfData))) {
883
+            if (!dbase_add_record($this->dbfFile, array_values($this->dbfData))) {
884 884
                 $this->setError('I wasn\'t possible to add the information to the DBF file.');
885 885
             }
886 886
         }
Please login to merge, or discard this patch.