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)) {
112
            return $singular;
113
        }
114
        if ($plural !== null) {
115
            return $plural;
116
        }
117
118
        $last_letter = strtolower($singular[strlen($singular) - 1]);
119
        switch ($last_letter) {
120
            case 'y':
121
                return substr($singular, 0, -1) . 'ies';
122
            case 's':
123
                return $singular . 'es';
124
            default:
125
                return $singular . 's';
126
        }

src/MetadataManager.php 1 location

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