mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-07-09 17:36:22 +02:00
remove Interface-Suffix
This commit is contained in:
@ -7,10 +7,10 @@ namespace DesignPatterns\Structural\Composite;
|
|||||||
* The composite node MUST extend the component contract. This is mandatory for building
|
* The composite node MUST extend the component contract. This is mandatory for building
|
||||||
* a tree of components.
|
* a tree of components.
|
||||||
*/
|
*/
|
||||||
class Form implements RenderableInterface
|
class Form implements Renderable
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var RenderableInterface[]
|
* @var Renderable[]
|
||||||
*/
|
*/
|
||||||
private $elements;
|
private $elements;
|
||||||
|
|
||||||
@ -36,9 +36,9 @@ class Form implements RenderableInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param RenderableInterface $element
|
* @param Renderable $element
|
||||||
*/
|
*/
|
||||||
public function addElement(RenderableInterface $element)
|
public function addElement(Renderable $element)
|
||||||
{
|
{
|
||||||
$this->elements[] = $element;
|
$this->elements[] = $element;
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace DesignPatterns\Structural\Composite;
|
namespace DesignPatterns\Structural\Composite;
|
||||||
|
|
||||||
class InputElement implements RenderableInterface
|
class InputElement implements Renderable
|
||||||
{
|
{
|
||||||
public function render(): string
|
public function render(): string
|
||||||
{
|
{
|
||||||
|
@ -26,9 +26,9 @@ Code
|
|||||||
|
|
||||||
You can also find this code on `GitHub`_
|
You can also find this code on `GitHub`_
|
||||||
|
|
||||||
RenderableInterface.php
|
Renderable.php
|
||||||
|
|
||||||
.. literalinclude:: RenderableInterface.php
|
.. literalinclude:: Renderable.php
|
||||||
:language: php
|
:language: php
|
||||||
:linenos:
|
:linenos:
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace DesignPatterns\Structural\Composite;
|
namespace DesignPatterns\Structural\Composite;
|
||||||
|
|
||||||
interface RenderableInterface
|
interface Renderable
|
||||||
{
|
{
|
||||||
public function render(): string;
|
public function render(): string;
|
||||||
}
|
}
|
@ -3,7 +3,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace DesignPatterns\Structural\Composite;
|
namespace DesignPatterns\Structural\Composite;
|
||||||
|
|
||||||
class TextElement implements RenderableInterface
|
class TextElement implements Renderable
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 30 KiB |
@ -1,23 +0,0 @@
|
|||||||
@startuml
|
|
||||||
class Form {
|
|
||||||
#elements : array|FormElement[]
|
|
||||||
+render($indent = 0 : int)
|
|
||||||
+addElement(FormElement $element)
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract class FormElement {
|
|
||||||
+render($indent = 0 : int)
|
|
||||||
}
|
|
||||||
|
|
||||||
class InputElement {
|
|
||||||
+render($indent = 0 : int)
|
|
||||||
}
|
|
||||||
|
|
||||||
class TextElement {
|
|
||||||
+render($indent = 0 : int)
|
|
||||||
}
|
|
||||||
|
|
||||||
FormElement <|.. TextElement
|
|
||||||
FormElement <|.. InputElement
|
|
||||||
FormElement <|.. Form
|
|
||||||
@enduml
|
|
Reference in New Issue
Block a user