• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

h4kuna / ares / 22293219950

22 Feb 2026 12:32PM UTC coverage: 84.701% (-4.8%) from 89.497%
22293219950

push

github

web-flow
Merge pull request #51 from h4kuna/php-coding-standard

Add coding standards

38 of 47 new or added lines in 16 files covered. (80.85%)

19 existing lines in 5 files now uncovered.

382 of 451 relevant lines covered (84.7%)

0.85 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

15.38
/src/Vies/Client.php
1
<?php declare(strict_types = 1);
2

3
namespace h4kuna\Ares\Vies;
4

5
use h4kuna\Ares\Exception\ServerResponseException;
6
use h4kuna\Ares\Http\TransportProvider;
7
use stdClass;
8
use function sprintf;
9

10
/**
11
 * @phpstan-type ViesResponse object{countryCode: string, vatNumber: string, requestDate: string, valid: bool, requestIdentifier: string, name: string, address: string, traderName: string, traderStreet: string, traderPostalCode: string, traderCity: string, traderCompanyType: string, traderNameMatch: string, traderStreetMatch: string, traderPostalCodeMatch: string, traderCityMatch: string, traderCompanyTypeMatch: string}&stdClass
12
 */
13
final class Client
14
{
15

16
        public static string $url = 'https://ec.europa.eu/taxation_customs/vies/rest-api';
17

18

19
        public function __construct(private TransportProvider $transportProvider)
1✔
20
        {
21
        }
1✔
22

23
        /**
24
         * @return ViesResponse
25
         *
26
         * @throws ServerResponseException
27
         */
28
        public function checkVatNumber(ViesEntity $viesEntity): object
29
        {
NEW
30
                $request = $this->transportProvider->createJsonRequest(self::$url . '/check-vat-number', $viesEntity->toParam());
×
UNCOV
31
                $response = $this->transportProvider->response($request);
×
32

UNCOV
33
                $data = $this->transportProvider->toJson($response);
×
UNCOV
34
                if (isset($data->errorWrappers[0]->error) && $data->errorWrappers[0] instanceof stdClass) {
×
UNCOV
35
                        if (isset($data->errorWrappers[0]->message)) {
×
UNCOV
36
                                throw new ServerResponseException(sprintf('%s: %s', $data->errorWrappers[0]->error, $data->errorWrappers[0]->message));
×
37
                        }
38

39
                        throw new ServerResponseException($data->errorWrappers[0]->error);
×
40
                }
41

42
                /** @var ViesResponse $data */
UNCOV
43
                return $data;
×
44
        }
45

46
        /**
47
         * @throws ServerResponseException
48
         */
49
        public function status(): stdClass
50
        {
NEW
51
                $request = $this->transportProvider->createRequest(self::$url . '/check-status');
×
UNCOV
52
                $response = $this->transportProvider->response($request);
×
53

UNCOV
54
                return $this->transportProvider->toJson($response);
×
55
        }
56

57
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc