This commit is contained in:
2020-09-02 15:38:04 +08:00
parent 0098e1bc6f
commit 0798a8c6f5
2 changed files with 6 additions and 3 deletions
+3 -3
View File
@@ -29,9 +29,9 @@ class BaseObject implements Configure
*/
public function __construct($config = [])
{
// if (!empty($config) && is_array($config)) {
// Snowflake::configure($this, $config);
// }
if (!empty($config) && is_array($config)) {
Snowflake::configure($this, $config);
}
$this->init();
}
+3
View File
@@ -152,6 +152,9 @@ class Snowflake
public static function configure($object, $config)
{
foreach ($config as $key => $value) {
if (!property_exists($object, $key)) {
continue;
}
$object->$key = $value;
}
return $object;