original_string: public function setRelationship($value, $key = '')
  	{
  		if (is_array($value)) {
  
  			$class = __NAMESPACE__ . '\\' . str_singular($key);
  
  			if (class_exists($class)) {
  
  				// Check to see if the key value is plural or singular
  				// if it is plural then we create a collection
  				// otherwise we instantiate the class and add a single item to the relationship
  				if (str_singular($key) == $key) {
  					$this->addRelationship(new $class($value));
  				}
  				else {
  					$collection = $class::newCollection($value);
  					$this->addRelationship($collection);
  				}
  			}
  		}
  		elseif ($value instanceof Collection) {
  			$this->addRelationship($value);
  		}
  		elseif ($value instanceof BaseModel) {
  			$this->addRelationship($value);
  		}
  	}
code: public function setRelationship($value, $key = '')
  	{
  		if (is_array($value)) {
  
  			$class = __NAMESPACE__ . '\\' . str_singular($key);
  
  			if (class_exists($class)) {
  
  				// Check to see if the key value is plural or singular
  				// if it is plural then we create a collection
  				// otherwise we instantiate the class and add a single item to the relationship
  				if (str_singular($key) == $key) {
  					$this->addRelationship(new $class($value));
  				}
  				else {
  					$collection = $class::newCollection($value);
  					$this->addRelationship($collection);
  				}
  			}
  		}
  		elseif ($value instanceof Collection) {
  			$this->addRelationship($value);
  		}
  		elseif ($value instanceof BaseModel) {
  			$this->addRelationship($value);
  		}
  	}
code_tokens: public function setRelationship ( $ value , $ key = '' ) { if ( is_array ( $ value ) ) { $ class = __NAMESPACE__ . '\\' . str_singular ( $ key ) ; if ( class_exists ( $ class ) ) { // Check to see if the key value is plural or singular // if it is plural then we create a collection // otherwise we instantiate the class and add a single item to the relationship if ( str_singular ( $ key ) == $ key ) { $ this -> addRelationship ( new $ class ( $ value ) ) ; } else { $ collection = $ class :: newCollection ( $ value ) ; $ this -> addRelationship ( $ collection ) ; } } } elseif ( $ value instanceof Collection ) { $ this -> addRelationship ( $ value ) ; } elseif ( $ value instanceof BaseModel ) { $ this -> addRelationship ( $ value ) ; } }
docstring: Sets the relationships on this model,
  which in fact are collections of other models
  
  @param string $key
  @param array $value
docstring_tokens: Sets the relationships on this model which in fact are collections of other models