Test Setup Failed
Push — master ( f749ef...c6b244 )
by Ilham
01:56
created

Client   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 27
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A listIds() 0 3 1
A list() 0 8 1
1
<?php
2
/**
3
 * This file is part of the dingtalk.
4
 * User: Ilham Tahir <[email protected]>
5
 * This source file is subject to the MIT license that is bundled
6
 * with this source code in the file LICENSE.
7
 */
8
9
namespace Aplisin\DingTalk\Department;
10
11
use Aplisin\DingTalk\Kernel\BaseClient;
12
13
class Client extends BaseClient
14
{
15
    /**
16
     * @param int $id
17
     * @return \Aplisin\DingTalk\Kernel\Http\Response|\Aplisin\DingTalk\Kernel\Support\Collection|array|mixed|\Psr\Http\Message\ResponseInterface
18
     * @throws \GuzzleHttp\Exception\GuzzleException
19
     */
20
    public function listIds($id = 1)
21
    {
22
        return $this->httpGet('/department/list_ids', compact('id'));
23
    }
24
25
    /**
26
     * @param int $id
27
     * @param bool $fetchChild
28
     * @param string $lang
29
     * @return \Aplisin\DingTalk\Kernel\Http\Response|\Aplisin\DingTalk\Kernel\Support\Collection|array|mixed|\Psr\Http\Message\ResponseInterface
30
     * @throws \GuzzleHttp\Exception\GuzzleException
31
     */
32
    public function list($id = 1, $fetchChild = false, $lang = 'zh_CN')
33
    {
34
        $params = [
35
            'id' => $id,
36
            'fetch_child' => $fetchChild,
37
            'lang' => $lang
38
        ];
39
        return $this->httpGet('/department/list', $params);
40
    }
41
}
42