PluginProbe
Auto Alt Text / trunk
Auto Alt Text vtrunk
3.0.3 2.8.2 1.3.1 1.3.2 2.0.0 2.1.0 2.1.1 2.2.0 2.3.0 2.3.1 2.3.2 2.3.3 2.3.4 2.4.0 2.4.1 2.4.2 2.5.0 2.5.1 2.5.2 2.5.3 2.6.0 2.6.1 2.7.0 2.8.0 2.8.1 All 28 releases
auto-alt-text / src / App / Configuration / OpenAIConfig.php

OpenAIConfig.php in Auto Alt Text trunk, at src/App/Configuration/OpenAIConfig.php

59 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 declare(strict_types=1);
4
5 namespace AATXT\App\Configuration;
6
7 /**
8 * Configuration object for OpenAI provider.
9 *
10 * Immutable value object that holds configuration data for OpenAI API calls.
11 * This class implements the Dependency Injection pattern, removing the need
12 * for static calls to PluginOptions.
13 */
14 final class OpenAIConfig implements AIProviderConfig
15 {
16 private string $apiKey;
17 private string $prompt;
18 private string $model;
19
20 /**
21 * @param string $apiKey The OpenAI API key
22 * @param string $prompt The prompt template for generating alt text
23 * @param string $model The OpenAI model identifier (e.g., 'gpt-4o', 'gpt-4o-mini')
24 */
25 public function __construct(
26 string $apiKey,
27 string $prompt,
28 string $model
29 ) {
30 $this->model = $model;
31 $this->prompt = $prompt;
32 $this->apiKey = $apiKey;
33 }
34
35 /**
36 * {@inheritDoc}
37 */
38 public function getApiKey(): string
39 {
40 return $this->apiKey;
41 }
42
43 /**
44 * {@inheritDoc}
45 */
46 public function getPrompt(): string
47 {
48 return $this->prompt;
49 }
50
51 /**
52 * {@inheritDoc}
53 */
54 public function getModel(): string
55 {
56 return $this->model;
57 }
58 }
59