StrictKeywordException::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 6
nc 1
nop 2
dl 0
loc 8
rs 10
c 0
b 0
f 0
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