original_string: protected function _formatAttribute($key, $value, $escape = true)
      {
          if (is_array($value)) {
              $value = implode(' ', $value);
          }
          if (is_numeric($key)) {
              return "$value=\"$value\"";
          }
          $truthy = [1, '1', true, 'true', $key];
          $isMinimized = isset($this->_compactAttributes[$key]);
          if (!preg_match('/\A(\w|[.-])+\z/', $key)) {
              $key = h($key);
          }
          if ($isMinimized && in_array($value, $truthy, true)) {
              return "$key=\"$key\"";
          }
          if ($isMinimized) {
              return '';
          }
  
          return $key . '="' . ($escape ? h($value) : $value) . '"';
      }
code: protected function _formatAttribute($key, $value, $escape = true)
      {
          if (is_array($value)) {
              $value = implode(' ', $value);
          }
          if (is_numeric($key)) {
              return "$value=\"$value\"";
          }
          $truthy = [1, '1', true, 'true', $key];
          $isMinimized = isset($this->_compactAttributes[$key]);
          if (!preg_match('/\A(\w|[.-])+\z/', $key)) {
              $key = h($key);
          }
          if ($isMinimized && in_array($value, $truthy, true)) {
              return "$key=\"$key\"";
          }
          if ($isMinimized) {
              return '';
          }
  
          return $key . '="' . ($escape ? h($value) : $value) . '"';
      }
code_tokens: protected function _formatAttribute ( $ key , $ value , $ escape = true ) { if ( is_array ( $ value ) ) { $ value = implode ( ' ' , $ value ) ; } if ( is_numeric ( $ key ) ) { return "$value=\"$value\"" ; } $ truthy = [ 1 , '1' , true , 'true' , $ key ] ; $ isMinimized = isset ( $ this -> _compactAttributes [ $ key ] ) ; if ( ! preg_match ( '/\A(\w|[.-])+\z/' , $ key ) ) { $ key = h ( $ key ) ; } if ( $ isMinimized && in_array ( $ value , $ truthy , true ) ) { return "$key=\"$key\"" ; } if ( $ isMinimized ) { return '' ; } return $ key . '="' . ( $ escape ? h ( $ value ) : $ value ) . '"' ; }
docstring: Formats an individual attribute, and returns the string value of the composed attribute.
  Works with minimized attributes that have the same value as their name such as 'disabled' and 'checked'
  
  @param string $key The name of the attribute to create
  @param string|array $value The value of the attribute to create.
  @param bool $escape Define if the value must be escaped
  @return string The composed attribute.
docstring_tokens: Formats an individual attribute and returns the string value of the composed attribute . Works with minimized attributes that have the same value as their name such as disabled and checked