Completed
Push — master ( 66b796...ebbacf )
by Kamil
17:43 queued 10:16
created

ChangeItemQuantityRequest::getCommand()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 4
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Sylius\ShopApiPlugin\Request;
4
5
use Sylius\ShopApiPlugin\Command\ChangeItemQuantity;
6
use Symfony\Component\HttpFoundation\Request;
7
8 View Code Duplication
final class ChangeItemQuantityRequest
0 ignored issues
show
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...
9
{
10
    /**
11
     * @var string
12
     */
13
    private $token;
14
15
    /**
16
     * @var mixed
17
     */
18
    private $id;
19
20
    /**
21
     * @var int
22
     */
23
    private $quantity;
24
25
    /**
26
     * @param Request $request
27
     */
28
    public function __construct(Request $request)
29
    {
30
        $this->token = $request->attributes->get('token');
31
        $this->id = $request->attributes->get('id');
32
        $this->quantity = $request->request->get('quantity');
33
    }
34
35
    /**
36
     * @return ChangeItemQuantity
37
     */
38
    public function getCommand()
39
    {
40
        return new ChangeItemQuantity($this->token, $this->id, $this->quantity);
41
    }
42
}
43