mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-08-11 01:14:01 +02:00
refactored State pattern example
This commit is contained in:
16
Behavioral/State/StateShipped.php
Normal file
16
Behavioral/State/StateShipped.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace DesignPatterns\Behavioral\State;
|
||||
|
||||
class StateShipped implements State
|
||||
{
|
||||
public function proceedToNext(OrderContext $context)
|
||||
{
|
||||
$context->setState(new StateDone());
|
||||
}
|
||||
|
||||
public function toString(): string
|
||||
{
|
||||
return 'shipped';
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user