Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
402 lars 1
<?php
2
 
3
namespace Illuminate\Http\Client\Concerns;
4
 
5
trait DeterminesStatusCode
6
{
7
    /**
8
     * Determine if the response code was 200 "OK" response.
9
     *
10
     * @return bool
11
     */
12
    public function ok()
13
    {
14
        return $this->status() === 200;
15
    }
16
 
17
    /**
18
     * Determine if the response code was 201 "Created" response.
19
     *
20
     * @return bool
21
     */
22
    public function created()
23
    {
24
        return $this->status() === 201;
25
    }
26
 
27
    /**
28
     * Determine if the response code was 202 "Accepted" response.
29
     *
30
     * @return bool
31
     */
32
    public function accepted()
33
    {
34
        return $this->status() === 202;
35
    }
36
 
37
    /**
38
     * Determine if the response code was the given status code and the body has no content.
39
     *
40
     * @param  int  $status
41
     * @return bool
42
     */
43
    public function noContent($status = 204)
44
    {
45
        return $this->status() === $status && $this->body() === '';
46
    }
47
 
48
    /**
49
     * Determine if the response code was a 301 "Moved Permanently".
50
     *
51
     * @return bool
52
     */
53
    public function movedPermanently()
54
    {
55
        return $this->status() === 301;
56
    }
57
 
58
    /**
59
     * Determine if the response code was a 302 "Found" response.
60
     *
61
     * @return bool
62
     */
63
    public function found()
64
    {
65
        return $this->status() === 302;
66
    }
67
 
68
    /**
69
     * Determine if the response was a 400 "Bad Request" response.
70
     *
71
     * @return bool
72
     */
73
    public function badRequest()
74
    {
75
        return $this->status() === 400;
76
    }
77
 
78
    /**
79
     * Determine if the response was a 401 "Unauthorized" response.
80
     *
81
     * @return bool
82
     */
83
    public function unauthorized()
84
    {
85
        return $this->status() === 401;
86
    }
87
 
88
    /**
89
     * Determine if the response was a 402 "Payment Required" response.
90
     *
91
     * @return bool
92
     */
93
    public function paymentRequired()
94
    {
95
        return $this->status() === 402;
96
    }
97
 
98
    /**
99
     * Determine if the response was a 403 "Forbidden" response.
100
     *
101
     * @return bool
102
     */
103
    public function forbidden()
104
    {
105
        return $this->status() === 403;
106
    }
107
 
108
    /**
109
     * Determine if the response was a 404 "Not Found" response.
110
     *
111
     * @return bool
112
     */
113
    public function notFound()
114
    {
115
        return $this->status() === 404;
116
    }
117
 
118
    /**
119
     * Determine if the response was a 408 "Request Timeout" response.
120
     *
121
     * @return bool
122
     */
123
    public function requestTimeout()
124
    {
125
        return $this->status() === 408;
126
    }
127
 
128
    /**
129
     * Determine if the response was a 409 "Conflict" response.
130
     *
131
     * @return bool
132
     */
133
    public function conflict()
134
    {
135
        return $this->status() === 409;
136
    }
137
 
138
    /**
139
     * Determine if the response was a 422 "Unprocessable Entity" response.
140
     *
141
     * @return bool
142
     */
143
    public function unprocessableEntity()
144
    {
145
        return $this->status() === 422;
146
    }
147
 
148
    /**
149
     * Determine if the response was a 429 "Too Many Requests" response.
150
     *
151
     * @return bool
152
     */
153
    public function tooManyRequests()
154
    {
155
        return $this->status() === 429;
156
    }
157
}