Skip to content

Commit 7e90e70

Browse files
Implement interface RenderInterface::class. (#3)
1 parent 8c27d3d commit 7e90e70

File tree

3 files changed

+34
-10
lines changed

3 files changed

+34
-10
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
# 0.1.1 Under development
44

5+
- Enh #3: Implement interface `RenderInterface::class` (@terabytesoftw)
6+
57
## 0.1.0 February 27, 2024
68

79
- Initial release

src/InputInterface.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,17 @@
77
/**
88
* Provide methods for handling HTML input-related attributes.
99
*/
10-
interface InputInterface
10+
interface InputInterface extends RenderInterface
1111
{
12+
/**
13+
* Set the `HTML` attributes.
14+
*
15+
* @param array $values Attribute values indexed by attribute names.
16+
*
17+
* @return static A new instance of the current class with the specified attributes.
18+
*/
19+
public function attributes(array $values): static;
20+
1221
/**
1322
* Set the `CSS` `HTML` class attribute.
1423
*
@@ -21,15 +30,6 @@ interface InputInterface
2130
*/
2231
public function class(string $value, bool $override = false): static;
2332

24-
/**
25-
* Set the `HTML` attributes.
26-
*
27-
* @param array $values Attribute values indexed by attribute names.
28-
*
29-
* @return static A new instance of the current class with the specified attributes.
30-
*/
31-
public function attributes(array $values): static;
32-
3333
/**
3434
* Generate the id and name attributes for the field.
3535
*

src/RenderInterface.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace PHPForge\Html\Interop;
6+
7+
use Stringable;
8+
9+
/**
10+
* Provide methods for handling HTML rendering.
11+
*/
12+
interface RenderInterface extends Stringable
13+
{
14+
/**
15+
* Executes the widget.
16+
*
17+
* This method is responsible for executing the widget and returning the result of the execution as a string.
18+
*
19+
* @return string The result of widget execution to be outputted.
20+
*/
21+
public function render(): string;
22+
}

0 commit comments

Comments
 (0)