/**
  * {@inheritdoc}
  */
 public function holdsFor(Context $context)
 {
     if (!$context->containsKey($this->key)) {
         return false;
     }
     $argument = $context->get($this->key);
     return $this->operator->appliesTo($argument);
 }
 /**
  * @param OperatorInterface $operator
  *
  * @return string
  */
 public function serialize(OperatorInterface $operator)
 {
     switch (true) {
         case $operator instanceof EqualsTo:
             return ['name' => 'equals-to', 'value' => $operator->getValue()];
         case $operator instanceof GreaterThan:
             return ['name' => 'greater-than', 'value' => $operator->getValue()];
         case $operator instanceof GreaterThanEqual:
             return ['name' => 'greater-than-equal', 'value' => $operator->getValue()];
         case $operator instanceof InSet:
             return ['name' => 'in-set', 'values' => $operator->getValues()];
         case $operator instanceof LessThan:
             return ['name' => 'less-than', 'value' => $operator->getValue()];
         case $operator instanceof LessThanEqual:
             return ['name' => 'less-than-equal', 'value' => $operator->getValue()];
         case $operator instanceof Percentage:
             return ['name' => 'percentage', 'percentage' => $operator->getPercentage(), 'shift' => $operator->getShift()];
         case $operator instanceof MatchesRegex:
             return ['name' => 'matches-regex', 'value' => $operator->getValue()];
         default:
             throw new \RuntimeException(sprintf('Unknown operator %s.', get_class($operator)));
     }
 }