Data Types
PHP enums are used to specify valid values for properties. This provides a central location for validation logic and documentation, as well as reducing duplication, ensuring consistency, and enabling type safety.
Alignment
Enum used to specify valid values for alignment properties.
Supported values
| Case | Value |
|---|---|
START | start |
END | end |
CENTER | center |
JUSTIFY | justify |
MATCH_PARENT | match-parent |
Methods
fromString(string $value)- Converts a string to the corresponding enum case.
Supported input mappings
Input Result 'start'self::START'left'self::START'top'self::START'end'self::END'right'self::END'bottom'self::END'center'self::CENTER'justify'self::JUSTIFYdefaultself::MATCH_PARENT
Basic usage
use Doubleedesign\Comet\Core\Alignment;
$result = Alignment::START;
$value = $result->value; // returns 'start'
Method usage
AspectRatio
Enum used to specify valid values for aspect ratio properties.
Supported values
| Case | Value |
|---|---|
STANDARD | 4:3 |
PORTRAIT | 3:4 |
SQUARE | 1:1 |
WIDE | 16:9 |
TALL | 9:16 |
CLASSIC | 3:2 |
CLASSIC_PORTRAIT | 2:3 |
CINEMATIC | 21:9 |
CINEMASCOPE | 2.35:1 |
Methods
fromString(string $value)- Converts a string to the corresponding enum case.
Supported input mappings
Input Result '4:3'self::STANDARD'4/3'self::STANDARD'standard'self::STANDARD'3:4'self::PORTRAIT'3/4'self::PORTRAIT'portrait'self::PORTRAIT'1:1'self::SQUARE'1/1'self::SQUARE'square'self::SQUARE'16:9'self::WIDE'16/9'self::WIDE'wide'self::WIDE'9:16'self::TALL'9/16'self::TALL'tall'self::TALL'3:2'self::CLASSIC'3/2'self::CLASSIC'classic'self::CLASSIC'2:3'self::CLASSIC_PORTRAIT'2/3'self::CLASSIC_PORTRAIT'classic_portrait'self::CLASSIC_PORTRAIT'2.35:1'self::CINEMASCOPE'2.35/1'self::CINEMASCOPE'2.35'self::CINEMASCOPE'cinemascope'self::CINEMASCOPEdefaultnull
Basic usage
use Doubleedesign\Comet\Core\AspectRatio;
$result = AspectRatio::STANDARD;
$value = $result->value; // returns '4:3'
Method usage
ContainerSize
Enum used to specify valid values for container size properties.
Supported values
| Case | Value |
|---|---|
FULLWIDTH | fullwidth |
WIDE | wide |
NARROW | narrow |
NARROWER | narrower |
SMALL | small |
DEFAULT | default |
Methods
tryFrom(string $value): ?self- Built-in PHP enum method that converts a string to the corresponding enum case, or returns null if the string is not a valid value.
Basic usage
use Doubleedesign\Comet\Core\ContainerSize;
$result = ContainerSize::FULLWIDTH;
$value = $result->value; // returns 'fullwidth'
Method usage
use Doubleedesign\Comet\Core\ContainerSize;
$result = ContainerSize::tryFrom('fullwidth');
GroupLayout
Enum used to specify valid values for group layout properties.
Supported values
| Case | Value |
|---|---|
LIST | list |
GRID | grid |
INLINE | inline |
Methods
fromString(string $value)- Converts a string to the corresponding enum case.
Supported input mappings
Input Result 'grid'self::GRID'inline'self::INLINEdefaultself::LIST
Basic usage
use Doubleedesign\Comet\Core\GroupLayout;
$result = GroupLayout::LIST;
$value = $result->value; // returns 'list'
Method usage
Orientation
Enum used to specify valid values for orientation properties.
Supported values
| Case | Value |
|---|---|
HORIZONTAL | horizontal |
VERTICAL | vertical |
Methods
tryFrom(string $value): ?self- Built-in PHP enum method that converts a string to the corresponding enum case, or returns null if the string is not a valid value.
Basic usage
use Doubleedesign\Comet\Core\Orientation;
$result = Orientation::HORIZONTAL;
$value = $result->value; // returns 'horizontal'
Method usage
use Doubleedesign\Comet\Core\Orientation;
$result = Orientation::tryFrom('horizontal');
Tag
Enum used to specify valid values for tag properties.
Supported values
| Case | Value | Valid attributes |
|---|---|---|
| A | a | download, href, hreflang, ping, referrerpolicy, rel, target, type, aria-current |
| ABBR | abbr | Global attributes |
| ABBR | abbr | |
| ADDRESS | address | Global attributes |
| ADDRESS | address | |
| ARTICLE | article | Global attributes |
| ARTICLE | article | |
| ASIDE | aside | Global attributes |
| ASIDE | aside | |
| AUDIO | audio | autoplay, controls, controlslist, crossorigin, disableremoteplayback, loop, muted, preload, src |
| BDI | bdi | Global attributes |
| BDI | bdi | |
| BDO | bdo | Global attributes |
| BDO | bdo | |
| BLOCKQUOTE | blockquote | cite |
| BR | br | Global attributes |
| BR | br | |
| BUTTON | button | aria-expanded, aria-haspopup, aria-pressed, disabled, form, formaction, formenctype, formmethod, formnovalidate, formtarget, name, popovertarget, popovertargetaction, type, value |
| CANVAS | canvas | height, width |
| CAPTION | caption | Global attributes |
| CAPTION | caption | |
| CITE | cite | Global attributes |
| CITE | cite | |
| CODE | code | Global attributes |
| CODE | code | |
| COL | col | span |
| COLGROUP | colgroup | span |
| DATA | data | value |
| DATALIST | datalist | Global attributes |
| DATALIST | datalist | |
| DD | dd | Global attributes |
| DD | dd | |
| DEL | del | cite, datetime |
| DETAILS | details | open, name |
| DFN | dfn | Global attributes |
| DFN | dfn | |
| DIALOG | dialog | open, aria-modal |
| DIV | div | role |
| DL | dl | Global attributes |
| DL | dl | |
| DT | dt | Global attributes |
| DT | dt | |
| EM | em | Global attributes |
| EM | em | |
| EMBED | embed | height, src, type, width |
| FIELDSET | fieldset | disabled, form, name |
| FIGCAPTION | figcaption | Global attributes |
| FIGCAPTION | figcaption | |
| FIGURE | figure | Global attributes |
| FIGURE | figure | |
| FOOTER | footer | Global attributes |
| FOOTER | footer | |
| FORM | form | accept-charset, autocomplete, name, rel |
| H1 | h1 | Global attributes |
| H1 | h1 | |
| H2 | h2 | Global attributes |
| H2 | h2 | |
| H3 | h3 | Global attributes |
| H3 | h3 | |
| H4 | h4 | Global attributes |
| H4 | h4 | |
| H5 | h5 | Global attributes |
| H5 | h5 | |
| H6 | h6 | Global attributes |
| H6 | h6 | |
| HEAD | head | Global attributes |
| HEAD | head | |
| HEADER | header | Global attributes |
| HEADER | header | |
| HGROUP | hgroup | Global attributes |
| HGROUP | hgroup | |
| HR | hr | Global attributes |
| HR | hr | |
| I | i | Global attributes |
| I | i | |
| IFRAME | iframe | allow, allowfullscreen, height, loading, name, referrerpolicy, sandbox, src, srcdoc, width |
| IMG | img | alt, crossorigin, decoding, elementtiming, fetchpriority, height, ismap, loading, referrerpolicy, sizes, src, srcset, width, usemap |
| INPUT | input | accept, alt, aria-invalid, aria-required, autocomplete, capture, checked, dirname, disabled, form, formaction, formenctype, formmethod, formnovalidate, formtarget, height, list, max, maxlength, min, minlength, multiple, name, pattern, placeholder, popovertarget, popovertargetaction, readonly, required, size, src, step, type, value, width |
| INS | ins | cite, datetime |
| KBD | kbd | Global attributes |
| KBD | kbd | |
| LABEL | label | for |
| LEGEND | legend | Global attributes |
| LEGEND | legend | |
| LI | li | value |
| MAIN | main | Global attributes |
| MAIN | main | |
| MAP | map | name |
| MARK | mark | Global attributes |
| MARK | mark | |
| META | meta | charset, content, http-equiv, name |
| METER | meter | aria-valuemin, aria-valuemax, aria-valuenow, value, min, max, low, high, optimum, form |
| NAV | nav | Global attributes |
| NAV | nav | |
| NOSCRIPT | noscript | Global attributes |
| NOSCRIPT | noscript | |
| OBJECT | object | data, form, height, name, type, width |
| OL | ol | reversed, start, type |
| OPTGROUP | optgroup | disabled, label |
| OPTION | option | disabled, label, selected, value |
| OUTPUT | output | for, form, name |
| P | p | Global attributes |
| P | p | |
| PICTURE | picture | Global attributes |
| PICTURE | picture | |
| PRE | pre | Global attributes |
| PRE | pre | |
| PROGRESS | progress | aria-valuemin, aria-valuemax, aria-valuenow, max, value |
| Q | q | cite |
| S | s | Global attributes |
| S | s | |
| SAMP | samp | Global attributes |
| SAMP | samp | |
| SEARCH | search | Global attributes |
| SEARCH | search | |
| SECTION | section | Global attributes |
| SECTION | section | |
| SELECT | select | autocomplete, disabled, form, multiple, name, required, size |
| SMALL | small | Global attributes |
| SMALL | small | |
| SOURCE | source | type, src, srcset, sizes, media, height, width |
| SPAN | span | Global attributes |
| SPAN | span | |
| STRONG | strong | Global attributes |
| STRONG | strong | |
| STYLE | style | media |
| SUB | sub | Global attributes |
| SUB | sub | |
| SUMMARY | summary | Global attributes |
| SUMMARY | summary | |
| SUP | sup | Global attributes |
| SUP | sup | |
| TABLE | table | aria-colcount, aria-rowcount |
| TBODY | tbody | Global attributes |
| TBODY | tbody | |
| TD | td | colspan, headers, rowspan |
| TEXTAREA | textarea | aria-invalid, aria-required, autocomplete, autocorrect, cols, dirname, disabled, form, maxlength, minlength, name, placeholder, readonly, required, rows, wrap |
| TFOOT | tfoot | Global attributes |
| TFOOT | tfoot | |
| TH | th | abbr, colspan, headers, rowspan, scope |
| THEAD | thead | Global attributes |
| THEAD | thead | |
| TIME | time | datetime |
| TITLE | title | Global attributes |
| TITLE | title | |
| TR | tr | Global attributes |
| TR | tr | |
| TRACK | track | default, kind, label, src, srclang |
| U | u | Global attributes |
| U | u | |
| UL | ul | Global attributes |
| UL | ul | |
| VAR | var | Global attributes |
| VAR | var | |
| VIDEO | video | autoplay, controls, controlslist, crossorigin, disablepictureinpicture, disableremoteplayback, height, loop, muted, playsinline, poster, preload, src, width |
| WBR | wbr | Global attributes |
| WBR | wbr |
Global attributes
accesskeyaria-labelaria-labelledbyaria-describedbyaria-controlsautocapitalizeautofocusclasscontenteditabledata-*dirdraggableenterkeyhintexportpartshiddenidinertinputmodeisitemiditempropitemrefitemscopeitemtypelangnoncepartpopoverslotspellcheckstyletabindextitletranslatewritingsuggestions
Methods
tryFrom(string $value): ?self- Built-in PHP enum method that converts a string to the corresponding enum case, or returns null if the string is not a valid value.
get_valid_attributes(): array- Returns an array of valid attributes
Basic usage
use Doubleedesign\Comet\Core\Tag;
$result = Tag::A;
$value = $result->value; // returns 'a'
Method usage
use Doubleedesign\Comet\Core\Tag;
$result = Tag::tryFrom('a');
use Doubleedesign\Comet\Core\Tag;
$someTag = Tag::A;
$result = $someTag->get_valid_attributes();
ThemeColor
Enum used to specify valid values for theme color properties.
Supported values
| Case | Value |
|---|---|
PRIMARY | primary |
SECONDARY | secondary |
ACCENT | accent |
ERROR | error |
SUCCESS | success |
WARNING | warning |
INFO | info |
LIGHT | light |
DARK | dark |
WHITE | white |
BLACK | black |
Methods
tryFrom(string $value): ?self- Built-in PHP enum method that converts a string to the corresponding enum case, or returns null if the string is not a valid value.
Basic usage
use Doubleedesign\Comet\Core\ThemeColor;
$result = ThemeColor::PRIMARY;
$value = $result->value; // returns 'primary'
Method usage
use Doubleedesign\Comet\Core\ThemeColor;
$result = ThemeColor::tryFrom('primary');
