public function create_rule( array $rules, $logical = 'and' ) {
		if ( empty( $rules ) ) {
			return null;
		}

		if ( static::is_proposition( $rules ) ) {
			$rules = [ $rules ];
		}

		if ( ! $props = $this->build_propositions( $rules ) ) {
			return null;
		}

		// Correct the "or" logical in case we have only one prop.
		if ( static::LOGICAL_OR === $logical && count( $props ) === 1 ) {
			$logical = static::LOGICAL_AND;
		}

		$logical = static::$logicals[ $logical ];

		return new Rule( new $logical( $props ) );
	}
public function create_rule( array $rules, $logical = 'and' ) {
		if ( empty( $rules ) ) {
			return null;
		}

		if ( static::is_proposition( $rules ) ) {
			$rules = [ $rules ];
		}

		if ( ! $props = $this->build_propositions( $rules ) ) {
			return null;
		}

		// Correct the "or" logical in case we have only one prop.
		if ( static::LOGICAL_OR === $logical && count( $props ) === 1 ) {
			$logical = static::LOGICAL_AND;
		}

		$logical = static::$logicals[ $logical ];

		return new Rule( new $logical( $props ) );
	}
public function create_rule ( array $ rules , $ logical = 'and' ) { if ( empty ( $ rules ) ) { return null ; } if ( static :: is_proposition ( $ rules ) ) { $ rules = [ $ rules ] ; } if ( ! $ props = $ this -> build_propositions ( $ rules ) ) { return null ; } // Correct the "or" logical in case we have only one prop. if ( static :: LOGICAL_OR === $ logical && count ( $ props ) === 1 ) { $ logical = static :: LOGICAL_AND ; } $ logical = static :: $ logicals [ $ logical ] ; return new Rule ( new $ logical ( $ props ) ) ; }
Create new rule based on an array of rules.

@param  array  $rules
@param  string $logical
@return \WPLibs\Rules\Rule|null
Create new rule based on an array of rules .