Total Complexity | 7 |
Total Lines | 69 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
20 | class BenchmarkedFunction |
||
21 | { |
||
22 | use GettableName; |
||
23 | |||
24 | /** @var null|string */ |
||
25 | private $comment; |
||
26 | |||
27 | /** @var int */ |
||
28 | private $index; |
||
29 | |||
30 | /** @var array */ |
||
31 | private $args; |
||
32 | |||
33 | /** @var callable */ |
||
34 | private $func; |
||
35 | |||
36 | /** |
||
37 | * BenchmarkedFunction constructor. |
||
38 | * @param callable $func |
||
39 | * @param string $name |
||
40 | * @param int $index |
||
41 | * @param array $args |
||
42 | * @param null|string $comment |
||
43 | */ |
||
44 | 1 | public function __construct($func, string $name, int $index, array $args, ?string $comment = null) |
|
45 | { |
||
46 | 1 | $this->func = $func; |
|
47 | 1 | $this->comment = $comment; |
|
48 | 1 | $this->name = $name; |
|
49 | 1 | $this->index = $index; |
|
50 | 1 | $this->args = $args; |
|
51 | 1 | } |
|
52 | |||
53 | /** |
||
54 | * @return string |
||
55 | */ |
||
56 | 1 | public function getComment(): string |
|
57 | { |
||
58 | 1 | return $this->comment ? str_decorate($this->comment, '"') : ''; |
|
59 | } |
||
60 | |||
61 | /** |
||
62 | * @return int |
||
63 | */ |
||
64 | 1 | public function getIndex(): int |
|
67 | } |
||
68 | |||
69 | /** |
||
70 | * @return array |
||
71 | */ |
||
72 | 1 | public function getArgs(): array |
|
75 | } |
||
76 | |||
77 | /** |
||
78 | * @return callable |
||
79 | */ |
||
80 | 1 | public function getFunction(): callable |
|
81 | { |
||
82 | 1 | return $this->func; |
|
83 | } |
||
84 | |||
85 | 1 | public function getEnumeratedName(): string |
|
89 | } |
||
90 | } |
||
91 |