1 | <?php |
||
28 | class Factory extends ResourceFactory |
||
29 | { |
||
30 | /** |
||
31 | * Collection name. |
||
32 | */ |
||
33 | public const COLLECTION_NAME = 'secrets'; |
||
34 | |||
35 | /** |
||
36 | * Default key. |
||
37 | */ |
||
38 | private const DEFAULT_KEY = '314004004b3cef33ba8ea540b424736408364317d9ebfbc9293b8478a8d2478e23dba1ba30ded48ab0dd059cfe3dce2daf00d10eb40af1c0bf429553a2d64802272a514cfde95ac31956baa3929ee01c7338c95805c3a619e254f7aa2966e6a7cdad4783'; |
||
39 | |||
40 | /** |
||
41 | * Encryption key. |
||
42 | * |
||
43 | * @var EncryptionKey |
||
44 | */ |
||
45 | protected $key; |
||
46 | |||
47 | /** |
||
48 | * Initialize. |
||
49 | */ |
||
50 | public function __construct(Database $db, EncryptionKey $key, LoggerInterface $logger) |
||
55 | |||
56 | /** |
||
57 | * Has secret. |
||
58 | */ |
||
59 | public function has(ResourceNamespaceInterface $namespace, string $name): bool |
||
66 | |||
67 | /** |
||
68 | * Get all. |
||
69 | */ |
||
70 | public function getAll(ResourceNamespaceInterface $namespace, ?array $query = null, ?int $offset = null, ?int $limit = null, ?array $sort = null): Generator |
||
86 | |||
87 | /** |
||
88 | * Get secret. |
||
89 | */ |
||
90 | public function getOne(ResourceNamespaceInterface $namespace, string $name): SecretInterface |
||
105 | |||
106 | /** |
||
107 | * Resolve resource secrets. |
||
108 | */ |
||
109 | public function resolve(ResourceNamespaceInterface $namespace, array $resource): array |
||
125 | |||
126 | /** |
||
127 | * Reverse resolved secrets. |
||
128 | */ |
||
129 | 2 | public static function reverse(ResourceInterface $resource, array $result): array |
|
137 | |||
138 | /** |
||
139 | * Delete by name. |
||
140 | */ |
||
141 | public function deleteOne(ResourceNamespaceInterface $namespace, string $name): bool |
||
147 | |||
148 | /** |
||
149 | * Update. |
||
150 | */ |
||
151 | public function update(SecretInterface $resource, array $data): bool |
||
160 | |||
161 | /** |
||
162 | * Add secret. |
||
163 | */ |
||
164 | public function add(ResourceNamespaceInterface $namespace, array $resource): ObjectIdInterface |
||
179 | |||
180 | /** |
||
181 | * Change stream. |
||
182 | */ |
||
183 | public function watch(ResourceNamespaceInterface $namespace, ?ObjectIdInterface $after = null, bool $existing = true, ?array $query = null, ?int $offset = null, ?int $limit = null, ?array $sort = null): Generator |
||
187 | |||
188 | /** |
||
189 | * Build instance. |
||
190 | */ |
||
191 | public function build(array $resource, ResourceNamespaceInterface $namespace): SecretInterface |
||
199 | |||
200 | /** |
||
201 | * Encrypt resource data. |
||
202 | */ |
||
203 | protected function crypt(array $resource): array |
||
215 | } |
||
216 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.