DefaultInfoService   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 21
ccs 8
cts 8
cp 1
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getAccountInfo() 0 5 1
A getChangelog() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Inspirum\Balikobot\Service;
6
7
use Inspirum\Balikobot\Client\Client;
8
use Inspirum\Balikobot\Definitions\Method;
9
use Inspirum\Balikobot\Definitions\Version;
10
use Inspirum\Balikobot\Model\Account\Account;
11
use Inspirum\Balikobot\Model\Account\AccountFactory;
12
use Inspirum\Balikobot\Model\Changelog\ChangelogCollection;
13
use Inspirum\Balikobot\Model\Changelog\ChangelogFactory;
14
15
final class DefaultInfoService implements InfoService
16
{
17 5
    public function __construct(
18
        private readonly Client $client,
19
        private readonly AccountFactory $accountFactory,
20
        private readonly ChangelogFactory $changelogFactory,
21
    ) {
22 5
    }
23
24 2
    public function getAccountInfo(): Account
25
    {
26 2
        $response = $this->client->call(Version::V2V1, null, Method::INFO_WHO_AM_I);
27
28 2
        return $this->accountFactory->create($response);
29
    }
30
31 3
    public function getChangelog(): ChangelogCollection
32
    {
33 3
        $response = $this->client->call(Version::V2V1, null, Method::CHANGELOG);
34
35 3
        return $this->changelogFactory->createCollection($response);
36
    }
37
}
38