Skip to content

Commit 863a07c

Browse files
committed
refactor: updates docblock with new standards
1 parent c78973e commit 863a07c

File tree

10 files changed

+200
-200
lines changed

10 files changed

+200
-200
lines changed

src/Common/AbstractEnum.php

Lines changed: 53 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ abstract class AbstractEnum
5555
private static array $instances = [];
5656

5757
/**
58-
* Constructor is private to ensure instances are created through static methods
58+
* Constructor is private to ensure instances are created through static methods.
5959
*
6060
* @since n.e.x.t
61-
* @param string $value The enum value
62-
* @param string $name The constant name
61+
* @param string $value The enum value.
62+
* @param string $name The constant name.
6363
*/
6464
final private function __construct(string $value, string $name)
6565
{
@@ -68,12 +68,12 @@ final private function __construct(string $value, string $name)
6868
}
6969

7070
/**
71-
* Magic getter to provide read-only access to properties
71+
* Provides read-only access to properties.
7272
*
7373
* @since n.e.x.t
74-
* @param string $property The property name
75-
* @return mixed
76-
* @throws BadMethodCallException If property doesn't exist
74+
* @param string $property The property name.
75+
* @return mixed The property value.
76+
* @throws BadMethodCallException If property doesn't exist.
7777
*/
7878
final public function __get(string $property)
7979
{
@@ -87,12 +87,12 @@ final public function __get(string $property)
8787
}
8888

8989
/**
90-
* Magic setter to prevent property modification
90+
* Prevents property modification.
9191
*
9292
* @since n.e.x.t
93-
* @param string $property The property name
94-
* @param mixed $value The value to set
95-
* @throws BadMethodCallException Always, as enum properties are read-only
93+
* @param string $property The property name.
94+
* @param mixed $value The value to set.
95+
* @throws BadMethodCallException Always, as enum properties are read-only.
9696
*/
9797
final public function __set(string $property, $value): void
9898
{
@@ -102,12 +102,12 @@ final public function __set(string $property, $value): void
102102
}
103103

104104
/**
105-
* Create an enum instance from a value, throws exception if invalid
105+
* Creates an enum instance from a value, throws exception if invalid.
106106
*
107107
* @since n.e.x.t
108-
* @param string $value The enum value
109-
* @return static
110-
* @throws InvalidArgumentException If the value is not valid
108+
* @param string $value The enum value.
109+
* @return static The enum instance.
110+
* @throws InvalidArgumentException If the value is not valid.
111111
*/
112112
final public static function from(string $value): self
113113
{
@@ -121,11 +121,11 @@ final public static function from(string $value): self
121121
}
122122

123123
/**
124-
* Try to create an enum instance from a value, returns null if invalid
124+
* Tries to create an enum instance from a value, returns null if invalid.
125125
*
126126
* @since n.e.x.t
127-
* @param string $value The enum value
128-
* @return static|null
127+
* @param string $value The enum value.
128+
* @return static|null The enum instance or null.
129129
*/
130130
final public static function tryFrom(string $value): ?self
131131
{
@@ -139,10 +139,10 @@ final public static function tryFrom(string $value): ?self
139139
}
140140

141141
/**
142-
* Get all enum cases
142+
* Gets all enum cases.
143143
*
144144
* @since n.e.x.t
145-
* @return static[]
145+
* @return static[] Array of all enum instances.
146146
*/
147147
final public static function cases(): array
148148
{
@@ -155,11 +155,11 @@ final public static function cases(): array
155155
}
156156

157157
/**
158-
* Check if this enum has the same value as the given value
158+
* Checks if this enum has the same value as the given value.
159159
*
160160
* @since n.e.x.t
161-
* @param string|self $other The value or enum to compare
162-
* @return bool
161+
* @param string|self $other The value or enum to compare.
162+
* @return bool True if values are equal.
163163
*/
164164
final public function equals($other): bool
165165
{
@@ -171,47 +171,47 @@ final public function equals($other): bool
171171
}
172172

173173
/**
174-
* Check if this enum is the same instance type and value as another enum
174+
* Checks if this enum is the same instance type and value as another enum.
175175
*
176176
* @since n.e.x.t
177-
* @param self $other The other enum to compare
178-
* @return bool
177+
* @param self $other The other enum to compare.
178+
* @return bool True if enums are identical.
179179
*/
180180
final public function is(self $other): bool
181181
{
182182
return $this === $other; // Since we're using singletons, we can use identity comparison
183183
}
184184

