Passed
Push — master ( 14d404...4bd91f )
by C.
02:09
created

CheckoutService::getCheckoutUrl()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 12
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 7
nc 1
nop 2
1
<?php
2
3
/*
4
 * This file is part of PHP CS Fixer.
5
 *
6
 * (c) Fabien Potencier <[email protected]>
7
 *     Dariusz Rumiński <[email protected]>
8
 *
9
 * This source file is subject to the MIT license that is bundled
10
 * with this source code in the file LICENSE.
11
 */
12
13
namespace Etrias\PaazlConnector\Service;
14
15
use Etrias\PaazlConnector\Processor\Processor;
16
use Etrias\PaazlConnector\ServiceType\Service as GeneralServiceType;
17
use Etrias\PaazlConnector\StructType\BaseCheckoutRequestType;
18
use Etrias\PaazlConnector\StructType\CheckoutResponse;
19
20
class CheckoutService
21
{
22
    use Processor;
23
24
    /**
25
     * @var SecurityServiceInterface
26
     */
27
    protected $securityService;
28
    /**
29
     * @var GeneralServiceType
30
     */
31
    protected $generalServiceType;
32
33
    /**
34
     * DocumentService constructor.
35
     *
36
     * @param GeneralServiceType       $generalServiceType
37
     * @param SecurityServiceInterface $securityService
38
     */
39
    public function __construct(GeneralServiceType $generalServiceType, SecurityServiceInterface $securityService)
40
    {
41
        $this->securityService = $securityService;
42
        $this->generalServiceType = $generalServiceType;
43
    }
44
45
    /**
46
     * @param $orderReference
47
     * @param null $targetWebShop
48
     *
49
     * @return CheckoutResponse
50
     */
51
    public function getCheckoutUrl($orderReference, $targetWebShop = null)
52
    {
53
        $request = new BaseCheckoutRequestType(
54
            $this->securityService->getHash($orderReference),
55
            $this->generalServiceType->getWebShopId(),
56
            $targetWebShop,
57
            $orderReference
58
        );
59
60
        $response = $this->generalServiceType->checkout($request);
61
62
        return $this->processResponse($response, $this->generalServiceType);
63
    }
64
65
    /**
66
     * @param $orderReference
67
     * @param null $targetWebShop
68
     *
69
     * @return CheckoutStatusResponse
0 ignored issues
show
Bug introduced by
The type Etrias\PaazlConnector\Se...\CheckoutStatusResponse was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
70
     */
71
    public function getCheckoutStatus($orderReference, $targetWebShop = null)
72
    {
73
        $request = new BaseCheckoutRequestType(
74
            $this->securityService->getHash($orderReference),
75
            $this->generalServiceType->getWebShopId(),
76
            $targetWebShop,
77
            $orderReference
78
        );
79
80
        $response = $this->generalServiceType->checkoutStatus($request);
81
82
        return $this->processResponse($response, $this->generalServiceType);
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->processRes...is->generalServiceType) returns the type WsdlToPhp\PackageBase\Ab...Base\AbstractStructBase which is incompatible with the documented return type Etrias\PaazlConnector\Se...\CheckoutStatusResponse.
Loading history...
83
    }
84
}
85