Autogenerated
4 weeks ago
GraphQLEndpointRegistrar.php
4 weeks ago
OpcacheFileExpiry.php
4 weeks ago
QueryCache.php
4 weeks ago
QueryComplexityRule.php
4 weeks ago
QueryDepthRule.php
4 weeks ago
Settings.php
4 weeks ago
StatusResolverFailedException.php
4 weeks ago
QueryComplexityRule.php
27 lines
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Automattic\WooCommerce\Internal\Api; |
| 6 | |
| 7 | use Automattic\WooCommerce\Vendor\GraphQL\Validator\Rules\QueryComplexity; |
| 8 | |
| 9 | /** |
| 10 | * QueryComplexity validation rule that returns a generic error message when the complexity is exceeded. |
| 11 | * |
| 12 | * Admins can still read both values via debug mode; see |
| 13 | * {@see GraphQLController} step 8. |
| 14 | */ |
| 15 | class QueryComplexityRule extends QueryComplexity { |
| 16 | /** |
| 17 | * Override webonyx's default ("Max query complexity should be {max} but |
| 18 | * got {count}."). |
| 19 | * |
| 20 | * @param int $max The configured maximum complexity (unused). |
| 21 | * @param int $count The computed query complexity (unused). |
| 22 | */ |
| 23 | public static function maxQueryComplexityErrorMessage( int $max, int $count ): string { |
| 24 | return 'Maximum query complexity exceeded.'; |
| 25 | } |
| 26 | } |
| 27 |