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

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