for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sylius\Component\Shipping\Resolver;
use Sylius\Component\Registry\PrioritizedServiceRegistryInterface;
use Sylius\Component\Shipping\Model\ShippingSubjectInterface;
/**
* @author Mateusz Zalewski <[email protected]>
class CompositeMethodsResolver implements MethodsResolverInterface
{
* @var PrioritizedServiceRegistryInterface
private $resolversRegistry;
* @param PrioritizedServiceRegistryInterface $resolversRegistry
public function __construct(PrioritizedServiceRegistryInterface $resolversRegistry)
$this->resolversRegistry = $resolversRegistry;
}
* {@inheritdoc}
public function getSupportedMethods(ShippingSubjectInterface $shippingSubject)
foreach ($this->resolversRegistry->all() as $resolver) {
if ($resolver->supports($shippingSubject)) {
return $resolver->getSupportedMethods($shippingSubject);
return [];
public function supports(ShippingSubjectInterface $subject)
if ($resolver->supports($subject)) {
return true;
return false;