protected function setColor($color) { $this->setSwitchTime(); $this->color = $color; echo sprintf('trafficlight[%s] switching to [%s]', $this->id, strtoupper($color)) . PHP_EOL; }