comparison vendor/zendframework/zend-feed/src/Writer/Entry.php @ 17:129ea1e6d783

Update, including to Drupal core 8.6.10
author Chris Cannam
date Thu, 28 Feb 2019 13:21:36 +0000
parents c2387f117808
children
comparison
equal deleted inserted replaced
16:c2387f117808 17:129ea1e6d783
8 */ 8 */
9 9
10 namespace Zend\Feed\Writer; 10 namespace Zend\Feed\Writer;
11 11
12 use DateTime; 12 use DateTime;
13 use DateTimeInterface;
13 use Zend\Feed\Uri; 14 use Zend\Feed\Uri;
14 15
15 /** 16 /**
16 */ 17 */
17 class Entry 18 class Entry
176 } 177 }
177 178
178 /** 179 /**
179 * Set the feed creation date 180 * Set the feed creation date
180 * 181 *
181 * @param null|int|DateTime $date 182 * @param null|int|DateTimeInterface $date
182 * @throws Exception\InvalidArgumentException 183 * @throws Exception\InvalidArgumentException
183 * @return Entry 184 * @return Entry
184 */ 185 */
185 public function setDateCreated($date = null) 186 public function setDateCreated($date = null)
186 { 187 {
187 if ($date === null) { 188 if ($date === null) {
188 $date = new DateTime(); 189 $date = new DateTime();
189 } elseif (is_int($date)) { 190 }
191 if (is_int($date)) {
190 $date = new DateTime('@' . $date); 192 $date = new DateTime('@' . $date);
191 } elseif (! $date instanceof DateTime) { 193 }
194 if (! $date instanceof DateTimeInterface) {
192 throw new Exception\InvalidArgumentException( 195 throw new Exception\InvalidArgumentException(
193 'Invalid DateTime object or UNIX Timestamp passed as parameter' 196 'Invalid DateTime object or UNIX Timestamp passed as parameter'
194 ); 197 );
195 } 198 }
196 $this->data['dateCreated'] = $date; 199 $this->data['dateCreated'] = $date;
199 } 202 }
200 203
201 /** 204 /**
202 * Set the feed modification date 205 * Set the feed modification date
203 * 206 *
204 * @param null|int|DateTime $date 207 * @param null|int|DateTimeInterface $date
205 * @throws Exception\InvalidArgumentException 208 * @throws Exception\InvalidArgumentException
206 * @return Entry 209 * @return Entry
207 */ 210 */
208 public function setDateModified($date = null) 211 public function setDateModified($date = null)
209 { 212 {
210 if ($date === null) { 213 if ($date === null) {
211 $date = new DateTime(); 214 $date = new DateTime();
212 } elseif (is_int($date)) { 215 }
216 if (is_int($date)) {
213 $date = new DateTime('@' . $date); 217 $date = new DateTime('@' . $date);
214 } elseif (! $date instanceof DateTime) { 218 }
219 if (! $date instanceof DateTimeInterface) {
215 throw new Exception\InvalidArgumentException( 220 throw new Exception\InvalidArgumentException(
216 'Invalid DateTime object or UNIX Timestamp passed as parameter' 221 'Invalid DateTime object or UNIX Timestamp passed as parameter'
217 ); 222 );
218 } 223 }
219 $this->data['dateModified'] = $date; 224 $this->data['dateModified'] = $date;