1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Iptc: A container class for IPTC data |
4
|
|
|
* |
5
|
|
|
* @link http://github.com/PHPExif/php-exif-common for the canonical source repository |
6
|
|
|
* @copyright Copyright (c) 2016 Tom Van Herreweghe <[email protected]> |
7
|
|
|
* @license http://github.com/PHPExif/php-exif-common/blob/master/LICENSE MIT License |
8
|
|
|
* @category PHPExif |
9
|
|
|
* @package Common |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace PHPExif\Common\Data; |
13
|
|
|
|
14
|
|
|
use PHPExif\Common\Collection\Collection; |
15
|
|
|
use PHPExif\Common\Data\ValueObject\Caption; |
16
|
|
|
use PHPExif\Common\Data\ValueObject\Copyright; |
17
|
|
|
use PHPExif\Common\Data\ValueObject\Credit; |
18
|
|
|
use PHPExif\Common\Data\ValueObject\Headline; |
19
|
|
|
use PHPExif\Common\Data\ValueObject\Jobtitle; |
20
|
|
|
use PHPExif\Common\Data\ValueObject\Title; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* Iptc class |
24
|
|
|
* |
25
|
|
|
* Container for IPTC data |
26
|
|
|
* |
27
|
|
|
* @category PHPExif |
28
|
|
|
* @package Common |
29
|
|
|
*/ |
30
|
|
|
class Iptc implements IptcInterface |
31
|
|
|
{ |
32
|
|
|
/** |
33
|
|
|
* @var Caption |
34
|
|
|
*/ |
35
|
|
|
protected $caption; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @var Copyright |
39
|
|
|
*/ |
40
|
|
|
protected $copyright; |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @var Credit |
44
|
|
|
*/ |
45
|
|
|
protected $credit; |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* @var Headline |
49
|
|
|
*/ |
50
|
|
|
protected $headline; |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @var Jobtitle |
54
|
|
|
*/ |
55
|
|
|
protected $jobtitle; |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* @var Title |
59
|
|
|
*/ |
60
|
|
|
protected $title; |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* @var Collection |
64
|
|
|
*/ |
65
|
|
|
protected $keywords; |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* Contains the mapping of names to IPTC field numbers |
69
|
|
|
* |
70
|
|
|
* @var array |
71
|
|
|
*/ |
72
|
|
|
public static $iptcMapping = array( |
73
|
|
|
'jobtitle' => '2#085', |
74
|
|
|
'source' => '2#115', |
75
|
|
|
); |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* {@inheritDoc} |
79
|
|
|
*/ |
80
|
|
|
public function getHeadline() |
81
|
|
|
{ |
82
|
|
|
return $this->headline; |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* {@inheritDoc} |
87
|
|
|
*/ |
88
|
|
|
public function withHeadline(Headline $headline) |
89
|
|
|
{ |
90
|
|
|
$new = clone $this; |
91
|
|
|
$new->headline = $headline; |
92
|
|
|
|
93
|
|
|
return $new; |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* {@inheritDoc} |
98
|
|
|
*/ |
99
|
|
|
public function getCredit() |
100
|
|
|
{ |
101
|
|
|
return $this->credit; |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* {@inheritDoc} |
106
|
|
|
*/ |
107
|
|
|
public function withCredit(Credit $credit) |
108
|
|
|
{ |
109
|
|
|
$new = clone $this; |
110
|
|
|
$new->credit = $credit; |
111
|
|
|
|
112
|
|
|
return $new; |
113
|
|
|
} |
114
|
|
|
|
115
|
|
|
/** |
116
|
|
|
* {@inheritDoc} |
117
|
|
|
*/ |
118
|
|
|
public function getCopyright() |
119
|
|
|
{ |
120
|
|
|
return $this->copyright; |
121
|
|
|
} |
122
|
|
|
|
123
|
|
|
/** |
124
|
|
|
* {@inheritDoc} |
125
|
|
|
*/ |
126
|
|
|
public function withCopyright(Copyright $copyright) |
127
|
|
|
{ |
128
|
|
|
$new = clone $this; |
129
|
|
|
$new->copyright = $copyright; |
130
|
|
|
|
131
|
|
|
return $new; |
132
|
|
|
} |
133
|
|
|
|
134
|
|
|
/** |
135
|
|
|
* {@inheritDoc} |
136
|
|
|
*/ |
137
|
|
|
public function getCaption() |
138
|
|
|
{ |
139
|
|
|
return $this->caption; |
140
|
|
|
} |
141
|
|
|
|
142
|
|
|
/** |
143
|
|
|
* {@inheritDoc} |
144
|
|
|
*/ |
145
|
|
|
public function withCaption(Caption $caption) |
146
|
|
|
{ |
147
|
|
|
$new = clone $this; |
148
|
|
|
$new->caption = $caption; |
149
|
|
|
|
150
|
|
|
return $new; |
151
|
|
|
} |
152
|
|
|
|
153
|
|
|
/** |
154
|
|
|
* {@inheritDoc} |
155
|
|
|
*/ |
156
|
|
|
public function getTitle() |
157
|
|
|
{ |
158
|
|
|
return $this->title; |
159
|
|
|
} |
160
|
|
|
|
161
|
|
|
/** |
162
|
|
|
* {@inheritDoc} |
163
|
|
|
*/ |
164
|
|
|
public function withTitle(Title $title) |
165
|
|
|
{ |
166
|
|
|
$new = clone $this; |
167
|
|
|
$new->title = $title; |
168
|
|
|
|
169
|
|
|
return $new; |
170
|
|
|
} |
171
|
|
|
|
172
|
|
|
/** |
173
|
|
|
* {@inheritDoc} |
174
|
|
|
*/ |
175
|
|
|
public function getKeywords() |
176
|
|
|
{ |
177
|
|
|
return $this->keywords; |
178
|
|
|
} |
179
|
|
|
|
180
|
|
|
/** |
181
|
|
|
* {@inheritDoc} |
182
|
|
|
*/ |
183
|
|
|
public function withKeywords(Collection $keywords) |
184
|
|
|
{ |
185
|
|
|
$new = clone $this; |
186
|
|
|
$new->keywords = $keywords; |
187
|
|
|
|
188
|
|
|
return $new; |
189
|
|
|
} |
190
|
|
|
|
191
|
|
|
/** |
192
|
|
|
* {@inheritDoc} |
193
|
|
|
*/ |
194
|
|
|
public function getJobtitle() |
195
|
|
|
{ |
196
|
|
|
return $this->jobtitle; |
197
|
|
|
} |
198
|
|
|
|
199
|
|
|
/** |
200
|
|
|
* {@inheritDoc} |
201
|
|
|
*/ |
202
|
|
|
public function withJobtitle(Jobtitle $jobtitle) |
203
|
|
|
{ |
204
|
|
|
$new = clone $this; |
205
|
|
|
$new->jobtitle = $jobtitle; |
206
|
|
|
|
207
|
|
|
return $new; |
208
|
|
|
} |
209
|
|
|
} |
210
|
|
|
|