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

webeweb / pappers-library / 8420086046

25 Mar 2024 12:30PM UTC coverage: 94.03%. Remained the same
8420086046

push

github

webeweb
Update analysis workflow configuration

1323 of 1407 relevant lines covered (94.03%)

50.93 hits per line

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

87.5
/src/Provider/APIv1Provider.php
1
<?php
2

3
/*
4
 * This file is part of the pappers-library package.
5
 *
6
 * (c) 2021 WEBEWEB
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11

12
namespace WBW\Library\Pappers\Provider;
13

14
use InvalidArgumentException;
15
use WBW\Library\Pappers\Request\AbstractRequest;
16
use WBW\Library\Pappers\Request\DocumentTelechargementRequest;
17
use WBW\Library\Pappers\Request\EntrepriseRequest;
18
use WBW\Library\Pappers\Request\RechercheRequest;
19
use WBW\Library\Pappers\Response\AbstractResponse;
20
use WBW\Library\Provider\Exception\ApiException;
21

22
/**
23
 * API v1 provider.
24
 *
25
 * @author webeweb <https://github.com/webeweb>
26
 * @package WBW\Library\Pappers\Provider
27
 */
28
class APIv1Provider extends AbstractProvider {
29

30
    /**
31
     * {@inheritDoc}
32
     */
33
    public function getEndpointVersion(): string {
34
        return "/v1";
32✔
35
    }
36

37
    /**
38
     * Send a request.
39
     *
40
     * @param AbstractRequest $request The request.
41
     * @return AbstractResponse Returns the response.
42
     * @throws InvalidArgumentException Throws an invalid argument exception if a parameter is missing.
43
     * @throws ApiException Throws an API exception if an error occurs.
44
     */
45
    public function sendRequest(AbstractRequest $request): AbstractResponse {
46

47
        if (false === ($request instanceof DocumentTelechargementRequest) &&
40✔
48
            false === ($request instanceof EntrepriseRequest) &&
40✔
49
            false === ($request instanceof RechercheRequest)) {
40✔
50

51
            throw new InvalidArgumentException(sprintf('The request "%s" is not supported', get_class($request)));
8✔
52
        }
53

54
        $queryData   = $request->serializeRequest();
32✔
55
        $rawResponse = $this->callApi($request, $queryData);
32✔
56

57
        return $request->deserializeResponse($rawResponse);
×
58
    }
59
}
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