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

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