]> git.immae.eu Git - github/wallabag/wallabag.git/blame - src/Wallabag/CoreBundle/Entity/Entry.php
Use two indexes instead of one for hashed urls
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Entity / Entry.php
CommitLineData
9d50517c
NL
1<?php
2
ad4d1caa 3namespace Wallabag\CoreBundle\Entity;
9d50517c 4
0a018fe0 5use Doctrine\Common\Collections\ArrayCollection;
9d50517c 6use Doctrine\ORM\Mapping as ORM;
0f006880 7use Hateoas\Configuration\Annotation as Hateoas;
7d1fdab2 8use JMS\Serializer\Annotation\Exclude;
f808b016 9use JMS\Serializer\Annotation\Groups;
7d1fdab2 10use JMS\Serializer\Annotation\SerializedName;
f808b016
JB
11use JMS\Serializer\Annotation\VirtualProperty;
12use JMS\Serializer\Annotation\XmlRoot;
619cc453 13use Symfony\Component\Validator\Constraints as Assert;
4dc87223 14use Wallabag\AnnotationBundle\Entity\Annotation;
927c9e79 15use Wallabag\CoreBundle\Helper\EntityTimestampsTrait;
4a551637 16use Wallabag\CoreBundle\Helper\UrlHasher;
f808b016 17use Wallabag\UserBundle\Entity\User;
9d50517c
NL
18
19/**
4346a860 20 * Entry.
9d50517c 21 *
0f006880 22 * @XmlRoot("entry")
be463487 23 * @ORM\Entity(repositoryClass="Wallabag\CoreBundle\Repository\EntryRepository")
7e9c1d65
JB
24 * @ORM\Table(
25 * name="`entry`",
26 * options={"collate"="utf8mb4_unicode_ci", "charset"="utf8mb4"},
81375151
NL
27 * indexes={
28 * @ORM\Index(name="created_at", columns={"created_at"}),
bfe02a0b 29 * @ORM\Index(name="uid", columns={"uid"}),
70df4c33
JB
30 * @ORM\Index(name="hashed_url_user_id", columns={"user_id", "hashed_url"}, options={"lengths"={null, 40}}),
31 * @ORM\Index(name="hashed_given_url_user_id", columns={"user_id", "hashed_given_url"}, options={"lengths"={null, 40}})
f3bfb875 32 * }
7e9c1d65 33 * )
34d15eb4 34 * @ORM\HasLifecycleCallbacks()
0f006880 35 * @Hateoas\Relation("self", href = "expr('/api/entries/' ~ object.getId())")
9d50517c 36 */
be463487 37class Entry
9d50517c 38{
927c9e79
JB
39 use EntityTimestampsTrait;
40
0f006880 41 /** @Serializer\XmlAttribute */
9d50517c 42 /**
4346a860 43 * @var int
9d50517c 44 *
be463487 45 * @ORM\Column(name="id", type="integer")
9d50517c 46 * @ORM\Id
34d15eb4 47 * @ORM\GeneratedValue(strategy="AUTO")
5b7da076
TC
48 *
49 * @Groups({"entries_for_user", "export_all"})
9d50517c 50 */
be463487 51 private $id;
9d50517c 52
f3d0cb91 53 /**
78b3c31d 54 * @var string
f3d0cb91 55 *
7239082a 56 * @ORM\Column(name="uid", type="string", length=23, nullable=true)
f3d0cb91
NL
57 *
58 * @Groups({"entries_for_user", "export_all"})
59 */
7239082a 60 private $uid;
f3d0cb91 61
9d50517c
NL
62 /**
63 * @var string
64 *
65 * @ORM\Column(name="title", type="text", nullable=true)
5b7da076
TC
66 *
67 * @Groups({"entries_for_user", "export_all"})
9d50517c
NL
68 */
69 private $title;
70
b7fa51ae 71 /**
f3bfb875
JB
72 * Define the url fetched by wallabag (the final url after potential redirections).
73 *
b7fa51ae
NL
74 * @var string
75 *
f3bfb875
JB
76 * @Assert\NotBlank()
77 * @ORM\Column(name="url", type="text", nullable=true)
b7fa51ae
NL
78 *
79 * @Groups({"entries_for_user", "export_all"})
80 */
f3bfb875 81 private $url;
b7fa51ae 82
9d50517c
NL
83 /**
84 * @var string
85 *
f3bfb875
JB
86 * @ORM\Column(name="hashed_url", type="string", length=40, nullable=true)
87 */
88 private $hashedUrl;
89
90 /**
91 * From where user retrieved/found the url (an other article, a twitter, or the given_url if non are provided).
92 *
93 * @var string
94 *
95 * @ORM\Column(name="origin_url", type="text", nullable=true)
5b7da076
TC
96 *
97 * @Groups({"entries_for_user", "export_all"})
9d50517c 98 */
f3bfb875 99 private $originUrl;
9d50517c 100
bfe02a0b 101 /**
f3bfb875
JB
102 * Define the url entered by the user (without redirections).
103 *
bfe02a0b
TC
104 * @var string
105 *
f3bfb875
JB
106 * @ORM\Column(name="given_url", type="text", nullable=true)
107 *
108 * @Groups({"entries_for_user", "export_all"})
bfe02a0b 109 */
f3bfb875
JB
110 private $givenUrl;
111
112 /**
113 * @var string
114 *
115 * @ORM\Column(name="hashed_given_url", type="string", length=40, nullable=true)
116 */
117 private $hashedGivenUrl;
bfe02a0b 118
9d50517c 119 /**
4346a860 120 * @var bool
9d50517c 121 *
189ef634
TC
122 * @Exclude
123 *
be463487 124 * @ORM\Column(name="is_archived", type="boolean")
5b7da076
TC
125 *
126 * @Groups({"entries_for_user", "export_all"})
9d50517c 127 */
905ae369 128 private $isArchived = false;
9d50517c 129
7975395d
SV
130 /**
131 * @var \DateTime
132 *
133 * @ORM\Column(name="archived_at", type="datetime", nullable=true)
134 *
135 * @Groups({"entries_for_user", "export_all"})
136 */
137 private $archivedAt = null;
138
9d50517c 139 /**
4346a860 140 * @var bool
9d50517c 141 *
189ef634
TC
142 * @Exclude
143 *
be463487 144 * @ORM\Column(name="is_starred", type="boolean")
5b7da076
TC
145 *
146 * @Groups({"entries_for_user", "export_all"})
9d50517c 147 */
905ae369 148 private $isStarred = false;
9d50517c 149
9d50517c
NL
150 /**
151 * @var string
152 *
eacaf7f8 153 * @ORM\Column(name="content", type="text", nullable=true)
5b7da076
TC
154 *
155 * @Groups({"entries_for_user", "export_all"})
9d50517c 156 */
eacaf7f8 157 private $content;
9d50517c 158
34d15eb4 159 /**
8664069e 160 * @var \DateTime
34d15eb4 161 *
be463487 162 * @ORM\Column(name="created_at", type="datetime")
5b7da076 163 *
9401696f 164 * @Groups({"entries_for_user", "export_all"})
34d15eb4
NL
165 */
166 private $createdAt;
167
168 /**
8664069e 169 * @var \DateTime
34d15eb4 170 *
be463487 171 * @ORM\Column(name="updated_at", type="datetime")
5b7da076 172 *
9401696f 173 * @Groups({"entries_for_user", "export_all"})
34d15eb4
NL
174 */
175 private $updatedAt;
176
5e9009ce
NL
177 /**
178 * @var \DateTime
179 *
180 * @ORM\Column(name="published_at", type="datetime", nullable=true)
181 *
182 * @Groups({"entries_for_user", "export_all"})
183 */
184 private $publishedAt;
185
7b0b3622
NL
186 /**
187 * @var array
188 *
1517d577 189 * @ORM\Column(name="published_by", type="array", nullable=true)
7b0b3622
NL
190 *
191 * @Groups({"entries_for_user", "export_all"})
192 */
193 private $publishedBy;
194
a991c46e
F
195 /**
196 * @var \DateTime
197 *
198 * @ORM\Column(name="starred_at", type="datetime", nullable=true)
199 *
200 * @Groups({"entries_for_user", "export_all"})
201 */
202 private $starredAt = null;
203
34d15eb4 204 /**
4dc87223 205 * @ORM\OneToMany(targetEntity="Wallabag\AnnotationBundle\Entity\Annotation", mappedBy="entry", cascade={"persist", "remove"})
f38e03dc 206 * @ORM\JoinTable
5b7da076 207 *
f38e03dc 208 * @Groups({"entries_for_user", "export_all"})
34d15eb4 209 */
4dc87223 210 private $annotations;
34d15eb4
NL
211
212 /**
213 * @var string
214 *
215 * @ORM\Column(name="mimetype", type="text", nullable=true)
5b7da076
TC
216 *
217 * @Groups({"entries_for_user", "export_all"})
34d15eb4
NL
218 */
219 private $mimetype;
220
98f0929f
JB
221 /**
222 * @var string
223 *
224 * @ORM\Column(name="language", type="text", nullable=true)
5b7da076
TC
225 *
226 * @Groups({"entries_for_user", "export_all"})
98f0929f
JB
227 */
228 private $language;
229
34d15eb4 230 /**
4346a860 231 * @var int
34d15eb4 232 *
88bac4a3 233 * @ORM\Column(name="reading_time", type="integer", nullable=false)
5b7da076
TC
234 *
235 * @Groups({"entries_for_user", "export_all"})
34d15eb4 236 */
88bac4a3 237 private $readingTime = 0;
34d15eb4
NL
238
239 /**
240 * @var string
241 *
242 * @ORM\Column(name="domain_name", type="text", nullable=true)
5b7da076
TC
243 *
244 * @Groups({"entries_for_user", "export_all"})
34d15eb4
NL
245 */
246 private $domainName;
247
fad31615
JB
248 /**
249 * @var string
250 *
251 * @ORM\Column(name="preview_picture", type="text", nullable=true)
5b7da076
TC
252 *
253 * @Groups({"entries_for_user", "export_all"})
fad31615
JB
254 */
255 private $previewPicture;
256
10b35097 257 /**
e10e6ab3 258 * @var string
10b35097 259 *
3ef75cc4 260 * @ORM\Column(name="http_status", type="string", length=3, nullable=true)
10b35097
NL
261 *
262 * @Groups({"entries_for_user", "export_all"})
263 */
264 private $httpStatus;
265
dda6a6ad
NL
266 /**
267 * @var array
268 *
1517d577 269 * @ORM\Column(name="headers", type="array", nullable=true)
dda6a6ad
NL
270 *
271 * @Groups({"entries_for_user", "export_all"})
272 */
273 private $headers;
274
5f09650e 275 /**
7d1fdab2
TC
276 * @Exclude
277 *
1210dae1 278 * @ORM\ManyToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="entries")
5b7da076
TC
279 *
280 * @Groups({"export_all"})
5f09650e
NL
281 */
282 private $user;
283
0a018fe0 284 /**
af95c09c 285 * @ORM\ManyToMany(targetEntity="Tag", inversedBy="entries", cascade={"persist"})
e42b13bc
JB
286 * @ORM\JoinTable(
287 * name="entry_tag",
288 * joinColumns={
206bade5 289 * @ORM\JoinColumn(name="entry_id", referencedColumnName="id", onDelete="cascade")
e42b13bc
JB
290 * },
291 * inverseJoinColumns={
206bade5 292 * @ORM\JoinColumn(name="tag_id", referencedColumnName="id", onDelete="cascade")
e42b13bc
JB
293 * }
294 * )
0a018fe0
NL
295 */
296 private $tags;
297
5f09650e
NL
298 /*
299 * @param User $user
300 */
5d6f6f56 301 public function __construct(User $user)
5f09650e
NL
302 {
303 $this->user = $user;
0a018fe0 304 $this->tags = new ArrayCollection();
5f09650e
NL
305 }
306
9d50517c 307 /**
4346a860 308 * Get id.
9d50517c 309 *
4346a860 310 * @return int
9d50517c
NL
311 */
312 public function getId()
313 {
314 return $this->id;
315 }
316
317 /**
4346a860
JB
318 * Set title.
319 *
320 * @param string $title
9d50517c 321 *
be463487 322 * @return Entry
9d50517c
NL
323 */
324 public function setTitle($title)
325 {
326 $this->title = $title;
327
328 return $this;
329 }
330
331 /**
4346a860 332 * Get title.
9d50517c 333 *
7df80cb3 334 * @return string
9d50517c
NL
335 */
336 public function getTitle()
337 {
338 return $this->title;
339 }
340
341 /**
4346a860
JB
342 * Set url.
343 *
344 * @param string $url
9d50517c 345 *
be463487 346 * @return Entry
9d50517c
NL
347 */
348 public function setUrl($url)
349 {
350 $this->url = $url;
4a551637 351 $this->hashedUrl = UrlHasher::hashUrl($url);
9d50517c
NL
352
353 return $this;
354 }
355
356 /**
4346a860 357 * Get url.
9d50517c 358 *
7df80cb3 359 * @return string
9d50517c
NL
360 */
361 public function getUrl()
362 {
363 return $this->url;
364 }
365
366 /**
4346a860
JB
367 * Set isArchived.
368 *
8eedc8cf 369 * @param bool $isArchived
9d50517c 370 *
be463487 371 * @return Entry
9d50517c 372 */
905ae369 373 public function setArchived($isArchived)
9d50517c 374 {
905ae369 375 $this->isArchived = $isArchived;
9d50517c
NL
376
377 return $this;
378 }
379
7975395d
SV
380 /**
381 * update isArchived and archive_at fields.
382 *
383 * @param bool $isArchived
384 *
385 * @return Entry
386 */
387 public function updateArchived($isArchived = false)
388 {
389 $this->setArchived($isArchived);
390 $this->setArchivedAt(null);
391 if ($this->isArchived()) {
392 $this->setArchivedAt(new \DateTime());
393 }
394
395 return $this;
396 }
397
398 /**
399 * @return \DateTime|null
400 */
401 public function getArchivedAt()
402 {
403 return $this->archivedAt;
404 }
405
406 /**
407 * @param \DateTime|null $archivedAt
408 *
409 * @return Entry
410 */
411 public function setArchivedAt($archivedAt = null)
412 {
413 $this->archivedAt = $archivedAt;
414
415 return $this;
416 }
417
9d50517c 418 /**
4346a860 419 * Get isArchived.
9d50517c 420 *
8eedc8cf 421 * @return bool
9d50517c 422 */
905ae369 423 public function isArchived()
9d50517c 424 {
905ae369 425 return $this->isArchived;
9d50517c
NL
426 }
427
189ef634
TC
428 /**
429 * @VirtualProperty
430 * @SerializedName("is_archived")
431 * @Groups({"entries_for_user", "export_all"})
432 */
433 public function is_Archived()
434 {
435 return (int) $this->isArchived();
436 }
437
163eae0b
NL
438 public function toggleArchive()
439 {
7975395d 440 $this->updateArchived($this->isArchived() ^ 1);
7df80cb3 441
163eae0b
NL
442 return $this;
443 }
444
9d50517c 445 /**
4346a860
JB
446 * Set isStarred.
447 *
8eedc8cf 448 * @param bool $isStarred
9d50517c 449 *
be463487 450 * @return Entry
9d50517c 451 */
905ae369 452 public function setStarred($isStarred)
9d50517c 453 {
905ae369 454 $this->isStarred = $isStarred;
9d50517c
NL
455
456 return $this;
457 }
458
459 /**
4346a860 460 * Get isStarred.
9d50517c 461 *
8eedc8cf 462 * @return bool
9d50517c 463 */
905ae369 464 public function isStarred()
9d50517c 465 {
905ae369 466 return $this->isStarred;
9d50517c
NL
467 }
468
189ef634
TC
469 /**
470 * @VirtualProperty
471 * @SerializedName("is_starred")
472 * @Groups({"entries_for_user", "export_all"})
473 */
474 public function is_Starred()
475 {
476 return (int) $this->isStarred();
477 }
478
163eae0b
NL
479 public function toggleStar()
480 {
905ae369 481 $this->isStarred = $this->isStarred() ^ 1;
163eae0b
NL
482
483 return $this;
484 }
485
9d50517c 486 /**
4346a860
JB
487 * Set content.
488 *
489 * @param string $content
9d50517c 490 *
be463487 491 * @return Entry
9d50517c
NL
492 */
493 public function setContent($content)
494 {
495 $this->content = $content;
496
497 return $this;
498 }
499
500 /**
4346a860 501 * Get content.
9d50517c 502 *
7df80cb3 503 * @return string
9d50517c
NL
504 */
505 public function getContent()
506 {
507 return $this->content;
508 }
509
510 /**
5f09650e 511 * @return User
9d50517c 512 */
5f09650e 513 public function getUser()
9d50517c 514 {
5f09650e 515 return $this->user;
9d50517c 516 }
42a90646 517
7d1fdab2
TC
518 /**
519 * @VirtualProperty
520 * @SerializedName("user_name")
521 */
522 public function getUserName()
523 {
524 return $this->user->getUserName();
525 }
526
527 /**
528 * @VirtualProperty
529 * @SerializedName("user_email")
530 */
531 public function getUserEmail()
532 {
533 return $this->user->getEmail();
534 }
535
536 /**
537 * @VirtualProperty
538 * @SerializedName("user_id")
539 */
540 public function getUserId()
541 {
542 return $this->user->getId();
543 }
544
34d15eb4 545 /**
6d65c0a8
JB
546 * Set created_at.
547 * Only used when importing data from an other service.
548 *
8664069e 549 * @param \DateTime $createdAt
6d65c0a8
JB
550 *
551 * @return Entry
552 */
553 public function setCreatedAt(\DateTime $createdAt)
554 {
555 $this->createdAt = $createdAt;
556
557 return $this;
558 }
559
560 /**
8664069e 561 * @return \DateTime
34d15eb4
NL
562 */
563 public function getCreatedAt()
564 {
565 return $this->createdAt;
566 }
567
34d15eb4 568 /**
8664069e 569 * @return \DateTime
34d15eb4
NL
570 */
571 public function getUpdatedAt()
572 {
573 return $this->updatedAt;
574 }
575
a991c46e
F
576 /**
577 * @return \DateTime|null
578 */
579 public function getStarredAt()
580 {
581 return $this->starredAt;
582 }
583
584 /**
585 * @param \DateTime|null $starredAt
586 *
587 * @return Entry
588 */
589 public function setStarredAt($starredAt = null)
590 {
591 $this->starredAt = $starredAt;
592
593 return $this;
594 }
595
596 /**
597 * update isStarred and starred_at fields.
598 *
599 * @param bool $isStarred
600 *
601 * @return Entry
602 */
603 public function updateStar($isStarred = false)
604 {
605 $this->setStarred($isStarred);
606 $this->setStarredAt(null);
607 if ($this->isStarred()) {
608 $this->setStarredAt(new \DateTime());
609 }
610
611 return $this;
612 }
613
34d15eb4 614 /**
4dc87223 615 * @return ArrayCollection<Annotation>
34d15eb4 616 */
4dc87223 617 public function getAnnotations()
34d15eb4 618 {
4dc87223 619 return $this->annotations;
34d15eb4
NL
620 }
621
622 /**
4dc87223 623 * @param Annotation $annotation
34d15eb4 624 */
4dc87223 625 public function setAnnotation(Annotation $annotation)
34d15eb4 626 {
4dc87223 627 $this->annotations[] = $annotation;
34d15eb4
NL
628 }
629
630 /**
631 * @return string
632 */
633 public function getMimetype()
634 {
635 return $this->mimetype;
636 }
637
638 /**
639 * @param string $mimetype
640 */
641 public function setMimetype($mimetype)
642 {
643 $this->mimetype = $mimetype;
644 }
645
646 /**
647 * @return int
648 */
649 public function getReadingTime()
650 {
651 return $this->readingTime;
652 }
653
654 /**
655 * @param int $readingTime
656 */
657 public function setReadingTime($readingTime)
658 {
659 $this->readingTime = $readingTime;
660 }
661
662 /**
663 * @return string
664 */
665 public function getDomainName()
666 {
667 return $this->domainName;
668 }
669
670 /**
671 * @param string $domainName
672 */
673 public function setDomainName($domainName)
674 {
675 $this->domainName = $domainName;
676 }
677
0a018fe0 678 /**
4ec53ab7 679 * @return ArrayCollection
0a018fe0
NL
680 */
681 public function getTags()
682 {
683 return $this->tags;
684 }
685
b0458874
JB
686 /**
687 * @VirtualProperty
688 * @SerializedName("tags")
689 * @Groups({"entries_for_user", "export_all"})
690 */
691 public function getSerializedTags()
692 {
693 $data = [];
694 foreach ($this->tags as $tag) {
695 $data[] = $tag->getLabel();
696 }
697
698 return $data;
699 }
700
0a018fe0
NL
701 /**
702 * @param Tag $tag
703 */
704 public function addTag(Tag $tag)
705 {
625acf33
KG
706 if ($this->tags->contains($tag)) {
707 return;
708 }
709
fc031e57
JB
710 // check if tag already exist but has not yet be persisted
711 // it seems that the previous condition with `contains()` doesn't check that case
712 foreach ($this->tags as $existingTag) {
fc732227 713 if ($existingTag->getLabel() === $tag->getLabel()) {
fc031e57
JB
714 return;
715 }
716 }
717
e42b13bc 718 $this->tags->add($tag);
46bbd8d3 719 $tag->addEntry($this);
0a018fe0 720 }
092ca707 721
a05b6115
JB
722 /**
723 * Remove the given tag from the entry (if the tag is associated).
724 *
725 * @param Tag $tag
726 */
092ca707
NL
727 public function removeTag(Tag $tag)
728 {
e42b13bc
JB
729 if (!$this->tags->contains($tag)) {
730 return;
731 }
732
092ca707 733 $this->tags->removeElement($tag);
e42b13bc 734 $tag->removeEntry($this);
092ca707 735 }
fad31615 736
a05b6115
JB
737 /**
738 * Remove all assigned tags from the entry.
739 */
740 public function removeAllTags()
741 {
742 foreach ($this->tags as $tag) {
743 $this->tags->removeElement($tag);
744 $tag->removeEntry($this);
745 }
746 }
747
fad31615 748 /**
a1413a3d 749 * Set previewPicture.
fad31615
JB
750 *
751 * @param string $previewPicture
752 *
753 * @return Entry
754 */
755 public function setPreviewPicture($previewPicture)
756 {
757 $this->previewPicture = $previewPicture;
758
759 return $this;
760 }
761
762 /**
a1413a3d 763 * Get previewPicture.
fad31615
JB
764 *
765 * @return string
766 */
767 public function getPreviewPicture()
768 {
769 return $this->previewPicture;
770 }
98f0929f
JB
771
772 /**
773 * Set language.
774 *
775 * @param string $language
776 *
777 * @return Entry
778 */
779 public function setLanguage($language)
780 {
781 $this->language = $language;
782
783 return $this;
784 }
785
786 /**
787 * Get language.
788 *
789 * @return string
790 */
791 public function getLanguage()
792 {
793 return $this->language;
794 }
f3d0cb91
NL
795
796 /**
78b3c31d 797 * @return string
f3d0cb91 798 */
7239082a 799 public function getUid()
f3d0cb91 800 {
7239082a 801 return $this->uid;
f3d0cb91
NL
802 }
803
804 /**
7239082a 805 * @param string $uid
f3d0cb91
NL
806 *
807 * @return Entry
808 */
7239082a 809 public function setUid($uid)
f3d0cb91 810 {
7239082a 811 $this->uid = $uid;
f3d0cb91
NL
812
813 return $this;
814 }
815
7239082a 816 public function generateUid()
f3d0cb91 817 {
7239082a 818 if (null === $this->uid) {
a7e2218e 819 // @see http://blog.kevingomez.fr/til/2015/07/26/why-is-uniqid-slow/ for true parameter
7239082a 820 $this->uid = uniqid('', true);
f3d0cb91
NL
821 }
822 }
f1be7af4 823
7239082a 824 public function cleanUid()
f1be7af4 825 {
7239082a 826 $this->uid = null;
f1be7af4 827 }
10b35097 828
e8911f7c
JB
829 /**
830 * Used in the entries filter so it's more explicit for the end user than the uid.
a9c6577f 831 * Also used in the API.
e8911f7c 832 *
1112e547
JB
833 * @VirtualProperty
834 * @SerializedName("is_public")
835 * @Groups({"entries_for_user"})
836 *
e8911f7c
JB
837 * @return bool
838 */
839 public function isPublic()
840 {
841 return null !== $this->uid;
842 }
843
10b35097 844 /**
5fe65bae 845 * @return string
10b35097
NL
846 */
847 public function getHttpStatus()
848 {
849 return $this->httpStatus;
850 }
851
852 /**
5fe65bae 853 * @param string $httpStatus
10b35097
NL
854 *
855 * @return Entry
856 */
857 public function setHttpStatus($httpStatus)
858 {
859 $this->httpStatus = $httpStatus;
860
861 return $this;
862 }
5e9009ce
NL
863
864 /**
865 * @return \Datetime
866 */
867 public function getPublishedAt()
868 {
869 return $this->publishedAt;
870 }
871
872 /**
873 * @param \Datetime $publishedAt
874 *
875 * @return Entry
876 */
877 public function setPublishedAt(\Datetime $publishedAt)
878 {
879 $this->publishedAt = $publishedAt;
880
881 return $this;
882 }
7b0b3622
NL
883
884 /**
dda6a6ad 885 * @return array
7b0b3622
NL
886 */
887 public function getPublishedBy()
888 {
889 return $this->publishedBy;
890 }
891
892 /**
1517d577 893 * @param array $publishedBy
7b0b3622
NL
894 *
895 * @return Entry
896 */
897 public function setPublishedBy($publishedBy)
898 {
899 $this->publishedBy = $publishedBy;
900
901 return $this;
902 }
dda6a6ad
NL
903
904 /**
905 * @return array
906 */
907 public function getHeaders()
908 {
909 return $this->headers;
910 }
911
912 /**
1517d577 913 * @param array $headers
dda6a6ad
NL
914 *
915 * @return Entry
916 */
917 public function setHeaders($headers)
918 {
919 $this->headers = $headers;
920
921 return $this;
922 }
eae8138b 923
e0ef1a1c
KD
924 /**
925 * Set origin url.
926 *
927 * @param string $originUrl
928 *
929 * @return Entry
930 */
931 public function setOriginUrl($originUrl)
932 {
933 $this->originUrl = $originUrl;
934
935 return $this;
936 }
eae8138b 937
e0ef1a1c
KD
938 /**
939 * Get origin url.
940 *
941 * @return string
942 */
943 public function getOriginUrl()
944 {
945 return $this->originUrl;
946 }
bfe02a0b 947
f3bfb875
JB
948 /**
949 * Set origin url.
950 *
951 * @param string $givenUrl
952 *
953 * @return Entry
954 */
955 public function setGivenUrl($givenUrl)
956 {
957 $this->givenUrl = $givenUrl;
958 $this->hashedGivenUrl = UrlHasher::hashUrl($givenUrl);
959
960 return $this;
961 }
962
963 /**
964 * Get origin url.
965 *
966 * @return string
967 */
968 public function getGivenUrl()
969 {
970 return $this->givenUrl;
971 }
972
bfe02a0b
TC
973 /**
974 * @return string
975 */
976 public function getHashedUrl()
977 {
978 return $this->hashedUrl;
979 }
980
981 /**
982 * @param mixed $hashedUrl
983 *
984 * @return Entry
985 */
986 public function setHashedUrl($hashedUrl)
987 {
988 $this->hashedUrl = $hashedUrl;
989
990 return $this;
991 }
9d50517c 992}