<commit_before><?php defined( 'ABSPATH' ) or die();

/**
 *
 *
 *
 * @since 0.7.0
 */
class WFV_Rules {


  /**
   * _construct
   *
   * @param array $rules
   */
  function __construct( $rules ) {
    $this->set( $rules );
  }

  /**
   * Push rules onto an instance of Valitron
   *
   * @since 0.7.0
   * @param object $valitron Instance of Valitron\Validator
   * @param object (optional) $messages Instance of WFV_Messages
   */
  public function push( &$valitron, $messages = null ) {

    foreach( $this as $field => $rules ) {
      //loop this field rules
      foreach( $rules as $rule ){

        // test if rule is custom
        if( $this->is_custom( $rule )) {
          // do something...
        }

        if( $messages->has($field, $rule) ) {
          $message = $messages->$field;
          $valitron->rule( $rule, $field )->message( $message[$rule] );
        } else { // use defaults
          $valitron->rule( $rule, $field );
        }
      }
    }
  }

  /**
   * Check if rule is custom
   *
   * @since 0.7.0
   * @param string $rule
   *
   * @return string|bool
   */
  public function is_custom( $rule ) {
    return ( false !== strpos( $rule, 'custom:' ) ) ? $rule : false;
  }

  /**
   * Sets supplied rules as properties on this class
   *
   * @since 0.7.0
   * @param array $rules Validation rules
   */
  private function set( $rules ) {
    foreach($rules as $field => $rule){
      $this->$field = $rule;
    }<commit_msg>phpdoc updated - method access is private<commit_after><?php defined( 'ABSPATH' ) or die();

/**
 *
 *
 *
 * @since 0.7.0
 */
class WFV_Rules {


  /**
   * _construct
   *
   * @param array $rules
   */
  function __construct( $rules ) {
    $this->set( $rules );
  }

  /**
   * Push rules onto an instance of Valitron
   *
   * @since 0.7.0
   * @param object $valitron Instance of Valitron\Validator
   * @param object (optional) $messages Instance of WFV_Messages
   */
  public function push( &$valitron, $messages = null ) {

    foreach( $this as $field => $rules ) {
      //loop this field rules
      foreach( $rules as $rule ){

        // test if rule is custom
        if( $this->is_custom( $rule )) {
          // do something...
        }

        if( $messages->has($field, $rule) ) {
          $message = $messages->$field;
          $valitron->rule( $rule, $field )->message( $message[$rule] );
        } else { // use defaults
          $valitron->rule( $rule, $field );
        }
      }
    }
  }

  /**
   * Check if rule is custom
   *
   * @since 0.7.0
   * @param string $rule
   *
   * @return string|bool
   */
  public function is_custom( $rule ) {
    return ( false !== strpos( $rule, 'custom:' ) ) ? $rule : false;
  }

  /**
   * Sets supplied rules as properties on this class
   *
   * @since 0.7.0
   * @param array $rules Validation rules
   * @access private
   */
  private function set( $rules ) {
    foreach($rules as $field => $rule){
      $this->$field = $rule;
    }
{'fraction_non_alphanumeric': 0.1569747899159664, 'fraction_numerical': 0.008067226890756302, 'mean_word_length': 2.0305498981670063, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6771540', 'n_tokens_mistral': 1014, 'n_tokens_neox': 984, 'n_words': 273}