|
1
|
|
|
<?php |
|
2
|
|
|
namespace Aoe\Imgix\Domain\Model; |
|
3
|
|
|
|
|
4
|
|
|
/*************************************************************** |
|
5
|
|
|
* Copyright notice |
|
6
|
|
|
* |
|
7
|
|
|
* (c) 2018 AOE GmbH <[email protected]> |
|
8
|
|
|
* |
|
9
|
|
|
* All rights reserved |
|
10
|
|
|
* |
|
11
|
|
|
* This script is part of the TYPO3 project. The TYPO3 project is |
|
12
|
|
|
* free software; you can redistribute it and/or modify |
|
13
|
|
|
* it under the terms of the GNU General Public License as published by |
|
14
|
|
|
* the Free Software Foundation; either version 3 of the License, or |
|
15
|
|
|
* (at your option) any later version. |
|
16
|
|
|
* |
|
17
|
|
|
* The GNU General Public License can be found at |
|
18
|
|
|
* http://www.gnu.org/copyleft/gpl.html. |
|
19
|
|
|
* |
|
20
|
|
|
* This script is distributed in the hope that it will be useful, |
|
21
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
22
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
23
|
|
|
* GNU General Public License for more details. |
|
24
|
|
|
* |
|
25
|
|
|
* This copyright notice MUST APPEAR in all copies of the script! |
|
26
|
|
|
***************************************************************/ |
|
27
|
|
|
|
|
28
|
|
|
class ImagePurgeResult |
|
29
|
|
|
{ |
|
30
|
|
|
/** |
|
31
|
|
|
* @var boolean |
|
32
|
|
|
*/ |
|
33
|
|
|
private $isSuccessful; |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* @var string |
|
37
|
|
|
*/ |
|
38
|
|
|
private $curlErrorMessage; |
|
39
|
|
|
|
|
40
|
|
|
/** |
|
41
|
|
|
* @var integer |
|
42
|
|
|
*/ |
|
43
|
|
|
private $curlErrorCode; |
|
44
|
|
|
|
|
45
|
|
|
/** |
|
46
|
|
|
* @var integer |
|
47
|
|
|
*/ |
|
48
|
|
|
private $curlHttpStatusCode; |
|
49
|
|
|
|
|
50
|
|
|
/** |
|
51
|
|
|
* @return string |
|
52
|
|
|
*/ |
|
53
|
2 |
|
public function getCurlErrorMessage() |
|
54
|
|
|
{ |
|
55
|
2 |
|
return $this->curlErrorMessage; |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
/** |
|
59
|
|
|
* @return integer |
|
60
|
|
|
*/ |
|
61
|
2 |
|
public function getCurlErrorCode() |
|
62
|
|
|
{ |
|
63
|
2 |
|
return $this->curlErrorCode; |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
/** |
|
67
|
|
|
* @return integer |
|
68
|
|
|
*/ |
|
69
|
2 |
|
public function getCurlHttpStatusCode() |
|
70
|
|
|
{ |
|
71
|
2 |
|
return $this->curlHttpStatusCode; |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
|
|
/** |
|
75
|
|
|
* @return boolean |
|
76
|
|
|
*/ |
|
77
|
3 |
|
public function hasCurlErrorMessage() |
|
78
|
|
|
{ |
|
79
|
3 |
|
return (false === empty($this->curlErrorMessage)); |
|
80
|
|
|
} |
|
81
|
|
|
|
|
82
|
|
|
/** |
|
83
|
|
|
* @return boolean |
|
84
|
|
|
*/ |
|
85
|
3 |
|
public function hasCurlErrorCode() |
|
86
|
|
|
{ |
|
87
|
3 |
|
return (false === empty($this->curlErrorCode)); |
|
88
|
|
|
} |
|
89
|
|
|
|
|
90
|
|
|
/** |
|
91
|
|
|
* @return boolean |
|
92
|
|
|
*/ |
|
93
|
5 |
|
public function isSuccessful() |
|
94
|
|
|
{ |
|
95
|
5 |
|
return $this->isSuccessful; |
|
96
|
|
|
} |
|
97
|
|
|
|
|
98
|
|
|
/** |
|
99
|
|
|
* image-purge was not successful |
|
100
|
|
|
* @param string $curlErrorMessage |
|
101
|
|
|
* @param integer $curlErrorCode |
|
102
|
|
|
* @param integer $curlHttpStatusCode |
|
103
|
|
|
*/ |
|
104
|
6 |
|
public function markImagePurgeAsFailed($curlErrorMessage = '', $curlErrorCode = 0, $curlHttpStatusCode = 0) |
|
105
|
|
|
{ |
|
106
|
6 |
|
$this->isSuccessful = false; |
|
107
|
6 |
|
$this->curlErrorMessage = $curlErrorMessage; |
|
108
|
6 |
|
$this->curlErrorCode = $curlErrorCode; |
|
109
|
6 |
|
$this->curlHttpStatusCode = $curlHttpStatusCode; |
|
110
|
6 |
|
} |
|
111
|
|
|
|
|
112
|
|
|
/** |
|
113
|
|
|
* image-purge was successful |
|
114
|
|
|
*/ |
|
115
|
2 |
|
public function markImagePurgeAsSuccessful() |
|
116
|
|
|
{ |
|
117
|
2 |
|
$this->isSuccessful = true; |
|
118
|
2 |
|
} |
|
119
|
|
|
} |
|
120
|
|
|
|