| Total Complexity | 4 |
| Total Lines | 56 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 12 | class TimesCalled implements Indifferent, Scalar |
||
| 13 | { |
||
| 14 | |||
| 15 | /** |
||
| 16 | * Ctor. |
||
| 17 | * |
||
| 18 | * @phpstan-param T $origin |
||
| 19 | * @param object $origin original object. |
||
| 20 | * @param Count $count how many times the method was called. |
||
| 21 | * @param string $method method to pay attention to. |
||
| 22 | */ |
||
| 23 | public function __construct( |
||
| 24 | /** |
||
| 25 | * Original object. |
||
| 26 | * |
||
| 27 | * @phpstan-var T |
||
| 28 | * @var object |
||
| 29 | */ |
||
| 30 | private object $origin, |
||
| 31 | |||
| 32 | /** |
||
| 33 | * How many times the method was called. |
||
| 34 | * |
||
| 35 | * @var Count |
||
| 36 | */ |
||
| 37 | private Count $count, |
||
| 38 | |||
| 39 | /** |
||
| 40 | * MEthod to pay attention to. |
||
| 41 | * |
||
| 42 | * @var string |
||
| 43 | */ |
||
| 44 | private string $method |
||
| 45 | ) { |
||
| 46 | } |
||
| 47 | |||
| 48 | /** |
||
| 49 | * Returns the number of calls to the specified method. |
||
| 50 | * |
||
| 51 | * @return int |
||
| 52 | */ |
||
| 53 | public function value(): int |
||
| 56 | } |
||
| 57 | |||
| 58 | /** |
||
| 59 | * Sends calls through itself and counts how many times a specific method was called. |
||
| 60 | * {@inheritDoc} |
||
| 61 | */ |
||
| 62 | public function __call(string $name, array $arguments): mixed |
||
| 68 | } |
||
| 69 | } |
||
| 70 |