Issues (30)

src/LaravelBitpay.php (1 issue)

1
<?php
2
3
namespace Vrajroham\LaravelBitpay;
4
5
use BitPaySDK\Model\Bill\Item;
6
use BitPaySDK\Model\Currency;
7
use BitPaySDK\Model\Invoice\Buyer;
8
use BitPaySDK\Model\Invoice\Invoice;
9
use Vrajroham\LaravelBitpay\Traits\LaravelBitpayTrait;
10
11
class LaravelBitpay
12
{
13
    use LaravelBitpayTrait;
14
    public $client;
15
    public $config;
16
17
    /**
18
     * LaravelBitpay constructor.
19
     */
20
    public function __construct()
21
    {
22
        $this->authenticate();
23
    }
24
25
    /**
26
     * @return \BitPaySDK\Model\Invoice\Invoice
27
     */
28
    public static function Invoice(): Invoice
29
    {
30
        return new Invoice();
31
    }
32
33
    /**
34
     * @param \BitPaySDK\Model\Invoice\Invoice $invoice
35
     *
36
     * @return \BitPaySDK\Model\Invoice\Invoice
37
     */
38
    public static function createInvoice(Invoice $invoice): Invoice
39
    {
40
        if ('' == $invoice->getNotificationURL()) {
41
            $invoice->setNotificationURL(route('laravel-bitpay.webhook.capture'));
42
        }
43
44
        return (new self())->client->createInvoice($invoice);
45
    }
46
47
    /**
48
     * @return \BitPaySDK\Model\Bill\Item
49
     */
50
    public static function Item(): Item
51
    {
52
        return new Item();
53
    }
54
55
    /**
56
     * @return \BitPaySDK\Model\Invoice\Buyer
57
     */
58
    public static function Buyer(): Buyer
59
    {
60
        return new Buyer();
61
    }
62
63
    /**
64
     * @param null $code
65
     *
66
     * @return \Bitpay\Model\Currency
67
     */
68
    public static function Currency($code = null): Currency
69
    {
70
        return new Currency($code);
0 ignored issues
show
The call to BitPaySDK\Model\Currency::__construct() has too many arguments starting with $code. ( Ignorable by Annotation )

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

70
        return /** @scrutinizer ignore-call */ new Currency($code);

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
71
    }
72
}
73