StrictKeywordException   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 16
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
1
<?php namespace Chekote\BehatRetryExtension\Definition\Exception;
2
3
use Behat\Behat\Definition\Definition;
4
use Behat\Behat\Definition\Exception\SearchException;
5
use RuntimeException;
6
7
/**
8
 * Represents an exception caused by an incorrect keyword used to invoke a step definition.
9
 */
10
final class StrictKeywordException extends RuntimeException implements SearchException
11
{
12
    /**
13
     * Initializes strict keyword exception.
14
     *
15
     * @param string     $keyword    the keyword that was used to invoke the step.
16
     * @param Definition $definition the definition that matched the step.
17
     */
18
    public function __construct($keyword, Definition $definition)
19
    {
20
        parent::__construct(
21
            sprintf(
22
                "Step '%s' was matched but the wrong keyword '%s' was used. The step should be invoked with '%s'",
23
                $definition->getPattern(),
24
                $keyword,
25
                $definition->getType()
26
            )
27
        );
28
    }
29
}
30