Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
100.00% |
1 / 1 |
|
100.00% |
7 / 7 |
CRAP | |
100.00% |
10 / 10 |
| ShippingMethodCollection | |
100.00% |
1 / 1 |
|
100.00% |
7 / 7 |
7 | |
100.00% |
10 / 10 |
| __construct(array $shippingMethod = []) | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
|||
| isFilled() | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| getShippingMethods() | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| addShippingMethod(ShippingMethodInterface $shippingMethod) | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
|||
| setShippingMethods(array $shippingMethods) | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
|||
| getIterator() | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| count() | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| <?php | |
| /** | |
| * @author Krzysztof Gzocha <krzysztof.gzocha@xsolve.pl> | |
| */ | |
| namespace Team3\PayU\Order\Model\ShippingMethods; | |
| class ShippingMethodCollection implements ShippingMethodCollectionInterface | |
| { | |
| /** | |
| * @var ShippingMethodInterface[] | |
| */ | |
| protected $shippingMethods; | |
| /** | |
| * @param ShippingMethodInterface[] $shippingMethod | |
| */ | |
| public function __construct(array $shippingMethod = []) | |
| { | |
| $this->shippingMethods = $shippingMethod; | |
| } | |
| /** | |
| * Return true if given object is filled | |
| * | |
| * @return bool | |
| */ | |
| public function isFilled() | |
| { | |
| return 0 < count($this->shippingMethods); | |
| } | |
| /** | |
| * @return ShippingMethodInterface[] | |
| */ | |
| public function getShippingMethods() | |
| { | |
| return $this->shippingMethods; | |
| } | |
| /** | |
| * @inheritdoc | |
| */ | |
| public function addShippingMethod(ShippingMethodInterface $shippingMethod) | |
| { | |
| $this->shippingMethods[] = $shippingMethod; | |
| return $this; | |
| } | |
| /** | |
| * @param ShippingMethodInterface[] $shippingMethods | |
| * | |
| * @return ShippingMethodCollection | |
| */ | |
| public function setShippingMethods(array $shippingMethods) | |
| { | |
| $this->shippingMethods = array_values($shippingMethods); | |
| return $this; | |
| } | |
| /** | |
| * @inheritdoc | |
| */ | |
| public function getIterator() | |
| { | |
| return new \ArrayIterator($this->getShippingMethods()); | |
| } | |
| /** | |
| * @inheritdoc | |
| */ | |
| public function count() | |
| { | |
| return count($this->getShippingMethods()); | |
| } | |
| } |