src/Support/Data/AbstractDataObject.php
protected function mergeAttribute(string $key, $mergeValue)
    {
        $current = $this[$key];

        if ($current instanceof DataObjectInterface && method_exists($current, 'merge')) {

            $class = get_class($current);

            if (is_array($mergeValue)) {
                $mergeValue = new $class($mergeValue);
            }

            // If we have nothing to merge with, don't bother
            if (null === $mergeValue) {
                return;
            }

            $mergeValue = $current->merge($mergeValue);
        }

        if (null === $mergeValue) {
            return;
        }

        $this[$key] = $mergeValue;
    }
protected function mergeAttribute(string $key, $mergeValue)
    {
        $current = $this[$key];

        if ($current instanceof DataObjectInterface && method_exists($current, 'merge')) {

            $class = get_class($current);

            if (is_array($mergeValue)) {
                $mergeValue = new $class($mergeValue);
            }

            // If we have nothing to merge with, don't bother
            if (null === $mergeValue) {
                return;
            }

            $mergeValue = $current->merge($mergeValue);
        }

        if (null === $mergeValue) {
            return;
        }

        $this[$key] = $mergeValue;
    }
protected function mergeAttribute ( string $ key , $ mergeValue ) { $ current = $ this [ $ key ] ; if ( $ current instanceof DataObjectInterface && method_exists ( $ current , 'merge' ) ) { $ class = get_class ( $ current ) ; if ( is_array ( $ mergeValue ) ) { $ mergeValue = new $ class ( $ mergeValue ) ; } // If we have nothing to merge with, don't bother if ( null === $ mergeValue ) { return ; } $ mergeValue = $ current -> merge ( $ mergeValue ) ; } if ( null === $ mergeValue ) { return ; } $ this [ $ key ] = $ mergeValue ; }
Merges a single attribute by key with a new given value.

@param string $key
@param mixed  $mergeValue
Merges a single attribute by key with a new given value .