1 | <?php |
||
6 | class DMSDocumentCart extends ViewableData |
||
|
|||
7 | { |
||
8 | /** |
||
9 | * A handle to the classes' {@link DMSCartBackendInterface} |
||
10 | * |
||
11 | * @var DMSCartBackendInterface |
||
12 | */ |
||
13 | protected $backend; |
||
14 | |||
15 | public function __construct($backend = null) |
||
20 | |||
21 | /** |
||
22 | * Returns all the cart items as an array |
||
23 | * |
||
24 | * @return ArrayList |
||
25 | */ |
||
26 | public function getItems() |
||
30 | |||
31 | /** |
||
32 | * Add an {@link DMSRequestItem} object into the cart. |
||
33 | * |
||
34 | * @param DMSRequestItem $item |
||
35 | * |
||
36 | * @return DMSDocumentCart |
||
37 | */ |
||
38 | public function addItem(DMSRequestItem $item) |
||
44 | |||
45 | /** |
||
46 | * Get a {@link DMSRequestItem} object from the cart. |
||
47 | * |
||
48 | * @param int $itemID The ID of the item |
||
49 | * |
||
50 | * @return DMSRequestItem|boolean |
||
51 | */ |
||
52 | public function getItem($itemID) |
||
56 | |||
57 | /** |
||
58 | * Removes a {@link DMSRequestItem} from the cart by it's id |
||
59 | * |
||
60 | * @param DMSRequestItem $item |
||
61 | * |
||
62 | * @return DMSDocumentCart |
||
63 | */ |
||
64 | public function removeItem(DMSRequestItem $item) |
||
70 | |||
71 | /** |
||
72 | * Removes a {@link DMSRequestItem} from the cart by it's id |
||
73 | * |
||
74 | * @param int $itemID |
||
75 | * |
||
76 | * @return DMSDocumentCart |
||
77 | */ |
||
78 | public function removeItemByID($itemID) |
||
84 | |||
85 | /** |
||
86 | * Adjusts (increments, decrements or amends) the quantity of an {@link DMSRequestItem}.' |
||
87 | * A positive $quantity increments the total, whereas a negative value decrements the total. A cart item |
||
88 | * is removed completely if it's value reaches <= 0. |
||
89 | * |
||
90 | * @param int $itemID |
||
91 | * @param int $quantity |
||
92 | * |
||
93 | * @return DMSDocumentCart |
||
94 | */ |
||
95 | public function updateItemQuantity($itemID, $quantity) |
||
110 | |||
111 | /** |
||
112 | * Completely empties a cart |
||
113 | * |
||
114 | * @return DMSDocumentCart |
||
115 | */ |
||
116 | public function emptyCart() |
||
122 | |||
123 | /** |
||
124 | * Checks if a cart is empty. |
||
125 | * Returns true if cart is empty, false otherwise. |
||
126 | * |
||
127 | * @return boolean |
||
128 | */ |
||
129 | public function isCartEmpty() |
||
135 | |||
136 | /** |
||
137 | * Set the backURL to be a Session variable for the current Document Cart |
||
138 | * |
||
139 | * @param string $backURL |
||
140 | * |
||
141 | * @return DMSDocumentCart |
||
142 | */ |
||
143 | public function setBackUrl($backURL) |
||
149 | |||
150 | /** |
||
151 | * Returns the backURL for the current Document Cart |
||
152 | * |
||
153 | * @return string |
||
154 | */ |
||
155 | public function getBackUrl() |
||
159 | |||
160 | /** |
||
161 | * Sets the recipients info as an array (e.g. array('Name'=>'Joe','Surname'=>'Soap')) |
||
162 | * |
||
163 | * @param array $receiverInfo |
||
164 | * |
||
165 | * @return DMSDocumentCart |
||
166 | */ |
||
167 | public function setReceiverInfo($receiverInfo) |
||
173 | |||
174 | /** |
||
175 | * Retrieves the recipients info as an array (e.g. array('Name'=>'Joe','Surname'=>'Soap')) |
||
176 | * |
||
177 | * @return array |
||
178 | */ |
||
179 | public function getReceiverInfo() |
||
183 | |||
184 | /** |
||
185 | * Returns the recipients in a Viewable format |
||
186 | * |
||
187 | * @return ArrayData|bool |
||
188 | */ |
||
189 | public function getReceiverInfoNice() |
||
193 | |||
194 | /** |
||
195 | * Gets the backend handler |
||
196 | * |
||
197 | * @return DMSSessionBackend |
||
198 | */ |
||
199 | public function getBackend() |
||
203 | |||
204 | /** |
||
205 | * Checks if an item exists within a cart. Returns true (if exists) or false. |
||
206 | * |
||
207 | * @param int $itemID |
||
208 | * |
||
209 | * @return bool |
||
210 | */ |
||
211 | public function isInCart($itemID) |
||
215 | |||
216 | /** |
||
217 | * Persists a cart submission to the database |
||
218 | * |
||
219 | * @param Form $form |
||
220 | * |
||
221 | * @return int |
||
222 | */ |
||
223 | public function saveSubmission(Form $form) |
||
239 | } |
||
240 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.