for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace drupol\phpermutations\Iterators;
use drupol\phpermutations\Combinatorics;
/**
* Class Cycle.
*
* @package drupol\phpermutations\Iterators
*/
class Cycle extends Combinatorics implements \Iterator, \Countable {
* The key.
* @var int
protected $key = 0;
* Cycle constructor.
* @param array $dataset
* The dataset.
public function __construct(array $dataset = array()) {
parent::__construct($dataset);
}
* {@inheritdoc}
public function key() {
return $this->key;
public function current() {
return $this->dataset[$this->key];
public function next() {
$this->key = ($this->key + 1) % $this->datasetCount;
public function rewind() {
$this->key = 0;
public function valid() {
return TRUE;
TRUE
FALSE
NULL
true
public function count() {
return count($this->getDataset());