Skip to content

Commit 84642f7

Browse files
committed
up: add new help method to base obj
1 parent cb539ba commit 84642f7

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/Obj/AbstractObj.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Toolkit\Stdlib\Obj;
66
use Toolkit\Stdlib\Obj\Traits\QuickInitTrait;
7+
use function get_object_vars;
78

89
/**
910
* Class AbstractObj
@@ -23,4 +24,12 @@ public function __construct(array $config = [])
2324
{
2425
Obj::init($this, $config);
2526
}
27+
28+
/**
29+
* @return array
30+
*/
31+
public function toArray(): array
32+
{
33+
return get_object_vars($this);
34+
}
2635
}

0 commit comments

Comments
 (0)