code: public function setAttribute($strName, $strValue)
      {
          if (!isset($this->attributes()->$strName)) {
              $this->addAttribute($strName, $strValue);
              return $strName;
          } else {
              $this->attributes()->$strName = $strValue;
              return $this->attributes()->$strName;
          }
      }
docs: Set (or create) Attribute
  
  @param string $strName
  @param string $strValue
  @return string