Passed
Push — master ( d02e66...ea1418 )
by Arthur
04:04
created

BulksDoc::setDeleteBulk()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 23
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 13
c 1
b 0
f 0
dl 0
loc 23
rs 9.8333
cc 1
nc 1
nop 0
1
<?php
2
3
namespace SoliDry\Documentation;
4
5
use SoliDry\Extension\JSONApiInterface;
6
use SoliDry\Types\DefaultInterface;
7
use SoliDry\Types\DocumentationInterface;
8
use SoliDry\Types\PhpInterface;
9
10
trait BulksDoc
11
{
12
13
    /**
14
     *  Sets OAS documentation for a bulk create method
15
     */
16
    private function setCreateBulk(): void
17
    {
18
        $this->openComment();
0 ignored issues
show
Bug introduced by
It seems like openComment() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

18
        $this->/** @scrutinizer ignore-call */ 
19
               openComment();
Loading history...
19
20
        $this->setStarredComment(DocumentationInterface::OA_POST . PhpInterface::OPEN_PARENTHESES);
0 ignored issues
show
Bug introduced by
It seems like setStarredComment() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

20
        $this->/** @scrutinizer ignore-call */ 
21
               setStarredComment(DocumentationInterface::OA_POST . PhpInterface::OPEN_PARENTHESES);
Loading history...
21
22
        $this->setStarredComment('path="' . PhpInterface::SLASH . $this->generator->version . PhpInterface::SLASH
23
            . strtolower($this->generator->objectName) . PhpInterface::SLASH . 'bulk",', 1, 1);
24
25
        $this->setStarredComment('summary="Create ' . $this->generator->objectName . ' bulk",', 1, 1);
26
27
        $this->setStarredComment('tags={"' . $this->generator->objectName . DefaultInterface::CONTROLLER_POSTFIX
28
            . '"},', 1, 1);
29
30
        $this->setResponse([
0 ignored issues
show
Bug introduced by
It seems like setResponse() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

30
        $this->/** @scrutinizer ignore-call */ 
31
               setResponse([
Loading history...
31
            'response'    => '"' . JSONApiInterface::HTTP_RESPONSE_CODE_CREATED . '"',
32
            'description' => '""',
33
        ]);
34
35
        $this->setStarredComment(PhpInterface::CLOSE_PARENTHESES);
36
37
        $this->closeComment();
0 ignored issues
show
Bug introduced by
It seems like closeComment() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

37
        $this->/** @scrutinizer ignore-call */ 
38
               closeComment();
Loading history...
38
        $this->setNewLines();
0 ignored issues
show
Bug introduced by
It seems like setNewLines() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

38
        $this->/** @scrutinizer ignore-call */ 
39
               setNewLines();
Loading history...
39
    }
40
41
    /**
42
     *  Sets OAS documentation for a bulk update method
43
     */
44
    private function setUpdateBulk(): void
45
    {
46
        $this->openComment();
47
48
        $this->setStarredComment(DocumentationInterface::OA_PATCH . PhpInterface::OPEN_PARENTHESES);
49
50
        $this->setStarredComment('path="' . PhpInterface::SLASH . $this->generator->version . PhpInterface::SLASH
51
            . strtolower($this->generator->objectName) . PhpInterface::SLASH . 'bulk",', 1, 1);
52
53
        $this->setStarredComment('summary="Update ' . $this->generator->objectName . ' bulk",', 1, 1);
54
55
        $this->setStarredComment('tags={"' . $this->generator->objectName . DefaultInterface::CONTROLLER_POSTFIX
56
            . '"},', 1, 1);
57
58
        $this->setResponse([
59
            'response'    => '"' . JSONApiInterface::HTTP_RESPONSE_CODE_OK . '"',
60
            'description' => '""',
61
        ]);
62
63
        $this->setStarredComment(PhpInterface::CLOSE_PARENTHESES);
64
65
        $this->closeComment();
66
        $this->setNewLines();
67
    }
68
69
    /**
70
     *  Sets OAS documentation for a bulk delete method
71
     */
72
    private function setDeleteBulk(): void
73
    {
74
        $this->openComment();
75
76
        $this->setStarredComment(DocumentationInterface::OA_DELETE . PhpInterface::OPEN_PARENTHESES);
77
78
        $this->setStarredComment('path="' . PhpInterface::SLASH . $this->generator->version . PhpInterface::SLASH
79
            . strtolower($this->generator->objectName) . PhpInterface::SLASH . 'bulk",', 1, 1);
80
81
        $this->setStarredComment('summary="Delete ' . $this->generator->objectName . ' bulk",', 1, 1);
82
83
        $this->setStarredComment('tags={"' . $this->generator->objectName . DefaultInterface::CONTROLLER_POSTFIX
84
            . '"},', 1, 1);
85
86
        $this->setResponse([
87
            'response'    => '"' . JSONApiInterface::HTTP_RESPONSE_CODE_NO_CONTENT . '"',
88
            'description' => '""',
89
        ]);
90
91
        $this->setStarredComment(PhpInterface::CLOSE_PARENTHESES);
92
93
        $this->closeComment();
94
        $this->setNewLines();
95
    }
96
}