Passed
Push — master ( 265add...662b8b )
by Morten Poul
02:27
created

ManagesShopifyPayments::getTransactionsCount()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 2
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Signifly\Shopify\REST\Actions;
4
5
use Illuminate\Support\Collection;
6
use Signifly\Shopify\REST\Resources\BalanceResource;
7
use Signifly\Shopify\REST\Resources\DisputeResource;
8
use Signifly\Shopify\REST\Resources\TransactionResource;
9
use Signifly\Shopify\REST\Resources\PayoutResource;
10
use Signifly\Shopify\Shopify;
11
12
/** @mixin Shopify */
13
trait ManagesShopifyPayments
14
{
15
    public function getBalance(): BalanceResource
16
    {
17
        $response = $this->get('shopify_payments/balance');
0 ignored issues
show
Bug introduced by
It seems like get() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

17
        /** @scrutinizer ignore-call */ 
18
        $response = $this->get('shopify_payments/balance');
Loading history...
18
19
        return new BalanceResource($response['balance'], $this);
20
    }
21
22
    public function getDisputes(array $params = []): Collection
23
    {
24
        return $this->getResources('disputes', $params, ['shopify_payments']);
0 ignored issues
show
Bug introduced by
It seems like getResources() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

24
        return $this->/** @scrutinizer ignore-call */ getResources('disputes', $params, ['shopify_payments']);
Loading history...
25
    }
26
27
    public function getDispute($disputeId): DisputeResource
28
    {
29
        return $this->getResource('disputes', $disputeId, ['shopify_payments']);
0 ignored issues
show
Bug introduced by
It seems like getResource() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

29
        return $this->/** @scrutinizer ignore-call */ getResource('disputes', $disputeId, ['shopify_payments']);
Loading history...
30
    }
31
32
    public function getPayouts(array $params = []): Collection
33
    {
34
        return $this->getResources('payouts', $params, ['shopify_payments']);
35
    }
36
37
    public function getPayout($payoutId): PayoutResource
38
    {
39
        return $this->getResource('payouts', $payoutId, ['shopify_payments']);
40
    }
41
42
    public function createTransaction($orderId, array $data = [])
43
    {
44
        return $this->createResource('transactions', $data, ['shopify_payments', 'orders', $orderId]);
0 ignored issues
show
Bug introduced by
It seems like createResource() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

44
        return $this->/** @scrutinizer ignore-call */ createResource('transactions', $data, ['shopify_payments', 'orders', $orderId]);
Loading history...
45
    }
46
47
    public function getTransactions($orderId, array $params = []): Collection
48
    {
49
        return $this->getResources('transactions', $params, ['shopify_payments', 'orders', $orderId]);
50
    }
51
52
    public function getTransaction($transactionId, $orderId): TransactionResource
53
    {
54
        return $this->getResource('transactions', $transactionId, ['shopify_payments', 'orders', $orderId]);
55
    }
56
57
    public function getTransactionsCount($orderId, array $params = []): int
58
    {
59
        return $this->getResourceCount('transactions', $params, ['shopify_payments', 'orders', $orderId]);
0 ignored issues
show
Bug introduced by
It seems like getResourceCount() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

59
        return $this->/** @scrutinizer ignore-call */ getResourceCount('transactions', $params, ['shopify_payments', 'orders', $orderId]);
Loading history...
60
    }
61
}
62