-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathAnalyzerItemInterface.php
More file actions
34 lines (29 loc) · 1.15 KB
/
Copy pathAnalyzerItemInterface.php
File metadata and controls
34 lines (29 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
/**
* Interface for a debug extension analyzer item (metric or rule).
*
* @package WPGraphQL\Debug\Analysis\Interfaces
*/
declare(strict_types=1);
namespace WPGraphQL\Debug\Analysis\Interfaces;
use GraphQL\Type\Schema;
interface AnalyzerItemInterface {
/**
* Executes the analysis (calculates metric or evaluates rule).
*
* @param string $query The GraphQL query string.
* @param array<string,mixed> $variables Optional: Variables provided with the query.
* @param Schema|null $schema Optional: The GraphQL schema.
* @return array<string,mixed> An associative array representing the analysis result.
* For metrics, it might contain 'value' and 'note'.
* For rules, it might contain 'triggered' and 'message'.
*/
public function analyze( string $query, array $variables = [], ?Schema $schema = null ): array;
/**
* Returns the key under which this item's result should appear in the 'debugExtensions' output.
* E.g., 'complexity', 'nestedQueryRule', 'excessiveFieldsRule'.
*
* @return string The unique key for the analyzer item.
*/
public function getKey(): string;
}