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\Data\ValueObject\Caption; |
15
|
|
|
use PHPExif\Common\Data\ValueObject\Copyright; |
16
|
|
|
use PHPExif\Common\Data\ValueObject\Credit; |
17
|
|
|
use PHPExif\Common\Data\ValueObject\Headline; |
18
|
|
|
use PHPExif\Common\Data\ValueObject\Title; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* Iptc class |
22
|
|
|
* |
23
|
|
|
* Container for IPTC data |
24
|
|
|
* |
25
|
|
|
* @category PHPExif |
26
|
|
|
* @package Common |
27
|
|
|
*/ |
28
|
|
|
class Iptc implements IptcInterface |
29
|
|
|
{ |
30
|
|
|
/** |
31
|
|
|
* @var Caption |
32
|
|
|
*/ |
33
|
|
|
protected $caption; |
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* @var Copyright |
37
|
|
|
*/ |
38
|
|
|
protected $copyright; |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* @var Credit |
42
|
|
|
*/ |
43
|
|
|
protected $credit; |
44
|
|
|
|
45
|
|
|
/** |
46
|
|
|
* @var Headline |
47
|
|
|
*/ |
48
|
|
|
protected $headline; |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* @var Title |
52
|
|
|
*/ |
53
|
|
|
protected $title; |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* Contains the mapping of names to IPTC field numbers |
57
|
|
|
* |
58
|
|
|
* @var array |
59
|
|
|
*/ |
60
|
|
|
public static $iptcMapping = array( |
61
|
|
|
'jobtitle' => '2#085', |
62
|
|
|
'keywords' => '2#025', |
63
|
|
|
'source' => '2#115', |
64
|
|
|
'title' => '2#005', |
65
|
|
|
); |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* {@inheritDoc} |
69
|
|
|
*/ |
70
|
|
|
public function getHeadline() |
71
|
|
|
{ |
72
|
|
|
return $this->headline; |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* {@inheritDoc} |
77
|
|
|
*/ |
78
|
|
|
public function withHeadline(Headline $headline) |
79
|
|
|
{ |
80
|
|
|
$new = clone $this; |
81
|
|
|
$new->headline = $headline; |
82
|
|
|
|
83
|
|
|
return $new; |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* {@inheritDoc} |
88
|
|
|
*/ |
89
|
|
|
public function getCredit() |
90
|
|
|
{ |
91
|
|
|
return $this->credit; |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* {@inheritDoc} |
96
|
|
|
*/ |
97
|
|
|
public function withCredit(Credit $credit) |
98
|
|
|
{ |
99
|
|
|
$new = clone $this; |
100
|
|
|
$new->credit = $credit; |
101
|
|
|
|
102
|
|
|
return $new; |
103
|
|
|
} |
104
|
|
|
|
105
|
|
|
/** |
106
|
|
|
* {@inheritDoc} |
107
|
|
|
*/ |
108
|
|
|
public function getCopyright() |
109
|
|
|
{ |
110
|
|
|
return $this->copyright; |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
/** |
114
|
|
|
* {@inheritDoc} |
115
|
|
|
*/ |
116
|
|
|
public function withCopyright(Copyright $copyright) |
117
|
|
|
{ |
118
|
|
|
$new = clone $this; |
119
|
|
|
$new->copyright = $copyright; |
120
|
|
|
|
121
|
|
|
return $new; |
122
|
|
|
} |
123
|
|
|
|
124
|
|
|
/** |
125
|
|
|
* {@inheritDoc} |
126
|
|
|
*/ |
127
|
|
|
public function getCaption() |
128
|
|
|
{ |
129
|
|
|
return $this->caption; |
130
|
|
|
} |
131
|
|
|
|
132
|
|
|
/** |
133
|
|
|
* {@inheritDoc} |
134
|
|
|
*/ |
135
|
|
|
public function withCaption(Caption $caption) |
136
|
|
|
{ |
137
|
|
|
$new = clone $this; |
138
|
|
|
$new->caption = $caption; |
139
|
|
|
|
140
|
|
|
return $new; |
141
|
|
|
} |
142
|
|
|
|
143
|
|
|
/** |
144
|
|
|
* {@inheritDoc} |
145
|
|
|
*/ |
146
|
|
|
public function getTitle() |
147
|
|
|
{ |
148
|
|
|
return $this->title; |
149
|
|
|
} |
150
|
|
|
|
151
|
|
|
/** |
152
|
|
|
* {@inheritDoc} |
153
|
|
|
*/ |
154
|
|
|
public function withTitle(Title $title) |
155
|
|
|
{ |
156
|
|
|
$new = clone $this; |
157
|
|
|
$new->title = $title; |
158
|
|
|
|
159
|
|
|
return $new; |
160
|
|
|
} |
161
|
|
|
} |
162
|
|
|
|