Code Duplication    Length = 15-18 lines in 2 locations

core/domain/services/graphql/resolvers/FieldResolver.php 2 locations

@@ 212-226 (lines=15) @@
209
     * @throws InvalidInterfaceException
210
     * @since $VID:$
211
     */
212
    public function resolveState($source)
213
    {
214
        switch (true) {
215
            case $source instanceof EE_Attendee:
216
            case $source instanceof EE_Venue:
217
                $state_id = $source->state_ID();
218
                break;
219
            default:
220
                $state_id = null;
221
                break;
222
        }
223
        return $state_id
224
            ? EEM_State::instance()->get_one_by_ID($state_id)
225
            : null;
226
    }
227
228
229
    /**
@@ 238-255 (lines=18) @@
235
     * @throws InvalidInterfaceException
236
     * @since $VID:$
237
     */
238
    public function resolveCountry($source)
239
    {
240
        switch (true) {
241
            case $source instanceof EE_State:
242
                $country_iso = $source->country_iso();
243
                break;
244
            case $source instanceof EE_Venue:
245
                $country_iso = $source->country_ID();
246
                break;
247
            default:
248
                $country_iso = null;
249
                break;
250
        }
251
252
        return $country_iso
253
            ? EEM_Country::instance()->get_one_by_ID($country_iso)
254
            : null;
255
    }
256
}
257