payments()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 4
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 9
rs 10
1
<?php
2
3
if (! function_exists('payments')) {
4
5
    /**
6
     * Return Payments interface.
7
     *
8
     * @param string|null $gateway
9
     *
10
     * @return \Nxmad\Larapay\Contracts\Payments|\Nxmad\Larapay\Abstracts\Gateway
11
     */
12
    function payments(string $gateway = null)
13
    {
14
        $payments = app(\Nxmad\Larapay\Contracts\Payments::class);
0 ignored issues
show
Bug introduced by
The function app was not found. Maybe you did not declare it correctly or list all dependencies? ( Ignorable by Annotation )

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

14
        $payments = /** @scrutinizer ignore-call */ app(\Nxmad\Larapay\Contracts\Payments::class);
Loading history...
15
16
        if (is_null($gateway)) {
17
            return $payments;
18
        }
19
20
        return $payments->gateway($gateway);
21
    }
22
}
23