Issues (36)

src/Traits/PayPalAPI/InvoicesSearch.php (2 issues)

Labels
1
<?php
2
3
namespace Srmklive\PayPal\Traits\PayPalAPI;
4
5
use Srmklive\PayPal\Traits\PayPalAPI\InvoiceSearch\Filters;
6
7
trait InvoicesSearch
8
{
9
    use Filters;
10
11
    /**
12
     * Search and return existing invoices.
13
     *
14
     * @throws \Throwable
15
     *
16
     * @return array|\Psr\Http\Message\StreamInterface|string
17
     *
18
     * @see https://developer.paypal.com/docs/api/invoicing/v2/#invoices_list
19
     */
20
    public function searchInvoices()
21
    {
22
        if (collect($this->invoice_search_filters)->count() < 1) {
0 ignored issues
show
$this->invoice_search_filters of type array is incompatible with the type Illuminate\Contracts\Support\Arrayable expected by parameter $value of collect(). ( Ignorable by Annotation )

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

22
        if (collect(/** @scrutinizer ignore-type */ $this->invoice_search_filters)->count() < 1) {
Loading history...
23
            $this->invoice_search_filters = [
24
                'currency_code' => $this->getCurrency(),
0 ignored issues
show
It seems like getCurrency() 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
                'currency_code' => $this->/** @scrutinizer ignore-call */ getCurrency(),
Loading history...
25
            ];
26
        }
27
28
        $this->apiEndPoint = "v2/invoicing/search-invoices?page={$this->current_page}&page_size={$this->page_size}&total_required={$this->show_totals}";
29
30
        $this->options['json'] = $this->invoice_search_filters;
31
32
        $this->verb = 'post';
33
34
        return $this->doPayPalRequest();
35
    }
36
}
37