Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function getEffective(User $user, $superCategory, $category, $optionName)
 {
     $groupNames = $user->getGroupNames();
     /** @var Option[] $options */
     $options = [];
     foreach ($groupNames as $name) {
         $options[$name] = $this->get($name, $superCategory, $category, $optionName);
     }
     $returnValue = null;
     foreach ($options as $name => $option) {
         if (!isset($this->optionTypes[$superCategory][$category][$optionName])) {
             // if this happens, somebody somewhere screwed up
             // we must return null, as there is no way to simply
             // ignore this
             $returnValue = null;
             break;
         }
         /** @var OptionTypeInterface $type */
         $type = $this->optionTypes[$superCategory][$category][$optionName];
         $returnValue = $type->getBestValue($returnValue, $option);
     }
     return $returnValue;
 }