Completed
Push — 3.x ( e32815...7c4255 )
by Ryota
10:41 queued 09:27
created

Me::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
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\UserFactory;
9
use Polidog\Chatwork\Entity\User;
10
11
/**
12
 * Api /me.
13
 */
14
class Me
15
{
16
    /**
17
     * @var ClientInterface
18
     */
19
    private $client;
20
21
    /**
22
     * @var UserFactory
23
     */
24
    private $factory;
25
26
    /**
27
     * Me constructor.
28
     *
29
     * @param ClientInterface $client
30
     * @param UserFactory     $factory
31
     */
32
    public function __construct(ClientInterface $client, UserFactory $factory)
33
    {
34
        $this->client = $client;
35
        $this->factory = $factory;
36
    }
37
38
    /**
39
     * @return User
40
     */
41
    public function show(): User
42
    {
43
        return $this->factory->entity(
44
            $this->client->get('me')
45
        );
46
    }
47
}
48