src/App/Model/Query/ConditionQuery/Type/NumericType.php

Open in your IDE?
  1. <?php
  2. namespace App\Model\Query\ConditionQuery\Type;
  3. use App\Model\Query\ConditionQuery\AbstractType;
  4. use App\Model\Query\ConditionQuery\Condition\EqualCondition;
  5. use App\Model\Query\ConditionQuery\Condition\GreaterThanCondition;
  6. use App\Model\Query\ConditionQuery\Condition\GreaterThanEqualCondition;
  7. use App\Model\Query\ConditionQuery\Condition\LessThanCondition;
  8. use App\Model\Query\ConditionQuery\Condition\LessThanEqualCondition;
  9. use App\Model\Query\ConditionQuery\Condition\NotEqualCondition;
  10. /**
  11.  *
  12.  */
  13. final class NumericType extends AbstractType
  14. {
  15.     const NAME 'numeric';
  16.     /**
  17.      * {@inheritDoc}
  18.      */
  19.     public function validate($value): void
  20.     {
  21.         // TODO
  22.     }
  23.     /**
  24.      * @return string[]
  25.      */
  26.     public function getValidOperators(): array
  27.     {
  28.         if ($this->allowsMultiple()) {
  29.             return self::VALID_ARRAY_OPERATOR_NAMES;
  30.         }
  31.         return [
  32.             EqualCondition::NAME => EqualCondition::HUMAN_READABLE_NAME,
  33.             GreaterThanCondition::NAME => GreaterThanCondition::HUMAN_READABLE_NAME,
  34.             GreaterThanEqualCondition::NAME => GreaterThanEqualCondition::HUMAN_READABLE_NAME,
  35.             LessThanCondition::NAME => LessThanCondition::HUMAN_READABLE_NAME,
  36.             LessThanEqualCondition::NAME => LessThanEqualCondition::HUMAN_READABLE_NAME,
  37.             NotEqualCondition::NAME => NotEqualCondition::HUMAN_READABLE_NAME,
  38.         ];
  39.     }
  40. }