Completed
Pull Request — master (#94)
by John
02:54
created

EntityController::getStatus()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 0
1
<?php declare(strict_types = 1);
2
/*
3
 * This file is part of the KleijnWeb\SwaggerBundle package.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 */
8
9
namespace KleijnWeb\SwaggerBundle\Tests\Functional\PetStore\Controller;
10
11
/**
12
 * @author John Kleijn <[email protected]>
13
 */
14
class EntityController
15
{
16
    /**
17
     * @return \stdClass
18
     */
19
    public function getStatus()
20
    {
21
        return (object)[
22
            'overall' => 'ok'
23
        ];
24
    }
25
26
    /**
27
     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
28
     * @param string    $type
29
     * @param \DateTime $lastModified
30
     *
31
     * @return array
32
     */
33
    public function find(string $type, \DateTime $lastModified)
0 ignored issues
show
Unused Code introduced by
The parameter $lastModified is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
34
    {
35
        return [
36
            (object)[
37
                'id'   => 2,
38
                'type' => $type,
39
                'foo'  => 'bar'
40
            ]
41
        ];
42
    }
43
44
    /**
45
     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
46
     * @param string $type
47
     * @param array  $criteria
48
     *
49
     * @return array
50
     */
51
    public function findByCriteria(string $type, array $criteria)
52
    {
53
        $entities = [];
54
55
        foreach ($criteria as $i => $criterion) {
56
            $entities[] = (object)[
57
                'id'   => $i + 3,
58
                'type' => $type,
59
                'foo'  => 'bar'
60
            ];
61
        }
62
63
        return $entities;
64
    }
65
66
    /**
67
     * @param string $type
68
     * @param int    $id
69
     *
70
     * @return \stdClass
71
     */
72
    public function get(string $type, int $id)
73
    {
74
        return (object)[
75
            'id'   => $id,
76
            'type' => $type,
77
            'foo'  => 'bar'
78
        ];
79
    }
80
81
    /**
82
     * @param string    $type
83
     * @param int       $id
84
     * @param \stdClass $data
85
     *
86
     * @return \stdClass
87
     */
88
    public function put(string $type, int $id, \stdClass $data)
89
    {
90
        $data->id   = $id;
91
        $data->type = $type;
92
93
        return $data;
94
    }
95
96
    /**
97
     * @param string    $type
98
     * @param \stdClass $data
99
     *
100
     * @return \stdClass
101
     */
102
    public function post(string $type, \stdClass $data)
103
    {
104
        $data->id   = rand();
105
        $data->type = $type;
106
107
        return $data;
108
    }
109
110
    /**
111
     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
112
     * @param string $type
113
     * @param int    $id
114
     *
115
     * @return null
116
     */
117
    public function delete(string $type, int $id)
0 ignored issues
show
Unused Code introduced by
The parameter $type is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Unused Code introduced by
The parameter $id is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
118
    {
119
        return null;
120
    }
121
}
122