• 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

24.07
/src/Generator/Security/BasicAuthenticationSecurityStrategy.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace DoclerLabs\ApiClientGenerator\Generator\Security;
6

7
use DoclerLabs\ApiClientGenerator\Entity\ImportCollection;
8
use DoclerLabs\ApiClientGenerator\Entity\Operation;
9
use DoclerLabs\ApiClientGenerator\Input\Specification;
10
use DoclerLabs\ApiClientGenerator\Naming\CopiedNamespace;
11
use DoclerLabs\ApiClientGenerator\Output\Copy\Request\AuthenticationCredentials;
12
use PhpParser\Node\Expr;
13

14
class BasicAuthenticationSecurityStrategy extends HttpBasedSecurityStrategyAbstract
15
{
16
    public const SCHEME = 'basic';
17

18
    private const PROPERTY_CREDENTIALS = 'credentials';
19

20
    public function getImports(string $baseNamespace): ImportCollection
21
    {
22
        return parent::getImports($baseNamespace)
2✔
23
            ->add(CopiedNamespace::getImport($baseNamespace, AuthenticationCredentials::class));
2✔
24
    }
25

26
    public function getProperties(Operation $operation, Specification $specification): array
27
    {
28
        if ($this->phpVersion->isConstructorPropertyPromotionSupported()) {
2✔
29
            return [];
×
30
        }
31

32
        $statements = [];
2✔
33

34
        if ($this->isAuthenticationAvailable($operation, $specification)) {
2✔
35
            $statements[] = $this->builder->localProperty(
×
36
                self::PROPERTY_CREDENTIALS,
×
37
                'AuthenticationCredentials',
×
38
                'AuthenticationCredentials',
×
39
                readonly: true
×
40
            );
×
41
        }
42

43
        return $statements;
2✔
44
    }
45

46
    public function getConstructorParams(Operation $operation, Specification $specification): array
47
    {
48
        $params = [];
2✔
49

50
        if ($this->isAuthenticationAvailable($operation, $specification)) {
2✔
51
            $params[] = $this->builder
×
52
                ->param(self::PROPERTY_CREDENTIALS)
×
53
                ->setType('AuthenticationCredentials');
×
54
        }
55

56
        return $params;
2✔
57
    }
58

59
    public function getConstructorParamInits(Operation $operation, Specification $specification): array
60
    {
61
        if ($this->phpVersion->isConstructorPropertyPromotionSupported()) {
2✔
62
            return [];
×
63
        }
64

65
        $paramInits = [];
2✔
66

67
        if ($this->isAuthenticationAvailable($operation, $specification)) {
2✔
68
            $paramInits[] = $this->builder->assign(
×
69
                $this->builder->localPropertyFetch(self::PROPERTY_CREDENTIALS),
×
70
                $this->builder->var(self::PROPERTY_CREDENTIALS)
×
71
            );
×
72
        }
73

74
        return $paramInits;
2✔
75
    }
76

77
    protected function getScheme(): string
78
    {
79
        return self::SCHEME;
×
80
    }
81

82
    protected function getAuthorizationHeader(): Expr
83
    {
84
        return $this->builder->funcCall(
×
85
            'sprintf',
×
86
            [
×
87
                'Basic %s',
×
88
                $this->builder->funcCall(
×
89
                    'base64_encode',
×
90
                    [
×
91
                        $this->builder->funcCall(
×
92
                            'sprintf',
×
93
                            [
×
94
                                '%s:%s',
×
95
                                $this->builder->methodCall(
×
96
                                    $this->builder->localPropertyFetch(self::PROPERTY_CREDENTIALS),
×
97
                                    'getUsername'
×
98
                                ),
×
99
                                $this->builder->methodCall(
×
100
                                    $this->builder->localPropertyFetch(self::PROPERTY_CREDENTIALS),
×
101
                                    'getPassword'
×
102
                                ),
×
103
                            ]
×
104
                        ),
×
105
                    ]
×
106
                ),
×
107
            ]
×
108
        );
×
109
    }
110
}
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