public function configureDefaults(array $defaults, $force = false)
    {
        if ($force || empty($this->toArray())) {
            $attachmentDefaults = $this->attachmentDefaults;

            foreach (MessageDefaults::allKeys() as $key) {
                if (isset($defaults[$key]) && ! is_null($value = $defaults[$key])) {
                    if (strpos($key, 'attachment_') !== false) {
                        if ($key = substr($key, strlen('attachment_'))) {
                            $attachmentDefaults[$key] = $value;
                        }
                    } else {
                        $this->fillDefaults($key, $value);
                    }
                }
            }

            $this->setAttachmentDefaults($attachmentDefaults);
        }

        return $this;
    }
public function configureDefaults(array $defaults, $force = false)
    {
        if ($force || empty($this->toArray())) {
            $attachmentDefaults = $this->attachmentDefaults;

            foreach (MessageDefaults::allKeys() as $key) {
                if (isset($defaults[$key]) && ! is_null($value = $defaults[$key])) {
                    if (strpos($key, 'attachment_') !== false) {
                        if ($key = substr($key, strlen('attachment_'))) {
                            $attachmentDefaults[$key] = $value;
                        }
                    } else {
                        $this->fillDefaults($key, $value);
                    }
                }
            }

            $this->setAttachmentDefaults($attachmentDefaults);
        }

        return $this;
    }
public function configureDefaults ( array $ defaults , $ force = false ) { if ( $ force || empty ( $ this -> toArray ( ) ) ) { $ attachmentDefaults = $ this -> attachmentDefaults ; foreach ( MessageDefaults :: allKeys ( ) as $ key ) { if ( isset ( $ defaults [ $ key ] ) && ! is_null ( $ value = $ defaults [ $ key ] ) ) { if ( strpos ( $ key , 'attachment_' ) !== false ) { if ( $ key = substr ( $ key , strlen ( 'attachment_' ) ) ) { $ attachmentDefaults [ $ key ] = $ value ; } } else { $ this -> fillDefaults ( $ key , $ value ) ; } } } $ this -> setAttachmentDefaults ( $ attachmentDefaults ) ; } return $ this ; }
Configure message defaults.

@param  array  $defaults
@param  bool  $force
@return $this
Configure message defaults .