JobExchangeDeleteMapper::mapMethod()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 3
Ratio 100 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 3
loc 3
ccs 2
cts 2
cp 1
rs 10
c 1
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
declare(strict_types=1);
3
namespace mcorten87\rabbitmq_api\mappers;
4
5
use mcorten87\rabbitmq_api\exceptions\WrongArgumentException;
6
use mcorten87\rabbitmq_api\jobs\JobBase;
7
use mcorten87\rabbitmq_api\jobs\JobExchangeDelete;
8
use mcorten87\rabbitmq_api\objects\Method;
9
use mcorten87\rabbitmq_api\objects\Url;
10
use mcorten87\rabbitmq_api\services\MqManagementConfig;
11
12 View Code Duplication
class JobExchangeDeleteMapper  extends BaseMapper
0 ignored issues
show
Coding Style introduced by
Expected 1 space after class name; 2 found
Loading history...
Coding Style introduced by
Expected 1 space before extends keyword; 2 found
Loading history...
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
13
{
14
15 2
    protected function mapMethod() : Method {
16 2
        return new Method(Method::DELETE);
17
    }
18
19
    /**
20
     * @param JobExchangeDelete $job
21
     * @return Url
22
     */
23 2
    protected function mapUrl(JobBase $job) : Url {
24 2
        if (!$job instanceof JobExchangeDelete) {
25
            throw new WrongArgumentException($job, JobExchangeDelete::class);
26
        }
27
28 2
        $url = 'exchanges';
29 2
        $url .= '/'.urlencode((string)$job->getVirtualHost());
30 2
        $url .= '/'.urlencode((string)$job->getExchangeName());
31 2
        return new Url($url);
32
    }
33
}
34