| 1 |
<?php |
| 2 |
|
| 3 |
declare (strict_types=1); |
| 4 |
namespace Dudlewebs\WPMCS\Brick\Math\Exception; |
| 5 |
|
| 6 |
/** |
| 7 |
* Exception thrown when a division by zero occurs. |
| 8 |
*/ |
| 9 |
class DivisionByZeroException extends MathException |
| 10 |
{ |
| 11 |
/** |
| 12 |
* @return DivisionByZeroException |
| 13 |
* |
| 14 |
* @psalm-pure |
| 15 |
*/ |
| 16 |
public static function divisionByZero(): DivisionByZeroException |
| 17 |
{ |
| 18 |
return new self('Division by zero.'); |
| 19 |
} |
| 20 |
/** |
| 21 |
* @return DivisionByZeroException |
| 22 |
* |
| 23 |
* @psalm-pure |
| 24 |
*/ |
| 25 |
public static function modulusMustNotBeZero(): DivisionByZeroException |
| 26 |
{ |
| 27 |
return new self('The modulus must not be zero.'); |
| 28 |
} |
| 29 |
/** |
| 30 |
* @return DivisionByZeroException |
| 31 |
* |
| 32 |
* @psalm-pure |
| 33 |
*/ |
| 34 |
public static function denominatorMustNotBeZero(): DivisionByZeroException |
| 35 |
{ |
| 36 |
return new self('The denominator of a rational number cannot be zero.'); |
| 37 |
} |
| 38 |
} |
| 39 |
|