Code Duplication    Length = 14-14 lines in 2 locations

src/Controller/Endpoint/Alerts/AlertCountsEndpointController.php 2 locations

@@ 79-92 (lines=14) @@
76
        $servers      = $this->getConfigItem('servers');
77
        $zones        = $this->getConfigItem('zones');
78
79
        if (! empty($serversQuery)) {
80
            $check = explode(',', $serversQuery);
81
82
            // Run a check on the IDs provided to make sure they're valid and no naughty things are being passed
83
            foreach($check as $id) {
84
                if (! in_array($id, $servers)) {
85
                    return $this->errorWrongArgs($response, 'Invalid Server Arguments passed');
86
                }
87
            }
88
89
            $servers = $serversQuery;
90
        } else {
91
            $servers = implode(',', $servers);
92
        }
93
94
        if (! empty($zonesQuery)) {
95
            $check = explode(',', $zonesQuery);
@@ 94-107 (lines=14) @@
91
            $servers = implode(',', $servers);
92
        }
93
94
        if (! empty($zonesQuery)) {
95
            $check = explode(',', $zonesQuery);
96
97
            // Run a check on the IDs provided to make sure they're valid and no naughty things are being passed
98
            foreach($check as $id) {
99
                if (! in_array($id, $zones)) {
100
                    return $this->errorWrongArgs($response, 'Invalid Zone Arguments passed');
101
                }
102
            }
103
104
            $zones = $zonesQuery;
105
        } else {
106
            $zones = implode(',', $zones);
107
        }
108
109
        /* The marvelous query that is fired:
110
        SUM(CASE WHEN `ResultWinner`='VS' AND `ResultServer` IN (1,10,13,17,25,1000,2000) AND `ResultAlertCont` IN (2,4,6,8) THEN 1 ELSE 0 END) vs,