Code Duplication    Length = 35-35 lines in 4 locations

src/Api/Coupon.php 1 location

@@ 18-52 (lines=35) @@
15
use Shapin\Stripe\Model\Coupon\CouponCollection;
16
use Symfony\Component\Config\Definition\Processor;
17
18
final class Coupon extends HttpApi
19
{
20
    /**
21
     * @throws Exception
22
     */
23
    public function get(string $id)
24
    {
25
        $response = $this->httpGet("coupons/$id");
26
27
        return $this->hydrator->hydrate($response, CouponModel::class);
28
    }
29
30
    /**
31
     * @throws Exception
32
     */
33
    public function all(array $params = [])
34
    {
35
        $response = $this->httpGet('coupons', $params);
36
37
        return $this->hydrator->hydrate($response, CouponCollection::class);
38
    }
39
40
    /**
41
     * @throws Exception
42
     */
43
    public function create(array $params)
44
    {
45
        $processor = new Processor();
46
        $params = $processor->processConfiguration(new Configuration\CouponCreate(), [$params]);
47
48
        $response = $this->httpPost('coupons', $params);
49
50
        return $this->hydrator->hydrate($response, CouponModel::class);
51
    }
52
}
53

src/Api/Refund.php 1 location

@@ 18-52 (lines=35) @@
15
use Shapin\Stripe\Model\Refund\RefundCollection;
16
use Symfony\Component\Config\Definition\Processor;
17
18
final class Refund extends HttpApi
19
{
20
    /**
21
     * @throws Exception
22
     */
23
    public function get(string $id)
24
    {
25
        $response = $this->httpGet("refunds/$id");
26
27
        return $this->hydrator->hydrate($response, RefundModel::class);
28
    }
29
30
    /**
31
     * @throws Exception
32
     */
33
    public function all(array $params = [])
34
    {
35
        $response = $this->httpGet('refunds', $params);
36
37
        return $this->hydrator->hydrate($response, RefundCollection::class);
38
    }
39
40
    /**
41
     * @throws Exception
42
     */
43
    public function create(array $params)
44
    {
45
        $processor = new Processor();
46
        $processor->processConfiguration(new Configuration\RefundCreate(), [$params]);
47
48
        $response = $this->httpPost('refunds', $params);
49
50
        return $this->hydrator->hydrate($response, RefundModel::class);
51
    }
52
}
53

src/Api/SetupIntent.php 1 location

@@ 18-52 (lines=35) @@
15
use Shapin\Stripe\Model\SetupIntent\SetupIntentCollection;
16
use Symfony\Component\Config\Definition\Processor;
17
18
final class SetupIntent extends HttpApi
19
{
20
    /**
21
     * @throws Exception
22
     */
23
    public function get(string $id)
24
    {
25
        $response = $this->httpGet("setup_intents/$id");
26
27
        return $this->hydrator->hydrate($response, SetupIntentModel::class);
28
    }
29
30
    /**
31
     * @throws Exception
32
     */
33
    public function all(array $params = [])
34
    {
35
        $response = $this->httpGet('setup_intents', $params);
36
37
        return $this->hydrator->hydrate($response, SetupIntentCollection::class);
38
    }
39
40
    /**
41
     * @throws Exception
42
     */
43
    public function create(array $params)
44
    {
45
        $processor = new Processor();
46
        $processor->processConfiguration(new Configuration\SetupIntentCreate(), [$params]);
47
48
        $response = $this->httpPost('setup_intents', $params);
49
50
        return $this->hydrator->hydrate($response, SetupIntentModel::class);
51
    }
52
}
53

src/Api/TaxRate.php 1 location

@@ 18-52 (lines=35) @@
15
use Shapin\Stripe\Model\TaxRate\TaxRateCollection;
16
use Symfony\Component\Config\Definition\Processor;
17
18
final class TaxRate extends HttpApi
19
{
20
    /**
21
     * @throws Exception
22
     */
23
    public function get(string $id)
24
    {
25
        $response = $this->httpGet("tax_rates/$id");
26
27
        return $this->hydrator->hydrate($response, TaxRateModel::class);
28
    }
29
30
    /**
31
     * @throws Exception
32
     */
33
    public function create(array $params)
34
    {
35
        $processor = new Processor();
36
        $processor->processConfiguration(new Configuration\TaxRateCreate(), [$params]);
37
38
        $response = $this->httpPost('tax_rates', $params);
39
40
        return $this->hydrator->hydrate($response, TaxRateModel::class);
41
    }
42
43
    /**
44
     * @throws Exception
45
     */
46
    public function all(array $params = [])
47
    {
48
        $response = $this->httpGet('tax_rates', $params);
49
50
        return $this->hydrator->hydrate($response, TaxRateCollection::class);
51
    }
52
}
53