Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
0.00% covered (danger)
0.00%
0 / 1
66.67% covered (warning)
66.67%
6 / 9
CRAP
85.19% covered (warning)
85.19%
23 / 27
Point
0.00% covered (danger)
0.00%
0 / 1
66.67% covered (warning)
66.67%
6 / 9
14.64
85.19% covered (warning)
85.19%
23 / 27
 __construct($x, $y, $z = null)
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
4 / 4
 __set($property, $value)
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
4 / 4
 __get($property)
0.00% covered (danger)
0.00%
0 / 1
2.15
66.67% covered (warning)
66.67%
2 / 3
 __toString()
0.00% covered (danger)
0.00%
0 / 1
3.10
77.78% covered (warning)
77.78%
7 / 9
 rewind()
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
 current()
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 key()
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
 next()
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
 valid()
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
1 / 1
<?php
/**
 *
 */
namespace aae\math\cartesian {
    /**
     * @author Axel Ancona Esselmann
     * @package aae\math\cartesian
     */
    class Point implements \Iterator {
        protected $_values = array("x" => null, "y" => null, "z" => null, "time" => null);
        public function __construct($x, $y, $z = null) {
            $this->_values["x"] = $x;
            $this->_values["y"] = $y;
            $this->_values["z"] = $z;
        }
        public function __set($property, $value) {
            if (array_key_exists($property, $this->_values)) {
                $this->_values[$property] = $value;
            }
            return $this;
        }
        public function __get($property) {
            if (array_key_exists($property, $this->_values)) {
                return $this->_values[$property];
            } else {
                return null;
            }
        }
        public function __toString() {
            $result = "(" . $this->_values["x"]. ", " . $this->_values["y"];
            if (!is_null($this->_values["z"] )) {
                $result .= ", " . $this->_values["z"];
            }
            $result .= ")";
            if (!is_null($this->_values["time"])) {
                $result .= ", time = ". $this->_values["time"];
            }
            return $result;
        }
        function rewind() {
            reset($this->_values);
        }
        function current() {
            return current($this->_values);
        }
        function key() {
            return key($this->_values);
        }
        function next() {
            next($this->_values);
        }
        function valid() {
            return !is_null(key($this->_values)) && !is_null($this->current());
        }
    }
}