Response.php in GraphQL 8.4
File
src/GraphQL/Response/Response.php
View source
<?php
declare (strict_types=1);
namespace Drupal\graphql\GraphQL\Response;
class Response implements ResponseInterface {
protected $violations = [];
public function addViolation($message, array $properties = []) : void {
$properties['message'] = (string) $message;
$this->violations[] = $properties;
}
public function addViolations(array $messages, array $properties = []) : void {
foreach ($messages as $message) {
$this
->addViolation($message, $properties);
}
}
public function getViolations() : array {
return $this->violations;
}
public function mergeViolations(ResponseInterface $source) : void {
$this->violations = array_merge($this->violations, $source
->getViolations());
}
}
Classes
Name |
Description |
Response |
Base class for responses containing the violations. |