Completed
Push — master ( fe3adb...475fd8 )
by Yuichi
10s
created

Graph   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 1
cbo 2
dl 0
loc 41
ccs 14
cts 14
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A get() 0 19 3
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 1
    }
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
        $options = [
41
            'query' => [
42 1
                'report' => $id,
43 1
                'title' => $isShowTitle
44
            ]
45 1
        ] + $options;
46
47 1
        return (string)$this->client
48 1
            ->get($url, $options)
49 1
            ->getBody();
50
    }
51
}
52