mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-08-01 12:40:11 +02:00
State pattern is maintainable
state pattern change readme.rst
This commit is contained in:
32
Behavioral/State/StateOrder.php
Normal file
32
Behavioral/State/StateOrder.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace DesignPatterns\Behavioral\State;
|
||||
|
||||
abstract class StateOrder
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
private $details;
|
||||
|
||||
/**
|
||||
* @var StateOrder $state
|
||||
*/
|
||||
protected static $state;
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
abstract protected function done();
|
||||
|
||||
protected function setStatus(string $status)
|
||||
{
|
||||
$this->details['status'] = $status;
|
||||
$this->details['updatedTime'] = time();
|
||||
}
|
||||
|
||||
protected function getStatus(): string
|
||||
{
|
||||
return $this->details['status'];
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user