Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
0.00% covered (danger)
0.00%
0 / 1
60.00% covered (warning)
60.00%
9 / 15
CRAP
57.58% covered (warning)
57.58%
19 / 33
Sequence
0.00% covered (danger)
0.00%
0 / 1
60.00% covered (warning)
60.00%
9 / 15
54.67
57.58% covered (warning)
57.58%
19 / 33
 __construct($elements = array())
0.00% covered (danger)
0.00%
0 / 1
13.57
30.00% covered (danger)
30.00%
3 / 10
 getId()
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
 setId($id)
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 2
 __toString()
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 addElement($point)
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
2 / 2
 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()
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 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
1
100.00% covered (success)
100.00%
1 / 1
 offsetSet($offset, $value)
0.00% covered (danger)
0.00%
0 / 1
2.03
80.00% covered (warning)
80.00%
4 / 5
 offsetExists($offset)
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
 offsetUnset($offset)
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 2
 offsetGet($offset)
100.00% covered (success)
100.00%
1 / 1
2
100.00% covered (success)
100.00%
1 / 1
 count()
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
<?php
/**
 *
 */
namespace aae\math\general {
    /**
     * @author Axel Ancona Esselmann
     * @package aae\math\general
     */
    class Sequence implements \Iterator, \arrayaccess,  \countable{
        protected $_elements = array(), $_id = NULL, $_class;
        public function __construct($elements = array()) {
            $args = func_get_args();
            if (count($args) > 0) {
                if (count($args) == 1 && is_array($args[0])) {
                    $this->_elements = $args[0];
                } else {
                    foreach ($args as $value) {
                        $this->addElement($value);
                    }
                }
            }
        }
        public function getId() {
            return $this->_id;
        }
        public function setId($id) {
            $this->_id = $id;
        }
        public function __toString() {
            return implode(", ", $this->_elements);
        }
        public function addElement($point) {
            $this->_elements[] = $point;
        }
        public function rewind() {
            reset($this->_elements);
        }
        public function current() {
            return current($this->_elements);
        }
        public function key() {
            return key($this->_elements);
        }
        public function next() {
            next($this->_elements);
        }
        public function valid() {
            return key($this->_elements) !== null;
        }
        // arrayaccess interface implementation
        public function offsetSet($offset, $value) {
            if (is_null($offset)) {
                $this->_elements[] = $value;
            } else {
                $this->_elements[$offset] = $value;
            }
        }
        public function offsetExists($offset) {
            return isset($this->_elements[$offset]);
        }
        public function offsetUnset($offset) {
            unset($this->_elements[$offset]);
        }
        public function offsetGet($offset) {
            return isset($this->_elements[$offset]) ? $this->_elements[$offset] : null;
        }
        // Countable interface implementation
        public function count() {
            return count($this->_elements);
        }
    }
}