Author: Adam Piotrowski (adam@wellcommerce.org)
Inheritance: extends WellCommerce\Bundle\DoctrineBundle\Repository\RepositoryInterface
 public function getCosts(ShippingSubjectInterface $subject) : Collection
 {
     $methods = $this->repository->getShippingMethods();
     $collection = new ArrayCollection();
     $methods->map(function (ShippingMethodInterface $shippingMethod) use($subject, $collection) {
         $costs = $this->getShippingMethodCosts($shippingMethod, $subject);
         $costs->map(function (ShippingMethodCostInterface $cost) use($collection) {
             $collection->add($cost);
         });
     });
     return $collection;
 }
 private function getShippingMethods(ShippingSubjectInterface $subject) : Collection
 {
     $methods = $this->repository->getShippingMethods();
     $country = $subject->getCountry();
     if (strlen($country)) {
         return $methods->filter(function (ShippingMethodInterface $method) use($country) {
             if (count($method->getCountries()) && !in_array($country, $method->getCountries())) {
                 return false;
             }
             return true;
         });
     }
     return $methods;
 }
 /**
  * Returns all enabled shipping methods as a collection
  *
  * @return ArrayCollection
  */
 protected function getEnabledMethods()
 {
     $methods = $this->shippingMethodRepository->findAllEnabledShippingMethods();
     return new ArrayCollection($methods);
 }