Completed
Pull Request — master (#36)
by
unknown
08:22
created

Form   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 4
dl 0
loc 32
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A get() 0 11 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
 *
11
 */
12
class Form
13
{
14
    /**
15
     * @var Client
16
     */
17
    private $client;
18
19
    public function __construct(Client $client)
20
    {
21
        $this->client = $client;
22
    }
23
24
    /**
25
     * Get form
26
     * https://developer.cybozu.io/hc/ja/articles/201941834
27
     *
28
     * @param integer $app
29
     * @param integer $guestSpaceId
30
     * @return array
31
     */
32
    public function get($app, $guestSpaceId = null)
33
    {
34
        $options = ['json' => ['app' => $app]];
35
36
        /** @var JsonStream $stream */
37
        $stream = $this->client
38
            ->get(KintoneApi::generateUrl('form.json', $guestSpaceId), $options)
39
            ->getBody();
40
41
        return $stream->jsonSerialize();
42
    }
43
}
44