/**
  * {@inheritdoc}
  */
 public function isEligible(ShippingSubjectInterface $subject, ShippingMethodInterface $method)
 {
     if (!$this->isCategoryEligible($subject, $method)) {
         return false;
     }
     foreach ($method->getRules() as $rule) {
         $checker = $this->registry->getChecker($rule->getType());
         if (!$checker->isEligible($subject, $rule->getConfiguration())) {
             return false;
         }
     }
     return true;
 }
示例#2
0
 /**
  * @param FormInterface $form
  * @param $ruleType
  * @param array         $data
  */
 protected function addConfigurationFields(FormInterface $form, $ruleType, array $data = array())
 {
     $checker = $this->checkerRegistry->getChecker($ruleType);
     $configurationField = $this->factory->createNamed('configuration', $checker->getConfigurationFormType(), $data, array('auto_initialize' => false));
     $form->add($configurationField);
 }