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

AxeWP / wp-graphql-headless-login / #77

03 Aug 2025 09:57PM UTC coverage: 82.325% (-0.2%) from 82.559%
#77

push

php-coveralls

web-flow
Merge 30a6f1f59 into ecab1fdba

2287 of 2778 relevant lines covered (82.33%)

24.01 hits per line

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

94.12
/src/Type/WPObject/ClientOptions.php
1
<?php
2
/**
3
 * Registers the individual Client Options GraphQL objects for each Login provider.
4
 *
5
 * @package WPGraphQL\Login\Type\WPObject
6
 */
7

8
declare( strict_types = 1 );
9

10
namespace WPGraphQL\Login\Type\WPObject;
11

12
use WPGraphQL\Login\Auth\ProviderRegistry;
13
use WPGraphQL\Login\Type\WPInterface\ClientOptions as ClientOptionsInterface;
14
use WPGraphQL\Login\Vendor\AxeWP\GraphQL\Abstracts\Type;
15
use WPGraphQL\Login\Vendor\AxeWP\GraphQL\Helper\Compat;
16

17
/**
18
 * Class - ClientOptions
19
 *
20
 * phpcs:disable SlevomatCodingStandard.Namespaces.FullyQualifiedClassNameInAnnotation -- PHPStan formatting.
21
 *
22
 * @phpstan-import-type ObjectTypeConfig from \WPGraphQL\Login\Vendor\AxeWP\GraphQL\Abstracts\ObjectType
23
 * @extends \WPGraphQL\Login\Vendor\AxeWP\GraphQL\Abstracts\Type<ObjectTypeConfig>
24
 *
25
 * phpcs:enable SlevomatCodingStandard.Namespaces.FullyQualifiedClassNameInAnnotation
26
 */
27
class ClientOptions extends Type {
28
        /**
29
         * {@inheritDoc}
30
         */
31
        public static function register(): void {
32
                $providers = ProviderRegistry::get_instance()->get_registered_providers();
67✔
33

34
                foreach ( $providers as $slug => $provider ) {
67✔
35
                        $name   = static::type_name( $slug );
67✔
36
                        $fields = $provider::get_client_options_fields();
67✔
37
                        $config = [
67✔
38
                                'description'     => static fn () => sprintf(
67✔
39
                                        self::get_description(),
67✔
40
                                        $slug
67✔
41
                                ),
67✔
42
                                'fields'          => $fields,
67✔
43
                                'interfaces'      => [ ClientOptionsInterface::get_type_name() ],
67✔
44
                                'eagerlyLoadType' => true,
67✔
45
                        ];
67✔
46

47
                        // @todo Remove this when WPGraphQL 2.3.0 is minimum.
48
                        $config = Compat::resolve_graphql_config( $config );
67✔
49

50
                        register_graphql_object_type( $name, $config );
67✔
51
                }
52
        }
53

54
        /**
55
         * {@inheritDoc}
56
         */
57
        public static function type_name( ?string $provider = null ): string {
58
                return graphql_format_type_name( ucfirst( (string) $provider ) . 'ClientOptions' );
67✔
59
        }
60

61
        /**
62
         * {@inheritDoc}
63
         */
64
        public static function get_description(): string {
65
                // translators: %s is the provider name.
66
                return __( 'The Login client options for the %s provider.', 'wp-graphql-headless-login' );
×
67
        }
68
}
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