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

activity()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 3
Bugs 0 Features 0
Metric Value
cc 1
eloc 5
c 3
b 0
f 0
nc 1
nop 1
dl 0
loc 9
ccs 5
cts 5
cp 1
crap 1
rs 10
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