Dispute::refresh()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php
2
3
/*
4
 * This file is part of the PhpMob package.
5
 *
6
 * (c) Ishmael Doss <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace PhpMob\Omise\Api;
15
16
use PhpMob\Omise\Api;
17
use PhpMob\Omise\Domain\Dispute as Domain;
18
use PhpMob\Omise\Domain\Pagination;
19
20
/**
21
 * @author Saranyu <[email protected]>
22
 *
23
 * @see https://www.omise.co/disputes-api
24
 */
25
final class Dispute extends Api
26
{
27
    /**
28
     * @param array $parameters
29
     *
30
     * @return Pagination
31
     */
32 1
    public function all(array $parameters = [])
33
    {
34 1
        return $this->doRequest('GET', '/disputes', $parameters);
35
    }
36
37
    /**
38
     * @param array $parameters
39
     *
40
     * @return Pagination
41
     */
42 1
    public function opens(array $parameters = [])
43
    {
44 1
        return $this->doRequest('GET', '/disputes/open', $parameters);
45
    }
46
47
    /**
48
     * @param array $parameters
49
     *
50
     * @return Pagination
51
     */
52 1
    public function pendings(array $parameters = [])
53
    {
54 1
        return $this->doRequest('GET', '/disputes/pending', $parameters);
55
    }
56
57
    /**
58
     * @param array $parameters
59
     *
60
     * @return Pagination
61
     */
62 1
    public function closeds(array $parameters = [])
63
    {
64 1
        return $this->doRequest('GET', '/disputes/closed', $parameters);
65
    }
66
67
    /**
68
     * @param string $id
69
     *
70
     * @return Domain
71
     */
72 4
    public function find($id)
73
    {
74 4
        self::assertNotEmpty($id);
75
76 3
        return $this->doRequest('GET', '/disputes/' . $id);
77
    }
78
79
    /**
80
     * @param Domain $dispute
81
     */
82 1
    public function refresh(Domain $dispute)
83
    {
84 1
        $dispute->updateStore($this->find($dispute->id)->toArray());
85 1
    }
86
87
    /**
88
     * @param Domain $dispute
89
     */
90 1
    public function update(Domain $dispute)
91
    {
92 1
        self::assertNotEmpty($dispute->id);
93
94 1
        $dispute->updateStore($this->doRequest('PATCH', '/disputes/' . $dispute->id, $dispute->getUpdateData())->toArray());
95 1
    }
96
}
97