original_string: public static function newWithType($locale, $type)
      {
          $nodeSource = new static();
  
          $sourceModel = $nodeSource->getNewSourceModel($type);
  
          // We temporarily cache the model since Eloquent does not
          // have a way to attach hasOne relations without saving them.
          // So we are providing a customized way to emulate that.
          // We will always access the source model through getSource() method.
          $nodeSource->setTemporarySource($sourceModel);
  
          // We first fill special attributes.
          // These have to be done after we have added the temporary source
          // since the setAttribute will look at the temporary source as well.
          $nodeSource->setAttribute('locale', $locale);
          $nodeSource->setAttribute('source_type', $type);
  
          return $nodeSource;
      }
code: public static function newWithType($locale, $type)
      {
          $nodeSource = new static();
  
          $sourceModel = $nodeSource->getNewSourceModel($type);
  
          // We temporarily cache the model since Eloquent does not
          // have a way to attach hasOne relations without saving them.
          // So we are providing a customized way to emulate that.
          // We will always access the source model through getSource() method.
          $nodeSource->setTemporarySource($sourceModel);
  
          // We first fill special attributes.
          // These have to be done after we have added the temporary source
          // since the setAttribute will look at the temporary source as well.
          $nodeSource->setAttribute('locale', $locale);
          $nodeSource->setAttribute('source_type', $type);
  
          return $nodeSource;
      }
code_tokens: public static function newWithType ( $ locale , $ type ) { $ nodeSource = new static ( ) ; $ sourceModel = $ nodeSource -> getNewSourceModel ( $ type ) ; // We temporarily cache the model since Eloquent does not // have a way to attach hasOne relations without saving them. // So we are providing a customized way to emulate that. // We will always access the source model through getSource() method. $ nodeSource -> setTemporarySource ( $ sourceModel ) ; // We first fill special attributes. // These have to be done after we have added the temporary source // since the setAttribute will look at the temporary source as well. $ nodeSource -> setAttribute ( 'locale' , $ locale ) ; $ nodeSource -> setAttribute ( 'source_type' , $ type ) ; return $ nodeSource ; }
docstring: Create new node source with locale and type
  
  @param string $locale
  @param string $type
  @return NodeSource
docstring_tokens: Create new node source with locale and type