V0id   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 13
dl 0
loc 56
ccs 13
cts 13
cp 1
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A serialize() 0 9 1
A getTransactionId() 0 3 1
A __construct() 0 4 1
A getTerminalType() 0 3 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: WilliamWard
5
 * Date: 8/6/2018
6
 * Time: 3:17 PM
7
 */
8
9
namespace GivePay\Gateway\Transactions;
10
11
12
final class V0id
13
{
14
15
    /**
16
     * @var string The type of terminal
17
     */
18
    private $terminal_type = 'com.givepay.terminal-types.ecommerce';
19
20
    /**
21
     * @var string The ID of the transactions to void
22
     */
23
    private $transaction_id;
24
25
    /**
26
     * Void constructor.
27
     * @param string $terminal_type
28
     * @param string $transaction_id
29
     */
30 2
    public function __construct(string $terminal_type, string $transaction_id)
31
    {
32 2
        $this->terminal_type = $terminal_type;
33 2
        $this->transaction_id = $transaction_id;
34 2
    }
35
36
    /**
37
     * Serializes the void into a GPG request
38
     * @param string $merchant_id
39
     * @param string $terminal_id
40
     * @return array
41
     */
42 1
    public function serialize($merchant_id, $terminal_id)
43
    {
44
        return array(
45 1
            'mid' => $merchant_id,
46
            'terminal' => array(
47 1
                'tid' => $terminal_id,
48 1
                'terminal_type' => $this->getTerminalType()
49
            ),
50 1
            'transaction_id' => $this->getTransactionId()
51
        );
52
    }
53
54
    /**
55
     * @return string
56
     */
57 1
    public function getTerminalType(): string
58
    {
59 1
        return $this->terminal_type;
60
    }
61
62
    /**
63
     * @return string
64
     */
65 1
    public function getTransactionId(): string
66
    {
67 1
        return $this->transaction_id;
68
    }
69
}