1 | <?php |
||
20 | final class DocumentInformation |
||
21 | { |
||
22 | /** |
||
23 | * @var array |
||
24 | */ |
||
25 | private $data = ['Producer' => 'BaconPdf']; |
||
26 | |||
27 | /** |
||
28 | * Sets an entry in the information dictionary. |
||
29 | * |
||
30 | * The CreationData and ModDate values are restricted for internal use, so trying to set them will trigger an |
||
31 | * exception. Setting the "Trapped" value is allowed, but it must be one of the values "True", "False" or "Unknown". |
||
32 | * You can set any key in here, but the following are the standard keys recognized by the PDF standard. Keep in mind |
||
33 | * that the keys are case-sensitive: |
||
34 | * |
||
35 | * Title, Author, Subject, Keywords, Creator, Producer and Trapped. |
||
36 | * |
||
37 | * @param string $key |
||
38 | * @param string $value |
||
39 | * @throws DomainException |
||
40 | */ |
||
41 | public function set($key, $value) |
||
58 | |||
59 | /** |
||
60 | * Removes an entry from the information dictionary. |
||
61 | * |
||
62 | * @param string $key |
||
63 | */ |
||
64 | public function remove($key) |
||
68 | |||
69 | /** |
||
70 | * Checks whether an entry exists in the information dictionary. |
||
71 | * |
||
72 | * @param string $key |
||
73 | * @return bool |
||
74 | */ |
||
75 | public function has($key) |
||
79 | |||
80 | /** |
||
81 | * Retrieves the value for a specific entry in the information dictionary. |
||
82 | * |
||
83 | * You may retrieve any entry from the information dictionary through this method, except for "CreationData" and |
||
84 | * "ModDate". Those two entries have their own respective methods to be retrieved. |
||
85 | * |
||
86 | * @param string $key |
||
87 | * @return string |
||
88 | * @throws DomainException |
||
89 | * @throws OutOfBoundsException |
||
90 | */ |
||
91 | public function get($key) |
||
103 | |||
104 | /** |
||
105 | * @return DateTimeImmutable |
||
106 | */ |
||
107 | public function getCreationDate() |
||
111 | |||
112 | /** |
||
113 | * @return DateTimeImmutable |
||
114 | */ |
||
115 | public function getModificationDate() |
||
119 | |||
120 | /** |
||
121 | * @param string $key |
||
122 | * @return DateTimeImmutable |
||
123 | * @throws OutOfBoundsException |
||
124 | */ |
||
125 | private function retrieveDate($key) |
||
133 | } |
||
134 |