Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
3 / 3 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| ParameterAssertionException | |
100.00% |
3 / 3 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
| getParameterName | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | declare( strict_types = 1 ); |
| 3 | |
| 4 | namespace Wikimedia\Assert; |
| 5 | |
| 6 | use InvalidArgumentException; |
| 7 | |
| 8 | /** |
| 9 | * Exception indicating that an parameter assertion failed. |
| 10 | * This generally means a disagreement between the caller and the implementation of a function. |
| 11 | * |
| 12 | * @since 0.1.0 |
| 13 | * |
| 14 | * @license MIT |
| 15 | * @author Daniel Kinzler |
| 16 | * @copyright Wikimedia Deutschland e.V. |
| 17 | */ |
| 18 | class ParameterAssertionException extends InvalidArgumentException implements AssertionException { |
| 19 | |
| 20 | private string $parameterName; |
| 21 | |
| 22 | public function __construct( string $parameterName, string $description ) { |
| 23 | parent::__construct( "Bad value for parameter $parameterName: $description" ); |
| 24 | |
| 25 | $this->parameterName = $parameterName; |
| 26 | } |
| 27 | |
| 28 | public function getParameterName(): string { |
| 29 | return $this->parameterName; |
| 30 | } |
| 31 | |
| 32 | } |