Mastodon::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 2
dl 0
loc 5
ccs 4
cts 4
cp 1
crap 1
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace Baguette\Mastodon;
4
5
use Baguette\Mastodon\Service\SessionStorage;
6
7
/**
8
 * Mastodon Service
9
 *
10
 * @author    USAMI Kenta <[email protected]>
11
 * @copyright 2017 Baguette HQ
12
 * @license   https://www.gnu.org/licenses/gpl-3.0.html GPL-3.0
13
 * @method Entity\Account fetchAccount(int $id)
14
 * @method Entity\Account getAccountCurrentUser()
15
 * @method Entity\Account updateAccount(array $update_data)
16
 * @method Entity\Account[] getAccountFollowers(int $account_id)
17
 * @method Entity\Account[] getBlocks(array $options = [])
18
 * @method Entity\Status[] getFavourites(array $options = [])
19
 * @method Entity\Account[] getFollowRequests(array $options = [])
20
 * @method Entity\Status getStatus($status_id)
21
 * @method Entity\Status postStatus(Service\Toot $toot)
22
 */
23
final class Mastodon
24
{
25
    use \Teto\Object\PrivateGetter;
26
    use \Teto\Object\ReadOnly;
27
28
    /** @var Client */
29
    private $client;
30
    /** @var SessionStorage */
31
    private $session;
32
33 1
    public function __construct(Client $client, SessionStorage $session)
34
    {
35 1
        $this->client = $client;
36 1
        $this->session = $session;
37 1
    }
38
39
    /**
40
     * @return Entity\Entity
41
     */
42
    public function __call($name, array $args)
43
    {
44
        return call_user_func_array(
45
            [Requester::class, $name],
46
            array_merge([$this->client, $this->session], $args)
47
        );
48
    }
49
}
50