PHP 5.3 compatibility.

This commit is contained in:
Ron Cemer 2015-10-14 10:49:28 -05:00
parent 6a2a38f64f
commit 3dc32e4ef4
3 changed files with 11 additions and 11 deletions

View File

@ -44,14 +44,14 @@ class Cluster extends Point implements IteratorAggregate, Countable
public function toArray()
{
$points = [];
$points = array();
foreach ($this->points as $point)
$points[] = $point->toArray();
return [
return array(
'centroid' => parent::toArray(),
'points' => $points,
];
);
}
public function attach(Point $point)
@ -103,4 +103,4 @@ class Cluster extends Point implements IteratorAggregate, Countable
{
return count($this->points);
}
}
}

View File

@ -43,10 +43,10 @@ class Point implements ArrayAccess
public function toArray()
{
return [
return array(
'coordinates' => $this->coordinates,
'data' => isset($this->space[$this]) ? $this->space[$this] : null,
];
);
}
public function getDistanceWith(self $point)
@ -117,4 +117,4 @@ class Point implements ArrayAccess
{
unset($this->coordinates[$offset]);
}
}
}

View File

@ -50,11 +50,11 @@ class Space extends SplObjectStorage
public function toArray()
{
$points = [];
$points = array();
foreach ($this as $point)
$points[] = $point->toArray();
return ['points' => $points];
return array('points' => $points);
}
public function newPoint(array $coordinates)
@ -98,7 +98,7 @@ class Space extends SplObjectStorage
}
}
return [$min, $max];
return array($min, $max);
}
public function getRandomPoint(Point $min, Point $max)
@ -229,4 +229,4 @@ class Space extends SplObjectStorage
return $continue;
}
}
}