Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
319 changes: 199 additions & 120 deletions clover.xml

Large diffs are not rendered by default.

67 changes: 8 additions & 59 deletions src/Command/CreateClassCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
namespace Html\Command;

use Html\Helper\Helper;
use Html\Helper\NamingHelper;
use Html\Helper\TypeMapper;
use Html\Helper\CommentHelper;
use Silly\Input\InputArgument;
use Silly\Input\InputOption;
use Symfony\Component\Console\Command\Command;
Expand Down Expand Up @@ -590,81 +593,27 @@ private function filterAndSortUses(array $uses, string $ignoreClass): array
// String manipulation utilities
private function toVariableName(string $string): string
{
$string = str_replace(['-', '_'], ' ', $string);
$words = explode(' ', $string);
$string = implode('', array_map('ucfirst', $words));
return lcfirst($string);
return NamingHelper::toVariableName($string);
}

private function toKebapCase(string $string): string
{
$string = str_replace(['-', '_'], ' ', $string);
$string = ucwords($string);
return str_replace(' ', '', $string);
return NamingHelper::toKebapCase($string);
}

private function getClassName(string $classname): string
{
$reserved = Helper::getReservedWords();
if (in_array(strtolower($classname), $reserved, true)) {
return $classname . 'Element';
}
return $classname;
return NamingHelper::getClassName($classname);
}

private function getAttributeComment(array $details): string
{
$lines = [];
$lines[] = $details['description'] ?? '';
$lines[] = '@category HTML attribute';

if (isset($details['deprecated']) && $details['deprecated']) {
$lines[] = '@deprecated' . \PHP_EOL . ' ';
}
if (isset($details['defaultValue'])) {
$lines[] = '@example ' . $details['defaultValue'] . \PHP_EOL . ' ';
}
if (isset($details['required']) && $details['required']) {
$lines[] = '@required' . \PHP_EOL . ' ';
}

$comment = '/** ';
if (count($lines) > 2) {
$comment .= \PHP_EOL . ' * ' . implode(\PHP_EOL . ' * ', $lines);
} else {
$comment .= $lines[0];
}

return $comment . ' */' . \PHP_EOL;
return CommentHelper::getAttributeComment($details);
}

private function mapToPhpType(string $string): string
{
return match ($string) {
'string' => 'string',
'integer' => 'int',
'boolean' => 'bool',
'uri' => 'string',
'language_iso' => 'string',
'color' => 'string',
'datetime' => 'string',
'datetime-local' => 'string',
'date' => 'string',
'time' => 'string',
'month' => 'string',
'week' => 'string',
'number' => 'int',
'float' => 'float',
'script' => 'string',
'url' => 'string',
'email' => 'string',
'tel' => 'string',
'password' => 'string',
'hidden' => 'bool|string',
'image' => 'string',
'file' => 'string',
default => $string,
};
return TypeMapper::mapToPhpType($string);
}

// Method signature templates
Expand Down
34 changes: 25 additions & 9 deletions src/Element/Block/Article.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* This file is auto-generated. Do not edit manually.
*
* @generated 2025-12-30 13:44:50
* @generated 2025-12-30 23:54:09
* @category HTML
* @package vardumper/extended-htmldocument
* @subpackage Html\Element\Block
Expand Down Expand Up @@ -211,16 +211,24 @@ class Article extends BlockElement
];


/** Defines the semantic purpose of an element for assistive technologies. */
/**
* Defines the semantic purpose of an element for assistive technologies.
* @category HTML attribute */
protected ?RoleEnum $role = null;

/** Identifies the element(s) whose contents or presence are controlled by this element. Value is a list of IDs separated by a space */
/**
* Identifies the element(s) whose contents or presence are controlled by this element. Value is a list of IDs separated by a space
* @category HTML attribute */
protected ?string $ariaControls = null;

/** Identifies the element(s) that describes the object. Value is a list of IDs separated by a space */
/**
* Identifies the element(s) that describes the object. Value is a list of IDs separated by a space
* @category HTML attribute */
protected ?string $ariaDescribedby = null;

/** Identifies the element(s) that labels the current element. Value is a list of IDs separated by a space */
/**
* Identifies the element(s) that labels the current element. Value is a list of IDs separated by a space
* @category HTML attribute */
protected ?string $ariaLabelledby = null;

/**
Expand All @@ -230,13 +238,19 @@ class Article extends BlockElement
*/
protected ?AriaBusyEnum $ariaBusy = null;

/** References an element that provides additional details about the current element. */
/**
* References an element that provides additional details about the current element.
* @category HTML attribute */
protected ?string $ariaDetails = null;

/** Defines keyboard shortcuts available for the element. */
/**
* Defines keyboard shortcuts available for the element.
* @category HTML attribute */
protected ?string $ariaKeyshortcuts = null;

/** Provides a human-readable custom role description for assistive technologies. */
/**
* Provides a human-readable custom role description for assistive technologies.
* @category HTML attribute */
protected ?string $ariaRoledescription = null;

/**
Expand All @@ -260,7 +274,9 @@ class Article extends BlockElement
*/
protected ?AriaAtomicEnum $ariaAtomic = null;

/** Establishes ownership relationships between elements. Value is a space-separated list of IDs. */
/**
* Establishes ownership relationships between elements. Value is a space-separated list of IDs.
* @category HTML attribute */
protected ?string $ariaOwns = null;


Expand Down
38 changes: 28 additions & 10 deletions src/Element/Block/Aside.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* This file is auto-generated. Do not edit manually.
*
* @generated 2025-12-30 13:44:50
* @generated 2025-12-30 23:54:09
* @category HTML
* @package vardumper/extended-htmldocument
* @subpackage Html\Element\Block
Expand Down Expand Up @@ -231,16 +231,24 @@ class Aside extends BlockElement
];


