public function setLayout($layout = null)
    {
        if (null !== $layout && !is_string($layout) && !($layout instanceof ViewModel)) {
            throw new InvalidArgumentException(
                'Invalid value supplied for setLayout.'.
                'Expected null, string, or Zend\View\Model\ViewModel.'
            );
        }

        if (null === $layout && empty($this->config['message']['layout'])) {
            return;
        }

        if (null === $layout) {
            $layout = (string) $this->config['message']['layout'];

            unset($this->config['message']['layout']);
        }

        if (is_string($layout)) {

            $template   = $layout;
            $layout     = new ViewModel;

            $layout->setTemplate($template);
        }

        $this->layout = $layout;
    }
public function setLayout($layout = null)
    {
        if (null !== $layout && !is_string($layout) && !($layout instanceof ViewModel)) {
            throw new InvalidArgumentException(
                'Invalid value supplied for setLayout.'.
                'Expected null, string, or Zend\View\Model\ViewModel.'
            );
        }

        if (null === $layout && empty($this->config['message']['layout'])) {
            return;
        }

        if (null === $layout) {
            $layout = (string) $this->config['message']['layout'];

            unset($this->config['message']['layout']);
        }

        if (is_string($layout)) {

            $template   = $layout;
            $layout     = new ViewModel;

            $layout->setTemplate($template);
        }

        $this->layout = $layout;
    }
public function setLayout ( $ layout = null ) { if ( null !== $ layout && ! is_string ( $ layout ) && ! ( $ layout instanceof ViewModel ) ) { throw new InvalidArgumentException ( 'Invalid value supplied for setLayout.' . 'Expected null, string, or Zend\View\Model\ViewModel.' ) ; } if ( null === $ layout && empty ( $ this -> config [ 'message' ] [ 'layout' ] ) ) { return ; } if ( null === $ layout ) { $ layout = ( string ) $ this -> config [ 'message' ] [ 'layout' ] ; unset ( $ this -> config [ 'message' ] [ 'layout' ] ) ; } if ( is_string ( $ layout ) ) { $ template = $ layout ; $ layout = new ViewModel ; $ layout -> setTemplate ( $ template ) ; } $ this -> layout = $ layout ; }
Set the layout.

@param   mixed   $layout Either null (looks in config), ViewModel, or string.

@throws  \SxMail\Exception\InvalidArgumentException
Set the layout .