Total Complexity | 6 |
Total Lines | 81 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
15 | class StarWarsBench |
||
16 | { |
||
17 | private $introQuery; |
||
18 | |||
19 | public function setIntroQuery() |
||
20 | { |
||
21 | $this->introQuery = Introspection::getIntrospectionQuery(); |
||
22 | } |
||
23 | |||
24 | public function benchSchema() |
||
25 | { |
||
26 | StarWarsSchema::build(); |
||
27 | } |
||
28 | |||
29 | public function benchHeroQuery() |
||
42 | ); |
||
43 | } |
||
44 | |||
45 | public function benchNestedQuery() |
||
46 | { |
||
47 | $q = ' |
||
48 | query NestedQuery { |
||
49 | hero { |
||
50 | name |
||
51 | friends { |
||
52 | name |
||
53 | appearsIn |
||
54 | friends { |
||
55 | name |
||
56 | } |
||
57 | } |
||
58 | } |
||
59 | } |
||
60 | '; |
||
61 | GraphQL::executeQuery( |
||
62 | StarWarsSchema::build(), |
||
63 | $q |
||
64 | ); |
||
65 | } |
||
66 | |||
67 | public function benchQueryWithFragment() |
||
68 | { |
||
69 | $q = ' |
||
70 | query UseFragment { |
||
71 | luke: human(id: "1000") { |
||
72 | ...HumanFragment |
||
73 | } |
||
74 | leia: human(id: "1003") { |
||
75 | ...HumanFragment |
||
76 | } |
||
77 | } |
||
78 | |||
79 | fragment HumanFragment on Human { |
||
80 | name |
||
81 | homePlanet |
||
82 | } |
||
83 | '; |
||
84 | |||
85 | GraphQL::executeQuery( |
||
86 | StarWarsSchema::build(), |
||
87 | $q |
||
88 | ); |
||
89 | } |
||
90 | |||
91 | public function benchStarWarsIntrospectionQuery() |
||
96 | ); |
||
97 | } |
||
98 | } |
||
99 |