Skip to content

Commit 7e3327f

Browse files
committed
fix #1
Need to tidy up code formatting
1 parent dceb2a0 commit 7e3327f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+391
-311
lines changed

README.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,23 @@
44

55
# php-graphql
66

7-
php-graphql is a pure php implementation of the latest GraphQL [specification](https://github.com/graphql/graphql-spec) based on the [reference implementation in JavaScript](https://github.com/graphql/graphql-js).
7+
php-graphql is a pure php implementation of the latest GraphQL [specification](https://github.com/graphql/graphql-spec)
8+
based on the [reference implementation in JavaScript](https://github.com/graphql/graphql-js).
89

910
## Installation
11+
1012
**git clone:**
13+
1114
````bash
1215
git clone https://github.com/joonlabs/php-graphql.git
1316
````
17+
1418
after downloading include the autloader.php, e.g.:
19+
1520
````php
1621
require 'php-graphql/src/autoloader.php';
1722
````
23+
1824
## Hello world!
1925

2026
```php
@@ -48,8 +54,9 @@ $server->listen();
4854
That's it! Now the GraphQL server is ready to accept requests at the URL of the PHP script.
4955

5056
## Backers and sponsors
57+
5158
<img src="https://joonlabs.com/php-graphql/backers/joon.png" alt="index.js logo" height="30"/><br>
52-
see [joonlabs.com](https://joonlabs.com)
59+
see [joonlabs.com](https://joonlabs.com)
5360
<br>
5461
<br>
5562
<img src="https://joonlabs.com/php-graphql/backers/leafx.png" alt="index.js logo" height="30"/><br>

examples/books/__data.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
<?php
22
// data
33
$books = [
4-
[ "id"=> 1, "name"=> 'Harry Potter and the Chamber of Secrets', "authorId"=> 1 ],
5-
[ "id"=> 2, "name"=> 'Harry Potter and the Prisoner of Azkaban', "authorId"=> 1 ],
6-
[ "id"=> 3, "name"=> 'Harry Potter and the Goblet of Fire', "authorId"=> 1 ],
7-
[ "id"=> 4, "name"=> 'The Fellowship of the Ring', "authorId"=> 2 ],
8-
[ "id"=> 5, "name"=> 'The Two Towers', "authorId"=> 2 ],
9-
[ "id"=> 6, "name"=> 'The Return of the King', "authorId"=> 2 ],
10-
[ "id"=> 7, "name"=> 'The Way of Shadows', "authorId"=> 3 ],
11-
[ "id"=> 8, "name"=> 'Beyond the Shadows', "authorId"=> 3 ]
4+
["id" => 1, "name" => 'Harry Potter and the Chamber of Secrets', "authorId" => 1],
5+
["id" => 2, "name" => 'Harry Potter and the Prisoner of Azkaban', "authorId" => 1],
6+
["id" => 3, "name" => 'Harry Potter and the Goblet of Fire', "authorId" => 1],
7+
["id" => 4, "name" => 'The Fellowship of the Ring', "authorId" => 2],
8+
["id" => 5, "name" => 'The Two Towers', "authorId" => 2],
9+
["id" => 6, "name" => 'The Return of the King', "authorId" => 2],
10+
["id" => 7, "name" => 'The Way of Shadows', "authorId" => 3],
11+
["id" => 8, "name" => 'Beyond the Shadows', "authorId" => 3]
1212
];
1313
$authors = [
14-
[ "id"=> 1, "name"=> 'J. K. Rowling' ],
15-
[ "id"=> 2, "name"=> 'J. R. R. Tolkien' ],
16-
[ "id"=> 3, "name"=> 'Brent Weeks' ]
14+
["id" => 1, "name" => 'J. K. Rowling'],
15+
["id" => 2, "name" => 'J. R. R. Tolkien'],
16+
["id" => 3, "name" => 'Brent Weeks']
1717
];
1818
?>

examples/parser/index.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
// include the php-graphql-autoloader
66
require '../../src/autoloader.php';
7+
78
use \GraphQL\Parser\Parser;
89

910
$parser = new Parser();
@@ -87,9 +88,9 @@ enumValues(includeDeprecated: true) {
8788
}
8889
';
8990

90-
try{
91+
try {
9192
echo json_encode($parser->parse($query));
92-
}catch (\GraphQL\Errors\GraphQLError $e){
93+
} catch (\GraphQL\Errors\GraphQLError $e) {
9394
var_dump($e->getMessage(), $e->getLocations());
9495
}
9596

src/Arguments/GraphQLArgument.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@
44

55
use GraphQL\Types\GraphQLType;
66

7-
abstract class GraphQLArgument{
7+
abstract class GraphQLArgument
8+
{
89
protected $id;
910
protected $type;
1011

11-
public function __construct(string $id, GraphQLType $type, string $description="", $defaultValue=null, ?string $deprecationReason=null)
12+
public function __construct(string $id, GraphQLType $type, string $description = "", $defaultValue = null, ?string $deprecationReason = null)
1213
{
1314
$this->id = $id;
1415
$this->description = $description;

src/Directives/GraphQLDirective.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
<?php
2+
23
namespace GraphQL\Directives;
34

4-
class GraphQLDirective{
5+
class GraphQLDirective
6+
{
57
protected $name;
68
protected $arguments;
79
protected $description;
@@ -48,4 +50,5 @@ public function isRepetable(): bool
4850
return $this->isRepetable;
4951
}
5052
}
53+
5154
?>
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
<?php
2+
23
namespace GraphQL\Directives;
34

45
use GraphQL\Arguments\GraphQLDirectiveArgument;
56
use GraphQL\Types\GraphQLBoolean;
67

7-
class GraphQLIncludeDirective extends GraphQLDirective {
8+
class GraphQLIncludeDirective extends GraphQLDirective
9+
{
810
protected $name = "include";
911

1012
public function __construct()
1113
{
1214
$this->arguments = [
13-
new GraphQLDirectiveArgument("if", new GraphQLBoolean(), "Determines whether to include the target field or not",true)
15+
new GraphQLDirectiveArgument("if", new GraphQLBoolean(), "Determines whether to include the target field or not", true)
1416
];
1517
}
1618
}
19+
1720
?>

src/Directives/GraphQLSkipDirective.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
<?php
2+
23
namespace GraphQL\Directives;
34

45
use GraphQL\Arguments\GraphQLDirectiveArgument;
56
use GraphQL\Types\GraphQLBoolean;
67

7-
class GraphQLSkipDirective extends GraphQLDirective {
8+
class GraphQLSkipDirective extends GraphQLDirective
9+
{
810
protected $name = "skip";
911

1012
public function __construct()
@@ -14,4 +16,5 @@ public function __construct()
1416
];
1517
}
1618
}
19+
1720
?>

src/Errors/BadImplementationError.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ class BadImplementationError extends GraphQLError
66
{
77
protected $code = "BAD_IMPLEMENTATION";
88
}
9+
910
?>

src/Errors/BadUserInputError.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ class BadUserInputError extends GraphQLError
66
{
77
protected $code = "BAD_USER_INPUT";
88
}
9+
910
?>

src/Errors/ForbiddenError.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ class ForbiddenError extends GraphQLError
66
{
77
protected $code = "FORBIDDEN";
88
}
9+
910
?>

0 commit comments

Comments
 (0)