1
|
|
|
<?php |
2
|
|
|
declare(strict_types = 1); |
3
|
|
|
|
4
|
|
|
/* |
5
|
|
|
* This file is part of the package typo3/cms-digital-asset-management. |
6
|
|
|
* |
7
|
|
|
* For the full copyright and license information, please read the |
8
|
|
|
* LICENSE file that was distributed with this source code. |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
namespace TYPO3\CMS\DigitalAssetManagement\Entity; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* Immutable permission object, used by FolderItemFolder |
15
|
|
|
* entity to represent permissions of folders. |
16
|
|
|
*/ |
17
|
|
|
class FileOperationResult implements \JsonSerializable |
18
|
|
|
{ |
19
|
|
|
public const FAILED = 'FAILED'; |
20
|
|
|
public const MOVED = 'MOVED'; |
21
|
|
|
public const COPIED = 'COPIED'; |
22
|
|
|
public const DELETED = 'DELETED'; |
23
|
|
|
public const RENAMED = 'RENAMED'; |
24
|
|
|
public const CREATED = 'CREATED'; |
25
|
|
|
public const UPLOADED = 'UPLOADED'; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* @var string the identifier |
29
|
|
|
*/ |
30
|
|
|
protected $identifier; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* @var string, one of the constants |
34
|
|
|
*/ |
35
|
|
|
protected $state; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @var string, The success or error message |
39
|
|
|
*/ |
40
|
|
|
protected $message; |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @var \JsonSerializable|null |
44
|
|
|
*/ |
45
|
|
|
protected $resource; |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* @param string $identifier |
49
|
|
|
* @param string $state |
50
|
|
|
* @param string $message |
51
|
|
|
* @param \JsonSerializable|null $resource |
52
|
|
|
*/ |
53
|
|
|
public function __construct(string $identifier, string $state, string $message, \JsonSerializable $resource = null) |
54
|
|
|
{ |
55
|
|
|
$this->identifier = $identifier; |
56
|
|
|
$this->state = $state; |
57
|
|
|
$this->message = $message; |
58
|
|
|
$this->resource = $resource; |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
public function jsonSerialize() |
62
|
|
|
{ |
63
|
|
|
return [ |
64
|
|
|
$this->identifier => [ |
65
|
|
|
'status' => $this->state, |
66
|
|
|
'message' => $this->message, |
67
|
|
|
'resource' => $this->resource |
68
|
|
|
] |
69
|
|
|
]; |
70
|
|
|
} |
71
|
|
|
} |
72
|
|
|
|