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

AxeWP / wp-graphql-rank-math / 5176687204

pending completion
5176687204

push

github

web-flow
chore: Implement WPGraphQL Code Standards (PHPCS) (#51)

* chore: lint for WPGraphQL-Minimum

* chore: lint for WPGraphQL-Strict

* chore: lint for WPGraphQL-Extra

* chore: lint for WPGraphQL (full)

* chore: update PHPCS ruleset

* chore: update changelog

* fix: restore `rank_math/head` hook

* chore: update composer deps (wpcli fix)

* chore: fix missed files

* chore: update composer deps

* test: bump boilerplate

* chore: update deps to final versions

93 of 93 new or added lines in 32 files covered. (100.0%)

1963 of 2274 relevant lines covered (86.32%)

5.42 hits per line

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

66.67
/src/CoreSchemaFilters.php
1
<?php
2
/**
3
 * Adds filters that modify core schema.
4
 *
5
 * @package WPGraphQL\RankMath
6
 */
7

8
namespace WPGraphQL\RankMath;
9

10
use WPGraphQL\RankMath\Vendor\AxeWP\GraphQL\Interfaces\Registrable;
11

12
/**
13
 * Class - CoreSchemaFilters
14
 */
15
class CoreSchemaFilters implements Registrable {
16
        /**
17
         * {@inheritDoc}
18
         */
19
        public static function init(): void {
20
                add_filter( 'graphql_seo_type_prefix', [ self::class, 'get_type_prefix' ] );
×
21
                add_filter( 'graphql_allowed_fields_on_restricted_type', [ self::class, 'allow_seo_on_post_types' ], 10, 2 );
×
22
        }
23

24
        /**
25
         * Prefixes all plugin GraphQL types.
26
         *
27
         * @param string $type_name the non-prefixed type name.
28
         */
29
        public static function get_type_prefix( string $type_name = null ): string {
30
                return ! empty( $type_name ) ? $type_name : 'RankMath';
9✔
31
        }
32

33
        /**
34
         * Sets seo to return on unauthenticated requests.
35
         *
36
         * @param string[] $allowed_fields .
37
         * @param string   $model_name .
38
         *
39
         * @return string[]
40
         */
41
        public static function allow_seo_on_post_types( array $allowed_fields, string $model_name ): array {
42
                if ( 'PostTypeObject' === $model_name ) {
2✔
43
                        $allowed_fields[] = 'seo';
1✔
44
                }
45

46
                return $allowed_fields;
2✔
47
        }
48
}
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