Skip to content

Commit 5580f88

Browse files
committed
fix Trait
1 parent 7559a26 commit 5580f88

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "1.0.6",
2+
"version": "1.0.7",
33
"name": "efureev/support",
44
"description": "PHP Support Package",
55
"keywords": [

src/Traits/ConfigurableTrait.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,13 @@ trait ConfigurableTrait
1616
public function configurable(array $attributes, ?bool $exceptOnMiss = true)
1717
{
1818
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+
}
2125
}
22-
$this->{$key} = $value;
2326
}
2427

2528
return $this;

0 commit comments

Comments
 (0)