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 ( 5d4e73...25e621 )
by Niels
03:58
created

Orders   A

Complexity

Total Complexity 13

Size/Duplication

Total Lines 67
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 13
lcom 1
cbo 1
dl 0
loc 67
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A show() 0 4 1
A createRedirectOrder() 0 6 1
A createDirectOrder() 0 13 4
B create() 0 14 7
1
<?php namespace Ntholenaar\MultiSafepayClient\Api;
2
3
class Orders extends AbstractApi
4
{
5
    /**
6
     * Show order.
7
     *
8
     * @param $identifier
9
     * @return Object|null
10
     */
11
    public function show($identifier)
12
    {
13
        return $this->get('/orders' . rawurlencode($identifier));
14
    }
15
16
    /**
17
     * Create an redirect order.
18
     *
19
     * @param array $params
20
     * @return Object
21
     */
22
    public function createRedirectOrder(array $params)
23
    {
24
        $params['type'] = 'redirect';
25
26
        return $this->create($params);
27
    }
28
29
    /**
30
     * Create direct order.
31
     *
32
     * @param array $params
33
     * @return Object
34
     */
35
    public function createDirectOrder(array $params)
36
    {
37
        $params['type'] = 'direct';
38
39
        if (! array_key_exists('gateway', $params) ||
40
            ! array_key_exists('gateway_info', $params) ||
41
            ! array_key_exists('issuer_id', $params)
42
        ) {
43
            throw new \InvalidArgumentException('Invalid data provided.');
44
        }
45
46
        return $this->create($params);
47
    }
48
49
    /**
50
     * Create order.
51
     *
52
     * @param array $params
53
     * @return Object
54
     */
55
    public function create(array $params)
56
    {
57
        if (! array_key_exists('amount', $params) ||
58
            ! array_key_exists('currency', $params) ||
59
            ! array_key_exists('description', $params) ||
60
            ! array_key_exists('order_id', $params) ||
61
            ! array_key_exists('payment_options', $params) ||
62
            ! array_key_exists('type', $params)
63
        ) {
64
            throw new \InvalidArgumentException('Invalid data provided.');
65
        }
66
67
        return $this->post('/orders', [], $params);
68
    }
69
}
70