Completed
Push — master ( 8f5b55...c52b56 )
by frey
04:17 queued 01:50
created

Batch::getResult()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 8
rs 9.4285
1
<?php
2
3
namespace EntWeChat\User;
4
5
use EntWeChat\Core\AbstractAPI;
6
7
class Batch extends AbstractAPI
8
{
9
    const API_SYNC_USER = 'https://qyapi.weixin.qq.com/cgi-bin/batch/syncuser';
10
    const API_REPLACE_USER = 'https://qyapi.weixin.qq.com/cgi-bin/batch/replaceuser';
11
    const API_REPLACE_PARTY = 'https://qyapi.weixin.qq.com/cgi-bin/batch/replaceparty';
12
    const API_GET_RESULT = 'https://qyapi.weixin.qq.com/cgi-bin/batch/getresult';
13
14
    /**
15
     * Batch sync user.
16
     *
17
     * @param       $mediaId
18
     * @param array $callback
19
     *
20
     * @return \EntWeChat\Support\Collection
21
     */
22 View Code Duplication
    public function batchSyncUser($mediaId, $callback = [])
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
23
    {
24
        $params = [
25
            'media_id' => $mediaId,
26
            'callback' => $callback,
27
        ];
28
29
        return $this->parseJSON('json', [self::API_SYNC_USER, $params]);
30
    }
31
32
    /**
33
     * Batch replace user.
34
     *
35
     * @param       $mediaId
36
     * @param array $callback
37
     *
38
     * @return \EntWeChat\Support\Collection
39
     */
40 View Code Duplication
    public function batchReplaceUser($mediaId, $callback = [])
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
41
    {
42
        $params = [
43
            'media_id' => $mediaId,
44
            'callback' => $callback,
45
        ];
46
47
        return $this->parseJSON('json', [self::API_REPLACE_USER, $params]);
48
    }
49
50
    /**
51
     * Batch replace party.
52
     *
53
     * @param       $mediaId
54
     * @param array $callback
55
     *
56
     * @return \EntWeChat\Support\Collection
57
     */
58 View Code Duplication
    public function batchReplaceParty($mediaId, $callback = [])
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
59
    {
60
        $params = [
61
            'media_id' => $mediaId,
62
            'callback' => $callback,
63
        ];
64
65
        return $this->parseJSON('json', [self::API_REPLACE_PARTY, $params]);
66
    }
67
68
    /**
69
     * Get result.
70
     *
71
     * @param $jobId
72
     *
73
     * @return \EntWeChat\Support\Collection
74
     */
75
    public function getResult($jobId)
76
    {
77
        $params = [
78
            'jobid' => $jobId,
79
        ];
80
81
        return $this->parseJSON('get', [self::API_GET_RESULT, $params]);
82
    }
83
}
84