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

h4kuna / ares / 13128129223

03 Feb 2025 06:36AM UTC coverage: 84.524% (-5.3%) from 89.838%
13128129223

push

github

h4kuna
fix(tests)

355 of 420 relevant lines covered (84.52%)

0.85 hits per line

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

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

3
namespace h4kuna\Ares\Vies;
4

5
use h4kuna\Ares\Exceptions\ServerResponseException;
6
use Nette\Utils\Strings;
7
use stdClass;
8

9
/**
10
 * @phpstan-import-type ViesResponse from Client
11
 */
12
final class ContentProvider
13
{
14
        public function __construct(private Client $client)
1✔
15
        {
16
        }
1✔
17

18

19
        /**
20
         * @param string|ViesEntity $vatNumber
21
         * @return ViesResponse
22
         *
23
         * @throws ServerResponseException
24
         */
25
        public function checkVat(string|ViesEntity $vatNumber): object
26
        {
27
                if (is_string($vatNumber)) {
×
28
                        $match = Strings::match($vatNumber, '/(?<country>[A-Z]+)(?<number>\d+)/');
×
29
                        if (isset($match['country'], $match['number'])) {
×
30
                                ['country' => $country, 'number' => $number] = $match;
×
31
                        } else {
32
                                $country = '';
×
33
                                $number = $vatNumber;
×
34
                        }
35
                        $viesEntity = new ViesEntity($number, $country);
×
36
                } else {
37
                        $viesEntity = $vatNumber;
×
38
                }
39

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

43

44
        public function status(): stdClass
45
        {
46
                return $this->client->status();
×
47
        }
48
}
49

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