Completed
Push — master ( 63e314...749f83 )
by William
08:02 queued 08:02
created
tests/ShapeFileTest.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
      */
195 195
     public function testCreate(): void
196 196
     {
197
-        if (! ShapeFile::supportsDbase()) {
197
+        if (!ShapeFile::supportsDbase()) {
198 198
             $this->markTestSkipped('dbase extension missing');
199 199
         }
200 200
 
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
      */
211 211
     public function testDelete(): void
212 212
     {
213
-        if (! ShapeFile::supportsDbase()) {
213
+        if (!ShapeFile::supportsDbase()) {
214 214
             $this->markTestSkipped('dbase extension missing');
215 215
         }
216 216
 
@@ -232,7 +232,7 @@  discard block
 block discarded – undo
232 232
      */
233 233
     public function testAdd(): void
234 234
     {
235
-        if (! ShapeFile::supportsDbase()) {
235
+        if (!ShapeFile::supportsDbase()) {
236 236
             $this->markTestSkipped('dbase extension missing');
237 237
         }
238 238
 
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
             'numpoints',
333 333
         ];
334 334
         foreach ($items as $item) {
335
-            if (! isset($record->shpData[$item])) {
335
+            if (!isset($record->shpData[$item])) {
336 336
                 continue;
337 337
             }
338 338
 
@@ -510,7 +510,7 @@  discard block
 block discarded – undo
510 510
             -1,
511 511
             $shp->getIndexFromDBFData('CNTRY_NAME', 'nonexisting')
512 512
         );
513
-        if (! ShapeFile::supportsDbase()) {
513
+        if (!ShapeFile::supportsDbase()) {
514 514
             return;
515 515
         }
516 516
 
Please login to merge, or discard this patch.
src/ShapeRecord.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@
 block discarded – undo
57 57
     /** @var int */
58 58
     public $shapeType = null;
59 59
 
60
-     /** @var string */
60
+        /** @var string */
61 61
     public $lastError = '';
62 62
 
63 63
     /** @var array */
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
             $this->setError(sprintf('Failed to parse record, read=%d, size=%d', $this->read, $this->size));
145 145
         }
146 146
 
147
-        if (! ShapeFile::supportsDbase() || ! isset($this->dbfFile)) {
147
+        if (!ShapeFile::supportsDbase() || !isset($this->dbfFile)) {
148 148
             return;
149 149
         }
150 150
 
@@ -210,7 +210,7 @@  discard block
 block discarded – undo
210 210
                 break;
211 211
         }
212 212
 
213
-        if (! ShapeFile::supportsDbase() || $this->dbfFile === null) {
213
+        if (!ShapeFile::supportsDbase() || $this->dbfFile === null) {
214 214
             return;
215 215
         }
216 216
 
@@ -391,7 +391,7 @@  discard block
 block discarded – undo
391 391
     private function loadMultiPointMZRecord(string $type): void
392 392
     {
393 393
         /* The m dimension is optional, depends on bounding box data */
394
-        if ($type === 'm' && ! $this->shapeFile->hasMeasure()) {
394
+        if ($type === 'm' && !$this->shapeFile->hasMeasure()) {
395 395
             return;
396 396
         }
397 397
 
@@ -481,8 +481,8 @@  discard block
 block discarded – undo
481 481
             }
482 482
 
483 483
             if (
484
-                ! isset($this->shpData['parts'][$part]['points'])
485
-                || ! is_array($this->shpData['parts'][$part]['points'])
484
+                !isset($this->shpData['parts'][$part]['points'])
485
+                || !is_array($this->shpData['parts'][$part]['points'])
486 486
             ) {
487 487
                 $this->shpData['parts'][$part] = ['points' => []];
488 488
             }
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
     private function loadPolyLineMZRecord(string $type): void
495 495
     {
496 496
         /* The m dimension is optional, depends on bounding box data */
497
-        if ($type === 'm' && ! $this->shapeFile->hasMeasure()) {
497
+        if ($type === 'm' && !$this->shapeFile->hasMeasure()) {
498 498
             return;
499 499
         }
500 500
 
@@ -620,13 +620,13 @@  discard block
 block discarded – undo
620 620
             'm',
621 621
         ];
622 622
         foreach ($directions as $direction) {
623
-            if (! isset($point[$direction])) {
623
+            if (!isset($point[$direction])) {
624 624
                 continue;
625 625
             }
626 626
 
627 627
             $min = $direction . 'min';
628 628
             $max = $direction . 'max';
629
-            if (! isset($this->shpData[$min]) || ($this->shpData[$min] > $point[$direction])) {
629
+            if (!isset($this->shpData[$min]) || ($this->shpData[$min] > $point[$direction])) {
630 630
                 $this->shpData[$min] = $point[$direction];
631 631
             }
632 632
 
@@ -648,7 +648,7 @@  discard block
 block discarded – undo
648 648
      */
649 649
     private function fixPoint(array $point, string $dimension): array
650 650
     {
651
-        if (! isset($point[$dimension])) {
651
+        if (!isset($point[$dimension])) {
652 652
             $point[$dimension] = 0.0; // no_value
653 653
         }
654 654
 
@@ -875,11 +875,11 @@  discard block
 block discarded – undo
875 875
 
876 876
         unset($this->dbfData['deleted']);
877 877
         if ($this->recordNumber <= dbase_numrecords($this->dbfFile)) {
878
-            if (! dbase_replace_record($this->dbfFile, array_values($this->dbfData), $this->recordNumber)) {
878
+            if (!dbase_replace_record($this->dbfFile, array_values($this->dbfData), $this->recordNumber)) {
879 879
                 $this->setError('I wasn\'t possible to update the information in the DBF file.');
880 880
             }
881 881
         } else {
882
-            if (! dbase_add_record($this->dbfFile, array_values($this->dbfData))) {
882
+            if (!dbase_add_record($this->dbfFile, array_values($this->dbfData))) {
883 883
                 $this->setError('I wasn\'t possible to add the information to the DBF file.');
884 884
             }
885 885
         }
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
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
      */
129 129
     public function loadFromFile(string $fileName): bool
130 130
     {
131
-        if (! empty($fileName)) {
131
+        if (!empty($fileName)) {
132 132
             $this->fileName = $fileName;
133 133
             $result = $this->openSHPFile();
134 134
         } else {
@@ -137,14 +137,14 @@  discard block
 block discarded – undo
137 137
         }
138 138
 
139 139
         if ($result && ($this->openDBFFile())) {
140
-            if (! $this->loadHeaders()) {
140
+            if (!$this->loadHeaders()) {
141 141
                 $this->closeSHPFile();
142 142
                 $this->closeDBFFile();
143 143
 
144 144
                 return false;
145 145
             }
146 146
 
147
-            if (! $this->loadRecords()) {
147
+            if (!$this->loadRecords()) {
148 148
                 $this->closeSHPFile();
149 149
                 $this->closeDBFFile();
150 150
 
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
             $this->fileName = $fileName;
172 172
         }
173 173
 
174
-        if (! $this->openSHPFile(true) || (! $this->openSHXFile(true)) || (! $this->createDBFFile())) {
174
+        if (!$this->openSHPFile(true) || (!$this->openSHXFile(true)) || (!$this->createDBFFile())) {
175 175
             return false;
176 176
         }
177 177
 
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
         $max = $type . 'max';
207 207
 
208 208
         if (
209
-            ! isset($this->boundingBox[$min])
209
+            !isset($this->boundingBox[$min])
210 210
             || $this->boundingBox[$min] == 0.0 // phpcs:ignore SlevomatCodingStandard.Operators.DisallowEqualOperators
211 211
             || ($this->boundingBox[$min] > $data[$min])
212 212
         ) {
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
      */
259 259
     public function deleteRecord(int $index): void
260 260
     {
261
-        if (! isset($this->records[$index])) {
261
+        if (!isset($this->records[$index])) {
262 262
             return;
263 263
         }
264 264
 
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
         $inHeader = true;
334 334
 
335 335
         while ($inHeader) {
336
-            if (! feof($DBFFile)) {
336
+            if (!feof($DBFFile)) {
337 337
                 $buff32 = fread($DBFFile, 32);
338 338
                 if ($i > 1) {
339 339
                     if (substr($buff32, 0, 1) === chr(13)) {
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
      */
368 368
     private function deleteRecordFromDBF(int $index): void
369 369
     {
370
-        if ($this->dbfFile === null || ! @dbase_delete_record($this->dbfFile, $index)) {
370
+        if ($this->dbfFile === null || !@dbase_delete_record($this->dbfFile, $index)) {
371 371
             return;
372 372
         }
373 373
 
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
     private function loadRecords(): bool
467 467
     {
468 468
         /* Need to start at offset 100 */
469
-        while (! $this->eofSHP()) {
469
+        while (!$this->eofSHP()) {
470 470
             $record = new ShapeRecord(-1);
471 471
             $record->loadFromFile($this, $this->shpFile, $this->dbfFile);
472 472
             if ($record->lastError !== '') {
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
     private function saveRecords(): void
492 492
     {
493 493
         $offset = 50;
494
-        if (! is_array($this->records) || (count($this->records) <= 0)) {
494
+        if (!is_array($this->records) || (count($this->records) <= 0)) {
495 495
             return;
496 496
         }
497 497
 
@@ -519,7 +519,7 @@  discard block
 block discarded – undo
519 519
     {
520 520
         $shpName = $this->getFilename($extension);
521 521
         $result = @fopen($shpName, ($toWrite ? 'wb+' : 'rb'));
522
-        if (! $result) {
522
+        if (!$result) {
523 523
             $this->setError(sprintf('It wasn\'t possible to open the %s file "%s"', $name, $shpName));
524 524
 
525 525
             return false;
@@ -545,7 +545,7 @@  discard block
 block discarded – undo
545 545
      */
546 546
     private function closeSHPFile(): void
547 547
     {
548
-        if (! $this->shpFile) {
548
+        if (!$this->shpFile) {
549 549
             return;
550 550
         }
551 551
 
@@ -570,7 +570,7 @@  discard block
 block discarded – undo
570 570
      */
571 571
     private function closeSHXFile(): void
572 572
     {
573
-        if (! $this->shxFile) {
573
+        if (!$this->shxFile) {
574 574
             return;
575 575
         }
576 576
 
@@ -583,7 +583,7 @@  discard block
 block discarded – undo
583 583
      */
584 584
     private function createDBFFile(): bool
585 585
     {
586
-        if (! self::supportsDbase() || ! is_array($this->dbfHeader) || count($this->dbfHeader) === 0) {
586
+        if (!self::supportsDbase() || !is_array($this->dbfHeader) || count($this->dbfHeader) === 0) {
587 587
             $this->dbfFile = null;
588 588
 
589 589
             return true;
@@ -612,21 +612,21 @@  discard block
 block discarded – undo
612 612
      */
613 613
     private function openDBFFile(): bool
614 614
     {
615
-        if (! self::supportsDbase()) {
615
+        if (!self::supportsDbase()) {
616 616
             $this->dbfFile = null;
617 617
 
618 618
             return true;
619 619
         }
620 620
 
621 621
         $dbfName = $this->getFilename('.dbf');
622
-        if (! is_readable($dbfName)) {
622
+        if (!is_readable($dbfName)) {
623 623
             $this->setError(sprintf('It wasn\'t possible to find the DBase file "%s"', $dbfName));
624 624
 
625 625
             return false;
626 626
         }
627 627
 
628 628
         $this->dbfFile = @dbase_open($dbfName, 0);
629
-        if (! $this->dbfFile) {
629
+        if (!$this->dbfFile) {
630 630
             $this->setError(sprintf('It wasn\'t possible to open the DBase file "%s"', $dbfName));
631 631
 
632 632
             return false;
@@ -640,7 +640,7 @@  discard block
 block discarded – undo
640 640
      */
641 641
     private function closeDBFFile(): void
642 642
     {
643
-        if (! $this->dbfFile) {
643
+        if (!$this->dbfFile) {
644 644
             return;
645 645
         }
646 646
 
Please login to merge, or discard this patch.