/**
  * Get the entity from the passed rule
  *
  * @param Rule $rule
  */
 protected function getEntity(Rule $rule)
 {
     if ($rule instanceof RuleSet) {
         foreach ($rule->getChildren() as $child) {
             return $child->getEntity();
         }
         throw new \Exception(sprintf('The rule %s and non of its children have an entity', get_class($rule)));
     }
     return $rule->getEntity();
 }