Passed
Pull Request — master (#777)
by Mark van den
11:22 queued 07:43
created

helpers.php ➔ activity()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 10
ccs 5
cts 5
cp 1
crap 1
rs 9.9332
c 0
b 0
f 0
1
<?php
2
3
use Spatie\Activitylog\ActivityLogger;
4
use Spatie\Activitylog\ActivityLogStatus;
5
6
if (! function_exists('activity')) {
7
    function activity(string $logName = null): ActivityLogger
8
    {
9 132
        $defaultLogName = config('activitylog.default_log_name');
10
11 132
        $logStatus = app(ActivityLogStatus::class);
12
13 132
        return app(ActivityLogger::class)
14 132
            ->useLog($logName ?? $defaultLogName)
15 132
            ->setLogStatus($logStatus);
16
    }
17
}
18