tch to pause", 1);
}
public function resume($context){
throw new Exception("The state is no service ,can not switch to resume", 1);
}
public function over($context){
$context->agreement->overDate = date();
$context->state = new AgreementOverState();
}
}
class AgreementServiceState extends AgreementState {
public function start($context){
throw new Exception("...", 1);
}
public function pause($context){
if($context->agreement->begin_time >= time() && $context->agreement->begin_time<=time()){
$context->agreement->stopDate = date();
$context->state = new AgreementPauseState();
}
}
public function resume($context){
throw new Exception("...", 1);
}
public function over($context){
$context->agreement->overDate = date();
$context->state = new AgreementOverState();
}
}
class AgreementPauseState extends AgreementState {
....
public function resume($context){
$context->agreement->resumeDate = date();
$context->state = new AgreementServiceState();
}
public function over($context){
$context->agreement->overDate = date();
$context->state = new AgreementOverState();
}
....
}
class AgreementOverState extends AgreementState {
...
}
|