Completed
Push — master ( a1e88d...bdfee2 )
by Olivier
07:21
created

Refund::handleErrors()   A

Complexity

Conditions 4
Paths 4

Size

Total Lines 14

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 20

Importance

Changes 0
Metric Value
dl 0
loc 14
ccs 0
cts 9
cp 0
rs 9.7998
c 0
b 0
f 0
cc 4
nc 4
nop 1
crap 20
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This software may be modified and distributed under the terms
7
 * of the MIT license. See the LICENSE file for details.
8
 */
9
10
namespace Shapin\Stripe\Api;
11
12
use Psr\Http\Message\ResponseInterface;
13
use Shapin\Stripe\Configuration;
14
use Shapin\Stripe\Exception;
15
use Shapin\Stripe\Exception\Domain\Refund as RefundExceptions;
16
use Shapin\Stripe\Model\Refund\Refund as RefundModel;
17
use Shapin\Stripe\Model\Refund\RefundCollection;
18
use Symfony\Component\Config\Definition\Processor;
19
20 View Code Duplication
final class Refund extends HttpApi
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...
21
{
22
    /**
23
     * @throws Exception
24
     */
25 1
    public function get(string $id)
26
    {
27 1
        $response = $this->httpGet("/v1/refunds/$id");
28
29 1
        return $this->hydrator->hydrate($response, RefundModel::class);
30
    }
31
32
    /**
33 1
     * @throws Exception
34
     */
35
    public function all(array $params = [])
36
    {
37
        $response = $this->httpGet('/v1/refunds', $params);
38
39 1
        return $this->hydrator->hydrate($response, RefundCollection::class);
40
    }
41 1
42
    /**
43 1
     * @throws Exception
44
     */
45
    public function create(array $params)
46
    {
47 1
        $processor = new Processor();
48
        $processor->processConfiguration(new Configuration\RefundCreate(), [$params]);
49
50
        $response = $this->httpPost('/v1/refunds', $params);
51
52
        return $this->hydrator->hydrate($response, RefundModel::class);
53
    }
54
}
55