aboutsummaryrefslogtreecommitdiffstats
path: root/apps/testing/lib/Provider/FakeText2ImageProvider.php
blob: 8e7ceca02f1de60a39e0a0a9baac142317c83d01 (plain)
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
<?php
/**
 * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
 * SPDX-License-Identifier: AGPL-3.0-or-later
 */

namespace OCA\Testing\Provider;

use OCP\TextToImage\IProvider;

class FakeText2ImageProvider implements IProvider {

	public function getName(): string {
		return 'Fake Text2Image provider';
	}

	public function generate(string $prompt, array $resources): void {
		foreach ($resources as $resource) {
			$read = fopen(__DIR__ . '/../../img/logo.png', 'r');
			stream_copy_to_stream($read, $resource);
			fclose($read);
		}
	}

	public function getExpectedRuntime(): int {
		return 1;
	}

	public function getId(): string {
		return 'testing-fake-text2image-provider';
	}
}