1 | <?php |
||
22 | class ListingSerializer implements \JsonSerializable |
||
23 | { |
||
24 | use SelectorValidationTrait; |
||
25 | |||
26 | /** |
||
27 | * @var Listing |
||
28 | */ |
||
29 | private $listing = null; |
||
30 | |||
31 | /** |
||
32 | * @var PaginatorAwareInterface|RecordSelector|DocumentSelector |
||
33 | */ |
||
34 | private $selector = null; |
||
35 | |||
36 | /** |
||
37 | * @param Listing $listing |
||
38 | * @param PaginatorAwareInterface|RecordSelector|DocumentSelector $selector |
||
39 | * |
||
40 | * @throws InvalidSelectorException |
||
41 | */ |
||
42 | public function __construct(Listing $listing, PaginatorAwareInterface $selector) |
||
49 | |||
50 | /** |
||
51 | * Unique id associated with listing. |
||
52 | * |
||
53 | * @return string |
||
54 | */ |
||
55 | public function getID() |
||
59 | |||
60 | /** |
||
61 | * @return array |
||
62 | */ |
||
63 | public function toArray() |
||
72 | |||
73 | /** |
||
74 | * @return array |
||
75 | */ |
||
76 | public function jsonSerialize() |
||
80 | |||
81 | /** |
||
82 | * @param Listing $listing |
||
83 | * @return string |
||
84 | */ |
||
85 | public static function listingID(Listing $listing) |
||
89 | |||
90 | /** |
||
91 | * @return array |
||
92 | */ |
||
93 | protected function packSorting() |
||
106 | |||
107 | /** |
||
108 | * @return array |
||
109 | */ |
||
110 | protected function packFilters() |
||
119 | |||
120 | /** |
||
121 | * @return array |
||
122 | */ |
||
123 | protected function packPagination() |
||
154 | } |