Code Duplication    Length = 35-36 lines in 2 locations

src/Russian/AdjectiveDeclension.php 2 locations

@@ 159-194 (lines=36) @@
156
     * @return string[]
157
     * @phpstan-return array<string, string>
158
     */
159
    protected static function declinateHardAdjective($adjective, $animateness, $gender,
160
        $afterConsonantVowel)
161
    {
162
        switch ($gender)
163
        {
164
            case static::MALE:
165
                $postfix = $afterConsonantVowel.'й';
166
                break;
167
168
            case static::FEMALE:
169
                $postfix = $afterConsonantVowel.'я';
170
                break;
171
172
            case static::NEUTER:
173
                $postfix = $afterConsonantVowel.'е';
174
                break;
175
176
            default: throw new RuntimeException('Unreachable');
177
        }
178
179
        $cases = [
180
            static::IMENIT => $adjective.$postfix,
181
            static::RODIT => $adjective.'о'.($gender !== static::FEMALE ? 'го' : 'й'),
182
            static::DAT => $adjective.'о'.($gender !== static::FEMALE ? 'му' : 'й'),
183
        ];
184
185
        if ($gender !== static::FEMALE)
186
            $cases[static::VINIT] = static::getVinitCaseByAnimateness($cases, $animateness);
187
        else
188
            $cases[static::VINIT] = $adjective.'ую';
189
190
        $cases[static::TVORIT] = $adjective.($gender !== static::FEMALE ? 'ым' : 'ой');
191
        $cases[static::PREDLOJ] = $adjective.($gender !== static::FEMALE ? 'ом' : 'ой');
192
193
        return $cases;
194
    }
195
196
    /**
197
     * @param string $adjective
@@ 205-239 (lines=35) @@
202
     * @return string[]
203
     * @phpstan-return array<string, string>
204
     */
205
    protected static function declinateSoftAdjective($adjective, $animateness, $gender, $afterConsonantVowel)
206
    {
207
        switch ($gender)
208
        {
209
            case static::MALE:
210
                $postfix = $afterConsonantVowel.'й';
211
                break;
212
213
            case static::FEMALE:
214
                $postfix = $afterConsonantVowel.'я';
215
                break;
216
217
            case static::NEUTER:
218
                $postfix = $afterConsonantVowel.'е';
219
                break;
220
221
            default: throw new RuntimeException('Unreachable');
222
        }
223
224
        $cases = [
225
            static::IMENIT => $adjective.$postfix,
226
            static::RODIT => $adjective.'е'.($gender !== static::FEMALE ? 'го' : 'й'),
227
            static::DAT => $adjective.'е'.($gender !== static::FEMALE ? 'му' : 'й'),
228
        ];
229
230
        if ($gender !== static::FEMALE)
231
            $cases[static::VINIT] = static::getVinitCaseByAnimateness($cases, $animateness);
232
        else
233
            $cases[static::VINIT] = $adjective.'юю';
234
235
        $cases[static::TVORIT] = $adjective.($gender !== static::FEMALE ? 'им' : 'ей');
236
        $cases[static::PREDLOJ] = $adjective.($gender !== static::FEMALE ? 'ем' : 'ей');
237
238
        return $cases;
239
    }
240
241
    /**
242
     * @param string $adjective