src/Invoice/Creator.php
protected function addIfSetAndNotEmpty(array &$targetArray, $targetKey, $source, $sourceKey)
    {
        if (is_array($source)) {
            if (!empty($source[$sourceKey])) {
                $targetArray[$targetKey] = $source[$sourceKey];
                return true;
            }
        } else {
            if (!empty($source->$sourceKey)) {
                $targetArray[$targetKey] = $source->$sourceKey;
                return true;
            }
        }
        return false;
    }
protected function addIfSetAndNotEmpty(array &$targetArray, $targetKey, $source, $sourceKey)
    {
        if (is_array($source)) {
            if (!empty($source[$sourceKey])) {
                $targetArray[$targetKey] = $source[$sourceKey];
                return true;
            }
        } else {
            if (!empty($source->$sourceKey)) {
                $targetArray[$targetKey] = $source->$sourceKey;
                return true;
            }
        }
        return false;
    }
protected function addIfSetAndNotEmpty ( array & $ targetArray , $ targetKey , $ source , $ sourceKey ) { if ( is_array ( $ source ) ) { if ( ! empty ( $ source [ $ sourceKey ] ) ) { $ targetArray [ $ targetKey ] = $ source [ $ sourceKey ] ; return true ; } } else { if ( ! empty ( $ source -> $ sourceKey ) ) { $ targetArray [ $ targetKey ] = $ source -> $ sourceKey ; return true ; } } return false ; }
Helper method to add a value from an array or object only if it is set
and not empty.

@param array $targetArray
@param string $targetKey
@param array|object $source
@param string $sourceKey

@return bool
Whether the array value or object property is set and not empty and
thus has been added.
Helper method to add a value from an array or object only if it is set and not empty .