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

AxeWP / wp-graphql-rank-math / 15507492505

07 Jun 2025 11:44AM UTC coverage: 86.429% (-2.0%) from 88.44%
15507492505

push

github

web-flow
dev: add support for lazy-loading `description`/`deprecationReason` config values (#121)

* chore: update strauss and deps

* dev: use callable descriptions/deprecations

* fix: dont prefix `NodeWithRankMathSeo`

* chore: fix backcompat on connections

* chore: update dep

* chore: update deps

* tests: ensure schema can build

* chore: update and cleanup

* fix: regenerate autoloader

357 of 367 new or added lines in 66 files covered. (97.28%)

60 existing lines in 60 files now uncovered.

2541 of 2940 relevant lines covered (86.43%)

11.49 hits per line

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

87.32
/src/Type/WPObject/OpenGraph/Twitter.php
1
<?php
2
/**
3
 * The Rank Math Twitter OpenGraph meta tags GraphQL Object.
4
 *
5
 * @package WPGraphQL\RankMath\Type\WPObject
6
 */
7

8
declare( strict_types = 1 );
9

10
namespace WPGraphQL\RankMath\Type\WPObject\OpenGraph;
11

12
use WPGraphQL\RankMath\Type\Enum\TwitterCardTypeEnum;
13
use WPGraphQL\RankMath\Vendor\AxeWP\GraphQL\Abstracts\ObjectType;
14

15
/**
16
 * Class - Twitter
17
 */
18
class Twitter extends ObjectType {
19
        /**
20
         * {@inheritDoc}
21
         */
22
        protected static function type_name(): string {
23
                return 'OpenGraphTwitter';
20✔
24
        }
25

26
        /**
27
         * {@inheritDoc}
28
         */
29
        public static function get_description(): string {
UNCOV
30
                return __( 'The OpenGraph Twitter meta.', 'wp-graphql-rank-math' );
×
31
        }
32

33
        /**
34
         * {@inheritDoc}
35
         */
36
        public static function get_fields(): array {
37
                return [
20✔
38
                        'card'                    => [
20✔
39
                                'type'        => TwitterCardTypeEnum::get_type_name(),
20✔
40
                                'description' => static fn () => __( 'The Twitter card type', 'wp-graphql-rank-math' ),
20✔
41
                        ],
20✔
42
                        'title'                   => [
20✔
43
                                'type'        => 'String',
20✔
44
                                'description' => static fn () => __( 'Title of content', 'wp-graphql-rank-math' ),
20✔
45
                        ],
20✔
46
                        'description'             => [
20✔
47
                                'type'        => 'String',
20✔
48
                                'description' => static fn () => __( 'Description of content (maximum 200 characters)', 'wp-graphql-rank-math' ),
20✔
49
                        ],
20✔
50
                        'appCountry'              => [
20✔
51
                                'type'        => 'String',
20✔
52
                                'description' => static fn () => __( 'The app country.', 'wp-graphql-rank-math' ),
20✔
53
                                'resolve'     => static fn ( $source ): ?string => ! empty( $source['app:country'] ) ? (string) $source['app:country'] : null,
20✔
54
                        ],
20✔
55
                        'ipadApp'                 => [
20✔
56
                                'type'        => TwitterApp::get_type_name(),
20✔
57
                                'description' => static fn () => __( 'The Twitter iPad app meta', 'wp-graphql-rank-math' ),
20✔
58
                                'resolve'     => static fn ( $source ): ?array => self::get_app_meta( $source, 'ipad' ),
20✔
59
                        ],
20✔
60
                        'iphoneApp'               => [
20✔
61
                                'type'        => TwitterApp::get_type_name(),
20✔
62
                                'description' => static fn () => __( 'The Twitter iPhone app meta', 'wp-graphql-rank-math' ),
20✔
63
                                'resolve'     => static fn ( $source ): ?array => self::get_app_meta( $source, 'iphone' ),
20✔
64
                        ],
20✔
65
                        'googleplayApp'           => [
20✔
66
                                'type'        => TwitterApp::get_type_name(),
20✔
67
                                'description' => static fn () => __( 'The Twitter Google Play app meta', 'wp-graphql-rank-math' ),
20✔
68
                                'resolve'     => static fn ( $source ): ?array => self::get_app_meta( $source, 'googleplay' ),
20✔
69
                        ],
20✔
70
                        'playerUrl'               => [
20✔
71
                                'type'        => 'Int',
20✔
72
                                'description' => static fn () => __( 'URL of the twitter player.', 'wp-graphql-rank-math' ),
20✔
73
                                'resolve'     => static fn ( $source ): ?int => ! empty( $source['player'] ) ? (int) $source['player'] : null,
20✔
74
                        ],
20✔
75
                        'playerStream'            => [
20✔
76
                                'type'        => 'String',
20✔
77
                                'description' => static fn () => __( 'URL to raw video or audio stream', 'wp-graphql-rank-math' ),
20✔
78
                                'resolve'     => static fn ( $source ): ?string => ! empty( $source['player:stream'] ) ? (string) $source['player:stream'] : null,
20✔
79
                        ],
20✔
80
                        'site'                    => [
20✔
81
                                'type'        => 'String',
20✔
82
                                'description' => static fn () => __( '@username of website', 'wp-graphql-rank-math' ),
20✔
83
                        ],
20✔
84
                        'playerStreamContentType' => [
20✔
85
                                'type'        => 'String',
20✔
86
                                'description' => static fn () => __( 'The content type of the stream', 'wp-graphql-rank-math' ),
20✔
87
                                'resolve'     => static fn ( $source ): ?string => ! empty( $source['player:stream:content_type'] ) ? (string) $source['player:stream:content_type'] : null,
20✔
88
                        ],
20✔
89
                        'image'                   => [
20✔
90
                                'type'        => 'String',
20✔
91
                                'description' => static fn () => __( 'URL of image to use in the card.', 'wp-graphql-rank-math' ),
20✔
92
                        ],
20✔
93
                        'creator'                 => [
20✔
94
                                'type'        => 'String',
20✔
95
                                'description' => static fn () => __( '@username of content creator', 'wp-graphql-rank-math' ),
20✔
96
                        ],
20✔
97

98
                ];
20✔
99
        }
100

101
        /**
102
         * Get the app meta for the twitter app type.
103
         *
104
         * @param array<string, mixed> $source The values from the resolver.
105
         * @param string               $type The app type.
106
         *
107
         * @return ?array<string, mixed>
108
         */
109
        protected static function get_app_meta( array $source, string $type ): ?array {
110
                $values = [];
×
111

112
                if ( ! empty( $source[ 'app:name:' . $type ] ) ) {
×
113
                        $values['name'] = $source[ 'app:name:' . $type ];
×
114
                }
115
                if ( ! empty( $source[ 'app:id:' . $type ] ) ) {
×
116
                        $values['id'] = $source[ 'app:id:' . $type ];
×
117
                }
118
                if ( ! empty( $source[ 'app:url:' . $type ] ) ) {
×
119
                        $values['url'] = $source[ 'app:url:' . $type ];
×
120
                }
121

122
                return $values ?: null;
×
123
        }
124
}
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