• 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

92.31
/src/Type/WPObject/OpenGraph/Product.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\Type\Enum\OpenGraphProductAvailabilityEnum;
13
use WPGraphQL\RankMath\Vendor\AxeWP\GraphQL\Abstracts\ObjectType;
14

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

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

33
        /**
34
         * {@inheritDoc}
35
         */
36
        public static function get_fields(): array {
37
                return [
18✔
38
                        'brand'        => [
18✔
39
                                'type'        => 'String',
18✔
40
                                'description' => __( 'The brand of the product.', 'wp-graphql-rank-math' ),
18✔
41
                        ],
18✔
42
                        'price'        => [
18✔
43
                                'type'        => 'Float',
18✔
44
                                'description' => __( 'The price of the object', 'wp-graphql-rank-math' ),
18✔
45
                                'resolve'     => static function ( $source ): ?float {
18✔
NEW
46
                                        return ! empty( $source['price']['amount'] ) ? (float) $source['price']['amount'] : null;
×
47
                                },
18✔
48
                        ],
18✔
49
                        'currency'     => [
18✔
50
                                'type'        => 'String',
18✔
51
                                'description' => __( 'The currency of the object price.', 'wp-graphql-rank-math' ),
18✔
52
                                'resolve'     => static function ( $source ): ?string {
18✔
NEW
53
                                        return ! empty( $source['price']['currency'] ) ? (string) $source['price']['currency'] : null;
×
54
                                },
18✔
55
                        ],
18✔
56
                        'availability' => [
18✔
57
                                'type'        => OpenGraphProductAvailabilityEnum::get_type_name(),
18✔
58
                                'description' => __( 'The currency of the object price.', 'wp-graphql-rank-math' ),
18✔
59
                        ],
18✔
60

61
                ];
18✔
62
        }
63
}
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