mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-02-24 01:32:22 +01:00
20 lines
399 B
PHP
20 lines
399 B
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
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';
|
|
}
|
|
}
|