Code Duplication    Length = 15-15 lines in 2 locations

tests/EdmxTest.php 1 location

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

src/MetadataManager.php 1 location

@@ 97-111 (lines=15) @@
94
     * form from singular if not provided
95
     * @return string Pluralized word if quantity is not one, otherwise singular
96
     */
97
    public static function pluralize($quantity, $singular, $plural = null)
98
    {
99
        if ($quantity == 1 || !strlen($singular)) {
100
            return $singular;
101
        }
102
        if ($plural !== null) {
103
            return $plural;
104
        }
105
106
        $last_letter = strtolower($singular[strlen($singular) - 1]);
107
        switch ($last_letter) {
108
            case 'y':
109
                return substr($singular, 0, -1) . 'ies';
110
            case 's':
111
                return $singular . 'es';
112
            default:
113
                return $singular . 's';
114
        }