mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-08-06 23:16:33 +02:00
fix: classes renaming to correspond to UML diagram
This commit is contained in:
33
Behavioral/State/ContextOrder.php
Normal file
33
Behavioral/State/ContextOrder.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace DesignPatterns\Behavioral\State;
|
||||
|
||||
class ContextOrder
|
||||
{
|
||||
private StateOrder $state;
|
||||
|
||||
public static function create(): ContextOrder
|
||||
{
|
||||
$order = new self();
|
||||
$order->state = new CreateOrder();
|
||||
|
||||
return $order;
|
||||
}
|
||||
|
||||
public function setState(StateOrder $state)
|
||||
{
|
||||
$this->state = $state;
|
||||
}
|
||||
|
||||
public function proceedToNext()
|
||||
{
|
||||
$this->state->proceedToNext($this);
|
||||
}
|
||||
|
||||
public function toString()
|
||||
{
|
||||
return $this->state->toString();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user