ding()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 13
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
eloc 7
nc 3
nop 0
dl 0
loc 13
rs 10
c 1
b 0
f 0
1
<?php
2
3
use DingNotice\DingTalk;
4
5
if (!function_exists('ding')){
6
7
    /**
8
     * @return bool|DingTalk
9
     */
10
    function ding(){
11
12
        $arguments = func_get_args();
13
14
        $dingTalk = app(DingTalk::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
        $dingTalk = /** @scrutinizer ignore-call */ app(DingTalk::class);
Loading history...
15
16
        if (empty($arguments)) {
17
            return $dingTalk;
18
        }
19
20
        if (is_string($arguments[0])) {
21
            $robot = $arguments[1] ?? 'default';
22
            return $dingTalk->with($robot)->text($arguments[0]);
23
        }
24
25
    }
26
}