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

lmc-eu / matej-client-php / 7529439147

15 Jan 2024 01:18PM UTC coverage: 100.0%. Remained the same
7529439147

Pull #145

github

web-flow
Bump actions/checkout from 3 to 4

Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Pull Request #145: Bump actions/checkout from 3 to 4

712 of 712 relevant lines covered (100.0%)

35.03 hits per line

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

100.0
/src/RequestBuilder/AbstractRequestBuilder.php
1
<?php declare(strict_types=1);
2

3
namespace Lmc\Matej\RequestBuilder;
4

5
use Lmc\Matej\Exception\LogicException;
6
use Lmc\Matej\Http\RequestManager;
7
use Lmc\Matej\Model\Request;
8
use Lmc\Matej\Model\Response;
9

10
/**
11
 * Request builders provides methods for simple and type-safe assembly of request to specific Matej endpoint.
12
 *
13
 * If `RequestManager` is injected to the builder via `setRequestManager()`, the request could be executed right from
14
 * the builder using `send()` method.
15
 */
16
abstract class AbstractRequestBuilder
17
{
18
    /** @var RequestManager */
19
    protected $requestManager;
20
    /** @var string */
21
    protected $requestId;
22

23
    /**
24
     * Use Commands and other settings which were passed to this builder object to build instance of
25
     * Lmc\Matej\Model\Request.
26
     */
27
    abstract public function build(): Request;
28

29
    /**
30
     * If instance of RequestManager is injected to this builder object, you can build and send the request directly
31
     * via send() method of the builder itself.
32
     *
33
     * @return $this
34
     */
35
    public function setRequestManager(RequestManager $requestManager): self
36
    {
37
        $this->requestManager = $requestManager;
42✔
38

39
        return $this;
42✔
40
    }
41

42
    /**
43
     * Set custom identifier of the request to make it traceable in case of debugging.
44
     * The same ID will then also be available in the response.
45
     *
46
     * @see Response::getResponseId()
47
     * @return $this
48
     */
49
    public function setRequestId(string $requestId): self
50
    {
51
        $this->requestId = $requestId;
70✔
52

53
        return $this;
70✔
54
    }
55

56
    public function send(): Response
57
    {
58
        $this->assertRequestManagerIsAvailable();
105✔
59

60
        return $this->requestManager->sendRequest($this->build());
42✔
61
    }
62

63
    private function assertRequestManagerIsAvailable(): void
64
    {
65
        if ($this->requestManager === null) {
105✔
66
            throw new LogicException(
63✔
67
                'Instance of RequestManager must be set to request builder via setRequestManager() before'
63✔
68
                . ' calling send()'
63✔
69
            );
63✔
70
        }
71
    }
72
}
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