function prev() { if ($this->can_prev()) { $zakaz = $this->zakaz; $stateName = Model::prevState(get_class($this)); $state = new $stateName(); $state->zakaz = $zakaz; return $state; } else { return $this; } }