GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 134146...83d859 )
by Niels
11:03
created

OrderRequest   A

Complexity

Total Complexity 13

Size/Duplication

Total Lines 79
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 13
c 1
b 0
f 0
lcom 1
cbo 3
dl 0
loc 79
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A show() 0 6 1
B create() 0 16 7
A createDirectOrder() 0 13 4
A createRedirectOrder() 0 6 1
1
<?php namespace Ntholenaar\MultiSafepayClient\Request;
2
3
use Ntholenaar\MultiSafepayClient\Exception\InvalidRequestException;
4
5
class OrderRequest extends Request
6
{
7
    /**
8
     * {@inheritdoc}
9
     */
10
    protected $baseUrl = 'orders';
11
12
    /**
13
     * Show order.
14
     *
15
     * @param $identifier
16
     * @return \Psr\Http\Message\RequestInterface
17
     */
18
    public function show($identifier)
19
    {
20
        return $this->get(
21
            $this->uriFactory->createUri($this->getBaseUrl() . '/'. $identifier)
22
        );
23
    }
24
25
    /**
26
     * Create order.
27
     *
28
     * @param array $parameters
29
     * @throws InvalidRequestException
30
     * @return \Psr\Http\Message\RequestInterface
31
     */
32
    public function create(array $parameters)
33
    {
34
        $uri = $this->uriFactory->createUri($this->getBaseUrl());
35
36
        if (! array_key_exists('amount', $parameters) ||
37
            ! array_key_exists('currency', $parameters) ||
38
            ! array_key_exists('description', $parameters) ||
39
            ! array_key_exists('order_id', $parameters) ||
40
            ! array_key_exists('payment_options', $parameters) ||
41
            ! array_key_exists('type', $parameters)
42
        ) {
43
            throw new InvalidRequestException('Missing required parameters.');
44
        }
45
46
        return $this->post($uri, array(), $parameters);
47
    }
48
49
    /**
50
     * Create an direct order.
51
     *
52
     * @param array $parameters
53
     * @throws InvalidRequestException
54
     * @return \Psr\Http\Message\RequestInterface
55
     */
56
    public function createDirectOrder(array $parameters)
57
    {
58
        $parameters['type'] = 'direct';
59
60
        if (! array_key_exists('gateway', $parameters) ||
61
            ! array_key_exists('gateway_info', $parameters) ||
62
            ! array_key_exists('issuer_id', $parameters)
63
        ) {
64
            throw new InvalidRequestException('Missing required parameters.');
65
        }
66
67
        return $this->create($parameters);
68
    }
69
70
    /**
71
     * Create an redirect order.
72
     *
73
     * @param array $parameters
74
     * @throws InvalidRequestException
75
     * @return \Psr\Http\Message\RequestInterface
76
     */
77
    public function createRedirectOrder(array $parameters)
78
    {
79
        $parameters['type'] = 'redirect';
80
81
        return $this->create($parameters);
82
    }
83
}
84