izzum\examples\trafficlight\TrafficLight::toString PHP Method

toString() public method

public toString ( )
    public function toString()
    {
        return sprintf("trafficlight[%s] on color [%s] for [%s] seconds", $this->id, $this->color, time() - $this->switch_time) . PHP_EOL;
    }

Usage Example

 /**
  * overriden method with the correct implementation for our
  * domain logic
  * {@inheritDoc}
  */
 protected function _applies()
 {
     echo $this->light->toString();
     return (bool) $this->light->isReadyToSwitch();
 }