Passed
Push — master ( 5f09f0...990103 )
by William
18:42 queued 16:08
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
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
             $this->setError(sprintf('Failed to parse record, read=%d, size=%d', $this->read, $this->size));
143 143
         }
144 144
 
145
-        if (! ShapeFile::supportsDbase() || ! isset($this->dbfFile)) {
145
+        if (!ShapeFile::supportsDbase() || !isset($this->dbfFile)) {
146 146
             return;
147 147
         }
148 148
 
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
                 break;
209 209
         }
210 210
 
211
-        if (! ShapeFile::supportsDbase() || $this->dbfFile === null) {
211
+        if (!ShapeFile::supportsDbase() || $this->dbfFile === null) {
212 212
             return;
213 213
         }
214 214
 
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
     private function loadMultiPointMZRecord(string $type): void
390 390
     {
391 391
         /* The m dimension is optional, depends on bounding box data */
392
-        if ($type === 'm' && ! $this->shapeFile->hasMeasure()) {
392
+        if ($type === 'm' && !$this->shapeFile->hasMeasure()) {
393 393
             return;
394 394
         }
395 395
 
@@ -478,8 +478,8 @@  discard block
 block discarded – undo
478 478
                 ++$part;
479 479
             }
480 480
 
481
-            if (! isset($this->shpData['parts'][$part]['points'])
482
-                || ! is_array($this->shpData['parts'][$part]['points'])
481
+            if (!isset($this->shpData['parts'][$part]['points'])
482
+                || !is_array($this->shpData['parts'][$part]['points'])
483 483
             ) {
484 484
                 $this->shpData['parts'][$part] = ['points' => []];
485 485
             }
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
     private function loadPolyLineMZRecord(string $type): void
492 492
     {
493 493
         /* The m dimension is optional, depends on bounding box data */
494
-        if ($type === 'm' && ! $this->shapeFile->hasMeasure()) {
494
+        if ($type === 'm' && !$this->shapeFile->hasMeasure()) {
495 495
             return;
496 496
         }
497 497
 
@@ -617,13 +617,13 @@  discard block
 block discarded – undo
617 617
             'm',
618 618
         ];
619 619
         foreach ($directions as $direction) {
620
-            if (! isset($point[$direction])) {
620
+            if (!isset($point[$direction])) {
621 621
                 continue;
622 622
             }
623 623
 
624 624
             $min = $direction . 'min';
625 625
             $max = $direction . 'max';
626
-            if (! isset($this->shpData[$min]) || ($this->shpData[$min] > $point[$direction])) {
626
+            if (!isset($this->shpData[$min]) || ($this->shpData[$min] > $point[$direction])) {
627 627
                 $this->shpData[$min] = $point[$direction];
628 628
             }
629 629
 
@@ -645,7 +645,7 @@  discard block
 block discarded – undo
645 645
      */
646 646
     private function fixPoint(array $point, string $dimension): array
647 647
     {
648
-        if (! isset($point[$dimension])) {
648
+        if (!isset($point[$dimension])) {
649 649
             $point[$dimension] = 0.0; // no_value
650 650
         }
651 651
 
@@ -870,11 +870,11 @@  discard block
 block discarded – undo
870 870
 
871 871
         unset($this->dbfData['deleted']);
872 872
         if ($this->recordNumber <= dbase_numrecords($this->dbfFile)) {
873
-            if (! dbase_replace_record($this->dbfFile, array_values($this->dbfData), $this->recordNumber)) {
873
+            if (!dbase_replace_record($this->dbfFile, array_values($this->dbfData), $this->recordNumber)) {
874 874
                 $this->setError('I wasn\'t possible to update the information in the DBF file.');
875 875
             }
876 876
         } else {
877
-            if (! dbase_add_record($this->dbfFile, array_values($this->dbfData))) {
877
+            if (!dbase_add_record($this->dbfFile, array_values($this->dbfData))) {
878 878
                 $this->setError('I wasn\'t possible to add the information to the DBF file.');
879 879
             }
880 880
         }
Please login to merge, or discard this patch.
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.
src/ShapeFile.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
      */
124 124
     public function loadFromFile(string $fileName): bool
125 125
     {
126
-        if (! empty($fileName)) {
126
+        if (!empty($fileName)) {
127 127
             $this->fileName = $fileName;
128 128
             $result = $this->openSHPFile();
129 129
         } else {
@@ -132,14 +132,14 @@  discard block
 block discarded – undo
132 132
         }
133 133
 
134 134
         if ($result && ($this->openDBFFile())) {
135
-            if (! $this->loadHeaders()) {
135
+            if (!$this->loadHeaders()) {
136 136
                 $this->closeSHPFile();
137 137
                 $this->closeDBFFile();
138 138
 
139 139
                 return false;
140 140
             }
141 141
 
142
-            if (! $this->loadRecords()) {
142
+            if (!$this->loadRecords()) {
143 143
                 $this->closeSHPFile();
144 144
                 $this->closeDBFFile();
145 145
 
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
             $this->fileName = $fileName;
167 167
         }
168 168
 
169
-        if (! $this->openSHPFile(true) || (! $this->openSHXFile(true)) || (! $this->createDBFFile())) {
169
+        if (!$this->openSHPFile(true) || (!$this->openSHXFile(true)) || (!$this->createDBFFile())) {
170 170
             return false;
171 171
         }
172 172
 
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
         $min = $type . 'min';
201 201
         $max = $type . 'max';
202 202
 
203
-        if (! isset($this->boundingBox[$min])
203
+        if (!isset($this->boundingBox[$min])
204 204
             || $this->boundingBox[$min] == 0.0
205 205
             || ($this->boundingBox[$min] > $data[$min])
206 206
         ) {
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
      */
252 252
     public function deleteRecord(int $index): void
253 253
     {
254
-        if (! isset($this->records[$index])) {
254
+        if (!isset($this->records[$index])) {
255 255
             return;
256 256
         }
257 257
 
@@ -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)) {
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
      */
360 360
     private function deleteRecordFromDBF(int $index): void
361 361
     {
362
-        if ($this->dbfFile === null || ! @dbase_delete_record($this->dbfFile, $index)) {
362
+        if ($this->dbfFile === null || !@dbase_delete_record($this->dbfFile, $index)) {
363 363
             return;
364 364
         }
365 365
 
@@ -458,7 +458,7 @@  discard block
 block discarded – undo
458 458
     private function loadRecords(): bool
459 459
     {
460 460
         /* Need to start at offset 100 */
461
-        while (! $this->eofSHP()) {
461
+        while (!$this->eofSHP()) {
462 462
             $record = new ShapeRecord(-1);
463 463
             $record->loadFromFile($this, $this->shpFile, $this->dbfFile);
464 464
             if ($record->lastError !== '') {
@@ -483,7 +483,7 @@  discard block
 block discarded – undo
483 483
     private function saveRecords(): void
484 484
     {
485 485
         $offset = 50;
486
-        if (! is_array($this->records) || (count($this->records) <= 0)) {
486
+        if (!is_array($this->records) || (count($this->records) <= 0)) {
487 487
             return;
488 488
         }
489 489
 
@@ -511,7 +511,7 @@  discard block
 block discarded – undo
511 511
     {
512 512
         $shpName = $this->getFilename($extension);
513 513
         $result = @fopen($shpName, ($toWrite ? 'wb+' : 'rb'));
514
-        if (! $result) {
514
+        if (!$result) {
515 515
             $this->setError(sprintf('It wasn\'t possible to open the %s file "%s"', $name, $shpName));
516 516
 
517 517
             return false;
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
      */
538 538
     private function closeSHPFile(): void
539 539
     {
540
-        if (! $this->shpFile) {
540
+        if (!$this->shpFile) {
541 541
             return;
542 542
         }
543 543
 
@@ -562,7 +562,7 @@  discard block
 block discarded – undo
562 562
      */
563 563
     private function closeSHXFile(): void
564 564
     {
565
-        if (! $this->shxFile) {
565
+        if (!$this->shxFile) {
566 566
             return;
567 567
         }
568 568
 
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
      */
576 576
     private function createDBFFile(): bool
577 577
     {
578
-        if (! self::supportsDbase() || ! is_array($this->dbfHeader) || count($this->dbfHeader) === 0) {
578
+        if (!self::supportsDbase() || !is_array($this->dbfHeader) || count($this->dbfHeader) === 0) {
579 579
             $this->dbfFile = null;
580 580
 
581 581
             return true;
@@ -604,21 +604,21 @@  discard block
 block discarded – undo
604 604
      */
605 605
     private function openDBFFile(): bool
606 606
     {
607
-        if (! self::supportsDbase()) {
607
+        if (!self::supportsDbase()) {
608 608
             $this->dbfFile = null;
609 609
 
610 610
             return true;
611 611
         }
612 612
 
613 613
         $dbfName = $this->getFilename('.dbf');
614
-        if (! is_readable($dbfName)) {
614
+        if (!is_readable($dbfName)) {
615 615
             $this->setError(sprintf('It wasn\'t possible to find the DBase file "%s"', $dbfName));
616 616
 
617 617
             return false;
618 618
         }
619 619
 
620 620
         $this->dbfFile = @dbase_open($dbfName, 0);
621
-        if (! $this->dbfFile) {
621
+        if (!$this->dbfFile) {
622 622
             $this->setError(sprintf('It wasn\'t possible to open the DBase file "%s"', $dbfName));
623 623
 
624 624
             return false;
@@ -632,7 +632,7 @@  discard block
 block discarded – undo
632 632
      */
633 633
     private function closeDBFFile(): void
634 634
     {
635
-        if (! $this->dbfFile) {
635
+        if (!$this->dbfFile) {
636 636
             return;
637 637
         }
638 638
 
Please login to merge, or discard this patch.