original_string: public function setAttribute(
              string $name, 
              $value = '', 
              bool $replaceIfExists = false, 
              $condition = true)
      {
          $name = trim(Text::toLower($name));
          if ($condition) {
              if (!preg_match('/^[a-z0-9_-]+$/', $name)) {
                  Checkers::notice('Attribute name [' . $name . '] syntax error.');
              } else if ($name === 'class') {
                  $this->addCssClass($value);
              } else if ($name === 'style') {
                  $this->appendStyle($value);
              } else if (!$replaceIfExists && array_key_exists($name, $this->attributes)) {
                  Checkers::notice('Attribute [' . $name . '] already exists.');
              } else {
                  $value = $value !== null ? (string) str_replace('"', '\"', (string) $value) : null;
                  $this->attributes[$name] = $value;
              }
          }
          return $this;
      }
code: public function setAttribute(
              string $name, 
              $value = '', 
              bool $replaceIfExists = false, 
              $condition = true)
      {
          $name = trim(Text::toLower($name));
          if ($condition) {
              if (!preg_match('/^[a-z0-9_-]+$/', $name)) {
                  Checkers::notice('Attribute name [' . $name . '] syntax error.');
              } else if ($name === 'class') {
                  $this->addCssClass($value);
              } else if ($name === 'style') {
                  $this->appendStyle($value);
              } else if (!$replaceIfExists && array_key_exists($name, $this->attributes)) {
                  Checkers::notice('Attribute [' . $name . '] already exists.');
              } else {
                  $value = $value !== null ? (string) str_replace('"', '\"', (string) $value) : null;
                  $this->attributes[$name] = $value;
              }
          }
          return $this;
      }
code_tokens: public function setAttribute ( string $ name , $ value = '' , bool $ replaceIfExists = false , $ condition = true ) { $ name = trim ( Text :: toLower ( $ name ) ) ; if ( $ condition ) { if ( ! preg_match ( '/^[a-z0-9_-]+$/' , $ name ) ) { Checkers :: notice ( 'Attribute name [' . $ name . '] syntax error.' ) ; } else if ( $ name === 'class' ) { $ this -> addCssClass ( $ value ) ; } else if ( $ name === 'style' ) { $ this -> appendStyle ( $ value ) ; } else if ( ! $ replaceIfExists && array_key_exists ( $ name , $ this -> attributes ) ) { Checkers :: notice ( 'Attribute [' . $ name . '] already exists.' ) ; } else { $ value = $ value !== null ? ( string ) str_replace ( '"' , '\"' , ( string ) $ value ) : null ; $ this -> attributes [ $ name ] = $ value ; } } return $ this ; }
docstring: Attributes. If value is null, the ="xx" part is not generated
  Attributes class is append. Other attributes are replaced or errors
  @param string $name
  @param type $value
  @param bool $replaceIfExists
  @param bool $condition perform operation if condition is true
  @return $this
docstring_tokens: Attributes . If value is null the = xx part is not generated Attributes class is append . Other attributes are replaced or errors