File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change 1
1
{
2
- "version" : " 1.0.6 " ,
2
+ "version" : " 1.0.7 " ,
3
3
"name" : " efureev/support" ,
4
4
"description" : " PHP Support Package" ,
5
5
"keywords" : [
Original file line number Diff line number Diff line change @@ -16,10 +16,13 @@ trait ConfigurableTrait
16
16
public function configurable (array $ attributes , ?bool $ exceptOnMiss = true )
17
17
{
18
18
foreach ($ attributes as $ key => $ value ) {
19
- if ($ exceptOnMiss && !property_exists ($ this , $ key )) {
20
- throw new InvalidParamException ("Property $ key is absent at class: " . get_class ($ this ));
19
+ if (property_exists ($ this , $ key )) {
20
+ $ this ->{$ key } = $ value ;
21
+ } else {
22
+ if ($ exceptOnMiss ) {
23
+ throw new InvalidParamException ("Property $ key is absent at class: " . get_class ($ this ));
24
+ }
21
25
}
22
- $ this ->{$ key } = $ value ;
23
26
}
24
27
25
28
return $ this ;
You can’t perform that action at this time.
0 commit comments