Skip to content

Commit 5dbd791

Browse files
author
MartkCz
committed
final values are cached
1 parent 586de1d commit 5dbd791

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

src/Wizard.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ class Wizard extends Container implements IWizard {
3434
/** @var bool */
3535
private $isSuccess = FALSE;
3636

37+
/** @var mixed[] */
38+
private $finalValues = [];
39+
3740
/**
3841
* @param Session $session
3942
*/
@@ -70,6 +73,7 @@ protected function getSection(): SessionSection {
7073
}
7174

7275
private function resetSection(): void {
76+
$this->finalValues = $this->getValues(TRUE);
7377
$this->getSection()->remove();
7478
}
7579

@@ -85,11 +89,12 @@ public function getCurrentStep(): int {
8589
* @return array|ArrayHash
8690
*/
8791
public function getValues(bool $asArray = FALSE) {
88-
if ($asArray) {
89-
return (array) $this->getSection()[self::VALUES];
90-
} else {
91-
return ArrayHash::from((array) $this->getSection()[self::VALUES]);
92+
$values = $this->finalValues;
93+
if (!$values) {
94+
$values = (array) $this->getSection()[self::VALUES];
9295
}
96+
97+
return $asArray ? $values : ArrayHash::from($values);
9398
}
9499

95100
/**

0 commit comments

Comments
 (0)