Exemplo n.º 1
0
 public function parse()
 {
     $executor = StepExecutor::getInstance();
     $matches = array();
     while ($line = fgets($this->_file)) {
         $line = str_replace("\n", '', $line);
         if (preg_match(self::STEP_PATTERN, $line, $matches) == 1) {
             list($full, $step, $args) = $matches;
             try {
                 $result = $executor->call($step, $args);
                 if (S_SUCCESS === $result) {
                     Output::success($line);
                 } elseif (S_PENDING === $result) {
                     Output::pending($line);
                 }
             } catch (Exception $ex) {
                 Output::error($ex);
             }
         } else {
             Output::println($line);
         }
     }
 }
Exemplo n.º 2
0
 public static function getInstance()
 {
     if (is_null(self::$_instance)) {
         self::$_instance = new StepExecutor();
     }
     return self::$_instance;
 }