185185
/**
186-
* Get all valid values for this enum
186+
* Gets all valid values for this enum.
187187
*
188188
* @since n.e.x.t
189-
* @return array<string, string>
189+
* @return array<string, string> Map of constant names to values.
190190
*/
191191
final public static function getValues(): array
192192
{
193193
return self::getConstants();
194194
}
195195

196196
/**
197-
* Check if a value is valid for this enum
197+
* Checks if a value is valid for this enum.
198198
*
199199
* @since n.e.x.t
200-
* @param string $value The value to check
201-
* @return bool
200+
* @param string $value The value to check.
201+
* @return bool True if value is valid.
202202
*/
203203
final public static function isValidValue(string $value): bool
204204
{
205205
return in_array($value, self::getValues(), true);
206206
}
207207

208208
/**
209-
* Get or create a singleton instance for the given value and name
209+
* Gets or creates a singleton instance for the given value and name.
210210
*
211211
* @since n.e.x.t
212-
* @param string $value The enum value
213-
* @param string $name The constant name
214-
* @return static
212+
* @param string $value The enum value.
213+
* @param string $name The constant name.
214+
* @return static The enum instance.
215215
*/
216216
private static function getInstance(string $value, string $name): self
217217
{
@@ -231,11 +231,11 @@ private static function getInstance(string $value, string $name): self
231231
}
232232

233233
/**
234-
* Get all constants for this enum class
234+
* Gets all constants for this enum class.
235235
*
236236
* @since n.e.x.t
237-
* @return array<string, string>
238-
* @throws \RuntimeException If invalid constant found
237+
* @return array<string, string> Map of constant names to values.
238+
* @throws \RuntimeException If invalid constant found.
239239
*/
240240
final protected static function getConstants(): array
241241
{
@@ -282,13 +282,13 @@ final protected static function getConstants(): array
282282
}
283283

284284
/**
285-
* Handle dynamic method calls for enum checking
285+
* Handles dynamic method calls for enum checking.
286286
*
287287
* @since n.e.x.t
288-
* @param string $name The method name
289-
* @param array<mixed> $arguments The method arguments
290-
* @return bool
291-
* @throws BadMethodCallException If the method doesn't exist
288+
* @param string $name The method name.
289+
* @param array<mixed> $arguments The method arguments.
290+
* @return bool True if the enum value matches.
291+
* @throws BadMethodCallException If the method doesn't exist.
292292
*/
293293
final public function __call(string $name, array $arguments): bool
294294
{
@@ -308,13 +308,13 @@ final public function __call(string $name, array $arguments): bool
308308
}
309309

310310
/**
311-
* Handle static method calls for enum creation
311+
* Handles static method calls for enum creation.
312312
*
313313
* @since n.e.x.t
314-
* @param string $name The method name
315-
* @param array<mixed> $arguments The method arguments
316-
* @return static
317-
* @throws BadMethodCallException If the method doesn't exist
314+
* @param string $name The method name.
315+
* @param array<mixed> $arguments The method arguments.
316+
* @return static The enum instance.
317+
* @throws BadMethodCallException If the method doesn't exist.
318318
*/
319319
final public static function __callStatic(string $name, array $arguments): self
320320
{
@@ -331,11 +331,11 @@ final public static function __callStatic(string $name, array $arguments): self
331331
}
332332

333333
/**
334-
* Convert camelCase to CONSTANT_CASE
334+
* Converts camelCase to CONSTANT_CASE.
335335
*
336336
* @since n.e.x.t
337-
* @param string $camelCase The camelCase string
338-
* @return string The CONSTANT_CASE version
337+
* @param string $camelCase The camelCase string.
338+
* @return string The CONSTANT_CASE version.
339339
*/
340340
private static function camelCaseToConstant(string $camelCase): string
341341
{
@@ -347,10 +347,10 @@ private static function camelCaseToConstant(string $camelCase): string
347347
}
348348

