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
    }
@@ 849-862 (lines=14) @@
846
        }
847
848
        $this->shardKey = array(
849
            'keys' => array_map(function($value) {
850
                if ($value == 1 || $value == -1) {
851
                    return (int) $value;
852
                }
853
                if (is_string($value)) {
854
                    $lower = strtolower($value);
855
                    if ($lower === 'asc') {
856
                        return 1;
857
                    } elseif ($lower === 'desc') {
858
                        return -1;
859
                    }
860
                }
861
                return $value;
862
            }, $keys),
863
            'options' => $options
864
        );
865
    }