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

h4kuna / ares / 15350580489

30 May 2025 03:51PM UTC coverage: 83.105% (-1.8%) from 84.928%
15350580489

push

github

web-flow
Merge pull request #48 from h4kuna/update-phpstan

Update phpstan

15 of 42 new or added lines in 17 files covered. (35.71%)

364 of 438 relevant lines covered (83.11%)

0.83 hits per line

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

93.75
/src/Adis/ContentProvider.php
1
<?php declare(strict_types=1);
2

3
namespace h4kuna\Ares\Adis;
4

5
use Generator;
6
use h4kuna\Ares\Adis\StatusBusinessSubjects\StatusBusinessSubjectsTransformer;
7
use h4kuna\Ares\Adis\StatusBusinessSubjects\Subject;
8
use h4kuna\Ares\Ares\Helper;
9
use h4kuna\Ares\Exception\LogicException;
10
use h4kuna\Ares\Exception\ServerResponseException;
11
use h4kuna\Ares\Tool\Batch;
12

13
final class ContentProvider
14
{
15
        public function __construct(private Client $client, private StatusBusinessSubjectsTransformer $stdClassTransformer)
1✔
16
        {
17
        }
1✔
18

19

20
        /**
21
         * @throws ServerResponseException
22
         */
23
        public function statusBusinessSubject(string $tin): Subject
1✔
24
        {
25
                foreach ($this->statusBusinessSubjects([$tin => $tin]) as $subject) {
1✔
26
                        return $subject;
1✔
27
                }
28

NEW
29
                throw new LogicException('ADIS must return anything.');
×
30
        }
31

32

33
        /**
34
         * @param array<string, string> $tin
35
         * @return Generator<string, Subject>
36
         *
37
         * @throws ServerResponseException
38
         */
39
        public function statusBusinessSubjects(array $tin): Generator
1✔
40
        {
41
                $duplicity = Batch::checkDuplicities($tin, static fn (string $tin) => Helper::normalizeTIN($tin));
1✔
42
                $chunks = Batch::chunk($duplicity, 100);
1✔
43

44
                foreach ($chunks as $chunk) {
1✔
45
                        $responseData = $this->client->statusBusinessSubjects($chunk);
1✔
46

47
                        foreach ($responseData as $item) {
1✔
48
                                $subject = $this->stdClassTransformer->transform($item);
1✔
49
                                foreach ($duplicity[$subject->tin] as $name) {
1✔
50
                                        yield $name => $subject;
1✔
51
                                }
52
                        }
53
                }
54
        }
1✔
55

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