Apps   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
c 1
b 0
f 0
dl 0
loc 39
ccs 10
cts 10
cp 1
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A get() 0 12 1
1
<?php
2
3
namespace CybozuHttp\Api\Kintone;
4
5
use CybozuHttp\Client;
6
use CybozuHttp\Api\KintoneApi;
7
use CybozuHttp\Middleware\JsonStream;
8
9
/**
10
 * @author ochi51 <[email protected]>
11
 */
12
class Apps
13
{
14
    public const MAX_GET_APPS = 100;
15
16
    /**
17
     * @var Client
18
     */
19
    private $client;
20
21 1
    public function __construct(Client $client)
22
    {
23 1
        $this->client = $client;
24
    }
25
26
    /**
27
     * Get apps
28
     * https://cybozudev.zendesk.com/hc/ja/articles/202931674#step2
29
     *
30
     * @param array $ids
31
     * @param array $codes
32
     * @param string $name
33
     * @param array $spaceIds
34
     * @param integer $limit
35
     * @param integer $offset
36
     * @param integer $guestSpaceId
37
     * @return array
38
     */
39 1
    public function get(array $ids = [], array $codes = [], $name = null, array $spaceIds = [], $limit = self::MAX_GET_APPS, $offset = 0, $guestSpaceId = null): array
40
    {
41 1
        $options = ['json' => compact('ids', 'codes', 'name', 'spaceIds')];
42 1
        $options['json']['limit'] = $limit;
43 1
        $options['json']['offset'] = $offset;
44
45
        /** @var JsonStream $stream */
46 1
        $stream = $this->client
47 1
            ->get(KintoneApi::generateUrl('apps.json', $guestSpaceId), $options)
48 1
            ->getBody();
49
50 1
        return $stream->jsonSerialize();
51
    }
52
53
54
}
55