Esempio n. 1
0
 /**
  * Преобразует сравнение в условие сортировки
  *
  * @param  ConverterInterface  $converter
  * @param  ComparatorInterface $comparator
  * @return Condition\Condition[]
  */
 public function convert(ConverterInterface $converter, ComparatorInterface $comparator) : array
 {
     if (!$comparator instanceof ConditionProviderInterface) {
         return $converter->convert($converter, $comparator);
     }
     return $comparator->getConditions();
 }
Esempio n. 2
0
 /**
  * Преобразует сравнение в условие сортировки
  *
  * @param  ConverterInterface  $converter
  * @param  ComparatorInterface $comparator
  * @return Condition\Condition[]
  */
 public function convert(ConverterInterface $converter, ComparatorInterface $comparator) : array
 {
     if (!$comparator instanceof ReverseComparator) {
         return $converter->convert($converter, $comparator);
     }
     $conditions = [];
     foreach ($converter->convert($converter, $comparator->getComparator()) as $condition) {
         $conditions[] = Condition\Condition::reverse($condition);
     }
     return $conditions;
 }