1
0

FakeText2ImageProvider.php 709 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-License-Identifier: AGPL-3.0-or-later
  5. */
  6. namespace OCA\Testing\Provider;
  7. use OCP\TextToImage\IProvider;
  8. class FakeText2ImageProvider implements IProvider {
  9. public function getName(): string {
  10. return 'Fake Text2Image provider';
  11. }
  12. public function generate(string $prompt, array $resources): void {
  13. foreach ($resources as $resource) {
  14. $read = fopen(__DIR__ . '/../../img/logo.png', 'r');
  15. stream_copy_to_stream($read, $resource);
  16. fclose($read);
  17. }
  18. }
  19. public function getExpectedRuntime(): int {
  20. return 1;
  21. }
  22. public function getId(): string {
  23. return 'testing-fake-text2image-provider';
  24. }
  25. }