-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathBootstrapTextInput.php
More file actions
48 lines (42 loc) · 977 Bytes
/
Copy pathBootstrapTextInput.php
File metadata and controls
48 lines (42 loc) · 977 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
namespace DesignPatterns\Creational\AbstractFactory\Bootstrap;
use DesignPatterns\Creational\AbstractFactory\TextInputInterface;
/**
* Concrete page that is created by @see BootstrapHTMLFactory::createTextInput()
*
* It corresponds to `ProductB2` in the Abstract Factory pattern.
*
* @author Vlad Riabchenko <contact@vria.eu>
*/
class BootstrapTextInput implements TextInputInterface
{
/**
* @var string
*/
private $name;
/**
* @var string
*/
private $label;
/**
* @param string $name
* @param string $label
*/
public function __construct($name, $label)
{
$this->name = $name;
$this->label = $label;
}
/**
* @inheritdoc
*/
public function render()
{
echo <<<EOT
<div class="form-group">
<label for="{$this->name}">{$this->label}</label>
<input type="text" class="form-control" id="{$this->name}" name="{$this->name}">
</div>
EOT;
}
}