Skip to content

Commit ca00ff0

Browse files
committed
Getting there :D!
1 parent b1f9b51 commit ca00ff0

File tree

2,168 files changed

+41592
-51314
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,168 files changed

+41592
-51314
lines changed

Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,5 +71,4 @@ help: ## Show this help ###
7171
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[32m%-32s\033[0m %s\n", $$1, $$2}' | tr -d '#'
7272

7373
generate-clients:
74-
$(DOCKER_RUN) rm src/OpenAPI -Rf
7574
$(DOCKER_RUN) ls ./etc/clients | xargs -I % $(DOCKER_RUN) php ./vendor/bin/openapi-client-generator ./etc/clients/%

composer.lock

Lines changed: 80 additions & 81 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

phpstan.neon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ parameters:
1313
- WyriHaximus\TestUtilities\TestCase
1414

1515
includes:
16-
- vendor/wyrihaximus/phpstan-rules-wrapper/wrapper.neon
16+
- vendor/wyrihaximus/async-test-utilities/rules.neon

src/OpenAPI/ApiGitHubCom/Client.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?php
22

3+
declare (strict_types=1);
34
namespace ApiClients\Client\Github\OpenAPI\ApiGitHubCom;
45

56
final class Client implements ClientInterface

src/OpenAPI/ApiGitHubCom/ClientInterface.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?php
22

3+
declare (strict_types=1);
34
namespace ApiClients\Client\Github\OpenAPI\ApiGitHubCom;
45

56
interface ClientInterface

src/OpenAPI/ApiGitHubCom/Hydrator/Operation/App/Hook/Config.php

Lines changed: 109 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -4,230 +4,232 @@
44

55
namespace ApiClients\Client\Github\OpenAPI\ApiGitHubCom\Hydrator\Operation\App\Hook;
66

7-
use ApiClients\Client\Github\OpenAPI\ApiGitHubCom\Schema\WebhookConfig;
87
use EventSauce\ObjectHydrator\IterableList;
98
use EventSauce\ObjectHydrator\ObjectMapper;
10-
use EventSauce\ObjectHydrator\PropertySerializers\SerializeArrayItems;
11-
use EventSauce\ObjectHydrator\PropertySerializers\SerializeDateTime;
12-
use EventSauce\ObjectHydrator\PropertySerializers\SerializeUuidToString;
139
use EventSauce\ObjectHydrator\UnableToHydrateObject;
1410
use EventSauce\ObjectHydrator\UnableToSerializeObject;
1511
use Generator;
16-
use LogicException;
17-
use Throwable;
18-
19-
use function assert;
20-
use function count;
2112

2213
class Config implements ObjectMapper
2314
{
2415
private array $hydrationStack = [];
25-
26-
public function __construct()
27-
{
28-
}
16+
public function __construct() {}
2917

3018
/**
19+
* @template T of object
3120
* @param class-string<T> $className
32-
*
3321
* @return T
34-
*
35-
* @template T of object
3622
*/
3723
public function hydrateObject(string $className, array $payload): object
3824
{
39-
return match ($className) {
25+
return match($className) {
4026
'ApiClients\Client\Github\OpenAPI\ApiGitHubCom\Schema\WebhookConfig' => $this->hydrateApiClients⚡️Client⚡️Github⚡️OpenAPI⚡️ApiGitHubCom⚡️Schema⚡️WebhookConfig($payload),
4127
default => throw UnableToHydrateObject::noHydrationDefined($className, $this->hydrationStack),
4228
};
4329
}
44-
45-
private function hydrateApiClients⚡️Client⚡️Github⚡️OpenAPI⚡️ApiGitHubCom⚡️Schema⚡️WebhookConfig(array $payload): WebhookConfig
46-
{
47-
$properties = [];
48-
$missingFields = [];
49-
try {
50-
$value = $payload['url'] ?? null;
51-
52-
if ($value === null) {
53-
$missingFields[] = 'url';
54-
goto after_url;
55-
}
56-
57-
$properties['url'] = $value;
58-
59-
after_url:
60-
61-
$value = $payload['content_type'] ?? null;
62-
63-
if ($value === null) {
64-
$missingFields[] = 'content_type';
65-
goto after_content_type;
30+
31+
32+
private function hydrateApiClients⚡️Client⚡️Github⚡️OpenAPI⚡️ApiGitHubCom⚡️Schema⚡️WebhookConfig(array $payload): \ApiClients\Client\Github\OpenAPI\ApiGitHubCom\Schema\WebhookConfig
33+
{
34+
$properties = [];
35+
$missingFields = [];
36+
try {
37+
38+
$value = $payload['url'] ?? null;
39+
40+
if ($value === null) {
41+
$missingFields[] = 'url';
42+
goto after_url;
43+
}
44+
45+
$properties['url'] = $value;
46+
47+
after_url:
48+
49+
$value = $payload['content_type'] ?? null;
50+
51+
if ($value === null) {
52+
$missingFields[] = 'content_type';
53+
goto after_content_type;
54+
}
55+
56+
$properties['content_type'] = $value;
57+
58+
after_content_type:
59+
60+
$value = $payload['secret'] ?? null;
61+
62+
if ($value === null) {
63+
$missingFields[] = 'secret';
64+
goto after_secret;
65+
}
66+
67+
$properties['secret'] = $value;
68+
69+
after_secret:
70+
71+
$value = $payload['insecure_ssl'] ?? null;
72+
73+
if ($value === null) {
74+
$properties['insecure_ssl'] = null;
75+
goto after_insecure_ssl;
76+
}
77+
78+
$properties['insecure_ssl'] = $value;
79+
80+
after_insecure_ssl:
81+
82+
} catch (\Throwable $exception) {
83+
throw UnableToHydrateObject::dueToError('ApiClients\Client\Github\OpenAPI\ApiGitHubCom\Schema\WebhookConfig', $exception, stack: $this->hydrationStack);
6684
}
67-
68-
$properties['content_type'] = $value;
69-
70-
after_content_type:
71-
72-
$value = $payload['secret'] ?? null;
73-
74-
if ($value === null) {
75-
$missingFields[] = 'secret';
76-
goto after_secret;
85+
86+
if (count($missingFields) > 0) {
87+
throw UnableToHydrateObject::dueToMissingFields(\ApiClients\Client\Github\OpenAPI\ApiGitHubCom\Schema\WebhookConfig::class, $missingFields, stack: $this->hydrationStack);
7788
}
78-
79-
$properties['secret'] = $value;
80-
81-
after_secret:
82-
83-
$value = $payload['insecure_ssl'] ?? null;
84-
85-
if ($value === null) {
86-
$properties['insecure_ssl'] = null;
87-
goto after_insecure_ssl;
89+
90+
try {
91+
return new \ApiClients\Client\Github\OpenAPI\ApiGitHubCom\Schema\WebhookConfig(...$properties);
92+
} catch (\Throwable $exception) {
93+
throw UnableToHydrateObject::dueToError('ApiClients\Client\Github\OpenAPI\ApiGitHubCom\Schema\WebhookConfig', $exception, stack: $this->hydrationStack);
8894
}
89-
90-
$properties['insecure_ssl'] = $value;
91-
92-
after_insecure_ssl:
93-
} catch (Throwable $exception) {
94-
throw UnableToHydrateObject::dueToError('ApiClients\Client\Github\OpenAPI\ApiGitHubCom\Schema\WebhookConfig', $exception, stack: $this->hydrationStack);
95-
}
96-
97-
if (count($missingFields) > 0) {
98-
throw UnableToHydrateObject::dueToMissingFields(WebhookConfig::class, $missingFields, stack: $this->hydrationStack);
99-
}
100-
101-
try {
102-
return new WebhookConfig(...$properties);
103-
} catch (Throwable $exception) {
104-
throw UnableToHydrateObject::dueToError('ApiClients\Client\Github\OpenAPI\ApiGitHubCom\Schema\WebhookConfig', $exception, stack: $this->hydrationStack);
10595
}
106-
}
107-
96+
10897
public function serializeObject(object $object): mixed
10998
{
11099
try {
111-
$className = $object::class;
100+
$className = get_class($object);
112101

113-
return match ($className) {
102+
return match($className) {
114103
'array' => $this->serializeValuearray($object),
115104
'Ramsey\Uuid\UuidInterface' => $this->serializeValueRamsey⚡️Uuid⚡️UuidInterface($object),
116105
'DateTime' => $this->serializeValueDateTime($object),
117106
'DateTimeImmutable' => $this->serializeValueDateTimeImmutable($object),
118107
'DateTimeInterface' => $this->serializeValueDateTimeInterface($object),
119108
'ApiClients\Client\Github\OpenAPI\ApiGitHubCom\Schema\WebhookConfig' => $this->serializeObjectApiClients⚡️Client⚡️Github⚡️OpenAPI⚡️ApiGitHubCom⚡️Schema⚡️WebhookConfig($object),
120-
default => throw new LogicException('No serialization defined for $className'),
109+
default => throw new \LogicException('No serialization defined for $className'),
121110
};
122-
} catch (Throwable $exception) {
111+
} catch (\Throwable $exception) {
123112
throw UnableToSerializeObject::dueToError($className, $exception);
124113
}
125114
}
126-
115+
116+
127117
private function serializeValuearray(mixed $value): mixed
128118
{
129119
static $serializer;
130-
120+
131121
if ($serializer === null) {
132-
$serializer = new SerializeArrayItems(...[]);
122+
$serializer = new \EventSauce\ObjectHydrator\PropertySerializers\SerializeArrayItems(...array (
123+
));
133124
}
134-
125+
135126
return $serializer->serialize($value, $this);
136127
}
137128

129+
138130
private function serializeValueRamsey⚡️Uuid⚡️UuidInterface(mixed $value): mixed
139131
{
140132
static $serializer;
141-
133+
142134
if ($serializer === null) {
143-
$serializer = new SerializeUuidToString(...[]);
135+
$serializer = new \EventSauce\ObjectHydrator\PropertySerializers\SerializeUuidToString(...array (
136+
));
144137
}
145-
138+
146139
return $serializer->serialize($value, $this);
147140
}
148141

142+
149143
private function serializeValueDateTime(mixed $value): mixed
150144
{
151145
static $serializer;
152-
146+
153147
if ($serializer === null) {
154-
$serializer = new SerializeDateTime(...[]);
148+
$serializer = new \EventSauce\ObjectHydrator\PropertySerializers\SerializeDateTime(...array (
149+
));
155150
}
156-
151+
157152
return $serializer->serialize($value, $this);
158153
}
159154

155+
160156
private function serializeValueDateTimeImmutable(mixed $value): mixed
161157
{
162158
static $serializer;
163-
159+
164160
if ($serializer === null) {
165-
$serializer = new SerializeDateTime(...[]);
161+
$serializer = new \EventSauce\ObjectHydrator\PropertySerializers\SerializeDateTime(...array (
162+
));
166163
}
167-
164+
168165
return $serializer->serialize($value, $this);
169166
}
170167

168+
171169
private function serializeValueDateTimeInterface(mixed $value): mixed
172170
{
173171
static $serializer;
174-
172+
175173
if ($serializer === null) {
176-
$serializer = new SerializeDateTime(...[]);
174+
$serializer = new \EventSauce\ObjectHydrator\PropertySerializers\SerializeDateTime(...array (
175+
));
177176
}
178-
177+
179178
return $serializer->serialize($value, $this);
180179
}
181180

181+
182182
private function serializeObjectApiClients⚡️Client⚡️Github⚡️OpenAPI⚡️ApiGitHubCom⚡️Schema⚡️WebhookConfig(mixed $object): mixed
183183
{
184-
assert($object instanceof WebhookConfig);
184+
\assert($object instanceof \ApiClients\Client\Github\OpenAPI\ApiGitHubCom\Schema\WebhookConfig);
185185
$result = [];
186-
186+
187187
$url = $object->url;
188188

189189
if ($url === null) {
190190
goto after_url;
191191
}
192-
193192
after_url: $result['url'] = $url;
194193

194+
195195
$content_type = $object->content_type;
196196

197197
if ($content_type === null) {
198198
goto after_content_type;
199199
}
200-
201200
after_content_type: $result['content_type'] = $content_type;
202201

202+
203203
$secret = $object->secret;
204204

205205
if ($secret === null) {
206206
goto after_secret;
207207
}
208-
209208
after_secret: $result['secret'] = $secret;
210209

210+
211211
$insecure_ssl = $object->insecure_ssl;
212212

213213
if ($insecure_ssl === null) {
214214
goto after_insecure_ssl;
215215
}
216-
217216
after_insecure_ssl: $result['insecure_ssl'] = $insecure_ssl;
218217

218+
219219
return $result;
220220
}
221+
222+
221223

222224
/**
225+
* @template T
226+
*
223227
* @param class-string<T> $className
224228
* @param iterable<array> $payloads;
225229
*
226230
* @return IterableList<T>
227231
*
228232
* @throws UnableToHydrateObject
229-
*
230-
* @template T
231233
*/
232234
public function hydrateObjects(string $className, iterable $payloads): IterableList
233235
{
@@ -242,14 +244,14 @@ private function doHydrateObjects(string $className, iterable $payloads): Genera
242244
}
243245

244246
/**
247+
* @template T
248+
*
245249
* @param class-string<T> $className
246250
* @param iterable<array> $payloads;
247251
*
248252
* @return IterableList<T>
249253
*
250254
* @throws UnableToSerializeObject
251-
*
252-
* @template T
253255
*/
254256
public function serializeObjects(iterable $payloads): IterableList
255257
{

0 commit comments

Comments
 (0)