Skip to content

Commit 17e2d99

Browse files
committed
feat: add VariableKey class and docs
Introduce a final `VariableKey` class implementing `VariableKeyInterface` and a detailed docblock explaining its purpose for application-specific variable names stored in the `variables` table (activation codes, reset tokens, online session tokens, etc.). Encourages using these constants instead of raw strings, includes an example; class currently inherits interface constants and can be extended with project-specific keys.
1 parent 4a1c938 commit 17e2d99

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

src/config/constants.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,34 @@ final class SessionKey implements SessionKeyInterface
4848

4949
// --------------------------------------------------------------------
5050

51+
/**
52+
* VariableKey
53+
*
54+
* Application-specific variable keys extending the core system's
55+
* {@see VariableKeyInterface}. These constants map to the `name` column in the
56+
* `variables` table and should be used for per-entity state such as activation
57+
* codes, password reset codes, quick-login tokens, and online session tokens.
58+
*
59+
* Developers are encouraged to use this class instead of raw variable-name
60+
* strings when reading from or writing to the `variables` table. Applications
61+
* may add project-specific variable keys here without modifying the core
62+
* interface.
63+
*
64+
* @example
65+
* ```php
66+
* $this->db->get_where('variables', ['name' => VariableKey::ONLINE_TOKEN]);
67+
* ```
68+
*
69+
* @since 0.0.1
70+
*/
71+
final class VariableKey implements VariableKeyInterface
72+
{
73+
// Currently inherits all constants from VariableKeyInterface.
74+
// Add application-specific variable keys here if needed.
75+
}
76+
77+
// --------------------------------------------------------------------
78+
5179
/**
5280
* UserLevel
5381
*

0 commit comments

Comments
 (0)