Completed
Push — master ( ba6533...24d46d )
by Olivier
02:23
created

Card::create()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
crap 1
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 Shapin\Stripe\Exception;
13
use Shapin\Stripe\Model\Card\Card as CardModel;
14
use Shapin\Stripe\Model\Card\CardCollection;
15
16
final class Card extends HttpApi
17
{
18
    /**
19
     * @throws Exception
20
     */
21 1
    public function get(string $customerId, string $cardId)
22
    {
23 1
        $response = $this->httpGet("customers/$customerId/cards/$cardId");
24
25 1
        return $this->hydrator->hydrate($response, CardModel::class);
26
    }
27
28
    /**
29
     * @throws Exception
30
     */
31 1
    public function all(string $customerId, array $params = [])
32
    {
33 1
        $response = $this->httpGet("customers/$customerId/cards", $params);
34
35 1
        return $this->hydrator->hydrate($response, CardCollection::class);
36
    }
37
38
    /**
39
     * @throws Exception
40
     */
41 1
    public function create(string $customerId, array $params)
42
    {
43 1
        $response = $this->httpPost("customers/$customerId/cards", $params);
44
45 1
        return $this->hydrator->hydrate($response, CardModel::class);
46
    }
47
}
48