@@ -38,11 +38,6 @@ class LazyChoiceList implements ChoiceListInterface
38
38
*/
39
39
private $ value ;
40
40
41
- /**
42
- * @var ChoiceListInterface|null
43
- */
44
- private $ loadedList ;
45
-
46
41
/**
47
42
* Creates a lazily-loaded list using the given loader.
48
43
*
@@ -63,58 +58,38 @@ public function __construct(ChoiceLoaderInterface $loader, callable $value = nul
63
58
*/
64
59
public function getChoices ()
65
60
{
66
- if ($ this ->loadedList ) {
67
- return $ this ->loadedList ->getChoices ();
68
- }
69
-
70
- return ($ this ->loadedList = $ this ->loader ->loadChoiceList ($ this ->value ))->getChoices ();
61
+ return $ this ->loader ->loadChoiceList ($ this ->value )->getChoices ();
71
62
}
72
63
73
64
/**
74
65
* {@inheritdoc}
75
66
*/
76
67
public function getValues ()
77
68
{
78
- if ($ this ->loadedList ) {
79
- return $ this ->loadedList ->getValues ();
80
- }
81
-
82
- return ($ this ->loadedList = $ this ->loader ->loadChoiceList ($ this ->value ))->getValues ();
69
+ return $ this ->loader ->loadChoiceList ($ this ->value )->getValues ();
83
70
}
84
71
85
72
/**
86
73
* {@inheritdoc}
87
74
*/
88
75
public function getStructuredValues ()
89
76
{
90
- if ($ this ->loadedList ) {
91
- return $ this ->loadedList ->getStructuredValues ();
92
- }
93
-
94
- return ($ this ->loadedList = $ this ->loader ->loadChoiceList ($ this ->value ))->getStructuredValues ();
77
+ return $ this ->loader ->loadChoiceList ($ this ->value )->getStructuredValues ();
95
78
}
96
79
97
80
/**
98
81
* {@inheritdoc}
99
82
*/
100
83
public function getOriginalKeys ()
101
84
{
102
- if ($ this ->loadedList ) {
103
- return $ this ->loadedList ->getOriginalKeys ();
104
- }
105
-
106
- return ($ this ->loadedList = $ this ->loader ->loadChoiceList ($ this ->value ))->getOriginalKeys ();
85
+ return $ this ->loader ->loadChoiceList ($ this ->value )->getOriginalKeys ();
107
86
}
108
87
109
88
/**
110
89
* {@inheritdoc}
111
90
*/
112
91
public function getChoicesForValues (array $ values )
113
92
{
114
- if ($ this ->loadedList ) {
115
- return $ this ->loadedList ->getChoicesForValues ($ values );
116
- }
117
-
118
93
return $ this ->loader ->loadChoicesForValues ($ values , $ this ->value );
119
94
}
120
95
@@ -123,10 +98,6 @@ public function getChoicesForValues(array $values)
123
98
*/
124
99
public function getValuesForChoices (array $ choices )
125
100
{
126
- if ($ this ->loadedList ) {
127
- return $ this ->loadedList ->getValuesForChoices ($ choices );
128
- }
129
-
130
101
return $ this ->loader ->loadValuesForChoices ($ choices , $ this ->value );
131
102
}
132
103
}
0 commit comments