Code Duplication    Length = 35-35 lines in 2 locations

src/Request/ChangeItemQuantityRequest.php 1 location

@@ 8-42 (lines=35) @@
5
use Sylius\ShopApiPlugin\Command\ChangeItemQuantity;
6
use Symfony\Component\HttpFoundation\Request;
7
8
final class ChangeItemQuantityRequest
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

src/Request/PutSimpleItemToCartRequest.php 1 location

@@ 8-42 (lines=35) @@
5
use Sylius\ShopApiPlugin\Command\PutSimpleItemToCart;
6
use Symfony\Component\HttpFoundation\Request;
7
8
final class PutSimpleItemToCartRequest
9
{
10
    /**
11
     * @var string
12
     */
13
    private $token;
14
15
    /**
16
     * @var string
17
     */
18
    private $product;
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->product = $request->request->get('productCode');
32
        $this->quantity = $request->request->get('quantity');
33
    }
34
35
    /**
36
     * @return PutSimpleItemToCart
37
     */
38
    public function getCommand()
39
    {
40
        return new PutSimpleItemToCart($this->token, $this->product, $this->quantity);
41
    }
42
}
43