Code Duplication    Length = 14-14 lines in 2 locations

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

@@ 816-829 (lines=14) @@
813
    public function addIndex($keys, array $options = array())
814
    {
815
        $this->indexes[] = array(
816
            'keys' => array_map(function($value) {
817
                if ($value == 1 || $value == -1) {
818
                    return (int) $value;
819
                }
820
                if (is_string($value)) {
821
                    $lower = strtolower($value);
822
                    if ($lower === 'asc') {
823
                        return 1;
824
                    } elseif ($lower === 'desc') {
825
                        return -1;
826
                    }
827
                }
828
                return $value;
829
            }, $keys),
830
            'options' => $options
831
        );
832
    }
@@ 903-916 (lines=14) @@
900
        }
901
902
        $this->shardKey = array(
903
            'keys' => array_map(function($value) {
904
                if ($value == 1 || $value == -1) {
905
                    return (int) $value;
906
                }
907
                if (is_string($value)) {
908
                    $lower = strtolower($value);
909
                    if ($lower === 'asc') {
910
                        return 1;
911
                    } elseif ($lower === 'desc') {
912
                        return -1;
913
                    }
914
                }
915
                return $value;
916
            }, $keys),
917
            'options' => $options
918
        );
919
    }