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

h4kuna / ares / 22536100246

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

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

20.0
/src/Vies/ContentProvider.php
1
<?php declare(strict_types = 1);
2

3
namespace h4kuna\Ares\Vies;
4

5
use h4kuna\Ares\Exception\LogicException;
6
use h4kuna\Ares\Exception\ServerResponseException;
7
use Nette\Utils\Strings;
8
use stdClass;
9
use function is_string;
10
use function substr;
11

12
/**
13
 * @phpstan-import-type ViesResponse from Client
14
 */
15
final class ContentProvider
16
{
17

18
        public function __construct(private Client $client)
1✔
19
        {
20
        }
1✔
21

22
        /**
23
         * @return ViesResponse
24
         *
25
         * @throws ServerResponseException
26
         */
27
        public function checkVat(string|ViesEntity $vatNumber): object
28
        {
UNCOV
29
                if (is_string($vatNumber)) {
×
UNCOV
30
                        $match = Strings::match($vatNumber, '/(?<country>[A-Z]{2})/');
×
UNCOV
31
                        if (isset($match['country']) === false) {
×
32
                                throw new LogicException('Use class ViesEntity instead of string.');
×
33
                        }
34

UNCOV
35
                        $viesEntity = new ViesEntity(substr($vatNumber, 2), $match['country']);
×
36
                } else {
UNCOV
37
                        $viesEntity = $vatNumber;
×
38
                }
39

UNCOV
40
                return $this->client->checkVatNumber($viesEntity);
×
41
        }
42

43
        /**
44
         * @throws ServerResponseException
45
         */
46
        public function status(): stdClass
47
        {
UNCOV
48
                return $this->client->status();
×
49
        }
50

51
}
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