|
| 1 | +<?php |
| 2 | +/* |
| 3 | + * This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony). |
| 4 | + * |
| 5 | + * Copyright (C) 2019 - 2025 Jan Böhmer (https://github.com/jbtronics) |
| 6 | + * |
| 7 | + * This program is free software: you can redistribute it and/or modify |
| 8 | + * it under the terms of the GNU Affero General Public License as published |
| 9 | + * by the Free Software Foundation, either version 3 of the License, or |
| 10 | + * (at your option) any later version. |
| 11 | + * |
| 12 | + * This program is distributed in the hope that it will be useful, |
| 13 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | + * GNU Affero General Public License for more details. |
| 16 | + * |
| 17 | + * You should have received a copy of the GNU Affero General Public License |
| 18 | + * along with this program. If not, see <https://www.gnu.org/licenses/>. |
| 19 | + */ |
| 20 | + |
| 21 | +declare(strict_types=1); |
| 22 | + |
| 23 | + |
| 24 | +namespace App\Services\InfoProviderSystem\Providers; |
| 25 | + |
| 26 | +use App\Services\InfoProviderSystem\DTOs\FileDTO; |
| 27 | +use App\Services\InfoProviderSystem\DTOs\PartDetailDTO; |
| 28 | +use App\Services\InfoProviderSystem\DTOs\SearchResultDTO; |
| 29 | +use Symfony\Component\DependencyInjection\Attribute\When; |
| 30 | + |
| 31 | +/** |
| 32 | + * This is a provider, which is used during tests. It always returns no results. |
| 33 | + */ |
| 34 | +#[When(env: 'test')] |
| 35 | +class EmptyProvider implements InfoProviderInterface |
| 36 | +{ |
| 37 | + public function getProviderInfo(): array |
| 38 | + { |
| 39 | + return [ |
| 40 | + 'name' => 'Empty Provider', |
| 41 | + 'description' => 'This is a test provider', |
| 42 | + //'url' => 'https://example.com', |
| 43 | + 'disabled_help' => 'This provider is disabled for testing purposes' |
| 44 | + ]; |
| 45 | + } |
| 46 | + |
| 47 | + public function getProviderKey(): string |
| 48 | + { |
| 49 | + return 'empty'; |
| 50 | + } |
| 51 | + |
| 52 | + public function isActive(): bool |
| 53 | + { |
| 54 | + return true; |
| 55 | + } |
| 56 | + |
| 57 | + public function searchByKeyword(string $keyword): array |
| 58 | + { |
| 59 | + return [ |
| 60 | + |
| 61 | + ]; |
| 62 | + } |
| 63 | + |
| 64 | + public function getCapabilities(): array |
| 65 | + { |
| 66 | + return [ |
| 67 | + ProviderCapabilities::BASIC, |
| 68 | + ProviderCapabilities::FOOTPRINT, |
| 69 | + ]; |
| 70 | + } |
| 71 | + |
| 72 | + public function getDetails(string $id): PartDetailDTO |
| 73 | + { |
| 74 | + throw new \RuntimeException('No part details available'); |
| 75 | + } |
| 76 | +} |
0 commit comments