Automattic\WooCommerce\Vendor\GraphQL\Utils

Utils::assign │ public static │ WC 1.0

Method of the class: Utils{}

No Hooks.

Returns

null. Nothing (null).

Usage

$result = Utils::assign( $obj, $vars ): object;
$obj(object) (required)
.
$vars(array<string, mixed>) (required)
.

Utils::assign() code WC 11.1.2

public static function assign(object $obj, array $vars): object
{
    foreach ($vars as $key => $value) {
        if (! property_exists($obj, $key)) {
            $cls = get_class($obj);
            Warning::warn(
                "Trying to set non-existing property '{$key}' on class '{$cls}'",
                Warning::WARNING_ASSIGN
            );
        }

        $obj->{$key} = $value;
    }

    return $obj;
}