original_string: public function assignAttribute($name, $value)
  	{
  		$table = static::table();
  		if (!is_object($value)) {
  			if (array_key_exists($name, $table->columns)) {
  				$value = $table->columns[$name]->cast($value, static::connection());
  			} else {
  				$col = $table->getColumnByInflectedName($name);
  				if (!is_null($col)){
  					$value = $col->cast($value, static::connection());
  				}
  			}
  		}
  
  		// convert php's \DateTime to ours
  		if ($value instanceof \DateTime) {
  			$value = new DateTime($value->format('Y-m-d H:i:s T'));
  		}
  
  		// make sure DateTime values know what model they belong to so
  		// dirty stuff works when calling set methods on the DateTime object
  		if ($value instanceof DateTime) {
  			$value->attributeOf($this, $name);
  		}
  
  		$this->_attributes[$name] = $value;
  		$this->flagDirty($name);
  		return $value;
  	}
code: public function assignAttribute($name, $value)
  	{
  		$table = static::table();
  		if (!is_object($value)) {
  			if (array_key_exists($name, $table->columns)) {
  				$value = $table->columns[$name]->cast($value, static::connection());
  			} else {
  				$col = $table->getColumnByInflectedName($name);
  				if (!is_null($col)){
  					$value = $col->cast($value, static::connection());
  				}
  			}
  		}
  
  		// convert php's \DateTime to ours
  		if ($value instanceof \DateTime) {
  			$value = new DateTime($value->format('Y-m-d H:i:s T'));
  		}
  
  		// make sure DateTime values know what model they belong to so
  		// dirty stuff works when calling set methods on the DateTime object
  		if ($value instanceof DateTime) {
  			$value->attributeOf($this, $name);
  		}
  
  		$this->_attributes[$name] = $value;
  		$this->flagDirty($name);
  		return $value;
  	}
code_tokens: public function assignAttribute ( $ name , $ value ) { $ table = static :: table ( ) ; if ( ! is_object ( $ value ) ) { if ( array_key_exists ( $ name , $ table -> columns ) ) { $ value = $ table -> columns [ $ name ] -> cast ( $ value , static :: connection ( ) ) ; } else { $ col = $ table -> getColumnByInflectedName ( $ name ) ; if ( ! is_null ( $ col ) ) { $ value = $ col -> cast ( $ value , static :: connection ( ) ) ; } } } // convert php's \DateTime to ours if ( $ value instanceof \ DateTime ) { $ value = new DateTime ( $ value -> format ( 'Y-m-d H:i:s T' ) ) ; } // make sure DateTime values know what model they belong to so // dirty stuff works when calling set methods on the DateTime object if ( $ value instanceof DateTime ) { $ value -> attributeOf ( $ this , $ name ) ; } $ this -> _attributes [ $ name ] = $ value ; $ this -> flagDirty ( $ name ) ; return $ value ; }
docstring: Assign a value to an attribute.
  
  @param string $name Name of the attribute
  @param mixed &$value Value of the attribute
  @return mixed the attribute value
docstring_tokens: Assign a value to an attribute .