/** Defines the semantic purpose of an element for assistive technologies. */
/**
* Defines the semantic purpose of an element for assistive technologies.
* @category HTML attribute */
protected ?RoleEnum $role = null;

/** Identifies the element(s) whose contents or presence are controlled by this element. Value is a list of IDs separated by a space */
/**
* Identifies the element(s) whose contents or presence are controlled by this element. Value is a list of IDs separated by a space
* @category HTML attribute */
protected ?string $ariaControls = null;

/** Identifies the element(s) that describes the object. Value is a list of IDs separated by a space */
/**
* Identifies the element(s) that describes the object. Value is a list of IDs separated by a space
* @category HTML attribute */
protected ?string $ariaDescribedby = null;

/** Identifies the element(s) that labels the current element. Value is a list of IDs separated by a space */
/**
* Identifies the element(s) that labels the current element. Value is a list of IDs separated by a space
* @category HTML attribute */
protected ?string $ariaLabelledby = null;

/**
Expand All @@ -250,16 +258,24 @@ class Aside extends BlockElement
*/
protected ?AriaBusyEnum $ariaBusy = null;

/** Defines a string value that labels the current element for assistive technologies. */
/**
* Defines a string value that labels the current element for assistive technologies.
* @category HTML attribute */
protected ?string $ariaLabel = null;

/** References an element that provides additional details about the current element. */
/**
* References an element that provides additional details about the current element.
* @category HTML attribute */
protected ?string $ariaDetails = null;

/** Defines keyboard shortcuts available for the element. */
/**
* Defines keyboard shortcuts available for the element.
* @category HTML attribute */
protected ?string $ariaKeyshortcuts = null;

/** Provides a human-readable custom role description for assistive technologies. */
/**
* Provides a human-readable custom role description for assistive technologies.
* @category HTML attribute */
protected ?string $ariaRoledescription = null;

/**
Expand All @@ -283,7 +299,9 @@ class Aside extends BlockElement
*/
protected ?AriaAtomicEnum $ariaAtomic = null;

/** Establishes ownership relationships between elements. Value is a space-separated list of IDs. */
/**
* Establishes ownership relationships between elements. Value is a space-separated list of IDs.
* @category HTML attribute */
protected ?string $ariaOwns = null;


Expand Down
54 changes: 40 additions & 14 deletions src/Element/Block/Audio.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* This file is auto-generated. Do not edit manually.
*
* @generated 2025-12-30 13:44:50
* @generated 2025-12-30 23:54:09
* @category HTML
* @package vardumper/extended-htmldocument
* @subpackage Html\Element\Block
Expand Down Expand Up @@ -103,22 +103,34 @@ class Audio extends BlockElement
];


/** When present, it specifies that the audio or video will automatically start playing as soon as it can do so without stopping. */
/**
* When present, it specifies that the audio or video will automatically start playing as soon as it can do so without stopping.
* @category HTML attribute */
protected ?bool $autoplay = null;

/** When present, it specifies that audio or video controls should be displayed (such as play, pause, and volume). */
/**
* When present, it specifies that audio or video controls should be displayed (such as play, pause, and volume).
* @category HTML attribute */
protected ?bool $controls = null;

/** Specifies how the element handles cross-origin requests. */
/**
* Specifies how the element handles cross-origin requests.
* @category HTML attribute */
protected ?CrossoriginEnum $crossorigin = null;

/** When present, it specifies that the audio or video will start over again every time it is finished. */
/**
* When present, it specifies that the audio or video will start over again every time it is finished.
* @category HTML attribute */
protected ?bool $loop = null;

/** When present, it specifies that the audio output of the video should be muted. */
/**
* When present, it specifies that the audio output of the video should be muted.
* @category HTML attribute */
protected ?bool $muted = null;

/** */
/**
*
* @category HTML attribute */
protected ?PreloadEnum $preload = null;

/**
Expand All @@ -128,16 +140,24 @@ class Audio extends BlockElement
*/
protected ?string $src = null;

/** Defines the semantic purpose of an element for assistive technologies. */
/**
* Defines the semantic purpose of an element for assistive technologies.
* @category HTML attribute */
protected ?RoleEnum $role = null;

/** Identifies the element(s) whose contents or presence are controlled by this element. Value is a list of IDs separated by a space */
/**
* Identifies the element(s) whose contents or presence are controlled by this element. Value is a list of IDs separated by a space
* @category HTML attribute */
protected ?string $ariaControls = null;

/** Identifies the element(s) that describes the object. Value is a list of IDs separated by a space */
/**
* Identifies the element(s) that describes the object. Value is a list of IDs separated by a space
* @category HTML attribute */
protected ?string $ariaDescribedby = null;

/** Identifies the element(s) that labels the current element. Value is a list of IDs separated by a space */
/**
* Identifies the element(s) that labels the current element. Value is a list of IDs separated by a space
* @category HTML attribute */
protected ?string $ariaLabelledby = null;

/**
Expand All @@ -147,13 +167,19 @@ class Audio extends BlockElement
*/
protected ?AriaBusyEnum $ariaBusy = null;

/** References an element that provides additional details about the current element. */
/**
* References an element that provides additional details about the current element.
* @category HTML attribute */
protected ?string $ariaDetails = null;

/** Defines keyboard shortcuts available for the element. */
/**
* Defines keyboard shortcuts available for the element.
* @category HTML attribute */
protected ?string $ariaKeyshortcuts = null;

/** Provides a human-readable custom role description for assistive technologies. */
/**
* Provides a human-readable custom role description for assistive technologies.
* @category HTML attribute */
protected ?string $ariaRoledescription = null;

/**
Expand Down
Loading
Loading