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.

Orders::createRedirectOrder()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
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
            throw new \InvalidArgumentException('Invalid data provided.');
41
        }
42
43
        return $this->create($params);
44
    }
45
46
    /**
47
     * Create order.
48
     *
49
     * @param array $params
50
     * @return Object
51
     */
52
    public function create(array $params)
53
    {
54
        if (!array_key_exists('amount', $params) ||
55
            !array_key_exists('currency', $params) ||
56
            !array_key_exists('description', $params) ||
57
            !array_key_exists('order_id', $params) ||
58
            !array_key_exists('payment_options', $params) ||
59
            !array_key_exists('type', $params)
60
        ) {
61
            throw new \InvalidArgumentException('Invalid data provided.');
62
        }
63
64
        return $this->post('/orders', [], $params);
65
    }
66
}
67