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

api-platform / core / 14635100171

24 Apr 2025 06:39AM UTC coverage: 8.271% (+0.02%) from 8.252%
14635100171

Pull #6904

github

web-flow
Merge c9cefd82e into a3e5e53ea
Pull Request #6904: feat(graphql): added support for graphql subscriptions to work for actions

0 of 73 new or added lines in 3 files covered. (0.0%)

1999 existing lines in 144 files now uncovered.

13129 of 158728 relevant lines covered (8.27%)

13.6 hits per line

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

73.68
/src/Metadata/Link.php
1
<?php
2

3
/*
4
 * This file is part of the API Platform project.
5
 *
6
 * (c) Kévin Dunglas <dunglas@gmail.com>
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
declare(strict_types=1);
13

14
namespace ApiPlatform\Metadata;
15

16
use ApiPlatform\OpenApi;
17

18
#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::TARGET_PARAMETER)]
19
final class Link extends Parameter
20
{
21
    public function __construct(
22
        private ?string $parameterName = null,
23
        private ?string $fromProperty = null,
24
        private ?string $toProperty = null,
25
        private ?string $fromClass = null,
26
        private ?string $toClass = null,
27
        private ?array $identifiers = null,
28
        private ?bool $compositeIdentifier = null,
29
        private ?string $expandedValue = null,
30
        ?string $security = null,
31
        ?string $securityMessage = null,
32
        private ?string $securityObjectName = null,
33

34
        ?string $key = null,
35
        ?array $schema = null,
36
        ?OpenApi\Model\Parameter $openApi = null,
37
        mixed $provider = null,
38
        mixed $filter = null,
39
        ?string $property = null,
40
        ?string $description = null,
41
        ?bool $required = null,
42
        array $extraProperties = [],
43
    ) {
44
        // For the inverse property shortcut
45
        if ($this->parameterName && class_exists($this->parameterName)) {
134✔
46
            $this->fromClass = $this->parameterName;
×
47
        }
48

49
        parent::__construct(
134✔
50
            key: $key,
134✔
51
            schema: $schema,
134✔
52
            openApi: $openApi,
134✔
53
            provider: $provider,
134✔
54
            filter: $filter,
134✔
55
            property: $property,
134✔
56
            description: $description,
134✔
57
            required: $required,
134✔
58
            security: $security,
134✔
59
            securityMessage: $securityMessage,
134✔
60
            extraProperties: $extraProperties
134✔
61
        );
134✔
62
    }
63

64
    public function getParameterName(): ?string
65
    {
66
        return $this->parameterName;
979✔
67
    }
68

69
    public function withParameterName(string $parameterName): self
70
    {
71
        $self = clone $this;
92✔
72
        $self->parameterName = $parameterName;
92✔
73

74
        return $self;
92✔
75
    }
76

77
    public function getFromClass(): ?string
78
    {
79
        return $this->fromClass;
1,011✔
80
    }
81

82
    public function withFromClass(string $fromClass): self
83
    {
84
        $self = clone $this;
94✔
85
        $self->fromClass = $fromClass;
94✔
86

87
        return $self;
94✔
88
    }
89

90
    public function getToClass(): ?string
91
    {
92
        return $this->toClass;
42✔
93
    }
94

95
    public function withToClass(string $toClass): self
96
    {
97
        $self = clone $this;
22✔
98
        $self->toClass = $toClass;
22✔
99

100
        return $self;
22✔
101
    }
102

103
    public function getFromProperty(): ?string
104
    {
105
        return $this->fromProperty;
294✔
106
    }
107

108
    public function withFromProperty(string $fromProperty): self
109
    {
110
        $self = $this;
22✔
111
        $self->fromProperty = $fromProperty;
22✔
112

113
        return $self;
22✔
114
    }
115

116
    public function getToProperty(): ?string
117
    {
118
        return $this->toProperty;
980✔
119
    }
120

121
    public function withToProperty(string $toProperty): self
122
    {
123
        $self = clone $this;
×
124
        $self->toProperty = $toProperty;
×
125

126
        return $self;
×
127
    }
128

129
    public function getIdentifiers(): ?array
130
    {
131
        return $this->identifiers;
997✔
132
    }
133

134
    public function withIdentifiers(array $identifiers): self
135
    {
136
        $self = clone $this;
96✔
137
        $self->identifiers = $identifiers;
96✔
138

139
        return $self;
96✔
140
    }
141

142
    public function getCompositeIdentifier(): ?bool
143
    {
144
        return $this->compositeIdentifier;
395✔
145
    }
146

147
    public function withCompositeIdentifier(bool $compositeIdentifier): self
148
    {
UNCOV
149
        $self = clone $this;
1✔
UNCOV
150
        $self->compositeIdentifier = $compositeIdentifier;
1✔
151

UNCOV
152
        return $self;
1✔
153
    }
154

155
    public function getExpandedValue(): ?string
156
    {
157
        return $this->expandedValue;
356✔
158
    }
159

160
    public function withExpandedValue(string $expandedValue): self
161
    {
162
        $self = clone $this;
×
163
        $self->expandedValue = $expandedValue;
×
164

165
        return $self;
×
166
    }
167

168
    public function getSecurity(): ?string
169
    {
170
        return $this->security;
378✔
171
    }
172

173
    public function getSecurityObjectName(): ?string
174
    {
175
        return $this->securityObjectName;
15✔
176
    }
177

178
    public function withSecurityObjectName(?string $securityObjectName): self
179
    {
180
        $self = clone $this;
×
181
        $self->securityObjectName = $securityObjectName;
×
182

183
        return $self;
×
184
    }
185

186
    public function withLink(self $link): self
187
    {
UNCOV
188
        $self = clone $this;
1✔
189

UNCOV
190
        if (!$self->getToProperty() && ($toProperty = $link->getToProperty())) {
1✔
UNCOV
191
            $self->toProperty = $toProperty;
1✔
192
        }
193

UNCOV
194
        if (!$self->getCompositeIdentifier() && ($compositeIdentifier = $link->getCompositeIdentifier())) {
1✔
195
            $self->compositeIdentifier = $compositeIdentifier;
×
196
        }
197

UNCOV
198
        if (!$self->getFromClass() && ($fromClass = $link->getFromClass())) {
1✔
199
            $self->fromClass = $fromClass;
×
200
        }
201

UNCOV
202
        if (!$self->getToClass() && ($toClass = $link->getToClass())) {
1✔
203
            $self->toClass = $toClass;
×
204
        }
205

UNCOV
206
        if (!$self->getIdentifiers() && ($identifiers = $link->getIdentifiers())) {
1✔
207
            $self->identifiers = $identifiers;
×
208
        }
209

UNCOV
210
        if (!$self->getFromProperty() && ($fromProperty = $link->getFromProperty())) {
1✔
211
            $self->fromProperty = $fromProperty;
×
212
        }
213

UNCOV
214
        if (!$self->getParameterName() && ($parameterName = $link->getParameterName())) {
1✔
215
            $self->parameterName = $parameterName;
×
216
        }
217

UNCOV
218
        if (!$self->getExpandedValue() && ($expandedValue = $link->getExpandedValue())) {
1✔
219
            $self->expandedValue = $expandedValue;
×
220
        }
221

UNCOV
222
        if (!$self->getSecurity() && ($security = $link->getSecurity())) {
1✔
223
            $self->security = $security;
×
224
        }
225

UNCOV
226
        if (!$self->getSecurityMessage() && ($securityMessage = $link->getSecurityMessage())) {
1✔
227
            $self->securityMessage = $securityMessage;
×
228
        }
229

UNCOV
230
        if (!$self->getSecurityObjectName() && ($securityObjectName = $link->getSecurityObjectName())) {
1✔
231
            $self->securityObjectName = $securityObjectName;
×
232
        }
233

UNCOV
234
        return $self;
1✔
235
    }
236
}
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