original_string: protected function _applyConfig($config)
      {
          if (is_string($config)) {
              $name = $config;
              $config = static::getConfig($name);
              if (empty($config)) {
                  throw new InvalidArgumentException(sprintf('Unknown email configuration "%s".', $name));
              }
              unset($name);
          }
  
          $this->_profile = array_merge($this->_profile, $config);
  
          $simpleMethods = [
              'from', 'sender', 'to', 'replyTo', 'readReceipt', 'returnPath',
              'cc', 'bcc', 'messageId', 'domain', 'subject', 'attachments',
              'transport', 'emailFormat', 'emailPattern', 'charset', 'headerCharset'
          ];
          foreach ($simpleMethods as $method) {
              if (isset($config[$method])) {
                  $this->{'set' . ucfirst($method)}($config[$method]);
              }
          }
  
          if (empty($this->headerCharset)) {
              $this->headerCharset = $this->charset;
          }
          if (isset($config['headers'])) {
              $this->setHeaders($config['headers']);
          }
  
          $viewBuilderMethods = [
              'template', 'layout', 'theme'
          ];
          foreach ($viewBuilderMethods as $method) {
              if (array_key_exists($method, $config)) {
                  $this->viewBuilder()->{'set' . ucfirst($method)}($config[$method]);
              }
          }
  
          if (array_key_exists('helpers', $config)) {
              $this->viewBuilder()->setHelpers($config['helpers'], false);
          }
          if (array_key_exists('viewRender', $config)) {
              $this->viewBuilder()->setClassName($config['viewRender']);
          }
          if (array_key_exists('viewVars', $config)) {
              $this->set($config['viewVars']);
          }
      }
code: protected function _applyConfig($config)
      {
          if (is_string($config)) {
              $name = $config;
              $config = static::getConfig($name);
              if (empty($config)) {
                  throw new InvalidArgumentException(sprintf('Unknown email configuration "%s".', $name));
              }
              unset($name);
          }
  
          $this->_profile = array_merge($this->_profile, $config);
  
          $simpleMethods = [
              'from', 'sender', 'to', 'replyTo', 'readReceipt', 'returnPath',
              'cc', 'bcc', 'messageId', 'domain', 'subject', 'attachments',
              'transport', 'emailFormat', 'emailPattern', 'charset', 'headerCharset'
          ];
          foreach ($simpleMethods as $method) {
              if (isset($config[$method])) {
                  $this->{'set' . ucfirst($method)}($config[$method]);
              }
          }
  
          if (empty($this->headerCharset)) {
              $this->headerCharset = $this->charset;
          }
          if (isset($config['headers'])) {
              $this->setHeaders($config['headers']);
          }
  
          $viewBuilderMethods = [
              'template', 'layout', 'theme'
          ];
          foreach ($viewBuilderMethods as $method) {
              if (array_key_exists($method, $config)) {
                  $this->viewBuilder()->{'set' . ucfirst($method)}($config[$method]);
              }
          }
  
          if (array_key_exists('helpers', $config)) {
              $this->viewBuilder()->setHelpers($config['helpers'], false);
          }
          if (array_key_exists('viewRender', $config)) {
              $this->viewBuilder()->setClassName($config['viewRender']);
          }
          if (array_key_exists('viewVars', $config)) {
              $this->set($config['viewVars']);
          }
      }
code_tokens: protected function _applyConfig ( $ config ) { if ( is_string ( $ config ) ) { $ name = $ config ; $ config = static :: getConfig ( $ name ) ; if ( empty ( $ config ) ) { throw new InvalidArgumentException ( sprintf ( 'Unknown email configuration "%s".' , $ name ) ) ; } unset ( $ name ) ; } $ this -> _profile = array_merge ( $ this -> _profile , $ config ) ; $ simpleMethods = [ 'from' , 'sender' , 'to' , 'replyTo' , 'readReceipt' , 'returnPath' , 'cc' , 'bcc' , 'messageId' , 'domain' , 'subject' , 'attachments' , 'transport' , 'emailFormat' , 'emailPattern' , 'charset' , 'headerCharset' ] ; foreach ( $ simpleMethods as $ method ) { if ( isset ( $ config [ $ method ] ) ) { $ this -> { 'set' . ucfirst ( $ method ) } ( $ config [ $ method ] ) ; } } if ( empty ( $ this -> headerCharset ) ) { $ this -> headerCharset = $ this -> charset ; } if ( isset ( $ config [ 'headers' ] ) ) { $ this -> setHeaders ( $ config [ 'headers' ] ) ; } $ viewBuilderMethods = [ 'template' , 'layout' , 'theme' ] ; foreach ( $ viewBuilderMethods as $ method ) { if ( array_key_exists ( $ method , $ config ) ) { $ this -> viewBuilder ( ) -> { 'set' . ucfirst ( $ method ) } ( $ config [ $ method ] ) ; } } if ( array_key_exists ( 'helpers' , $ config ) ) { $ this -> viewBuilder ( ) -> setHelpers ( $ config [ 'helpers' ] , false ) ; } if ( array_key_exists ( 'viewRender' , $ config ) ) { $ this -> viewBuilder ( ) -> setClassName ( $ config [ 'viewRender' ] ) ; } if ( array_key_exists ( 'viewVars' , $ config ) ) { $ this -> set ( $ config [ 'viewVars' ] ) ; } }
docstring: Apply the config to an instance
  
  @param string|array $config Configuration options.
  @return void
  @throws \InvalidArgumentException When using a configuration that doesn't exist.
docstring_tokens: Apply the config to an instance