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

MichaelJ2324 / PHP-REST-Client / 13115874484

03 Feb 2025 02:35PM UTC coverage: 94.384% (+0.03%) from 94.359%
13115874484

push

github

web-flow
Merge pull request #14 from MichaelJ2324/3.x

v3.0.2 - Abstract Generating Endpoint inside Endpoint

11 of 14 new or added lines in 2 files covered. (78.57%)

1042 of 1104 relevant lines covered (94.38%)

1.48 hits per line

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

75.0
/src/Endpoint/Traits/GenerateEndpointTrait.php
1
<?php
2

3
namespace MRussell\REST\Endpoint\Traits;
4

5
use MRussell\REST\Endpoint\Interfaces\EndpointInterface;
6

7
trait GenerateEndpointTrait
8
{
9
    protected function generateEndpoint(string $endpoint): EndpointInterface|null
1✔
10
    {
11
        $EP = null;
1✔
12
        if (class_exists($endpoint)) {
1✔
13
            $EP = new $endpoint();
1✔
NEW
14
        } elseif (!empty($this->_client)) {
×
NEW
15
            if ($this->_client->hasEndpoint($endpoint)) {
×
NEW
16
                $EP = $this->_client->getEndpoint($endpoint);
×
17
            }
18
        }
19

20
        if ($EP instanceof EndpointInterface) {
1✔
21
            if (!empty($this->_client)) {
1✔
22
                $EP->setClient($this->getClient());
1✔
23
            } else {
24
                $EP->setBaseUrl($this->getBaseUrl());
1✔
25
            }
26
        }
27
        return $EP;
1✔
28
    }
29
}
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