src/Utils/Utils.php
public static function assign($obj, array $vars, array $requiredKeys = [])
    {
        foreach ($requiredKeys as $key) {
            if (! isset($vars[$key])) {
                throw new InvalidArgumentException(sprintf('Key %s is expected to be set and not to be null', $key));
            }
        }

        foreach ($vars as $key => $value) {
            if (! property_exists($obj, $key)) {
                $cls = get_class($obj);
                Warning::warn(
                    sprintf("Trying to set non-existing property '%s' on class '%s'", $key, $cls),
                    Warning::WARNING_ASSIGN
                );
            }
            $obj->{$key} = $value;
        }

        return $obj;
    }
public static function assign($obj, array $vars, array $requiredKeys = [])
    {
        foreach ($requiredKeys as $key) {
            if (! isset($vars[$key])) {
                throw new InvalidArgumentException(sprintf('Key %s is expected to be set and not to be null', $key));
            }
        }

        foreach ($vars as $key => $value) {
            if (! property_exists($obj, $key)) {
                $cls = get_class($obj);
                Warning::warn(
                    sprintf("Trying to set non-existing property '%s' on class '%s'", $key, $cls),
                    Warning::WARNING_ASSIGN
                );
            }
            $obj->{$key} = $value;
        }

        return $obj;
    }
@param object   $obj
@param mixed[]  $vars
@param string[] $requiredKeys

@return object