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

AxeWP / wp-graphql-rank-math / 10331310134

10 Aug 2024 11:40AM UTC coverage: 90.23% (-0.2%) from 90.42%
10331310134

push

github

web-flow
fix: improve openGraph type handling (#104)

10 of 22 new or added lines in 5 files covered. (45.45%)

2 existing lines in 2 files now uncovered.

2586 of 2866 relevant lines covered (90.23%)

11.01 hits per line

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

68.18
/src/Type/WPObject/OpenGraph/Facebook.php
1
<?php
2
/**
3
 * The Rank Math Facebook 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\Vendor\AxeWP\GraphQL\Abstracts\ObjectType;
13

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

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

32
        /**
33
         * {@inheritDoc}
34
         */
35
        public static function get_fields(): array {
36
                return [
18✔
37
                        'appId'  => [
18✔
38
                                'type'        => 'ID',
18✔
39
                                'description' => __( 'The Facebook app ID associated with this resource', 'wp-graphql-rank-math' ),
18✔
40
                                'resolve'     => static fn ( $source ): ?string => ! empty( $source['app_id'] ) ? (string) $source['app_id'] : null,
18✔
41
                        ],
18✔
42
                        'admins' => [
18✔
43
                                'type'        => [ 'list_of' => 'String' ],
18✔
44
                                'description' => __( 'The Facebook admins associated with this resource', 'wp-graphql-rank-math' ),
18✔
45
                                'resolve'     => static function ( $source ): ?array {
18✔
46
                                        $value = ! empty( $source['admins'] ) ? $source['admins'] : null;
×
47

NEW
48
                                        if ( empty( $value ) ) {
×
NEW
49
                                                return null;
×
50
                                        }
51

NEW
52
                                        if ( ! is_array( $value ) ) {
×
NEW
53
                                                $value = [ (string) $value ];
×
54
                                        }
55

56
                                        // Ensure all tags are strings.
NEW
57
                                        $value = array_map( 'strval', $value );
×
58

UNCOV
59
                                        return $value;
×
60
                                },
18✔
61
                        ],
18✔
62
                ];
18✔
63
        }
64
}
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