Completed
Push — master ( 2a8d76...cdb9d8 )
by Alexpts
01:48
created
src/Response/JsonResponse.php 1 patch
Indentation   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -10,64 +10,64 @@
 block discarded – undo
10 10
 
11 11
 class JsonResponse extends HttpResponse implements JsonResponseInterface
12 12
 {
13
-	protected array $data = [];
14
-	protected bool $isSyncBody = false;
13
+    protected array $data = [];
14
+    protected bool $isSyncBody = false;
15 15
 
16
-	public function __construct(
17
-		array $data,
18
-		int $status = 200,
19
-		array $headers = [],
20
-		string $version = '1.1'
21
-	) {
22
-		$headers['Content-Type'] = 'application/json';
23
-		parent::__construct($status, $headers, null, $version);
24
-		$this->data = $data;
25
-	}
16
+    public function __construct(
17
+        array $data,
18
+        int $status = 200,
19
+        array $headers = [],
20
+        string $version = '1.1'
21
+    ) {
22
+        $headers['Content-Type'] = 'application/json';
23
+        parent::__construct($status, $headers, null, $version);
24
+        $this->data = $data;
25
+    }
26 26
 
27
-	public function getData(): array
28
-	{
29
-		return $this->data;
30
-	}
27
+    public function getData(): array
28
+    {
29
+        return $this->data;
30
+    }
31 31
 
32
-	public function getBody(): StreamInterface
33
-	{
34
-		if (!$this->isSyncBody) {
35
-			$this->isSyncBody = true;
36
-			$data = json_encode($this->data, JSON_THROW_ON_ERROR | JSON_UNESCAPED_UNICODE, 512);
37
-			parent::withBody(Stream::create($data));
38
-		}
32
+    public function getBody(): StreamInterface
33
+    {
34
+        if (!$this->isSyncBody) {
35
+            $this->isSyncBody = true;
36
+            $data = json_encode($this->data, JSON_THROW_ON_ERROR | JSON_UNESCAPED_UNICODE, 512);
37
+            parent::withBody(Stream::create($data));
38
+        }
39 39
 
40
-		return parent::getBody();
41
-	}
40
+        return parent::getBody();
41
+    }
42 42
 
43
-	public function withBody(StreamInterface $body): Message
44
-	{
45
-		$this->data = json_decode((string)$body, true, 512, JSON_THROW_ON_ERROR);
46
-		$this->isSyncBody = true;
47
-		return parent::withBody($body);
48
-	}
43
+    public function withBody(StreamInterface $body): Message
44
+    {
45
+        $this->data = json_decode((string)$body, true, 512, JSON_THROW_ON_ERROR);
46
+        $this->isSyncBody = true;
47
+        return parent::withBody($body);
48
+    }
49 49
 
50
-	public function setData(array $data): self
51
-	{
52
-		$this->isSyncBody = false;
53
-		$this->data = $data;
54
-		return $this;
55
-	}
50
+    public function setData(array $data): self
51
+    {
52
+        $this->isSyncBody = false;
53
+        $this->data = $data;
54
+        return $this;
55
+    }
56 56
 
57
-	public function reset(): self
58
-	{
59
-		$this->setData([]);
60
-		$this->protocol = '1.1';
61
-		$this->statusCode = 200;
62
-		$this->attributes = [];
63
-		$this->headers = [];
64
-		$this->withHeader('Content-Type', 'application/json');
57
+    public function reset(): self
58
+    {
59
+        $this->setData([]);
60
+        $this->protocol = '1.1';
61
+        $this->statusCode = 200;
62
+        $this->attributes = [];
63
+        $this->headers = [];
64
+        $this->withHeader('Content-Type', 'application/json');
65 65
 
66
-		if ($this->stream) {
67
-			$this->stream->close();
68
-			$this->stream = null;
69
-		}
66
+        if ($this->stream) {
67
+            $this->stream->close();
68
+            $this->stream = null;
69
+        }
70 70
 
71
-		return $this;
72
-	}
71
+        return $this;
72
+    }
73 73
 }
74 74
\ No newline at end of file
Please login to merge, or discard this patch.