Last active
May 31, 2016 09:51
-
-
Save Mezzle/95f6d975ae67d1b9d5ce to your computer and use it in GitHub Desktop.
Route.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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