| @@ 10-56 (lines=47) @@ | ||
| 7 | * Class IronChair |
|
| 8 | * @package codenixsv\Patterns\Creational\AbstractFactory |
|
| 9 | */ |
|
| 10 | class IronChair implements ChairInterface |
|
| 11 | { |
|
| 12 | /** |
|
| 13 | * @var string |
|
| 14 | */ |
|
| 15 | private $color; |
|
| 16 | ||
| 17 | /** |
|
| 18 | * @var bool |
|
| 19 | */ |
|
| 20 | private $hasLegs; |
|
| 21 | ||
| 22 | /** |
|
| 23 | * WoodenChair constructor. |
|
| 24 | * @param string $color |
|
| 25 | * @param bool $hasLegs |
|
| 26 | */ |
|
| 27 | public function __construct(string $color, bool $hasLegs) |
|
| 28 | { |
|
| 29 | $this->color = $color; |
|
| 30 | $this->hasLegs = $hasLegs; |
|
| 31 | } |
|
| 32 | ||
| 33 | /** |
|
| 34 | * @return string |
|
| 35 | */ |
|
| 36 | public function getColor(): string |
|
| 37 | { |
|
| 38 | return $this->color; |
|
| 39 | } |
|
| 40 | ||
| 41 | /** |
|
| 42 | * @return bool |
|
| 43 | */ |
|
| 44 | public function hasLegs(): bool |
|
| 45 | { |
|
| 46 | return $this->hasLegs; |
|
| 47 | } |
|
| 48 | ||
| 49 | /** |
|
| 50 | * @return string |
|
| 51 | */ |
|
| 52 | public function getMaterial(): string |
|
| 53 | { |
|
| 54 | return 'iron'; |
|
| 55 | } |
|
| 56 | } |
|
| 57 | ||
| @@ 10-56 (lines=47) @@ | ||
| 7 | * Class WoodenChair |
|
| 8 | * @package codenixsv\Patterns\Creational\AbstractFactory |
|
| 9 | */ |
|
| 10 | class WoodenChair implements ChairInterface |
|
| 11 | { |
|
| 12 | /** |
|
| 13 | * @var string |
|
| 14 | */ |
|
| 15 | private $color; |
|
| 16 | ||
| 17 | /** |
|
| 18 | * @var bool |
|
| 19 | */ |
|
| 20 | private $hasLegs; |
|
| 21 | ||
| 22 | /** |
|
| 23 | * WoodenChair constructor. |
|
| 24 | * @param string $color |
|
| 25 | * @param bool $hasLegs |
|
| 26 | */ |
|
| 27 | public function __construct(string $color, bool $hasLegs) |
|
| 28 | { |
|
| 29 | $this->color = $color; |
|
| 30 | $this->hasLegs = $hasLegs; |
|
| 31 | } |
|
| 32 | ||
| 33 | /** |
|
| 34 | * @return string |
|
| 35 | */ |
|
| 36 | public function getColor(): string |
|
| 37 | { |
|
| 38 | return $this->color; |
|
| 39 | } |
|
| 40 | ||
| 41 | /** |
|
| 42 | * @return bool |
|
| 43 | */ |
|
| 44 | public function hasLegs(): bool |
|
| 45 | { |
|
| 46 | return $this->hasLegs; |
|
| 47 | } |
|
| 48 | ||
| 49 | /** |
|
| 50 | * @return string |
|
| 51 | */ |
|
| 52 | public function getMaterial(): string |
|
| 53 | { |
|
| 54 | return 'wood'; |
|
| 55 | } |
|
| 56 | } |
|
| 57 | ||