RuntimeTokensReplacement::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 1
eloc 3
nc 1
nop 3
1
<?php
2
3
/**
4
 * @author Alexei Gorobet <[email protected]>
5
 */
6
7
namespace Behat\TokensExtension\Call;
8
9
use Behat\Testwork\Call\RuntimeCallee;
10
11
/**
12
 * Tokens replacement that is created and executed in the runtime.
13
 *
14
 * @author Alexei Gorobet <[email protected]>
15
 */
16
final class RuntimeTokensReplacement extends RuntimeCallee implements TokensReplacement
17
{
18
    /**
19
     * @var string
20
     */
21
    private $pattern;
22
23
    /**
24
     * Initializes tokens replacement.
25
     *
26
     * @param string      $pattern
27
     * @param callable    $callable
28
     * @param null|string $description
29
     */
30
    public function __construct($pattern, $callable, $description = null)
31
    {
32
        $this->pattern = $pattern;
33
34
        parent::__construct($callable, $description);
35
    }
36
37
    /**
38
     * {@inheritdoc}
39
     */
40
    public function getPattern()
41
    {
42
        return $this->pattern;
43
    }
44
45
    /**
46
     * {@inheritdoc}
47
     */
48
    public function __toString()
49
    {
50
        return 'TokensReplacement ' . $this->getPattern();
51
    }
52
}
53