Passed
Push — develop ( 176838...c67b25 )
by mingyoung
01:40
created

Client::parent()   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 1
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) mingyoung <[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\Department;
13
14
use EasyDingTalk\Kernel\BaseClient;
15
16
/**
17
 * Class Client.
18
 *
19
 * @author mingyoung <[email protected]>
20
 */
21
class Client extends BaseClient
22
{
23
    /**
24
     * Get department list.
25
     *
26
     * @param int $id
27
     *
28
     * @return array
29
     */
30
    public function list(int $id)
31
    {
32
        return $this->httpGet('department/list', compact('id'));
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->httpGet('d...t/list', compact('id')) also could return the type GuzzleHttp\Psr7\Response which is incompatible with the documented return type array.
Loading history...
33
    }
34
35
    /**
36
     * Get department detail.
37
     *
38
     * @param int $id
39
     *
40
     * @return array
41
     */
42
    public function get(int $id)
43
    {
44
        return $this->httpGet('department/get', compact('id'));
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->httpGet('d...nt/get', compact('id')) also could return the type GuzzleHttp\Psr7\Response which is incompatible with the documented return type array.
Loading history...
45
    }
46
47
    /**
48
     * Create a department.
49
     *
50
     * @param array $data
51
     *
52
     * @return array
53
     */
54
    public function create(array $data)
55
    {
56
        return $this->httpPostJson('department/create', $data);
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->httpPostJs...artment/create', $data) also could return the type GuzzleHttp\Psr7\Response which is incompatible with the documented return type array.
Loading history...
57
    }
58
59
    /**
60
     * Update a department.
61
     *
62
     * @param array $data
63
     *
64
     * @return array
65
     */
66
    public function update(array $data)
67
    {
68
        return $this->httpPostJson('department/update', $data);
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->httpPostJs...artment/update', $data) also could return the type GuzzleHttp\Psr7\Response which is incompatible with the documented return type array.
Loading history...
69
    }
70
71
    /**
72
     * Delete a department.
73
     *
74
     * @param int $id
75
     *
76
     * @return array
77
     */
78
    public function delete(int $id)
79
    {
80
        return $this->httpGet('department/delete', compact('id'));
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->httpGet('d...delete', compact('id')) also could return the type GuzzleHttp\Psr7\Response which is incompatible with the documented return type array.
Loading history...
81
    }
82
83
    /**
84
     * Get department parents by department id.
85
     *
86
     * @param int $id
87
     *
88
     * @return array
89
     */
90
    public function parent(int $id)
91
    {
92
        return $this->httpGet('department/list_parent_depts_by_dept', compact('id'));
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->httpGet('d...y_dept', compact('id')) also could return the type GuzzleHttp\Psr7\Response which is incompatible with the documented return type array.
Loading history...
93
    }
94
95
    /**
96
     * Get department parents by user id.
97
     *
98
     * @param string $userId
99
     *
100
     * @return array
101
     */
102
    public function userParent(string $userId)
103
    {
104
        return $this->httpGet('department/list_parent_depts', compact('userId'));
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->httpGet('d...ts', compact('userId')) also could return the type GuzzleHttp\Psr7\Response which is incompatible with the documented return type array.
Loading history...
105
    }
106
}
107