Skip to content

[GitHubEnterprise-3.13] Update to 1.1.4-446a3cd1fdbd8dda94d848b89bd8f6e2 from 1.1.4-398d18348d48e9783363f49ed8fadd49 #1467

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
216 changes: 110 additions & 106 deletions clients/GitHubEnterprise-3.13/etc/openapi-client-generator.state

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

declare(strict_types=1);

namespace ApiClients\Client\GitHubEnterprise\Internal\Attribute\CastUnionToType\Schema\Integration;

use ApiClients\Client\GitHubEnterprise\Schema;
use Attribute;
use EventSauce\ObjectHydrator\ObjectMapper;
use EventSauce\ObjectHydrator\PropertyCaster;
use Throwable;

use function array_keys;
use function array_unique;
use function implode;
use function is_array;
use function sort;

#[Attribute(Attribute::TARGET_PARAMETER)]
final class Owner implements PropertyCaster
{
public function cast(mixed $value, ObjectMapper $hydrator): mixed
{
if (is_array($value)) {
$signatureChunks = array_unique(array_keys($value));
sort($signatureChunks);
$signature = implode('|', $signatureChunks);
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') {
try {
return $hydrator->hydrateObject(Schema\SimpleUser::class, $value);
} catch (Throwable) {
}
}

if ($signature === 'avatar_url|created_at|description|html_url|id|name|node_id|slug|updated_at|website_url') {
try {
return $hydrator->hydrateObject(Schema\Enterprise::class, $value);
} catch (Throwable) {
}
}
}

return $value;
}
}
Loading
Loading