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

Mastodon   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 50%

Importance

Changes 0
Metric Value
dl 0
loc 27
ccs 4
cts 8
cp 0.5
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __call() 0 7 1
A __construct() 0 5 1
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