refactored Decorator pattern

This commit is contained in:
Dominik Liebler
2018-06-22 10:06:50 +02:00
parent 50cb2ea8d0
commit 4c0fbf4a7c
12 changed files with 107 additions and 103 deletions

View File

@@ -0,0 +1,18 @@
<?php
namespace DesignPatterns\Structural\Decorator;
class ExtraBed extends BookingDecorator
{
private const PRICE = 30;
public function calculatePrice(): int
{
return $this->booking->calculatePrice() + self::PRICE;
}
public function getDescription(): string
{
return $this->booking->getDescription() . ' with extra bed';
}
}