Completed
Push — master ( 0d5f24...6df70d )
by Luka
04:20
created

Mastodon::__construct()   A

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 postStatus(Service\Toot $toot)
20
 */
21
final class Mastodon
22
{
23
    use \Teto\Object\PrivateGetter;
24
    use \Teto\Object\ReadOnly;
25
26
    /** @var Client */
27
    private $client;
28
    /** @var SessionStorage */
29
    private $session;
30
31 1
    public function __construct(Client $client, SessionStorage $session)
32
    {
33 1
        $this->client = $client;
34 1
        $this->session = $session;
35 1
    }
36
37
    /**
38
     * @return Entity\Entity
39
     */
40
    public function __call($name, array $args)
41
    {
42
        return call_user_func_array(
43
            [Requester::class, $name],
44
            array_merge([$this->client, $this->session], $args)
45
        );
46
    }
47
}
48