Passed
Push — master ( 6b7ce6...e487de )
by mingyoung
02:11 queued 10s
created

Client::groups()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 2
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
/*
4
 * This file is part of the mingyoung/dingtalk.
5
 *
6
 * (c) 张铭阳 <[email protected]>
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace EasyDingTalk\Attendance;
13
14
use EasyDingTalk\Kernel\BaseClient;
15
16
class Client extends BaseClient
17
{
18
    /**
19
     * 企业考勤排班详情
20
     *
21
     * @param string   $date
22
     * @param int|null $offset
23
     * @param int|null $size
24
     *
25
     * @return mixed
26
     */
27
    public function schedules($date, $offset = null, $size = null)
28
    {
29
        return $this->client->postJson('topapi/attendance/listschedule', [
30
            'workDate' => $date, 'offset' => $offset, 'size' => $size,
31
        ]);
32
    }
33
34
    /**
35
     * 企业考勤组详情
36
     *
37
     * @param int|null $offset
38
     * @param int|null $size
39
     *
40
     * @return mixed
41
     */
42
    public function groups($offset = null, $size = null)
43
    {
44
        return $this->client->postJson('topapi/attendance/getsimplegroups', compact('offset', 'size'));
45
    }
46
47
    /**
48
     * 获取用户考勤组
49
     *
50
     * @param string $userId
51
     *
52
     * @return mixed
53
     */
54
    public function userGroup($userId)
0 ignored issues
show
Unused Code introduced by
The parameter $userId is not used and could be removed. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-unused  annotation

54
    public function userGroup(/** @scrutinizer ignore-unused */ $userId)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
55
    {
56
        return $this->client->postJson('topapi/attendance/getusergroup');
57
    }
58
59
    /**
60
     * 获取打卡详情
61
     *
62
     * @param array $params
63
     *
64
     * @return mixed
65
     */
66
    public function records($params)
67
    {
68
        return $this->client->postJson('attendance/listRecord', $params);
69
    }
70
71
    /**
72
     * 获取打卡结果
73
     *
74
     * @param array $params
75
     *
76
     * @return mixed
77
     */
78
    public function results($params)
79
    {
80
        return $this->client->postJson('attendance/list', $params);
81
    }
82
83
    /**
84
     * 获取请假时长
85
     *
86
     * @param string $userId
87
     * @param string $from
88
     * @param string $to
89
     *
90
     * @return mixed
91
     */
92
    public function duration($userId, $from, $to)
93
    {
94
        return $this->client->postJson('topapi/attendance/getleaveapproveduration', [
95
            'userid' => $userId, 'from_date' => $from, 'to_date' => $to,
96
        ]);
97
    }
98
99
    /**
100
     * 查询请假状态
101
     *
102
     * @param array $params
103
     *
104
     * @return mixed
105
     */
106
    public function status($params)
107
    {
108
        return $this->client->postJson('topapi/attendance/getleavestatus', $params);
109
    }
110
}
111