Transaction::all()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 4
loc 4
ccs 2
cts 2
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\Pagination;
18
use PhpMob\Omise\Domain\Transaction as Domain;
19
20
/**
21
 * @author Saranyu <[email protected]>
22
 *
23
 * @see https://www.omise.co/transactions-api
24
 */
25 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...
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', '/transactions', $parameters);
35
    }
36
37
    /**
38
     * @param string $id
39
     *
40
     * @return Domain
41
     */
42 3
    public function find($id)
43
    {
44 3
        self::assertNotEmpty($id);
45
46 2
        return $this->doRequest('GET', '/transactions/' . $id);
47
    }
48
49
    /**
50
     * @param Domain $transaction
51
     */
52 1
    public function refresh(Domain $transaction)
53
    {
54 1
        $transaction->updateStore($this->find($transaction->id)->toArray());
55 1
    }
56
}
57