@@ -7,10 +7,10 @@ discard block |
||
| 7 | 7 | use Youshido\GraphQL\Type\Object\ObjectType; |
| 8 | 8 | use Youshido\GraphQL\Type\Scalar\StringType; |
| 9 | 9 | |
| 10 | -if(file_exists(__DIR__ . '/../../../../../vendor/autoload.php')) { |
|
| 11 | - require_once __DIR__ . '/../../../../../vendor/autoload.php'; |
|
| 10 | +if (file_exists(__DIR__.'/../../../../../vendor/autoload.php')) { |
|
| 11 | + require_once __DIR__.'/../../../../../vendor/autoload.php'; |
|
| 12 | 12 | } else { |
| 13 | - require_once realpath(__DIR__ . '/../..') . '/vendor/autoload.php'; |
|
| 13 | + require_once realpath(__DIR__.'/../..').'/vendor/autoload.php'; |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | $processor = new Processor(new Schema([ |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | 'fields' => [ |
| 20 | 20 | 'currentTime' => [ |
| 21 | 21 | 'type' => new StringType(), |
| 22 | - 'resolve' => function () { |
|
| 22 | + 'resolve' => function() { |
|
| 23 | 23 | return date('Y-m-d H:ia'); |
| 24 | 24 | } |
| 25 | 25 | ] |
@@ -28,4 +28,4 @@ discard block |
||
| 28 | 28 | ])); |
| 29 | 29 | |
| 30 | 30 | $processor->processPayload('{ currentTime }'); |
| 31 | -echo json_encode($processor->getResponseData()) . "\n"; |
|
| 31 | +echo json_encode($processor->getResponseData())."\n"; |
|
@@ -28,8 +28,8 @@ |
||
| 28 | 28 | 'args' => [ |
| 29 | 29 | 'truncated' => new BooleanType() |
| 30 | 30 | ], |
| 31 | - 'resolve' => function ($value, $args) { |
|
| 32 | - return (!empty($args['truncated'])) ? explode(' ', $value)[0] . '...' : $value; |
|
| 31 | + 'resolve' => function($value, $args) { |
|
| 32 | + return (!empty($args['truncated'])) ? explode(' ', $value)[0].'...' : $value; |
|
| 33 | 33 | } |
| 34 | 34 | ]) |
| 35 | 35 | ->addField( |
@@ -2,18 +2,18 @@ |
||
| 2 | 2 | |
| 3 | 3 | namespace BlogTest; |
| 4 | 4 | |
| 5 | -if(file_exists(__DIR__ . '/../../../../../vendor/autoload.php')) { |
|
| 6 | - require_once __DIR__ . '/../../../../../vendor/autoload.php'; |
|
| 5 | +if (file_exists(__DIR__.'/../../../../../vendor/autoload.php')) { |
|
| 6 | + require_once __DIR__.'/../../../../../vendor/autoload.php'; |
|
| 7 | 7 | } else { |
| 8 | - require_once realpath(__DIR__ . '/../..') . '/vendor/autoload.php'; |
|
| 8 | + require_once realpath(__DIR__.'/../..').'/vendor/autoload.php'; |
|
| 9 | 9 | } |
| 10 | 10 | |
| 11 | -require_once __DIR__ . '/Schema/DataProvider.php'; |
|
| 12 | -require_once __DIR__ . '/Schema/PostType.php'; |
|
| 13 | -require_once __DIR__ . '/Schema/PostStatus.php'; |
|
| 14 | -require_once __DIR__ . '/Schema/ContentBlockInterface.php'; |
|
| 15 | -require_once __DIR__ . '/Schema/LikePostField.php'; |
|
| 16 | -require_once __DIR__ . '/Schema/BannerType.php'; |
|
| 17 | -require_once __DIR__ . '/Schema/ContentBlockUnion.php'; |
|
| 18 | -require_once __DIR__ . '/Schema/PostInputType.php'; |
|
| 19 | -require_once __DIR__ . '/Schema/BlogSchema.php'; |
|
| 11 | +require_once __DIR__.'/Schema/DataProvider.php'; |
|
| 12 | +require_once __DIR__.'/Schema/PostType.php'; |
|
| 13 | +require_once __DIR__.'/Schema/PostStatus.php'; |
|
| 14 | +require_once __DIR__.'/Schema/ContentBlockInterface.php'; |
|
| 15 | +require_once __DIR__.'/Schema/LikePostField.php'; |
|
| 16 | +require_once __DIR__.'/Schema/BannerType.php'; |
|
| 17 | +require_once __DIR__.'/Schema/ContentBlockUnion.php'; |
|
| 18 | +require_once __DIR__.'/Schema/PostInputType.php'; |
|
| 19 | +require_once __DIR__.'/Schema/BlogSchema.php'; |
|
@@ -17,16 +17,16 @@ discard block |
||
| 17 | 17 | 'fields' => [ |
| 18 | 18 | // here you have a complex field with a lot of options |
| 19 | 19 | 'title' => [ |
| 20 | - 'type' => new StringType(), // string type |
|
| 21 | - 'description' => 'This field contains a post title', // description |
|
| 22 | - 'isDeprecated' => true, // marked as deprecated |
|
| 23 | - 'deprecationReason' => 'field title is now deprecated', // explain the reason |
|
| 20 | + 'type' => new StringType(), // string type |
|
| 21 | + 'description' => 'This field contains a post title', // description |
|
| 22 | + 'isDeprecated' => true, // marked as deprecated |
|
| 23 | + 'deprecationReason' => 'field title is now deprecated', // explain the reason |
|
| 24 | 24 | 'args' => [ |
| 25 | 25 | 'truncated' => new BooleanType() // add an optional argument |
| 26 | 26 | ], |
| 27 | - 'resolve' => function ($value, $args) { |
|
| 27 | + 'resolve' => function($value, $args) { |
|
| 28 | 28 | // used argument to modify a field value |
| 29 | - return (!empty($args['truncated'])) ? explode(' ', $value['title'])[0] . '...' : $value['title']; |
|
| 29 | + return (!empty($args['truncated'])) ? explode(' ', $value['title'])[0].'...' : $value['title']; |
|
| 30 | 30 | } |
| 31 | 31 | ], |
| 32 | 32 | // if field just has a type, you can use a short declaration syntax like this |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | 'id' => new IntType() |
| 40 | 40 | ], |
| 41 | 41 | // resolve function for the query |
| 42 | - 'resolve' => function () { |
|
| 42 | + 'resolve' => function() { |
|
| 43 | 43 | return [ |
| 44 | 44 | 'title' => 'Title for the latest Post', |
| 45 | 45 | 'summary' => 'Post summary', |
@@ -6,13 +6,13 @@ discard block |
||
| 6 | 6 | use Youshido\GraphQL\Schema\Schema; |
| 7 | 7 | use Youshido\GraphQL\Type\Object\ObjectType; |
| 8 | 8 | |
| 9 | -if(file_exists(__DIR__ . '/../../../../../vendor/autoload.php')) { |
|
| 10 | - require_once __DIR__ . '/../../../../../vendor/autoload.php'; |
|
| 9 | +if (file_exists(__DIR__.'/../../../../../vendor/autoload.php')) { |
|
| 10 | + require_once __DIR__.'/../../../../../vendor/autoload.php'; |
|
| 11 | 11 | } else { |
| 12 | - require_once realpath(__DIR__ . '/../..') . '/vendor/autoload.php'; |
|
| 12 | + require_once realpath(__DIR__.'/../..').'/vendor/autoload.php'; |
|
| 13 | 13 | } |
| 14 | 14 | |
| 15 | -require_once __DIR__ . '/inline-schema.php'; |
|
| 15 | +require_once __DIR__.'/inline-schema.php'; |
|
| 16 | 16 | /** @var ObjectType $rootQueryType */ |
| 17 | 17 | |
| 18 | 18 | $processor = new Processor(new Schema([ |
@@ -21,4 +21,4 @@ discard block |
||
| 21 | 21 | $payload = '{ latestPost { title(truncated: true), summary } }'; |
| 22 | 22 | |
| 23 | 23 | $processor->processPayload($payload); |
| 24 | -echo json_encode($processor->getResponseData()) . "\n"; |
|
| 24 | +echo json_encode($processor->getResponseData())."\n"; |
|