Code Duplication    Length = 27-28 lines in 2 locations

Repository/Repository.php 2 locations

@@ 558-585 (lines=28) @@
555
     * @param array $options
556
     * @return mixed
557
     */
558
    public function max($field, array $query = [], array $options = ['maxTimeMS' => 0])
559
    {
560
        $this->validateQueryOptions($options);
561
562
        $this->logger->info(
563
            sprintf('Maximum value in field %s', $field),
564
            [
565
                'filter' => $query,
566
                'options' => $options
567
            ]
568
        );
569
570
        $result = $this->findBy(
571
            $query,
572
            [
573
                Query::PROJECTION => [
574
                    $field => true
575
                ],
576
                Query::SORT => [
577
                    $field => -1
578
                ],
579
                Query::LIMIT => 1
580
            ]
581
        )->toArray();
582
583
        return ArrayAccessor::dget($result, '0.' . $field);
584
585
    }
586
587
    /**
588
     * Return the min value for a field in a collection
@@ 595-621 (lines=27) @@
592
     * @param array $options
593
     * @return \Traversable
594
     */
595
    public function min($field, array $query = [], array $options = ['maxTimeMS' => 0])
596
    {
597
        $this->validateQueryOptions($options);
598
599
        $this->logger->info(
600
            sprintf('Minimum value in field %s', $field),
601
            [
602
                'filter' => $query,
603
                'options' => $options
604
            ]
605
        );
606
607
        $result = $this->findBy(
608
            $query,
609
            [
610
                Query::PROJECTION => [
611
                    $field => true
612
                ],
613
                Query::SORT => [
614
                    $field => 1
615
                ],
616
                Query::LIMIT => 1
617
            ]
618
        )->toArray();
619
620
        return ArrayAccessor::dget($result, '0.' . $field);
621
    }
622
623
    /**
624
     * @param $field