Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
11 / 11 |
|
100.00% |
7 / 7 |
CRAP | |
100.00% |
1 / 1 |
| PdfUaProfile | |
100.00% |
11 / 11 |
|
100.00% |
7 / 7 |
11 | |
100.00% |
1 / 1 |
| getFamily | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getLevel | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getPart | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
3 | |||
| getPdfVersion | |
100.00% |
3 / 3 |
|
100.00% |
1 / 1 |
3 | |||
| getXmpNamespace | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getXmpPrefix | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getXmpProperties | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Phpdftk\Pdf\Conformance\Profile; |
| 6 | |
| 7 | use Phpdftk\Pdf\Core\PdfVersion; |
| 8 | |
| 9 | /** |
| 10 | * PDF/UA conformance profiles (ISO 14289). |
| 11 | * |
| 12 | * PDF/UA-1 (ISO 14289-1): based on PDF 1.7 |
| 13 | * PDF/UA-2 (ISO 14289-2:2024): based on PDF 2.0 |
| 14 | */ |
| 15 | enum PdfUaProfile: string implements ConformanceProfile |
| 16 | { |
| 17 | case UA1 = 'UA-1'; |
| 18 | case UA2 = 'UA-2'; |
| 19 | |
| 20 | public function getFamily(): string |
| 21 | { |
| 22 | return 'PDF/UA'; |
| 23 | } |
| 24 | |
| 25 | public function getLevel(): string |
| 26 | { |
| 27 | return $this->value; |
| 28 | } |
| 29 | |
| 30 | /** ISO 14289 part number (1 or 2). */ |
| 31 | public function getPart(): int |
| 32 | { |
| 33 | return match ($this) { |
| 34 | self::UA1 => 1, |
| 35 | self::UA2 => 2, |
| 36 | }; |
| 37 | } |
| 38 | |
| 39 | public function getPdfVersion(): PdfVersion |
| 40 | { |
| 41 | return match ($this) { |
| 42 | self::UA1 => PdfVersion::V1_7, |
| 43 | self::UA2 => PdfVersion::V2_0, |
| 44 | }; |
| 45 | } |
| 46 | |
| 47 | public function getXmpNamespace(): string |
| 48 | { |
| 49 | return 'http://www.aiim.org/pdfua/ns/id/'; |
| 50 | } |
| 51 | |
| 52 | public function getXmpPrefix(): string |
| 53 | { |
| 54 | return 'pdfuaid'; |
| 55 | } |
| 56 | |
| 57 | public function getXmpProperties(): array |
| 58 | { |
| 59 | return ['part' => (string) $this->getPart()]; |
| 60 | } |
| 61 | } |