Add setCurrent() method to Page Collection

#531
This commit is contained in:
Karmalakas
2021-07-06 21:14:06 +03:00
committed by Matias Griese
parent 2866a51326
commit c57a29c23f

View File

@@ -145,6 +145,18 @@ class Collection extends Iterator implements PageCollectionInterface
return $this;
}
/**
* Set current page.
*/
public function setCurrent(string $path): void
{
reset($this->items);
while (key($this->items) !== $path && key($this->items) !== null) {
next($this->items);
}
}
/**
* Returns current page.
*