@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | } |
11 | 11 | if ($_SERVER['REQUEST_URI'] == '/graphiql.css') { |
12 | 12 | header('Content-Type: text/css'); |
13 | - readfile(__DIR__ . '/../GraphiQL/graphiql.css'); |
|
13 | + readfile(__DIR__.'/../GraphiQL/graphiql.css'); |
|
14 | 14 | die(); |
15 | 15 | } |
16 | 16 | |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | use Youshido\GraphQL\Execution\Processor; |
19 | 19 | use Youshido\GraphQL\Schema\Schema; |
20 | 20 | |
21 | -require_once __DIR__ . '/schema-bootstrap.php'; |
|
21 | +require_once __DIR__.'/schema-bootstrap.php'; |
|
22 | 22 | /** @var Schema $schema */ |
23 | 23 | $schema = new BookStoreSchema(); |
24 | 24 | |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | $variables = isset($requestData['variables']) ? $requestData['variables'] : null; |
36 | 36 | |
37 | 37 | if (empty($payload)) { |
38 | - $GraphiQLData = file_get_contents(__DIR__ . '/../GraphiQL/index.html'); |
|
38 | + $GraphiQLData = file_get_contents(__DIR__.'/../GraphiQL/index.html'); |
|
39 | 39 | echo $GraphiQLData; |
40 | 40 | die(); |
41 | 41 | } |
@@ -149,6 +149,9 @@ discard block |
||
149 | 149 | return [$this->getAlias($query) => $value]; |
150 | 150 | } |
151 | 151 | |
152 | + /** |
|
153 | + * @return AstFieldInterface |
|
154 | + */ |
|
152 | 155 | protected function resolveField(FieldInterface $field, AstFieldInterface $ast, $parentValue = null, $fromObject = false) |
153 | 156 | { |
154 | 157 | try { |
@@ -220,6 +223,9 @@ discard block |
||
220 | 223 | } |
221 | 224 | } |
222 | 225 | |
226 | + /** |
|
227 | + * @param \Youshido\GraphQL\Parser\Ast\Interfaces\ValueInterface $argumentValue |
|
228 | + */ |
|
223 | 229 | private function prepareArgumentValue($argumentValue, AbstractType $argumentType, Request $request) |
224 | 230 | { |
225 | 231 | switch ($argumentType->getKind()) { |
@@ -337,9 +337,9 @@ discard block |
||
337 | 337 | } |
338 | 338 | |
339 | 339 | $fakeField = new Field([ |
340 | - 'name' => $field->getName(), |
|
341 | - 'type' => $itemType, |
|
342 | - 'args' => $field->getArguments(), |
|
340 | + 'name' => $field->getName(), |
|
341 | + 'type' => $itemType, |
|
342 | + 'args' => $field->getArguments(), |
|
343 | 343 | ]); |
344 | 344 | |
345 | 345 | $result = []; |
@@ -441,9 +441,9 @@ discard block |
||
441 | 441 | } |
442 | 442 | |
443 | 443 | $fakeField = new Field([ |
444 | - 'name' => $field->getName(), |
|
445 | - 'type' => $resolvedType, |
|
446 | - 'args' => $field->getArguments(), |
|
444 | + 'name' => $field->getName(), |
|
445 | + 'type' => $resolvedType, |
|
446 | + 'args' => $field->getArguments(), |
|
447 | 447 | ]); |
448 | 448 | |
449 | 449 | return $this->resolveObject($fakeField, $ast, $resolvedValue, true); |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * http://opensource.org/licenses/MIT |
10 | 10 | */ |
11 | 11 | |
12 | -declare(strict_types=1); |
|
12 | +declare(strict_types = 1); |
|
13 | 13 | /** |
14 | 14 | * Date: 03.11.16. |
15 | 15 | */ |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | { |
305 | 305 | $resolvedValue = $this->doResolve($field, $ast, $parentValue); |
306 | 306 | |
307 | - return $this->deferredResolve($resolvedValue, $field, function ($resolvedValue) use ($field, $ast, $parentValue) { |
|
307 | + return $this->deferredResolve($resolvedValue, $field, function($resolvedValue) use ($field, $ast, $parentValue) { |
|
308 | 308 | $this->resolveValidator->assertValidResolvedValueForField($field, $resolvedValue); |
309 | 309 | |
310 | 310 | /** @var AbstractScalarType $type */ |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | /** @var AstQuery $ast */ |
320 | 320 | $resolvedValue = $this->doResolve($field, $ast, $parentValue); |
321 | 321 | |
322 | - return $this->deferredResolve($resolvedValue, $field, function ($resolvedValue) use ($field, $ast, $parentValue) { |
|
322 | + return $this->deferredResolve($resolvedValue, $field, function($resolvedValue) use ($field, $ast, $parentValue) { |
|
323 | 323 | $this->resolveValidator->assertValidResolvedValueForField($field, $resolvedValue); |
324 | 324 | |
325 | 325 | if (null === $resolvedValue) { |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | |
347 | 347 | foreach ($resolvedValue as $resolvedValueItem) { |
348 | 348 | try { |
349 | - $fakeField->getConfig()->set('resolve', static function () use ($resolvedValueItem) { |
|
349 | + $fakeField->getConfig()->set('resolve', static function() use ($resolvedValueItem) { |
|
350 | 350 | return $resolvedValueItem; |
351 | 351 | }); |
352 | 352 | |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | $resolvedValue = $this->doResolve($field, $ast, $parentValue); |
393 | 393 | } |
394 | 394 | |
395 | - return $this->deferredResolve($resolvedValue, $field, function ($resolvedValue) use ($field, $ast, $parentValue) { |
|
395 | + return $this->deferredResolve($resolvedValue, $field, function($resolvedValue) use ($field, $ast, $parentValue) { |
|
396 | 396 | $this->resolveValidator->assertValidResolvedValueForField($field, $resolvedValue); |
397 | 397 | |
398 | 398 | if (null === $resolvedValue) { |
@@ -414,7 +414,7 @@ discard block |
||
414 | 414 | /** @var AstQuery $ast */ |
415 | 415 | $resolvedValue = $this->doResolve($field, $ast, $parentValue); |
416 | 416 | |
417 | - return $this->deferredResolve($resolvedValue, $field, function ($resolvedValue) use ($field, $ast, $parentValue) { |
|
417 | + return $this->deferredResolve($resolvedValue, $field, function($resolvedValue) use ($field, $ast, $parentValue) { |
|
418 | 418 | $this->resolveValidator->assertValidResolvedValueForField($field, $resolvedValue); |
419 | 419 | |
420 | 420 | if (null === $resolvedValue) { |
@@ -1,13 +1,13 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (is_file(__DIR__ . '/../../../../../vendor/autoload.php')) { |
|
4 | - require_once __DIR__ . '/../../../../../vendor/autoload.php'; |
|
3 | +if (is_file(__DIR__.'/../../../../../vendor/autoload.php')) { |
|
4 | + require_once __DIR__.'/../../../../../vendor/autoload.php'; |
|
5 | 5 | } |
6 | -require_once __DIR__ . '/../../vendor/autoload.php'; |
|
7 | -require_once __DIR__ . '/Schema/Type/BookType.php'; |
|
8 | -require_once __DIR__ . '/Schema/Type/AuthorType.php'; |
|
9 | -require_once __DIR__ . '/Schema/Type/CategoryType.php'; |
|
10 | -require_once __DIR__ . '/Schema/Field/Book/RecentBooksField.php'; |
|
11 | -require_once __DIR__ . '/Schema/Field/CategoriesField.php'; |
|
12 | -require_once __DIR__ . '/DataProvider.php'; |
|
13 | -require_once __DIR__ . '/Schema/BookStoreSchema.php'; |
|
6 | +require_once __DIR__.'/../../vendor/autoload.php'; |
|
7 | +require_once __DIR__.'/Schema/Type/BookType.php'; |
|
8 | +require_once __DIR__.'/Schema/Type/AuthorType.php'; |
|
9 | +require_once __DIR__.'/Schema/Type/CategoryType.php'; |
|
10 | +require_once __DIR__.'/Schema/Field/Book/RecentBooksField.php'; |
|
11 | +require_once __DIR__.'/Schema/Field/CategoriesField.php'; |
|
12 | +require_once __DIR__.'/DataProvider.php'; |
|
13 | +require_once __DIR__.'/Schema/BookStoreSchema.php'; |
@@ -24,12 +24,12 @@ |
||
24 | 24 | |
25 | 25 | public function resolve($value, array $args, ResolveInfo $info) |
26 | 26 | { |
27 | - return new DeferredResolver(function () use ($value) { |
|
28 | - $id = empty($value['id']) ? "1" : $value['id'] . ".1"; |
|
27 | + return new DeferredResolver(function() use ($value) { |
|
28 | + $id = empty($value['id']) ? "1" : $value['id'].".1"; |
|
29 | 29 | |
30 | 30 | return [ |
31 | 31 | 'id' => $id, |
32 | - 'title' => 'Category ' . $id, |
|
32 | + 'title' => 'Category '.$id, |
|
33 | 33 | 'authors' => [ |
34 | 34 | [ |
35 | 35 | 'id' => 'author1', |
@@ -24,7 +24,7 @@ |
||
24 | 24 | $config->getQuery()->addFields([ |
25 | 25 | 'authors' => [ |
26 | 26 | 'type' => new ListType(new AuthorType()), |
27 | - 'resolve' => function () { |
|
27 | + 'resolve' => function() { |
|
28 | 28 | return DataProvider::getAuthors(); |
29 | 29 | } |
30 | 30 | ], |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | -if (is_file(__DIR__ . '/../../../../../vendor/autoload.php')) { |
|
3 | - require_once __DIR__ . '/../../../../../vendor/autoload.php'; |
|
2 | +if (is_file(__DIR__.'/../../../../../vendor/autoload.php')) { |
|
3 | + require_once __DIR__.'/../../../../../vendor/autoload.php'; |
|
4 | 4 | } |
5 | 5 | |
6 | -require_once __DIR__ . '/../../vendor/autoload.php'; |
|
7 | -require_once __DIR__ . '/Schema/FactionType.php'; |
|
8 | -require_once __DIR__ . '/Schema/ShipType.php'; |
|
9 | -require_once __DIR__ . '/Schema/TestDataProvider.php'; |
|
10 | -require_once __DIR__ . '/Schema/StarWarsRelaySchema.php'; |
|
6 | +require_once __DIR__.'/../../vendor/autoload.php'; |
|
7 | +require_once __DIR__.'/Schema/FactionType.php'; |
|
8 | +require_once __DIR__.'/Schema/ShipType.php'; |
|
9 | +require_once __DIR__.'/Schema/TestDataProvider.php'; |
|
10 | +require_once __DIR__.'/Schema/StarWarsRelaySchema.php'; |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | } |
10 | 10 | if ($_SERVER['REQUEST_URI'] == '/graphiql.css') { |
11 | 11 | header('Content-Type: text/css'); |
12 | - readfile(__DIR__ . '/../GraphiQL/graphiql.css'); |
|
12 | + readfile(__DIR__.'/../GraphiQL/graphiql.css'); |
|
13 | 13 | die(); |
14 | 14 | } |
15 | 15 | |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | use Youshido\GraphQL\Execution\Processor; |
18 | 18 | use Youshido\GraphQL\Schema\Schema; |
19 | 19 | |
20 | -require_once __DIR__ . '/schema-bootstrap.php'; |
|
20 | +require_once __DIR__.'/schema-bootstrap.php'; |
|
21 | 21 | /** @var Schema $schema */ |
22 | 22 | $schema = new StarWarsRelaySchema(); |
23 | 23 | |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | $variables = isset($requestData['variables']) ? $requestData['variables'] : null; |
35 | 35 | |
36 | 36 | if (empty($payload)) { |
37 | - $GraphiQLData = file_get_contents(__DIR__ . '/../GraphiQL/index.html'); |
|
37 | + $GraphiQLData = file_get_contents(__DIR__.'/../GraphiQL/index.html'); |
|
38 | 38 | echo $GraphiQLData; |
39 | 39 | die(); |
40 | 40 | } |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | } |
148 | 148 | |
149 | 149 | /** |
150 | - * @param $key |
|
150 | + * @param string $key |
|
151 | 151 | * @param null $defaultValue |
152 | 152 | * |
153 | 153 | * @return callable|mixed|null |
@@ -157,6 +157,9 @@ discard block |
||
157 | 157 | return $this->has($key) ? $this->data[$key] : $defaultValue; |
158 | 158 | } |
159 | 159 | |
160 | + /** |
|
161 | + * @param string $key |
|
162 | + */ |
|
160 | 163 | public function set($key, $value) |
161 | 164 | { |
162 | 165 | $this->data[$key] = $value; |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | * http://opensource.org/licenses/MIT |
10 | 10 | */ |
11 | 11 | |
12 | -declare(strict_types=1); |
|
12 | +declare(strict_types = 1); |
|
13 | 13 | /* |
14 | 14 | * This file is a part of graphql-youshido project. |
15 | 15 | * |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | return $this->get(\lcfirst(\mb_substr($method, 2))); |
80 | 80 | } |
81 | 81 | |
82 | - throw new \Exception('Call to undefined method ' . $method); |
|
82 | + throw new \Exception('Call to undefined method '.$method); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | public function validate(): void |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | $validator = ConfigValidator::getInstance(); |
88 | 88 | |
89 | 89 | if (!$validator->validate($this->data, $this->getContextRules(), $this->extraFieldsAllowed)) { |
90 | - throw new ConfigurationException('Config is not valid for ' . ($this->contextObject ? \get_class($this->contextObject) : null) . "\n" . \implode("\n", $validator->getErrorsArray(false))); |
|
90 | + throw new ConfigurationException('Config is not valid for '.($this->contextObject ? \get_class($this->contextObject) : null)."\n".\implode("\n", $validator->getErrorsArray(false))); |
|
91 | 91 | } |
92 | 92 | } |
93 | 93 |
@@ -38,6 +38,9 @@ |
||
38 | 38 | */ |
39 | 39 | private $directiveList; |
40 | 40 | |
41 | + /** |
|
42 | + * @param \Youshido\GraphQL\Schema\AbstractSchema $contextObject |
|
43 | + */ |
|
41 | 44 | public function __construct(array $configData, $contextObject = null, $finalClass = false) |
42 | 45 | { |
43 | 46 | $this->typesList = new SchemaTypesList(); |
@@ -9,7 +9,7 @@ |
||
9 | 9 | * http://opensource.org/licenses/MIT |
10 | 10 | */ |
11 | 11 | |
12 | -declare(strict_types=1); |
|
12 | +declare(strict_types = 1); |
|
13 | 13 | /* |
14 | 14 | * This file is a part of graphql-youshido project. |
15 | 15 | * |