payments_gateways()   A
last analyzed

Complexity

Conditions 3
Paths 4

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 12

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
eloc 4
c 1
b 0
f 0
nc 4
nop 0
dl 0
loc 8
rs 10
ccs 0
cts 4
cp 0
crap 12
1
<?php
2
3
use ByTIC\Payments\Gateways\Manager as GatewaysManager;
4
use Nip\Container\Container;
5
6
if (!function_exists('payments_gateways')) {
7
    /**
8
     * @return GatewaysManager
9
     */
10
    function payments_gateways(): GatewaysManager
11
    {
12
        $container = function_exists('app') ? app() : Container::getInstance();
13
14
        if ($container->has('payments.gateways')) {
15
            return $container->get('payments.gateways');
16
        }
17
        return new GatewaysManager();
18
    }
19
}
20