EWKT::write()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
nc 2
nop 1
dl 0
loc 12
rs 9.8666
c 0
b 0
f 0
1
<?php
2
/**
3
 * EWKT (Extended Well Known Text) Adapter
4
 */
5
class EWKT extends WKT
6
{
7
  
8
  /**
9
   * Serialize geometries into an EWKT string.
10
   *
11
   * @param Geometry $geometry
12
   *
13
   * @return string The Extended-WKT string representation of the input geometries
14
   */
15
  public function write(Geometry $geometry) {
16
    $srid = $geometry->SRID();
17
    $wkt = '';
0 ignored issues
show
Unused Code introduced by
$wkt is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
18
    if ($srid) {
19
      $wkt = 'SRID=' . $srid . ';';
20
      $wkt .= $geometry->out('wkt');
21
      return $wkt;
22
    }
23
    else {
24
      return $geometry->out('wkt');
25
    }
26
  }
27
}
28