Code Duplication    Length = 22-24 lines in 2 locations

examples/Metrica/api.php 2 locations

@@ 323-344 (lines=22) @@
320
                    }
321
                    break;
322
323
                case 'deleteFilter':
324
                    if (isset($_POST['counterId'], $_POST['filterId']) && $_POST['counterId'] && $_POST['filterId']) {
325
326
                        //DELETE /management/v1/counter/{counterId}/filter/{filterId}
327
                        /**
328
                         * @see http://api.yandex.ru/metrika/doc/beta/management/filters/deletefilter.xml
329
                         */
330
                        $response = $managementClient
331
                            ->filters()
332
                            ->deleteFilter($_POST['filterId'], $_POST['counterId']);
333
334
                        if (isset($response['errors']) && $response['errors']) {
335
                            $status = 'error';
336
                            $errorMessage = $response['errors'][0]['text'];
337
338
                        } else {
339
                            $result = array(
340
                                'id' => $_POST['filterId']
341
                            );
342
                        }
343
                    }
344
                    break;
345
346
                case 'addGrant':
347
                    if (isset($_POST['counterId'], $_POST['userLogin'], $_POST['perm'], $_POST['comment']
@@ 398-421 (lines=24) @@
395
                    }
396
                    break;
397
398
                case 'deleteGrant':
399
                    if (isset($_POST['counterId'], $_POST['userLogin'])
400
                        && $_POST['counterId']
401
                        && $_POST['userLogin']
402
                    ) {
403
                        //DELETE /management/v1/counter/{counterId}/grant/{userLogin}
404
                        /**
405
                         * @see http://api.yandex.ru/metrika/doc/beta/management/grants/deletegrantold.xml
406
                         */
407
                        $response = $managementClient
408
                            ->grants()
409
                            ->deleteGrant( $_POST['counterId'], $_POST['userLogin']);
410
411
                        if (isset($response['errors']) && $response['errors']) {
412
                            $status = 'error';
413
                            $errorMessage = $response['errors'][0]['text'];
414
415
                        } else {
416
                            $result = array(
417
                                'id' => $_POST['userLogin']
418
                            );
419
                        }
420
                    }
421
                    break;
422
423
                case 'addOperation':
424
                    if (isset($_POST['counterId'], $_POST['action'], $_POST['attr'], $_POST['value'], $_POST['status'])