Skip to content

Instantly share code, notes, and snippets.

@Mezzle
Last active May 31, 2016 09:51
Show Gist options
  • Save Mezzle/95f6d975ae67d1b9d5ce to your computer and use it in GitHub Desktop.
Save Mezzle/95f6d975ae67d1b9d5ce to your computer and use it in GitHub Desktop.
Route.php
<?php
class Route
{
protected $first_stop;
protected $last_stop;
// Assume getters and setters
public function getStops()
{
do {
if (is_null($stop)) {
$stop = $this->getFirstStop();
} else {
$stop = $stop->next();
}
yield $stop;
} while ($stop != $this->getLastStop());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment