Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
11 / 11 |
|
100.00% |
7 / 7 |
CRAP | |
100.00% |
1 / 1 |
| ZugferdProfile | |
100.00% |
11 / 11 |
|
100.00% |
7 / 7 |
7 | |
100.00% |
1 / 1 |
| getFamily | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getLevel | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getPdfVersion | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getXmpNamespace | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getXmpPrefix | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| getXmpProperties | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
1 | |||
| getBaseProfile | |
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 | * ZUGFeRD / Factur-X conformance profiles. |
| 11 | * |
| 12 | * E-invoicing standard built on PDF/A-3 with embedded XML invoice. |
| 13 | * Each level specifies increasing invoice data requirements. |
| 14 | * |
| 15 | * @see https://www.ferd-net.de/ |
| 16 | * @see https://fnfe-mpe.org/factur-x/ |
| 17 | */ |
| 18 | enum ZugferdProfile: string implements ConformanceProfile |
| 19 | { |
| 20 | case MINIMUM = 'MINIMUM'; |
| 21 | case BASIC_WL = 'BASIC WL'; |
| 22 | case BASIC = 'BASIC'; |
| 23 | case EN16931 = 'EN 16931'; |
| 24 | case EXTENDED = 'EXTENDED'; |
| 25 | case XRECHNUNG = 'XRECHNUNG'; |
| 26 | |
| 27 | public function getFamily(): string |
| 28 | { |
| 29 | return 'Factur-X'; |
| 30 | } |
| 31 | |
| 32 | public function getLevel(): string |
| 33 | { |
| 34 | return $this->value; |
| 35 | } |
| 36 | |
| 37 | public function getPdfVersion(): PdfVersion |
| 38 | { |
| 39 | return PdfVersion::V1_7; // PDF/A-3b base |
| 40 | } |
| 41 | |
| 42 | public function getXmpNamespace(): string |
| 43 | { |
| 44 | return 'urn:factur-x:pdfa:CrossIndustryDocument:invoice:1p0#'; |
| 45 | } |
| 46 | |
| 47 | public function getXmpPrefix(): string |
| 48 | { |
| 49 | return 'fx'; |
| 50 | } |
| 51 | |
| 52 | public function getXmpProperties(): array |
| 53 | { |
| 54 | return [ |
| 55 | 'ConformanceLevel' => $this->value, |
| 56 | 'DocumentType' => 'INVOICE', |
| 57 | 'DocumentFileName' => 'factur-x.xml', |
| 58 | ]; |
| 59 | } |
| 60 | |
| 61 | /** The base PDF/A profile required for ZUGFeRD. */ |
| 62 | public function getBaseProfile(): PdfAProfile |
| 63 | { |
| 64 | return PdfAProfile::A3b; |
| 65 | } |
| 66 | } |