Passed
Pull Request — master (#77)
by Yuichi
04:41 queued 02:24
created

Graph   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Test Coverage

Coverage 12.5%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A get() 0 18 3
A __construct() 0 3 1
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
    public function get($appId, $id, $guestSpaceId = null, $isIframe = false, $isShowTitle = false, array $options = []): string
33
    {
34
        $url =  $guestSpaceId ? KintoneApi::GUEST_SPACE_PREFIX . $guestSpaceId . '/' : '/k/';
35
        $url .= $appId . '/report';
36
        if ($isIframe) {
37
            $url .= '/portlet';
38
        }
39
40
        $options = [
41
            'query' => [
42
                'report' => $id,
43
                'title' => $isShowTitle
44
            ]
45
        ] + $options;
46
47
        return (string)$this->client
48
            ->get($url, $options)
49
            ->getBody();
50
    }
51
}
52