| 1 | <?php |
||
| 22 | class HtmlForm implements FormInterface |
||
| 23 | { |
||
| 24 | /** @var string */ |
||
| 25 | private $name; |
||
| 26 | /** @var string */ |
||
| 27 | private $action; |
||
| 28 | /** @var string */ |
||
| 29 | private $method; |
||
| 30 | /** @var array */ |
||
| 31 | private $formElements = []; |
||
| 32 | |||
| 33 | /** |
||
| 34 | * FormInterface constructor. |
||
| 35 | * |
||
| 36 | * @param string $name |
||
| 37 | * @param string $action |
||
| 38 | * @param string $method |
||
| 39 | */ |
||
| 40 | public function __construct(string $name, string $action, string $method = 'POST') |
||
| 46 | |||
| 47 | /** |
||
| 48 | * Gets form name. |
||
| 49 | * |
||
| 50 | * @return string |
||
| 51 | */ |
||
| 52 | public function getName() : string |
||
| 56 | |||
| 57 | /** |
||
| 58 | * Gets form action. |
||
| 59 | * |
||
| 60 | * @return string |
||
| 61 | */ |
||
| 62 | public function getAction() : string |
||
| 66 | |||
| 67 | /** |
||
| 68 | * Gets form method. |
||
| 69 | * |
||
| 70 | * @return string |
||
| 71 | */ |
||
| 72 | public function getMethod() : string |
||
| 76 | |||
| 77 | /** |
||
| 78 | * Adds an element to the form. |
||
| 79 | * |
||
| 80 | * @param FormElementInterface $formElement |
||
| 81 | * @return FormInterface |
||
| 82 | */ |
||
| 83 | public function addElement(FormElementInterface $formElement) : FormInterface |
||
| 93 | |||
| 94 | /** |
||
| 95 | * Returns all the elements assigned. |
||
| 96 | * |
||
| 97 | * @return array<FormElementInterface> |
||
| 98 | */ |
||
| 99 | public function getElements() : array |
||
| 103 | } |
||
| 104 |