Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
66.67% |
8 / 12 |
CRAP | |
64.00% |
16 / 25 |
| Track | |
0.00% |
0 / 1 |
|
66.67% |
8 / 12 |
25.50 | |
64.00% |
16 / 25 |
| __construct() | |
100.00% |
1 / 1 |
1 | |
100.00% |
3 / 3 |
|||
| __toString() | |
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 5 |
|||
| offsetSet($offset, $value) | |
0.00% |
0 / 1 |
2.03 | |
80.00% |
4 / 5 |
|||
| offsetExists($offset) | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
|||
| offsetUnset($offset) | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 2 |
|||
| offsetGet($offset) | |
100.00% |
1 / 1 |
2 | |
100.00% |
1 / 1 |
|||
| rewind() | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
|||
| current() | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| key() | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| next() | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
|||
| valid() | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| count() | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| <?php | |
| /** | |
| * | |
| */ | |
| namespace aae\geo { | |
| /** | |
| * @author Axel Ancona Esselmann | |
| * @package aae\geo | |
| */ | |
| class Track implements \arrayaccess, \Iterator, \Countable{ | |
| public $name = ""; | |
| private $position = 0; | |
| private $container = array(); | |
| public $segmentStarts = array(); | |
| public function __construct() { | |
| $this->position = 0; | |
| $this->segmentStarts[] = 0; | |
| } | |
| public function __toString() { | |
| $result = ""; | |
| foreach ($this->container as $point) { | |
| $result .= $point->__toString()."\n"; | |
| } | |
| return $result; | |
| } | |
| // arrayaccess interface implementation | |
| public function offsetSet($offset, $value) { | |
| if (is_null($offset)) { | |
| $this->container[] = $value; | |
| } else { | |
| $this->container[$offset] = $value; | |
| } | |
| } | |
| public function offsetExists($offset) { | |
| return isset($this->container[$offset]); | |
| } | |
| public function offsetUnset($offset) { | |
| unset($this->container[$offset]); | |
| } | |
| public function offsetGet($offset) { | |
| return isset($this->container[$offset]) ? $this->container[$offset] : null; | |
| } | |
| // Iterator interface implementation | |
| function rewind() { | |
| $this->position = 0; | |
| } | |
| function current() { | |
| return $this->container[$this->position]; | |
| } | |
| function key() { | |
| return $this->position; | |
| } | |
| function next() { | |
| ++$this->position; | |
| } | |
| function valid() { | |
| return isset($this->container[$this->position]); | |
| } | |
| // Countable interface implementation | |
| public function count() { | |
| return count($this->container); | |
| } | |
| } | |
| } |