Response::end()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 1
b 0
f 0
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