Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
9 / 9 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| DeprecatedFeatureException | |
100.00% |
9 / 9 |
|
100.00% |
1 / 1 |
2 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
9 / 9 |
|
100.00% |
1 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Phpdftk\Pdf\Core\File; |
| 6 | |
| 7 | use Phpdftk\Pdf\Core\DeprecatedPdfFeature; |
| 8 | use Phpdftk\Pdf\Core\PdfVersion; |
| 9 | |
| 10 | /** |
| 11 | * Thrown when strict deprecation mode (or ceiling mode) is active and a |
| 12 | * feature marked with {@see DeprecatedPdfFeature::$removedIn} is registered |
| 13 | * at or above its removal version. |
| 14 | */ |
| 15 | class DeprecatedFeatureException extends \RuntimeException |
| 16 | { |
| 17 | public function __construct( |
| 18 | public readonly string $objectClass, |
| 19 | public readonly DeprecatedPdfFeature $deprecation, |
| 20 | public readonly PdfVersion $targetVersion, |
| 21 | ) { |
| 22 | parent::__construct(sprintf( |
| 23 | '%s was removed in PDF %s (deprecated since %s%s). ' |
| 24 | . 'Cannot include in a PDF %s document.', |
| 25 | $objectClass, |
| 26 | $deprecation->removedIn, |
| 27 | $deprecation->since, |
| 28 | $deprecation->replacement ? "; replacement: {$deprecation->replacement}" : '', |
| 29 | $targetVersion->value, |
| 30 | )); |
| 31 | } |
| 32 | } |