Skip to content

Commit 37ad4e9

Browse files
authored
Merge pull request #1477 from php-api-clients/GitHubEnterpriseCloud/from-1.1.4-13776516632b8263e4016cfcc797d2c2-from-1.1.4-13776516632b8263e4016cfcc797d2c2
2 parents fa41a79 + c750674 commit 37ad4e9

File tree

262 files changed

+30281
-9511
lines changed

Some content is hidden

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

262 files changed

+30281
-9511
lines changed

clients/GitHubEnterpriseCloud/README.md

Lines changed: 446 additions & 0 deletions
Large diffs are not rendered by default.

clients/GitHubEnterpriseCloud/etc/openapi-client-generator.state

Lines changed: 608 additions & 148 deletions
Large diffs are not rendered by default.

clients/GitHubEnterpriseCloud/src/Client.php

Lines changed: 7 additions & 7 deletions
Large diffs are not rendered by default.

clients/GitHubEnterpriseCloud/src/ClientInterface.php

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace ApiClients\Client\GitHubEnterpriseCloud\Internal\Attribute\CastUnionToType\Schema\Integration;
6+
7+
use ApiClients\Client\GitHubEnterpriseCloud\Schema;
8+
use Attribute;
9+
use EventSauce\ObjectHydrator\ObjectMapper;
10+
use EventSauce\ObjectHydrator\PropertyCaster;
11+
use Throwable;
12+
13+
use function array_keys;
14+
use function array_unique;
15+
use function implode;
16+
use function is_array;
17+
use function sort;
18+
19+
#[Attribute(Attribute::TARGET_PARAMETER)]
20+
final class Owner implements PropertyCaster
21+
{
22+
public function cast(mixed $value, ObjectMapper $hydrator): mixed
23+
{
24+
if (is_array($value)) {
25+
$signatureChunks = array_unique(array_keys($value));
26+
sort($signatureChunks);
27+
$signature = implode('|', $signatureChunks);
28+
if ($signature === 'avatar_url|email|events_url|followers_url|following_url|gists_url|gravatar_id|html_url|id|login|name|node_id|organizations_url|received_events_url|repos_url|site_admin|starred_at|starred_url|subscriptions_url|type|url|user_view_type') {
29+
try {
30+
return $hydrator->hydrateObject(Schema\SimpleUser::class, $value);
31+
} catch (Throwable) {
32+
}
33+
}
34+
35+
if ($signature === 'avatar_url|created_at|description|html_url|id|name|node_id|slug|updated_at|website_url') {
36+
try {
37+
return $hydrator->hydrateObject(Schema\Enterprise::class, $value);
38+
} catch (Throwable) {
39+
}
40+
}
41+
}
42+
43+
return $value;
44+
}
45+
}

0 commit comments

Comments
 (0)