Graph::get()   A
last analyzed

Complexity

Conditions 3
Paths 4

Size

Total Lines 18
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 14
CRAP Score 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
eloc 12
c 1
b 0
f 0
nc 4
nop 6
dl 0
loc 18
ccs 14
cts 14
cp 1
crap 3
rs 9.8666
1
<?php
2
3
namespace CybozuHttp\Api\Kintone;
4
5
use CybozuHttp\Client;
6
use CybozuHttp\Api\KintoneApi;
7
8
/**
9
 * @author ochi51 <[email protected]>
10
 */
11
class Graph
12
{
13
    /**
14
     * @var Client
15
     */
16
    private $client;
17
18 1
    public function __construct(Client $client)
19
    {
20 1
        $this->client = $client;
21
    }
22
23
    /**
24
     * @param integer $appId
25
     * @param integer $id
26
     * @param integer|null $guestSpaceId
27
     * @param bool $isIframe
28
     * @param bool $isShowTitle
29
     * @param array $options
30
     * @return string
31
     */
32 1
    public function get($appId, $id, $guestSpaceId = null, $isIframe = false, $isShowTitle = false, array $options = []): string
33
    {
34 1
        $url =  $guestSpaceId ? KintoneApi::GUEST_SPACE_PREFIX . $guestSpaceId . '/' : '/k/';
35 1
        $url .= $appId . '/report';
36 1
        if ($isIframe) {
37 1
            $url .= '/portlet';
38
        }
39
40 1
        $options = [
41 1
            'query' => [
42 1
                'report' => $id,
43 1
                'title' => $isShowTitle
44 1
            ]
45 1
        ] + $options;
46
47 1
        return (string)$this->client
48 1
            ->get($url, $options)
49 1
            ->getBody();
50
    }
51
}
52