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

h4kuna / ares / 8979741081

07 May 2024 04:36AM UTC coverage: 83.377% (-6.1%) from 89.487%
8979741081

push

github

h4kuna
fix(tests)

0 of 3 new or added lines in 1 file covered. (0.0%)

19 existing lines in 3 files now uncovered.

316 of 379 relevant lines covered (83.38%)

0.83 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
        {
UNCOV
27
                if (is_string($vatNumber)) {
×
UNCOV
28
                        $match = Strings::match($vatNumber, '/(?<country>[A-Z]+)(?<number>\d+)/');
×
UNCOV
29
                        if (isset($match['country'], $match['number'])) {
×
UNCOV
30
                                ['country' => $country, 'number' => $number] = $match;
×
31
                        } else {
UNCOV
32
                                $country = '';
×
UNCOV
33
                                $number = $vatNumber;
×
34
                        }
UNCOV
35
                        $viesEntity = new ViesEntity($number, $country);
×
36
                } else {
UNCOV
37
                        $viesEntity = $vatNumber;
×
38
                }
39

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

43

44
        public function status(): stdClass
45
        {
UNCOV
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