1 <?php
2 3 4
5 namespace Team3\PayU\Order\Model\ShippingMethods;
6
7 class ShippingMethodCollection implements ShippingMethodCollectionInterface
8 {
9 10 11
12 protected $shippingMethods;
13
14 15 16
17 public function __construct(array $shippingMethod = [])
18 {
19 $this->shippingMethods = $shippingMethod;
20 }
21
22 23 24 25 26
27 public function isFilled()
28 {
29 return 0 < count($this->shippingMethods);
30 }
31
32 33 34
35 public function getShippingMethods()
36 {
37 return $this->shippingMethods;
38 }
39
40 41 42
43 public function addShippingMethod(ShippingMethodInterface $shippingMethod)
44 {
45 $this->shippingMethods[] = $shippingMethod;
46
47 return $this;
48 }
49
50 51 52 53 54
55 public function setShippingMethods(array $shippingMethods)
56 {
57 $this->shippingMethods = array_values($shippingMethods);
58
59 return $this;
60 }
61
62 63 64
65 public function getIterator()
66 {
67 return new \ArrayIterator($this->getShippingMethods());
68 }
69
70 71 72
73 public function count()
74 {
75 return count($this->getShippingMethods());
76 }
77 }
78