Issues (879)

Bundle/ApiBundle/Documentation/Model/Response.php (1 issue)

1
<?php
2
3
namespace Enhavo\Bundle\ApiBundle\Documentation\Model;
4
5
class Response
6
{
7 1
    public function __construct(
8
        private array &$response,
9
        private Method $parent,
10
    )
11
    {
12 1
    }
13
14 1
    public function description($description): self
15
    {
16 1
        $this->method['description'] = $description;
0 ignored issues
show
Bug Best Practice introduced by
The property method does not exist. Although not strictly required by PHP, it is generally a best practice to declare properties explicitly.
Loading history...
17 1
        return $this;
18
    }
19
20 1
    public function content($mimeType = 'application/json'): Content
21
    {
22 1
        if (!array_key_exists('content', $this->response)) {
23 1
            $this->response['content'] = [];
24
        }
25
26 1
        if (!array_key_exists($mimeType, $this->response['content'])) {
27 1
            $this->response['content'][$mimeType] = [];
28
        }
29
30 1
        return new Content($this->response['content'][$mimeType], $this);
31
    }
32
33 1
    public function end(): Method
34
    {
35 1
        return $this->parent;
36
    }
37
38
    public function getDocumentation(): Documentation
39
    {
40
        return $this->parent->getDocumentation();
41
    }
42
}
43