Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
7 / 7 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| EncryptionConstraint | |
100.00% |
7 / 7 |
|
100.00% |
1 / 1 |
2 | |
100.00% |
1 / 1 |
| check | |
100.00% |
7 / 7 |
|
100.00% |
1 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Phpdftk\Pdf\Conformance\Constraint; |
| 6 | |
| 7 | use Phpdftk\Pdf\Conformance\Inspection\DocumentInspector; |
| 8 | use Phpdftk\Pdf\Conformance\Profile\ConformanceProfile; |
| 9 | use Phpdftk\Pdf\Conformance\Result\ConformanceViolation; |
| 10 | use Phpdftk\Pdf\Conformance\Result\ViolationSeverity; |
| 11 | |
| 12 | /** |
| 13 | * PDF/A clause 6.6: Encryption is prohibited. |
| 14 | */ |
| 15 | final class EncryptionConstraint implements ConformanceConstraint |
| 16 | { |
| 17 | public function check(DocumentInspector $inspector, ConformanceProfile $profile): array |
| 18 | { |
| 19 | if ($inspector->hasEncryption()) { |
| 20 | return [new ConformanceViolation( |
| 21 | clause: '6.6', |
| 22 | message: 'Encryption is prohibited in ' . $profile->getFamily() . '-' . $profile->getLevel(), |
| 23 | severity: ViolationSeverity::Error, |
| 24 | )]; |
| 25 | } |
| 26 | |
| 27 | return []; |
| 28 | } |
| 29 | } |