1 <?php
2 /**
3 * @author Krzysztof Gzocha <krzysztof.gzocha@xsolve.pl>
4 */
5 namespace Team3\PayU\Order\Model\Traits;
6
7 use Team3\PayU\Order\Model\ShippingMethods\ShippingMethodCollection;
8 use Team3\PayU\Order\Model\ShippingMethods\ShippingMethodCollectionInterface;
9
10 trait ShippingMethodCollectionTrait
11 {
12 /**
13 * @var ShippingMethodCollectionInterface
14 * @JMS\Type("array<Team3\PayU\Order\Model\ShippingMethods\ShippingMethod>")
15 * @JMS\SerializedName("shippingMethods")
16 * @JMS\Accessor(
17 * getter="getShippingMethodCollection",
18 * setter="setShippingMethodCollectionFromDeserialization"
19 * )
20 * @JMS\Groups({"shippingMethods"})
21 */
22 protected $shippingCollection;
23
24 /**
25 * @return ShippingMethodCollectionInterface
26 */
27 public function getShippingMethodCollection()
28 {
29 return $this->shippingCollection;
30 }
31
32 /**
33 * @param ShippingMethodCollectionInterface $shippingMethodCollection
34 *
35 * @return $this
36 */
37 public function setShippingMethodCollection(
38 ShippingMethodCollectionInterface $shippingMethodCollection
39 ) {
40 $this->shippingCollection = $shippingMethodCollection;
41
42 return $this;
43 }
44
45 /**
46 * @param array $shippingMethods
47 *
48 * @return $this
49 */
50 public function setShippingMethodCollectionFromDeserialization(
51 array $shippingMethods
52 ) {
53 $this->setShippingMethodCollection(
54 new ShippingMethodCollection($shippingMethods)
55 );
56
57 return $this;
58 }
59 }
60