<commit_before><?hh
/*
 *  Copyright (c) 2015, Facebook, Inc.
 *  All rights reserved.
 *
 *  This source code is licensed under the BSD-style license found in the
 *  LICENSE file in the root directory of this source tree. An additional grant
 *  of patent rights can be found in the PATENTS file in the same directory.
 *
 */

/*
 * Use of this trait assumes you have inherited attributes from an HTML element.
 * For the bare minimum, use:
 *
 * attribute :xhp:html-element;
 */
trait XHPHelpers {

  require extends :x:composable-element;

  /*
   * Appends a string to the "class" attribute (space separated).
   */
  public function addClass(string $class): this {
    try {
      $current_class = /* UNSAFE_EXPR */ $this->:class;
      return $this->setAttribute('class', trim($current_class.' '.$class));
    } catch (XHPInvalidAttributeException $error) {
      throw new XHPException(<commit_msg>add marker interface for XHPHelpers trait<commit_after><?hh
/*
 *  Copyright (c) 2015, Facebook, Inc.
 *  All rights reserved.
 *
 *  This source code is licensed under the BSD-style license found in the
 *  LICENSE file in the root directory of this source tree. An additional grant
 *  of patent rights can be found in the PATENTS file in the same directory.
 *
 */

interface HasXHPHelpers {
  require extends :x:composable-element;
};

/*
 * Use of this trait assumes you have inherited attributes from an HTML element.
 * For the bare minimum, use:
 *
 * attribute :xhp:html-element;
 */
trait XHPHelpers implements HasXHPHelpers {

  require extends :x:composable-element;

  /*
   * Appends a string to the "class" attribute (space separated).
   */
  public function addClass(string $class): this {
    try {
      $current_class = /* UNSAFE_EXPR */ $this->:class;
      return $this->setAttribute('class', trim($current_class.' '.$class));
    } catch (XHPInvalidAttributeException $error) {
      throw new XHPException(
{'fraction_non_alphanumeric': 0.10175619834710743, 'fraction_numerical': 0.004132231404958678, 'mean_word_length': 3.4941995359628772, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3359732', 'n_tokens_mistral': 562, 'n_tokens_neox': 557, 'n_words': 213}