Passed
Pull Request — 1.x (#1)
by Kevin
01:50
created

Fail   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
dl 0
loc 12
rs 10
c 1
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A __invoke() 0 3 1
1
<?php
2
3
namespace Zenstruck\Browser\Assert\Assertion;
4
5
use Zenstruck\Browser\Assert\Assertion;
6
use Zenstruck\Browser\Assert\Exception\AssertionFailed;
7
8
/**
9
 * @author Kevin Bond <[email protected]>
10
 */
11
final class Fail implements Assertion
12
{
13
    private string $message;
14
15
    public function __construct(string $message, ...$args)
16
    {
17
        $this->message = \sprintf($message, ...$args);
18
    }
19
20
    public function __invoke(): void
21
    {
22
        throw new AssertionFailed($this->message);
23
    }
24
}
25