mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-06-10 16:04:57 +02:00
All public methods of abstract classes should be final. Enforce API encapsulation in an inheritance architecture. If you want to override a method, use the Template method pattern.
24 lines
403 B
PHP
24 lines
403 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace DesignPatterns\Creational\Prototype;
|
|
|
|
abstract class BookPrototype
|
|
{
|
|
protected string $title;
|
|
protected string $category;
|
|
|
|
abstract public function __clone();
|
|
|
|
final public function getTitle(): string
|
|
{
|
|
return $this->title;
|
|
}
|
|
|
|
final public function setTitle(string $title): void
|
|
{
|
|
$this->title = $title;
|
|
}
|
|
}
|