Completed
Push — 3.x ( e32815...7c4255 )
by Ryota
09:26 queued 05:13
created

IncomingRequests::reject()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Polidog\Chatwork\Api;
6
7
use Polidog\Chatwork\Client\ClientInterface;
8
use Polidog\Chatwork\Entity\Factory\IncomingRequestsFactory;
9
10
class IncomingRequests
11
{
12
    /**
13
     * @var ClientInterface
14
     */
15
    private $client;
16
17
    /**
18
     * @var IncomingRequestsFactory
19
     */
20
    private $factory;
21
22
    /**
23
     * IncomingRequests constructor.
24
     *
25
     * @param ClientInterface         $client
26
     * @param IncomingRequestsFactory $factory
27
     */
28
    public function __construct(ClientInterface $client, IncomingRequestsFactory $factory)
29
    {
30
        $this->client = $client;
31
        $this->factory = $factory;
32
    }
33
34
    public function show()
35
    {
36
        return $this->factory->collection(
37
            $this->client->get('incoming_requests')
38
        );
39
    }
40
41
    public function accept($requestId)
42
    {
43
        return $this->factory->entity(
44
            $this->client->put("incoming_requests/{$requestId}")
45
        );
46
    }
47
48
    public function reject($requestId)
49
    {
50
        $this->client->delete("incoming_requests/{$requestId}");
51
    }
52
}
53