User   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 15
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A get() 0 9 2
1
<?php
2
declare(strict_types=1);
3
4
namespace Shoman4eg\Nalog\Api;
5
6
use Psr\Http\Client\ClientExceptionInterface;
7
use Shoman4eg\Nalog\ErrorHandler;
8
use Shoman4eg\Nalog\Exception\DomainException;
9
use Shoman4eg\Nalog\Model\User\UserType;
10
11
/**
12
 * @author Artem Dubinin <[email protected]>
13
 */
14
final class User extends BaseHttpApi
15
{
16
    /**
17
     * @throws ClientExceptionInterface
18
     * @throws DomainException
19
     */
20
    public function get(): UserType
21
    {
22
        $response = $this->httpGet('/user');
23
24
        if ($response->getStatusCode() >= 400) {
25
            (new ErrorHandler())->handleResponse($response);
26
        }
27
28
        return $this->hydrator->hydrate($response, UserType::class);
29
    }
30
}
31