@@ -23,8 +23,8 @@ |
||
| 23 | 23 | |
| 24 | 24 | public function getDescription() |
| 25 | 25 | { |
| 26 | - return 'The `Float` scalar type represents signed double-precision fractional ' . |
|
| 27 | - 'values as specified by ' . |
|
| 26 | + return 'The `Float` scalar type represents signed double-precision fractional '. |
|
| 27 | + 'values as specified by '. |
|
| 28 | 28 | '[IEEE 754](http://en.wikipedia.org/wiki/IEEE_floating_point).'; |
| 29 | 29 | } |
| 30 | 30 | |
@@ -28,7 +28,7 @@ |
||
| 28 | 28 | public function addArgument($name, $type, $config = []) |
| 29 | 29 | { |
| 30 | 30 | if (!TypeMap::isInputType($type)) { |
| 31 | - throw new ConfigurationException('Argument input type ' . $type . ' is not supported'); |
|
| 31 | + throw new ConfigurationException('Argument input type '.$type.' is not supported'); |
|
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | $config['name'] = $name; |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | $this->data = $configData; |
| 52 | 52 | $this->validator = new ConfigValidator($contextObject); |
| 53 | 53 | if (!$this->validator->validate($this->data, $this->getRules())) { |
| 54 | - throw new ConfigurationException('Config is not valid for ' . get_class($contextObject) . "\n" . implode("\n", $this->validator->getErrorsArray(false))); |
|
| 54 | + throw new ConfigurationException('Config is not valid for '.get_class($contextObject)."\n".implode("\n", $this->validator->getErrorsArray(false))); |
|
| 55 | 55 | } |
| 56 | 56 | $this->build(); |
| 57 | 57 | } |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | return $this->get($propertyName); |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - throw new \Exception('Call to undefined method ' . $method); |
|
| 99 | + throw new \Exception('Call to undefined method '.$method); |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | |
@@ -76,7 +76,7 @@ |
||
| 76 | 76 | $name = $name == 'Datetime' ? 'DateTime' : $name; |
| 77 | 77 | $name = $name == 'Datetimetz' ? 'DateTimeTz' : $name; |
| 78 | 78 | |
| 79 | - $className = 'Youshido\GraphQL\Type\Scalar\\' . $name . 'Type'; |
|
| 79 | + $className = 'Youshido\GraphQL\Type\Scalar\\'.$name.'Type'; |
|
| 80 | 80 | self::$scalarObjectsCache[$type] = new $className(); |
| 81 | 81 | } |
| 82 | 82 | |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | if (array_key_exists('required', $fieldRules)) { |
| 47 | 47 | unset($fieldRules['required']); |
| 48 | 48 | if (!array_key_exists($fieldName, $data)) { |
| 49 | - $this->addError(new ValidationException('Field \'' . $fieldName . '\' of ' . $this->getContextName() . ' is required')); |
|
| 49 | + $this->addError(new ValidationException('Field \''.$fieldName.'\' of '.$this->getContextName().' is required')); |
|
| 50 | 50 | continue; |
| 51 | 51 | } |
| 52 | 52 | } elseif (!array_key_exists($fieldName, $data)) { |
@@ -56,14 +56,14 @@ discard block |
||
| 56 | 56 | /** Validation of all other rules*/ |
| 57 | 57 | foreach ($fieldRules as $ruleName => $ruleInfo) { |
| 58 | 58 | if (!array_key_exists($ruleName, $this->validationRules)) { |
| 59 | - $this->addError(new ValidationException('Field \'' . $fieldName . '\' has invalid rule \'' . $ruleInfo . '\'')); |
|
| 59 | + $this->addError(new ValidationException('Field \''.$fieldName.'\' has invalid rule \''.$ruleInfo.'\'')); |
|
| 60 | 60 | continue; |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | if (!$this->validationRules[$ruleName]->validate($data[$fieldName], $ruleInfo)) { |
| 64 | 64 | $this->addError( |
| 65 | - new ValidationException('Field \'' . $fieldName . '\' of ' . $this->getContextName() |
|
| 66 | - . ' expected to be ' . $ruleName . ': \'' . (string)$ruleInfo . '\', but got: ' . gettype($data[$fieldName]))); |
|
| 65 | + new ValidationException('Field \''.$fieldName.'\' of '.$this->getContextName() |
|
| 66 | + . ' expected to be '.$ruleName.': \''.(string)$ruleInfo.'\', but got: '.gettype($data[$fieldName]))); |
|
| 67 | 67 | } |
| 68 | 68 | } |
| 69 | 69 | } |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | foreach (array_keys($data) as $fieldName) { |
| 73 | 73 | if (!in_array($fieldName, $processedFields)) { |
| 74 | 74 | $this->addError( |
| 75 | - new ValidationException('Field \'' . $fieldName . '\' is not expected in ' . $this->getContextName())); |
|
| 75 | + new ValidationException('Field \''.$fieldName.'\' is not expected in '.$this->getContextName())); |
|
| 76 | 76 | |
| 77 | 77 | } |
| 78 | 78 | } |
@@ -12,16 +12,16 @@ |
||
| 12 | 12 | use Youshido\GraphQL\Type\ListType\ListType; |
| 13 | 13 | use Youshido\GraphQL\Type\Object\ObjectType; |
| 14 | 14 | |
| 15 | -require_once __DIR__ . '/../../vendor/autoload.php'; |
|
| 16 | -require_once __DIR__ . '/Schema/DataProvider.php'; |
|
| 17 | -require_once __DIR__ . '/Schema/PostType.php'; |
|
| 18 | -require_once __DIR__ . '/Schema/PostStatus.php'; |
|
| 19 | -require_once __DIR__ . '/Schema/ContentBlockInterface.php'; |
|
| 20 | -require_once __DIR__ . '/Schema/LikePost.php'; |
|
| 21 | -require_once __DIR__ . '/Schema/BannerType.php'; |
|
| 22 | -require_once __DIR__ . '/Schema/ContentBlockUnion.php'; |
|
| 23 | -require_once __DIR__ . '/Schema/PostInputType.php'; |
|
| 24 | -require_once __DIR__ . '/Schema/BlogSchema.php'; |
|
| 15 | +require_once __DIR__.'/../../vendor/autoload.php'; |
|
| 16 | +require_once __DIR__.'/Schema/DataProvider.php'; |
|
| 17 | +require_once __DIR__.'/Schema/PostType.php'; |
|
| 18 | +require_once __DIR__.'/Schema/PostStatus.php'; |
|
| 19 | +require_once __DIR__.'/Schema/ContentBlockInterface.php'; |
|
| 20 | +require_once __DIR__.'/Schema/LikePost.php'; |
|
| 21 | +require_once __DIR__.'/Schema/BannerType.php'; |
|
| 22 | +require_once __DIR__.'/Schema/ContentBlockUnion.php'; |
|
| 23 | +require_once __DIR__.'/Schema/PostInputType.php'; |
|
| 24 | +require_once __DIR__.'/Schema/BlogSchema.php'; |
|
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | 27 | $rootQueryType = new ObjectType([ |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | use Youshido\GraphQL\Processor; |
| 12 | 12 | use Youshido\GraphQL\Schema; |
| 13 | 13 | |
| 14 | -require_once __DIR__ . '/schema-bootstrap.php'; |
|
| 14 | +require_once __DIR__.'/schema-bootstrap.php'; |
|
| 15 | 15 | /** @var Schema $schema */ |
| 16 | 16 | $schema = new BlogSchema(); |
| 17 | 17 | |
@@ -18,19 +18,19 @@ |
||
| 18 | 18 | 'latestPost' => new PostType(), |
| 19 | 19 | 'randomBanner' => [ |
| 20 | 20 | 'type' => new BannerType(), |
| 21 | - 'resolve' => function () { |
|
| 21 | + 'resolve' => function() { |
|
| 22 | 22 | return DataProvider::getBanner(rand(1, 10)); |
| 23 | 23 | } |
| 24 | 24 | ], |
| 25 | 25 | 'pageContentUnion' => [ |
| 26 | 26 | 'type' => new ListType(new ContentBlockUnion()), |
| 27 | - 'resolve' => function () { |
|
| 27 | + 'resolve' => function() { |
|
| 28 | 28 | return [DataProvider::getPost(1), DataProvider::getBanner(1)]; |
| 29 | 29 | } |
| 30 | 30 | ], |
| 31 | 31 | 'pageContentInterface' => [ |
| 32 | 32 | 'type' => new ListType(new ContentBlockInterface()), |
| 33 | - 'resolve' => function () { |
|
| 33 | + 'resolve' => function() { |
|
| 34 | 34 | return [DataProvider::getPost(2), DataProvider::getBanner(3)]; |
| 35 | 35 | } |
| 36 | 36 | ] |
@@ -25,8 +25,8 @@ |
||
| 25 | 25 | 'args' => [ |
| 26 | 26 | 'truncated' => new BooleanType() |
| 27 | 27 | ], |
| 28 | - 'resolve' => function ($value, $args) { |
|
| 29 | - return (!empty($args['truncated'])) ? explode(' ', $value)[0] . '...' : $value; |
|
| 28 | + 'resolve' => function($value, $args) { |
|
| 29 | + return (!empty($args['truncated'])) ? explode(' ', $value)[0].'...' : $value; |
|
| 30 | 30 | } |
| 31 | 31 | ]) |
| 32 | 32 | ->addField('title', new NonNullType(new StringType())) |