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

webeweb / pappers-library / 4105872644

pending completion
4105872644

push

github

webeweb
Fix PHPDoc

1271 of 1345 relevant lines covered (94.5%)

45.6 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 GuzzleHttp\Exception\GuzzleException;
15
use InvalidArgumentException;
16
use WBW\Library\Pappers\Request\AbstractRequest;
17
use WBW\Library\Pappers\Request\DocumentTelechargementRequest;
18
use WBW\Library\Pappers\Request\EntrepriseRequest;
19
use WBW\Library\Pappers\Request\RechercheRequest;
20
use WBW\Library\Pappers\Response\AbstractResponse;
21
use WBW\Library\Provider\Exception\ApiException;
22

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

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

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

49
        if (false === ($request instanceof DocumentTelechargementRequest) &&
35✔
50
            false === ($request instanceof EntrepriseRequest) &&
35✔
51
            false === ($request instanceof RechercheRequest)) {
35✔
52

53
            throw new InvalidArgumentException(sprintf('The request "%s" is not supported', get_class($request)));
7✔
54
        }
55

56
        $queryData   = $request->serializeRequest();
28✔
57
        $rawResponse = $this->callApi($request, $queryData);
28✔
58

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

© 2025 Coveralls, Inc