original_string: public function setAttribute( $attr, $value ) {
          //data-* attribute or in valid attribute array
          if( strpos( $attr, 'data-' ) === 0 || in_array( $attr, $this->validAttributes ) ) {
              $this->attrs[$attr] = $value;
          } else {
              throw new Exception\InvalidAttributeException( $attr );
          }
      }
code: public function setAttribute( $attr, $value ) {
          //data-* attribute or in valid attribute array
          if( strpos( $attr, 'data-' ) === 0 || in_array( $attr, $this->validAttributes ) ) {
              $this->attrs[$attr] = $value;
          } else {
              throw new Exception\InvalidAttributeException( $attr );
          }
      }
code_tokens: public function setAttribute ( $ attr , $ value ) { //data-* attribute or in valid attribute array
   if ( strpos ( $ attr , 'data-' ) === 0 || in_array ( $ attr , $ this -> validAttributes ) ) { $ this -> attrs [ $ attr ] = $ value ; } else { throw new Exception \ InvalidAttributeException ( $ attr ) ; } }
docstring: Sets an attribute given the name and value.
  
  @param $attr the name of the attribute
  @param $value the value of the attribute
  
  @throws Exception\InvalidAttributeException if an invalid attribute is provided
docstring_tokens: Sets an attribute given the name and value .