Code Duplication    Length = 18-18 lines in 2 locations

src/Rule/OrRule.php 1 location

@@ 185-202 (lines=18) @@
182
                        });
183
                        $operands = [reset($operands)];
184
                    }
185
                    elseif (BelowRule::operator == $operator) {
186
                        usort($operands, function( BelowRule $a, BelowRule $b ) {
187
                            if (null === $a->getMaximum()) {
188
                                return 1;
189
                            }
190
191
                            if (null === $b->getMaximum()) {
192
                                return -1;
193
                            }
194
195
                            if ($a->getMaximum() > $b->getMaximum()) {
196
                                return -1;
197
                            }
198
199
                            return 1;
200
                        });
201
                        $operands = [reset($operands)];
202
                    }
203
                    elseif (InRule::operator == $operator) {
204
                        $first_in = reset($operands);
205

src/Rule/AndRule.php 1 location

@@ 389-406 (lines=18) @@
386
                        });
387
                        $operands = [reset($operands)];
388
                    }
389
                    elseif (BelowRule::operator == $operator) {
390
                        usort($operands, function( BelowRule $a, BelowRule $b ) {
391
                            if (null === $a->getUpperLimit()) {
392
                                return 1;
393
                            }
394
395
                            if (null === $b->getUpperLimit()) {
396
                                return -1;
397
                            }
398
399
                            if ($a->getUpperLimit() < $b->getUpperLimit()) {
400
                                return -1;
401
                            }
402
403
                            return 1;
404
                        });
405
                        $operands = [reset($operands)];
406
                    }
407
                    elseif (EqualRule::operator == $operator) {
408
                        // TODO add an option for the support strict comparison
409
                        foreach ($operands as $i => $operand) {