Completed
Push — master ( 6d9ae5...9656aa )
by
18:43 queued 08:49
created

Transaction::refresh()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Importance

Changes 0
Metric Value
dl 4
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 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
namespace PhpMob\Omise\Api;
13
14
use PhpMob\Omise\Api;
15
use PhpMob\Omise\Domain\Transaction as Domain;
16
use PhpMob\Omise\Domain\Pagination;
17
18
/**
19
 * @author Saranyu <[email protected]>
20
 *
21
 * @see https://www.omise.co/transactions-api
22
 */
23 View Code Duplication
final class Transaction extends Api
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
24
{
25
    /**
26
     * @param array $parameters
27
     *
28
     * @return Pagination
29
     */
30
    public function all(array $parameters = [])
31
    {
32
        return $this->doRequest('GET', '/transactions', $parameters);
33
    }
34
35
    /**
36
     * @param string $id
37
     *
38
     * @return Domain
39
     */
40
    public function find($id)
41
    {
42
        self::assertNotEmpty($id);
43
44
        return $this->doRequest('GET', '/transactions/'.$id);
45
    }
46
47
    /**
48
     * @param Domain $transaction
49
     */
50
    public function refresh(Domain $transaction)
51
    {
52
        $transaction->updateStore($this->find($transaction->id)->toArray());
53
    }
54
}
55