349349
/**
350-
* String representation of the enum
350+
* Returns string representation of the enum.
351351
*
352352
* @since n.e.x.t
353-
* @return string
353+
* @return string The enum value.
354354
*/
355355
final public function __toString(): string
356356
{

src/Messages/Enums/MessagePartTypeEnum.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,44 +7,44 @@
77
use WordPress\AiClient\Common\AbstractEnum;
88

99
/**
10-
* Enum for message part types
10+
* Enum for message part types.
1111
*
1212
* @since n.e.x.t
13-
* @method static self text() Create an instance for TEXT type
14-
* @method static self inlineFile() Create an instance for INLINE_FILE type
15-
* @method static self remoteFile() Create an instance for REMOTE_FILE type
16-
* @method static self functionCall() Create an instance for FUNCTION_CALL type
17-
* @method static self functionResponse() Create an instance for FUNCTION_RESPONSE type
18-
* @method bool isText() Check if the type is TEXT
19-
* @method bool isInlineFile() Check if the type is INLINE_FILE
20-
* @method bool isRemoteFile() Check if the type is REMOTE_FILE
21-
* @method bool isFunctionCall() Check if the type is FUNCTION_CALL
22-
* @method bool isFunctionResponse() Check if the type is FUNCTION_RESPONSE
13+
* @method static self text() Creates an instance for TEXT type.
14+
* @method static self inlineFile() Creates an instance for INLINE_FILE type.
15+
* @method static self remoteFile() Creates an instance for REMOTE_FILE type.
16+
* @method static self functionCall() Creates an instance for FUNCTION_CALL type.
17+
* @method static self functionResponse() Creates an instance for FUNCTION_RESPONSE type.
18+
* @method bool isText() Checks if the type is TEXT.
19+
* @method bool isInlineFile() Checks if the type is INLINE_FILE.
20+
* @method bool isRemoteFile() Checks if the type is REMOTE_FILE.
21+
* @method bool isFunctionCall() Checks if the type is FUNCTION_CALL.
22+
* @method bool isFunctionResponse() Checks if the type is FUNCTION_RESPONSE.
2323
*/
2424
class MessagePartTypeEnum extends AbstractEnum
2525
{
2626
/**
27-
* Text content
27+
* Text content.
2828
*/
2929
public const TEXT = 'text';
3030

3131
/**
32-
* Inline file content (base64 encoded)
32+
* Inline file content (base64 encoded).
3333
*/
3434
public const INLINE_FILE = 'inline_file';
3535

3636
/**
37-
* Remote file reference (URL)
37+
* Remote file reference (URL).
3838
*/
3939
public const REMOTE_FILE = 'remote_file';
4040

4141
/**
42-
* Function call request
42+
* Function call request.
4343
*/
4444
public const FUNCTION_CALL = 'function_call';
4545

4646
/**
47-
* Function response
47+
* Function response.
4848
*/
4949
public const FUNCTION_RESPONSE = 'function_response';
5050
}

src/Messages/Enums/MessageRoleEnum.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,30 @@
77
use WordPress\AiClient\Common\AbstractEnum;
88

99
/**
10-
* Enum for message roles in AI conversations
10+
* Enum for message roles in AI conversations.
1111
*
1212
* @since n.e.x.t
13-
* @method static self user() Create an instance for USER role
14-
* @method static self model() Create an instance for MODEL role
15-
* @method static self system() Create an instance for SYSTEM role
16-
* @method bool isUser() Check if the role is USER
17-
* @method bool isModel() Check if the role is MODEL
18-
* @method bool isSystem() Check if the role is SYSTEM
13+
* @method static self user() Creates an instance for USER role.
14+
* @method static self model() Creates an instance for MODEL role.
15+
* @method static self system() Creates an instance for SYSTEM role.
16+
* @method bool isUser() Checks if the role is USER.
17+
* @method bool isModel() Checks if the role is MODEL.
18+
* @method bool isSystem() Checks if the role is SYSTEM.
1919
*/
2020
class MessageRoleEnum extends AbstractEnum
2121
{
2222
/**
23-
* User role - messages from the user
23+
* User role - messages from the user.
2424
*/
2525
public const USER = 'user';
2626

2727
/**
28-
* Model role - messages from the AI model
28+
* Model role - messages from the AI model.
2929
*/
3030
public const MODEL = 'model';
3131

3232
/**
33-
* System role - system instructions
33+
* System role - system instructions.
3434
*/
3535
public const SYSTEM = 'system';
3636
}

0 commit comments

Comments
 (0)