Code Duplication    Length = 14-14 lines in 2 locations

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

@@ 831-844 (lines=14) @@
828
    public function addIndex($keys, array $options = array())
829
    {
830
        $this->indexes[] = array(
831
            'keys' => array_map(function($value) {
832
                if ($value == 1 || $value == -1) {
833
                    return (int) $value;
834
                }
835
                if (is_string($value)) {
836
                    $lower = strtolower($value);
837
                    if ($lower === 'asc') {
838
                        return 1;
839
                    } elseif ($lower === 'desc') {
840
                        return -1;
841
                    }
842
                }
843
                return $value;
844
            }, $keys),
845
            'options' => $options
846
        );
847
    }
@@ 918-931 (lines=14) @@
915
        }
916
917
        $this->shardKey = array(
918
            'keys' => array_map(function($value) {
919
                if ($value == 1 || $value == -1) {
920
                    return (int) $value;
921
                }
922
                if (is_string($value)) {
923
                    $lower = strtolower($value);
924
                    if ($lower === 'asc') {
925
                        return 1;
926
                    } elseif ($lower === 'desc') {
927
                        return -1;
928
                    }
929
                }
930
                return $value;
931
            }, $keys),
932
            'options' => $options
933
        );
934
    }