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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# 0.1.1 Under development

- Enh #3: Implement interface `RenderInterface::class` (@terabytesoftw)
- Enh #4: Add interface `ContentInterface::class` and `LabelInterface::class` (@terabytesoftw)

## 0.1.0 February 27, 2024

Expand Down
20 changes: 20 additions & 0 deletions src/ContentInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

declare(strict_types=1);

namespace PHPForge\Html\Interop;

/**
* Provide methods for handling HTML content attributes.
*/
interface ContentInterface
{
/**
* Set the `HTML` content value.
*
* @param RenderInterface|string ...$values The `HTML` content value.
*
* @return static A new instance of the current class with the specified content value.
*/
public function content(string|RenderInterface ...$values): static;
}
64 changes: 64 additions & 0 deletions src/LabelInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?php

declare(strict_types=1);

namespace PHPForge\Html\Interop;

/**
* Provide methods for handling HTML choice input-related attributes and properties.
*/
interface LabelInterface
{
/**
* Set the current instance as being enclosed by a label.
*
* @param bool $value The value to set.
*
* @return static A new instance of the current class with the specified enclosed by label property.
*/
public function enclosedByLabel(bool $value): static;

/**
* Set the `HTML` label content.
*
* @param RenderInterface|string ...$values The `HTML` label content value.
*
* @return static A new instance of the current class with the specified `HTML` label content.
*/
public function label(string|RenderInterface ...$values): static;

/**
* Set the `HTML` attributes for the label.
*
* @param array $values Attribute values indexed by attribute names.
*
* @return static A new instance of the current class with the specified label attributes.
*/
public function labelAttributes(array $values): static;

/**
* Set the `CSS` class for the label.
*
* @param string $value The value of the class attribute.
* @param bool $override If `true` the value will be overridden.
*
* @return static A new instance of the current class with the specified label class.
*/
public function labelClass(string $value, bool $override = false): static;

/**
* Set the `for` attribute for the label.
*
* @param string|null $value The value for the `for` attribute.
*
* @return static A new instance of the current class with the specified label `for` attribute.
*/
public function labelFor(string|null $value): static;

/**
* Disable the label rendering.
*
* @return static A new instance of the current class with the label disabled.
*/
public function notLabel(): static;
}