-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Expand file tree
/
Copy pathShapeDescriptor.php
More file actions
70 lines (62 loc) · 1.54 KB
/
Copy pathShapeDescriptor.php
File metadata and controls
70 lines (62 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
/**
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCP\TaskProcessing;
use OCP\AppFramework\Attribute\Consumable;
/**
* Data object for input output shape entries
*
* @since 30.0.0
*/
#[Consumable(since: '30.0.0')]
class ShapeDescriptor implements \JsonSerializable {
/**
* @param string $name
* @param string $description
* @param EShapeType $shapeType
* @since 30.0.0
*/
public function __construct(
private string $name,
private string $description,
private EShapeType $shapeType,
) {
}
/**
* @return string
* @since 30.0.0
*/
public function getName(): string {
return $this->name;
}
/**
* @return string
* @since 30.0.0
*/
public function getDescription(): string {
return $this->description;
}
/**
* @return EShapeType
* @since 30.0.0
*/
public function getShapeType(): EShapeType {
return $this->shapeType;
}
/**
* @return array{name: string, description: string, type: "Number"|"Text"|"Audio"|"Image"|"Video"|"File"|"Enum"|"ListOfNumbers"|"ListOfTexts"|"ListOfImages"|"ListOfAudios"|"ListOfVideos"|"ListOfFiles"}
* @since 30.0.0
*/
#[\Override]
public function jsonSerialize(): array {
/** @var "Number"|"Text"|"Audio"|"Image"|"Video"|"File"|"Enum"|"ListOfNumbers"|"ListOfTexts"|"ListOfImages"|"ListOfAudios"|"ListOfVideos"|"ListOfFiles" $type */
$type = $this->getShapeType()->name;
return [
'name' => $this->getName(),
'description' => $this->getDescription(),
'type' => $type,
];
}
}