Code Duplication    Length = 14-14 lines in 2 locations

lib/Doctrine/ODM/MongoDB/Mapping/ClassMetadataInfo.php 2 locations

@@ 776-789 (lines=14) @@
773
    public function addIndex($keys, array $options = array())
774
    {
775
        $this->indexes[] = array(
776
            'keys' => array_map(function($value) {
777
                if ($value == 1 || $value == -1) {
778
                    return (int) $value;
779
                }
780
                if (is_string($value)) {
781
                    $lower = strtolower($value);
782
                    if ($lower === 'asc') {
783
                        return 1;
784
                    } elseif ($lower === 'desc') {
785
                        return -1;
786
                    }
787
                }
788
                return $value;
789
            }, $keys),
790
            'options' => $options
791
        );
792
    }
@@ 857-870 (lines=14) @@
854
        }
855
856
        $this->shardKey = array(
857
            'keys' => array_map(function($value) {
858
                if ($value == 1 || $value == -1) {
859
                    return (int) $value;
860
                }
861
                if (is_string($value)) {
862
                    $lower = strtolower($value);
863
                    if ($lower === 'asc') {
864
                        return 1;
865
                    } elseif ($lower === 'desc') {
866
                        return -1;
867
                    }
868
                }
869
                return $value;
870
            }, $keys),
871
            'options' => $options
872
        );
873
    }