This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate
the same code in three or more different places, we strongly encourage you to
look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.
Loading history...
48
{
49
if ($this->hasNext())
50
{
51
$this->canRemove = true;
52
return $this->list->get(--$this->index);
53
}
54
else
55
{
56
throw new NoSuchElementException("Could not find element at index {$this->index}");
57
}
58
}
59
60
/**
61
* Returns the next element in the list and advances the cursor position.
62
* @return multitype
63
* @throws NoSuchElementException
64
*/
65
public function hasNext()
66
{
67
return $this->index > 0;
68
}
69
70
/**
71
* Removes from the list the last element that was returned by next()
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate
the same code in three or more different places, we strongly encourage you to
look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.
Loading history...
76
{
77
if($this->canRemove)
78
{
79
$this->list->removeAt($this->index);
80
$this->canRemove = false;
81
}
82
else
83
{
84
throw new IllegalStateException("Cannot remove element unless next has been called");
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.