Code Duplication    Length = 15-15 lines in 2 locations

tests/EdmxTest.php 1 location

@@ 109-123 (lines=15) @@
106
     * @param string $plural Plural form of word; function will attempt to deduce plural form from singular if not provided
107
     * @return string Pluralized word if quantity is not one, otherwise singular
108
     */
109
    public static function pluralize($quantity, $singular, $plural = null)
110
    {
111
        if ($quantity == 1 || !strlen($singular)) return $singular;
112
        if ($plural !== null) return $plural;
113
114
        $last_letter = strtolower($singular[strlen($singular) - 1]);
115
        switch ($last_letter) {
116
            case 'y':
117
                return substr($singular, 0, -1) . 'ies';
118
            case 's':
119
                return $singular . 'es';
120
            default:
121
                return $singular . 's';
122
        }
123
    }
124
}
125

src/MetadataManager.php 1 location

@@ 79-93 (lines=15) @@
76
     * @param string $plural Plural form of word; function will attempt to deduce plural form from singular if not provided
77
     * @return string Pluralized word if quantity is not one, otherwise singular
78
     */
79
    public static function pluralize($quantity, $singular, $plural = null)
80
    {
81
        if ($quantity == 1 || !strlen($singular)) return $singular;
82
        if ($plural !== null) return $plural;
83
84
        $last_letter = strtolower($singular[strlen($singular) - 1]);
85
        switch ($last_letter) {
86
            case 'y':
87
                return substr($singular, 0, -1) . 'ies';
88
            case 's':
89
                return $singular . 'es';
90
            default:
91
                return $singular . 's';
92
        }
93
    }
94
95
    private function revertEdmxTransaction()
96
    {