1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
|
4
|
|
|
namespace Luilliarcec\LaravelImgur\Support; |
5
|
|
|
|
6
|
|
|
/** |
7
|
|
|
* @property mixed id |
8
|
|
|
* @property mixed link |
9
|
|
|
* @property mixed deletehash |
10
|
|
|
* @property mixed type |
11
|
|
|
* @property mixed name |
12
|
|
|
* @package Luilliarcec\LaravelImgur\Support |
13
|
|
|
*/ |
14
|
|
|
class ImgurResponse |
15
|
|
|
{ |
16
|
|
|
/** |
17
|
|
|
* Imgur Response |
18
|
|
|
*/ |
19
|
|
|
protected $response; |
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* Fill variables with the response |
23
|
|
|
*/ |
24
|
|
|
protected function fillData() |
25
|
|
|
{ |
26
|
|
|
$this->id = $this->getId(); |
27
|
|
|
$this->link = $this->getLink(); |
28
|
|
|
$this->deletehash = $this->getDeletehash(); |
29
|
|
|
$this->type = $this->getType(); |
30
|
|
|
$this->name = $this->getName(); |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* Flush data of the response |
35
|
|
|
*/ |
36
|
|
|
protected function flushData() |
37
|
|
|
{ |
38
|
|
|
$this->id = $this->link = $this->deletehash = $this->type = $this->name = ''; |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* Get the resource id |
43
|
|
|
* |
44
|
|
|
* @return mixed |
45
|
|
|
*/ |
46
|
|
|
public function getId() |
47
|
|
|
{ |
48
|
|
|
return $this->response->data->id; |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* Get the resource access link |
53
|
|
|
* |
54
|
|
|
* @return mixed |
55
|
|
|
*/ |
56
|
|
|
public function getLink() |
57
|
|
|
{ |
58
|
|
|
return $this->response->data->link; |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* Get the resource delete hash |
63
|
|
|
* |
64
|
|
|
* @return mixed |
65
|
|
|
*/ |
66
|
|
|
public function getDeletehash() |
67
|
|
|
{ |
68
|
|
|
return $this->response->data->deletehash; |
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
/** |
72
|
|
|
* Get the type and extent of the resource |
73
|
|
|
* |
74
|
|
|
* @return mixed |
75
|
|
|
*/ |
76
|
|
|
public function getType() |
77
|
|
|
{ |
78
|
|
|
return $this->response->data->type; |
79
|
|
|
} |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* Get the size of the uploaded resource |
83
|
|
|
* |
84
|
|
|
* @return mixed |
85
|
|
|
*/ |
86
|
|
|
public function getSize() |
87
|
|
|
{ |
88
|
|
|
return $this->response->data->size; |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* Get the width of the image |
93
|
|
|
* |
94
|
|
|
* @return mixed |
95
|
|
|
*/ |
96
|
|
|
public function getWidth() |
97
|
|
|
{ |
98
|
|
|
return $this->response->data->width; |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
/** |
102
|
|
|
* Get the height of the image |
103
|
|
|
* |
104
|
|
|
* @return mixed |
105
|
|
|
*/ |
106
|
|
|
public function getHeight() |
107
|
|
|
{ |
108
|
|
|
return $this->response->data->height; |
109
|
|
|
} |
110
|
|
|
|
111
|
|
|
/** |
112
|
|
|
* Get the name of the resource |
113
|
|
|
* |
114
|
|
|
* @return mixed |
115
|
|
|
*/ |
116
|
|
|
public function getName() |
117
|
|
|
{ |
118
|
|
|
return $this->response->data->name; |
119
|
|
|
} |
120
|
|
|
} |
121
|
|
|
|