Exemplo n.º 1
0
 public function decide(Strategy $strategy, Feature $feature, array $context = array())
 {
     $voter = $strategy->getVoter();
     $context = !empty($context) ? $context : $this->getContext();
     $context['_user'] = $this->get('_user');
     $options = array_merge($strategy->getOptions(), $feature->getOptions());
     if (is_callable($voter)) {
         return $this->callVoter($voter, $context, $options);
     } else {
         if (is_string($voter)) {
             $contextObj = $this->arrayToObject($context);
             $optionsObj = $this->arrayToObject($options);
             return $this->expressionLanguage->evaluate($voter, ['context' => $contextObj, 'options' => $optionsObj, 'user' => $this->get('_user')]);
         }
     }
 }