mirror of
https://github.com/DesignPatternsPHP/DesignPatternsPHP.git
synced 2025-10-02 01:07:02 +02:00
refactored State pattern example
This commit is contained in:
@@ -1,32 +0,0 @@
|
||||
<?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