HalJsonResponseTrait::resourceProcessingResponse()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
c 3
b 0
f 0
dl 0
loc 7
rs 9.4286
cc 1
eloc 4
nc 1
nop 1
1
<?php
2
/**
3
 * Author: Nil Portugués Calderó <[email protected]>
4
 * Date: 8/18/15
5
 * Time: 11:19 PM.
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace NilPortugues\Laravel5\HalJsonSerializer;
12
13
use Symfony\Bridge\PsrHttpMessage\Factory\HttpFoundationFactory;
14
15
trait HalJsonResponseTrait
16
{
17
    /**
18
     * @param \Psr\Http\Message\ResponseInterface $response
19
     *
20
     * @return \Psr\Http\Message\ResponseInterface
21
     */
22
    protected function addHeaders(\Psr\Http\Message\ResponseInterface $response)
23
    {
24
        return $response;
25
    }
26
27
    /**
28
     * @param string $json
29
     *
30
     * @return \Symfony\Component\HttpFoundation\Response
31
     */
32
    private function errorResponse($json)
0 ignored issues
show
Unused Code introduced by
This method is not used, and could be removed.
Loading history...
33
    {
34
        return (new HttpFoundationFactory())
35
            ->createResponse($this->addHeaders(new \NilPortugues\Api\HalJson\Http\Message\ErrorResponse($json)));
36
    }
37
38
    /**
39
     * @param string $json
40
     *
41
     * @return \Symfony\Component\HttpFoundation\Response
42
     */
43
    private function resourceCreatedResponse($json)
0 ignored issues
show
Unused Code introduced by
This method is not used, and could be removed.
Loading history...
44
    {
45
        return (new HttpFoundationFactory())
46
            ->createResponse(
47
                $this->addHeaders(new \NilPortugues\Api\HalJson\Http\Message\ResourceCreatedResponse($json))
48
            );
49
    }
50
51
    /**
52
     * @param string $json
53
     *
54
     * @return \Symfony\Component\HttpFoundation\Response
55
     */
56
    private function resourceDeletedResponse($json)
0 ignored issues
show
Unused Code introduced by
This method is not used, and could be removed.
Loading history...
57
    {
58
        return (new HttpFoundationFactory())
59
            ->createResponse(
60
                $this->addHeaders(new \NilPortugues\Api\HalJson\Http\Message\ResourceDeletedResponse($json))
61
            );
62
    }
63
64
    /**
65
     * @param string $json
66
     *
67
     * @return \Symfony\Component\HttpFoundation\Response
68
     */
69
    private function resourceNotFoundResponse($json)
0 ignored issues
show
Unused Code introduced by
This method is not used, and could be removed.
Loading history...
70
    {
71
        return (new HttpFoundationFactory())
72
            ->createResponse(
73
                $this->addHeaders(new \NilPortugues\Api\HalJson\Http\Message\ResourceNotFoundResponse($json))
74
            );
75
    }
76
77
    /**
78
     * @param string $json
79
     *
80
     * @return \Symfony\Component\HttpFoundation\Response
81
     */
82
    private function resourcePatchErrorResponse($json)
0 ignored issues
show
Unused Code introduced by
This method is not used, and could be removed.
Loading history...
83
    {
84
        return (new HttpFoundationFactory())
85
            ->createResponse(
86
                $this->addHeaders(new \NilPortugues\Api\HalJson\Http\Message\ResourcePatchErrorResponse($json))
87
            );
88
    }
89
90
    /**
91
     * @param string $json
92
     *
93
     * @return \Symfony\Component\HttpFoundation\Response
94
     */
95
    private function resourcePostErrorResponse($json)
0 ignored issues
show
Unused Code introduced by
This method is not used, and could be removed.
Loading history...
96
    {
97
        return (new HttpFoundationFactory())
98
            ->createResponse(
99
                $this->addHeaders(new \NilPortugues\Api\HalJson\Http\Message\ResourcePostErrorResponse($json))
100
            );
101
    }
102
103
    /**
104
     * @param string $json
105
     *
106
     * @return \Symfony\Component\HttpFoundation\Response
107
     */
108
    private function resourceProcessingResponse($json)
0 ignored issues
show
Unused Code introduced by
This method is not used, and could be removed.
Loading history...
109
    {
110
        return (new HttpFoundationFactory())
111
            ->createResponse(
112
                $this->addHeaders(new \NilPortugues\Api\HalJson\Http\Message\ResourceProcessingResponse($json))
113
            );
114
    }
115
116
    /**
117
     * @param string $json
118
     *
119
     * @return \Symfony\Component\HttpFoundation\Response
120
     */
121
    private function resourceUpdatedResponse($json)
0 ignored issues
show
Unused Code introduced by
This method is not used, and could be removed.
Loading history...
122
    {
123
        return (new HttpFoundationFactory())
124
            ->createResponse(
125
                $this->addHeaders(new \NilPortugues\Api\HalJson\Http\Message\ResourceUpdatedResponse($json))
126
            );
127
    }
128
129
    /**
130
     * @param string $json
131
     *
132
     * @return \Symfony\Component\HttpFoundation\Response
133
     */
134
    private function response($json)
0 ignored issues
show
Unused Code introduced by
This method is not used, and could be removed.
Loading history...
135
    {
136
        return (new HttpFoundationFactory())
137
            ->createResponse($this->addHeaders(new \NilPortugues\Api\HalJson\Http\Message\Response($json)));
138
    }
139
140
    /**
141
     * @param string $json
142
     *
143
     * @return \Symfony\Component\HttpFoundation\Response
144
     */
145
    private function unsupportedActionResponse($json)
0 ignored issues
show
Unused Code introduced by
This method is not used, and could be removed.
Loading history...
146
    {
147
        return (new HttpFoundationFactory())
148
            ->createResponse(
149
                $this->addHeaders(new \NilPortugues\Api\HalJson\Http\Message\UnsupportedActionResponse($json))
150
            );
151
    }
152
}
153