Completed
Push — master ( 0579b1...8760fe )
by Hao
05:49 queued 02:57
created

make_btn()   A

Complexity

Conditions 3
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 3

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 3
eloc 3
c 1
b 0
f 1
nc 2
nop 2
dl 0
loc 6
ccs 3
cts 3
cp 1
crap 3
rs 9.4285
1
<?php
2
3
if (!function_exists('make_btn')) {
4
5
    /**
6
     * 生成 button 辅助函数
7
     *
8
     * @param string $title     按钮文案
9
     * @param string $actionURL 按钮跳转地址
10
     *
11
     * @return array
12
     */
13
    function make_btn($title, $actionURL)
14
    {
15 4
        if (!is_string($title) || !is_string($actionURL)) {
16 1
            throw new \InvalidArgumentException('wrong btn params');
17
        }
18 4
        return compact('title', 'actionURL');
19
    }
20
}
21
22
if (!function_exists('make_link')) {
23
24
    /**
25
     * 生成 link 辅助函数
26
     *
27
     * @param string $title      链接标题
28
     * @param string $messageURL 跳转链接
29
     * @param string $picURL     图片地址
30
     *
31
     * @return array
32
     */
33
    function make_link($title, $messageURL, $picURL)
34
    {
35 1
        if (!is_string($title) || !is_string($messageURL) || !is_string($picURL)) {
1 ignored issue
show
introduced by
The condition is_string($messageURL) is always true.
Loading history...
36 1
            throw new \InvalidArgumentException('wrong link params');
37
        }
38 1
        return compact('title', 'messageURL', 'picURL');
39
    }
40
}