Code Coverage |
||||||||||||||||
Lines |
Branches |
Paths |
Functions and Methods |
Classes and Traits |
||||||||||||
| Total | |
100.00% |
4 / 4 |
|
100.00% |
4 / 4 |
|
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| Call | |
100.00% |
4 / 4 |
|
100.00% |
4 / 4 |
|
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
3 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
4 / 4 |
|
100.00% |
4 / 4 |
|
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
3 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Celemas\Wire; |
| 6 | |
| 7 | use Attribute; |
| 8 | use Celemas\Wire\Exception\WireException; |
| 9 | |
| 10 | /** @psalm-api */ |
| 11 | #[Attribute(Attribute::IS_REPEATABLE | Attribute::TARGET_CLASS)] |
| 12 | class Call |
| 13 | { |
| 14 | public array $args; |
| 15 | |
| 16 | public function __construct( |
| 17 | public readonly string $method, |
| 18 | mixed ...$args, |
| 19 | ) { |
| 20 | if (count($args) > 0) { |
| 21 | if (is_int(array_key_first($args))) { |
| 22 | throw new WireException('Arguments for Call must be named arguments'); |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | $this->args = $args; |
| 27 | } |
| 28 | } |