Exemplo n.º 1
0
 /**
  * Initialize Exception.
  *
  * @param   Definition  $step2  duplicate step definition
  * @param   Definition  $step1  firstly matched step definition
  */
 public function __construct(Definition $step2, Definition $step1)
 {
     parent::__construct();
     $this->step1 = $step1;
     $this->step2 = $step2;
     $this->message = sprintf("Step \"%s\" is already defined in %s:%d\n\n%s:%d\n%s:%d", $this->step2->getRegex(), Formatter::trimFilename($this->step1->getFile()), $this->step1->getLine(), Formatter::trimFilename($this->step1->getFile()), $this->step1->getLine(), Formatter::trimFilename($this->step2->getFile()), $this->step2->getLine());
 }
Exemplo n.º 2
0
 /**
  * Initialize exception.
  *
  * @param   string  $text       step description
  * @param   array   $matches    ambigious matches (array of StepDefinition's)
  */
 public function __construct($text, array $matches)
 {
     parent::__construct();
     $this->text = $text;
     $this->matches = $matches;
     $this->message = sprintf("Ambiguous match of \"%s\":", $this->text);
     foreach ($this->matches as $definition) {
         $this->message .= sprintf("\n%s:%d:in `%s`", Formatter::trimFilename($definition->getFile()), $definition->getLine(), $definition->getRegex());
     }
 }
Exemplo n.º 3
0
 /**
  * Get source HTML representation. 
  * 
  * @param   string  $file   filename
  * @param   string  $line   lineno
  *
  * @return  string          HTML
  */
 protected function getSourcePathHtml($file, $line)
 {
     $html = '';
     if (null !== $file) {
         $file = ConsoleFormatter::trimFilename($file);
         $html .= '<span class="path">';
         $html .= $file . (null !== $line ? ':' . $line : '');
         $html .= '</span>';
     }
     return $html;
 }