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

h4kuna / ares / 22277187268

22 Feb 2026 12:24PM UTC coverage: 89.348% (-0.1%) from 89.497%
22277187268

Pull #51

github

h4kuna
Add coding standards
Pull Request #51: Add coding standards

40 of 47 new or added lines in 16 files covered. (85.11%)

1 existing line in 1 file now uncovered.

411 of 460 relevant lines covered (89.35%)

0.89 hits per line

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

83.33
/src/Adis/Client.php
1
<?php declare(strict_types = 1);
2

3
namespace h4kuna\Ares\Adis;
4

5
use h4kuna\Ares\Adis\Soap\Envelope;
6
use h4kuna\Ares\Exception\ServerResponseException;
7
use h4kuna\Ares\Http\TransportProvider;
8
use h4kuna\Ares\Tool\Arrays;
9
use h4kuna\Ares\Tool\Integer;
10
use h4kuna\Ares\Tool\Strings;
11
use h4kuna\Ares\Tool\Xml;
12
use SimpleXMLElement;
13
use stdClass;
14
use function simplexml_load_string;
15

16
final class Client
17
{
18

19
        public static string $url = 'https://adisrws.mfcr.cz/adistc/axis2/services/rozhraniCRPDPH.rozhraniCRPDPHSOAP';
20

21
        public function __construct(
1✔
22
                private TransportProvider $transportProvider,
23
        )
24
        {
25
        }
1✔
26

27
        /**
28
         * @param array<string, string> $chunk
29
         * @return list<stdClass>
30
         *
31
         * @throws ServerResponseException
32
         */
33
        public function statusBusinessSubjects(array $chunk): array
1✔
34
        {
35
                $xml = Envelope::statusNespolehlivySubjektRozsireny(...$chunk);
1✔
36
                $data = $this->request($xml, 'StatusNespolehlivySubjektRozsirenyResponse');
1✔
37
                $attributes = '@attributes';
1✔
38

39
                if (
40
                        $data->status instanceof stdClass === false
1✔
41
                        || isset($data->status->$attributes) === false
1✔
42
                        || $data->status->$attributes instanceof stdClass === false
1✔
43
                ) {
44
                        throw ServerResponseException::brokenXml();
×
45
                }
46
                $element = $data->status->$attributes;
1✔
47
                if ($element->statusCode !== '0') {
1✔
48
                        throw ServerResponseException::badResponse(Strings::fromMixedStrict($element->statusText), (int) Integer::fromMixed($element->statusCode));
×
49
                }
50

51
                return Arrays::fromStdClass($data->statusSubjektu);
1✔
52
        }
53

54
        /**
55
         * @throws ServerResponseException
56
         */
57
        private function request(
1✔
58
                string $xml,
59
                string $name,
60
        ): stdClass
61
        {
62
                $request = $this->transportProvider->createXmlRequest(self::$url, $xml);
1✔
63
                $response = $this->transportProvider->response($request);
1✔
64
                $xml = @simplexml_load_string($response->getBody()->getContents(), namespace_or_prefix: 'soapenv', is_prefix: true);
1✔
65

66
                if ($xml === false) {
1✔
NEW
67
                        throw ServerResponseException::badResponse('Broken XML.');
×
68
                }
69

70
                $body = $xml->Body; // phpcs:ignore Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps
1✔
71
                if (($body->children()->$name instanceof SimpleXMLElement) === false) {
1✔
NEW
72
                        throw ServerResponseException::badResponse("Missing tag '{$name}' in response.");
×
73
                }
74

75
                return Xml::toJson($body->children()->$name);
1✔
76
        }
77

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