Issues (150)

src/Documentation/BulksDoc.php (8 issues)

Labels
Severity
1
<?php
2
3
namespace SoliDry\Documentation;
4
5
use SoliDry\Extension\JSONApiInterface;
6
use SoliDry\Helpers\Classes;
7
use SoliDry\Helpers\MigrationsHelper;
8
use SoliDry\Types\DefaultInterface;
9
use SoliDry\Types\DocumentationInterface;
10
use SoliDry\Types\PhpInterface;
11
12
trait BulksDoc
13
{
14
    /**
15
     *  Sets OAS documentation for a bulk create method
16
     */
17
    private function setCreateBulk(): void
18
    {
19
        $this->openComment();
0 ignored issues
show
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

19
        $this->/** @scrutinizer ignore-call */ 
20
               openComment();
Loading history...
20
21
        $this->setStarredComment(DocumentationInterface::OA_POST . PhpInterface::OPEN_PARENTHESES);
0 ignored issues
show
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

21
        $this->/** @scrutinizer ignore-call */ 
22
               setStarredComment(DocumentationInterface::OA_POST . PhpInterface::OPEN_PARENTHESES);
Loading history...
22
        $this->setStarredComment('path="' . PhpInterface::SLASH . $this->generator->version . PhpInterface::SLASH
23
            . MigrationsHelper::getTableName($this->generator->objectName) . PhpInterface::SLASH . 'bulk",', 1, 1);
24
25
        $this->setStarredComment('summary="Create ' . Classes::getClassName($this->generator->objectName) . ' bulk",', 1, 1);
26
27
        $this->setStarredComment('tags={"' . Classes::getClassName($this->generator->objectName) . DefaultInterface::CONTROLLER_POSTFIX
28
            . '"},', 1, 1);
29
30
        $this->setResponse([
0 ignored issues
show
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' => '"' . self::SUCCESSFUL_OPERATION . '"',
0 ignored issues
show
The constant SoliDry\Documentation\Bu...c::SUCCESSFUL_OPERATION was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
33
        ]);
34
35
        $this->setStarredComment(PhpInterface::CLOSE_PARENTHESES);
36
37
        $this->closeComment();
0 ignored issues
show
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
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
            . MigrationsHelper::getTableName($this->generator->objectName) . PhpInterface::SLASH . 'bulk",', 1, 1);
52
53
        $this->setStarredComment('summary="Update ' . Classes::getClassName($this->generator->objectName) . ' bulk",', 1, 1);
54
55
        $this->setStarredComment('tags={"' . Classes::getClassName($this->generator->objectName) . DefaultInterface::CONTROLLER_POSTFIX
56
            . '"},', 1, 1);
57
58
        $this->setResponse([
59
            'response'    => '"' . JSONApiInterface::HTTP_RESPONSE_CODE_OK . '"',
60
            'description' => '"' . self::SUCCESSFUL_OPERATION . '"',
0 ignored issues
show
The constant SoliDry\Documentation\Bu...c::SUCCESSFUL_OPERATION was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
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
            . MigrationsHelper::getTableName($this->generator->objectName) . PhpInterface::SLASH . 'bulk",', 1, 1);
80
81
        $this->setStarredComment('summary="Delete ' . Classes::getClassName($this->generator->objectName) . ' bulk",', 1, 1);
82
83
        $this->setStarredComment('tags={"' . Classes::getClassName($this->generator->objectName) . DefaultInterface::CONTROLLER_POSTFIX
84
            . '"},', 1, 1);
85
86
        $this->setResponse([
87
            'response'    => '"' . JSONApiInterface::HTTP_RESPONSE_CODE_NO_CONTENT . '"',
88
            'description' => '"' . self::SUCCESSFUL_OPERATION . '"',
0 ignored issues
show
The constant SoliDry\Documentation\Bu...c::SUCCESSFUL_OPERATION was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
89
        ]);
90
91
        $this->setStarredComment(PhpInterface::CLOSE_PARENTHESES);
92
93
        $this->closeComment();
94
        $this->setNewLines();
95
    }
96
}