Ubiquity
2.5.2
php rapid development framework
Loading...
Searching...
No Matches
RestError.php
Go to the documentation of this file.
1
<?php
2
3
namespace
Ubiquity\controllers\rest
;
4
5
class
RestError
{
6
private
$status
;
7
private
$code
;
8
private
$source
;
9
private
$title
;
10
private
$detail
;
11
12
public
function
__construct
(
$code
,
$title
,
$detail
=
null
,
$source
=
null
,
$status
=
null
) {
13
$this->code =
$code
;
14
$this->title =
$title
;
15
$this->detail =
$detail
;
16
$this->source =
$source
;
17
$this->status =
$status
;
18
}
19
24
public
function
getStatus
() {
25
return
$this->status
;
26
}
27
32
public
function
getCode
() {
33
return
$this->code
;
34
}
35
40
public
function
getSource
() {
41
return
$this->source
;
42
}
43
48
public
function
getTitle
() {
49
return
$this->title
;
50
}
51
56
public
function
getDetail
() {
57
return
$this->detail
;
58
}
59
64
public
function
setStatus
(
$status
) {
65
$this->status =
$status
;
66
}
67
72
public
function
setCode
(
$code
) {
73
$this->code =
$code
;
74
}
75
80
public
function
setSource
(
$source
) {
81
$this->source =
$source
;
82
}
83
88
public
function
setTitle
(
$title
) {
89
$this->title =
$title
;
90
}
91
96
public
function
setDetail
(
$detail
) {
97
$this->detail =
$detail
;
98
}
99
100
public
function
asArray
() {
101
$r = [ ];
102
if
(isset ( $this->code )) {
103
$r [
'code'
] =
$this->code
;
104
}
105
if
(isset ( $this->status )) {
106
$r [
'status'
] =
$this->status
;
107
}
108
if
(isset ( $this->source )) {
109
$r [
'source'
] = [
'pointer'
=>
$this->source
];
110
}
111
if
(isset ( $this->title )) {
112
$r [
'title'
] =
$this->title
;
113
}
114
if
(isset ( $this->detail )) {
115
$r [
'detail'
] =
$this->detail
;
116
}
117
return
$r;
118
}
119
120
public
static
function
notFound
($keyValues,
$source
=
null
){
121
return
new
RestError
(404,
"No result found"
,
"No result found for primary key(s): "
.$keyValues,
$source
,404);
122
}
123
}
124
Ubiquity\controllers\rest\RestError
Definition
RestError.php:5
Ubiquity\controllers\rest\RestError\asArray
asArray()
Definition
RestError.php:100
Ubiquity\controllers\rest\RestError\setDetail
setDetail($detail)
Definition
RestError.php:96
Ubiquity\controllers\rest\RestError\__construct
__construct($code, $title, $detail=null, $source=null, $status=null)
Definition
RestError.php:12
Ubiquity\controllers\rest\RestError\notFound
static notFound($keyValues, $source=null)
Definition
RestError.php:120
Ubiquity\controllers\rest\RestError\getSource
getSource()
Definition
RestError.php:40
Ubiquity\controllers\rest\RestError\setSource
setSource($source)
Definition
RestError.php:80
Ubiquity\controllers\rest\RestError\$status
$status
Definition
RestError.php:6
Ubiquity\controllers\rest\RestError\$code
$code
Definition
RestError.php:7
Ubiquity\controllers\rest\RestError\setStatus
setStatus($status)
Definition
RestError.php:64
Ubiquity\controllers\rest\RestError\setTitle
setTitle($title)
Definition
RestError.php:88
Ubiquity\controllers\rest\RestError\setCode
setCode($code)
Definition
RestError.php:72
Ubiquity\controllers\rest\RestError\getTitle
getTitle()
Definition
RestError.php:48
Ubiquity\controllers\rest\RestError\$source
$source
Definition
RestError.php:8
Ubiquity\controllers\rest\RestError\getStatus
getStatus()
Definition
RestError.php:24
Ubiquity\controllers\rest\RestError\$detail
$detail
Definition
RestError.php:10
Ubiquity\controllers\rest\RestError\getCode
getCode()
Definition
RestError.php:32
Ubiquity\controllers\rest\RestError\$title
$title
Definition
RestError.php:9
Ubiquity\controllers\rest\RestError\getDetail
getDetail()
Definition
RestError.php:56
Ubiquity\controllers\rest
Rest part.
C:
Users
myadd
Documents
GitHub
ubiquity-doc-api
vendor
phpmv
ubiquity
src
Ubiquity
controllers
rest
RestError.php
Generated on Sun Dec 10 2023 15:04:19 for
Ubiquity
by
doxygen
1.9.8