Mastodon   A
last analyzed

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 __construct() 0 5 1
A __call() 0 7 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[] 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