| 1 |
<?php |
| 2 |
|
| 3 |
namespace AATXT\App\Services; |
| 4 |
|
| 5 |
use AATXT\App\AltTextGeneratorInterface; |
| 6 |
use AATXT\App\Domain\Exceptions\UnsupportedGeneratorException; |
| 7 |
|
| 8 |
/** |
| 9 |
* Factory interface for creating AltTextGenerator instances. |
| 10 |
* |
| 11 |
* This interface defines the contract for creating different types of |
| 12 |
* alt text generators based on a configuration type. |
| 13 |
* |
| 14 |
* Following the Open/Closed Principle, new generator types can be added |
| 15 |
* without modifying existing code, just by registering them in the factory. |
| 16 |
*/ |
| 17 |
interface AltTextGeneratorFactory |
| 18 |
{ |
| 19 |
/** |
| 20 |
* Create an alt text generator instance for the given type. |
| 21 |
* |
| 22 |
* @param string $type The generator type identifier (e.g., 'openai', 'anthropic', 'azure') |
| 23 |
* @return AltTextGeneratorInterface The generator instance |
| 24 |
* @throws UnsupportedGeneratorException If the type is not registered |
| 25 |
*/ |
| 26 |
public function create(string $type): AltTextGeneratorInterface; |
| 27 |
} |
| 28 |
|