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

DoclerLabs / api-client-generator / 21418891888

27 Jan 2026 11:51PM UTC coverage: 86.69% (-0.3%) from 86.973%
21418891888

Pull #131

github

web-flow
Bump phpunit/phpunit from 9.5.9 to 9.6.33

Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 9.5.9 to 9.6.33.
- [Release notes](https://github.com/sebastianbergmann/phpunit/releases)
- [Changelog](https://github.com/sebastianbergmann/phpunit/blob/9.6.33/ChangeLog-9.6.md)
- [Commits](https://github.com/sebastianbergmann/phpunit/compare/9.5.9...9.6.33)

---
updated-dependencies:
- dependency-name: phpunit/phpunit
  dependency-version: 9.6.33
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Pull Request #131: Bump phpunit/phpunit from 9.5.9 to 9.6.33

3465 of 3997 relevant lines covered (86.69%)

7.11 hits per line

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

78.26
/src/Input/Factory/OperationCollectionFactory.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace DoclerLabs\ApiClientGenerator\Input\Factory;
6

7
use cebe\openapi\spec\OpenApi;
8
use cebe\openapi\spec\PathItem;
9
use DoclerLabs\ApiClientGenerator\Entity\OperationCollection;
10
use DoclerLabs\ApiClientGenerator\Entity\Request;
11
use DoclerLabs\ApiClientGenerator\Input\InvalidSpecificationException;
12
use ReflectionClass;
13
use UnexpectedValueException;
14

15
class OperationCollectionFactory
16
{
17
    private const NON_OPERATION_ALLOWED_KEYS = ['parameters'];
18

19
    public function __construct(private OperationFactory $operationFactory)
20
    {
21
    }
3✔
22

23
    public function create(OpenApi $specification): OperationCollection
24
    {
25
        $collection = new OperationCollection();
3✔
26
        if (count($specification->paths) === 0) {
3✔
27
            throw new InvalidSpecificationException('No paths found in the specification.');
×
28
        }
29

30
        foreach ($specification->paths as $path => $pathItem) {
3✔
31
            foreach ($this->getOperations($pathItem) as $method => $operation) {
3✔
32
                if (!in_array($method, Request::ALLOWED_METHODS, true)) {
3✔
33
                    throw new InvalidSpecificationException(
×
34
                        sprintf('Unsupported request method `%s` in `%s`.', $method, $path)
×
35
                    );
×
36
                }
37

38
                $collection->add(
3✔
39
                    $this->operationFactory->create($operation, $path, $method, $pathItem->parameters ?? [])
3✔
40
                );
3✔
41
            }
42
        }
43

44
        return $collection;
3✔
45
    }
46

47
    private function getOperations(PathItem $pathItem): array
48
    {
49
        $parentClass = (new ReflectionClass($pathItem))->getParentClass();
3✔
50
        if ($parentClass === false) {
3✔
51
            throw new UnexpectedValueException('Wrong path item class passed.');
×
52
        }
53
        $properties = $parentClass->getProperty('_properties');
3✔
54
        $properties->setAccessible(true);
3✔
55
        /** @var array $operations */
56
        $operations = $properties->getValue($pathItem);
3✔
57

58
        foreach (self::NON_OPERATION_ALLOWED_KEYS as $key) {
3✔
59
            unset($operations[$key]);
3✔
60
        }
61

62
        return array_change_key_case($operations, CASE_UPPER);
3✔
63
    }
64
}
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