Code Duplication    Length = 21-22 lines in 2 locations

src/mappers/JobExchangeDeleteMapper.php 1 location

@@ 12-33 (lines=22) @@
9
use mcorten87\rabbitmq_api\objects\Url;
10
use mcorten87\rabbitmq_api\services\MqManagementConfig;
11
12
class JobExchangeDeleteMapper  extends BaseMapper
13
{
14
15
    protected function mapMethod() : Method {
16
        return new Method(Method::DELETE);
17
    }
18
19
    /**
20
     * @param JobExchangeDelete $job
21
     * @return Url
22
     */
23
    protected function mapUrl(JobBase $job) : Url {
24
        if (!$job instanceof JobExchangeDelete) {
25
            throw new WrongArgumentException($job, JobExchangeDelete::class);
26
        }
27
28
        $url = 'exchanges';
29
        $url .= '/'.urlencode((string)$job->getVirtualHost());
30
        $url .= '/'.urlencode((string)$job->getExchangeName());
31
        return new Url($url);
32
    }
33
}
34

src/mappers/JobExchangeListMapper.php 1 location

@@ 12-32 (lines=21) @@
9
use mcorten87\rabbitmq_api\objects\Url;
10
use mcorten87\rabbitmq_api\services\MqManagementConfig;
11
12
class JobExchangeListMapper  extends BaseMapper
13
{
14
    protected function mapMethod() : Method {
15
        return new Method(Method::GET);
16
    }
17
18
    /**
19
     * @param JobExchangeList $job
20
     * @return Url
21
     */
22
    protected function mapUrl(JobBase $job) : Url {
23
        if (!$job instanceof JobExchangeList) {
24
            throw new WrongArgumentException($job, JobExchangeList::class);
25
        }
26
27
        $url = 'exchanges';
28
        $url .= '/'.urlencode((string)$job->getVirtualHost());
29
        $url .= '/'.urlencode((string)$job->getExchangeName());
30
        return new Url($url);
31
    }
32
}
33