/** * Runs the steps in this exercise. * * @return void */ public function run() { $this->_command->clear(); $this->_moveToLatestStep(); foreach ($this->_steps as $step) { $success = false; while (!$success) { $this->_initUnit(); $this->{$step}(); $results = $this->_unit->results(); if ($this->_stepSuccess($results)) { $this->_logLastCompletedStep($step); $this->_command->clear(); $success = true; } else { $this->_command->clear(); $this->_printErrors($results); } } } $this->header("Exercise complete."); $response = $this->in("{:cyan}Run again?{:end}", array('choices' => array('y', 'n'), 'default' => 'n')); if ($response == 'y') { $this->_command->clear(); $this->_clearLogFile(); $this->_initSteps(); return $this->run(); } }