@@ -138,31 +138,35 @@ public function setInstance($instance) {
138138 $ this ->properties =$ this ->getDefaultProperties ();
139139 }else {
140140 foreach ($ this ->visibleProperties as $ property ){
141- if (\is_callable ($ property )){
142- $ this ->properties []=$ property ;
143- }elseif (\is_string ($ property )){
144- try {
145- $ this ->_beforeAddProperty (\sizeof ($ this ->properties ), $ property );
146- $ rProperty =$ this ->reflect ->getProperty ($ property );
147- $ this ->properties []=$ rProperty ;
148- }catch (\Exception $ e ){
149- $ this ->_beforeAddProperty (\sizeof ($ this ->properties ), $ property );
150- $ this ->properties []=$ property ;
151- }
152- }elseif (\is_int ($ property )){
153- $ props =$ this ->getDefaultProperties ();
154- if (isset ($ props [$ property ]))
155- $ this ->properties []=$ props [$ property ];
156- else
157- $ this ->properties []=$ property ;
158- }else {
159- $ this ->properties []=$ property ;
160- }
141+ $ this ->setInstanceProperty ($ property );
161142 }
162143 }
163144 return $ this ;
164145 }
165146
147+ private function setInstanceProperty ($ property ){
148+ if (\is_callable ($ property )){
149+ $ this ->properties []=$ property ;
150+ }elseif (\is_string ($ property )){
151+ try {
152+ $ this ->_beforeAddProperty (\sizeof ($ this ->properties ), $ property );
153+ $ rProperty =$ this ->reflect ->getProperty ($ property );
154+ $ this ->properties []=$ rProperty ;
155+ }catch (\Exception $ e ){
156+ $ this ->_beforeAddProperty (\sizeof ($ this ->properties ), $ property );
157+ $ this ->properties []=$ property ;
158+ }
159+ }elseif (\is_int ($ property )){
160+ $ props =$ this ->getDefaultProperties ();
161+ if (isset ($ props [$ property ]))
162+ $ this ->properties []=$ props [$ property ];
163+ else
164+ $ this ->properties []=$ property ;
165+ }else {
166+ $ this ->properties []=$ property ;
167+ }
168+ }
169+
166170 protected function getDefaultProperties (){
167171 $ result =[];
168172 $ properties =$ this ->reflect ->getProperties ();
0 commit comments